From cbfd4c01299394735e21970b728b7a00184a8640 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Wed, 26 Apr 2023 15:16:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/config/DataTypeConvertConfig.java | 21 ++++++++++++++ .../com/glxp/api/config/WebMvcConfig.java | 9 ++++++ .../purchase/SupCertController.java | 28 ++++++++----------- .../purchase/SupCompanyController.java | 14 ++++++++-- .../com/glxp/api/entity/auth/DeptEntity.java | 4 +-- .../api/entity/basic/UdiProductEntity.java | 4 +++ .../req/sync/BasicExportStatusRequest.java | 2 +- .../api/res/basic/BasicHospTypeResponse.java | 4 +-- .../basic/impl/BasicCorpServiceImpl.java | 2 +- .../basic/impl/UdiProductServiceImpl.java | 6 ++++ .../api/service/inout/IoAddInoutService.java | 5 +++- .../service/sync/SpsSyncDownloadService.java | 28 +++++++++++++------ .../com/glxp/api/task/AsyncHeartTask.java | 2 +- .../com/glxp/api/util/udi/UdiInfoUtil.java | 2 ++ .../mybatis/mapper/basic/UdiProductDao.xml | 24 +++++++++++----- .../mapper/sync/BasicExportTimeDao.xml | 2 +- 16 files changed, 114 insertions(+), 43 deletions(-) create mode 100644 src/main/java/com/glxp/api/config/DataTypeConvertConfig.java diff --git a/src/main/java/com/glxp/api/config/DataTypeConvertConfig.java b/src/main/java/com/glxp/api/config/DataTypeConvertConfig.java new file mode 100644 index 00000000..2ea30d9e --- /dev/null +++ b/src/main/java/com/glxp/api/config/DataTypeConvertConfig.java @@ -0,0 +1,21 @@ +package com.glxp.api.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +@Configuration +public class DataTypeConvertConfig { + @Bean + public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { + ObjectMapper objectMapper = builder.createXmlMapper(false).build(); + SimpleModule simpleModule = new SimpleModule(); + // 直接将所有的Long类型转换为String + simpleModule.addSerializer(Long.class, ToStringSerializer.instance); + objectMapper.registerModule(simpleModule); + return objectMapper; + } +} diff --git a/src/main/java/com/glxp/api/config/WebMvcConfig.java b/src/main/java/com/glxp/api/config/WebMvcConfig.java index e27d4dea..4042c592 100644 --- a/src/main/java/com/glxp/api/config/WebMvcConfig.java +++ b/src/main/java/com/glxp/api/config/WebMvcConfig.java @@ -1,10 +1,18 @@ package com.glxp.api.config; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.util.List; + @Configuration public class WebMvcConfig implements WebMvcConfigurer { @@ -21,4 +29,5 @@ public class WebMvcConfig implements WebMvcConfigurer { //跨域允许时间 .maxAge(3600); } + } diff --git a/src/main/java/com/glxp/api/controller/purchase/SupCertController.java b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java index ae289dcf..4e363801 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupCertController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupCertController.java @@ -85,8 +85,6 @@ public class SupCertController { } - - private BaseResponse insertCompanyCert(String customerId, PostSelCertRequest request) { if (CollUtil.isEmpty(request.getSupCertSetEntities())) { return ResultVOUtils.error(500, "请选入资质证书!"); @@ -160,8 +158,8 @@ public class SupCertController { return ResultVOUtils.error(500, "参数错误!"); } - String errMsg=checkCert(postSelCertRequest,customerId); - if(StrUtil.isNotEmpty(errMsg)){ + String errMsg = checkCert(postSelCertRequest, customerId); + if (StrUtil.isNotEmpty(errMsg)) { return ResultVOUtils.error(999, errMsg.substring(1) + "已存在!"); } for (SupCertSetEntity supCertSetEntity : postSelCertRequest.getSupCertSetEntities()) { @@ -182,8 +180,7 @@ public class SupCertController { } - - public String checkCert(PostSelCertRequest postSelCertRequest,String customerId){ + public String checkCert(PostSelCertRequest postSelCertRequest, String customerId) { String errMsg = ""; ArrayList list = new ArrayList<>(); @@ -193,11 +190,11 @@ public class SupCertController { FilterSupCertRequest supCertRequest = new FilterSupCertRequest(); supCertRequest.setName(supCertSetEntity.getName()); supCertRequest.setCustomerId(customerId); - if(StrUtil.isEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) { + if (StrUtil.isEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) { supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk()); supCertRequest.setType(2); } - if(StrUtil.isNotEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) { + if (StrUtil.isNotEmpty(postSelCertRequest.getProductIdFk()) && StrUtil.isNotEmpty(postSelCertRequest.getManufacturerIdFk())) { supCertRequest.setManufacturerIdFk(postSelCertRequest.getManufacturerIdFk()); supCertRequest.setProductIdFk(postSelCertRequest.getProductIdFk()); supCertRequest.setType(3); @@ -209,10 +206,10 @@ public class SupCertController { for (String s : list) { errMsg = errMsg + "," + s; } - return errMsg; + return errMsg; } - }else{ - if(i == 0 && list.size()>0){ + } else { + if (i == 0 && list.size() > 0) { for (String s : list) { errMsg = errMsg + "," + s; } @@ -243,6 +240,7 @@ public class SupCertController { supCertEntity.setCreateTime(new Date()); supCertEntity.setUpdateTime(new Date()); supCertEntity.setStatus(0); + supCertEntity.setId(IdUtil.getSnowflakeNextId()); boolean b = supCertService.insertCompanyCert(supCertEntity); return ResultVOUtils.success("成功"); } @@ -305,15 +303,13 @@ public class SupCertController { BeanUtils.copyProperties(postSupCertRequest, supCertEntity); - if(postSupCertRequest.getVailDate() !=null && postSupCertRequest.getExpireDate() != null){ - if(postSupCertRequest.getVailDate().getTime()>postSupCertRequest.getExpireDate().getTime()){ - return ResultVOUtils.error(999,"生效期不能小于失效期!"); + if (postSupCertRequest.getVailDate() != null && postSupCertRequest.getExpireDate() != null) { + if (postSupCertRequest.getVailDate().getTime() > postSupCertRequest.getExpireDate().getTime()) { + return ResultVOUtils.error(999, "生效期不能小于失效期!"); } } - - if (postSupCertRequest.getRepeatUpload() == 1) { //已审核的重新提交 //1.修改对应的资质信息进入变更审核状态, diff --git a/src/main/java/com/glxp/api/controller/purchase/SupCompanyController.java b/src/main/java/com/glxp/api/controller/purchase/SupCompanyController.java index e9a9527b..e908908d 100644 --- a/src/main/java/com/glxp/api/controller/purchase/SupCompanyController.java +++ b/src/main/java/com/glxp/api/controller/purchase/SupCompanyController.java @@ -1,8 +1,10 @@ package com.glxp.api.controller.purchase; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.pinyin.PinyinUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.annotation.Log; @@ -11,6 +13,7 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.constant.BusinessType; import com.glxp.api.constant.ConstantStatus; +import com.glxp.api.dao.basic.BasicCorpDao; import com.glxp.api.entity.auth.AuthAdmin; import com.glxp.api.entity.auth.AuthRoleAdmin; import com.glxp.api.entity.auth.CustomerInfoEntity; @@ -295,7 +298,7 @@ public class SupCompanyController { companyEntity.setAuditor(authAdmin.getId() + ""); companyEntity.setAuditTime(new Date()); companyEntity.setUpdateTime(new Date()); - if(companyEntity.getAuditComment() == null){ + if (companyEntity.getAuditComment() == null) { companyEntity.setAuditComment(""); } boolean b = companyService.modifyCompany(companyEntity); @@ -317,11 +320,18 @@ public class SupCompanyController { basicCorpEntity.setMobile(companyEntity.getMobile()); basicCorpEntity.setCorpType(ConstantStatus.CORP_SP); basicCorpEntity.setUpdateTime(new Date()); - basicCorpService.insertBasicUnitMaintain(basicCorpEntity); + if (!basicCorpDao.exists(new QueryWrapper().eq("erpId", companyEntity.getCustomerId()))) { + basicCorpEntity.setId(IdUtil.getSnowflakeNextId()); + basicCorpService.insert(basicCorpEntity); + }else { + } + return ResultVOUtils.success("修改成功"); } + @Resource + BasicCorpDao basicCorpDao; @AuthRuleAnnotation("") @PostMapping("/sup/company/selectBind") diff --git a/src/main/java/com/glxp/api/entity/auth/DeptEntity.java b/src/main/java/com/glxp/api/entity/auth/DeptEntity.java index 06d695ff..95a5c6d1 100644 --- a/src/main/java/com/glxp/api/entity/auth/DeptEntity.java +++ b/src/main/java/com/glxp/api/entity/auth/DeptEntity.java @@ -15,7 +15,7 @@ public class DeptEntity { private Long id; @TableField(value = "pid") private Integer pid; - @TableField(value = "code;") + @TableField(value = "code") private String code; @TableField(value = "name") private String name; @@ -33,7 +33,7 @@ public class DeptEntity { private Integer level; @TableField(value = "pcode") private String pcode; - @TableField(value = "pName") + @TableField(exist = false) private String pName; /** diff --git a/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java b/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java index 7229fec7..322b3350 100644 --- a/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/UdiProductEntity.java @@ -2,6 +2,8 @@ package com.glxp.api.entity.basic; import lombok.Data; +import java.util.Date; + /** * 耗材字典信息表 */ @@ -78,6 +80,8 @@ public class UdiProductEntity { private Integer status; private String supId; + private Date updateTime; + private Integer relSupId; diff --git a/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java b/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java index 81bb33c9..8ee5134e 100644 --- a/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java +++ b/src/main/java/com/glxp/api/req/sync/BasicExportStatusRequest.java @@ -7,7 +7,7 @@ import lombok.Data; public class BasicExportStatusRequest extends ListPageRequest { private String id; private Integer status; - private Integer type; + private String type; private Integer scheduleType; private String idDatas; public Integer createType; diff --git a/src/main/java/com/glxp/api/res/basic/BasicHospTypeResponse.java b/src/main/java/com/glxp/api/res/basic/BasicHospTypeResponse.java index d11b9015..24a4646c 100644 --- a/src/main/java/com/glxp/api/res/basic/BasicHospTypeResponse.java +++ b/src/main/java/com/glxp/api/res/basic/BasicHospTypeResponse.java @@ -11,7 +11,7 @@ import java.util.Date; @Data public class BasicHospTypeResponse { - private Integer id; + private Long id; private String code; private String parentCode; private String name; @@ -23,4 +23,4 @@ public class BasicHospTypeResponse { private String label; -} \ No newline at end of file +} diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicCorpServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicCorpServiceImpl.java index 20ad0c9d..c6a47b9d 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicCorpServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicCorpServiceImpl.java @@ -50,7 +50,7 @@ public class BasicCorpServiceImpl extends ServiceImpl baseResponse = syncUdi(getRequest(ConstantStatus.SYNC_DI_PRODUCTS)); SpSyncUdiResponse spSyncUdiResponse = baseResponse.getData(); if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) @@ -183,7 +191,6 @@ public class SpsSyncDownloadService { , x -> x.generateDocumentTypeDataFile(info, now, true)); } break; - case COUNTRY_DI_DATA: } } @@ -263,7 +270,7 @@ public class SpsSyncDownloadService { throw new RuntimeException(errorMsg); } BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class) - .eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.BASIC_DATA.getRemark()) + .eq(BasicExportStatusEntity::getType, exportEnum.getRemark()) .orderByDesc(BasicExportStatusEntity::getStartTime) .last("limit 1") ); @@ -279,8 +286,8 @@ public class SpsSyncDownloadService { exportStatus = BasicExportStatusEntity.builder() .id(CustomUtil.getId()) .status(BasicExportStatusEnum.WAIT_TRIGGERED.getCode()) - .idDatas(BasicExportTypeEnum.BASIC_DATA.getKey()) - .type(BasicExportTypeEnum.BASIC_DATA.getRemark()) + .idDatas(exportEnum.getKey()) + .type(exportEnum.getRemark()) .scheduleType(0) .updateTime(cn.hutool.core.date.DateUtil.date()) .startTime(now) @@ -315,7 +322,7 @@ public class SpsSyncDownloadService { , map.get("oldDate"), now) ); if (CollectionUtil.isNotEmpty(hospTypeList)) { - jsonMap.put(BasicExportStatusTimeEntity.class.getSimpleName(), hospTypeList); + jsonMap.put(BasicHospTypeEntity.class.getSimpleName(), hospTypeList); } List udiRelevanceList = udiRelevanceService.list(Wrappers.lambdaQuery(UdiRelevanceEntity.class) .le((boolean) map.get("isNew"), UdiRelevanceEntity::getUpdateTime, now) @@ -362,6 +369,7 @@ public class SpsSyncDownloadService { totalTimeMap.put(BasicExportStatusTimeEnum.SUP_CERT, map); List supCertList = supCertService.list(Wrappers.lambdaQuery(SupCertEntity.class) .le((boolean) map.get("isNew"), SupCertEntity::getUpdateTime, now) + .eq(SupCertEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .between(!(boolean) map.get("isNew"), SupCertEntity::getUpdateTime , map.get("oldDate"), now) ); @@ -378,6 +386,7 @@ public class SpsSyncDownloadService { } List supCompanyList = supCompanyService.list(Wrappers.lambdaQuery(SupCompanyEntity.class) .le((boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime, now) + .eq(SupCompanyEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .between(!(boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime , map.get("oldDate"), now) ); @@ -385,7 +394,7 @@ public class SpsSyncDownloadService { jsonMap.put(SupCompanyEntity.class.getSimpleName(), supCompanyList); } List supManufacturerList = supManufacturerService.list(Wrappers.lambdaQuery(SupManufacturerEntity.class) - .le((boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime, now) + .eq(SupManufacturerEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .between(!(boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime , map.get("oldDate"), now) ); @@ -393,6 +402,7 @@ public class SpsSyncDownloadService { jsonMap.put(SupManufacturerEntity.class.getSimpleName(), supManufacturerList); } List supProductList = supProductService.list(Wrappers.lambdaQuery(SupProductEntity.class) + .eq(SupProductEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .le((boolean) map.get("isNew"), SupProductEntity::getUpdateTime, now) .between(!(boolean) map.get("isNew"), SupProductEntity::getUpdateTime , map.get("oldDate"), now) diff --git a/src/main/java/com/glxp/api/task/AsyncHeartTask.java b/src/main/java/com/glxp/api/task/AsyncHeartTask.java index 12c59512..85afa253 100644 --- a/src/main/java/com/glxp/api/task/AsyncHeartTask.java +++ b/src/main/java/com/glxp/api/task/AsyncHeartTask.java @@ -57,7 +57,7 @@ public class AsyncHeartTask implements SchedulingConfigurer { SyncDataSetResponse syncDataSetEntity = syncDataSetService.selectSet(); if (syncDataSetEntity.isDownstreamEnable()) { if (syncDataSetEntity.getSyncTime() != null) { - long timeInterval = syncDataSetEntity.getSyncTime() * 60 * 1000; + long timeInterval = syncDataSetEntity.getSyncTime() * 6 * 1000; long curTime = System.currentTimeMillis(); Long lastTime = (Long) redisUtil.get("SPS_SYNC_GEN_DATA"); if (lastTime == null) { diff --git a/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java b/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java index 5a10803e..3aba538c 100644 --- a/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java +++ b/src/main/java/com/glxp/api/util/udi/UdiInfoUtil.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; import com.glxp.api.constant.ConstantStatus; import com.glxp.api.entity.basic.UdiProductEntity; +import java.util.Date; import java.util.List; public class UdiInfoUtil { @@ -26,6 +27,7 @@ public class UdiInfoUtil { public static List initUdiInfoEntitys(List udiProductEntities) { if (CollUtil.isNotEmpty(udiProductEntities)) { for (UdiProductEntity udiProductEntity : udiProductEntities) { + udiProductEntity.setUpdateTime(new Date()); udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI); if (StrUtil.isNotEmpty(udiProductEntity.getScbssfbhph()) && "否".equals(udiProductEntity.getScbssfbhph())) { udiProductEntity.setAllowNoBatch(true); diff --git a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml index 99db4e5d..2d4a2b5f 100644 --- a/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml +++ b/src/main/resources/mybatis/mapper/basic/UdiProductDao.xml @@ -172,7 +172,7 @@ allowNoBatch, allowNoExpire, allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2, basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7, - basicPrductRemak8) + basicPrductRemak8, updateTime) values (#{uuid}, #{originUuid}, #{nameCode}, @@ -223,7 +223,7 @@ #{basicPrductRemak5}, #{basicPrductRemak6}, #{basicPrductRemak7}, - #{basicPrductRemak8}) + #{basicPrductRemak8}, #{updateTime}) @@ -235,7 +235,7 @@ allowNoBatch, allowNoExpire, allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2, basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7, - basicPrductRemak8) + basicPrductRemak8, updateTime) values @@ -423,8 +423,9 @@ allowNoSerial=#{allowNoSerial}, - - + + updateTime=#{updateTime}, + spmc=#{spmc}, @@ -625,6 +626,9 @@ basicPrductRemak8=#{basicPrductRemak8}, + + updateTime=#{updateTime}, + where uuid = #{uuid} @@ -785,6 +789,9 @@ basicPrductRemak8=#{basicPrductRemak8}, + + updateTime=#{updateTime}, + where id = #{id} @@ -955,6 +962,9 @@ diff --git a/src/main/resources/mybatis/mapper/sync/BasicExportTimeDao.xml b/src/main/resources/mybatis/mapper/sync/BasicExportTimeDao.xml index 04cffd34..ed87bf6c 100644 --- a/src/main/resources/mybatis/mapper/sync/BasicExportTimeDao.xml +++ b/src/main/resources/mybatis/mapper/sync/BasicExportTimeDao.xml @@ -17,7 +17,7 @@ - replace INTO basic_export_status_time(`key`, lastUpdateTime, remark)