From 49dc552120eda8e840ee2f829c31665bbf78eab2 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Fri, 15 Apr 2022 09:19:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E7=94=A8=E5=87=BA=E5=BA=93=EF=BC=8Cud?= =?UTF-8?q?i=E5=9B=BD=E5=AE=B6=E5=BA=93=E5=88=87=E6=8D=A2=E5=88=B0?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/basic/UdiInfoController.java | 86 +++++++------ .../basic/UdiRelevanceController.java | 2 - .../inout/StockOrderController.java | 8 ++ .../inout/utils/ContrastErpUtil.java | 9 +- .../controller/inout/utils/InoutUtils.java | 15 ++- .../thrsys/ThrOrderReceiveController.java | 10 +- .../admin/httpclient/UdiDlHttpClient.java | 57 --------- .../admin/res/inout/ErpOrderResponse.java | 9 ++ .../basic/impl/UdiRelevanceServiceImpl.java | 6 - .../admin/service/receipt/SyncUdiService.java | 96 ++++++++++++++ .../sale/admin/thread/AsyncDiDlHelper.java | 20 ++- .../thread/BasicUdiInfoImportService.java | 2 - .../admin/thread/IoTransInoutService.java | 4 +- .../sale/admin/thread/IoTransInoutTask.java | 2 - .../sale/admin/thread/UdiDlHttpClient.java | 118 ++++++++++++------ .../mybatis/mapper/thrsys/ThrOrderDao.xml | 6 +- 16 files changed, 290 insertions(+), 160 deletions(-) delete mode 100644 api-admin/src/main/java/com/glxp/sale/admin/httpclient/UdiDlHttpClient.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/receipt/SyncUdiService.java diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiInfoController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiInfoController.java index 3fb1513..df355ea 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiInfoController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiInfoController.java @@ -8,17 +8,21 @@ import com.glxp.sale.admin.entity.basic.BasicThirdSysDetailEntity; import com.glxp.sale.admin.entity.basic.UdiCompanyEntity; import com.glxp.sale.admin.entity.basic.UdiInfoEntity; import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity; +import com.glxp.sale.admin.entity.receipt.ProductInfoEntity; import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity; import com.glxp.sale.admin.entity.udid.UdiEntity; import com.glxp.sale.admin.httpclient.ErpBasicClient; import com.glxp.sale.admin.req.basic.FilterErpGoodsRequest; import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest; +import com.glxp.sale.admin.req.basic.UdiCompanyRequest; +import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest; import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest; import com.glxp.sale.admin.res.PageSimpleResponse; import com.glxp.sale.admin.res.basic.ErpProductsResponse; import com.glxp.sale.admin.service.basic.BasicThirdSysDetailService; import com.glxp.sale.admin.service.basic.UdiInfoService; import com.glxp.sale.admin.service.basic.UdiRelevanceService; +import com.glxp.sale.admin.service.receipt.SyncUdiService; import com.glxp.sale.admin.service.thrsys.ThrProductsService; import com.glxp.sale.admin.util.FilterUdiUtils; import com.glxp.sale.admin.util.HttpClient; @@ -35,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,55 +56,60 @@ public class UdiInfoController { BasicThirdSysDetailService basicThirdSysDetailService; @Resource private ThrProductsService thrProductsService; - @Value("${UDI_SERVER_URL}") - private String udiUrl; @Resource private ErpBasicClient erpBasicClient; @Resource HttpClient httpClient; + @Resource + SyncUdiService syncUdiService; //获取同步库UDI信息 @AuthRuleAnnotation("") @GetMapping("udiwms/udiinfo/filterUdi") - public BaseResponse filterUdi(FilterUdiInfoRequest productInfoFilterRequest) { + public BaseResponse filterUdi(FilterUdiInfoRequest filterUdiInfoRequest) { Map paramMap = new HashMap<>(16); String nameCode = null; - if (productInfoFilterRequest.getUdiCode() != null && !productInfoFilterRequest.getUdiCode().equals("")) { - UdiEntity udiEntity = FilterUdiUtils.getUdi(productInfoFilterRequest.getUdiCode()); + if (filterUdiInfoRequest.getUdiCode() != null && !filterUdiInfoRequest.getUdiCode().equals("")) { + UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiInfoRequest.getUdiCode()); if (udiEntity != null) { nameCode = udiEntity.getUdi(); } else { return ResultVOUtils.error(500, "无效UDI码!"); } -// paramMap.put("udiCode", productInfoFilterRequest.getUdiCode()); } else - nameCode = productInfoFilterRequest.getNameCode(); - - paramMap.put("page", productInfoFilterRequest.getPage()); - paramMap.put("limit", productInfoFilterRequest.getLimit()); - paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc()); - paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc()); - paramMap.put("nameCode", nameCode); - paramMap.put("ggxh", productInfoFilterRequest.getGgxh()); - paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh()); - paramMap.put("uuid", productInfoFilterRequest.getUuid()); - - String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterUdi", paramMap); - try { - BaseResponse> udiDlDeviceResponse = - JSONObject.parseObject(response, new TypeReference>>() { - }); + nameCode = filterUdiInfoRequest.getNameCode(); +// paramMap.put("page", productInfoFilterRequest.getPage()); +// paramMap.put("limit", productInfoFilterRequest.getLimit()); +// paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc()); +// paramMap.put("cpmctymc", productInfoFilterRequest.getCpmctymc()); +// paramMap.put("nameCode", nameCode); +// paramMap.put("ggxh", productInfoFilterRequest.getGgxh()); +// paramMap.put("zczbhhzbapzbh", productInfoFilterRequest.getZczbhhzbapzbh()); +// paramMap.put("uuid", productInfoFilterRequest.getUuid()); - if (productInfoFilterRequest.getIsCheck() != null && productInfoFilterRequest.getIsCheck()) { - List udiInfoEntities = udiDlDeviceResponse.getData().getList(); - if (udiInfoEntities != null && udiInfoEntities.size() > 0) { - for (UdiInfoEntity udiInfoEntity : udiInfoEntities) { - List udiRelevanceEntities = udiRelevanceService.selectByUuid(udiInfoEntity.getUuid()); - if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) { + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + BeanUtils.copyProperties(filterUdiInfoRequest, productInfoFilterRequest); + productInfoFilterRequest.setNameCode(nameCode); +// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterUdi", paramMap); + + try { +// BaseResponse> udiDlDeviceResponse = +// JSONObject.parseObject(response, new TypeReference>>() { +// }); + BaseResponse> udiDlDeviceResponse = syncUdiService.filterUdi(productInfoFilterRequest); + if (filterUdiInfoRequest.getIsCheck() != null && filterUdiInfoRequest.getIsCheck()) { + List productInfoEntities = udiDlDeviceResponse.getData().getList(); + List udiInfoEntities = new ArrayList<>(); + if (productInfoEntities != null && productInfoEntities.size() > 0) { + for (ProductInfoEntity productInfoEntity : productInfoEntities) { + UdiInfoEntity udiInfoEntity = new UdiInfoEntity(); + List udiRelevanceEntities = udiRelevanceService.selectByUuid(productInfoEntity.getUuid()); + if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) { + BeanUtils.copyProperties(productInfoEntity, udiInfoEntity); for (UdiRelevanceEntity udiRelevanceEntity : udiRelevanceEntities) { if (udiRelevanceEntity.getThirdId() == null && udiRelevanceEntity.getThirdId2() == null && udiRelevanceEntity.getThirdId1() == null && @@ -114,11 +124,10 @@ public class UdiInfoController { } else { udiInfoEntity.setCheck(false); } + udiInfoEntities.add(udiInfoEntity); } } } - - return udiDlDeviceResponse; } catch (Exception e) { e.printStackTrace(); @@ -130,16 +139,19 @@ public class UdiInfoController { //获取同步库医疗器械注册人信息 @AuthRuleAnnotation("") @GetMapping("udiwms/udiinfo/filterCompany") - public BaseResponse filterCompany(FilterUdiInfoRequest productInfoFilterRequest) { + public BaseResponse filterCompany(UdiCompanyRequest udiCompanyRequest) { - Map paramMap = new HashMap<>(16); - paramMap.put("page", productInfoFilterRequest.getPage()); - paramMap.put("limit", productInfoFilterRequest.getLimit()); - paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc()); +// Map paramMap = new HashMap<>(16); +// paramMap.put("page", productInfoFilterRequest.getPage()); +// paramMap.put("limit", productInfoFilterRequest.getLimit()); +// paramMap.put("ylqxzcrbarmc", productInfoFilterRequest.getYlqxzcrbarmc()); - String response = httpClient.mipsGetHead(udiUrl + "/udi/company/filter", paramMap); +// String response = httpClient.mipsGetHead(udiUrl + "/udi/company/filter", paramMap); try { - BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); + + BaseResponse> udiDlDeviceResponse = syncUdiService.filterCompany(udiCompanyRequest); + +// BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); return udiDlDeviceResponse; } catch (Exception e) { e.printStackTrace(); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiRelevanceController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiRelevanceController.java index de06f06..86045d1 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiRelevanceController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/basic/UdiRelevanceController.java @@ -56,8 +56,6 @@ import java.util.stream.Collectors; @RestController public class UdiRelevanceController { - @Value("${UDI_SERVER_URL}") - private String udiUrl; @Resource UdiDlHttpClient udiDlHttpClient; @Resource diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java index 5c808df..8a487b0 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/StockOrderController.java @@ -577,6 +577,14 @@ public class StockOrderController { return ResultVOUtils.success(billNo); } + @AuthRuleAnnotation("") + @GetMapping("/udiwms/stock/order/generateBillNoInt") + public BaseResponse generateBillNoInt(@RequestParam("action") String action) { + + String billNo = CustomUtil.getId(); + return ResultVOUtils.success(billNo); + } + public String getCustomerId() { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/ContrastErpUtil.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/ContrastErpUtil.java index 8963507..b03d1f6 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/ContrastErpUtil.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/ContrastErpUtil.java @@ -22,6 +22,7 @@ import com.glxp.sale.admin.service.inout.OrderDetailService; import com.glxp.sale.admin.service.inout.OrderService; import com.glxp.sale.admin.thread.InvProductsTrService; import com.glxp.sale.admin.thread.IoTransInoutService; +import com.glxp.sale.admin.thread.UdiDlHttpClient; import com.glxp.sale.admin.util.FilterUdiUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -47,6 +48,8 @@ public class ContrastErpUtil { UdiRelevanceService udiRelevanceService; @Resource private OrderDetailService myErpOrderService; + @Resource + UdiDlHttpClient udiDlHttpClient; public ContrastErpUtil() { @@ -79,7 +82,7 @@ public class ContrastErpUtil { OrderEntity orderEntity = orderService.findOne(orderFilterRequest); //校验单据详情是否有包含一个di多个绑定 - errMsg = vailMutiDi(); + errMsg = vailMutiDi(); if (errMsg != null) { orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL); orderEntity.setRemark(errMsg); @@ -125,7 +128,7 @@ public class ContrastErpUtil { // // } UdiInfoEntity udiInfoEntity = null; - udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService,udiRelevanceService, warehouseEntity.getCode()); + udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode(),udiDlHttpClient); if (warehouseEntity.getCount() > 1) { udiInfoEntity.setCount(warehouseEntity.getCount()); } @@ -176,7 +179,7 @@ public class ContrastErpUtil { } if (errorData.size() > 0) { - new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, errorData); + new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, orderDetailService, errorData,udiDlHttpClient); } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/InoutUtils.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/InoutUtils.java index 08efc6e..bf335ce 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/InoutUtils.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/inout/utils/InoutUtils.java @@ -1,14 +1,12 @@ package com.glxp.sale.admin.controller.inout.utils; import com.glxp.sale.admin.constant.ConstantType; -import com.glxp.sale.admin.entity.basic.BasicInstrumentMaintainRelevanceEntity; import com.glxp.sale.admin.entity.basic.UdiInfoEntity; import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity; import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; import com.glxp.sale.admin.entity.inout.ErpOrderEntity; import com.glxp.sale.admin.entity.inout.WarehouseEntity; import com.glxp.sale.admin.entity.udid.UdiEntity; -import com.glxp.sale.admin.httpclient.UdiDlHttpClient; import com.glxp.sale.admin.req.param.SystemParamConfigRequest; import com.glxp.sale.admin.res.basic.UdiRelevanceResponse; import com.glxp.sale.admin.service.basic.UdiInfoService; @@ -16,6 +14,7 @@ import com.glxp.sale.admin.service.basic.UdiRelevanceService; import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.admin.service.inout.CodesService; import com.glxp.sale.admin.service.inout.OrderDetailService; +import com.glxp.sale.admin.thread.UdiDlHttpClient; import com.glxp.sale.admin.util.DateUtil; import com.glxp.sale.admin.util.FilterUdiUtils; import org.springframework.beans.BeanUtils; @@ -168,12 +167,12 @@ public class InoutUtils { } - public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code) { + public UdiInfoEntity getUdiInfo(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code, UdiDlHttpClient udiDlHttpClient) { String prefix; prefix = FilterUdiUtils.getDiStr(code); UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(prefix); if (udiInfoEntity == null) { - List froms = new UdiDlHttpClient(udiUrl).getUdiByDi(prefix); + List froms = udiDlHttpClient.getUdiByDi(prefix); if (froms != null && !froms.isEmpty()) { udiInfoService.insertUdiInfos(froms); udiInfoEntity = udiInfoService.findByNameCode(prefix); @@ -196,7 +195,7 @@ public class InoutUtils { } - public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code) { + public UdiInfoEntity getUdiInfoByRlId(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, String code,UdiDlHttpClient udiDlHttpClient) { String prefix; prefix = FilterUdiUtils.getDiStr(code); UdiInfoEntity udiInfoEntity = new UdiInfoEntity(); @@ -208,7 +207,7 @@ public class InoutUtils { udiRelevanceResponse = udiRelevanceResponses.get(0); } if (udiRelevanceResponse == null) { - udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, code); + udiInfoEntity = getUdiInfo(udiInfoService, udiRelevanceService, code,udiDlHttpClient); } else { BeanUtils.copyProperties(udiRelevanceResponse, udiInfoEntity); udiInfoEntity.setRelId(udiRelevanceResponse.getId() + ""); @@ -225,12 +224,12 @@ public class InoutUtils { public void generateConstrastDetail(UdiInfoService udiInfoService, UdiRelevanceService udiRelevanceService, OrderDetailService orderDetailService, - List warehouseEntityList) { + List warehouseEntityList,UdiDlHttpClient udiDlHttpClient) { if (warehouseEntityList != null && warehouseEntityList.size() > 0) { List udiInfoEntities = new ArrayList<>(); for (WarehouseEntity warehouseEntity : warehouseEntityList) { UdiInfoEntity udiInfoEntity = null; - udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode()); + udiInfoEntity = new InoutUtils(udiUrl).getUdiInfoByRlId(udiInfoService, udiRelevanceService, warehouseEntity.getCode(),udiDlHttpClient); if (udiInfoEntity != null) { udiInfoEntity.setCount(getActCount(warehouseEntity, udiRelevanceService) * warehouseEntity.getCount()); udiInfoEntity.setRelId(warehouseEntity.getRelId()); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrOrderReceiveController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrOrderReceiveController.java index b8a21f5..84b2ce0 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrOrderReceiveController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/thrsys/ThrOrderReceiveController.java @@ -53,13 +53,19 @@ public class ThrOrderReceiveController { } Integer userId = customerService.getUserId(); ThrOrderEntity stockOrderEntity = new ThrOrderEntity(); +// Integer id = Integer.parseInt(CustomUtil.getId()); BeanUtils.copyProperties(stockOrderPostRequest, stockOrderEntity); stockOrderEntity.setCreateUser(userId + ""); stockOrderEntity.setType(1);//领用单据 + stockOrderEntity.setUpdateTime(new Date()); stockOrderEntity.setBilldate(DateUtil.formatDate(new Date())); - stockOrderEntity.setBillNo(CustomUtil.getId() + ""); +// stockOrderEntity.setId(id); + ThrOrderEntity temp = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), stockOrderEntity.getThirdSysFk()); + if (temp != null) { + stockOrderEntity.setId(temp.getId()); + } thrOrderService.insertThrOrder(stockOrderEntity); - stockOrderEntity = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), null); + stockOrderEntity = thrOrderService.findByUnique(stockOrderEntity.getBillNo(), stockOrderEntity.getThirdSysFk()); if (stockOrderPostRequest.getSubErpOrders() != null) { List stockOrderDetailEntityList = stockOrderPostRequest.getSubErpOrders(); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/httpclient/UdiDlHttpClient.java b/api-admin/src/main/java/com/glxp/sale/admin/httpclient/UdiDlHttpClient.java deleted file mode 100644 index 5106d27..0000000 --- a/api-admin/src/main/java/com/glxp/sale/admin/httpclient/UdiDlHttpClient.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.glxp.sale.admin.httpclient; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.TypeReference; -import com.glxp.sale.admin.entity.basic.UdiInfoEntity; -import com.glxp.sale.admin.util.HttpClient; -import com.glxp.sale.common.res.BaseResponse; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 获取国家UDI同步库信息 - */ -public class UdiDlHttpClient { - String udiUrl; - - public UdiDlHttpClient(String udiUrl) { - this.udiUrl = udiUrl; - } - - public List getUdiByUuid(String uuid) { - Map paramMap = new HashMap<>(16); - paramMap.put("page", 1); - paramMap.put("limit", 100); - paramMap.put("uuid", uuid); - String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterByUuid", paramMap); - try { - BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); - List udiInfoEntities = udiDlDeviceResponse.getData(); - return udiInfoEntities; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public List getUdiByDi(String key) { - Map paramMap = new HashMap<>(16); - paramMap.put("page", 1); - paramMap.put("limit", 100); - paramMap.put("nameCode", key); - String response = HttpClient.mipsGet(udiUrl + "/udidl/device/filterByNameCode", paramMap); - try { - BaseResponse> udiDlDeviceResponse = - JSONObject.parseObject(response, new TypeReference>>() { - - }); - List udiInfoEntities = udiDlDeviceResponse.getData(); - return udiInfoEntities; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } -} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/inout/ErpOrderResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/ErpOrderResponse.java index c57b9db..6c20bb7 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/res/inout/ErpOrderResponse.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/inout/ErpOrderResponse.java @@ -17,6 +17,7 @@ public class ErpOrderResponse { private String customerId; private String originType; private String locStorageCode; + private String thirdSysFk; private List subErpOrders; //增加字段 @@ -224,6 +225,14 @@ public class ErpOrderResponse { this.locStorageCode = locStorageCode; } + public String getThirdSysFk() { + return thirdSysFk; + } + + public void setThirdSysFk(String thirdSysFk) { + this.thirdSysFk = thirdSysFk; + } + public static class SubErpOrder { private String productId; private String productName; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/UdiRelevanceServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/UdiRelevanceServiceImpl.java index 17daff7..5e46304 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/UdiRelevanceServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/basic/impl/UdiRelevanceServiceImpl.java @@ -4,21 +4,15 @@ import com.github.pagehelper.PageHelper; import com.glxp.sale.admin.constant.ConstantStatus; import com.glxp.sale.admin.dao.basic.UdiRelevanceDao; import com.glxp.sale.admin.entity.basic.BasicThirdSysEntity; -import com.glxp.sale.admin.entity.basic.UdiInfoEntity; import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity; -import com.glxp.sale.admin.httpclient.UdiDlHttpClient; import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest; import com.glxp.sale.admin.res.basic.UdiRelevanceResponse; import com.glxp.sale.admin.service.basic.BasicThirdSysService; import com.glxp.sale.admin.service.basic.UdiInfoService; import com.glxp.sale.admin.service.basic.UdiRelevanceService; -import com.glxp.sale.admin.util.DateUtil; -import com.glxp.sale.admin.util.FilterUdiUtils; -import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/receipt/SyncUdiService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/receipt/SyncUdiService.java new file mode 100644 index 0000000..334cff4 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/receipt/SyncUdiService.java @@ -0,0 +1,96 @@ +package com.glxp.sale.admin.service.receipt; + +import cn.hutool.core.util.StrUtil; +import com.github.pagehelper.PageInfo; +import com.glxp.sale.admin.entity.basic.UdiCompanyEntity; +import com.glxp.sale.admin.entity.receipt.ProductInfoEntity; +import com.glxp.sale.admin.req.basic.FilterUdiInfoRequest; +import com.glxp.sale.admin.req.basic.UdiCompanyRequest; +import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest; +import com.glxp.sale.admin.res.PageSimpleResponse; +import com.glxp.sale.admin.service.basic.UdiCompanyService; +import com.glxp.sale.common.enums.ResultEnum; +import com.glxp.sale.common.res.BaseResponse; +import com.glxp.sale.common.util.ResultVOUtils; +import org.springframework.stereotype.Service; +import org.springframework.validation.BindingResult; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.List; + +@Service +public class SyncUdiService { + + + @Resource + ProductInfoService productInfoService; + @Resource + UdiCompanyService udiCompanyService; + + public BaseResponse filterUdi(ProductInfoFilterRequest productInfoFilterRequest) { + + //过滤--1.参数不能全未空 + if ((productInfoFilterRequest.getYlqxzcrbarmc() == null || productInfoFilterRequest.getYlqxzcrbarmc().equals("")) && + (productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals("")) && + (productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals("")) && + (productInfoFilterRequest.getGgxh() == null || productInfoFilterRequest.getGgxh().equals("")) && + (productInfoFilterRequest.getUuid() == null || productInfoFilterRequest.getUuid().equals("")) && + (productInfoFilterRequest.getZczbhhzbapzbh() == null || productInfoFilterRequest.getZczbhhzbapzbh().equals("")) && + (productInfoFilterRequest.getDeviceRecordKey() == null || productInfoFilterRequest.getDeviceRecordKey().equals("")) + ) { + return ResultVOUtils.error(500, "参数不能为空!"); + } + + if (StrUtil.isEmpty(productInfoFilterRequest.getYlqxzcrbarmc()) && + StrUtil.isEmpty(productInfoFilterRequest.getCpmctymc()) + && StrUtil.isEmpty(productInfoFilterRequest.getNameCode()) + && StrUtil.isEmpty(productInfoFilterRequest.getGgxh()) + && StrUtil.isEmpty(productInfoFilterRequest.getUuid()) + && StrUtil.isEmpty(productInfoFilterRequest.getZczbhhzbapzbh())) + + + if (productInfoFilterRequest.getNameCode() != null && !productInfoFilterRequest.getNameCode().equals("") && productInfoFilterRequest.getNameCode().length() < 10) { + return ResultVOUtils.error(500, "请输入完整的最小销售单元标识!"); + } + + if (productInfoFilterRequest.getYlqxzcrbarmc() != null && !productInfoFilterRequest.getYlqxzcrbarmc().equals("") && productInfoFilterRequest.getYlqxzcrbarmc().length() < 4) { + return ResultVOUtils.error(500, "请输入完整的医疗器械注册备案人名称!"); + } + + + if ((productInfoFilterRequest.getYlqxzcrbarmc() == null || productInfoFilterRequest.getYlqxzcrbarmc().equals("")) + && (productInfoFilterRequest.getNameCode() == null || productInfoFilterRequest.getNameCode().equals("")) + && (productInfoFilterRequest.getCpmctymc() == null || productInfoFilterRequest.getCpmctymc().equals("")) + + ) { + if (productInfoFilterRequest.getGgxh() != null && !productInfoFilterRequest.getGgxh().equals("")) { + return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称"); + } + if (productInfoFilterRequest.getZczbhhzbapzbh() != null && !productInfoFilterRequest.getZczbhhzbapzbh().equals("")) { + return ResultVOUtils.error(500, "请输入医疗器械注册备案人名称"); + } + } + +// if (productInfoFilterRequest.getCpmctymc() != null && !productInfoFilterRequest.getCpmctymc().equals("")) { +// return ResultVOUtils.error(500, "请输入完整的产品通用名称!"); +// } + productInfoFilterRequest.setIsNewest(1); + productInfoFilterRequest.setDiType("1"); + List productInfoEntityList = productInfoService.filterUdi(productInfoFilterRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(productInfoEntityList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(productInfoEntityList); + return ResultVOUtils.success(pageSimpleResponse); + + } + + + public BaseResponse filterCompany(@Valid UdiCompanyRequest udiCompanyRequest) { + + List udiCompanyEntities = udiCompanyService.filterUdiCompany(udiCompanyRequest); + return ResultVOUtils.success(udiCompanyEntities); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncDiDlHelper.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncDiDlHelper.java index 16e8c44..2926667 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncDiDlHelper.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/AsyncDiDlHelper.java @@ -1,8 +1,11 @@ package com.glxp.sale.admin.thread; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.glxp.sale.admin.entity.basic.UdiCompanyEntity; +import com.glxp.sale.admin.entity.basic.UdiInfoEntity; import com.glxp.sale.admin.entity.receipt.ProductInfoEntity; +import com.glxp.sale.admin.res.PageSimpleResponse; import com.glxp.sale.admin.util.HttpClient; import com.glxp.sale.common.res.BaseResponse; @@ -19,7 +22,13 @@ public class AsyncDiDlHelper { paramMap.put("updateTime", updateTime); String response = HttpClient.mipsGet(udiUrl + "/udidl/udiwms/syncUdi", paramMap); try { - BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); +// BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); + + BaseResponse> udiDlDeviceResponse = + JSONObject.parseObject(response, new TypeReference>>() { + }); + + List udiInfoEntities = udiDlDeviceResponse.getData(); return udiInfoEntities; } catch (Exception e) { @@ -36,7 +45,14 @@ public class AsyncDiDlHelper { paramMap.put("updateTime", updateTime); String response = HttpClient.mipsGet(udiUrl + "/udidl/udiwms/syncCompany", paramMap); try { - BaseResponse> baseResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); +// BaseResponse> baseResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); + + + BaseResponse> baseResponse = + JSONObject.parseObject(response, new TypeReference>>() { + }); + + List udiCompanyEntities = baseResponse.getData(); return udiCompanyEntities; } catch (Exception e) { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicUdiInfoImportService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicUdiInfoImportService.java index 61db71f..379427d 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicUdiInfoImportService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicUdiInfoImportService.java @@ -41,8 +41,6 @@ public class BasicUdiInfoImportService { UdiRelevanceService udiRelevanceService; @Resource ThrDataService thrDataService; - @Value("${UDI_SERVER_URL}") - private String udiUrl; @Resource SystemParamConfigService systemParamConfigService; @Resource diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java index 051a4ae..3a0b54a 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutService.java @@ -112,6 +112,8 @@ public class IoTransInoutService { InvProductService invProductService; @Resource InvPreProductService invPreProductService; + @Resource + UdiDlHttpClient udiDlHttpClient; //web端新增订单, @Async @@ -729,7 +731,7 @@ public class IoTransInoutService { } public void genOrderDetail(List warehouseEntityList) { - new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, warehouseEntityList); + new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, warehouseEntityList,udiDlHttpClient); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutTask.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutTask.java index 46ea4cf..353c714 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutTask.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/IoTransInoutTask.java @@ -3,7 +3,6 @@ package com.glxp.sale.admin.thread; import com.glxp.sale.admin.dao.info.ScheduledDao; import com.glxp.sale.admin.entity.info.ScheduledEntity; import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; -import com.glxp.sale.admin.httpclient.UdiDlHttpClient; import com.glxp.sale.admin.req.udid.ScheduledRequest; import com.glxp.sale.admin.service.param.SystemParamConfigService; import org.slf4j.Logger; @@ -15,7 +14,6 @@ import org.springframework.scheduling.support.CronTrigger; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import java.util.List; @Component @EnableScheduling diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/UdiDlHttpClient.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/UdiDlHttpClient.java index 2597fce..7f1a8de 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/UdiDlHttpClient.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/UdiDlHttpClient.java @@ -3,68 +3,112 @@ package com.glxp.sale.admin.thread; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.glxp.sale.admin.entity.basic.UdiInfoEntity; +import com.glxp.sale.admin.entity.receipt.ProductInfoEntity; +import com.glxp.sale.admin.req.receipt.ProductInfoFilterRequest; +import com.glxp.sale.admin.service.receipt.ProductInfoService; +import com.glxp.sale.admin.util.BeanUtils; import com.glxp.sale.admin.util.HttpClient; import com.glxp.sale.common.res.BaseResponse; +import com.glxp.sale.common.util.ResultVOUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 获取国家UDI同步库信息 */ @Service public class UdiDlHttpClient { - @Value("${UDI_SERVER_URL}") - private String udiUrl; + @Resource - HttpClient httpClient; + ProductInfoService productInfoService; public List getUdiByUuid(String uuid) { - Map paramMap = new HashMap<>(16); - paramMap.put("page", 1); - paramMap.put("limit", 100); - paramMap.put("uuid", uuid); - String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByUuid", paramMap); - try { -// BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); - - BaseResponse> udiDlDeviceResponse = - JSONObject.parseObject(response, new TypeReference>>() { - - }); + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + productInfoFilterRequest.setPage(1); + productInfoFilterRequest.setLimit(100); + productInfoFilterRequest.setUuid(uuid); - List udiInfoEntities = udiDlDeviceResponse.getData(); - return udiInfoEntities; - } catch (Exception e) { - e.printStackTrace(); - return null; + List productInfoEntityList = productInfoService.findAll(productInfoFilterRequest); + List udiInfoEntities = new ArrayList<>(); + for (ProductInfoEntity productInfoEntity : productInfoEntityList) { + UdiInfoEntity udiInfoEntity = new UdiInfoEntity(); + BeanUtils.copyProperties(productInfoEntity, udiInfoEntity); + udiInfoEntities.add(udiInfoEntity); } + return udiInfoEntities; +// +// Map paramMap = new HashMap<>(16); +// paramMap.put("page", 1); +// paramMap.put("limit", 100); +// paramMap.put("uuid", uuid); +// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByUuid", paramMap); +// try { +//// BaseResponse> udiDlDeviceResponse = (BaseResponse>) JSONObject.parseObject(response, BaseResponse.class); +// +// BaseResponse> udiDlDeviceResponse = +// JSONObject.parseObject(response, new TypeReference>>() { +// +// }); +// +// List udiInfoEntities = udiDlDeviceResponse.getData(); +// return udiInfoEntities; +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } } public List getUdiByDi(String key) { - Map paramMap = new HashMap<>(16); - paramMap.put("page", 1); - paramMap.put("limit", 100); - paramMap.put("nameCode", key); - String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByNameCode", paramMap); - try { - BaseResponse> udiDlDeviceResponse = - JSONObject.parseObject(response, new TypeReference>>() { + ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest(); + productInfoFilterRequest.setPage(1); + productInfoFilterRequest.setLimit(100); + productInfoFilterRequest.setNameCode(key); - }); - if (udiDlDeviceResponse != null && udiDlDeviceResponse.getCode() == 20000) { - List udiInfoEntities = udiDlDeviceResponse.getData(); - return udiInfoEntities; + List productInfoEntityList = productInfoService.findAll(productInfoFilterRequest); + Map> listMap = productInfoEntityList.stream().collect(Collectors.groupingBy(ProductInfoEntity::getUuid)); + List result = null; + for (List value : listMap.values()) { + if (result == null || value.get(0).getVersionNumber() > result.get(0).getVersionNumber()) { + result = value; } - - } catch (Exception e) { - e.printStackTrace(); - return null; } - return null; + productInfoFilterRequest.setNameCode(null); + productInfoFilterRequest.setUuid(result.get(0).getUuid()); + List datas = productInfoService.findAll(productInfoFilterRequest); + List udiInfoEntities = new ArrayList<>(); + for (ProductInfoEntity productInfoEntity : datas) { + UdiInfoEntity udiInfoEntity = new UdiInfoEntity(); + BeanUtils.copyProperties(productInfoEntity, udiInfoEntity); + udiInfoEntities.add(udiInfoEntity); + } + return udiInfoEntities; + +// Map paramMap = new HashMap<>(16); +// paramMap.put("page", 1); +// paramMap.put("limit", 100); +// paramMap.put("nameCode", key); +// String response = httpClient.mipsGetHead(udiUrl + "/udidl/device/filterByNameCode", paramMap); +// try { +// BaseResponse> udiDlDeviceResponse = +// JSONObject.parseObject(response, new TypeReference>>() { +// +// }); +// if (udiDlDeviceResponse != null && udiDlDeviceResponse.getCode() == 20000) { +// List udiInfoEntities = udiDlDeviceResponse.getData(); +// return udiInfoEntities; +// } +// +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// return null; } } diff --git a/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrOrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrOrderDao.xml index 4bfb511..4eb3a2f 100644 --- a/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrOrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/thrsys/ThrOrderDao.xml @@ -41,6 +41,9 @@ AND editStatus = #{editStatus} + + + ORDER BY updateTime DESC @@ -49,10 +52,11 @@ replace INTO thr_order - (billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk, + (id,billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk, startDate, endDate, createUser, reviewUser, address, linkMan, linkTel, remark, remark1, remark2, remark3,locStorageCode,editStatus) values ( + #{id}, #{billNo}, #{billdate}, #{corpId},