diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/config/GlobalConfig.java b/api-admin/src/main/java/com/glxp/udidl/admin/config/GlobalConfig.java index 9d5af5d..773d32d 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/config/GlobalConfig.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/config/GlobalConfig.java @@ -9,6 +9,20 @@ import org.springframework.stereotype.Component; public class GlobalConfig { @Value("${config.downloadPath}") private String downloadPath; + /** + * 是否开启权限验证 + */ @Value("${config.openAuth}") private boolean openAuth; + /** + * 阳光采购平台地址 + */ + @Value("${udplat.host}") + private String udplat_host; + @Value("${udplat.appId}") + private String udplat_appId; + @Value("${udplat.secretKey}") + private String udplat_secretKey; + @Value("${udplat.userName}") + private String udplat_userName; } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/device/TestController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/device/TestController.java index 6c2d66b..60e8aba 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/device/TestController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/device/TestController.java @@ -5,6 +5,7 @@ import com.glxp.udidl.admin.entity.udid.Device; import com.glxp.udidl.admin.req.ListPageRequest; import com.glxp.udidl.admin.service.DataSync.DeviceSyncService; import com.glxp.udidl.admin.service.DataSync.UdplatDownloadService; +import com.glxp.udidl.admin.service.DataSync.UdplatSyncService; import com.glxp.udidl.admin.service.inout.DeviceService; import com.glxp.udidl.admin.service.inout.ProductInfoService; import com.glxp.udidl.admin.service.udi.UdiCompanyService; @@ -15,6 +16,7 @@ import com.glxp.udidl.common.util.ResultVOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -44,6 +46,8 @@ public class TestController { DeviceSyncService deviceSyncService; @Autowired UdplatDownloadService udplatDownloadService; + @Autowired + UdplatSyncService udplatSyncService; @GetMapping("udidl/device/transfer") public void transfer() { List keys = deviceService.findAllByZxxscpbs(); @@ -97,10 +101,24 @@ public class TestController { logger.info(month + "---按月开启下载"); asyncDownloadTask.downloadByMonth(month, page); } - @GetMapping("/test/getDistributor") + /* @GetMapping("/test/getDistributor") public String udplatTest(){ return udplatDownloadService.getDistributor(); + }*/ + @GetMapping("/test/getManufactures") + public BaseResponse getManufactures(){ + return udplatDownloadService.getAllManufactures(); + } + @GetMapping("/test/udplat") + public BaseResponse udplatSync(){ + udplatSyncService.downloadAndSave("manual",""); + return ResultVOUtils.success("后台已开始下载!"); + } + @GetMapping("/test/udplatGoods") + /* public UdplatResponse getGoods(){ + return udplatDownloadService.getUdplatGoods(1,1000,null,null); + }*/ + public ResponseEntity getGoods(){ + return udplatDownloadService.getUdplatGoods(1,100); } - - } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatDistributorController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatDistributorController.java index ba8df2a..c5e12d7 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatDistributorController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatDistributorController.java @@ -30,6 +30,6 @@ public class UdplatDistributorController { @AuthRuleAnnotation("udidl_udplatDistributor_all") @PostMapping("/import") public BaseResponse imports(@RequestBody List models){ - return udplatDistributorService.imports(models); + return udplatDistributorService.save(models,"import"); } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatGoodsController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatGoodsController.java index 3d2c5cf..02bddde 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatGoodsController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatGoodsController.java @@ -2,6 +2,8 @@ package com.glxp.udidl.admin.controller.udplat; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.dto.udplat.BaseParam; +import com.glxp.udidl.admin.dto.udplat.DeliveryGoods; +import com.glxp.udidl.admin.dto.udplat.HospitalGoods; import com.glxp.udidl.admin.service.udplat.UdplatGoodsService; import com.glxp.udidl.common.res.BaseResponse; import com.glxp.udidl.common.util.ResultVOUtils; @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + /** *目录清单 */ @@ -38,4 +42,14 @@ public class UdplatGoodsController { } } + @AuthRuleAnnotation("udidl_udplatGoods_all") + @PostMapping("/inportHospitalGoods") + public BaseResponse importHospitalGoods(@RequestBody List list){ + return udplatGoodsService.importHospitalGoods(list); + } + @AuthRuleAnnotation("udidl_udplatGoods_all") + @PostMapping("/importDeliveryGoods") + public BaseResponse importDeliveryGoods(@RequestBody List list){ + return udplatGoodsService.importDeliveryGoods(list); + } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatHospitalController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatHospitalController.java index 4fe7a94..39c5c4f 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatHospitalController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatHospitalController.java @@ -27,6 +27,6 @@ public class UdplatHospitalController { @AuthRuleAnnotation("udidl_udplatHospital_all") @PostMapping("/import") public BaseResponse imports(@RequestBody List models){ - return udplatHospitalService.imports(models); + return udplatHospitalService.save(models,"import"); } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatLogController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatLogController.java index 3a9ba8d..78be4ec 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatLogController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatLogController.java @@ -2,8 +2,10 @@ package com.glxp.udidl.admin.controller.udplat; import com.glxp.udidl.admin.annotation.AuthRuleAnnotation; import com.glxp.udidl.admin.req.udid.JobLogFilterRequest; +import com.glxp.udidl.admin.service.DataSync.UdplatSyncService; import com.glxp.udidl.admin.service.udplat.UdplatLogService; import com.glxp.udidl.common.res.BaseResponse; +import com.glxp.udidl.common.util.ResultVOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -15,10 +17,18 @@ import org.springframework.web.bind.annotation.RestController; public class UdplatLogController { @Autowired UdplatLogService udplatLogService; + @Autowired + UdplatSyncService udplatSyncService; @AuthRuleAnnotation("udidl_udplatLog_all") @PostMapping("/list") public BaseResponse getList(@RequestBody JobLogFilterRequest param){ return udplatLogService.getList(param); } + @AuthRuleAnnotation("udidl_udplatLog_all") + @PostMapping("/udplatSync") + public BaseResponse udplatSync(String tbName){ + udplatSyncService.downloadAndSave("manual",tbName); + return ResultVOUtils.success("后台已开始下载!"); + } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatManufactureController.java b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatManufactureController.java index 92edd09..f587649 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatManufactureController.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/controller/udplat/UdplatManufactureController.java @@ -27,6 +27,6 @@ public class UdplatManufactureController { @AuthRuleAnnotation("udidl_udplatManufacture_all") @PostMapping("/import") public BaseResponse imports(@RequestBody List models){ - return udplatManufactureService.imports(models); + return udplatManufactureService.save(models,"import"); } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatGoodsMapper.java b/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatGoodsMapper.java index 9c1a822..0ea7473 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatGoodsMapper.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatGoodsMapper.java @@ -12,8 +12,8 @@ public interface UdplatGoodsMapper { int insert(UdplatGoods record); - UdplatGoods selectByGoodId(String deliveryGoodId); - + UdplatGoods selectByGoodsId(String deliveryGoodId); + UdplatGoods selectByProjectGoodsCode(String projectGoodsCode); List selectAll(); int update(UdplatGoods record); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatManufactureMapper.java b/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatManufactureMapper.java index 582d061..2f1c0b4 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatManufactureMapper.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dao/udplat/UdplatManufactureMapper.java @@ -18,5 +18,5 @@ public interface UdplatManufactureMapper { int updateByPrimaryKey(UdplatManufacture record); List list(BaseParam param); - UdplatManufacture selectByManufactureId(String id); + UdplatManufacture selectByManufactureId(String manufactureId); } \ No newline at end of file diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/DeliveryGoods.java b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/DeliveryGoods.java index c134df0..fb7fbe1 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/DeliveryGoods.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/DeliveryGoods.java @@ -6,17 +6,17 @@ import java.util.Date; @Data public class DeliveryGoods { + //private String deliveryGoodsId;//配送目录ID/bigint @Excel(name = "*采购平台产品ID") - private String deliveryGoodId;//配送目录ID/bigint private String projectGoodsCode;//联采目录编码/varchar(50) - private String deliveryGoodsCode;//配送目录编码/varchar(50) + /*private String deliveryGoodsCode;//配送目录编码/varchar(50) private long manufactureId;//平台生产企业ID/bigint(20) private String manufactureName;//平台生产企业名称/varchar(50) private long distributorId; //平台配送企业ID/bigint(20) - private String distributorName;//平台配送企业名称/varchar(50) + private String distributorName;//平台配送企业名称/varchar(50)*/ @Excel(name = "产品名称") private String productName; //产品通用名/varchar(255) - private Integer compId; //组件id/bigint + //private Integer compId; //组件id/bigint @Excel(name = "型号") private String model;//型号/varchar(1000) @Excel(name = "规格") @@ -30,21 +30,21 @@ public class DeliveryGoods { @Excel(name = "注册证名称") private String regName;//注册证名称/varchar(255) @Excel(name = "注册证有效期截止时间") - private String regValidTo;//注册证有效期截止时间/varchar(255) - private long unionProjectId;//联采项目ID/bigint(20) + private Date regValidTo;//注册证有效期截止时间/varchar(255) + /* private long unionProjectId;//联采项目ID/bigint(20) private String unionProjectName;//采购项目名称/varchar(255) private double salePrice;//价格/decimal(18,4) private String priceUnitText;//价格单位/varchar(100) private double topSalePrice;//最高销售限价,可能为空/decimal(18,4) private double settlePayPrice;//医保支付标准,可能为空/varchar(255) - private Integer goodsSource;//数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) + private Integer goodsSource;*///数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) @Excel(name = "*缺货状态",convertExp="1=有货,2=缺货") private String stockStatus;//缺货状态(1有货、2缺货)/int @Excel(name = "更新内容") private String changedContent;//更新内容 @Excel(name = "更新时间") private Date changedTime;//更新时间 - private String proxyName;//申报企业名称/ varchar(50) + //private String proxyName;//申报企业名称/ varchar(50) @Excel(name = "挂网状态") private Integer onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 @Excel(name = "医用耗材代码") diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/HospitalGoods.java b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/HospitalGoods.java index deee107..d75c345 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/HospitalGoods.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/HospitalGoods.java @@ -6,48 +6,48 @@ import java.util.Date; @Data public class HospitalGoods { + //private String deliveryGoodsId;//配送目录ID/bigint @Excel(name = "采购平台产品ID") - private String deliveryGoodId;//配送目录ID/bigint private String projectGoodsCode;//联采目录编码/varchar(50) - private String deliveryGoodsCode;//配送目录编码/varchar(50) - private long manufactureId;//平台生产企业ID/bigint(20) + //private String deliveryGoodsCode;//配送目录编码/varchar(50) + //private long manufactureId;//平台生产企业ID/bigint(20) @Excel(name = "生产企业") private String manufactureName;//平台生产企业名称/varchar(50) - private long distributorId; //平台配送企业ID/bigint(20) + //private long distributorId; //平台配送企业ID/bigint(20) @Excel(name = "配送企业") private String distributorName;//平台配送企业名称/varchar(50) @Excel(name = "产品名称") private String productName; //产品通用名/varchar(255) - private Integer compId; //组件id/bigint + //private Integer compId; //组件id/bigint @Excel(name = "型号") private String model;//型号/varchar(1000) @Excel(name = "规格") private String spec;//规格/varchar(1000) @Excel(name = "材质") private String prodMaterial;//材质/varchar(255) - private String packMaterial;//包材/varchar(255) + //private String packMaterial;//包材/varchar(255) @Excel(name = "注册证编号") private String regNum;//注册证编号/varchar(255) @Excel(name = "注册证名称") private String regName;//注册证名称/varchar(255) @Excel(name = "注册证有效期截止时间") - private String regValidTo;//注册证有效期截止时间/varchar(255) - private long unionProjectId;//联采项目ID/bigint(20) - private String unionProjectName;//采购项目名称/varchar(255) + private Date regValidTo;//注册证有效期截止时间/varchar(255) + //private long unionProjectId;//联采项目ID/bigint(20) + //private String unionProjectName;//采购项目名称/varchar(255) @Excel(name = "企业报价(元)") private double salePrice;//价格/decimal(18,4) @Excel(name = "价格单位") private String priceUnitText;//价格单位/varchar(100) - private double topSalePrice;//最高销售限价,可能为空/decimal(18,4) + /*private double topSalePrice;//最高销售限价,可能为空/decimal(18,4) private double settlePayPrice;//医保支付标准,可能为空/varchar(255) private Integer goodsSource;//数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) - private String stockStatus;//缺货状态(1有货、2缺货)/int + private String stockStatus;//缺货状态(1有货、2缺货)/int*/ @Excel(name = "更新内容") private String changedContent;//更新内容 @Excel(name = "更新时间") private Date changedTime;//更新时间 - private String proxyName;//申报企业名称/ varchar(50) - private Integer onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 + //private String proxyName;//申报企业名称/ varchar(50) + //private Integer onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 @Excel(name = "医用耗材代码") private String medicalCode;//医保编码 } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsMatchModel.java b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsMatchModel.java index 3a16843..abfee59 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsMatchModel.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsMatchModel.java @@ -10,9 +10,9 @@ public class UdplatGoodsMatchModel { private String deviceRecordKey; /** - * 配送目录id + * 联采目录编码 */ - private String deliveryGoodId; + private String projectGoodsCode; /** * 医保编码 diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsModel.java b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsModel.java new file mode 100644 index 0000000..5ef8328 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/udidl/admin/dto/udplat/UdplatGoodsModel.java @@ -0,0 +1,37 @@ +package com.glxp.udidl.admin.dto.udplat; + +import lombok.Data; + +import java.util.Date; + +@Data +public class UdplatGoodsModel { + private String deliveryGoodsId;//配送目录ID/bigint + private String projectGoodsCode;//联采目录编码/varchar(50) + private String deliveryGoodsCode;//配送目录编码/varchar(50) + private String manufactureId;//平台生产企业ID/bigint(20) + private String manufactureName;//平台生产企业名称/varchar(50) + private String distributorId; //平台配送企业ID/bigint(20) + private String distributorName;//平台配送企业名称/varchar(50) + private String productName; //产品通用名/varchar(255) + private String compId; //组件id/bigint + private String model;//型号/varchar(1000) + private String spec;//规格/varchar(1000) + private String prodMaterial;//材质/varchar(255) + private String packMaterial;//包材/varchar(255) + private String regNum;//注册证编号/varchar(255) + private String regName;//注册证名称/varchar(255) + private String regValidTo;//注册证有效期截止时间/varchar(255) + private String unionProjectId;//联采项目ID/bigint(20) + private String unionProjectName;//采购项目名称/varchar(255) + private double salePrice;//价格/decimal(18,4) + private String priceUnitText;//价格单位/varchar(100) + private double topSalePrice;//最高销售限价,可能为空/decimal(18,4) + private double settlePayPrice;//医保支付标准,可能为空/varchar(255) + private String goodsSource;//数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) + private String stockStatus;//缺货状态(1有货、2缺货)/int + private String changedContent;//更新内容 + private Date changedTime;//更新时间 + private String proxyName;//申报企业名称/ varchar(50) + private String onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 +} diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoods.java b/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoods.java index 01ba5a2..7864760 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoods.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoods.java @@ -9,34 +9,34 @@ import java.util.Date; public class UdplatGoods { private Long id; private String uuid; - private String deliveryGoodId;//配送目录ID/bigint + private String deliveryGoodsId;//配送目录ID/bigint private String projectGoodsCode;//联采目录编码/varchar(50) private String deliveryGoodsCode;//配送目录编码/varchar(50) - private Long manufactureId;//平台生产企业ID/bigint(20) + private String manufactureId;//平台生产企业ID/bigint(20) private String manufactureName;//平台生产企业名称/varchar(50) - private Long distributorId; //平台配送企业ID/bigint(20) + private String distributorId; //平台配送企业ID/bigint(20) private String distributorName;//平台配送企业名称/varchar(50) private String productName; //产品通用名/varchar(255) - private Integer compId; //组件id/bigint + private String compId; //组件id/bigint private String model;//型号/varchar(1000) private String spec;//规格/varchar(1000) private String prodMaterial;//材质/varchar(255) private String packMaterial;//包材/varchar(255) private String regNum;//注册证编号/varchar(255) private String regName;//注册证名称/varchar(255) - private String regValidTo;//注册证有效期截止时间/varchar(255) - private Long unionProjectId;//联采项目ID/bigint(20) + private Date regValidTo;//注册证有效期截止时间/varchar(255) + private String unionProjectId;//联采项目ID/bigint(20) private String unionProjectName;//采购项目名称/varchar(255) private double salePrice;//价格/decimal(18,4) private String priceUnitText;//价格单位/varchar(100) private double topSalePrice;//最高销售限价,可能为空/decimal(18,4) private double settlePayPrice;//医保支付标准,可能为空/varchar(255) - private Integer goodsSource;//数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) + private String goodsSource;//数据来源/int(11)(取值:1.集中采购 2.耗材联采 3.医院HIS/医疗机构新增 4.备案采购 9. 阳光采购10. 新型冠状病毒相关检测试剂省级集中采购14. 限新冠病毒核酸快速检测采购使用) private String stockStatus;//缺货状态(1有货、2缺货)/int private String changedContent;//更新内容 private Date changedTime;//更新时间 private String proxyName;//申报企业名称/ varchar(50) - private Integer onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 + private String onlineStatus;//挂网状态 1挂网2挂网状态为空 6 撤销申报 private String medicalCode;//医保编码 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date createTime;//创建时间 diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoodsMatch.java b/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoodsMatch.java index e1cb6c1..c6f49d4 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoodsMatch.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/entity/udplat/UdplatGoodsMatch.java @@ -24,9 +24,9 @@ public class UdplatGoodsMatch { private String deviceRecordKey; /** - * 配送目录id + * 联采目录编码 */ - private String deliveryGoodId; + private String projectGoodsCode; /** * 医保编码 diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponse.java b/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponse.java new file mode 100644 index 0000000..8e15f07 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponse.java @@ -0,0 +1,10 @@ +package com.glxp.udidl.admin.res.udplat; + +import lombok.Data; + +@Data +public class UdplatResponse { + private Boolean success; + private String message; + private UdplatResponseData data; +} diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponseData.java b/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponseData.java new file mode 100644 index 0000000..3a2e1cc --- /dev/null +++ b/api-admin/src/main/java/com/glxp/udidl/admin/res/udplat/UdplatResponseData.java @@ -0,0 +1,13 @@ +package com.glxp.udidl.admin.res.udplat; + +import lombok.Data; + +import java.util.List; + +@Data +public class UdplatResponseData { + private int page; + private int pageSize; + private int total; + private List data; +} diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.java index 81e3d46..38b86ec 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.java @@ -240,7 +240,8 @@ public class DeviceSaveService { devicepackage.setBzcpbs(packingInfo.getBzcpbs()); devicepackage.setBznhxyjbzcpbs(packingInfo.getBznhxyjbzcpbs()); devicepackage.setCpbzjb(packingInfo.getCpbzjb()); - devicepackage.setBznhxyjcpbssl(Integer.parseInt(packingInfo.getBznhxyjcpbssl())); + //devicepackage.setBznhxyjcpbssl(Integer.parseInt(packingInfo.getBznhxyjcpbssl())); + devicepackage.setBznhxyjcpbssl(getInteger(packingInfo.getBznhxyjcpbssl())); return devicepackage; } @@ -259,4 +260,12 @@ public class DeviceSaveService { return s.length()>255 ? s.substring(0,255) : s; else return s; } + private Integer getInteger(String s){ + try + { + return Integer.parseInt(s); + }catch(Exception e) { + return 0; + } + } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatDownloadService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatDownloadService.java index aa921f8..08ae75d 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatDownloadService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatDownloadService.java @@ -1,31 +1,69 @@ package com.glxp.udidl.admin.service.DataSync; +//import com.alibaba.fastjson.JSON; + +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.glxp.udidl.admin.config.GlobalConfig; +import com.glxp.udidl.admin.dto.udplat.UdplatDistributorModel; +import com.glxp.udidl.admin.dto.udplat.UdplatGoodsModel; +import com.glxp.udidl.admin.dto.udplat.UdplatHospitalModel; +import com.glxp.udidl.admin.dto.udplat.UdplatManufactureModel; +import com.glxp.udidl.admin.res.udplat.UdplatResponse; import com.glxp.udidl.admin.util.Md5Utils; +import com.glxp.udidl.common.res.BaseResponse; +import com.glxp.udidl.common.util.ResultVOUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; +import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; +import java.lang.reflect.Type; import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; +import java.util.*; @Service +@Slf4j public class UdplatDownloadService { - private String host="http://pre-mcs.udplat.org";//"http://120.32.125.20";//"http://pre.udplat.org/deal";"http://pre.udplat.org";// + /* private String host="http://pre-mcs.udplat.org/mcs-api";//"http://120.32.125.20";//"http://pre.udplat.org/deal";"http://pre.udplat.org";// private String appId="20004072"; private String secretKey="hoGxLSEsSyysnS9"; - private String userName="漳州片仔癀诊断"; + private String userName="福建片仔癀诊断技术有限公司";//"漳州片仔癀诊断";*/ + @Autowired + private GlobalConfig globalConfig; + private long getTime(){ return System.currentTimeMillis(); } - private String getSign(String time){ + private String getUserName(){ + String userName = ""; + try + { + userName = URLEncoder.encode(globalConfig.getUdplat_userName(),"utf-8"); + }catch (Exception e){ + e.printStackTrace(); + } + return userName; + } + /** + * 获取签名 + * @param mapParam + * @return + */ + private String getSign(Map mapParam){ TreeMap map= new TreeMap<>(); - map.put("appId",appId); - map.put("userName", URLEncoder.encode(userName)); - map.put("time",time); - map.put("secretKey",secretKey); + + map.put("appId",globalConfig.getUdplat_appId()); + map.put("userName",getUserName() ); + map.put("secretKey",globalConfig.getUdplat_secretKey()); + map.putAll(mapParam); StringBuffer sb = new StringBuffer(); for(Map.Entry entry:map.entrySet()){ sb.append(entry.getKey()+"="+entry.getValue()); @@ -33,28 +71,320 @@ public class UdplatDownloadService { } String str = sb.toString(); String str0 = str.substring(0,str.length()-1); + //System.out.println(globalConfig.getUdplat_userName()); + System.out.println("userName:"+globalConfig.getUdplat_userName()); System.out.println("签名前:"+str0); String result = Md5Utils.stringToMD5(str0); System.out.println("签名:"+result); return result; } - private Map getHeader(){ + private Map getHeader(Map mapParam){ Map map = new HashMap<>(); String time = getTime()+""; - time = time.substring(0,time.length()-3); - map.put("appId",appId); - map.put("userName", userName); + mapParam.put("time",time); + map.put("appId",globalConfig.getUdplat_appId()); + map.put("userName", getUserName()); map.put("time",time); - map.put("secretKey",secretKey); - map.put("sign",getSign(time)); + map.put("secretKey",globalConfig.getUdplat_secretKey()); + map.put("sign",getSign(mapParam)); return map; } - public String getDistributor(){ + /*public String getDistributor(){ + Map map=new HashMap<>(); + String url="/hsapi/purchase/distributors"; + String result = post3(url,getHeader(map),null,null); + return result; + }*/ + public BaseResponse getAllDistributors(){ + List result = new ArrayList<>(); + int page = 1; + int totalPage = 1; + int pageSize=1000; + while (page<=totalPage){ + UdplatResponse response = getDistributors(page,pageSize); + if(response.getSuccess() == false) + return ResultVOUtils.error(-1,response.getMessage()); + totalPage = response.getData().getTotal()/pageSize + 1; + List list = response.getData().getData(); + if(list.size()>0){ + result.addAll(list); + } + page++; + } + return ResultVOUtils.success(result); + } + + /** + * 下载全部生产厂家信息 + * @return + */ + public BaseResponse getAllManufactures(){ + List result = new ArrayList<>(); + int page = 1; + int totalPage = 1; + int pageSize=1000; + while (page<=totalPage){ + UdplatResponse response = getManufactures(page,pageSize); + //System.out.println(JSONObject.toJSON(response)); + if(response.getSuccess() == false) + return ResultVOUtils.error(-1,response.getMessage()); + //pageSize = response.getData().getPageSize(); + totalPage = response.getData().getTotal()/pageSize + 1; + /* ObjectMapper mapper = new ObjectMapper(); + mapper.convertValue() + JSON.toJSON(response.getData().getData()) + String dataStr = JSONObject.toJSON(response.getData().getData());*/ + //List list = Convert(response.getData().getData(),UdplatManufactureModel); + List list = response.getData().getData(); + if(list.size()>0){ + result.addAll(list); + } + /* if(list.size()> 0) + { + //String s = data.getString("data"); + List list = //JSONObject.parseArray(s,UdplatManufactureModel.class); + if(list != null && list.size()>0) + result.addAll(list); + }*/ + page++; + } + return ResultVOUtils.success(result); + } + public BaseResponse getAllHospitals(){ + List result = new ArrayList<>(); + int page = 1; + int totalPage = 1; + int pageSize=200; + while (page<=totalPage){ + UdplatResponse response = getHospitals(page,pageSize); + if(response.getSuccess() == false) + return ResultVOUtils.error(-1,response.getMessage()); + totalPage = response.getData().getTotal()/pageSize + 1; + List list = response.getData().getData(); + if(list.size()>0){ + result.addAll(list); + } + page++; + } + return ResultVOUtils.success(result); + } + + /** + * 下载可选目录 + * @param startTime + * @param endTime + * @return + */ + public BaseResponse getAllUdplatGoods(String startTime,String endTime){ + List result = new ArrayList<>(); + int page = 1; + int totalPage = 1; + int pageSize=2000; + while (page<=totalPage){ + UdplatResponse response = getUdplatGoods(page,pageSize,startTime,endTime); + if(response.getSuccess() == false) + return ResultVOUtils.error(-1,response.getMessage()); + totalPage = response.getData().getTotal()/pageSize + 1; + List list = response.getData().getData(); + if(list.size()>0){ + result.addAll(list); + } + page++; + } + return ResultVOUtils.success(result); + } + private UdplatResponse getManufactures(int page,int pageSize){ + String url="/hsapi/manufactures"; + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + return post(UdplatManufactureModel.class,url,getHeader(map),null,map); + //return post(url,getHeader(map),null,map); + } + private UdplatResponse getDistributors(int page,int pageSize){ String url="/hsapi/purchase/distributors"; - String result = post(url,getHeader(),null); + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + return post(UdplatDistributorModel.class,url,getHeader(map),null,map); + //return post(url,getHeader(map),null,map); + } + private UdplatResponse getHospitals(int page,int pageSize){ + String url="/hsapi/distribute/hospitals"; + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + return post(UdplatHospitalModel.class,url,getHeader(map),null,map); + } + public UdplatResponse getUdplatGoods(int page,int pageSize,String startTime,String endTime){ + String url="/hsapi/purchase/delivery/goods/query"; + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + if(startTime != null && !startTime.isEmpty()) + map.put("startTime",startTime); + if(endTime != null && !endTime.isEmpty()) + map.put("endTime",endTime); + return get(UdplatGoodsModel.class,url,getHeader(map),null,map); + } + public ResponseEntity getUdplatGoods(int page,int pageSize){ + String url="/hsapi/purchase/delivery/goods/query"; + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + return get(url,getHeader(map),null,map); + } + public String getUdplatGoods2(int page,int pageSize){ + String url="/hsapi/distribute/delivery/goods/query"; + Map map = new HashMap<>(); + map.put("page",page+""); + map.put("pageSize",pageSize+""); + return post3(url,getHeader(map),null,map); + } + /*public String getManufacturesTest(){ + String url="/hsapi/manufactures"; + Map map = new HashMap<>(); + map.put("page","1"); + map.put("pageSize","88"); + //String result = post(url,getHeader(map),null,map); + JSONObject result = post2(url,getHeader(map),null,map); + if(result.getBoolean("success")) + { + JSONObject data = result.getJSONObject("data"); + Integer page = data.getInteger("page"); + Integer total = data.getInteger("total"); + String s = data.getString("data"); + List list = JSONObject.parseArray(s,UdplatManufactureModel.class); + System.out.println(JSONObject.toJSON(list)); + } + return result.toString(); + }*/ + private ParameterizedTypeReference> getReference2(Class clazz){ + ParameterizedTypeImpl type = ParameterizedTypeImpl.make(UdplatResponse.class,new Type[]{clazz}, + UdplatResponse.class.getDeclaringClass()); + return ParameterizedTypeReference.forType(type); + } + private UdplatResponse post(Class clazz, String url, Map headerMap, Object jsonObject,Map map){ + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry stringStringEntry : headerMap.entrySet()) { + httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + httpHeaders.add("Content-Type", "application/json"); + HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); + RestTemplate restTemplate = new RestTemplate(); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + UdplatResponse response = restTemplate.exchange(globalConfig.getUdplat_host()+tmpUrl, HttpMethod.POST,httpEntity,getReference2(clazz)).getBody(); + log.info(JSONObject.toJSONString(response)); + return response; + //return restTemplate.exchange(globalConfig.getUdplat_host()+tmpUrl, HttpMethod.POST,httpEntity,getReference2(clazz)).getBody(); + } + private UdplatResponse get(Class clazz, String url, Map headerMap, Object jsonObject,Map map){ + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry stringStringEntry : headerMap.entrySet()) { + httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + httpHeaders.add("Content-Type", "application/json"); + HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); + RestTemplate restTemplate = new RestTemplate(); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + UdplatResponse response = restTemplate.exchange(globalConfig.getUdplat_host()+tmpUrl, HttpMethod.GET,httpEntity,getReference2(clazz)).getBody(); + log.info(JSONObject.toJSONString(response)); + return response; + //return restTemplate.exchange(globalConfig.getUdplat_host()+tmpUrl, HttpMethod.POST,httpEntity,getReference2(clazz)).getBody(); + } + private UdplatResponse post(String url, Map headerMap, Object jsonObject,Map map) { + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry stringStringEntry : headerMap.entrySet()) { + httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + httpHeaders.add("Content-Type", "application/json"); + HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); + RestTemplate restTemplate = new RestTemplate(); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + //String str = restTemplate.postForObject(globalConfig.getUdplat_host()+tmpUrl, httpEntity, String.class); + //return JSONObject.parseObject(str,UdplatResponse.class); + return restTemplate.postForObject(globalConfig.getUdplat_host()+tmpUrl, httpEntity, UdplatResponse.class); + } + private String post3(String url, Map headerMap, Object jsonObject,Map map) { + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry stringStringEntry : headerMap.entrySet()) { + httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + httpHeaders.add("Content-Type", "application/json"); + HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); + RestTemplate restTemplate = new RestTemplate(); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + String result = restTemplate.postForObject(globalConfig.getUdplat_host()+tmpUrl, httpEntity, String.class); + return result; + } + private ResponseEntity get(String url, Map headerMap, Object jsonObject,Map map) { + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry stringStringEntry : headerMap.entrySet()) { + httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); + } + httpHeaders.add("Content-Type", "application/json"); + HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); + RestTemplate restTemplate = new RestTemplate(); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + ResponseEntity result = restTemplate.exchange(globalConfig.getUdplat_host()+tmpUrl, HttpMethod.GET,httpEntity,String.class); return result; } - private String post(String url, Map headerMap, Object jsonObject) { + private JSONObject post2(String url, Map headerMap, Object jsonObject,Map map) { HttpHeaders httpHeaders = new HttpHeaders(); for (Map.Entry stringStringEntry : headerMap.entrySet()) { httpHeaders.add(stringStringEntry.getKey(), stringStringEntry.getValue()); @@ -62,7 +392,24 @@ public class UdplatDownloadService { httpHeaders.add("Content-Type", "application/json"); HttpEntity httpEntity = new HttpEntity(jsonObject, httpHeaders); RestTemplate restTemplate = new RestTemplate(); - String result = restTemplate.postForObject(host+url, httpEntity, String.class); + String tmpUrl=url; + if(map != null) + { + String params = ""; + for (Map.Entry entry:map.entrySet()){ + if(params == "") + params = "?"+entry.getKey()+"="+entry.getValue(); + else + params = params+"&"+entry.getKey()+"="+entry.getValue(); + } + tmpUrl+=params; + } + JSONObject result = restTemplate.postForObject(globalConfig.getUdplat_host()+tmpUrl, httpEntity, JSONObject.class); return result; } + + private T Convert(Object obj, Class responseType){ + ObjectMapper mapper = new ObjectMapper(); + return mapper.convertValue(obj,responseType); + } } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatSyncService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatSyncService.java new file mode 100644 index 0000000..e15c8b1 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/DataSync/UdplatSyncService.java @@ -0,0 +1,144 @@ +package com.glxp.udidl.admin.service.DataSync; + +import com.glxp.udidl.admin.dto.udplat.UdplatDistributorModel; +import com.glxp.udidl.admin.dto.udplat.UdplatGoodsModel; +import com.glxp.udidl.admin.dto.udplat.UdplatHospitalModel; +import com.glxp.udidl.admin.dto.udplat.UdplatManufactureModel; +import com.glxp.udidl.admin.entity.udplat.UdplatLog; +import com.glxp.udidl.admin.service.udplat.*; +import com.glxp.udidl.admin.util.DateUtil; +import com.glxp.udidl.common.res.BaseResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +@Slf4j +public class UdplatSyncService { + @Autowired + private UdplatDownloadService downloadService; + @Autowired + private UdplatLogService logService; + @Autowired + private UdplatManufactureService manufactureService; + @Autowired + private UdplatDistributorService distributorService; + @Autowired + private UdplatHospitalService hospitalService; + @Autowired + private UdplatGoodsService goodsService; + @Async + public void downloadAndSave(String downloadType,String tbName) { + log.info("tbName:"+tbName); + if (tbName == null || tbName == "" || tbName.equals("udplat_manufacture")) + SyncManufacture(downloadType); + if (tbName == null || tbName == "" || tbName.equals("udplat_distributor")) + SyncDistributor(downloadType); + if (tbName == null || tbName == "" || tbName.equals("udplat_hospital")) + SyncHospitals(downloadType); + if (tbName == null || tbName == "" || tbName.equals("udplat_goods")) + SyncUdplatGoods(downloadType, null, null); + } + + public void downloadByDay(String downloadType){ + SyncManufacture(downloadType); + SyncDistributor(downloadType); + SyncHospitals(downloadType); + String starTime=DateUtil.getYesterday(); + String endTime=DateUtil.getLastDay(1); + SyncUdplatGoods(downloadType,starTime,endTime); + } + /** + * 同步生产企业 + * @param downloadType + */ + private void SyncManufacture(String downloadType){ + BaseResponse response = downloadService.getAllManufactures(); + if(response.getCode() != 20000) + { + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_manufacture"); + udplatLog.setType("error"); + udplatLog.setMsg(response.getMessage()); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return; + } + List list = (List)response.getData(); + manufactureService.save(list,downloadType); + } + + /** + * 同步配送企业 + * @param downloadType + */ + private void SyncDistributor(String downloadType){ + BaseResponse response = downloadService.getAllDistributors(); + if(response.getCode() != 20000) + { + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_distributor"); + udplatLog.setType("error"); + udplatLog.setMsg(response.getMessage()); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return; + } + List list = (List)response.getData(); + distributorService.save(list,downloadType); + } + + /** + * 同步医疗机构清单 + * @param downloadType + */ + private void SyncHospitals(String downloadType){ + BaseResponse response = downloadService.getAllHospitals(); + if(response.getCode() != 20000) + { + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_hospital"); + udplatLog.setType("error"); + udplatLog.setMsg(response.getMessage()); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return; + } + List list = (List)response.getData(); + hospitalService.save(list,downloadType); + } + + /** + * 同步可选目录 + * @param downloadType + * @param startTime + * @param endTime + */ + public void SyncUdplatGoods(String downloadType,String startTime,String endTime){ + BaseResponse response = downloadService.getAllUdplatGoods(startTime,endTime); + if(response.getCode() != 20000) + { + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_goods"); + udplatLog.setType("error"); + udplatLog.setMsg(response.getMessage()); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return; + } + List list = (List)response.getData(); + goodsService.save(list,downloadType); + } +} diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatDistributorService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatDistributorService.java index 22cafa8..54c7ff0 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatDistributorService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatDistributorService.java @@ -8,7 +8,7 @@ import java.util.List; public interface UdplatDistributorService { BaseResponse getList(BaseParam param); - BaseResponse imports(List models); + BaseResponse save(List models,String type); /*int insert(UdplatDistributor record); UdplatDistributor selectByPrimaryKey(Integer id); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatGoodsService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatGoodsService.java index d981264..cfddada 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatGoodsService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatGoodsService.java @@ -1,9 +1,13 @@ package com.glxp.udidl.admin.service.udplat; import com.glxp.udidl.admin.dto.udplat.BaseParam; +import com.glxp.udidl.admin.dto.udplat.DeliveryGoods; +import com.glxp.udidl.admin.dto.udplat.HospitalGoods; +import com.glxp.udidl.admin.dto.udplat.UdplatGoodsModel; import com.glxp.udidl.common.res.BaseResponse; import java.io.InputStream; +import java.util.List; public interface UdplatGoodsService { BaseResponse getList(BaseParam param); @@ -13,5 +17,26 @@ public interface UdplatGoodsService { * @param type 1:院内的导入 2;配送目录 * @return */ - BaseResponse importExcel(InputStream is,int type) ; + BaseResponse importExcel(InputStream is, int type) ; + + /** + * 保存阳光采购平台接口数据 + * @param models + * @return + */ + BaseResponse save(List models, String downloadType); + + /** + *存储医疗目录 + * @param list + * @return + */ + BaseResponse importHospitalGoods(List list); + + /** + * 存储配送目录 + * @param list + * @return + */ + BaseResponse importDeliveryGoods(List list); } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatHospitalService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatHospitalService.java index 51ca4ca..8e3db41 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatHospitalService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatHospitalService.java @@ -8,5 +8,5 @@ import java.util.List; public interface UdplatHospitalService { BaseResponse getList(BaseParam param); - BaseResponse imports(List models); + BaseResponse save(List models,String type); } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatManufactureService.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatManufactureService.java index ffe9f68..faba0fe 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatManufactureService.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/UdplatManufactureService.java @@ -8,5 +8,5 @@ import java.util.List; public interface UdplatManufactureService { BaseResponse getList(BaseParam param); - BaseResponse imports(List models); + BaseResponse save(List models,String type); } diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatDistributorServiceImpl.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatDistributorServiceImpl.java index e0e1c30..b2d9ecd 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatDistributorServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatDistributorServiceImpl.java @@ -40,11 +40,12 @@ public class UdplatDistributorServiceImpl implements UdplatDistributorService { } @Override - public BaseResponse imports(List models) { + public BaseResponse save(List models,String type) { if (models != null && models.size() > 0) { for (UdplatDistributorModel item : models) { UdplatDistributor entity = mapper.selectByDistributorId(item.getDistributorId()); if (entity == null) { + entity = new UdplatDistributor(); BeanUtils.copyProperties(item, entity); entity.setCreateTime(new Date()); mapper.insert(entity); @@ -57,7 +58,7 @@ public class UdplatDistributorServiceImpl implements UdplatDistributorService { } } UdplatLog udplatLog = new UdplatLog(); - udplatLog.setDownloadType("import"); + udplatLog.setDownloadType(type); udplatLog.setTbName("udplat_distributor"); udplatLog.setType("info"); udplatLog.setMsg("执行成功!"); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsMatchServiceImpl.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsMatchServiceImpl.java index 87d9830..0ce7738 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsMatchServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsMatchServiceImpl.java @@ -38,7 +38,7 @@ public class UdplatGoodsMatchServiceImpl implements UdplatGoodsMatchService { udplatGoodsMatchMapper.insert(udplatGoodsMatch); }else { - udplatGoodsMatch.setDeliveryGoodId(model.getDeliveryGoodId()); + udplatGoodsMatch.setProjectGoodsCode(model.getProjectGoodsCode()); udplatGoodsMatch.setMedicalCode(model.getMedicalCode()); udplatGoodsMatch.setUpdateTime(new Date()); udplatGoodsMatchMapper.updateByPrimaryKey(udplatGoodsMatch); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsServiceImpl.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsServiceImpl.java index 8a44eb1..371d7cc 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatGoodsServiceImpl.java @@ -7,6 +7,7 @@ import com.glxp.udidl.admin.dao.udplat.UdplatGoodsMapper; import com.glxp.udidl.admin.dto.udplat.BaseParam; import com.glxp.udidl.admin.dto.udplat.DeliveryGoods; import com.glxp.udidl.admin.dto.udplat.HospitalGoods; +import com.glxp.udidl.admin.dto.udplat.UdplatGoodsModel; import com.glxp.udidl.admin.entity.udplat.UdplatGoods; import com.glxp.udidl.admin.entity.udplat.UdplatLog; import com.glxp.udidl.admin.res.PageSimpleResponse; @@ -33,7 +34,7 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { @Autowired private UdplatLogService logService; - public BaseResponse getList(BaseParam param){ + public BaseResponse getList(BaseParam param) { PageHelper.startPage(param.getPage(), param.getLimit()); if (param.getEndDate() != null && !param.getEndDate().isEmpty()) param.setEndDate(DateUtil.formatDate(DateUtil.addDays(DateUtil.parseDate(param.getEndDate()), 1))); @@ -44,26 +45,26 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { pageSimpleResponse.setList(list); return ResultVOUtils.success(pageSimpleResponse); } + @Override public BaseResponse importExcel(InputStream is, int type) { - int count=0; - try{ - if(type == 1) { + int count = 0; + try { + if (type == 1) { List list1 = getData1(is); //list = BeanUtils.convertList2List(list1,UdplatGoods.class); - if(list1 == null || list1.size()<1) - return ResultVOUtils.error(-1,"无数据!"); + if (list1 == null || list1.size() < 1) + return ResultVOUtils.error(-1, "无数据!"); count = SaveHospitalGoods(list1); - }else - if(type == 2){ + } else if (type == 2) { List list2 = getData2(is); //log.info(JSONUtil.toJsonStr(list2)); //list = BeanUtils.convertList2List(list2,UdplatGoods.class); - if(list2 == null || list2.size()<1) - return ResultVOUtils.error(-1,"无数据!"); + if (list2 == null || list2.size() < 1) + return ResultVOUtils.error(-1, "无数据!"); count = SaveDeliveryGoods(list2); - }else - return ResultVOUtils.error(-1,"文件类型不匹配!"); + } else + return ResultVOUtils.error(-1, "文件类型不匹配!"); UdplatLog udplatLog = new UdplatLog(); udplatLog.setDownloadType("import"); udplatLog.setTbName("udplat_goods"); @@ -75,7 +76,7 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { logService.insert(udplatLog); return ResultVOUtils.success(count); //return save(list); - }catch (Exception e){ + } catch (Exception e) { UdplatLog udplatLog = new UdplatLog(); udplatLog.setDownloadType("import"); udplatLog.setTbName("udplat_goods"); @@ -85,32 +86,105 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); udplatLog.setCreateTime(new Date()); logService.insert(udplatLog); - return ResultVOUtils.error(-1,"出错了:"+e.getMessage()); + return ResultVOUtils.error(-1, "出错了:" + e.getMessage()); } //return ResultVOUtils.success(); } - private List getData1(InputStream is) throws Exception{ + + public BaseResponse save(List models,String downloadType) { + if (models.size() > 0) + try + { + for (UdplatGoodsModel item : models) { + String projectGoodsCode = item.getProjectGoodsCode(); + UdplatGoods goods = udplatGoodsMapper.selectByProjectGoodsCode(projectGoodsCode); + if(goods == null){ + goods = new UdplatGoods(); + goods.setId(0L); + } + BeanUtils.copyProperties(item,goods); + if (goods.getId() > 0) { + goods.setUpdateTime(new Date()); + udplatGoodsMapper.update(goods); + } else { + goods.setUuid(BeanUtils.getUUId()); + goods.setCreateTime(new Date()); + udplatGoodsMapper.insert(goods); + } + } + }catch (Exception e){ + e.printStackTrace(); + log.error(JSON.toJSONString(e.getStackTrace())); + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_goods"); + udplatLog.setType("error"); + udplatLog.setMsg(e.getMessage()); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return ResultVOUtils.error(-1,e.getMessage()); + } + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType(downloadType); + udplatLog.setTbName("udplat_goods"); + udplatLog.setType("info"); + udplatLog.setMsg("执行成功!"); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setTotalCount(models.size()); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return ResultVOUtils.success(); + } + + private List getData1(InputStream is) throws Exception { ExcelUtil util = new ExcelUtil(HospitalGoods.class); return util.importExcel(is); } - private List getData2(InputStream is) throws Exception{ + + private List getData2(InputStream is) throws Exception { ExcelUtil util = new ExcelUtil(DeliveryGoods.class); return util.importExcel(is); } - private int SaveHospitalGoods(List list){ - int count=0; - for(HospitalGoods item:list){ - String goodId = item.getDeliveryGoodId(); - if(goodId == null || goodId.isEmpty()) + public BaseResponse importHospitalGoods(List list){ + int count = SaveHospitalGoods(list); + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType("import"); + udplatLog.setTbName("udplat_goods"); + udplatLog.setType("info"); + udplatLog.setMsg("执行成功!"); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setTotalCount(count); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return ResultVOUtils.success(count); + } + public BaseResponse importDeliveryGoods(List list){ + int count = SaveDeliveryGoods(list); + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType("import"); + udplatLog.setTbName("udplat_goods"); + udplatLog.setType("info"); + udplatLog.setMsg("执行成功!"); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setTotalCount(count); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + return ResultVOUtils.success(count); + } + private int SaveHospitalGoods(List list) { + int count = 0; + for (HospitalGoods item : list) { + String projectGoodsCode = item.getProjectGoodsCode(); + if (projectGoodsCode == null || projectGoodsCode.isEmpty()) continue; - UdplatGoods goods = udplatGoodsMapper.selectByGoodId(goodId); - goods = HospitalGoodsToUdplatGoods(item,goods); - if(goods.getId()>0){ + UdplatGoods goods = udplatGoodsMapper.selectByProjectGoodsCode(projectGoodsCode); + goods = HospitalGoodsToUdplatGoods(item, goods); + if (goods.getId() > 0) { goods.setUpdateTime(new Date()); udplatGoodsMapper.update(goods); - }else - { + } else { goods.setUuid(BeanUtils.getUUId()); goods.setCreateTime(new Date()); udplatGoodsMapper.insert(goods); @@ -119,20 +193,21 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { } return count; } - private int SaveDeliveryGoods(List list){ - int count=0; - for(DeliveryGoods item:list){ - String goodId = item.getDeliveryGoodId(); - if(goodId == null || goodId.isEmpty()) + + private int SaveDeliveryGoods(List list) { + int count = 0; + for (DeliveryGoods item : list) { + //String goodId = item.getDeliveryGoodId(); + String projectGoodsCode = item.getProjectGoodsCode(); + if (projectGoodsCode == null || projectGoodsCode.isEmpty()) continue; - UdplatGoods goods = udplatGoodsMapper.selectByGoodId(goodId); - goods = DeliveryGoodsToUdplatGoods(item,goods); - System.out.println(JSON.toJSONString(goods)); - if(goods.getId()>0L){ + UdplatGoods goods = udplatGoodsMapper.selectByProjectGoodsCode(projectGoodsCode); + goods = DeliveryGoodsToUdplatGoods(item, goods); + //System.out.println(JSON.toJSONString(goods)); + if (goods.getId() > 0L) { goods.setUpdateTime(new Date()); udplatGoodsMapper.update(goods); - }else - { + } else { goods.setUuid(BeanUtils.getUUId()); goods.setCreateTime(new Date()); udplatGoodsMapper.insert(goods); @@ -141,12 +216,14 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { } return count; } - private UdplatGoods HospitalGoodsToUdplatGoods(HospitalGoods hospitalGoods, UdplatGoods udplatGoods){ - if(udplatGoods == null){ + + private UdplatGoods HospitalGoodsToUdplatGoods(HospitalGoods hospitalGoods, UdplatGoods udplatGoods) { + if (udplatGoods == null) { udplatGoods = new UdplatGoods(); udplatGoods.setId(0L); } - udplatGoods.setDeliveryGoodId(hospitalGoods.getDeliveryGoodId()); + //udplatGoods.setDeliveryGoodsId(hospitalGoods.getDeliveryGoodsId()); + udplatGoods.setProjectGoodsCode(hospitalGoods.getProjectGoodsCode()); udplatGoods.setManufactureName(hospitalGoods.getManufactureName()); udplatGoods.setDistributorName(hospitalGoods.getDistributorName()); udplatGoods.setProductName(hospitalGoods.getProductName()); @@ -163,13 +240,14 @@ public class UdplatGoodsServiceImpl implements UdplatGoodsService { udplatGoods.setMedicalCode(hospitalGoods.getMedicalCode()); return udplatGoods; } - private UdplatGoods DeliveryGoodsToUdplatGoods(DeliveryGoods deliveryGoods, UdplatGoods udplatGoods){ - if(udplatGoods == null) - { + + private UdplatGoods DeliveryGoodsToUdplatGoods(DeliveryGoods deliveryGoods, UdplatGoods udplatGoods) { + if (udplatGoods == null) { udplatGoods = new UdplatGoods(); udplatGoods.setId(0L); } - udplatGoods.setDeliveryGoodId(deliveryGoods.getDeliveryGoodId()); + //udplatGoods.setDeliveryGoodsId(deliveryGoods.getDeliveryGoodsId()); + udplatGoods.setProjectGoodsCode(deliveryGoods.getProjectGoodsCode()); udplatGoods.setProductName(deliveryGoods.getProductName()); udplatGoods.setModel(deliveryGoods.getModel()); udplatGoods.setSpec(deliveryGoods.getSpec()); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatHospitalServiceImpl.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatHospitalServiceImpl.java index c0f03a0..2d43847 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatHospitalServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatHospitalServiceImpl.java @@ -42,11 +42,12 @@ public class UdplatHospitalServiceImpl implements UdplatHospitalService { } @Override - public BaseResponse imports(List models) { + public BaseResponse save(List models,String type) { if (models != null && models.size() > 0) { for (UdplatHospitalModel item : models) { UdplatHospital entity = mapper.selectByPurchaseId(item.getPurchaseId()); if (entity == null) { + entity = new UdplatHospital(); BeanUtils.copyProperties(item, entity); entity.setCreateTime(new Date()); mapper.insert(entity); @@ -59,7 +60,7 @@ public class UdplatHospitalServiceImpl implements UdplatHospitalService { } } UdplatLog udplatLog = new UdplatLog(); - udplatLog.setDownloadType("import"); + udplatLog.setDownloadType(type); udplatLog.setTbName("udplat_hospital"); udplatLog.setType("info"); udplatLog.setMsg("执行成功!"); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatManufactureServiceImpl.java b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatManufactureServiceImpl.java index 246e4df..786ce73 100644 --- a/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatManufactureServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/udidl/admin/service/udplat/impl/UdplatManufactureServiceImpl.java @@ -40,11 +40,12 @@ public class UdplatManufactureServiceImpl implements UdplatManufactureService { } @Override - public BaseResponse imports(List models) { + public BaseResponse save(List models,String type) { if (models != null && models.size() > 0) { for (UdplatManufactureModel item : models) { UdplatManufacture entity = mapper.selectByManufactureId(item.getManufactureId()); if (entity == null) { + entity = new UdplatManufacture(); BeanUtils.copyProperties(item, entity); entity.setCreateTime(new Date()); mapper.insert(entity); @@ -57,7 +58,8 @@ public class UdplatManufactureServiceImpl implements UdplatManufactureService { } } UdplatLog udplatLog = new UdplatLog(); - udplatLog.setDownloadType("import"); + //udplatLog.setDownloadType("import"); + udplatLog.setDownloadType(type); udplatLog.setTbName("udplat_manufacture"); udplatLog.setType("info"); udplatLog.setMsg("执行成功!"); diff --git a/api-admin/src/main/java/com/glxp/udidl/admin/thread/DownloadTaskUdplat.java b/api-admin/src/main/java/com/glxp/udidl/admin/thread/DownloadTaskUdplat.java new file mode 100644 index 0000000..7e60361 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/udidl/admin/thread/DownloadTaskUdplat.java @@ -0,0 +1,61 @@ +package com.glxp.udidl.admin.thread; + +import com.alibaba.fastjson.JSON; +import com.glxp.udidl.admin.dao.info.ScheduledDao; +import com.glxp.udidl.admin.entity.info.ScheduledEntity; +import com.glxp.udidl.admin.entity.udplat.UdplatLog; +import com.glxp.udidl.admin.req.info.ScheduledRequest; +import com.glxp.udidl.admin.service.DataSync.UdplatSyncService; +import com.glxp.udidl.admin.service.udplat.UdplatLogService; +import com.glxp.udidl.admin.util.DateUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; +import org.springframework.scheduling.support.CronTrigger; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; + +@Component +@EnableScheduling +@Slf4j +public class DownloadTaskUdplat implements SchedulingConfigurer { + @Resource + private ScheduledDao scheduledDao; + @Autowired + UdplatSyncService udplatSyncService; + @Autowired + private UdplatLogService logService; //日志 + @Override + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { + scheduledTaskRegistrar.addTriggerTask(() -> process(), + triggerContext -> { + ScheduledRequest scheduledRequest = new ScheduledRequest(); + scheduledRequest.setCronName("downloadTaskUdplat"); + ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest); + String cron = scheduledEntity.getCron(); + if (cron.isEmpty()) { + log.error("cron is null"); + } + return new CronTrigger(cron).nextExecutionTime(triggerContext); + }); + } + private void process(){ + try { + udplatSyncService.downloadByDay("auto"); + }catch (Exception e){ + UdplatLog udplatLog = new UdplatLog(); + udplatLog.setDownloadType("auto"); + //udplatLog.setTbName(""); + udplatLog.setType("error"); + udplatLog.setMsg(e.getMessage()); + udplatLog.setContent(JSON.toJSONString(e.getStackTrace())); + udplatLog.setActionDate(DateUtil.parseDate(DateUtil.getDate())); + udplatLog.setCreateTime(new Date()); + logService.insert(udplatLog); + } + } +} diff --git a/api-admin/src/main/resources/application-dev.properties b/api-admin/src/main/resources/application-dev.properties index aabf090..982585d 100644 --- a/api-admin/src/main/resources/application-dev.properties +++ b/api-admin/src/main/resources/application-dev.properties @@ -17,4 +17,9 @@ UDIC_MIPSDOWNLOAD_URL = http://127.0.0.1:8080/UDIC_MIPSDL_Server config.downloadPath=E:/temp config.openAuth=false spring.servlet.multipart.max-file-size=100MB -spring.servlet.multipart.max-request-size=1000MB \ No newline at end of file +spring.servlet.multipart.max-request-size=1000MB +# 阳光采购平台 +udplat.host=http://pre-mcs.udplat.org/mcs-api +udplat.appId=20004072 +udplat.secretKey=hoGxLSEsSyysnS9 +udplat.userName=\u798F\u5EFA\u7247\u4ED4\u7640\u8BCA\u65AD\u6280\u672F\u6709\u9650\u516C\u53F8 \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatDistributorMapper.xml b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatDistributorMapper.xml index a703877..402ebd6 100644 --- a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatDistributorMapper.xml +++ b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatDistributorMapper.xml @@ -15,9 +15,9 @@ where id = #{id,jdbcType=INTEGER} - insert into udplat_distributor (id, distributorId, distributorCode, + insert into udplat_distributor ( distributorId, distributorCode, distributorName, createTime) - values (#{id,jdbcType=INTEGER}, #{distributorId,jdbcType=INTEGER}, #{distributorCode,jdbcType=VARCHAR}, + values (#{distributorId,jdbcType=INTEGER}, #{distributorCode,jdbcType=VARCHAR}, #{distributorName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) diff --git a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatGoodsMapper.xml b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatGoodsMapper.xml index f9c0197..4375071 100644 --- a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatGoodsMapper.xml +++ b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatGoodsMapper.xml @@ -4,7 +4,7 @@ - + @@ -41,7 +41,7 @@ where id = #{id,jdbcType=BIGINT} - insert into udplat_goods ( uuid, deliveryGoodId, + insert into udplat_goods ( uuid, deliveryGoodsId, projectGoodsCode, deliveryGoodsCode, manufactureId, manufactureName, distributorId, distributorName, productName, compId, model, @@ -53,7 +53,7 @@ changedTime, proxyName, onlineStatus, medicalCode, createTime ) - values (#{uuid,jdbcType=VARCHAR}, #{deliveryGoodId,jdbcType=VARCHAR}, + values (#{uuid,jdbcType=VARCHAR}, #{deliveryGoodsId,jdbcType=VARCHAR}, #{projectGoodsCode,jdbcType=VARCHAR}, #{deliveryGoodsCode,jdbcType=VARCHAR}, #{manufactureId,jdbcType=BIGINT}, #{manufactureName,jdbcType=VARCHAR}, #{distributorId,jdbcType=BIGINT}, #{distributorName,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{compId,jdbcType=BIGINT}, #{model,jdbcType=VARCHAR}, @@ -69,7 +69,7 @@ update udplat_goods set - deliveryGoodId = #{deliveryGoodId,jdbcType=VARCHAR}, + deliveryGoodsId = #{deliveryGoodsId,jdbcType=VARCHAR}, projectGoodsCode = #{projectGoodsCode,jdbcType=VARCHAR}, deliveryGoodsCode = #{deliveryGoodsCode,jdbcType=VARCHAR}, manufactureId = #{manufactureId,jdbcType=BIGINT}, @@ -101,17 +101,26 @@ updateTime = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} - + select id, uuid, deliveryGoodsId, projectGoodsCode, deliveryGoodsCode, manufactureId, manufactureName, distributorId, distributorName, productName, compId, model, spec, prodMaterial, packMaterial, regNum, regName, regValidTo, unionProjectId, unionProjectName, salePrice, priceUnitText, topSalePrice, settlePayPrice, goodsSource, stockStatus, changedContent, changedTime, proxyName, onlineStatus, medicalCode, createTime, updateTime from udplat_goods - where deliveryGoodId = #{deliveryGoodId} + where deliveryGoodsId = #{deliveryGoodsId} + + - select id, deviceRecordKey, deliveryGoodId, medicalCode, createTime, updateTime + select id, deviceRecordKey, projectGoodsCode, medicalCode, createTime, updateTime from udplat_goods_match where id = #{id,jdbcType=INTEGER} \ No newline at end of file diff --git a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatHospitalMapper.xml b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatHospitalMapper.xml index 53432d6..7ca0d7b 100644 --- a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatHospitalMapper.xml +++ b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatHospitalMapper.xml @@ -16,12 +16,12 @@ where id = #{id,jdbcType=INTEGER} - insert into udplat_hospital (id, purchaseId, purchaseCode, + insert into udplat_hospital ( purchaseId, purchaseCode, purchaseName, purchaseArea, purchaseAreaId, - createTime, updateTime) - values (#{id,jdbcType=INTEGER}, #{purchaseId,jdbcType=VARCHAR}, #{purchaseCode,jdbcType=VARCHAR}, + createTime) + values ( #{purchaseId,jdbcType=VARCHAR}, #{purchaseCode,jdbcType=VARCHAR}, #{purchaseName,jdbcType=VARCHAR}, #{purchaseArea,jdbcType=VARCHAR}, #{purchaseAreaId,jdbcType=VARCHAR}, - #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + #{createTime,jdbcType=TIMESTAMP}) update udplat_hospital @@ -30,7 +30,6 @@ purchaseName = #{purchaseName,jdbcType=VARCHAR}, purchaseArea = #{purchaseArea,jdbcType=VARCHAR}, purchaseAreaId = #{purchaseAreaId,jdbcType=VARCHAR}, - createTime = #{createTime,jdbcType=TIMESTAMP}, updateTime = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER} diff --git a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatManufactureMapper.xml b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatManufactureMapper.xml index 1a566b8..4547133 100644 --- a/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatManufactureMapper.xml +++ b/api-admin/src/main/resources/mybatis/mapper/udplat/UdplatManufactureMapper.xml @@ -14,11 +14,11 @@ where id = #{id,jdbcType=INTEGER} - insert into udplat_manufacture (id, manufactureId, manufactureCode, - manufactureName, createTime, updateTime + insert into udplat_manufacture (manufactureId, manufactureCode, + manufactureName, createTime ) - values (#{id,jdbcType=INTEGER}, #{manufactureId,jdbcType=INTEGER}, #{manufactureCode,jdbcType=VARCHAR}, - #{manufactureName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} + values (#{manufactureId,jdbcType=INTEGER}, #{manufactureCode,jdbcType=VARCHAR}, + #{manufactureName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP} ) @@ -26,7 +26,6 @@ set manufactureId = #{manufactureId,jdbcType=INTEGER}, manufactureCode = #{manufactureCode,jdbcType=VARCHAR}, manufactureName = #{manufactureName,jdbcType=VARCHAR}, - createTime = #{createTime,jdbcType=TIMESTAMP}, updateTime = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER} @@ -59,6 +58,6 @@ \ No newline at end of file diff --git a/api-admin/target/classes/application-dev.properties b/api-admin/target/classes/application-dev.properties index aabf090..982585d 100644 --- a/api-admin/target/classes/application-dev.properties +++ b/api-admin/target/classes/application-dev.properties @@ -17,4 +17,9 @@ UDIC_MIPSDOWNLOAD_URL = http://127.0.0.1:8080/UDIC_MIPSDL_Server config.downloadPath=E:/temp config.openAuth=false spring.servlet.multipart.max-file-size=100MB -spring.servlet.multipart.max-request-size=1000MB \ No newline at end of file +spring.servlet.multipart.max-request-size=1000MB +# 阳光采购平台 +udplat.host=http://pre-mcs.udplat.org/mcs-api +udplat.appId=20004072 +udplat.secretKey=hoGxLSEsSyysnS9 +udplat.userName=\u798F\u5EFA\u7247\u4ED4\u7640\u8BCA\u65AD\u6280\u672F\u6709\u9650\u516C\u53F8 \ No newline at end of file diff --git a/api-admin/target/classes/com/glxp/udidl/admin/config/GlobalConfig.class b/api-admin/target/classes/com/glxp/udidl/admin/config/GlobalConfig.class index 198bfe4..16ad287 100644 Binary files a/api-admin/target/classes/com/glxp/udidl/admin/config/GlobalConfig.class and b/api-admin/target/classes/com/glxp/udidl/admin/config/GlobalConfig.class differ diff --git a/api-admin/target/classes/com/glxp/udidl/admin/controller/device/TestController.class b/api-admin/target/classes/com/glxp/udidl/admin/controller/device/TestController.class index 5ea7545..758158c 100644 Binary files a/api-admin/target/classes/com/glxp/udidl/admin/controller/device/TestController.class and b/api-admin/target/classes/com/glxp/udidl/admin/controller/device/TestController.class differ diff --git a/api-admin/target/classes/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.class b/api-admin/target/classes/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.class index 8293b92..0197654 100644 Binary files a/api-admin/target/classes/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.class and b/api-admin/target/classes/com/glxp/udidl/admin/service/DataSync/DeviceSaveService.class differ