From 1869760c524d83b141800254a04921a5d96aaf6e Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Fri, 14 Jul 2023 15:46:10 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=8E=A8=E9=80=81=E8=BF=90?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E6=8D=AE=E5=AD=98=E6=94=BE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oldproject/entity/WaybillDesEntity.java | 77 ++++++++++++++++ .../oldproject/feign/IWaybillDesClient.java | 20 +++++ .../oldproject/feign/WaybillDesClient.java | 22 +++++ .../oldproject/mapper/WaybillDesMapper.java | 12 +++ .../service/IWaybillDesService.java | 11 +++ .../service/impl/WaybillDesServiceImpl.java | 27 ++++++ .../controller/OldSystemPushController.java | 23 ++--- .../com/logpm/warehouse/dto/WaybillDTO.java | 9 +- .../IWarehouseWayBillDetailService.java | 4 + .../WarehouseWayBillDetailServiceImpl.java | 12 +++ .../impl/WarehouseWaybillServiceImpl.java | 87 ++++++++++++------- 11 files changed, 258 insertions(+), 46 deletions(-) create mode 100644 blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java create mode 100644 blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java create mode 100644 blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java create mode 100644 blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java create mode 100644 blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java create mode 100644 blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java new file mode 100644 index 000000000..b353965e6 --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/WaybillDesEntity.java @@ -0,0 +1,77 @@ +package com.logpm.oldproject.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@ApiModel(value = "运单表",description = "") +@Data +@TableName("ht_waybill_des") +public class WaybillDesEntity implements Serializable,Cloneable { + + /** ID */ + @TableId( + value = "id", + type = IdType.AUTO + ) + private Integer id; + + @ApiModelProperty(name = "运单号") + private String waybillNo; + + @ApiModelProperty(name = "运单id") + private Integer wayBillId; + + @ApiModelProperty(name = "二级品") + private String firstName; + + @ApiModelProperty(name = "货物名称") + private String name; + + @ApiModelProperty(name = "包装") + private String pocket; + + @ApiModelProperty(name = "件数") + private Integer num; + + @ApiModelProperty(name = "重量") + private BigDecimal weight; + + @ApiModelProperty(name = "体积") + private BigDecimal volume; + + @ApiModelProperty(name = "单价") + private BigDecimal price; + + @ApiModelProperty(name = "单位") + private Integer pic; + + @ApiModelProperty(name = "运费小计") + private BigDecimal totalDesPrice; + + @ApiModelProperty(name = "创建时间") + private Date createTime; + + @ApiModelProperty(name = "修改时间") + private Date updateTime; + + @ApiModelProperty(name = "删除时间") + private Integer delete_time; + + @ApiModelProperty(name = "") + private Integer oldId; + + @ApiModelProperty(name = "价格id") + private Integer secPriceId; + + @ApiModelProperty(name = "价格信息") + private String priceInfo; + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java new file mode 100644 index 000000000..e671e23bc --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWaybillDesClient.java @@ -0,0 +1,20 @@ +package com.logpm.oldproject.feign; + +import com.logpm.oldproject.entity.WaybillDesEntity; +import org.springblade.common.constant.ModuleNameConstant; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.List; + +@FeignClient( + value = ModuleNameConstant.APPLICATION_OLDPROJECT_NAME +) +public interface IWaybillDesClient { + + String API_PREFIX = "/client"; + + @GetMapping(API_PREFIX + "/getDesList") + List getDesList(@RequestParam String waybillNo); + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java new file mode 100644 index 000000000..b1f54333b --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WaybillDesClient.java @@ -0,0 +1,22 @@ +package com.logpm.oldproject.feign; + +import com.logpm.oldproject.entity.WaybillDesEntity; +import com.logpm.oldproject.service.IWaybillDesService; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; + +@ApiIgnore() +@RestController +@AllArgsConstructor +public class WaybillDesClient implements IWaybillDesClient{ + + private final IWaybillDesService waybillDesService; + + @Override + public List getDesList(String waybillNo) { + return waybillDesService.getDesList(waybillNo); + } +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java new file mode 100644 index 000000000..80bd9f2d7 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/WaybillDesMapper.java @@ -0,0 +1,12 @@ +package com.logpm.oldproject.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.oldproject.entity.WaybillDesEntity; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface WaybillDesMapper extends BaseMapper { + + + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java new file mode 100644 index 000000000..d69905d17 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWaybillDesService.java @@ -0,0 +1,11 @@ +package com.logpm.oldproject.service; + +import com.logpm.oldproject.entity.WaybillDesEntity; + +import java.util.List; + +public interface IWaybillDesService { + + List getDesList(String waybillNo); + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java new file mode 100644 index 000000000..1ddd3db3d --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WaybillDesServiceImpl.java @@ -0,0 +1,27 @@ +package com.logpm.oldproject.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.oldproject.entity.WaybillDesEntity; +import com.logpm.oldproject.mapper.WaybillDesMapper; +import com.logpm.oldproject.service.IWaybillDesService; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Log4j2 +@Service +@AllArgsConstructor +public class WaybillDesServiceImpl implements IWaybillDesService { + + private final WaybillDesMapper waybillDesMapper; + + @Override + public List getDesList(String waybillNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("waybill_no",waybillNo); + + return waybillDesMapper.selectList(queryWrapper); + } +} diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java index 5803463c6..99c7052e1 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -44,25 +45,27 @@ public class OldSystemPushController { @PostMapping("/sendWaybillData") @ApiOperationSupport(order = 1) @ApiOperation(value = "运单数据推送", notes = "传入waybillDTO") - public R sendWaybillData(@Validated @RequestBody WaybillDTO waybillDTO) { - log.info("############sendWaybillData: 请求参数{}",waybillDTO); + public R sendWaybillData(@Validated @RequestBody List waybillDTOS) { + log.info("############sendWaybillData: 请求参数{}",waybillDTOS); try{ //先保存原始请求数据 WarehouseLog warehouseLog = new WarehouseLog(); - warehouseLog.setArgs(JSONObject.toJSONString(waybillDTO)); + warehouseLog.setArgs(JSONObject.toJSONString(waybillDTOS)); warehouseLog.setStatus(1); warehouseLog.setType(1); warehouseLogService.save(warehouseLog); - Map map=new HashMap<>(); - map.put("messageId", CommonUtil.getUUID()); - map.put("logId", warehouseLog.getId()); - map.put("messageData",waybillDTO); - map.put("createTime",new Date().getTime()); + for(WaybillDTO waybillDTO:waybillDTOS){ + Map map=new HashMap<>(); + map.put("messageId", CommonUtil.getUUID()); + map.put("logId", warehouseLog.getId()); + map.put("messageData",waybillDTO); + map.put("createTime",new Date().getTime()); - //把推送数据推入队列 - rabbitTemplate.convertAndSend(RabbitConstant.WAYBILL_DATA_EXCHANGE, RabbitConstant.WAYBILL_DATA_ROUTING, map); + //把推送数据推入队列 + rabbitTemplate.convertAndSend(RabbitConstant.WAYBILL_DATA_EXCHANGE, RabbitConstant.WAYBILL_DATA_ROUTING, map); + } return R.success("调用成功"); }catch (CustomerException e){ diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java index 3d97062b7..c4ed116da 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/WaybillDTO.java @@ -3,8 +3,6 @@ package com.logpm.warehouse.dto; import lombok.Data; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; @Data public class WaybillDTO implements Serializable { @@ -14,9 +12,10 @@ public class WaybillDTO implements Serializable { */ private String waybillNo; - - private List productList = new ArrayList<>(); - + /** + * 实际入库数量 + */ + private Integer number; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java index 2125fcd1d..0c0369eb8 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseWayBillDetailService.java @@ -12,4 +12,8 @@ public interface IWarehouseWayBillDetailService { void update(WarehouseWayBillDetail warehouseWayBillDetail); List findByWaybillId(Long waybillId); + + WarehouseWayBillDetail findByWaybillIdAndGoodsName(Long waybillId, String goodsName); + + void addList(List ls); } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java index 69832d041..457135afe 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWayBillDetailServiceImpl.java @@ -40,4 +40,16 @@ public class WarehouseWayBillDetailServiceImpl implements IWarehouseWayBillDetai queryWrapper.eq("waybill_id",waybillId); return warehouseWayBillDetailMapper.selectList(queryWrapper); } + + @Override + public WarehouseWayBillDetail findByWaybillIdAndGoodsName(Long waybillId, String goodsName) { + return null; + } + + @Override + public void addList(List ls) { + for (WarehouseWayBillDetail warehouseWayBillDetail:ls){ + warehouseWayBillDetailMapper.insert(warehouseWayBillDetail); + } + } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index a69928c00..209eb1972 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -14,7 +14,9 @@ import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.feign.IDistributionParcelListClient; import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.oldproject.entity.WayBillEntity; +import com.logpm.oldproject.entity.WaybillDesEntity; import com.logpm.oldproject.feign.IWayBillClient; +import com.logpm.oldproject.feign.IWaybillDesClient; import com.logpm.warehouse.dto.ProductDTO; import com.logpm.warehouse.dto.SplitOrderDTO; import com.logpm.warehouse.dto.WaybillDTO; @@ -50,6 +52,7 @@ import java.util.Objects; public class WarehouseWaybillServiceImpl extends BaseServiceImpl implements IWarehouseWaybillService { private final WarehouseWaybillMapper warehouseWaybillMapper; private final IWayBillClient wayBillClient; + private final IWaybillDesClient waybillDesClient; private final IBasicdataWarehouseClient basicdataWarehouseClient; private final IBasicdataClientClient basicdataClientClient; private final IBasicdataStoreBusinessClient basicdataStoreBusinessClient; @@ -67,15 +70,14 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl productList = waybillDTO.getProductList(); + Integer allNum = waybillDTO.getNumber(); Date date = new Date(); - Integer allNum = 0; Long waybillId = null; boolean isOrder = false; - for (ProductDTO productDTO : productList) { - Integer num = productDTO.getNum(); - allNum = allNum + num; - } +// for (ProductDTO productDTO : productList) { +// Integer num = productDTO.getNum(); +// allNum = allNum + num; +// } log.info("###############waybillDataHandler: 处理数据开始 waybillNo={}", waybillNo); //通过运单号先去查询新系统是否存在这个运单号 @@ -86,7 +88,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl 0) { log.warn("##############waybillDataHandler: 运单的总数量异常 allNum={} number={}", allNum, number); @@ -133,7 +136,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl des = waybillDesClient.getDesList(waybillNo); + List ls = new ArrayList<>(); + for (WaybillDesEntity waybillDesEntity : des) { + WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail(); + warehouseWayBillDetail.setWaybillId(waybillId); + warehouseWayBillDetail.setWaybillNo(waybillNo); + warehouseWayBillDetail.setProductName(waybillDesEntity.getName()); + warehouseWayBillDetail.setNum(waybillDesEntity.getNum()); + warehouseWayBillDetail.setStatus(1); + warehouseWayBillDetail.setIsDeleted(0); + warehouseWayBillDetail.setCreateTime(date); + warehouseWayBillDetail.setUpdateTime(date); + ls.add(warehouseWayBillDetail); + } + warehouseWayBillDetailService.addList(ls); + //判断是否需要创建在库订单 if (allNum.compareTo(number) == 0) { isOrder = true; @@ -179,28 +200,32 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl