From 5e43d9f6fac7c4e7807b64ff7a5ee533e1a2348f Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Tue, 15 Mar 2022 10:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD=EF=BC=88?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E8=BD=ACjson=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sync/IOOrderStatusController.java | 30 +- .../sync/UdiInfoImportLogController.java | 87 ++-- .../sync/UdiwmsPostDirectController.java | 10 +- .../dao/sync/CompanyProductRelevanceDao.java | 42 ++ .../glxp/sale/admin/dao/sync/UdiInfoDao.java | 51 +++ .../sale/admin/dao/sync/UdiRelevanceDao.java | 53 +++ .../info/CompanyProductRelevanceEntity.java | 3 +- .../entity/sync/BasicThirdSysEntity.java | 15 + .../sale/admin/entity/sync/UdiInfoEntity.java | 398 ++++++++++++++++++ .../admin/entity/sync/UdiRelevanceEntity.java | 41 ++ .../com/glxp/sale/admin/http/PostSmpHttp.java | 29 +- .../com/glxp/sale/admin/http/SpGetHttp.java | 21 +- .../com/glxp/sale/admin/http/UHttpClient.java | 54 +++ .../FilterCompanyProductRelevanceRequest.java | 4 + .../sync/CompanyProductRelevanceRequest.java | 50 +++ .../req/sync/FilterBasicThirdSysRequest.java | 14 + .../admin/req/sync/FilterUdiInfoRequest.java | 2 +- .../sync/CompanyProductRelevanceResponse.java | 61 +++ .../sync/UdiRelevanceExportJsonResponse.java | 28 ++ .../sync/CompanyProductRelevanceService.java | 36 ++ .../sync/UdiInfoImportDetailService.java | 7 +- .../admin/service/sync/UdiInfoService.java | 37 ++ .../service/sync/UdiRelevanceService.java | 42 ++ .../CompanyProductRelevanceServiceImpl.java | 110 +++++ .../impl/UdiInfoImportDetailServiceImpl.java | 37 +- .../service/sync/impl/UdiInfoServiceImpl.java | 104 +++++ .../sync/impl/UdiRelevanceServiceImpl.java | 137 ++++++ .../admin/thread/BasicGenExcelService.java | 64 +++ .../sale/admin/thread/DataImportService.java | 16 +- .../sale/admin/thread/DlSpOrderService.java | 77 ++-- .../glxp/sale/admin/util/FilterUdiUtils.java | 273 ++++++++++++ .../com/glxp/sale/admin/util/UdiEntity.java | 65 +++ .../main/resources/application-pro.properties | 7 +- .../src/main/resources/logback-spring.xml | 28 +- .../sync/CompanyProductRelevanceDao.xml | 276 ++++++++++++ .../mybatis/mapper/sync/UdiInfoDao.xml | 280 ++++++++++++ .../mybatis/mapper/sync/UdiRelevanceDao.xml | 354 ++++++++++++++++ 37 files changed, 2819 insertions(+), 124 deletions(-) create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/dao/sync/CompanyProductRelevanceDao.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiInfoDao.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiRelevanceDao.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BasicThirdSysEntity.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiInfoEntity.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiRelevanceEntity.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/req/sync/CompanyProductRelevanceRequest.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterBasicThirdSysRequest.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/res/sync/CompanyProductRelevanceResponse.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/res/sync/UdiRelevanceExportJsonResponse.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/CompanyProductRelevanceService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiRelevanceService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/CompanyProductRelevanceServiceImpl.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoServiceImpl.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiRelevanceServiceImpl.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/thread/BasicGenExcelService.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/util/FilterUdiUtils.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/util/UdiEntity.java create mode 100644 api-admin/src/main/resources/mybatis/mapper/sync/CompanyProductRelevanceDao.xml create mode 100644 api-admin/src/main/resources/mybatis/mapper/sync/UdiInfoDao.xml create mode 100644 api-admin/src/main/resources/mybatis/mapper/sync/UdiRelevanceDao.xml diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/IOOrderStatusController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/IOOrderStatusController.java index 7b03e31..ef57591 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/IOOrderStatusController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/IOOrderStatusController.java @@ -67,22 +67,22 @@ public class IOOrderStatusController { return ResultVOUtils.success(dlOrderResponses); } - //更新订单 - @PostMapping("/spms/inout/order/deleteStatus") - public BaseResponse deleteStatus(@RequestBody OrderStatusFilterRequest orderStatusFilterRequest, - BindingResult bindingResult) { - - if (bindingResult.hasErrors()) { - return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); - } - boolean b = ioOrderStatusService.deleteByOrderId(orderStatusFilterRequest.getOrderId()); - if (!b) { - return ResultVOUtils.error(ResultEnum.NOT_NETWORK); - } - return ResultVOUtils.success("更新成功"); - } +// //更新订单 +// @PostMapping("/spms/inout/order/deleteStatus") +// public BaseResponse deleteStatus(@RequestBody OrderStatusFilterRequest orderStatusFilterRequest, +// BindingResult bindingResult) { +// +// if (bindingResult.hasErrors()) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); +// } +// boolean b = ioOrderStatusService.deleteByOrderId(orderStatusFilterRequest.getOrderId()); +// if (!b) { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } +// return ResultVOUtils.success("更新成功"); +// } - @PostMapping("/spms/inout/order/updateStatus") + @PostMapping("/spms/inout/order/deleteStatus") public BaseResponse updateStatus(@RequestBody IOOrderStatusEntity orderStatusFilterRequest, BindingResult bindingResult) { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiInfoImportLogController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiInfoImportLogController.java index 65df53a..fcc4898 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiInfoImportLogController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiInfoImportLogController.java @@ -2,15 +2,19 @@ package com.glxp.sale.admin.controller.sync; import com.github.pagehelper.PageInfo; import com.glxp.sale.admin.constant.BasicProcessStatus; +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; import com.glxp.sale.admin.entity.param.SystemParamConfigEntity; +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; import com.glxp.sale.admin.entity.sync.UdiInfoImportDetailEntity; import com.glxp.sale.admin.entity.sync.UdiInfoImportLogEntity; +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; import com.glxp.sale.admin.http.PostSmpHttp; import com.glxp.sale.admin.req.info.DeleteRequest; import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; import com.glxp.sale.admin.req.sync.FilterUdiIpLogRequest; import com.glxp.sale.admin.req.sync.PostUdiInfoRequest; import com.glxp.sale.admin.res.PageSimpleResponse; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.admin.service.sync.UdiInfoImportDetailService; import com.glxp.sale.admin.service.sync.UdiInfoImportLogService; @@ -119,43 +123,43 @@ public class UdiInfoImportLogController { return ResultVOUtils.error(500, "删除成功"); } - //产品信息接口上传 + //UDI管理系统产品信息接口上传 @PostMapping("/udiwms/basic/products/upload") - public BaseResponse postUdiInfo(@RequestBody PostUdiInfoRequest postUdiInfoRequest, BindingResult bindingResult) { + public BaseResponse postUdiInfo(@RequestBody UdiRelevanceExportJsonResponse postUdiInfoRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } String value = systemParamConfigService.selectValueByParamKey("enable_direct"); if ("1".equals(value)) { - return postSmpHttp.postUdiInfo(postUdiInfoRequest); + postSmpHttp.postUdiInfo(postUdiInfoRequest); + return ResultVOUtils.error(500, "稍等片刻!"); } else { - String genKey = postUdiInfoRequest.getGenKey(); - if (genKey == null) { - genKey = CustomUtil.getId(); - } + String genKey = CustomUtil.getId(); UdiInfoImportLogEntity udiInfoImportLogEntity = udiInfoImportLogService.selectByGenKey(genKey); - List udiInfoImportEntities = postUdiInfoRequest.getDatas(); - if (udiInfoImportEntities != null) { - for (UdiInfoImportDetailEntity udiInfoImportEntity : udiInfoImportEntities) { - udiInfoImportEntity.setGenKeyFk(genKey); - udiInfoImportEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_UNPROCESS); - udiInfoImportEntity.setUpdateTime(new java.util.Date()); - udiInfoImportService.insertUdiInfoImport(udiInfoImportEntity); + if (postUdiInfoRequest.getUdiInfoEntities() != null) { + for (UdiInfoEntity udiInfoEntity : postUdiInfoRequest.getUdiInfoEntities()) { + udiInfoEntity.setGenKeyFk(genKey); } } - if (udiInfoImportLogEntity == null) { - udiInfoImportLogEntity = new UdiInfoImportLogEntity(); - udiInfoImportLogEntity.setGenKey(genKey); - udiInfoImportLogEntity.setDataType(BasicProcessStatus.DATA_TYPE_UDI); - udiInfoImportLogEntity.setFromType("接口上传"); - udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); - udiInfoImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis())); - udiInfoImportLogService.insertImportLog(udiInfoImportLogEntity); - } else { - udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); - udiInfoImportLogService.updateImportLog(udiInfoImportLogEntity); + if (postUdiInfoRequest.getCompanyProductRelevanceEntities() != null) { + for (CompanyProductRelevanceEntity udiInfoEntity : postUdiInfoRequest.getCompanyProductRelevanceEntities()) { + udiInfoEntity.setGenKeyFk(genKey); + } } + if (postUdiInfoRequest.getUdiRelevanceEntities() != null) { + for (UdiRelevanceEntity udiInfoEntity : postUdiInfoRequest.getUdiRelevanceEntities()) { + udiInfoEntity.setGenKeyFk(genKey); + } + } + udiInfoImportLogEntity = new UdiInfoImportLogEntity(); + udiInfoImportLogEntity.setGenKey(genKey); + udiInfoImportLogEntity.setDataType(BasicProcessStatus.DATA_TYPE_UDI); + udiInfoImportLogEntity.setFromType("接口上传"); + udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); + udiInfoImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis())); + udiInfoImportLogService.insertImportLog(udiInfoImportLogEntity); + udiInfoImportService.importJsonData(postUdiInfoRequest, genKey); return ResultVOUtils.success("上传成功"); } @@ -163,29 +167,33 @@ public class UdiInfoImportLogController { } - //产品信息接口上传 + //供应商自助平台产品信息接口上传 @PostMapping("/spms/basic/products/upload") - public BaseResponse uploadUdiInfo(@RequestBody PostUdiInfoRequest postUdiInfoRequest, BindingResult bindingResult) { + public BaseResponse uploadUdiInfo(@RequestBody UdiRelevanceExportJsonResponse postUdiInfoRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } String value = systemParamConfigService.selectValueByParamKey("enable_direct"); if ("1".equals(value)) { - return postSmpHttp.postUdiInfo(postUdiInfoRequest); +// postSmpHttp.postUdiInfo(postUdiInfoRequest); + return ResultVOUtils.error(500, "稍等片刻!"); } else { - String genKey = postUdiInfoRequest.getGenKey(); - if (genKey == null) { - genKey = CustomUtil.getId(); - } + String genKey = CustomUtil.getId(); UdiInfoImportLogEntity udiInfoImportLogEntity = udiInfoImportLogService.selectByGenKey(genKey); - List udiInfoImportEntities = postUdiInfoRequest.getDatas(); - if (udiInfoImportEntities != null) { - for (UdiInfoImportDetailEntity udiInfoImportEntity : udiInfoImportEntities) { - udiInfoImportEntity.setGenKeyFk(genKey); - udiInfoImportEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_UNPROCESS); - udiInfoImportEntity.setUpdateTime(new java.util.Date()); - udiInfoImportService.insertUdiInfoImport(udiInfoImportEntity); + if (postUdiInfoRequest.getUdiInfoEntities() != null) { + for (UdiInfoEntity udiInfoEntity : postUdiInfoRequest.getUdiInfoEntities()) { + udiInfoEntity.setGenKeyFk(genKey); + } + } + if (postUdiInfoRequest.getCompanyProductRelevanceEntities() != null) { + for (CompanyProductRelevanceEntity udiInfoEntity : postUdiInfoRequest.getCompanyProductRelevanceEntities()) { + udiInfoEntity.setGenKeyFk(genKey); + } + } + if (postUdiInfoRequest.getUdiRelevanceEntities() != null) { + for (UdiRelevanceEntity udiInfoEntity : postUdiInfoRequest.getUdiRelevanceEntities()) { + udiInfoEntity.setGenKeyFk(genKey); } } if (udiInfoImportLogEntity == null) { @@ -196,6 +204,7 @@ public class UdiInfoImportLogController { udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); udiInfoImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis())); udiInfoImportLogService.insertImportLog(udiInfoImportLogEntity); + udiInfoImportService.importJsonData(postUdiInfoRequest, genKey); } else { udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS); udiInfoImportLogService.updateImportLog(udiInfoImportLogEntity); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java index 74fc40a..557b25c 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/UdiwmsPostDirectController.java @@ -7,8 +7,10 @@ import com.glxp.sale.admin.http.PostSmpHttp; import com.glxp.sale.admin.req.sync.*; import com.glxp.sale.admin.res.sync.ErpOrderResponse; import com.glxp.sale.admin.res.sync.ErpProductsResponse; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; import com.glxp.sale.admin.service.param.SystemParamConfigService; import com.glxp.sale.admin.service.sync.*; +import com.glxp.sale.admin.thread.BasicGenExcelService; import com.glxp.sale.common.enums.ResultEnum; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; @@ -54,6 +56,8 @@ public class UdiwmsPostDirectController { ThrProductsImportLogService thrProductsImportLogService; @Resource ThrProductsImportDetailService thrProductsImportDetailService; + @Resource + BasicGenExcelService basicGenExcelService; @PostMapping("/udisp/sync/postUdiInfo") public BaseResponse postUdiInfo(@RequestBody PostUdiInfoRequest postUdiInfoRequest, @@ -64,10 +68,8 @@ public class UdiwmsPostDirectController { } FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest(); filterUdiIpLogRequest.setGenKey(postUdiInfoRequest.getGenKey()); - List udiInfoImportDetailEntityList = udiInfoImportDetailService.filterUdiInfoImport(filterUdiIpLogRequest); - PostUdiInfoRequest postUdiInfoRequest1 = new PostUdiInfoRequest(); - postUdiInfoRequest1.setDatas(udiInfoImportDetailEntityList); - BaseResponse baseResponse = postSmpHttp.postUdiInfo(postUdiInfoRequest1); + UdiRelevanceExportJsonResponse udiRelevanceExportJsonResponse = basicGenExcelService.exportJsonUdiInfo(postUdiInfoRequest.getGenKey()); + BaseResponse baseResponse = postSmpHttp.postUdiInfo(udiRelevanceExportJsonResponse); UdiInfoImportLogEntity udiInfoImportLogEntity = udiInfoImportLogService.selectByGenKey(postUdiInfoRequest.getGenKey()); if (baseResponse.getCode() == 20000) { udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/CompanyProductRelevanceDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/CompanyProductRelevanceDao.java new file mode 100644 index 0000000..5bf8ff2 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/CompanyProductRelevanceDao.java @@ -0,0 +1,42 @@ +package com.glxp.sale.admin.dao.sync; + +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest; +import com.glxp.sale.admin.req.sync.CompanyProductRelevanceRequest; +import com.glxp.sale.admin.res.sync.CompanyProductRelevanceResponse; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface CompanyProductRelevanceDao { + + List filterUdiGp(CompanyProductRelevanceRequest basicInstrumentMaintainRequest); + + List filterCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest); + + CompanyProductRelevanceEntity findCompanyProductRelevance(Long CustomerId); + + + CompanyProductRelevanceEntity findCompanyProductRelevanceByProductId(String productId); + + CompanyProductRelevanceEntity findCompanyProductRelevanceByUdiRlIdFk(@Param("udiRlIdFk") String udiRlIdFk, @Param("customerId") String customerId); + + CompanyProductRelevanceEntity findCompanyProductRelevanceByProductUuid(CompanyProductRelevanceEntity companyProductRelevanceEntity); + + List getCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest); + + boolean updateCompanyProductRelevance(CompanyProductRelevanceEntity companyCertEntity); + + boolean insertCompanyProductRelevance(CompanyProductRelevanceEntity companyCertEntity); + + boolean deleteById(String id); + + boolean deleteByRlId(String id); + + + void importComapnyUdiRelevance(@Param("udiRelevanceEntities") List udiRelevanceEntities); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiInfoDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiInfoDao.java new file mode 100644 index 0000000..da22c49 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiInfoDao.java @@ -0,0 +1,51 @@ +package com.glxp.sale.admin.dao.sync; + +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface UdiInfoDao { + + List filterUdiInfo(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterUdiInfo2(FilterUdiInfoRequest filterUdiInfoRequest); + + UdiInfoEntity findByNameCode(@Param("nameCode") String nameCode); + + UdiInfoEntity findById(@Param("id") String id); + + UdiInfoEntity findByUuid(@Param("uuid") String uuid); + + List findByUuids(@Param("uuid") String uuid); + + boolean insertUdiInfo(UdiInfoEntity udiInfoEntity); + + boolean insertUdiInfos(@Param("udiInfoEntities") List udiInfoEntities); + + boolean updateUdiInfo(UdiInfoEntity udiInfoEntity); + + boolean deleteById(@Param("id") String id); + + boolean deleteByUuid(@Param("uuid") String uuid); + + /** + * 根据UUID批量查询数据 + * + * @param uuids + * @return + */ + List batchSelectByUuid(@Param("uuids") List uuids); + + /** + * 导入医疗器械信息 + * + * @param udiInfoEntities + */ + void importUdiInfo(@Param("udiInfoEntities") List udiInfoEntities); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiRelevanceDao.java b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiRelevanceDao.java new file mode 100644 index 0000000..8117dd9 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/dao/sync/UdiRelevanceDao.java @@ -0,0 +1,53 @@ +package com.glxp.sale.admin.dao.sync; + +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface UdiRelevanceDao { + + List filterUdiRelevance(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterUdiGp(FilterUdiInfoRequest filterUdiInfoRequest); + + // UdiRelevanceResponse selectUdiByUUid + List selectByUuid(@Param("uuid") String uuid); + + UdiRelevanceEntity selectById(@Param("id") String id); + + UdiRelevanceEntity selectByThirdId(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterEntity(FilterUdiInfoRequest filterUdiInfoRequest); + + + boolean insertUdiRelevance(UdiRelevanceEntity udiRelevanceEntity); + + boolean updateUdiRelevance(UdiRelevanceEntity udiRelevanceEntity); + + boolean deleteById(@Param("id") String id); + + boolean deleteByIds(@Param("ids") List id); + + boolean deleteByUuid(@Param("uuid") String uuid); + + /** + * 根据UUID批量查询信息 + * + * @param uuids + * @return + */ + List batchSelectByUuid(@Param("uuids") List uuids); + + /** + * 批量导入数据 + * + * @param udiRelevanceEntities + */ + void importUdiRelevance(@Param("udiRelevanceEntities") List udiRelevanceEntities); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/info/CompanyProductRelevanceEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/info/CompanyProductRelevanceEntity.java index 9677a2a..566db96 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/info/CompanyProductRelevanceEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/info/CompanyProductRelevanceEntity.java @@ -19,5 +19,6 @@ public class CompanyProductRelevanceEntity { private String auditStatus; private String productUuid; private Integer udiRlIdFk; - + private String genKeyFk; + private Integer gid; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BasicThirdSysEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BasicThirdSysEntity.java new file mode 100644 index 0000000..75fb0bd --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BasicThirdSysEntity.java @@ -0,0 +1,15 @@ +package com.glxp.sale.admin.entity.sync; + +import lombok.Data; + +@Data +public class BasicThirdSysEntity { + private String id; + private String thirdId; + private String thirdName; + private Boolean enabled; + private String remark; + private String guideUrl; + private String thridUrl; + private Boolean mainSys; +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiInfoEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiInfoEntity.java new file mode 100644 index 0000000..f6b64bb --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiInfoEntity.java @@ -0,0 +1,398 @@ +package com.glxp.sale.admin.entity.sync; + +import lombok.Data; + +@Data +public class UdiInfoEntity { + + private Integer id; + private String nameCode; + private String packRatio; + private String packLevel; + private Integer bhxjsl; + private Integer bhzxxsbzsl; + private Integer zxxsbzbhsydysl; + private String bhxjcpbm; + private String sjcpbm; // + private String bzcj; + private String addType; + private String deviceRecordKey; + private String cpmctymc; + private String cplb; + private String flbm; + private String ggxh; + private String qxlb; + private String tyshxydm; + private String ylqxzcrbarmc; + private String zczbhhzbapzbh; + private String ylqxzcrbarywmc; + private String sydycpbs; + private String uuid; + private int versionNumber; + private int diType; + private String thirdId; + private String thirdName; + private String ybbm; + private String sptm; + private String manufactory; + private String measname; + private Integer productType; + private Integer gid; + + //本地生成信息 + private String batchNo; + private String produceDate; + private String expireDate; + private String serialNo; + private String udi; + private String code; + private Integer count; + private String warehouseCode; + private String udplatCode; + private String relId;//关联ID主键 + private Integer status; + private String supId; + + private Boolean isCheck; + private String genKeyFk; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNameCode() { + return nameCode; + } + + public void setNameCode(String nameCode) { + this.nameCode = nameCode; + } + + public String getPackRatio() { + return packRatio; + } + + public void setPackRatio(String packRatio) { + this.packRatio = packRatio; + } + + public String getPackLevel() { + return packLevel; + } + + public void setPackLevel(String packLevel) { + this.packLevel = packLevel; + } + + public Integer getBhxjsl() { + if (bhxjsl == null || bhxjsl == 0) { + return 1; + } + return bhxjsl; + } + + public void setBhxjsl(Integer bhxjsl) { + this.bhxjsl = bhxjsl; + } + + public Integer getBhzxxsbzsl() { + if (bhzxxsbzsl == null || bhzxxsbzsl == 0) { + return 1; + } + return bhzxxsbzsl; + } + + public String getSptm() { + return sptm; + } + + public void setSptm(String sptm) { + this.sptm = sptm; + } + + public String getManufactory() { + return manufactory; + } + + public void setManufactory(String manufactory) { + this.manufactory = manufactory; + } + + public String getMeasname() { + return measname; + } + + public void setMeasname(String measname) { + this.measname = measname; + } + + public void setBhzxxsbzsl(Integer bhzxxsbzsl) { + this.bhzxxsbzsl = bhzxxsbzsl; + } + + public Integer getZxxsbzbhsydysl() { + if (zxxsbzbhsydysl == null || zxxsbzbhsydysl == 0) { + return 1; + } + return zxxsbzbhsydysl; + } + + public void setZxxsbzbhsydysl(Integer zxxsbzbhsydysl) { + this.zxxsbzbhsydysl = zxxsbzbhsydysl; + } + + public String getBhxjcpbm() { + return bhxjcpbm; + } + + public void setBhxjcpbm(String bhxjcpbm) { + this.bhxjcpbm = bhxjcpbm; + } + + public String getSjcpbm() { + return sjcpbm; + } + + public void setSjcpbm(String sjcpbm) { + this.sjcpbm = sjcpbm; + } + + public String getBzcj() { + return bzcj; + } + + public void setBzcj(String bzcj) { + this.bzcj = bzcj; + } + + public String getAddType() { + return addType; + } + + public void setAddType(String addType) { + this.addType = addType; + } + + public String getDeviceRecordKey() { + return deviceRecordKey; + } + + public void setDeviceRecordKey(String deviceRecordKey) { + this.deviceRecordKey = deviceRecordKey; + } + + + public String getCpmctymc() { + return cpmctymc; + } + + public void setCpmctymc(String cpmctymc) { + this.cpmctymc = cpmctymc; + } + + public String getCplb() { + return cplb; + } + + public void setCplb(String cplb) { + this.cplb = cplb; + } + + public String getFlbm() { + return flbm; + } + + public void setFlbm(String flbm) { + this.flbm = flbm; + } + + public String getGgxh() { + return ggxh; + } + + public void setGgxh(String ggxh) { + this.ggxh = ggxh; + } + + public String getQxlb() { + return qxlb; + } + + public void setQxlb(String qxlb) { + this.qxlb = qxlb; + } + + public String getTyshxydm() { + return tyshxydm; + } + + public void setTyshxydm(String tyshxydm) { + this.tyshxydm = tyshxydm; + } + + public String getYlqxzcrbarmc() { + return ylqxzcrbarmc; + } + + public void setYlqxzcrbarmc(String ylqxzcrbarmc) { + this.ylqxzcrbarmc = ylqxzcrbarmc; + } + + public String getZczbhhzbapzbh() { + return zczbhhzbapzbh; + } + + public void setZczbhhzbapzbh(String zczbhhzbapzbh) { + this.zczbhhzbapzbh = zczbhhzbapzbh; + } + + public String getYlqxzcrbarywmc() { + return ylqxzcrbarywmc; + } + + public void setYlqxzcrbarywmc(String ylqxzcrbarywmc) { + this.ylqxzcrbarywmc = ylqxzcrbarywmc; + } + + public String getSydycpbs() { + return sydycpbs; + } + + public void setSydycpbs(String sydycpbs) { + this.sydycpbs = sydycpbs; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public int getVersionNumber() { + return versionNumber; + } + + public void setVersionNumber(int versionNumber) { + this.versionNumber = versionNumber; + } + + public int getDiType() { + return diType; + } + + public void setDiType(int diType) { + this.diType = diType; + } + + public String getThirdId() { + return thirdId; + } + + public void setThirdId(String thirdId) { + this.thirdId = thirdId; + } + + public String getThirdName() { + return thirdName; + } + + public void setThirdName(String thirdName) { + this.thirdName = thirdName; + } + + public String getBatchNo() { + return batchNo; + } + + public void setBatchNo(String batchNo) { + this.batchNo = batchNo; + } + + public String getProduceDate() { + return produceDate; + } + + public void setProduceDate(String produceDate) { + this.produceDate = produceDate; + } + + public String getExpireDate() { + return expireDate; + } + + public void setExpireDate(String expireDate) { + this.expireDate = expireDate; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getUdi() { + return udi; + } + + public void setUdi(String udi) { + this.udi = udi; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Integer getCount() { + if (count == null) + return 1; + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getYbbm() { + return ybbm; + } + + public void setYbbm(String ybbm) { + this.ybbm = ybbm; + } + + public Boolean getCheck() { + return isCheck; + } + + public void setCheck(Boolean check) { + isCheck = check; + } + + public Integer getProductType() { + return productType; + } + + public void setProductType(Integer productType) { + this.productType = productType; + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiRelevanceEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiRelevanceEntity.java new file mode 100644 index 0000000..8f4cafb --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/UdiRelevanceEntity.java @@ -0,0 +1,41 @@ +package com.glxp.sale.admin.entity.sync; + +import lombok.Data; + +@Data +public class UdiRelevanceEntity { + + private String id; + private String thirdId; + private String thirdName; + private String uuid; + private Boolean isUseDy; + private String updateTime; + private String thirdId1; + private String thirdId2; + private String thirdId3; + private String thirdId4; + private String thirdName1; + private String thirdName2; + private String thirdName3; + private String thirdName4; + private String manufactory; + private String measname; + private String ybbm; + private String sptm; + private Boolean isDisable; + private Boolean isLock; + private String mainId; + private String mainName; + private Integer lockStatus; + private String udplatCode; + private Boolean isAdavence; + private String genKeyFk; + private Integer gid; + + public Integer getLockStatus() { + if (lockStatus == null) + return 1; + return lockStatus; + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java b/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java index a0880f9..f165450 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/http/PostSmpHttp.java @@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.glxp.sale.admin.req.sync.*; import com.glxp.sale.admin.res.PageSimpleResponse; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -18,9 +20,23 @@ public class PostSmpHttp { @Value("${SPMS_IP}") private String spmsUrl; + @Value("${API_KEY}") + private String apiKey; + @Value("${API_SECRET}") + private String apiSecret; + + + public HttpHeaders getHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", "application/json"); + headers.add("api_key", apiKey); + headers.add("secret_key", apiSecret); + return headers; + } + public BaseResponse postOrder(PostThrOrderRequest postThrOrderRequest) { - String result = UHttpClient.postJson(spmsUrl+"/udiwms/thrsys/postOrderDetail", postThrOrderRequest); + String result = UHttpClient.postJson(spmsUrl + "/udiwms/thrsys/postOrderDetail", postThrOrderRequest, getHeaders()); BaseResponse response = JSONObject.parseObject(result, new TypeReference>() { }); @@ -28,8 +44,8 @@ public class PostSmpHttp { } - public BaseResponse postUdiInfo(PostUdiInfoRequest postUdiInfoRequest) { - String result = UHttpClient.postJson(spmsUrl+"/udiwms/basic/products/upload", postUdiInfoRequest); + public BaseResponse postUdiInfo(UdiRelevanceExportJsonResponse udiRelevanceExportJsonResponse) { + String result = UHttpClient.postJson(spmsUrl + "/udiwms/basic/products/sync/upload", udiRelevanceExportJsonResponse, getHeaders()); BaseResponse response = JSONObject.parseObject(result, new TypeReference>() { @@ -39,7 +55,7 @@ public class PostSmpHttp { public BaseResponse postThrProducts(PostThrProductsRequest postThrProductsRequest) { - String result = UHttpClient.postJson(spmsUrl+"/udiwms/thrsys/postThrProducts", postThrProductsRequest); + String result = UHttpClient.postJson(spmsUrl + "/udiwms/thrsys/postThrProducts", postThrProductsRequest, getHeaders()); BaseResponse response = JSONObject.parseObject(result, new TypeReference>() { }); @@ -48,8 +64,7 @@ public class PostSmpHttp { public BaseResponse postCorp(PostCorpsRequest postCorpsRequest) { - String result = UHttpClient.postJson(spmsUrl+"/udiwms/basic/corps/upload", postCorpsRequest); - + String result = UHttpClient.postJson(spmsUrl + "/udiwms/basic/corps/upload", postCorpsRequest, getHeaders()); BaseResponse response = JSONObject.parseObject(result, new TypeReference>() { }); @@ -61,7 +76,7 @@ public class PostSmpHttp { paramMap.put("page", filterUdiInfoRequest.getPage()); paramMap.put("limit", filterUdiInfoRequest.getLimit()); paramMap.put("lastUpdateTime", filterUdiInfoRequest.getLastUpdateTime()); - String response = UHttpClient.mipsGet(spmsUrl + "/udiwms/basic/products/download", paramMap); + String response = UHttpClient.mipsGetHead(spmsUrl + "/udiwms/basic/products/download", paramMap, getHeaders()); try { BaseResponse> udiDlDeviceResponse = JSONObject.parseObject(response, new TypeReference>>() { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/http/SpGetHttp.java b/api-admin/src/main/java/com/glxp/sale/admin/http/SpGetHttp.java index d4c1c24..69d9ec3 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/http/SpGetHttp.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/http/SpGetHttp.java @@ -12,6 +12,7 @@ import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; import com.glxp.sale.common.res.BaseResponse; import com.glxp.sale.common.util.ResultVOUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -23,10 +24,23 @@ public class SpGetHttp { @Value("${SPMS_IP}") private String spmsUrl; + @Value("${API_KEY}") + private String apiKey; + @Value("${API_SECRET}") + private String apiSecret; + + public HttpHeaders getHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", "application/json"); + headers.add("api_key", apiKey); + headers.add("secret_key", apiSecret); + return headers; + } + public BaseResponse> getOrderStatus() { Map paramMap = new HashMap<>(16); - String response = UHttpClient.mipsGet(spmsUrl + "/spms/inout/order/status", paramMap); + String response = UHttpClient.mipsGetHead(spmsUrl + "/spms/inout/order/status", paramMap, getHeaders()); try { BaseResponse> data = JSONObject.parseObject(response, new TypeReference>>() { @@ -43,7 +57,7 @@ public class SpGetHttp { public BaseResponse> getOrders(String orderId) { Map paramMap = new HashMap<>(16); paramMap.put("status", 1); - String response = UHttpClient.mipsGet(spmsUrl + "/spms/inout/order/dlByStatus", paramMap); + String response = UHttpClient.mipsGetHead(spmsUrl + "/spms/inout/order/dlByStatus", paramMap, getHeaders()); try { BaseResponse> data = JSONObject.parseObject(response, new TypeReference>>() { @@ -59,7 +73,8 @@ public class SpGetHttp { public BaseResponse postOrder(String orderId) { OrderStatusFilterRequest orderStatusFilterRequest = new OrderStatusFilterRequest(); orderStatusFilterRequest.setOrderId(orderId); - String result = UHttpClient.postJson(spmsUrl + "/spms/inout/order/deleteStatus", orderStatusFilterRequest); + orderStatusFilterRequest.setStatus(2); + String result = UHttpClient.postJson(spmsUrl + "/spms/inout/order/deleteStatus", orderStatusFilterRequest, getHeaders()); BaseResponse response = JSONObject.parseObject(result, new TypeReference>() { }); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/http/UHttpClient.java b/api-admin/src/main/java/com/glxp/sale/admin/http/UHttpClient.java index 5cec192..a9a6763 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/http/UHttpClient.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/http/UHttpClient.java @@ -5,6 +5,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -52,6 +54,19 @@ public class UHttpClient { return response; } + public static String postJson(String url, Object object, HttpHeaders headers) { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(600000); + factory.setReadTimeout(20000); + RestTemplate restTemplate = new RestTemplate(factory); + String json = JSONObject.toJSON(object).toString(); + logger.info(url + "\n" + json); + HttpEntity httpEntity = new HttpEntity<>(json, headers); + String response = restTemplate.postForObject(url, httpEntity, String.class); + logger.info(response); + return response; + } + public static String mipsGet(String url, Map params) { StringBuffer stringBuffer = new StringBuffer(url); if (params instanceof Map) { @@ -94,4 +109,43 @@ public class UHttpClient { String response = restTemplate.getForObject(accessTokenRequestUrl, String.class); return response; } + + + + public static String mipsGetHead(String url, Map params, HttpHeaders headers) { + + headers.add("Content-Type", "application/json"); + if(params!=null){ + StringBuffer stringBuffer = new StringBuffer(url); + if (params instanceof Map) { + Iterator iterator = ((Map) params).entrySet().iterator(); + if (iterator.hasNext()) { + stringBuffer.append("?"); + Object element; + while (iterator.hasNext()) { + element = iterator.next(); + Map.Entry entry = (Map.Entry) element; + if (entry.getValue() != null) { + stringBuffer.append(element).append("&"); + } + url = stringBuffer.substring(0, stringBuffer.length() - 1); + } + } + } else { + throw new RuntimeException("url请求:" + url + "请求参数有误不是map类型"); + } + } + + + RestTemplate restTemplate = new RestTemplate(); + String accessTokenRequestUrl = url;//"http://127.0.0.1:9997/mips/druginfo/list"; + logger.info(accessTokenRequestUrl); + + + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(headers), String.class); + +// String response = restTemplate.getForObject(accessTokenRequestUrl, String.class, new HttpEntity(headers)); + return response.getBody(); + } + } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/info/FilterCompanyProductRelevanceRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/info/FilterCompanyProductRelevanceRequest.java index c2a1da5..60d7dda 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/req/info/FilterCompanyProductRelevanceRequest.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/info/FilterCompanyProductRelevanceRequest.java @@ -6,7 +6,11 @@ import lombok.Data; @Data public class FilterCompanyProductRelevanceRequest extends ListPageRequest { + private Long customerId; private Long productId; private String productUuid; + private String udiRlIdFk; + private String unitFk; + private String genKeyFk; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/sync/CompanyProductRelevanceRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/CompanyProductRelevanceRequest.java new file mode 100644 index 0000000..72d992c --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/CompanyProductRelevanceRequest.java @@ -0,0 +1,50 @@ +package com.glxp.sale.admin.req.sync; + +import com.glxp.sale.admin.req.ListPageRequest; +import lombok.Data; + +@Data +public class CompanyProductRelevanceRequest extends ListPageRequest { + private String ylqxzcrbarmc; + private String cpmctymc; + private String nameCode; + private String uuid; + private String ggxh; + private String thirdId; + private String id; + + private String thirdId1; + private String thirdId2; + private String thirdId3; + private String thirdId4; + + + private String thirdCode; + private String thirdSys; + + private String lastUpdateTime; + private String zczbhhzbapzbh; + private Integer diType; + + + private String unionCode; + private String udiCode; + private String thrPiId; + + + private Boolean isCheck; + + private Integer filterType; //0:全部,1.对照完成,2.未对照DI,3.未对照产品编码,4.未对照其他产品编码 + + + private String customerId; + + + private String auditStatus; + private String companyName; + private Integer lockStatus; + private Boolean isAdavence; + private String unitFk; + private String corpId; + private String billType; +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterBasicThirdSysRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterBasicThirdSysRequest.java new file mode 100644 index 0000000..09d71a7 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterBasicThirdSysRequest.java @@ -0,0 +1,14 @@ +package com.glxp.sale.admin.req.sync; + +import com.glxp.sale.admin.req.ListPageRequest; +import lombok.Data; + +@Data +public class FilterBasicThirdSysRequest extends ListPageRequest { + + private String thirdId; + private String thirdName; + private Boolean enabled; + private Boolean mainSys; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterUdiInfoRequest.java b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterUdiInfoRequest.java index 976da0c..5c31bfc 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterUdiInfoRequest.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/req/sync/FilterUdiInfoRequest.java @@ -37,7 +37,7 @@ public class FilterUdiInfoRequest extends ListPageRequest { private Integer filterType; //0:全部,1.对照完成,2.未对照DI,3.未对照产品编码,4.未对照其他产品编码 private Integer dataType; - + private String genKeyFk; private String customerId; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/CompanyProductRelevanceResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/CompanyProductRelevanceResponse.java new file mode 100644 index 0000000..26ef92b --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/CompanyProductRelevanceResponse.java @@ -0,0 +1,61 @@ +package com.glxp.sale.admin.res.sync; + +import lombok.Data; + +@Data +public class CompanyProductRelevanceResponse { + + private int id; + private Integer rlId; + private String thirdId; + private String thirdName; + private String uuid; + private String nameCode; + private String packLevel; + private String packRatio; + private Integer bhxjsl; + private Integer bhzxxsbzsl; + private Integer zxxsbzbhsydysl; + private String bhxjcpbm; + private String sjcpbm; // + private String bzcj; + private String deviceRecordKey; + private int isUseDy; + private String cpmctymc; + private String cplb; + private String flbm; + private String ggxh; + private String qxlb; + private String tyshxydm; + private String ylqxzcrbarmc; + private String zczbhhzbapzbh; + private String ylqxzcrbarywmc; + private String sydycpbs; + private int versionNumber; + private int diType; + + private String thirdId1; + private String thirdId2; + private String thirdId3; + private String thirdId4; + private String thirdName1; + private String thirdName2; + private String thirdName3; + private String thirdName4; + + private String ybbm; + private String sptm; + private String manufactory; + private String measname; + + private long customerId; + + private String auditStatus; + private Boolean isLock; + private Integer lockStatus; + private String companyName; + private String mainId; + private String mainName; + private Boolean isAdavence; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/UdiRelevanceExportJsonResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/UdiRelevanceExportJsonResponse.java new file mode 100644 index 0000000..f6786fa --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/UdiRelevanceExportJsonResponse.java @@ -0,0 +1,28 @@ +package com.glxp.sale.admin.res.sync; + +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +/** + * 医疗器械信息导出实体类 + */ +@Data +public class UdiRelevanceExportJsonResponse { + + List udiInfoEntities; + + List udiRelevanceEntities; + + List companyProductRelevanceEntities; + + public UdiRelevanceExportJsonResponse() { + this.udiInfoEntities = new ArrayList<>(); + this.udiRelevanceEntities = new ArrayList<>(); + this.companyProductRelevanceEntities = new ArrayList<>(); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/CompanyProductRelevanceService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/CompanyProductRelevanceService.java new file mode 100644 index 0000000..011b248 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/CompanyProductRelevanceService.java @@ -0,0 +1,36 @@ +package com.glxp.sale.admin.service.sync; + + +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; +import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest; +import com.glxp.sale.admin.req.sync.CompanyProductRelevanceRequest; +import com.glxp.sale.admin.res.sync.CompanyProductRelevanceResponse; + +import java.util.List; + +public interface CompanyProductRelevanceService { + + List filterUdiGp(CompanyProductRelevanceRequest basicInstrumentMaintainRequest); + + List filterCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest); + + CompanyProductRelevanceEntity findCompanyProductRelevance(Long CustomerId); + + CompanyProductRelevanceEntity findCompanyProductRelevanceByProductId(String productId); + + CompanyProductRelevanceEntity findCompanyProductRelevanceByUdiRlIdFk(String udiRlIdFk, String customerId); + + CompanyProductRelevanceEntity findByUdiRlIdUnitFk(String udiRlIdFk, String unitFk); + + CompanyProductRelevanceEntity findCompanyProductRelevanceByProductUuid(CompanyProductRelevanceEntity companyProductRelevanceEntity); + + List getCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest); + + boolean updateCompanyProductRelevance(CompanyProductRelevanceEntity companyCertEntity); + + boolean insertCompanyProductRelevance(CompanyProductRelevanceEntity companyCertEntity); + + boolean deleteById(String id); + + boolean deleteByRlId(String id); +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoImportDetailService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoImportDetailService.java index 99ae5a5..bfacc99 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoImportDetailService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoImportDetailService.java @@ -1,9 +1,10 @@ package com.glxp.sale.admin.service.sync; - import com.glxp.sale.admin.entity.sync.UdiInfoImportDetailEntity; import com.glxp.sale.admin.req.sync.FilterUdiIpLogRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; +import org.springframework.scheduling.annotation.Async; import java.util.List; @@ -22,4 +23,8 @@ public interface UdiInfoImportDetailService { boolean deleteById(String id); boolean deleteByGenkey(String genKey); + + + @Async + void importJsonData(UdiRelevanceExportJsonResponse udiRelevanceExportJsonResponse,String genKey); } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoService.java new file mode 100644 index 0000000..67f4247 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiInfoService.java @@ -0,0 +1,37 @@ +package com.glxp.sale.admin.service.sync; + + +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface UdiInfoService { + + List filterUdiInfo(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterUdiInfo2(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterAllUdiInfo(FilterUdiInfoRequest filterUdiInfoRequest); + + UdiInfoEntity findByNameCode(String nameCode); + + UdiInfoEntity findById(@Param("id") String id); + + UdiInfoEntity findByUuid(String uuid); + + List findByUuids(String uuid); + + boolean insertUdiInfo(UdiInfoEntity udiInfoEntity); + + boolean insertUdiInfos(List udiInfoEntities); + + boolean updateUdiInfo(UdiInfoEntity udiInfoEntity); + + boolean deleteById(String id); + + boolean deleteByUuid(String uuid); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiRelevanceService.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiRelevanceService.java new file mode 100644 index 0000000..278215a --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/UdiRelevanceService.java @@ -0,0 +1,42 @@ +package com.glxp.sale.admin.service.sync; + + +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; + +import java.util.List; + +public interface UdiRelevanceService { + + List filterUdiRelevance(FilterUdiInfoRequest filterUdiInfoRequest); + + List filterUdiEntity(FilterUdiInfoRequest filterUdiInfoRequest); + + UdiRelevanceResponse selectByNameCode(String nameCode); + + List selectAllByNameCode(String nameCode); + + boolean isExit(); + + List filterUdiGp(FilterUdiInfoRequest filterUdiInfoRequest); + + boolean isExitByUuid(String uuid); + + List selectByUuid(String uuid); + + UdiRelevanceEntity selectById(String id); + + UdiRelevanceResponse selectGroupById(String id); + + + boolean insertUdiRelevance(UdiRelevanceEntity udiRelevanceEntity); + + + boolean deleteById(String id); + + boolean deleteByIds(List id); + + boolean deleteByUuid(String uuid); + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/CompanyProductRelevanceServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/CompanyProductRelevanceServiceImpl.java new file mode 100644 index 0000000..f9ff712 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/CompanyProductRelevanceServiceImpl.java @@ -0,0 +1,110 @@ +package com.glxp.sale.admin.service.sync.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.sale.admin.dao.sync.CompanyProductRelevanceDao; +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; +import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest; +import com.glxp.sale.admin.req.sync.CompanyProductRelevanceRequest; +import com.glxp.sale.admin.res.sync.CompanyProductRelevanceResponse; +import com.glxp.sale.admin.service.sync.CompanyProductRelevanceService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class CompanyProductRelevanceServiceImpl implements CompanyProductRelevanceService { + + @Resource + CompanyProductRelevanceDao companyProductRelevanceDao; + + @Override + public List filterUdiGp(CompanyProductRelevanceRequest basicInstrumentMaintainRequest) { + if (basicInstrumentMaintainRequest == null) { + return Collections.emptyList(); + } + if (basicInstrumentMaintainRequest.getPage() != null) { + int offset = (basicInstrumentMaintainRequest.getPage() - 1) * basicInstrumentMaintainRequest.getLimit(); + PageHelper.offsetPage(offset, basicInstrumentMaintainRequest.getLimit()); + } + + List data = companyProductRelevanceDao.filterUdiGp(basicInstrumentMaintainRequest); + return data; + } + + @Override + public List filterCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest) { + if (filterCompanyProductRelevanceRequest == null) { + return Collections.emptyList(); + } + if (filterCompanyProductRelevanceRequest.getPage() != null) { + int offset = (filterCompanyProductRelevanceRequest.getPage() - 1) * filterCompanyProductRelevanceRequest.getLimit(); + PageHelper.offsetPage(offset, filterCompanyProductRelevanceRequest.getLimit()); + } + return companyProductRelevanceDao.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest); + } + + @Override + public CompanyProductRelevanceEntity findCompanyProductRelevance(Long CustomerId) { + return companyProductRelevanceDao.findCompanyProductRelevance(CustomerId); + } + + @Override + public List getCompanyProductRelevance(FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest) { + if (filterCompanyProductRelevanceRequest == null) { + return Collections.emptyList(); + } + int offset = (filterCompanyProductRelevanceRequest.getPage() - 1) * filterCompanyProductRelevanceRequest.getLimit(); + PageHelper.offsetPage(offset, filterCompanyProductRelevanceRequest.getLimit()); + List companyEntities = companyProductRelevanceDao.getCompanyProductRelevance(filterCompanyProductRelevanceRequest); + return companyEntities; + } + + @Override + public CompanyProductRelevanceEntity findCompanyProductRelevanceByProductId(String productId) { + return companyProductRelevanceDao.findCompanyProductRelevanceByProductId(productId); + } + + @Override + public CompanyProductRelevanceEntity findCompanyProductRelevanceByUdiRlIdFk(String udiRlIdFk, String customerId) { + return companyProductRelevanceDao.findCompanyProductRelevanceByUdiRlIdFk(udiRlIdFk, customerId); + } + + @Override + public CompanyProductRelevanceEntity findByUdiRlIdUnitFk(String udiRlIdFk, String unitFk) { + FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest(); + filterCompanyProductRelevanceRequest.setUdiRlIdFk(udiRlIdFk); + filterCompanyProductRelevanceRequest.setUnitFk(unitFk); + List companyProductRelevanceEntities = companyProductRelevanceDao.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest); + if (companyProductRelevanceEntities.size() > 0) { + return companyProductRelevanceEntities.get(0); + } + return null; + } + + @Override + public CompanyProductRelevanceEntity findCompanyProductRelevanceByProductUuid(CompanyProductRelevanceEntity companyProductRelevanceEntity) { + return companyProductRelevanceDao.findCompanyProductRelevanceByProductUuid(companyProductRelevanceEntity); + } + + @Override + public boolean updateCompanyProductRelevance(CompanyProductRelevanceEntity companyProductRelevanceEntity) { + return companyProductRelevanceDao.updateCompanyProductRelevance(companyProductRelevanceEntity); + } + + @Override + public boolean insertCompanyProductRelevance(CompanyProductRelevanceEntity companyProductRelevanceEntity) { + return companyProductRelevanceDao.insertCompanyProductRelevance(companyProductRelevanceEntity); + } + + @Override + public boolean deleteById(String id) { + return companyProductRelevanceDao.deleteById(id); + } + + @Override + public boolean deleteByRlId(String id) { + return companyProductRelevanceDao.deleteByRlId(id); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoImportDetailServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoImportDetailServiceImpl.java index 0db4aa9..0eeb995 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoImportDetailServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoImportDetailServiceImpl.java @@ -1,10 +1,18 @@ package com.glxp.sale.admin.service.sync.impl; +import cn.hutool.core.collection.CollUtil; import com.github.pagehelper.PageHelper; +import com.glxp.sale.admin.constant.BasicProcessStatus; +import com.glxp.sale.admin.dao.sync.CompanyProductRelevanceDao; +import com.glxp.sale.admin.dao.sync.UdiInfoDao; import com.glxp.sale.admin.dao.sync.UdiInfoImportDetailDao; +import com.glxp.sale.admin.dao.sync.UdiRelevanceDao; import com.glxp.sale.admin.entity.sync.UdiInfoImportDetailEntity; +import com.glxp.sale.admin.entity.sync.UdiInfoImportLogEntity; import com.glxp.sale.admin.req.sync.FilterUdiIpLogRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; import com.glxp.sale.admin.service.sync.UdiInfoImportDetailService; +import com.glxp.sale.admin.service.sync.UdiInfoImportLogService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -16,7 +24,14 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic @Resource UdiInfoImportDetailDao udiInfoImportDao; - + @Resource + UdiInfoDao udiInfoDao; + @Resource + UdiRelevanceDao udiRelevanceDao; + @Resource + CompanyProductRelevanceDao companyProductRelevanceDao; + @Resource + UdiInfoImportLogService udiInfoImportLogService; @Override public List filterUdiInfoImport(FilterUdiIpLogRequest filterInCodeLogRequest) { @@ -57,4 +72,24 @@ public class UdiInfoImportDetailServiceImpl implements UdiInfoImportDetailServic public boolean deleteByGenkey(String genKey) { return udiInfoImportDao.deleteByGenkey(genKey); } + + @Override + public void importJsonData(UdiRelevanceExportJsonResponse udiRelevanceExportJsonResponse, String genKey) { + if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiInfoEntities())) { + udiInfoDao.importUdiInfo(udiRelevanceExportJsonResponse.getUdiInfoEntities()); + } + + if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getUdiRelevanceEntities())) { + udiRelevanceDao.importUdiRelevance(udiRelevanceExportJsonResponse.getUdiRelevanceEntities()); + } + + if (CollUtil.isNotEmpty(udiRelevanceExportJsonResponse.getCompanyProductRelevanceEntities())) { + companyProductRelevanceDao.importComapnyUdiRelevance(udiRelevanceExportJsonResponse.getUdiRelevanceEntities()); + } + +// UdiInfoImportLogEntity udiInfoImportLogEntity = udiInfoImportLogService.selectByGenKey(genKey); +// udiInfoImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); +// udiInfoImportLogService.updateImportLog(udiInfoImportLogEntity); + } } + diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoServiceImpl.java new file mode 100644 index 0000000..8b88ab7 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiInfoServiceImpl.java @@ -0,0 +1,104 @@ +package com.glxp.sale.admin.service.sync.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.sale.admin.dao.sync.UdiInfoDao; +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import com.glxp.sale.admin.service.sync.UdiInfoService; +import com.glxp.sale.admin.util.FilterUdiUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class UdiInfoServiceImpl implements UdiInfoService { + + @Resource + UdiInfoDao udiInfoDao; + + @Override + public List filterUdiInfo(FilterUdiInfoRequest filterUdiInfoRequest) { + if (filterUdiInfoRequest == null) { + return Collections.emptyList(); + } + if(filterUdiInfoRequest.getPage()!=null){ + int offset = (filterUdiInfoRequest.getPage() - 1) * filterUdiInfoRequest.getLimit(); + PageHelper.offsetPage(offset, filterUdiInfoRequest.getLimit()); + } + + List data = udiInfoDao.filterUdiInfo(filterUdiInfoRequest); + return data; + } + + @Override + public List filterUdiInfo2(FilterUdiInfoRequest filterUdiInfoRequest) { + if (filterUdiInfoRequest == null) { + return Collections.emptyList(); + } + if (filterUdiInfoRequest.getPage() != null) { + int offset = (filterUdiInfoRequest.getPage() - 1) * filterUdiInfoRequest.getLimit(); + PageHelper.offsetPage(offset, filterUdiInfoRequest.getLimit()); + } + + List data = udiInfoDao.filterUdiInfo2(filterUdiInfoRequest); + return data; + } + + @Override + public List filterAllUdiInfo(FilterUdiInfoRequest filterUdiInfoRequest) { + if (filterUdiInfoRequest == null) { + return Collections.emptyList(); + } + List data = udiInfoDao.filterUdiInfo(filterUdiInfoRequest); + return data; + } + + @Override + public UdiInfoEntity findByNameCode(String nameCode) { + String prefix = FilterUdiUtils.getDiStr(nameCode); + return udiInfoDao.findByNameCode(prefix); + } + + @Override + public UdiInfoEntity findById(String id) { + return udiInfoDao.findById(id); + } + + @Override + public UdiInfoEntity findByUuid(String uuid) { + return udiInfoDao.findByUuid(uuid); + } + + @Override + public List findByUuids(String uuid) { + return udiInfoDao.findByUuids(uuid); + } + + @Override + public boolean insertUdiInfo(UdiInfoEntity udiInfoEntity) { + return udiInfoDao.insertUdiInfo(udiInfoEntity); + } + + @Override + public boolean insertUdiInfos(List udiInfoEntities) { + return udiInfoDao.insertUdiInfos(udiInfoEntities); + } + + @Override + public boolean updateUdiInfo(UdiInfoEntity udiInfoEntity) { + return udiInfoDao.updateUdiInfo(udiInfoEntity); + } + + @Override + public boolean deleteById(String id) { + return udiInfoDao.deleteById(id); + } + + @Override + public boolean deleteByUuid(String uuid) { + return udiInfoDao.deleteByUuid(uuid); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiRelevanceServiceImpl.java b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiRelevanceServiceImpl.java new file mode 100644 index 0000000..3fed9f7 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/service/sync/impl/UdiRelevanceServiceImpl.java @@ -0,0 +1,137 @@ +package com.glxp.sale.admin.service.sync.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.sale.admin.dao.sync.UdiRelevanceDao; +import com.glxp.sale.admin.entity.sync.BasicThirdSysEntity; +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import com.glxp.sale.admin.service.sync.UdiRelevanceService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class UdiRelevanceServiceImpl implements UdiRelevanceService { + @Resource + UdiRelevanceDao udiRelevanceDao; + + @Override + public List filterUdiRelevance(FilterUdiInfoRequest filterUdiInfoRequest) { + if (filterUdiInfoRequest == null) { + return Collections.emptyList(); + } + if (filterUdiInfoRequest.getPage() != null) { + int offset = (filterUdiInfoRequest.getPage() - 1) * filterUdiInfoRequest.getLimit(); + PageHelper.offsetPage(offset, filterUdiInfoRequest.getLimit()); + } + + List data = udiRelevanceDao.filterUdiRelevance(filterUdiInfoRequest); + return data; + } + + @Override + public List filterUdiEntity(FilterUdiInfoRequest filterUdiInfoRequest) { + + List data = udiRelevanceDao.filterEntity(filterUdiInfoRequest); + return data; + } + + @Override + public UdiRelevanceResponse selectByNameCode(String nameCode) { + FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest(); + filterUdiInfoRequest.setNameCode(nameCode); + List udiRelevanceResponses = filterUdiRelevance(filterUdiInfoRequest); + if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) + return udiRelevanceResponses.get(0); + return null; + } + + @Override + public List selectAllByNameCode(String nameCode) { + FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest(); + filterUdiInfoRequest.setNameCode(nameCode); + List udiRelevanceResponses = filterUdiRelevance(filterUdiInfoRequest); + return udiRelevanceResponses; + } + + @Override + public boolean isExit() { + FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest(); + filterUdiInfoRequest.setPage(1); + filterUdiInfoRequest.setLimit(1); + List data = filterUdiRelevance(filterUdiInfoRequest); + if (data != null && data.size() > 0) { + return true; + } + return false; + } + + @Override + public List filterUdiGp(FilterUdiInfoRequest filterUdiInfoRequest) { + if (filterUdiInfoRequest == null) { + return Collections.emptyList(); + } + if (filterUdiInfoRequest.getPage() != null) { + int offset = (filterUdiInfoRequest.getPage() - 1) * filterUdiInfoRequest.getLimit(); + PageHelper.offsetPage(offset, filterUdiInfoRequest.getLimit()); + } + + List data = udiRelevanceDao.filterUdiGp(filterUdiInfoRequest); + return data; + } + + @Override + public boolean isExitByUuid(String uuid) { + List udiRelevanceEntities = udiRelevanceDao.selectByUuid(uuid); + if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) { + return true; + } + return false; + } + + @Override + public List selectByUuid(String uuid) { + return udiRelevanceDao.selectByUuid(uuid); + } + + @Override + public UdiRelevanceEntity selectById(String id) { + return udiRelevanceDao.selectById(id); + } + + @Override + public UdiRelevanceResponse selectGroupById(String id) { + FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest(); + filterUdiInfoRequest.setId(id); + filterUdiInfoRequest.setDiType(1); + List data = udiRelevanceDao.filterUdiRelevance(filterUdiInfoRequest); + if (data != null && data.size() > 0) + return data.get(0); + return null; + } + + + @Override + public boolean insertUdiRelevance(UdiRelevanceEntity udiRelevanceEntity) { + return udiRelevanceDao.insertUdiRelevance(udiRelevanceEntity); + } + + + @Override + public boolean deleteById(String id) { + return udiRelevanceDao.deleteById(id); + } + + @Override + public boolean deleteByIds(List ids) { + return udiRelevanceDao.deleteByIds(ids); + } + + @Override + public boolean deleteByUuid(String uuid) { + return udiRelevanceDao.deleteByUuid(uuid); + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicGenExcelService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicGenExcelService.java new file mode 100644 index 0000000..3d23861 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/BasicGenExcelService.java @@ -0,0 +1,64 @@ +package com.glxp.sale.admin.thread; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.io.file.FileWriter; +import cn.hutool.json.JSONUtil; +import com.glxp.sale.admin.constant.BasicProcessStatus; +import com.glxp.sale.admin.dao.sync.UdiInfoDao; +import com.glxp.sale.admin.dao.sync.UdiRelevanceDao; +import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity; +import com.glxp.sale.admin.entity.sync.CorpImportDetailEntity; +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.entity.sync.UdiInfoImportDetailEntity; +import com.glxp.sale.admin.entity.sync.UdiRelevanceEntity; +import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest; +import com.glxp.sale.admin.req.sync.FilterUdiInfoRequest; +import com.glxp.sale.admin.req.sync.PostCorpsRequest; +import com.glxp.sale.admin.req.sync.PostUdiInfoRequest; +import com.glxp.sale.admin.res.sync.UdiRelevanceExportJsonResponse; +import com.glxp.sale.admin.res.sync.UdiRelevanceResponse; +import com.glxp.sale.admin.service.sync.CompanyProductRelevanceService; +import com.glxp.sale.admin.service.sync.UdiInfoService; +import com.glxp.sale.admin.service.sync.UdiRelevanceService; +import com.glxp.sale.admin.util.ExcelUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Slf4j +@Service +public class BasicGenExcelService { + @Resource + UdiRelevanceService udiRelevanceService; + @Resource + UdiInfoService udiInfoService; + @Resource + private CompanyProductRelevanceService companyProductRelevanceService; + + public UdiRelevanceExportJsonResponse exportJsonUdiInfo(String genKey) { + + FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest(); + filterUdiInfoRequest.setGenKeyFk(genKey); + List udiRelevanceEntities = udiRelevanceService.filterUdiEntity(filterUdiInfoRequest); + FilterCompanyProductRelevanceRequest filterCompanyProductRelevanceRequest = new FilterCompanyProductRelevanceRequest(); + filterCompanyProductRelevanceRequest.setGenKeyFk(genKey); + List companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(filterCompanyProductRelevanceRequest); + List udiInfoEntities = udiInfoService.filterUdiInfo(filterUdiInfoRequest); + UdiRelevanceExportJsonResponse exportData = new UdiRelevanceExportJsonResponse(); + exportData.setCompanyProductRelevanceEntities(companyProductRelevanceEntities); + exportData.setUdiInfoEntities(udiInfoEntities); + exportData.setUdiRelevanceEntities(udiRelevanceEntities); + return exportData; + } + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/DataImportService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/DataImportService.java index 88a5ab3..56be265 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/DataImportService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/DataImportService.java @@ -21,6 +21,7 @@ import com.glxp.sale.admin.util.DateUtil; import com.glxp.sale.common.res.BaseResponse; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -45,6 +46,19 @@ public class DataImportService { @Value("${SPMS_IP}") private String spmsUrl; + @Value("${API_KEY}") + private String apiKey; + @Value("${API_SECRET}") + private String apiSecret; + + + public HttpHeaders getHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", "application/json"); + headers.add("api_key", apiKey); + headers.add("secret_key", apiSecret); + return headers; + } // //接收第三方上传或文件导入数据 @Async @@ -120,7 +134,7 @@ public class DataImportService { paramMap.put("page", page); paramMap.put("limit", limit); paramMap.put("lastUpdateTime", lastUpdateTime); - String response = UHttpClient.mipsGet(spmsUrl + "/udiwms/basic/products/download", paramMap); + String response = UHttpClient.mipsGetHead(spmsUrl + "/udiwms/basic/products/download", paramMap, getHeaders()); try { BaseResponse> udiDlDeviceResponse = JSONObject.parseObject(response, new TypeReference>>() { diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlSpOrderService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlSpOrderService.java index e976136..f5c22e5 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlSpOrderService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlSpOrderService.java @@ -60,47 +60,50 @@ public class DlSpOrderService { if (dlOrderResponses != null && dlOrderResponses.size() > 0) { for (DlOrderResponse dlOrderResponse : dlOrderResponses) { OrderEntity orderEntity = dlOrderResponse.getOrderEntity(); - IOOrderStatusEntity temp = ioOrderStatusService.findByOrderId(orderEntity.getId()); - if (temp == null) {//避免重复操作插入 - if (Integer.parseInt(stausConfig.getParamValue()) == 1) { - IOOrderStatusEntity orderStatusEntity = new IOOrderStatusEntity(); - orderStatusEntity.setOrderId(orderEntity.getId()); - orderStatusEntity.setUpdateTime(new Date()); - orderStatusEntity.setStatus(1); - ioOrderStatusService.insertOrderStatus(orderStatusEntity); - List codes = dlOrderResponse.getCodes(); - orderService.insertOrder(orderEntity); - codesService.insertWarehouses(codes); - } + if(orderEntity!=null){ + IOOrderStatusEntity temp = ioOrderStatusService.findByOrderId(orderEntity.getId()); + if (temp == null) {//避免重复操作插入 + if (Integer.parseInt(stausConfig.getParamValue()) == 1) { + IOOrderStatusEntity orderStatusEntity = new IOOrderStatusEntity(); + orderStatusEntity.setOrderId(orderEntity.getId()); + orderStatusEntity.setUpdateTime(new Date()); + orderStatusEntity.setStatus(1); + ioOrderStatusService.insertOrderStatus(orderStatusEntity); + List codes = dlOrderResponse.getCodes(); + orderService.insertOrder(orderEntity); + codesService.insertWarehouses(codes); + } - if (Integer.parseInt(folderConfig.getParamValue()) == 1) { - String fileName = filePath + "/" + "扫码单据" + orderEntity.getId() + ".json"; - String backFileName = backFilePath + "/" + "扫码单据" + orderEntity.getId() + ".json"; - List postOrders = new ArrayList<>(); - PostOrderRequest postOrderRequest = new PostOrderRequest(); - List warehouseEntityList = dlOrderResponse.getCodes(); - PostOrderRequest.PostOrder postOrder = new PostOrderRequest.PostOrder(); - postOrder.setCodes(warehouseEntityList); - postOrder.setBillType(orderEntity.getAction()); - postOrders.add(postOrder); - postOrderRequest.setPostOrders(postOrders); - String json = JSONObject.toJSON(postOrderRequest).toString(); - FileUtils.makeDirectory(filePath); - FileUtils.makeDirectory(backFilePath); - FileUtils.SaveFileAs(json, fileName); - FileUtils.SaveFileAs(json, backFileName); - ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity(); - thrImportLogEntity.setGenKey(CustomUtil.getUUId()); - thrImportLogEntity.setImportType(1); - thrImportLogEntity.setUpdateTime(new Date()); - thrImportLogEntity.setFilePath(fileName); - thrImportLogEntity.setBackFilePath(backFileName); - thrImportLogEntity.setOrderId(orderEntity.getId()); - thrImportLogService.insertImportLog(thrImportLogEntity); + if (Integer.parseInt(folderConfig.getParamValue()) == 1) { + String fileName = filePath + "/" + "扫码单据" + orderEntity.getId() + ".json"; + String backFileName = backFilePath + "/" + "扫码单据" + orderEntity.getId() + ".json"; + List postOrders = new ArrayList<>(); + PostOrderRequest postOrderRequest = new PostOrderRequest(); + List warehouseEntityList = dlOrderResponse.getCodes(); + PostOrderRequest.PostOrder postOrder = new PostOrderRequest.PostOrder(); + postOrder.setCodes(warehouseEntityList); + postOrder.setBillType(orderEntity.getAction()); + postOrders.add(postOrder); + postOrderRequest.setPostOrders(postOrders); + String json = JSONObject.toJSON(postOrderRequest).toString(); + FileUtils.makeDirectory(filePath); + FileUtils.makeDirectory(backFilePath); + FileUtils.SaveFileAs(json, fileName); + FileUtils.SaveFileAs(json, backFileName); + ThrImportLogEntity thrImportLogEntity = new ThrImportLogEntity(); + thrImportLogEntity.setGenKey(CustomUtil.getUUId()); + thrImportLogEntity.setImportType(1); + thrImportLogEntity.setUpdateTime(new Date()); + thrImportLogEntity.setFilePath(fileName); + thrImportLogEntity.setBackFilePath(backFileName); + thrImportLogEntity.setOrderId(orderEntity.getId()); + thrImportLogService.insertImportLog(thrImportLogEntity); + } + spGetHttp.postOrder(orderEntity.getId()); } - spGetHttp.postOrder(orderEntity.getId()); } + } } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/util/FilterUdiUtils.java b/api-admin/src/main/java/com/glxp/sale/admin/util/FilterUdiUtils.java new file mode 100644 index 0000000..fde4f82 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/util/FilterUdiUtils.java @@ -0,0 +1,273 @@ +package com.glxp.sale.admin.util; + + +import com.glxp.sale.admin.entity.sync.UdiInfoEntity; +import com.glxp.sale.admin.entity.sync.WarehouseEntity; + +/** + * @author 彭于晏 + * @date 2020/9/22. + */ +public class FilterUdiUtils { + private static final String TAG = "FilterUdiUtils"; + + public static UdiEntity getUdi(String data) { + if (data != null && data.length() > 2) { + if (data.substring(0, 2).equals("MA")) { + return getZGCUdi(data); + } else if (data.substring(0, 2).equals("01")) { + return getGS1Udi(data); + } else if (data.substring(0, 1).equals("#")) { + return getGLXPUdi(data); + } + } + return null; + } + + public static UdiEntity getGS1Udi(String data) { + String batchNo = ""; + String produceDate = ""; + String expireDate = ""; + String serialNo = null; + String udi = ""; + UdiEntity udiEntity = null; + if (data.length() >= 16) { + udi = data.substring(2, 16); + if (data.length() >= 18 && data.substring(16, 18).equals("10")) { + if (data.contains("\u001D")) { + String[] splits = data.split("\u001D"); + String front = splits[0]; + batchNo = front.substring(18, front.length()); + String last = splits[1]; + boolean b = last.length() >= 18 && last.substring(16, 18).equals("21"); + if ((last != null && last.length() >= 2) && last.substring(0, 2).equals("11")) { + produceDate = last.substring(2, 8); + if (last.length() >= 10 && last.substring(8, 10).equals("17")) { + expireDate = last.substring(10, 16); + if (b) { + serialNo = last.substring(18, last.length()); + } else { + serialNo = null; + } + } + } else if ((last != null && last.length() >= 2) && last.substring(0, 2).equals("17")) { + expireDate = last.substring(2, 8); + if (last.length() >= 10 && last.substring(8, 10).equals("11")) { + produceDate = last.substring(10, 16); + if (b) { + serialNo = last.substring(18, last.length()); + } else { + serialNo = null; + } + } + } else if ((last != null && last.length() >= 2) && last.substring(0, 2).equals("21")) { + serialNo = last.substring(2, last.length()); + } + } else { + batchNo = data.substring(18); + } + + + } else if (data.length() >= 18 && data.substring(16, 18).equals("11")) { + produceDate = data.substring(18, 24); + if (data.length() >= 26 && data.substring(24, 26).equals("17")) { + expireDate = data.substring(26, 32); + if (data.length() >= 34 && data.substring(32, 34).equals("10")) { + if (data.contains("\u001D")) { + String[] splits = data.split("\u001D"); + batchNo = splits[0].substring(34, splits[0].length()); + serialNo = splits[1].substring(2); + } else { + batchNo = data.substring(34, data.length()); + } + + } + } else if (data.length() >= 26 && data.substring(24, 26).equals("10")) { + if (data.contains("\u001D")) { + String[] splits = data.split("\u001D"); + batchNo = splits[0].substring(26, splits[0].length()); + String last = splits[1]; + if (last.substring(0, 2).equals("17")) { + expireDate = last.substring(2, 8); + if (last.length() >= 10) { + serialNo = last.substring(10, last.length()); + } + } else if (last.substring(0, 2).equals("21")) { + serialNo = last.substring(2, last.length()); + } + } else { + batchNo = data.substring(26, data.length()); + } + + } else if (data.length() >= 26 && data.substring(24, 26).equals("21")) { + + serialNo = data.substring(26); + } + } else if (data.length() >= 18 && data.substring(16, 18).equals("17")) { + expireDate = data.substring(18, 24); + if (data.length() >= 26 && data.substring(24, 26).equals("11")) { + produceDate = data.substring(26, 32); + if (data.length() >= 34 && data.substring(32, 34).equals("10")) { + if (data.contains("\u001D")) { + String[] splits = data.split("\u001D"); + batchNo = splits[0].substring(34, splits[0].length()); + serialNo = splits[1].substring(2); + } else { + batchNo = data.substring(34, data.length()); + } + + } + } else if (data.length() >= 26 && data.substring(24, 26).equals("10")) { + if (data.contains("\u001D")) { + String[] splits = data.split("\u001D"); + batchNo = splits[0].substring(26); + String last = splits[1]; + if (last.substring(0, 2).equals("11")) { + produceDate = last.substring(2, 8); + if (last.length() > 8 && last.substring(8, 10).equals("21")) { + serialNo = last.substring(10); + } + } else if (last.substring(0, 2).equals("21")) { + serialNo = last.substring(2); + } + } else { + batchNo = data.substring(26, data.length()); + } + } else if (data.length() >= 26 && data.substring(24, 26).equals("21")) { + + serialNo = data.substring(26); + } + + } else if (data.length() >= 18 && data.substring(16, 18).equals("21")) { + serialNo = data.substring(18); + } + udiEntity = new UdiEntity(); + udiEntity.setUdi(udi); + udiEntity.setBatchNo(batchNo); + udiEntity.setExpireDate(expireDate); + udiEntity.setProduceDate(produceDate); + udiEntity.setSerialNo(serialNo); + } + return udiEntity; + } + + public static UdiEntity getZGCUdi(String data) { + String batchNo = ""; + String produceDate = ""; + String expireDate = ""; + String serialNo = null; + String udi = data; + String[] spilts = data.split("[.]"); + if (spilts != null && spilts.length >= 5) { + for (int i = 0; i < 5; i++) { + udi = udi + "." + spilts[i]; + } + udi = udi.substring(1); + for (int i = 0; i < spilts.length; i++) { + String tempStr = spilts[i]; + if (tempStr != null && tempStr.length() > 1 && tempStr.substring(0, 1).equals("P")) { + produceDate = tempStr.substring(1); + } else if (tempStr != null && tempStr.length() > 1 && tempStr.substring(0, 1).equals("L")) { + batchNo = tempStr.substring(1); + } else if (tempStr != null && tempStr.length() > 1 && tempStr.substring(0, 1).equals("E")) { + expireDate = tempStr.substring(1); + } else if (tempStr != null && tempStr.length() > 1 && tempStr.substring(0, 1).equals("S")) { + serialNo = tempStr.substring(1); + } + } + } + + UdiEntity udiEntity = new UdiEntity(); + udiEntity.setBatchNo(batchNo); + udiEntity.setExpireDate(expireDate); + udiEntity.setProduceDate(produceDate); + udiEntity.setUdi(udi); + udiEntity.setSerialNo(serialNo); + return udiEntity; + + } + + public static UdiEntity getGLXPUdi(String data) { + String batchNo = ""; + String produceDate = ""; + String expireDate = ""; + String serialNo = null; + String udi = ""; + String[] spilts = data.split("#"); + if (spilts != null && spilts.length >= 5) { + udi = spilts[1]; + produceDate = spilts[2]; + expireDate = spilts[3]; + batchNo = spilts[4]; + if (spilts.length > 6) { + serialNo = spilts[5]; + if (serialNo != null && serialNo.equals("")) { + serialNo = null; + } + } + + } + UdiEntity udiEntity = new UdiEntity(); + udiEntity.setBatchNo(batchNo); + udiEntity.setExpireDate(expireDate); + udiEntity.setProduceDate(produceDate); + udiEntity.setUdi(udi); + udiEntity.setSerialNo(serialNo); + return udiEntity; + } + + public static String getDiStr(String data) { + String prefix = ""; + if (data != null && data.length() > 2) { + if (data.substring(0, 2).equals("MA")) { + String[] spilts = data.split("[.]"); + if (spilts != null && spilts.length >= 5) { + for (int i = 0; i < 5; i++) { + prefix = prefix + "." + spilts[i]; + } + prefix = prefix.substring(1); + } + } else if (data.substring(0, 2).equals("01") && data.length() >= 16) { + prefix = data.substring(2, 16); + } else if (data.substring(0, 1).equals("#")) { + String[] spilts = data.split("#"); + if (spilts != null && spilts.length >= 1) + prefix = spilts[1]; + } + } + if (prefix.equals("")) + return data; + return prefix; + } + + + public static UdiInfoEntity transUdi(UdiInfoEntity data) { + UdiEntity udiEntity = getUdi(data.getCode()); + if (udiEntity != null) { + data.setBatchNo(udiEntity.getBatchNo()); + data.setProduceDate(udiEntity.getProduceDate()); + data.setExpireDate(udiEntity.getExpireDate()); + data.setSerialNo(udiEntity.getSerialNo()); + data.setUdi(udiEntity.getUdi()); + } + return data; + } + + public static String transGlxpStr(String code) { + UdiEntity udiEntity = getUdi(code); + String udiCode = "#" + udiEntity.getUdi() + "#" + udiEntity.getProduceDate() + "#" + udiEntity.getExpireDate() + + "#" + udiEntity.getBatchNo() + "#" + udiEntity.getSerialNo() + "#" + "#"; + return udiCode; + } + + public static String transGlxpNoSerStr(WarehouseEntity warehouseEntity) { + String udiCode = "#" + warehouseEntity.getNameCode() + "#" + warehouseEntity.getProduceDate() + "#" + warehouseEntity.getExpireDate() + + "#" + warehouseEntity.getBatchNo() + "#" + "#" + "#"; + return udiCode; + } + public static String transGlxpNoSerStr(UdiEntity warehouseEntity) { + String udiCode = "#" + warehouseEntity.getUdi() + "#" + warehouseEntity.getProduceDate() + "#" + warehouseEntity.getExpireDate() + + "#" + warehouseEntity.getBatchNo() + "#" + "#" + "#"; + return udiCode; + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/util/UdiEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/util/UdiEntity.java new file mode 100644 index 0000000..7178e55 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/util/UdiEntity.java @@ -0,0 +1,65 @@ +package com.glxp.sale.admin.util; + +/** + * @author 彭于晏 + * @date 2020/9/22. + */ +public class UdiEntity { + + private String batchNo; + private String produceDate; + private String expireDate; + private String serialNo; + private String udi; + + public String getBatchNo() { + return batchNo; + } + + public void setBatchNo(String batchNo) { + this.batchNo = batchNo; + } + + public String getProduceDate() { + return produceDate; + } + + public void setProduceDate(String produceDate) { + this.produceDate = produceDate; + } + + public String getExpireDate() { + return expireDate; + } + + public void setExpireDate(String expireDate) { + this.expireDate = expireDate; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getUdi() { + return udi; + } + + public void setUdi(String udi) { + this.udi = udi; + } + + @Override + public String toString() { + return "UdiEntity{" + + "batchNo='" + batchNo + '\'' + + ", produceDate='" + produceDate + '\'' + + ", expireDate='" + expireDate + '\'' + + ", serialNo='" + serialNo + '\'' + + ", udi='" + udi + '\'' + + '}'; + } +} diff --git a/api-admin/src/main/resources/application-pro.properties b/api-admin/src/main/resources/application-pro.properties index 46fa708..235d258 100644 --- a/api-admin/src/main/resources/application-pro.properties +++ b/api-admin/src/main/resources/application-pro.properties @@ -6,7 +6,7 @@ spring.datasource.username=root #spring.datasource.password=root spring.datasource.password=123456 #server.servlet.context-path= -#logging.level.com.glxp.sale.admin.dao=debug +logging.level.com.glxp.sale.admin.dao=debug # \u8DE8\u57DF\u8BBE\u7F6E cors.allowed-origins=* cors.allowed-headers=Content-Type,ADMIN_ID,ADMIN_TOKEN @@ -22,8 +22,11 @@ server.connectionTimeout=180000 #logging.level.com.glxp.sale.admin.dao=debug # \u8F93\u51FA\u65E5\u5FD7\u5230\u9879\u76EE\u6839\u76EE\u5F55\u4E0B\u7684springboot.log\u6587\u4EF6\u4E2D // \u914D\u7F6E logback-spring.xml\u65F6 \u6B64\u65E5\u5FD7\u8F93\u51FA\u65B9\u5F0F\u4F1A\u88AB\u8986\u76D6\u3002 logging.file=D:/1s/udiwms/udiwms.log +#logging.file=/www/glxpdata/spsyc/ file_path=D:/1s/udiwms/sp/order/sync +#file_path=/share/order/sync back_file_path=D:/1s/udiwms/sp/order/sync/sync_back +#back_file_path=/share/order/sync_back #UDI\u6570\u636E\u4E0B\u8F7D UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server #UCLOD\u670D\u52A1 @@ -43,6 +46,8 @@ spring.jackson.time-zone=GMT+8 #UDIWMS_IP=http://139.159.187.130:8080/UDI_WMS_MC UDIWMS_IP=http://127.0.0.1:9991 SPMS_IP=http://127.0.0.1:9996 +API_KEY=1101 +API_SECRET=zBITspLNvuoEd4FaamlSoqxRHmNsmQ9L #SPMS_IP=http://139.159.187.130:8080/SPMS_SERVER ##端口号 # Redis数据库索引(默认为0) diff --git a/api-admin/src/main/resources/logback-spring.xml b/api-admin/src/main/resources/logback-spring.xml index 8a2b724..bd4c40d 100644 --- a/api-admin/src/main/resources/logback-spring.xml +++ b/api-admin/src/main/resources/logback-spring.xml @@ -11,14 +11,16 @@ - - - - + + + - + @@ -38,7 +40,7 @@ - d:/1s/udiwms/logs/${LOG_INFO_HOME}//%d{yyyy-MM-dd}_%i.log + /www/glxpdata/spsync/logs/${LOG_INFO_HOME}//%d{yyyy-MM-dd}_%i.log 30 - d:/1s/udiwms/logs/${LOG_ERROR_HOME}//%d{yyyy-MM-dd}_%i.log + /www/glxpdata/spsync/logs/${LOG_ERROR_HOME}//%d{yyyy-MM-dd}_%i.log 30 - - - + + + - - - + + + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/sync/CompanyProductRelevanceDao.xml b/api-admin/src/main/resources/mybatis/mapper/sync/CompanyProductRelevanceDao.xml new file mode 100644 index 0000000..dc933f2 --- /dev/null +++ b/api-admin/src/main/resources/mybatis/mapper/sync/CompanyProductRelevanceDao.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + UPDATE company_product_relevance + + customerId=#{customerId}, + name=#{name}, + tel=#{tel}, + phone=#{phone}, + create_time=#{create_time}, + update_time=#{update_time}, + auditStatus=#{auditStatus}, + productUuid=#{productUuid}, + udiRlIdFk=#{udiRlIdFk}, + unitFk=#{unitFk}, + + + WHERE id = #{id} + + + + replace + INTO company_product_relevance(customerId,productId,enterpriseId,registrationId, + create_time,update_time,auditStatus,productUuid,udiRlIdFk,unitFk) values + ( + #{customerId}, + #{productId}, + #{enterpriseId}, + #{registrationId}, + #{create_time}, + #{update_time}, + #{auditStatus}, + #{productUuid}, + #{udiRlIdFk}, + #{unitFk} + ) + + + + + replace into basic_udirel (id, customerId, productId, enterpriseId, create_time, update_time, auditStatus, + productUuid, udiRlIdFk,unitFk,genKeyFk) + values + + (#{item.id}, + #{item.customerId}, + #{item.productId}, + #{item.enterpriseId}, + #{item.registrationId}, + #{item.create_time}, + #{item.update_time}, + #{item.auditStatus}, + #{item.productUuid}, + #{item.udiRlIdFk}, + #{item.unitFk},#{item.genKeyFk}) + + + + + + DELETE + FROM company_product_relevance + WHERE id = #{id} + + + + + DELETE + FROM company_product_relevance + WHERE udiRlIdFk = #{id} + + + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/sync/UdiInfoDao.xml b/api-admin/src/main/resources/mybatis/mapper/sync/UdiInfoDao.xml new file mode 100644 index 0000000..4f0f666 --- /dev/null +++ b/api-admin/src/main/resources/mybatis/mapper/sync/UdiInfoDao.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + replace INTO basic_products + ( + nameCode,packRatio,packLevel,bhxjsl, + bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,addType,deviceRecordKey, + cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber + ,diType,productType,genKeyFk) + values + ( + #{nameCode}, + #{packRatio}, + #{packLevel}, + #{bhxjsl}, + #{bhzxxsbzsl}, + #{zxxsbzbhsydysl}, + #{bhxjcpbm}, + #{bzcj}, + #{addType}, + #{deviceRecordKey}, + #{cpmctymc}, + #{cplb}, + #{flbm}, + #{ggxh}, + #{qxlb}, + #{tyshxydm}, + #{ylqxzcrbarmc}, + #{zczbhhzbapzbh}, + #{ylqxzcrbarywmc}, + #{uuid}, + #{sjcpbm}, + #{versionNumber}, + #{diType},#{productType},#{genKeyFk} + ) + + + + replace INTO basic_products + ( + nameCode,packRatio,packLevel,bhxjsl, + bhzxxsbzsl,zxxsbzbhsydysl,bhxjcpbm,bzcj,addType,deviceRecordKey, + cpmctymc,cplb,flbm,ggxh,qxlb,tyshxydm,ylqxzcrbarmc,zczbhhzbapzbh,ylqxzcrbarywmc,uuid,sjcpbm,versionNumber + ,diType,productType,genKeyFk + ) + values + + + ( + #{item.nameCode}, + #{item.packRatio}, + #{item.packLevel}, + #{item.bhxjsl}, + #{item.bhzxxsbzsl}, + #{item.zxxsbzbhsydysl}, + #{item.bhxjcpbm}, + #{item.bzcj}, + #{item.addType}, + #{item.deviceRecordKey}, + #{item.cpmctymc}, + #{item.cplb}, + #{item.flbm}, + #{item.ggxh}, + #{item.qxlb}, + #{item.tyshxydm}, + #{item.ylqxzcrbarmc}, + #{item.zczbhhzbapzbh}, + #{item.ylqxzcrbarywmc}, + #{item.uuid}, + #{item.sjcpbm}, + #{item.versionNumber}, + #{item.diType},#{item.productType},#{item.genKeyFk} + ) + + + + + DELETE FROM basic_products WHERE id = #{id} + + + + DELETE FROM basic_products WHERE uuid = #{uuid} + + + + UPDATE basic_products + + packRatio=#{packRatio}, + packLevel=#{packLevel}, + bhxjsl=#{bhxjsl}, + bhzxxsbzsl=#{bhzxxsbzsl}, + zxxsbzbhsydysl=#{zxxsbzbhsydysl}, + bhxjcpbm=#{bhxjcpbm}, + bzcj=#{bzcj}, + addType=#{addType}, + deviceRecordKey=#{deviceRecordKey}, + cpmctymc=#{cpmctymc}, + cplb=#{cplb}, + flbm=#{flbm}, + ggxh=#{ggxh}, + qxlb=#{qxlb}, + tyshxydm=#{tyshxydm}, + ylqxzcrbarmc=#{ylqxzcrbarmc}, + ylqxzcrbarywmc=#{ylqxzcrbarywmc}, + uuid=#{uuid}, + sjcpbm=#{sjcpbm}, + versionNumber=#{versionNumber}, + sptm=#{sptm}, + manufactory=#{manufactory}, + ybbm=#{ybbm}, + measname=#{measname}, + diType=#{diType}, + productType=#{productType}, + + + WHERE nameCode = #{nameCode} + + + + + + replace into basic_products + (id, nameCode, packRatio, packLevel, bhxjsl, bhzxxsbzsl, zxxsbzbhsydysl, bhxjcpbm, bzcj, addType, + deviceRecordKey, cpmctymc, cplb, flbm, ggxh, qxlb, tyshxydm, ylqxzcrbarmc, zczbhhzbapzbh, + ylqxzcrbarywmc, sydycpbs, uuid, sjcpbm, versionNumber, diType, ybbm, sptm, manufactory, measname, + productType,genKeyFk) values + + (#{item.id}, + #{item.nameCode}, + #{item.packRatio}, + #{item.packLevel}, + #{item.bhxjsl}, + #{item.bhzxxsbzsl}, + #{item.zxxsbzbhsydysl}, + #{item.bhxjcpbm}, + #{item.bzcj}, + #{item.addType}, + #{item.deviceRecordKey}, + #{item.cpmctymc}, + #{item.cplb}, + #{item.flbm}, + #{item.ggxh}, + #{item.qxlb}, + #{item.tyshxydm}, + #{item.ylqxzcrbarmc}, + #{item.zczbhhzbapzbh}, + #{item.ylqxzcrbarywmc}, + #{item.sydycpbs}, + #{item.uuid}, + #{item.sjcpbm}, + #{item.versionNumber}, + #{item.diType}, + #{item.ybbm}, + #{item.sptm}, + #{item.manufactory}, + #{item.measname}, + #{item.productType},#{item.genKeyFk}) + + + \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/sync/UdiRelevanceDao.xml b/api-admin/src/main/resources/mybatis/mapper/sync/UdiRelevanceDao.xml new file mode 100644 index 0000000..a7cfeef --- /dev/null +++ b/api-admin/src/main/resources/mybatis/mapper/sync/UdiRelevanceDao.xml @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + replace + INTO basic_udirel + ( + thirdId,thirdName,uuid,isUseDy,updateTime, + thirdId1,thirdId2,thirdId3,thirdId4,thirdName1,thirdName2,thirdName3,thirdName4,manufactory,measname,ybbm,sptm,isDisable,isLock + ,mainId,mainName,lockStatus,udplatCode,isAdavence + ) + values + ( + #{thirdId}, + #{thirdName}, + #{uuid}, + #{isUseDy}, + #{updateTime}, + #{thirdId1}, + #{thirdId2}, + #{thirdId3}, + #{thirdId4}, + #{thirdName1}, + #{thirdName2}, + #{thirdName3}, + #{thirdName4}, + #{manufactory}, + #{measname}, + #{ybbm}, + #{sptm}, + #{isDisable}, + #{isLock}, + #{mainId}, + #{mainName}, + #{lockStatus}, + #{udplatCode}, + #{isAdavence} + ) + + + + + DELETE + FROM basic_udirel + WHERE id = #{id} + + + DELETE FROM basic_udirel WHERE id in + + #{item} + + + + DELETE + FROM basic_udirel + WHERE uuid = #{uuid} + + + + UPDATE basic_udirel + + thirdId=#{thirdId}, + thirdName=#{thirdName}, + uuid=#{uuid}, + isUseDy=#{isUseDy}, + thirdId1=#{thirdId1}, + thirdId2=#{thirdId2}, + thirdId3=#{thirdId3}, + thirdId4=#{thirdId4}, + thirdName1=#{thirdName1}, + thirdName2=#{thirdName2}, + thirdName3=#{thirdName3}, + thirdName4=#{thirdName4}, + manufactory=#{manufactory}, + measname=#{measname}, + ybbm=#{ybbm}, + sptm=#{sptm}, + updateTime=#{updateTime}, + isDisable=#{isDisable}, + isLock=#{isLock}, + mainId=#{mainId}, + lockStatus=#{lockStatus}, + mainName=#{mainName}, + udplatCode=#{udplatCode}, + isAdavence=#{isAdavence}, + + + WHERE id = #{id} + + + + + + replace into basic_udirel (id, thirdId, thirdName, uuid, isUseDy, updateTime, thirdId1, thirdId2, thirdId3, + thirdId4, thirdName1, thirdName2, thirdName3, thirdName4, ybbm, sptm, manufactory, + measname, isDisable, mainId, mainName, udplatCode,genKeyFk) + values + + (#{item.id}, + #{item.thirdId}, + #{item.thirdName}, + #{item.uuid}, + #{item.isUseDy}, + #{item.updateTime}, + #{item.thirdId1}, + #{item.thirdId2}, + #{item.thirdId3}, + #{item.thirdId4}, + #{item.thirdName1}, + #{item.thirdName2}, + #{item.thirdName3}, + #{item.thirdName4}, + #{item.ybbm}, + #{item.sptm}, + #{item.manufactory}, + #{item.measname}, + #{item.isDisable}, + #{item.mainId}, + #{item.mainName}, + #{item.udplatCode},#{item.genKeyFk}) + + + \ No newline at end of file