From 592e8d8d60c1697530b96f9c85dde541003033ff Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 14 Mar 2024 09:53:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E8=BA=BA=E8=BF=87=E6=BB=A4=E6=9C=AA?= =?UTF-8?q?=E5=AF=B9=E7=85=A7=E7=A7=91=E5=AE=A4=E7=9A=84=E6=94=B6=E8=B4=B9?= =?UTF-8?q?=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../glxp/mipsdl/client/ctqyy/CtqyyClient.java | 7 +- .../mipsdl/client/ptxhyy/PtxhyyClient.java | 98 +++++++++++++++++-- .../entity/auth/AuthWarehouseEntity.java | 6 +- src/main/resources/application-dev.yml | 2 +- 4 files changed, 96 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/glxp/mipsdl/client/ctqyy/CtqyyClient.java b/src/main/java/com/glxp/mipsdl/client/ctqyy/CtqyyClient.java index 6623acb..404b0c2 100644 --- a/src/main/java/com/glxp/mipsdl/client/ctqyy/CtqyyClient.java +++ b/src/main/java/com/glxp/mipsdl/client/ctqyy/CtqyyClient.java @@ -25,7 +25,6 @@ import com.glxp.mipsdl.dao.auth.AuthWarehouseDao; import com.glxp.mipsdl.dao.auth.AuthWarehouseUserMapper; import com.glxp.mipsdl.dao.basic.*; import com.glxp.mipsdl.dao.inout.*; -import com.glxp.mipsdl.dao.system.SysParamConfigMapper; import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao; import com.glxp.mipsdl.dao.thrsys.ThrProductsDao; import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao; @@ -37,7 +36,6 @@ import com.glxp.mipsdl.entity.ctqyy.MaterialDictEntity; import com.glxp.mipsdl.entity.ctqyy.PriceClassEntity; import com.glxp.mipsdl.entity.ctqyy.ThrHslbEntity; import com.glxp.mipsdl.entity.inout.*; -import com.glxp.mipsdl.entity.system.SysParamConfigEntity; import com.glxp.mipsdl.entity.thrsys.ThrCorpEntity; import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity; import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity; @@ -46,13 +44,11 @@ import com.glxp.mipsdl.http.HttpClient; import com.glxp.mipsdl.req.base.*; import com.glxp.mipsdl.req.ctqyy.*; import com.glxp.mipsdl.req.post.*; -import com.glxp.mipsdl.req.ptxhyy.PtxhyyInvRequest; import com.glxp.mipsdl.req.zaxyy.ZaxzyyOrderRequest; import com.glxp.mipsdl.req.zzzyy.ZzzyyRequest; import com.glxp.mipsdl.res.BaseResponse; import com.glxp.mipsdl.res.PageSimpleResponse; import com.glxp.mipsdl.res.ctqyy.CtBaseResponse; -import com.glxp.mipsdl.res.ptxhyy.PtxhInvResponse; import com.glxp.mipsdl.res.udiwms.*; import com.glxp.mipsdl.service.auth.AuthWarehouseService; import com.glxp.mipsdl.service.order.OrderUploadLogService; @@ -70,7 +66,6 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; -import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @Slf4j @@ -1060,7 +1055,7 @@ public class CtqyyClient extends CommonHttpClient { ThrProductsEntity thrProductsEntity = thrProductsDao.selectOne(new LambdaQueryWrapper() .eq(ThrProductsEntity::getCode, thirdProductId).last("limit 1")); if (thrProductsEntity == null) { - log.error("第三方产品编码未关联"); +// log.error("第三方产品编码未关联"); return null; } item.setProductName(thrProductsEntity.getName()); //产品名称 diff --git a/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java b/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java index 59533ba..62e8325 100644 --- a/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java +++ b/src/main/java/com/glxp/mipsdl/client/ptxhyy/PtxhyyClient.java @@ -3,13 +3,16 @@ package com.glxp.mipsdl.client.ptxhyy; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.BeanUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.glxp.mipsdl.client.CommonHttpClient; +import com.glxp.mipsdl.client.ctqyy.entity.InvProjectResultEntity; import com.glxp.mipsdl.client.ptxhyy.entity.OrderUploadResponse; import com.glxp.mipsdl.client.ptxhyy.entity.ThrHslbEntity; import com.glxp.mipsdl.client.ptxhyy.entity.ThrHslbService; @@ -18,12 +21,12 @@ import com.glxp.mipsdl.constant.ConstantType; import com.glxp.mipsdl.constant.Constants; import com.glxp.mipsdl.dao.auth.AuthUserDao; import com.glxp.mipsdl.dao.auth.AuthWarehouseDao; -import com.glxp.mipsdl.dao.basic.BasicBussinessTypeDao; -import com.glxp.mipsdl.dao.basic.BasicCorpDao; +import com.glxp.mipsdl.dao.basic.*; import com.glxp.mipsdl.dao.inout.IoCodeDao; import com.glxp.mipsdl.dao.inout.IoOrderDao; import com.glxp.mipsdl.dao.inout.IoOrderDetailBizDao; import com.glxp.mipsdl.dao.inout.IoOrderUploadLogDao; +import com.glxp.mipsdl.dao.thrsys.ThrDeptDao; import com.glxp.mipsdl.dao.thrsys.ThrInvWarehouseDao; import com.glxp.mipsdl.dao.thrsys.ThrProductsDao; import com.glxp.mipsdl.dao.thrsys.ThrSystemBusApiDao; @@ -33,10 +36,15 @@ import com.glxp.mipsdl.entity.auth.AuthWarehouseUser; import com.glxp.mipsdl.dao.auth.AuthWarehouseUserMapper; import com.glxp.mipsdl.entity.basic.BasicBussinessTypeEntity; import com.glxp.mipsdl.entity.basic.BasicCorpEntity; +import com.glxp.mipsdl.entity.basic.BasicSkProjectDetailEntity; +import com.glxp.mipsdl.entity.basic.BasicSkProjectEntity; import com.glxp.mipsdl.entity.inout.*; +import com.glxp.mipsdl.entity.thrsys.ThrDeptEntity; import com.glxp.mipsdl.entity.thrsys.ThrInvWarehouseEntity; +import com.glxp.mipsdl.entity.thrsys.ThrProductsEntity; import com.glxp.mipsdl.entity.thrsys.ThrSystemBusApiEntity; import com.glxp.mipsdl.http.HttpClient; +import com.glxp.mipsdl.req.base.CompanyProductRelevanceRequest; import com.glxp.mipsdl.req.base.UdiwmsInvProductsRequest; import com.glxp.mipsdl.req.base.UdiwmsOrderDetailRequest; import com.glxp.mipsdl.req.base.UdiwmsOrderRequest; @@ -48,10 +56,12 @@ import com.glxp.mipsdl.res.PageSimpleResponse; import com.glxp.mipsdl.res.ptxhyy.PtxhInvResponse; import com.glxp.mipsdl.res.udiwms.InvProductRequest; import com.glxp.mipsdl.res.udiwms.ThrInvResultResponse; +import com.glxp.mipsdl.res.udiwms.UdiRlSupResponse; import com.glxp.mipsdl.service.auth.AuthWarehouseService; import com.glxp.mipsdl.service.order.OrderUploadLogService; import com.glxp.mipsdl.service.thrsys.ThrCorpService; import com.glxp.mipsdl.service.thrsys.ThrSystemDetailService; +import com.glxp.mipsdl.util.CustomUtil; import com.glxp.mipsdl.util.DateUtil; import com.glxp.mipsdl.util.ResultVOUtils; import com.glxp.mipsdl.util.SubmitOrderUtil; @@ -89,6 +99,7 @@ public class PtxhyyClient extends CommonHttpClient { private final IoOrderDetailBizDao orderDetailBizDao; private final SubmitOrderUtil submitOrderUtil; private final ThrProductsDao thrProductsDao; + private final ThrDeptDao thrDeptDao; @Resource ThrHslbService thrHslbService; @@ -436,36 +447,109 @@ public class PtxhyyClient extends CommonHttpClient { } + @Resource + BasicSkProjectMapper basicSkProjectMapper; + @Resource + UdiRlSupDao udiRlSupDao; + @Resource + BasicDestinyRelMapper basicDestinyRelMapper; + /** * 获取库存/出入库明细信息 */ - public BaseResponse getInvResult(UdiwmsInvProductsRequest udiwmsInvProductsRequest) { + @Override + public BaseResponse getInvFeeResult(UdiwmsInvProductsRequest udiwmsInvProductsRequest) { PtxhyyInvRequest ptxhyyInvRequest = new PtxhyyInvRequest(); ptxhyyInvRequest.setKssj(DateUtil.formatDate(udiwmsInvProductsRequest.getStartDate(), "yyyy-MM-dd")); ptxhyyInvRequest.setJssj(DateUtil.formatDate(udiwmsInvProductsRequest.getEndDate(), "yyyy-MM-dd")); - String response = httpClient.postJson(thrSystemDetailService.getUrlExclude(null) + "/api/foreign/CKCX", ptxhyyInvRequest); - + String response = httpClient.postJson(thrSystemDetailService.getUrlExclude(null) + "/CKCX", ptxhyyInvRequest); +// String response = "{\"code\": 20000,\"data\": {\"list\": [{\"zsl\": 1,\"fyxh\": 30274,\"dw\": \"根\",\"lb\": \"住院\",\"fymc\": \"一次性使用避光压力延长管/根\",\"fydj\": 13,\"rq\": 1709222400000,\"zxks\": \"新10区\"},{\"zsl\": 3,\"fyxh\": 35550,\"dw\": \"个\",\"lb\": \"住院\",\"fymc\": \"静脉林华留置针(苏州林华)/个\",\"fydj\": 3.12,\"rq\": 1709222400000,\"zxks\": \"精神科病区\"},{\"zsl\": 2,\"fyxh\": 29290,\"dw\": \"支\",\"lb\": \"住院\",\"fymc\": \"一次性采血针/支 (100.000%)\",\"fydj\": 0.28,\"rq\": 1709222400000,\"zxks\": \"精神科病区\"},{\"zsl\": 6,\"fyxh\": 29976,\"dw\": \"个\",\"lb\": \"住院\",\"fymc\": \"雾化面罩(口含式)/个 (100.000%)\",\"fydj\": 14.4,\"rq\": 1709222400000,\"zxks\": \"新11区\"},{\"zsl\": 1,\"fyxh\": 29298,\"dw\": \"支\",\"lb\": \"住院\",\"fymc\": \"一次性无菌注射器(1ml 带针)/支\",\"fydj\": 0.27,\"rq\": 1709222400000,\"zxks\": \"03区\"},{\"zsl\": 1,\"fyxh\": 29291,\"dw\": \"支\",\"lb\": \"住院\",\"fymc\": \"一次性使用静脉输液针(头皮针)/支 (100.000%)\",\"fydj\": 0.14,\"rq\": 1709222400000,\"zxks\": \"03区\"},{\"zsl\": 62,\"fyxh\": 29292,\"dw\": \"副\",\"lb\": \"住院\",\"fymc\": \"一次性使用代贴输液器(带针)/副 (100.000%)\",\"fydj\": 0.95,\"rq\": 1709222400000,\"zxks\": \"16区\"},{\"zsl\": 9,\"fyxh\": 30621,\"dw\": \"个\",\"lb\": \"住院\",\"fymc\": \"一次性使用真空采血管(促凝剂)/个\",\"fydj\": 0.58,\"rq\": 1709222400000,\"zxks\": \"05区\"},{\"zsl\": 66,\"fyxh\": 29294,\"dw\": \"支\",\"lb\": \"住院\",\"fymc\": \"一次性无菌注射器(5ml 带针)/支\",\"fydj\": 0.28,\"rq\": 1709222400000,\"zxks\": \"16区\"},{\"zsl\": 4,\"fyxh\": 29278,\"dw\": \"个\",\"lb\": \"住院\",\"fymc\": \"一次性使用负压引流袋/个\",\"fydj\": 5.8,\"rq\": 1709222400000,\"zxks\": \"04区\"}]}}"; BaseResponse> baseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); if (baseResponse.getCode() == 20000) { List ptxhInvResponses = baseResponse.getData().getList(); List thrInvResultResponses = new ArrayList<>(); + + Set seenNames = new HashSet<>(); + List itemData = new ArrayList<>(); + if (CollUtil.isNotEmpty(ptxhInvResponses)) { for (PtxhInvResponse ptxhInvResponse : ptxhInvResponses) { ThrInvResultResponse thrInvResultResponse = new ThrInvResultResponse(); + + + thrInvResultResponse.setBillType("SC71021292871198"); //科室收费出库 + thrInvResultResponse.setMainAction(ConstantType.TYPE_OUT); + + ThrInvWarehouseEntity thrInvWarehouseEntity = thrInvWarehouseDao.selectOne(new QueryWrapper().eq("name", ptxhInvResponse.getZxks()).last("limit 1")); + if (thrInvWarehouseEntity != null) { + AuthWarehouseEntity authWarehouseEntity = authWarehouseDao.selectOne(new QueryWrapper().eq("thirdId", thrInvWarehouseEntity.getCode()).last("limit 1")); + if (authWarehouseEntity != null) { + thrInvResultResponse.setInvCode(authWarehouseEntity.getCode()); + thrInvResultResponse.setDeptCode(authWarehouseEntity.getParentId()); + thrInvResultResponse.setDeptName(ptxhInvResponse.getZxks()); + thrInvResultResponse.setInvName(ptxhInvResponse.getZxks()); + } else { +// thrInvWarehouseEntity.setCode(CustomUtil.getId()); +// thrInvWarehouseEntity.setName(ptxhInvResponse.getZxks()); +// thrInvWarehouseEntity.setThirdSysFk("thirdId"); +// thrInvWarehouseEntity.setId(IdUtil.getSnowflakeNextId() + ""); +// thrInvWarehouseEntity.setParentId(thrInvWarehouseEntity.getCode()); +// thrInvWarehouseEntity.setRemark("收费出库自动生成"); +// thrInvWarehouseEntity.setUpdateTime(new Date()); +// thrInvWarehouseDao.insert(thrInvWarehouseEntity); +// +// ThrDeptEntity thrDeptEntity = new ThrDeptEntity(); +// thrDeptEntity.setCode(thrInvWarehouseEntity.getCode()); +// thrDeptEntity.setName(thrInvWarehouseEntity.getName()); +// thrDeptEntity.setPId(0); +// thrDeptEntity.setId(IdUtil.getSnowflakeNextId()); +// thrDeptEntity.setStatus(1); +// thrDeptEntity.setRemark("收费出库自动生成"); +// thrInvWarehouseEntity.setUpdateTime(new Date()); +// thrDeptEntity.setThirdSysFk(thrDeptEntity.getThirdSysFk()); +// thrDeptDao.insert(thrDeptEntity); + +// return ResultVOUtils.error(500, ptxhInvResponse.getZxks() + "第三方科室仓库未创建!"); + log.error(ptxhInvResponse.getZxks() + "第三方科室仓库未创建!"); + continue; + } + } + if (thrInvWarehouseEntity == null) { + log.error(ptxhInvResponse.getZxks() + "--科室仓库未对照!"); + continue; +// return ResultVOUtils.error(500, ptxhInvResponse.getZxks() + "--科室仓库未对照!"); + } thrInvResultResponse.setThrCode(ptxhInvResponse.getFyxh()); thrInvResultResponse.setCpmctymc(ptxhInvResponse.getFymc()); thrInvResultResponse.setPrice(BigDecimal.valueOf(Double.parseDouble(ptxhInvResponse.getFydj()))); thrInvResultResponse.setMeasname(ptxhInvResponse.getDw()); - thrInvResultResponse.setDeptName(ptxhInvResponse.getZxks()); - thrInvResultResponse.setInvName(ptxhInvResponse.getZxks()); thrInvResultResponse.setType(ptxhInvResponse.getLb()); + thrInvResultResponse.setOutCount(ptxhInvResponse.getZsl()); thrInvResultResponse.setReCount(ptxhInvResponse.getZsl()); thrInvResultResponses.add(thrInvResultResponse); + if (seenNames.add(ptxhInvResponse.getFyxh())) { + itemData.add(ptxhInvResponse); + } } } + + for (PtxhInvResponse invProjectResultEntity : itemData) { + if (!basicSkProjectMapper.exists(new QueryWrapper().eq("code", invProjectResultEntity.getFyxh()))) { + BasicSkProjectEntity basicSkProjectEntity = new BasicSkProjectEntity(); + basicSkProjectEntity.setCode(invProjectResultEntity.getFyxh()); + basicSkProjectEntity.setName(invProjectResultEntity.getFymc()); + basicSkProjectEntity.setType(2); + basicSkProjectEntity.setCreateTime(new Date()); + basicSkProjectEntity.setUpdateTime(new Date()); + basicSkProjectEntity.setRemark("出入库明细自动生成"); + basicSkProjectEntity.setId(IdUtil.getSnowflakeNextId()); + basicSkProjectMapper.insert(basicSkProjectEntity); + } + } + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(thrInvResultResponses.size() + 0l); pageSimpleResponse.setList(thrInvResultResponses); diff --git a/src/main/java/com/glxp/mipsdl/entity/auth/AuthWarehouseEntity.java b/src/main/java/com/glxp/mipsdl/entity/auth/AuthWarehouseEntity.java index 5f0c03c..d612722 100644 --- a/src/main/java/com/glxp/mipsdl/entity/auth/AuthWarehouseEntity.java +++ b/src/main/java/com/glxp/mipsdl/entity/auth/AuthWarehouseEntity.java @@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** - * 仓库字典表 - */ + * 仓库字典表 + */ @Data @TableName(value = "auth_warehouse") public class AuthWarehouseEntity { @@ -82,4 +82,4 @@ public class AuthWarehouseEntity { */ @TableField(value = "parentCode") private String parentCode; -} \ No newline at end of file +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 7a9395c..3ab9057 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,7 +1,7 @@ spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_ct?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: 123456 hikari: