From 0d9122d6effe01f69848a1a0519d22dd651a0ce9 Mon Sep 17 00:00:00 2001 From: chenhc <2369838784@qq.com> Date: Fri, 22 Nov 2024 10:58:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/api/entity/thrsys/ThrInvOrder.java | 4 +- .../api/entity/thrsys/ThrInvOrderDetail.java | 15 +++ .../api/res/thrsys/ThrInvOrderResponse.java | 1 + .../thrsys/impl/ThrInvOrderServiceImpl.java | 112 ++++++++++++------ src/main/resources/schemas/schema_v2.4.sql | 2 + 5 files changed, 97 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrder.java b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrder.java index 81f9f0949..b3e0c1d45 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrder.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrder.java @@ -62,11 +62,13 @@ public class ThrInvOrder implements Serializable { * 部门编码 */ private String deptCode; + private String deptName; /** * 仓库编码 */ private String invCode; + private String invName; /** * 货位编码 @@ -145,7 +147,7 @@ public class ThrInvOrder implements Serializable { /** * 收费时间 */ - private Date chargeTime; + private String chargeTime; /** * 收费人员 diff --git a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java index 67683abfb..6d0ff93b0 100644 --- a/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java +++ b/src/main/java/com/glxp/api/entity/thrsys/ThrInvOrderDetail.java @@ -1,8 +1,10 @@ package com.glxp.api.entity.thrsys; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import groovy.transform.Field; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -187,4 +189,17 @@ public class ThrInvOrderDetail implements Serializable { private static final long serialVersionUID = 1L; + /** + * 收费时间 + */ + @TableField( exist = false ) + private String chargeTime; + + /** + * 收费人员 + */ + @TableField( exist = false ) + private String chargeUser; + + } diff --git a/src/main/java/com/glxp/api/res/thrsys/ThrInvOrderResponse.java b/src/main/java/com/glxp/api/res/thrsys/ThrInvOrderResponse.java index 476d5e34c..acc9232fb 100644 --- a/src/main/java/com/glxp/api/res/thrsys/ThrInvOrderResponse.java +++ b/src/main/java/com/glxp/api/res/thrsys/ThrInvOrderResponse.java @@ -10,6 +10,7 @@ public class ThrInvOrderResponse { private String billTypeName; private String invName; + private String deptName; private Long id; /** diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java index fa197bd93..9cc423d63 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvOrderServiceImpl.java @@ -2,6 +2,7 @@ package com.glxp.api.service.thrsys.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -14,6 +15,7 @@ import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.Constant; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.constant.ConstantType; +import com.glxp.api.dao.basic.ProductInfoDao; import com.glxp.api.dao.basic.UdiRelevanceDao; import com.glxp.api.dao.inout.IoCodeTempDao; import com.glxp.api.dao.thrsys.ThrInvOrderDetailMapper; @@ -113,6 +115,8 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { IoAddInoutService addInoutService; @Resource UdiCalCountUtil udiCalCountUtil; + @Resource + ProductInfoDao productInfoDao; // 设置要输出的日期格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); @@ -174,32 +178,38 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { @Override public void handleExternalThrInvPhOrder(FilterInvProductRequest filterInvProductRequest) { BaseResponse> baseResponse = erpInvClient.getInvPhResult(filterInvProductRequest); - if (baseResponse!= null && baseResponse.getCode() == 20000) { + if (baseResponse != null && baseResponse.getCode() == 20000) { List list = baseResponse.getData().getList(); if (CollectionUtil.isNotEmpty(list)) { - String billNo = generateBillNo(filterInvProductRequest);//单据号 - //处理 返回实体 转换成 单据 和 单据明细 - ThrInvOrder thrInvOrder = new ThrInvOrder(); - List thrInvOrderDetails = new ArrayList<>(); - String thirdSys = filterInvProductRequest.getThirdSys(); - handleExternalConvertThrInvOrderDetail(list, thrInvOrderDetails, billNo, thirdSys, thrInvOrder, 0); - - if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) { - handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, list.get(0), Constant.THR_INV_PH_ORDER_TYPE); - - //是否自动生成出入库单据 - if (IntUtil.value(systemParamConfigService.selectValueByParamKey("fee_out_auto_gen")) > 0) { - GenerateOrderRequest generateOrderRequest = new GenerateOrderRequest(); - generateOrderRequest.setBillNo(thrInvOrder.getBillNo()); - generateOrderRequest.setAction(thrInvOrder.getBillType()); - generateOrderRequest.setFromCorp(thrInvOrder.getFromCorp()); - generateOrder(generateOrderRequest); - } + Map> groupedByInv = list.stream() + .collect(Collectors.groupingBy( + item -> item.getInvCode() + "-" + item.getBillType() + )); + groupedByInv.forEach((invCode, invResultResponses) -> { + String billNo = generateBillNo(filterInvProductRequest);//单据号 + //处理 返回实体 转换成 单据 和 单据明细 + ThrInvOrder thrInvOrder = new ThrInvOrder(); + List thrInvOrderDetails = new ArrayList<>(); + String thirdSys = filterInvProductRequest.getThirdSys(); + handleExternalConvertThrInvOrderDetail(invResultResponses, thrInvOrderDetails, billNo, thirdSys, thrInvOrder, 0); - //保存数据 - thrInvOrderMapper.insert(thrInvOrder); - thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails); - } + if (CollectionUtil.isNotEmpty(thrInvOrderDetails)) { + handleExternalConvertThrInvOrder(billNo, filterInvProductRequest, thrInvOrder, invResultResponses.get(0), Constant.THR_INV_PH_ORDER_TYPE); + + //是否自动生成出入库单据 + if (IntUtil.value(systemParamConfigService.selectValueByParamKey("fee_out_auto_gen")) > 0) { + GenerateOrderRequest generateOrderRequest = new GenerateOrderRequest(); + generateOrderRequest.setBillNo(thrInvOrder.getBillNo()); + generateOrderRequest.setAction(thrInvOrder.getBillType()); + generateOrderRequest.setFromCorp(thrInvOrder.getFromCorp()); + generateOrder(generateOrderRequest); + } + + //保存数据 + thrInvOrderMapper.insert(thrInvOrder); + thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails); + } + }); } } } @@ -227,11 +237,11 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { thrInvOrder.setSickerCode(thrInvResultResponse.getSickerCode()); thrInvOrder.setSickerName(thrInvResultResponse.getSickerName()); thrInvOrder.setCreateUser(thrInvResultResponse.getChargeUser()); - try { - thrInvOrder.setChargeTime(sdf2.parse(thrInvResultResponse.getChargeTime())); - } catch (ParseException e) { - log.error("第三方高耗收费明细下载--收费时间转化出错,原数据:【" + thrInvResultResponse.getChargeTime() + "】"); - } +// try { + thrInvOrder.setChargeTime(thrInvResultResponse.getChargeTime()); +// } catch (ParseException e) { +// log.error("第三方高耗收费明细下载--收费时间转化出错,原数据:【" + thrInvResultResponse.getChargeTime() + "】"); +// } //保存数据 thrInvOrderMapper.insert(thrInvOrder); thrInvOrderDetailMapper.insertBatch(thrInvOrderDetails); @@ -1513,23 +1523,36 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { Date newDate = new Date(); - ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiService.getOne(new QueryWrapper().eq("code", thrInvResultResponse.getBillType()).last("limit 1")); thrInvOrder.setBillNo(billNo);//单据号 thrInvOrder.setBillDate(newDate);//单据时间 thrInvOrder.setStartDate(filterInvProductRequest.getStartDate());//库存开始时间 thrInvOrder.setEndDate(filterInvProductRequest.getEndDate());//库存结束时间 - thrInvOrder.setMainAction(thrInvResultResponse.getMainAction());//出入库类型 - thrInvOrder.setBillType(thrInvResultResponse.getBillType());//第三方单据类型 + + if ("OUT".equals(thrInvResultResponse.getBillType())){//收费出库 + thrInvOrder.setMainAction("WareHouseOut");//出入库类型 + thrInvOrder.setBillType("SC71021292871198");//第三方单据类型 + }else { + thrInvOrder.setMainAction("WareHouseIn");//出入库类型 + thrInvOrder.setBillType("SC72854426720051");//第三方单据类型 + } + thrInvOrder.setThirdSysFk(filterInvProductRequest.getThirdSys());//外部系统 thrInvOrder.setDeptCode(thrInvResultResponse.getDeptCode());//部门编号 + thrInvOrder.setDeptName(thrInvResultResponse.getDeptName());//部门编号 thrInvOrder.setInvCode(thrInvResultResponse.getInvCode());//仓库代码 + thrInvOrder.setInvName(thrInvResultResponse.getInvName());//仓库代码 thrInvOrder.setSpaceCode(thrInvResultResponse.getSpaceCode());//货位编码 thrInvOrder.setStatus(ConstantStatus.SFIO_DRAFT);//单据状态 草稿 thrInvOrder.setSourceType(SourceType);//来源类型 thrInvOrder.setCreateTime(newDate); thrInvOrder.setGenStatus(1); - if (thrSystemBusApiEntity != null) - thrInvOrder.setFromCorp(thrSystemBusApiEntity.getFromCorp()); + thrInvOrder.setSickerCode(thrInvResultResponse.getSickerCode()); + thrInvOrder.setSickerName(thrInvResultResponse.getSickerName()); + thrInvOrder.setChargeTime(DateUtil.formatDate(DateUtil.parse(thrInvResultResponse.getChargeTime(), "yyyyMMdd"))); + thrInvOrder.setChargeUser(thrInvResultResponse.getChargeUser()); + + ThrSystemBusApiEntity thrSystemBusApiEntity = thrSystemBusApiService.getOne(new QueryWrapper().eq("code", thrInvOrder.getBillType()).last("limit 1")); + if (thrSystemBusApiEntity != null) thrInvOrder.setFromCorp(thrSystemBusApiEntity.getFromCorp()); thrInvOrder.setCreateUser("外部系统下载"); } @@ -1563,8 +1586,9 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { String mainAction = item.getMainAction(); String thrCode = item.getThrCode(); Long relId = null; + UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); if (mainIdRelIdMap != null){ - UdiRelevanceEntity udiRelevanceEntity = mainIdRelIdMap.get(thrCode); + udiRelevanceEntity = mainIdRelIdMap.get(thrCode); if (udiRelevanceEntity != null){ relId = udiRelevanceEntity.getId(); } @@ -1582,6 +1606,22 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { thrInvOrderDetail.setRelId(relId); thrInvOrderDetail.setThrCode(thrCode); thrInvOrderDetail.setReCount(String.valueOf(count)); + + if (udiRelevanceEntity != null) { + String uuid = udiRelevanceEntity.getUuid(); + List productInfoEntities = productInfoDao.selectByUuid(uuid); + if (CollUtil.isNotEmpty(productInfoEntities)){ + ProductInfoEntity productInfoEntity = productInfoEntities.get(0); + if(productInfoEntity != null && StrUtil.isEmpty(thrInvOrderDetail.getYlqxzcrbarmc())){ + thrInvOrderDetail.setYlqxzcrbarmc(productInfoEntity.getYlqxzcrbarmc()); + } + if(productInfoEntity != null && StrUtil.isEmpty(thrInvOrderDetail.getZczbhhzbapzbh())){ + thrInvOrderDetail.setZczbhhzbapzbh(productInfoEntity.getZczbhhzbapzbh()); + } + } + } + + if (ObjectUtil.isNull(relId)) { exmsg.append(thrCode + ","); } @@ -1617,7 +1657,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { if (relId != null){ //过滤是否高值 if (IntUtil.value(highFilter) > 0) { - UdiRelevanceEntity udiRelevanceEntity = mainIdRelIdMap.get(thrCode); + UdiRelevanceEntity udiRelevanceEntity1 = mainIdRelIdMap.get(thrCode); if (IntUtil.value(udiRelevanceEntity.getHcType()) != 1) { thrInvOrderDetails.add(thrInvOrderDetail); } @@ -1628,7 +1668,7 @@ public class ThrInvOrderServiceImpl implements ThrInvOrderService { } else { //过滤是否高值 if (IntUtil.value(highFilter) > 0) { - UdiRelevanceEntity udiRelevanceEntity = mainIdRelIdMap.get(thrCode); + UdiRelevanceEntity udiRelevanceEntity1 = mainIdRelIdMap.get(thrCode); if (IntUtil.value(udiRelevanceEntity.getHcType()) != 1) { thrInvOrderDetails.add(thrInvOrderDetail); } diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 6a7f261fd..873ccd423 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -1095,6 +1095,8 @@ CALL Pro_Temp_ColumnWork('io_code_temp', 'errUdiCode', 'varchar(255) NULL DEFAUL CALL Pro_Temp_ColumnWork('io_code', 'errUdiCode', 'varchar(255) NULL DEFAULT NULL COMMENT ''去掉错误符号异常UDI码''', 1); CALL Pro_Temp_ColumnWork('thr_system_bus_api', 'fromCorp', 'varchar(255) NULL DEFAULT NULL COMMENT ''配置默认往来单位''', 1); CALL Pro_Temp_ColumnWork('thr_inv_order', 'fromCorp', 'varchar(255) NULL DEFAULT NULL COMMENT ''配置默认往来单位''', 1); +CALL Pro_Temp_ColumnWork('thr_inv_order', 'deptName', 'varchar(255) NULL DEFAULT NULL COMMENT ''配置默认往来单位''', 1); +CALL Pro_Temp_ColumnWork('thr_inv_order', 'invName', 'varchar(255) NULL DEFAULT NULL COMMENT ''配置默认往来单位''', 1); INSERT IGNORE INTO `sys_param_config`(`id`, `parentId`, `paramName`, `paramKey`, `paramValue`, `paramStatus`,