Commit b5846a74b9e567edc111c694cc6bcb3666fe4007
Merge branch 'dev' of http://61.169.120.202:8888/youxiw20000/trash into dev
Showing
9 changed files
with
149 additions
and
14 deletions
trash-garbage/pom.xml
| ... | ... | @@ -16,7 +16,29 @@ |
| 16 | 16 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 17 | 17 | </properties> |
| 18 | 18 | <dependencies> |
| 19 | - <dependency> | |
| 19 | + <dependency> | |
| 20 | + <groupId>com.google.zxing</groupId> | |
| 21 | + <artifactId>javase</artifactId> | |
| 22 | + <version>3.5.3</version> | |
| 23 | + </dependency> | |
| 24 | + | |
| 25 | + <dependency> | |
| 26 | + <groupId>com.google.zxing</groupId> | |
| 27 | + <artifactId>core</artifactId> | |
| 28 | + <version>3.5.3</version> | |
| 29 | + </dependency> | |
| 30 | + | |
| 31 | + <!-- https://mvnrepository.com/artifact/QRCode/QRCode --> | |
| 32 | + <dependency> | |
| 33 | + <groupId>com.github</groupId> | |
| 34 | + <artifactId>QRCode</artifactId> | |
| 35 | + <version>1.0.0</version> | |
| 36 | + <classifier>sources</classifier> | |
| 37 | + <type>java-source</type> | |
| 38 | + </dependency> | |
| 39 | + | |
| 40 | + | |
| 41 | + <dependency> | |
| 20 | 42 | <groupId>com.trash</groupId> |
| 21 | 43 | <artifactId>trash-common</artifactId> |
| 22 | 44 | </dependency> | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/controller/GarQRController.java
| 1 | 1 | package com.trash.garbage.controller; |
| 2 | 2 | |
| 3 | +import cn.hutool.extra.qrcode.BufferedImageLuminanceSource; | |
| 4 | +import com.google.zxing.*; | |
| 5 | +import com.google.zxing.common.HybridBinarizer; | |
| 6 | +import com.google.zxing.qrcode.QRCodeReader; | |
| 3 | 7 | import com.trash.garbage.global.Result; |
| 4 | 8 | import com.trash.garbage.service.GarQRCodeService; |
| 9 | +import org.apache.commons.io.IOUtils; | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 5 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 7 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 8 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | -import org.springframework.web.bind.annotation.RestController; | |
| 13 | +import org.springframework.web.bind.annotation.*; | |
| 14 | +import org.springframework.web.multipart.MultipartFile; | |
| 10 | 15 | |
| 16 | +import javax.imageio.ImageIO; | |
| 11 | 17 | import javax.servlet.http.HttpServletResponse; |
| 18 | +import java.awt.image.BufferedImage; | |
| 19 | +import java.io.File; | |
| 20 | +import java.io.FileInputStream; | |
| 21 | +import java.io.InputStream; | |
| 22 | +import java.util.HashMap; | |
| 23 | +import java.util.Map; | |
| 12 | 24 | |
| 13 | 25 | @RestController |
| 14 | 26 | @RequestMapping("/QRCode") |
| ... | ... | @@ -16,14 +28,53 @@ public class GarQRController { |
| 16 | 28 | |
| 17 | 29 | @Autowired |
| 18 | 30 | private GarQRCodeService qrCodeService; |
| 31 | + private Logger logger = LoggerFactory.getLogger(GarQRController.class); | |
| 19 | 32 | |
| 20 | 33 | /** |
| 21 | 34 | * 生成订单详情二维码 |
| 22 | 35 | */ |
| 23 | 36 | @GetMapping("/create/{orderId}") |
| 24 | - public Result<String> createQRCode(@PathVariable("orderId") String orderId, HttpServletResponse response){ | |
| 25 | - return Result.OK(qrCodeService.createQRCode(orderId,response)); | |
| 37 | + public Result<String> createQRCode(@PathVariable("orderId") String orderId, HttpServletResponse response) { | |
| 38 | + return Result.OK(qrCodeService.createQRCode(orderId, response)); | |
| 26 | 39 | } |
| 27 | 40 | |
| 41 | + @PostMapping("/ocr/pric") | |
| 42 | + public String uploadOcrPric(@RequestParam("file") MultipartFile file) { | |
| 43 | + InputStream inputStream = null; | |
| 44 | + BufferedImage image = null; | |
| 45 | + BinaryBitmap binaryBitmap = null; | |
| 46 | + try { | |
| 47 | + inputStream = file.getInputStream(); | |
| 48 | + image = ImageIO.read(inputStream); | |
| 49 | + LuminanceSource source = new BufferedImageLuminanceSource(image); | |
| 50 | + Binarizer binarizer = new HybridBinarizer(source); | |
| 51 | + binaryBitmap = new BinaryBitmap(binarizer); | |
| 52 | + Map<DecodeHintType, Object> hints = new HashMap<>(); | |
| 53 | + hints.put(DecodeHintType.CHARACTER_SET, "UTF-8"); | |
| 54 | + com.google.zxing.Result result = new MultiFormatReader().decode(binaryBitmap, hints); | |
| 28 | 55 | |
| 56 | + image.flush(); | |
| 57 | + return result.getText(); | |
| 58 | + } catch (Exception e) { | |
| 59 | + logger.error("识别图片错误", e); | |
| 60 | + ocrPric1(binaryBitmap); | |
| 61 | + } finally { | |
| 62 | + IOUtils.closeQuietly(inputStream); | |
| 63 | + } | |
| 64 | + return ""; | |
| 65 | + } | |
| 66 | + | |
| 67 | + private String ocrPric1(BinaryBitmap binaryBitmap) { | |
| 68 | + try { | |
| 69 | + Map<DecodeHintType, Object> hints = new HashMap<>(); | |
| 70 | + hints.put(DecodeHintType.CHARACTER_SET, "UTF-8"); | |
| 71 | + hints.put(DecodeHintType.TRY_HARDER,true); | |
| 72 | + hints.put(DecodeHintType.PURE_BARCODE,true); | |
| 73 | + com.google.zxing.Result result = new MultiFormatReader().decode(binaryBitmap, hints); | |
| 74 | + System.out.println(result.getText()); | |
| 75 | + } catch (ReaderException e) { | |
| 76 | + logger.error("识别图片错误", e); | |
| 77 | + } | |
| 78 | + return ""; | |
| 79 | + } | |
| 29 | 80 | } | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageCarController.java
| ... | ... | @@ -3,12 +3,18 @@ package com.trash.garbage.controller; |
| 3 | 3 | import com.trash.common.annotation.Log; |
| 4 | 4 | import com.trash.common.core.domain.AjaxResult; |
| 5 | 5 | import com.trash.common.enums.BusinessType; |
| 6 | +import com.trash.enterprise.domain.TransportationEnterprise; | |
| 6 | 7 | import com.trash.garbage.global.Result; |
| 7 | 8 | import com.trash.garbage.pojo.domain.DockingQRCodeEntity; |
| 8 | 9 | import com.trash.garbage.pojo.dto.DockingQRCodeDTO; |
| 9 | 10 | import com.trash.garbage.pojo.dto.OrderDto; |
| 11 | +import com.trash.garbage.pojo.vo.DispatchDisposalVo; | |
| 12 | +import com.trash.garbage.service.GarOrderMatchDisposalService; | |
| 10 | 13 | import com.trash.garbage.service.GarOrderService; |
| 14 | +import com.trash.garbage.service.GarTransportationEnterpriseService; | |
| 15 | +import jdk.nashorn.internal.runtime.options.Option; | |
| 11 | 16 | import lombok.extern.slf4j.Slf4j; |
| 17 | +import org.apache.commons.collections4.CollectionUtils; | |
| 12 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 19 | import org.springframework.validation.BindingResult; |
| 14 | 20 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -18,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 18 | 24 | import org.springframework.web.bind.annotation.RestController; |
| 19 | 25 | |
| 20 | 26 | import java.util.List; |
| 27 | +import java.util.Objects; | |
| 28 | +import java.util.Optional; | |
| 29 | +import java.util.stream.Collectors; | |
| 21 | 30 | |
| 22 | 31 | @RestController |
| 23 | 32 | @RequestMapping("/car/order") |
| ... | ... | @@ -25,6 +34,10 @@ import java.util.List; |
| 25 | 34 | public class GarbageCarController { |
| 26 | 35 | @Autowired |
| 27 | 36 | private GarOrderService garOrderService; |
| 37 | + @Autowired | |
| 38 | + private GarTransportationEnterpriseService garTransportationEnterpriseService; | |
| 39 | + @Autowired | |
| 40 | + private GarOrderMatchDisposalService garOrderMatchDisposalService; | |
| 28 | 41 | |
| 29 | 42 | @PostMapping("/processing") |
| 30 | 43 | public Result<?> saveOrder(@Validated @RequestBody DockingQRCodeDTO dto, BindingResult bindingResult) { |
| ... | ... | @@ -33,6 +46,18 @@ public class GarbageCarController { |
| 33 | 46 | } |
| 34 | 47 | List<DockingQRCodeEntity> entities = garOrderService.queryReportByCarCode(dto.getCarCode()); |
| 35 | 48 | |
| 49 | + List<DispatchDisposalVo> vos = garOrderMatchDisposalService.requestDisposalListWithDispatch(); | |
| 50 | + if (CollectionUtils.isNotEmpty(vos) && CollectionUtils.isNotEmpty(entities)) { | |
| 51 | + entities = entities.stream().map(e -> { | |
| 52 | + Optional<DispatchDisposalVo> optional = vos.stream().filter(v -> Objects.equals(v.getGarOrderDisposalCompanyId(), e.getGarOrderDisposalCompanyId())).findFirst(); | |
| 53 | + if (optional.isPresent()) { | |
| 54 | + e.setDsName(optional.get().getGarOrderDisposalCompanyName()); | |
| 55 | + e.setDsAddress(optional.get().getBuildCompanyAddress()); | |
| 56 | + } | |
| 57 | + return e; | |
| 58 | + }).collect(Collectors.toList()); | |
| 59 | + } | |
| 60 | + | |
| 36 | 61 | return Result.OK(entities); |
| 37 | 62 | } |
| 38 | 63 | } | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/DockingQRCodeEntity.java
| ... | ... | @@ -11,6 +11,8 @@ public class DockingQRCodeEntity implements java.io.Serializable { |
| 11 | 11 | private String dsAddress;//场地地址 |
| 12 | 12 | private String dsLocalArea;//场地所属区域 |
| 13 | 13 | private String dsName;//处置场所名称 |
| 14 | + private String garOrderDisposalCompanyId; | |
| 15 | + | |
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | public String getGarOrderAddress() { |
| ... | ... | @@ -84,4 +86,12 @@ public class DockingQRCodeEntity implements java.io.Serializable { |
| 84 | 86 | public void setDsName(String dsName) { |
| 85 | 87 | this.dsName = dsName; |
| 86 | 88 | } |
| 89 | + | |
| 90 | + public String getGarOrderDisposalCompanyId() { | |
| 91 | + return garOrderDisposalCompanyId; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setGarOrderDisposalCompanyId(String garOrderDisposalCompanyId) { | |
| 95 | + this.garOrderDisposalCompanyId = garOrderDisposalCompanyId; | |
| 96 | + } | |
| 87 | 97 | } | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/DispatchDisposalVo.java
| ... | ... | @@ -24,6 +24,7 @@ public class DispatchDisposalVo { |
| 24 | 24 | private String garOrderDisposalCompanyName; |
| 25 | 25 | private String garOrderDisposalCompanyId; |
| 26 | 26 | private boolean check=false; |
| 27 | + private String buildCompanyAddress; | |
| 27 | 28 | |
| 28 | 29 | public boolean isCheck() { |
| 29 | 30 | return check; |
| ... | ... | @@ -100,4 +101,11 @@ public class DispatchDisposalVo { |
| 100 | 101 | this.personnelInfo = personnelInfo; |
| 101 | 102 | } |
| 102 | 103 | |
| 104 | + public String getBuildCompanyAddress() { | |
| 105 | + return buildCompanyAddress; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setBuildCompanyAddress(String buildCompanyAddress) { | |
| 109 | + this.buildCompanyAddress = buildCompanyAddress; | |
| 110 | + } | |
| 103 | 111 | } | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderMatchDisposalServiceImpl.java
| ... | ... | @@ -115,6 +115,7 @@ public class GarOrderMatchDisposalServiceImpl extends ServiceImpl<GarOrderMatchD |
| 115 | 115 | DispatchDisposalVo vo = new DispatchDisposalVo(); |
| 116 | 116 | vo.setGarOrderDisposalCompanyId(obj.getString("id")); |
| 117 | 117 | vo.setGarOrderDisposalCompanyName(obj.getString("name")); |
| 118 | + vo.setBuildCompanyAddress(obj.getString("BuildCompanyAddress")); | |
| 118 | 119 | |
| 119 | 120 | List<DispatchDisposalVo.Personnel> personnelInfos = new ArrayList<>(); |
| 120 | 121 | DispatchDisposalVo.Personnel personnel = new DispatchDisposalVo.Personnel(); | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/utils/HttpUtil.java
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
| ... | ... | @@ -260,12 +260,12 @@ |
| 260 | 260 | </select> |
| 261 | 261 | <select id="queryReportByCarCode" resultType="com.trash.garbage.pojo.domain.DockingQRCodeEntity"> |
| 262 | 262 | select go2.gar_order_address garOrderAddress ,go2.gar_order_address_details garOrderAddressDetails ,go2.gar_order_agreement_time garOrderAgreementTime, |
| 263 | - gu.gar_user_name garUserName,gu.gar_user_tel garUserTel,goc.container_volume containerVolume,ds.address dsAddress,ds.local_area dsLocalArea ,ds.name dsName | |
| 263 | + gu.gar_user_name garUserName,gu.gar_user_tel garUserTel,goc.container_volume containerVolume | |
| 264 | + ,gomd.gar_order_disposal_company_id garOrderDisposalCompanyId | |
| 264 | 265 | from gar_order go2 |
| 265 | 266 | left join gar_user gu on gu.gar_user_id =go2.gar_order_user_id |
| 266 | 267 | left join gar_order_car goc on goc.gar_order_id =go2.gar_order_id |
| 267 | 268 | left join gar_order_match_disposal gomd on gomd.gar_order_id=go2.gar_order_id |
| 268 | - left join disposal_site ds on ds.id = gomd.gar_order_disposal_company_id | |
| 269 | 269 | left join gar_order_match_handler gomh on gomh.gar_order_id =go2.gar_order_id |
| 270 | 270 | where gomh.gar_handler_car_code=#{carCode} |
| 271 | 271 | AND gomh.gar_cancel_flag = 0 | ... | ... |
trash-ui/src/views/unit/dropPointInfo/index.vue
| ... | ... | @@ -93,7 +93,13 @@ |
| 93 | 93 | }}</span> |
| 94 | 94 | </template> |
| 95 | 95 | </el-table-column> |
| 96 | - <el-table-column label="社区" align="center" prop="community"/> | |
| 96 | + <el-table-column label="社区" align="center" prop="community"> | |
| 97 | + <template slot-scope="scope"> | |
| 98 | + <span>{{ | |
| 99 | + communitysInfo(scope.row.community) | |
| 100 | + }}</span> | |
| 101 | + </template> | |
| 102 | + </el-table-column> | |
| 97 | 103 | <el-table-column label="小区" align="center" prop="plot"/> |
| 98 | 104 | <el-table-column label="详细地址" align="center" prop="address"/> |
| 99 | 105 | <el-table-column label="投放点形式" align="center" prop="type"/> |
| ... | ... | @@ -448,19 +454,31 @@ export default { |
| 448 | 454 | dict(code){ |
| 449 | 455 | for(let key in this.areas){ |
| 450 | 456 | if(this.areas[key].code === code){ |
| 457 | + // this.streets = this.areas[key].items; | |
| 451 | 458 | return this.areas[key].name; |
| 452 | 459 | } |
| 453 | 460 | } |
| 454 | 461 | }, |
| 455 | 462 | dictInfo(code){ |
| 456 | 463 | for(let key in this.areas){ |
| 457 | - for(let keyInfo in this.areas[key].streets){ | |
| 458 | - if(this.areas[key].streets[keyInfo].code === code){ | |
| 459 | - return this.areas[key].streets[keyInfo].name; | |
| 464 | + for(let key1 in this.areas[key].items){ | |
| 465 | + if(this.areas[key].items[key1].code === code){ | |
| 466 | + return this.areas[key].items[key1].name; | |
| 460 | 467 | } |
| 461 | 468 | } |
| 462 | 469 | } |
| 463 | 470 | }, |
| 471 | + communitysInfo(code){ | |
| 472 | + for(let key in this.areas){ | |
| 473 | + for(let key1 in this.areas[key].items){ | |
| 474 | + for (let key2 in this.areas[key].items[key1].items){ | |
| 475 | + if (this.areas[key].items[key1].items[key2].code === code){ | |
| 476 | + return this.areas[key].items[key1].items[key2].name; | |
| 477 | + } | |
| 478 | + } | |
| 479 | + } | |
| 480 | + } | |
| 481 | + }, | |
| 464 | 482 | clearCoordinatePoint(){ |
| 465 | 483 | this.center = null; |
| 466 | 484 | this.form.coordinatePoint = null; | ... | ... |