数据同步bug修改

master
anthonywj 2 years ago
parent 963406dd91
commit cbfd4c0129

@ -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;
}
}

@ -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);
}
}

@ -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<String> 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.修改对应的资质信息进入变更审核状态,

@ -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<BasicCorpEntity>().eq("erpId", companyEntity.getCustomerId()))) {
basicCorpEntity.setId(IdUtil.getSnowflakeNextId());
basicCorpService.insert(basicCorpEntity);
}else {
}
return ResultVOUtils.success("修改成功");
}
@Resource
BasicCorpDao basicCorpDao;
@AuthRuleAnnotation("")
@PostMapping("/sup/company/selectBind")

@ -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;
/**

@ -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;

@ -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;

@ -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;
}
}

@ -50,7 +50,7 @@ public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEnt
@Override
public boolean insert(BasicCorpEntity basicUnitMaintainEntity) {
return basicCorpDao.insertEntity(basicUnitMaintainEntity) == 0 ? false : true;
return basicCorpDao.insert(basicUnitMaintainEntity) == 0 ? false : true;
}
@Override

@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service
@ -96,6 +97,7 @@ public class UdiProductServiceImpl implements UdiProductService {
@Override
public boolean insertUdiInfo(UdiProductEntity udiProductEntity) {
udiProductEntity.setUpdateTime(new Date());
return udiProductDao.insertUdiInfo(udiProductEntity);
}
@ -108,6 +110,7 @@ public class UdiProductServiceImpl implements UdiProductService {
public boolean updateUdiInfo(UdiProductEntity udiProductEntity) {
if (StrUtil.isEmpty(udiProductEntity.getNameCode()))
return false;
udiProductEntity.setUpdateTime(new Date());
return udiProductDao.updateUdiInfo(udiProductEntity);
}
@ -115,11 +118,13 @@ public class UdiProductServiceImpl implements UdiProductService {
public boolean updateUdiInfoByUuid(UdiProductEntity udiProductEntity) {
if (StrUtil.isEmpty(udiProductEntity.getUuid()))
return false;
udiProductEntity.setUpdateTime(new Date());
return udiProductDao.updateUdiInfoByUuid(udiProductEntity);
}
@Override
public boolean updateUdiInfoById(UdiProductEntity udiProductEntity) {
udiProductEntity.setUpdateTime(new Date());
return udiProductDao.updateUdiInfoById(udiProductEntity);
}
@ -143,6 +148,7 @@ public class UdiProductServiceImpl implements UdiProductService {
public boolean updateUdiInfoNotAll(UdiInfoRequest udiInfoRequest) {
if (StrUtil.isEmpty(udiInfoRequest.getUuid()))
return false;
return udiProductDao.updateUdiInfoNotAll(udiInfoRequest);
}

@ -2,6 +2,7 @@ package com.glxp.api.service.inout;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -119,12 +120,14 @@ public class IoAddInoutService {
basicCorpEntity.setCorpType(ConstantStatus.CORP_SICK);
basicCorpEntity.setOutType(ConstantStatus.CORP_SICK_SICK);
basicCorpEntity.setName(orderEntity.getFromCorp());
basicCorpEntity.setId(IdUtil.getSnowflakeNextId());
basicCorpService.insertBasicUnitMaintain(basicCorpEntity);
}
orderEntity.setFromCorp(basicCorpEntity.getErpId());
orderEntity.setUpdateTime(new Date());
orderService.update(orderEntity);
basicCorpService.insertBasicUnitMaintain(basicCorpEntity);
}
}

@ -99,7 +99,7 @@ public class SpsSyncDownloadService {
orderStatusEntity.setIdDatas(ConstantStatus.SYNC_SCAN_ORDER);
orderStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
orderStatusEntity.setUpdateTime(new Date());
orderStatusEntity.setStatus(0);
orderStatusEntity.setStatus(BasicExportStatusEnum.WAIT_BUILT.getCode());
orderStatusEntity.setStartTime(new Date());
orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL);
basicExportService.insertExportStatus(orderStatusEntity);
@ -109,8 +109,16 @@ public class SpsSyncDownloadService {
// 创建国家库同步任务
public void syncDiProductsTask() {
BasicExportStatusEntity basicExportStatusEntity4 = basicExportService.findByData(ConstantStatus.SYNC_DI_PRODUCTS, 1);
if (basicExportStatusEntity4 == null) {
BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class)
.eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.COUNTRY_DI_DATA.getRemark())
.orderByDesc(BasicExportStatusEntity::getStartTime)
.last("limit 1")
);
//首次任务or上次任务结束
if (exportStatus == null || BasicExportStatusEnum.COMPLETED.getCode().equals(exportStatus.getStatus())) {
BaseResponse<SpSyncUdiResponse> 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<UdiRelevanceEntity> 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<SupCertEntity> 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<SupCompanyEntity> 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<SupManufacturerEntity> 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<SupProductEntity> 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)

@ -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) {

@ -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<UdiProductEntity> initUdiInfoEntitys(List<UdiProductEntity> 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);

@ -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})
</insert>
<insert id="insertUdiInfos" keyProperty="id" parameterType="java.util.List">
@ -235,7 +235,7 @@
allowNoBatch, allowNoExpire,
allowNoProduct, allowNoSerial, spmc, cplx, hchzsb, cpdls, price, basicPrductRemak1, basicPrductRemak2,
basicPrductRemak3, basicPrductRemak4, basicPrductRemak5, basicPrductRemak6, basicPrductRemak7,
basicPrductRemak8)
basicPrductRemak8, updateTime)
values
<foreach collection="udiInfoEntities" item="item" index="index"
@ -290,7 +290,7 @@
#{item.basicPrductRemak5},
#{item.basicPrductRemak6},
#{item.basicPrductRemak7},
#{item.basicPrductRemak8})
#{item.basicPrductRemak8}, #{item.updateTime})
</foreach>
</insert>
@ -423,8 +423,9 @@
<if test="allowNoSerial != null">
allowNoSerial=#{allowNoSerial},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
<if test="spmc != null">
spmc=#{spmc},
</if>
@ -625,6 +626,9 @@
<if test="basicPrductRemak8 != null">
basicPrductRemak8=#{basicPrductRemak8},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
</trim>
where uuid = #{uuid}
</update>
@ -785,6 +789,9 @@
<if test="basicPrductRemak8 != null">
basicPrductRemak8=#{basicPrductRemak8},
</if>
<if test="updateTime != null">
updateTime=#{updateTime},
</if>
</trim>
where id = #{id}
</update>
@ -955,6 +962,9 @@
</update>
<select id="selectAllowNoBatch" resultType="com.glxp.api.entity.basic.UdiProductEntity">
select id, allowNoBatch from basic_products where nameCode = #{nameCode} limit 1
select id, allowNoBatch
from basic_products
where nameCode = #{nameCode}
limit 1
</select>
</mapper>

@ -17,7 +17,7 @@
</select>
<insert id="insertExportStatus" keyProperty="id"
<insert id="insertExportStatus"
parameterType="com.glxp.api.entity.sync.BasicExportStatusTimeEntity">
replace
INTO basic_export_status_time(`key`, lastUpdateTime, remark)

Loading…
Cancel
Save