From 71361ac9b000d55fc3574a6634907fc5592498d9 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 24 May 2023 12:47:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=BF=A1=E6=81=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/UdiProductController.java | 26 ++++-- .../controller/basic/UdiRelController.java | 8 ++ .../controller/basic/UdiSyncController.java | 86 ++++++++++++++++++- .../entity/basic/BasicUdiProductEntity.java | 6 +- .../api/req/basic/BasicDictSelectRequest.java | 4 +- .../api/req/basic/BasicUdiRelRequest.java | 7 ++ .../glxp/api/req/system/DeleteRequest.java | 1 + .../service/basic/BasicUdiProductService.java | 2 + .../basic/BasicUdiProductServiceImpl.java | 5 ++ 9 files changed, 128 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/basic/UdiProductController.java b/src/main/java/com/glxp/api/controller/basic/UdiProductController.java index 140ffd0..392102f 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiProductController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiProductController.java @@ -3,6 +3,7 @@ package com.glxp.api.controller.basic; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.res.BaseResponse; @@ -13,8 +14,8 @@ import com.glxp.api.entity.basic.ProductInfoEntity; import com.glxp.api.entity.basic.UdiEntity; import com.glxp.api.req.basic.BasicDictSelectRequest; import com.glxp.api.req.basic.FilterUdiRelRequest; +import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.PageSimpleResponse; -import com.glxp.api.res.basic.BasicUdiRelResponse; import com.glxp.api.service.basic.BasicUdiProductService; import com.glxp.api.service.basic.ProductInfoService; import com.glxp.api.util.udi.FilterUdiUtils; @@ -75,8 +76,8 @@ public class UdiProductController extends BaseController { @PostMapping("udi/basic/dict/add") public BaseResponse addDict(@RequestBody BasicDictSelectRequest basicDictSelectRequest) { - if (StrUtil.isNotEmpty(basicDictSelectRequest.getUuid())) { - List productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getUuid()); + if (StrUtil.isNotEmpty(basicDictSelectRequest.getKey())) { + List productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getKey()); if (CollUtil.isNotEmpty(productInfoEntities)) { for (ProductInfoEntity productInfoEntity : productInfoEntities) { BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity(); @@ -92,17 +93,27 @@ public class UdiProductController extends BaseController { } + @AuthRuleAnnotation("") + @PostMapping("udi/basic/dict/delete") + public BaseResponse addDict(@RequestBody DeleteRequest deleteRequest) { + if (StrUtil.isEmpty(deleteRequest.getUuid())) { + return ResultVOUtils.error(500, "uuid不能未空!"); + } + basicUdiProductService.remove(new QueryWrapper().eq("uuid", deleteRequest.getUuid())); + return ResultVOUtils.success("删除成功!!"); + } + + //医疗器械信息字典编辑保存 @AuthRuleAnnotation("") @PostMapping("udi/basic/dict/batchAdd") public BaseResponse batchAdd(@RequestBody BasicDictSelectRequest basicDictSelectRequest) { long userId = getUserId(); - if (CollUtil.isNotEmpty(basicDictSelectRequest.getUuids())) { - for (String uuid : basicDictSelectRequest.getUuids()) { - + if (CollUtil.isNotEmpty(basicDictSelectRequest.getKeys())) { + for (String uuid : basicDictSelectRequest.getKeys()) { if (!basicUdiProductService.isExit(uuid)) { - List productInfoEntities = productInfoService.selectByUuid(basicDictSelectRequest.getUuid()); + List productInfoEntities = productInfoService.selectByUuid(uuid); if (CollUtil.isNotEmpty(productInfoEntities)) { for (ProductInfoEntity productInfoEntity : productInfoEntities) { BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity(); @@ -114,7 +125,6 @@ public class UdiProductController extends BaseController { } } } - } } return ResultVOUtils.success("添加成功!"); diff --git a/src/main/java/com/glxp/api/controller/basic/UdiRelController.java b/src/main/java/com/glxp/api/controller/basic/UdiRelController.java index 60416d9..c09cee1 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiRelController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiRelController.java @@ -143,6 +143,14 @@ public class UdiRelController extends BaseController { basicUdiRelEntity.setUpdateTime(new Date()); basicUdiRelEntity.setUpdateUser(customerService.getUserId() + ""); basicUdiRelService.updateById(basicUdiRelEntity); + + + BasicUdiProductEntity basicUdiProductEntity = new BasicUdiProductEntity(); + basicUdiProductEntity.setUuid(basicUdiRelRequest.getUuid()); + basicUdiProductEntity.setManufactory(basicUdiRelRequest.getManufactory()); + basicUdiProductEntity.setMeasname(basicUdiRelRequest.getMeasname()); + basicUdiProductEntity.setSpmc(basicUdiRelRequest.getSpmc()); + basicUdiProductService.updateByUuid(basicUdiProductEntity); return ResultVOUtils.success("添加成功!"); } diff --git a/src/main/java/com/glxp/api/controller/basic/UdiSyncController.java b/src/main/java/com/glxp/api/controller/basic/UdiSyncController.java index 32006bc..8d06d76 100644 --- a/src/main/java/com/glxp/api/controller/basic/UdiSyncController.java +++ b/src/main/java/com/glxp/api/controller/basic/UdiSyncController.java @@ -13,10 +13,7 @@ import com.glxp.api.req.basic.ProductInfoFilterRequest; import com.glxp.api.req.basic.UdiCompanyRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.BasicUdiRelResponse; -import com.glxp.api.service.basic.BasicUdiRelService; -import com.glxp.api.service.basic.ProductInfoService; -import com.glxp.api.service.basic.SyncUdiService; -import com.glxp.api.service.basic.UdiCompanyService; +import com.glxp.api.service.basic.*; import com.glxp.api.util.udi.FilterUdiUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -38,12 +35,93 @@ public class UdiSyncController { UdiCompanyService udiCompanyService; @Resource BasicUdiRelService basicUdiRelService; + @Resource + BasicUdiProductService basicUdiProductService; //获取同步库UDI信息 @ApiIgnore @AuthRuleAnnotation("") @GetMapping("udiwms/udiinfo/filterUdi") public BaseResponse filterUdi(FilterUdiRelRequest filterUdiRelRequest) { + String nameCode; + if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) { + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode()); + if (udiEntity != null) { + nameCode = udiEntity.getUdi(); + } else { + return ResultVOUtils.error(500, "无效UDI码!"); + } + } else + nameCode = filterUdiRelRequest.getNameCode(); + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + BeanUtils.copyProperties(filterUdiRelRequest, productInfoFilterRequest); + if (StrUtil.isNotEmpty(nameCode)) { + productInfoFilterRequest.setNameCode(nameCode); + } else { + productInfoFilterRequest.setDiType("1"); + } + try { + BaseResponse> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest); + return udiDlDeviceResponse; + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResultVOUtils.error(500, "连接UDI数据下载服务出错!"); + } + } + + + //获取同步库UDI信息 + @ApiIgnore + @AuthRuleAnnotation("") + @GetMapping("udiwms/udiinfo/dict/filter") + public BaseResponse filterDict(FilterUdiRelRequest filterUdiRelRequest) { + String nameCode; + if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) { + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode()); + if (udiEntity != null) { + nameCode = udiEntity.getUdi(); + } else { + return ResultVOUtils.error(500, "无效UDI码!"); + } + } else + nameCode = filterUdiRelRequest.getNameCode(); + + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + BeanUtils.copyProperties(filterUdiRelRequest, productInfoFilterRequest); + if (StrUtil.isNotEmpty(nameCode)) { + productInfoFilterRequest.setNameCode(nameCode); + } else { + productInfoFilterRequest.setDiType("1"); + } + try { + BaseResponse> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest); + if (udiDlDeviceResponse.getCode() == 20000) { + if (filterUdiRelRequest.getIsCheck() != null && filterUdiRelRequest.getIsCheck()) { + List productInfoEntities = udiDlDeviceResponse.getData().getList(); + if (productInfoEntities != null && productInfoEntities.size() > 0) { + for (ProductInfoEntity productInfoEntity : productInfoEntities) { + Boolean isExit = basicUdiProductService.isExit(productInfoEntity.getUuid()); + if (isExit) { + productInfoEntity.setCheck(true); + } else + productInfoEntity.setCheck(false); + } + } + } + } + return udiDlDeviceResponse; + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResultVOUtils.error(500, "连接UDI数据下载服务出错!"); + } + } + + + //获取同步库UDI信息 + @ApiIgnore + @AuthRuleAnnotation("") + @GetMapping("udiwms/udiinfo/rel/filter") + public BaseResponse filterRel(FilterUdiRelRequest filterUdiRelRequest) { String nameCode; if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) { UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode()); diff --git a/src/main/java/com/glxp/api/entity/basic/BasicUdiProductEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicUdiProductEntity.java index c9c320c..740ceff 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicUdiProductEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicUdiProductEntity.java @@ -87,7 +87,7 @@ public class BasicUdiProductEntity implements Serializable { * 以使用单元数量入库 */ @TableField(value = "isUseDy") - private Byte isUseDy; + private Integer isUseDy; /** * ERP产品名 @@ -177,7 +177,7 @@ public class BasicUdiProductEntity implements Serializable { * 表示类型:1.主标识,2,使用单元标识,3.本体标识,4,包装标识 */ @TableField(value = "diType") - private Byte diType; + private Integer diType; /** * 生产标识是否包含批号 @@ -228,7 +228,7 @@ public class BasicUdiProductEntity implements Serializable { * 是否是最新记录 */ @TableField(value = "isNewest") - private Byte isNewest; + private Boolean isNewest; /** * 更新时间 diff --git a/src/main/java/com/glxp/api/req/basic/BasicDictSelectRequest.java b/src/main/java/com/glxp/api/req/basic/BasicDictSelectRequest.java index 8a7d09d..2a5175e 100644 --- a/src/main/java/com/glxp/api/req/basic/BasicDictSelectRequest.java +++ b/src/main/java/com/glxp/api/req/basic/BasicDictSelectRequest.java @@ -7,6 +7,6 @@ import java.util.List; @Data public class BasicDictSelectRequest { - private String uuid; - private List uuids; + private String key; + private List keys; } diff --git a/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java b/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java index fe38a5c..f049531 100644 --- a/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java +++ b/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java @@ -45,4 +45,11 @@ public class BasicUdiRelRequest { private Date agengtStartDate; private Date agengtEndDate; + + + // 器械字典设置 + private String manufactory; + private String measname; + private String spmc; + } diff --git a/src/main/java/com/glxp/api/req/system/DeleteRequest.java b/src/main/java/com/glxp/api/req/system/DeleteRequest.java index ddad45d..671417f 100644 --- a/src/main/java/com/glxp/api/req/system/DeleteRequest.java +++ b/src/main/java/com/glxp/api/req/system/DeleteRequest.java @@ -12,4 +12,5 @@ public class DeleteRequest { String billNo; List billNos; Integer dlType; //1:同步任务,2:下载记录 + String uuid; } diff --git a/src/main/java/com/glxp/api/service/basic/BasicUdiProductService.java b/src/main/java/com/glxp/api/service/basic/BasicUdiProductService.java index 37863ae..edbed00 100644 --- a/src/main/java/com/glxp/api/service/basic/BasicUdiProductService.java +++ b/src/main/java/com/glxp/api/service/basic/BasicUdiProductService.java @@ -12,5 +12,7 @@ public interface BasicUdiProductService extends IService public boolean isExit(String uuid); public List filterList(FilterUdiRelRequest filterUdiRelRequest); + + boolean updateByUuid(BasicUdiProductEntity basicUdiProductEntity); } diff --git a/src/main/java/com/glxp/api/service/basic/BasicUdiProductServiceImpl.java b/src/main/java/com/glxp/api/service/basic/BasicUdiProductServiceImpl.java index 07522ff..2d66f5f 100644 --- a/src/main/java/com/glxp/api/service/basic/BasicUdiProductServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/BasicUdiProductServiceImpl.java @@ -29,4 +29,9 @@ public class BasicUdiProductServiceImpl extends ServiceImpl().eq("uuid", basicUdiProductEntity.getUuid())) > 0; + } }