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,7 +16,29 @@ | ||
| 16 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 16 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 17 | </properties> | 17 | </properties> |
| 18 | <dependencies> | 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 | <groupId>com.trash</groupId> | 42 | <groupId>com.trash</groupId> |
| 21 | <artifactId>trash-common</artifactId> | 43 | <artifactId>trash-common</artifactId> |
| 22 | </dependency> | 44 | </dependency> |
trash-garbage/src/main/java/com/trash/garbage/controller/GarQRController.java
| 1 | package com.trash.garbage.controller; | 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 | import com.trash.garbage.global.Result; | 7 | import com.trash.garbage.global.Result; |
| 4 | import com.trash.garbage.service.GarQRCodeService; | 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 | import org.springframework.beans.factory.annotation.Autowired; | 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 | import javax.servlet.http.HttpServletResponse; | 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 | @RestController | 25 | @RestController |
| 14 | @RequestMapping("/QRCode") | 26 | @RequestMapping("/QRCode") |
| @@ -16,14 +28,53 @@ public class GarQRController { | @@ -16,14 +28,53 @@ public class GarQRController { | ||
| 16 | 28 | ||
| 17 | @Autowired | 29 | @Autowired |
| 18 | private GarQRCodeService qrCodeService; | 30 | private GarQRCodeService qrCodeService; |
| 31 | + private Logger logger = LoggerFactory.getLogger(GarQRController.class); | ||
| 19 | 32 | ||
| 20 | /** | 33 | /** |
| 21 | * 生成订单详情二维码 | 34 | * 生成订单详情二维码 |
| 22 | */ | 35 | */ |
| 23 | @GetMapping("/create/{orderId}") | 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,12 +3,18 @@ package com.trash.garbage.controller; | ||
| 3 | import com.trash.common.annotation.Log; | 3 | import com.trash.common.annotation.Log; |
| 4 | import com.trash.common.core.domain.AjaxResult; | 4 | import com.trash.common.core.domain.AjaxResult; |
| 5 | import com.trash.common.enums.BusinessType; | 5 | import com.trash.common.enums.BusinessType; |
| 6 | +import com.trash.enterprise.domain.TransportationEnterprise; | ||
| 6 | import com.trash.garbage.global.Result; | 7 | import com.trash.garbage.global.Result; |
| 7 | import com.trash.garbage.pojo.domain.DockingQRCodeEntity; | 8 | import com.trash.garbage.pojo.domain.DockingQRCodeEntity; |
| 8 | import com.trash.garbage.pojo.dto.DockingQRCodeDTO; | 9 | import com.trash.garbage.pojo.dto.DockingQRCodeDTO; |
| 9 | import com.trash.garbage.pojo.dto.OrderDto; | 10 | import com.trash.garbage.pojo.dto.OrderDto; |
| 11 | +import com.trash.garbage.pojo.vo.DispatchDisposalVo; | ||
| 12 | +import com.trash.garbage.service.GarOrderMatchDisposalService; | ||
| 10 | import com.trash.garbage.service.GarOrderService; | 13 | import com.trash.garbage.service.GarOrderService; |
| 14 | +import com.trash.garbage.service.GarTransportationEnterpriseService; | ||
| 15 | +import jdk.nashorn.internal.runtime.options.Option; | ||
| 11 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| 17 | +import org.apache.commons.collections4.CollectionUtils; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.validation.BindingResult; | 19 | import org.springframework.validation.BindingResult; |
| 14 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
| @@ -18,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -18,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | import org.springframework.web.bind.annotation.RestController; | 24 | import org.springframework.web.bind.annotation.RestController; |
| 19 | 25 | ||
| 20 | import java.util.List; | 26 | import java.util.List; |
| 27 | +import java.util.Objects; | ||
| 28 | +import java.util.Optional; | ||
| 29 | +import java.util.stream.Collectors; | ||
| 21 | 30 | ||
| 22 | @RestController | 31 | @RestController |
| 23 | @RequestMapping("/car/order") | 32 | @RequestMapping("/car/order") |
| @@ -25,6 +34,10 @@ import java.util.List; | @@ -25,6 +34,10 @@ import java.util.List; | ||
| 25 | public class GarbageCarController { | 34 | public class GarbageCarController { |
| 26 | @Autowired | 35 | @Autowired |
| 27 | private GarOrderService garOrderService; | 36 | private GarOrderService garOrderService; |
| 37 | + @Autowired | ||
| 38 | + private GarTransportationEnterpriseService garTransportationEnterpriseService; | ||
| 39 | + @Autowired | ||
| 40 | + private GarOrderMatchDisposalService garOrderMatchDisposalService; | ||
| 28 | 41 | ||
| 29 | @PostMapping("/processing") | 42 | @PostMapping("/processing") |
| 30 | public Result<?> saveOrder(@Validated @RequestBody DockingQRCodeDTO dto, BindingResult bindingResult) { | 43 | public Result<?> saveOrder(@Validated @RequestBody DockingQRCodeDTO dto, BindingResult bindingResult) { |
| @@ -33,6 +46,18 @@ public class GarbageCarController { | @@ -33,6 +46,18 @@ public class GarbageCarController { | ||
| 33 | } | 46 | } |
| 34 | List<DockingQRCodeEntity> entities = garOrderService.queryReportByCarCode(dto.getCarCode()); | 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 | return Result.OK(entities); | 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,6 +11,8 @@ public class DockingQRCodeEntity implements java.io.Serializable { | ||
| 11 | private String dsAddress;//场地地址 | 11 | private String dsAddress;//场地地址 |
| 12 | private String dsLocalArea;//场地所属区域 | 12 | private String dsLocalArea;//场地所属区域 |
| 13 | private String dsName;//处置场所名称 | 13 | private String dsName;//处置场所名称 |
| 14 | + private String garOrderDisposalCompanyId; | ||
| 15 | + | ||
| 14 | 16 | ||
| 15 | 17 | ||
| 16 | public String getGarOrderAddress() { | 18 | public String getGarOrderAddress() { |
| @@ -84,4 +86,12 @@ public class DockingQRCodeEntity implements java.io.Serializable { | @@ -84,4 +86,12 @@ public class DockingQRCodeEntity implements java.io.Serializable { | ||
| 84 | public void setDsName(String dsName) { | 86 | public void setDsName(String dsName) { |
| 85 | this.dsName = dsName; | 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,6 +24,7 @@ public class DispatchDisposalVo { | ||
| 24 | private String garOrderDisposalCompanyName; | 24 | private String garOrderDisposalCompanyName; |
| 25 | private String garOrderDisposalCompanyId; | 25 | private String garOrderDisposalCompanyId; |
| 26 | private boolean check=false; | 26 | private boolean check=false; |
| 27 | + private String buildCompanyAddress; | ||
| 27 | 28 | ||
| 28 | public boolean isCheck() { | 29 | public boolean isCheck() { |
| 29 | return check; | 30 | return check; |
| @@ -100,4 +101,11 @@ public class DispatchDisposalVo { | @@ -100,4 +101,11 @@ public class DispatchDisposalVo { | ||
| 100 | this.personnelInfo = personnelInfo; | 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,6 +115,7 @@ public class GarOrderMatchDisposalServiceImpl extends ServiceImpl<GarOrderMatchD | ||
| 115 | DispatchDisposalVo vo = new DispatchDisposalVo(); | 115 | DispatchDisposalVo vo = new DispatchDisposalVo(); |
| 116 | vo.setGarOrderDisposalCompanyId(obj.getString("id")); | 116 | vo.setGarOrderDisposalCompanyId(obj.getString("id")); |
| 117 | vo.setGarOrderDisposalCompanyName(obj.getString("name")); | 117 | vo.setGarOrderDisposalCompanyName(obj.getString("name")); |
| 118 | + vo.setBuildCompanyAddress(obj.getString("BuildCompanyAddress")); | ||
| 118 | 119 | ||
| 119 | List<DispatchDisposalVo.Personnel> personnelInfos = new ArrayList<>(); | 120 | List<DispatchDisposalVo.Personnel> personnelInfos = new ArrayList<>(); |
| 120 | DispatchDisposalVo.Personnel personnel = new DispatchDisposalVo.Personnel(); | 121 | DispatchDisposalVo.Personnel personnel = new DispatchDisposalVo.Personnel(); |
trash-garbage/src/main/java/com/trash/garbage/utils/HttpUtil.java
| @@ -62,7 +62,7 @@ public class HttpUtil { | @@ -62,7 +62,7 @@ public class HttpUtil { | ||
| 62 | .timeout(15000); | 62 | .timeout(15000); |
| 63 | 63 | ||
| 64 | json = request.execute().body(); | 64 | json = request.execute().body(); |
| 65 | - LOGGER.info(url + ";,returnJson:[" + json + "]"); | 65 | + LOGGER.info(url + ";returnJson:[" + json + "]"); |
| 66 | return json; | 66 | return json; |
| 67 | } | 67 | } |
| 68 | 68 |
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
| @@ -260,12 +260,12 @@ | @@ -260,12 +260,12 @@ | ||
| 260 | </select> | 260 | </select> |
| 261 | <select id="queryReportByCarCode" resultType="com.trash.garbage.pojo.domain.DockingQRCodeEntity"> | 261 | <select id="queryReportByCarCode" resultType="com.trash.garbage.pojo.domain.DockingQRCodeEntity"> |
| 262 | select go2.gar_order_address garOrderAddress ,go2.gar_order_address_details garOrderAddressDetails ,go2.gar_order_agreement_time garOrderAgreementTime, | 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 | from gar_order go2 | 265 | from gar_order go2 |
| 265 | left join gar_user gu on gu.gar_user_id =go2.gar_order_user_id | 266 | left join gar_user gu on gu.gar_user_id =go2.gar_order_user_id |
| 266 | left join gar_order_car goc on goc.gar_order_id =go2.gar_order_id | 267 | left join gar_order_car goc on goc.gar_order_id =go2.gar_order_id |
| 267 | left join gar_order_match_disposal gomd on gomd.gar_order_id=go2.gar_order_id | 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 | left join gar_order_match_handler gomh on gomh.gar_order_id =go2.gar_order_id | 269 | left join gar_order_match_handler gomh on gomh.gar_order_id =go2.gar_order_id |
| 270 | where gomh.gar_handler_car_code=#{carCode} | 270 | where gomh.gar_handler_car_code=#{carCode} |
| 271 | AND gomh.gar_cancel_flag = 0 | 271 | AND gomh.gar_cancel_flag = 0 |
trash-ui/src/views/unit/dropPointInfo/index.vue
| @@ -93,7 +93,13 @@ | @@ -93,7 +93,13 @@ | ||
| 93 | }}</span> | 93 | }}</span> |
| 94 | </template> | 94 | </template> |
| 95 | </el-table-column> | 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 | <el-table-column label="小区" align="center" prop="plot"/> | 103 | <el-table-column label="小区" align="center" prop="plot"/> |
| 98 | <el-table-column label="详细地址" align="center" prop="address"/> | 104 | <el-table-column label="详细地址" align="center" prop="address"/> |
| 99 | <el-table-column label="投放点形式" align="center" prop="type"/> | 105 | <el-table-column label="投放点形式" align="center" prop="type"/> |
| @@ -448,19 +454,31 @@ export default { | @@ -448,19 +454,31 @@ export default { | ||
| 448 | dict(code){ | 454 | dict(code){ |
| 449 | for(let key in this.areas){ | 455 | for(let key in this.areas){ |
| 450 | if(this.areas[key].code === code){ | 456 | if(this.areas[key].code === code){ |
| 457 | + // this.streets = this.areas[key].items; | ||
| 451 | return this.areas[key].name; | 458 | return this.areas[key].name; |
| 452 | } | 459 | } |
| 453 | } | 460 | } |
| 454 | }, | 461 | }, |
| 455 | dictInfo(code){ | 462 | dictInfo(code){ |
| 456 | for(let key in this.areas){ | 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 | clearCoordinatePoint(){ | 482 | clearCoordinatePoint(){ |
| 465 | this.center = null; | 483 | this.center = null; |
| 466 | this.form.coordinatePoint = null; | 484 | this.form.coordinatePoint = null; |