|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.glxp.api.service.basic;
|
|
|
|
|
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
@ -171,6 +172,8 @@ public class BasicBackUpdateProductService {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
UdiContrastService udiContrastService;
|
|
|
|
|
|
|
|
|
|
//定时或一键下载更新本地所有产品信息
|
|
|
|
|
@Async
|
|
|
|
@ -185,65 +188,71 @@ public class BasicBackUpdateProductService {
|
|
|
|
|
filterThrInvProductsRequest.setPage(null);
|
|
|
|
|
List<ThrProductsEntity> thrProductsEntities = thrProductsService.filterThrProducts(filterThrInvProductsRequest);
|
|
|
|
|
|
|
|
|
|
SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type");
|
|
|
|
|
if (isEnable == null || isEnable == false) {
|
|
|
|
|
isUpdate.setParamValue("1");
|
|
|
|
|
}
|
|
|
|
|
// SystemParamConfigEntity isUpdate = systemParamConfigService.selectByParamKey("erp_updateErpData_type");
|
|
|
|
|
// if (isEnable == null || isEnable == false) {
|
|
|
|
|
// isUpdate.setParamValue("1");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
|
|
|
|
|
for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByThirdId(thrProductsEntity.getCode(), thirdSysId);
|
|
|
|
|
if (udiRelevanceEntity == null) {
|
|
|
|
|
if (isUpdate.getParamValue().equals("1")) {
|
|
|
|
|
|
|
|
|
|
UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
udiProductEntity.setGgxh(thrProductsEntity.getSpec());
|
|
|
|
|
udiProductEntity.setUuid(CustomUtil.getUUId());
|
|
|
|
|
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
udiProductEntity.setDiType(1);
|
|
|
|
|
udiProductEntity.setManufactory(thrProductsEntity.getManufactory());
|
|
|
|
|
udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
|
|
|
|
|
udiRelevanceEntity1.setUuid(udiProductEntity.getUuid());
|
|
|
|
|
udiRelevanceEntity1.setIsDisable(false);
|
|
|
|
|
udiRelevanceEntity1.setSupName(thrProductsEntity.getSupName());
|
|
|
|
|
|
|
|
|
|
if ("thirdId".equals(thirdSysId)) {
|
|
|
|
|
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
|
|
|
|
|
} else if ("thirdId1".equals(thirdSysId)) {
|
|
|
|
|
udiRelevanceEntity1.setThirdId1(thrProductsEntity.getCode());
|
|
|
|
|
} else if ("thirdId2".equals(thirdSysId)) {
|
|
|
|
|
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
|
|
|
|
|
} else if ("thirdId3".equals(thirdSysId)) {
|
|
|
|
|
udiRelevanceEntity1.setThirdId3(thrProductsEntity.getCode());
|
|
|
|
|
} else if ("thirdId4".equals(thirdSysId)) {
|
|
|
|
|
udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
|
|
|
|
|
String mainSys = thrSystemEntity.getThirdId();
|
|
|
|
|
if (mainSys.equals("thirdId")) {
|
|
|
|
|
udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId());
|
|
|
|
|
} else if (mainSys.equals("thirdId1")) {
|
|
|
|
|
udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId1());
|
|
|
|
|
} else if (mainSys.equals("thirdId2")) {
|
|
|
|
|
udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId2());
|
|
|
|
|
} else if (mainSys.equals("thirdId3")) {
|
|
|
|
|
udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId3());
|
|
|
|
|
} else if (mainSys.equals("thirdId4")) {
|
|
|
|
|
udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId4());
|
|
|
|
|
}
|
|
|
|
|
// if (isUpdate.getParamValue().equals("1")) {
|
|
|
|
|
//
|
|
|
|
|
// UdiProductEntity udiProductEntity = new UdiProductEntity();
|
|
|
|
|
// udiProductEntity.setNameCode(thrProductsEntity.getCode());
|
|
|
|
|
// udiProductEntity.setCpmctymc(thrProductsEntity.getName());
|
|
|
|
|
// udiProductEntity.setGgxh(thrProductsEntity.getSpec());
|
|
|
|
|
// udiProductEntity.setUuid(CustomUtil.getUUId());
|
|
|
|
|
// udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
|
|
|
|
|
// udiProductEntity.setDiType(1);
|
|
|
|
|
// udiProductEntity.setManufactory(thrProductsEntity.getManufactory());
|
|
|
|
|
// udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
|
|
|
|
|
// udiProductEntity.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
|
|
|
|
|
// udiProductEntity.setRequireScanCode(0);
|
|
|
|
|
// udiProductService.insertUdiInfo(udiProductEntity);
|
|
|
|
|
// UdiRelevanceEntity udiRelevanceEntity1 = new UdiRelevanceEntity();
|
|
|
|
|
// udiRelevanceEntity1.setUuid(udiProductEntity.getUuid());
|
|
|
|
|
// udiRelevanceEntity1.setIsDisable(false);
|
|
|
|
|
// udiRelevanceEntity1.setSupName(thrProductsEntity.getSupName());
|
|
|
|
|
//
|
|
|
|
|
// if ("thirdId".equals(thirdSysId)) {
|
|
|
|
|
// udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
|
|
|
|
|
// } else if ("thirdId1".equals(thirdSysId)) {
|
|
|
|
|
// udiRelevanceEntity1.setThirdId1(thrProductsEntity.getCode());
|
|
|
|
|
// } else if ("thirdId2".equals(thirdSysId)) {
|
|
|
|
|
// udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
|
|
|
|
|
// } else if ("thirdId3".equals(thirdSysId)) {
|
|
|
|
|
// udiRelevanceEntity1.setThirdId3(thrProductsEntity.getCode());
|
|
|
|
|
// } else if ("thirdId4".equals(thirdSysId)) {
|
|
|
|
|
// udiRelevanceEntity1.setThirdId4(thrProductsEntity.getCode());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
|
|
|
|
|
// String mainSys = thrSystemEntity.getThirdId();
|
|
|
|
|
// if (mainSys.equals("thirdId")) {
|
|
|
|
|
// udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId());
|
|
|
|
|
// } else if (mainSys.equals("thirdId1")) {
|
|
|
|
|
// udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId1());
|
|
|
|
|
// } else if (mainSys.equals("thirdId2")) {
|
|
|
|
|
// udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId2());
|
|
|
|
|
// } else if (mainSys.equals("thirdId3")) {
|
|
|
|
|
// udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId3());
|
|
|
|
|
// } else if (mainSys.equals("thirdId4")) {
|
|
|
|
|
// udiRelevanceEntity1.setMainId(udiRelevanceEntity1.getThirdId4());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
|
|
|
|
|
// udiRelevanceEntity1.setUpdateTime(new Date());
|
|
|
|
|
// udiRelevanceEntity1.setModifyTime(new Date());
|
|
|
|
|
// udiRelevanceEntity1.setId(gennerOrderUtils.getRelId());
|
|
|
|
|
// udiRelevanceService.insertUdiRelevanceignore(udiRelevanceEntity1);
|
|
|
|
|
// }
|
|
|
|
|
try {
|
|
|
|
|
udiContrastService.createOnlyMainId(thrProductsEntity.getCode());
|
|
|
|
|
} catch (JsonException e) {
|
|
|
|
|
|
|
|
|
|
udiRelevanceEntity1.setThirdId(thrProductsEntity.getCode());
|
|
|
|
|
udiRelevanceEntity1.setUpdateTime(new Date());
|
|
|
|
|
udiRelevanceEntity1.setModifyTime(new Date());
|
|
|
|
|
udiRelevanceEntity1.setId(gennerOrderUtils.getRelId());
|
|
|
|
|
udiRelevanceService.insertUdiRelevanceignore(udiRelevanceEntity1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|