From c166838758f618de661f57b5d9d80ca5d36cf223 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Tue, 30 May 2023 15:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../trace/TraceOrderController.java | 9 ----- .../controller/trace/UdiTraceController.java | 1 - .../glxp/api/dao/basic/BasicUdiRelMapper.java | 3 ++ .../api/entity/trace/TraceOrderEntity.java | 20 +++++++++++ .../entity/trace/TraceTaskNoticeEntity.java | 2 +- .../api/res/trace/TraceOrderResponse.java | 13 +++++-- .../api/service/basic/BasicUdiRelService.java | 10 ++++++ .../api/service/trace/TraceOrderService.java | 31 +++++++++++++--- .../api/service/trace/UdiTraceService.java | 35 ++++++++++++------- .../trace/impl/TraceOrderServiceImpl.java | 34 ------------------ src/main/resources/application-pro.yml | 8 ++--- src/main/resources/application.yml | 2 +- .../mapper/basic/BasicUdiRelMapper.xml | 10 ++++++ 14 files changed, 108 insertions(+), 72 deletions(-) delete mode 100644 src/main/java/com/glxp/api/service/trace/impl/TraceOrderServiceImpl.java diff --git a/pom.xml b/pom.xml index 5c4e47b..b3b3431 100644 --- a/pom.xml +++ b/pom.xml @@ -378,7 +378,7 @@ - UDI_WMS_MC + UDI_CPT_SERVER org.springframework.boot diff --git a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java index 2602fb9..37bb439 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java @@ -1,32 +1,23 @@ package com.glxp.api.controller.trace; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; -import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.basic.UdiEntity; -import com.glxp.api.entity.trace.TraceOrderEntity; import com.glxp.api.req.trace.TraceOrderDetailRequest; -import com.glxp.api.req.trace.TraceOrderUploadRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.trace.TraceOrderResponse; import com.glxp.api.service.trace.TraceOrderService; import com.glxp.api.util.udi.FilterUdiUtils; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; -import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; -import java.util.Date; import java.util.List; @ApiIgnore diff --git a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java index 78ed9b1..799a74e 100644 --- a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java @@ -151,7 +151,6 @@ public class UdiTraceController extends BaseController { } - return ResultVOUtils.success(traceRecordLogEntity); } diff --git a/src/main/java/com/glxp/api/dao/basic/BasicUdiRelMapper.java b/src/main/java/com/glxp/api/dao/basic/BasicUdiRelMapper.java index b8da261..af294da 100644 --- a/src/main/java/com/glxp/api/dao/basic/BasicUdiRelMapper.java +++ b/src/main/java/com/glxp/api/dao/basic/BasicUdiRelMapper.java @@ -23,4 +23,7 @@ public interface BasicUdiRelMapper extends BaseMapper { List findDiList(@Param("uuid") String uuid); + + List findDiListByProduct(FilterUdiRelRequest filterUdiRelRequest); } + diff --git a/src/main/java/com/glxp/api/entity/trace/TraceOrderEntity.java b/src/main/java/com/glxp/api/entity/trace/TraceOrderEntity.java index b15d4a3..927ce3a 100644 --- a/src/main/java/com/glxp/api/entity/trace/TraceOrderEntity.java +++ b/src/main/java/com/glxp/api/entity/trace/TraceOrderEntity.java @@ -16,6 +16,7 @@ import lombok.Data; @Data @TableName(value = "trace_order") public class TraceOrderEntity implements Serializable { + @TableId(value = "id", type = IdType.INPUT) private Long id; @@ -67,6 +68,13 @@ public class TraceOrderEntity implements Serializable { @TableField(value = "toCorpCreditNum") private String toCorpCreditNum; + + /** + * 使用者信息 (医疗机构实际使用者信息) + */ + @TableField(value = "toUserInfo") + private String toUserInfo; + /** * 单据创建者 */ @@ -79,6 +87,13 @@ public class TraceOrderEntity implements Serializable { @TableField(value = "companyIdFk") private Long companyIdFk; + + /** + * 当前企业统一社会信用号 + */ + @TableField(value = "companyCertNum") + private String companyCertNum; + /** * 客户端类型 */ @@ -144,6 +159,11 @@ public class TraceOrderEntity implements Serializable { @TableField(value = "traceProductIdFk") private Long traceProductIdFk; + /** + * 单据源头类型:1:起始位置(例如:生产企业) 2: 中间位置:(流通企业)3:结束位置:(例如:医疗机构使用,或一些销毁等) + */ + @TableField(value = "sourceType") + private Long sourceType; private static final long serialVersionUID = 1L; } diff --git a/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java b/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java index 81f8b6f..d81117e 100644 --- a/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java +++ b/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java @@ -27,7 +27,7 @@ public class TraceTaskNoticeEntity implements Serializable { private Long produdctRecordIdFk; /** - * 任务类型 1:关联关系;2:出入库 + * 任务类型 1:关联关系;2:出入库单据 */ @TableField(value = "taskType") private Integer taskType; diff --git a/src/main/java/com/glxp/api/res/trace/TraceOrderResponse.java b/src/main/java/com/glxp/api/res/trace/TraceOrderResponse.java index 409af38..7d48963 100644 --- a/src/main/java/com/glxp/api/res/trace/TraceOrderResponse.java +++ b/src/main/java/com/glxp/api/res/trace/TraceOrderResponse.java @@ -21,7 +21,7 @@ public class TraceOrderResponse { /** * 1:入库;2:出库 */ - private Byte inOutType; + private Integer inOutType; /** * 单据类型 @@ -48,21 +48,28 @@ public class TraceOrderResponse { */ private String toCorpCreditNum; + private String toUserInfo; + /** * 单据创建者 */ private Long createUser; /** - * 企业信息ID外键 + * 当前企业信息ID外键 */ private Long companyIdFk; /** - * 企业名称 + * 当前企业名称 */ private String companyName; + /** + * 当前企业统一社会信用号 + */ + private String companyCertNum; + /** * 客户端类型 */ diff --git a/src/main/java/com/glxp/api/service/basic/BasicUdiRelService.java b/src/main/java/com/glxp/api/service/basic/BasicUdiRelService.java index 4cf5cf9..555defa 100644 --- a/src/main/java/com/glxp/api/service/basic/BasicUdiRelService.java +++ b/src/main/java/com/glxp/api/service/basic/BasicUdiRelService.java @@ -60,4 +60,14 @@ public class BasicUdiRelService extends ServiceImpl findDiListByProduct(FilterUdiRelRequest filterUdiRelRequest) { + if (StrUtil.isNotEmpty(filterUdiRelRequest.getNameCode())) { + BasicUdiRelResponse basicUdiRelResponse = findByProductNameCode(filterUdiRelRequest.getNameCode()); + return basicUdiRelMapper.findDiList(basicUdiRelResponse.getUuid()); + } else { + return basicUdiRelMapper.findDiListByProduct(filterUdiRelRequest); + } + } + } diff --git a/src/main/java/com/glxp/api/service/trace/TraceOrderService.java b/src/main/java/com/glxp/api/service/trace/TraceOrderService.java index 0dfc4fb..52183df 100644 --- a/src/main/java/com/glxp/api/service/trace/TraceOrderService.java +++ b/src/main/java/com/glxp/api/service/trace/TraceOrderService.java @@ -1,16 +1,37 @@ package com.glxp.api.service.trace; -import com.glxp.api.entity.trace.TraceOrderEntity; -import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageHelper; import com.glxp.api.req.trace.TraceOrderDetailRequest; -import com.glxp.api.req.trace.TraceOrderRequest; import com.glxp.api.res.trace.TraceOrderResponse; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.glxp.api.dao.trace.TraceOrderMapper; +import com.glxp.api.entity.trace.TraceOrderEntity; +import javax.annotation.Resource; +import java.util.Collections; import java.util.List; -public interface TraceOrderService extends IService{ +@Service +public class TraceOrderService extends ServiceImpl { + + @Resource + TraceOrderMapper traceOrderMapper; - List queryTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest); + public List queryTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest) { + if (traceOrderDetailRequest == null) { + return Collections.emptyList(); + } + if (traceOrderDetailRequest.getPage() != null) { + int offset = (traceOrderDetailRequest.getPage() - 1) * traceOrderDetailRequest.getLimit(); + PageHelper.offsetPage(offset, traceOrderDetailRequest.getLimit()); + } + return traceOrderMapper.queryTraceOrderList(traceOrderDetailRequest); + } + List findByProductIdFk(Long traceProductIdFk) { + return traceOrderMapper.selectList(new QueryWrapper().eq("traceProductIdFk", traceProductIdFk)); + } } diff --git a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java index b9abebd..33404f0 100644 --- a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java +++ b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java @@ -6,6 +6,7 @@ import com.glxp.api.entity.trace.MqTraceMessage; import com.glxp.api.entity.trace.TraceProductDetailEntity; import com.glxp.api.entity.trace.TraceRecordLogEntity; import com.glxp.api.entity.trace.TraceTaskNoticeEntity; +import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.trace.TraceRecordRequest; import com.glxp.api.res.basic.BasicUdiRelResponse; import com.glxp.api.service.basic.BasicUdiProductService; @@ -109,21 +110,28 @@ public class UdiTraceService { //1.查询生产订单信息是否已上传 - if (traceProductDetailEntity.getManuStatus() != 3) { - //生产订单关联关系 - if (traceProductDetailEntity.getManuStatus() == 2) { - TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId()); - if (taskNoticeEntity == null) { - createTraceNotice(1, traceProductDetailEntity, companyId); - pushMq(traceProductDetailEntity, companyId); - } else if (taskNoticeEntity.getStatus() == 4) { - //任务超时未处理,重新推送消息 - pushMq(traceProductDetailEntity, companyId); - } + //生产订单关联关系 + if (traceProductDetailEntity.getManuStatus() == 1) { //生产订单未处理 + createTraceNotice(1, traceProductDetailEntity, companyId); + pushMq(traceProductDetailEntity, companyId); + } else if (traceProductDetailEntity.getManuStatus() == 2) { //生产订单处理未完成 + TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId()); + if (taskNoticeEntity == null) { + createTraceNotice(1, traceProductDetailEntity, companyId); + pushMq(traceProductDetailEntity, companyId); + } else if (taskNoticeEntity.getStatus() == 4) { + //任务超时未处理,重新推送消息 + pushMq(traceProductDetailEntity, companyId); } } //2.查询出入库单消息是否已经上传 + if (traceProductDetailEntity.getStatus() == 1) { //出入库订单未处理 + createTraceNotice(2, traceProductDetailEntity, companyId); + pushMq(traceProductDetailEntity, companyId); + } else if (traceProductDetailEntity.getStatus() == 2) { //出入库订单未处理完成 + + } } @@ -146,8 +154,9 @@ public class UdiTraceService { traceTaskNoticeEntity.setExpireDate(traceProductDetailEntity.getExpireDate()); traceTaskNoticeEntity.setSerialNo(traceProductDetailEntity.getSerialNo()); traceTaskNoticeEntity.setCreateTime(new Date()); -// List diList = basicUdiRelService.getBaseMapper().findDiList(basicUdiRelResponse.getUuid()); -// traceTaskNoticeEntity.setDiList(diList); + FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); + List diList = basicUdiRelService.findDiListByProduct(filterUdiRelRequest); + traceTaskNoticeEntity.setDiList(diList); traceTaskNoticeService.save(traceTaskNoticeEntity); return traceTaskNoticeEntity; } diff --git a/src/main/java/com/glxp/api/service/trace/impl/TraceOrderServiceImpl.java b/src/main/java/com/glxp/api/service/trace/impl/TraceOrderServiceImpl.java deleted file mode 100644 index a1c1b4a..0000000 --- a/src/main/java/com/glxp/api/service/trace/impl/TraceOrderServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.glxp.api.service.trace.impl; - -import com.github.pagehelper.PageHelper; -import com.glxp.api.req.trace.TraceOrderDetailRequest; -import com.glxp.api.req.trace.TraceOrderRequest; -import com.glxp.api.res.trace.TraceOrderResponse; -import com.glxp.api.service.trace.TraceOrderService; -import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.glxp.api.dao.trace.TraceOrderMapper; -import com.glxp.api.entity.trace.TraceOrderEntity; - -import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; - -@Service -public class TraceOrderServiceImpl extends ServiceImpl implements TraceOrderService { - - @Resource - TraceOrderMapper traceOrderMapper; - - @Override - public List queryTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest) { - if (traceOrderDetailRequest == null) { - return Collections.emptyList(); - } - if (traceOrderDetailRequest.getPage() != null) { - int offset = (traceOrderDetailRequest.getPage() - 1) * traceOrderDetailRequest.getLimit(); - PageHelper.offsetPage(offset, traceOrderDetailRequest.getLimit()); - } - return traceOrderMapper.queryTraceOrderList(traceOrderDetailRequest); - } -} diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml index d18589d..acf74d0 100644 --- a/src/main/resources/application-pro.yml +++ b/src/main/resources/application-pro.yml @@ -3,7 +3,7 @@ server: spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - jdbc-url: jdbc:mysql://127.0.0.1:3306/udi_cpt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:mysql://192.168.0.66:3364/udi_cpt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: Glxp@6066 hikari: @@ -18,7 +18,7 @@ spring: timeout: 300 jedis: pool: - max-active: 8 + max-active: 16 max-wait: -1 max-idle: 8 min-idle: 0 @@ -43,12 +43,12 @@ logging: level: com.glxp.api.dao: debug -file_path: D:/udi/udiwms/udiwmsfile/ +file_path: D:/udi/cpt/udiwmsfile/ UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs -back_file_path: D:/share/udisps/back/ +back_file_path: D:/share/cpt/back/ API_KEY: 1101 API_SECRET: zBITspLNvuoEd4FaamlSoqxRHmNsmQ9L diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 80e18f1..a97493f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev + active: pro jmx: enabled: false servlet: diff --git a/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml b/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml index 2b429d7..2453946 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicUdiRelMapper.xml @@ -124,4 +124,14 @@ from basic_udi_product where uuid = #{uuid} + + +