You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-java/src/main/java/com/glxp/api/controller/basic/UdiContrastController.java

545 lines
27 KiB
Java

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.glxp.api.controller.basic;
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.github.pagehelper.PageInfo;
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.annotation.Log;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.AsyncDiDlHelper;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.controller.BaseController;
import com.glxp.api.dto.BasicProductsCreateDto;
import com.glxp.api.entity.basic.CompanyProductRelevanceEntity;
import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.basic.UdiProductEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.system.CompanyEntity;
import com.glxp.api.entity.thrsys.CodeRel;
import com.glxp.api.entity.thrsys.ThrProductsEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.NmpaUdiClient;
import com.glxp.api.req.basic.*;
import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest;
import com.glxp.api.req.thrsys.ThirdAliDrugRequest;
import com.glxp.api.res.DiLevelResponse;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.inout.IoOrderDetailCodeService;
import com.glxp.api.service.system.CompanyService;
import com.glxp.api.service.thrsys.ThrDataService;
import com.glxp.api.service.thrsys.ThrSystemService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.IntUtil;
import com.glxp.api.util.udi.UdiInfoUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 耗材字典关联相关接口
*/
@RestController
public class UdiContrastController {
@Resource
NmpaUdiClient udiDlHttpClient;
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
UdiProductService udiProductService;
@Resource
private ThrSystemService thrSystemService;
@Resource
UdiContrastService udiContrastService;
@Resource
CustomerService customerService;
@Resource
ProductInfoService productInfoService;
@Resource
ThrDataService thrDataService;
@Resource
CompanyService companyService;
@Resource
private CompanyProductRelevanceService companyProductRelevanceService;
@Resource
IoOrderDetailCodeService orderDetailCodeService;
/**
* 耗材字典添加
*/
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/revleance")
@Log(title = "耗材字典", businessType = BusinessType.INSERT)
public BaseResponse revleanceUdi(@RequestBody UdiCombineRequest udiCombineRequest) {
List<String> keys = udiCombineRequest.getKeys();
if (keys != null && keys.size() > 0) {
for (String key : keys) {
//关联添加
if (udiCombineRequest.getRelId() == null) {
if (StrUtil.isNotEmpty(udiCombineRequest.getThirdId())) {
if (udiContrastService.isExit(key, udiCombineRequest.getThirdId(), null)) {
return ResultVOUtils.error(500, "已存在相同的对照关系,对照失败!");
} else {
udiContrastService.createUnionContrast(udiCombineRequest, key);
}
} else {
//只添加DI
if (udiContrastService.isExit(key, null, null)) {
return ResultVOUtils.error(500, "已存在该DI且未对照");
} else {
udiContrastService.createOnlyUuid(udiCombineRequest, key);
}
}
} else {//修改关联DI
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiCombineRequest.getRelId());
if (udiContrastService.isExit(key, udiRelevanceEntity.getMainId(), null)) {
return ResultVOUtils.error(500, "已存在相同的对照关系,对照失败!");
} else {
updateDi(udiRelevanceEntity, key);
}
}
}
} else if (CollUtil.isNotEmpty(udiCombineRequest.getThirdIds())) {
StringBuffer buffer = new StringBuffer();
//只添加第三方产品
for (String thirdId : udiCombineRequest.getThirdIds()) {
if (udiContrastService.isExit(null, thirdId, null)) {
buffer.append(thirdId).append(",");
} else {
BasicProductsCreateDto basicProductsCreateDto =new BasicProductsCreateDto();
basicProductsCreateDto.setMainId(thirdId);
basicProductsCreateDto.setDrugCheckMark(false);
udiContrastService.createOnlyMainId(basicProductsCreateDto);
}
}
if (StrUtil.isNotBlank(buffer.toString())) {
String errorInfo = StrUtil.removeSuffix(buffer.toString(), ",");
return ResultVOUtils.error(500, "产品编码:" + errorInfo + "已存在!");
}
}
return ResultVOUtils.success("添加成功");
}
/**
* 切换耗材字典版本号
*/
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/changeVersion")
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse changeVersion(@RequestBody UdiCombineRequest udiCombineRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiCombineRequest.getRelId());
// if (udiContrastService.isExit(udiCombineRequest.getKeys().get(0), udiRelevanceEntity.getMainId(), null)) {
// return ResultVOUtils.error(500, "已存在相同的对照关系,无法切换版本");
// }
List<UdiProductEntity> udiInfoEntities = udiDlHttpClient.getUdiByUuid(udiCombineRequest.getKeys().get(0));
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());
for (UdiProductEntity udiProductEntity : udiInfoEntities) {
udiProductEntity.setUuid(udiRelevanceEntity.getUuid());
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI);
}
udiProductService.insertUdiInfos(UdiInfoUtil.initUdiInfoEntitys(udiInfoEntities));
udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date());
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
return ResultVOUtils.success("切换成功!");
}
@Resource
AsyncDiDlHelper asyncDiDlHelper;
/**
* 切换耗材字典版本号
*/
@Transactional(rollbackFor = Exception.class)
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/syncOnline")
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse syncOnline(@RequestBody UdiCombineRequest udiCombineRequest) {
List<UdiProductEntity> udiInfoEntities = udiProductService.findByOriginUuid(udiCombineRequest.getOriginUuid());
if (CollUtil.isNotEmpty(udiInfoEntities)) {
String newUuid = null;
BaseResponse<List<ProductInfoEntity>> listBaseResponse = asyncDiDlHelper.dlLastVersionByDi(udiInfoEntities.get(0).getNameCode());
if (listBaseResponse.getCode() == 20000) {
List<ProductInfoEntity> productInfoEntityList = listBaseResponse.getData();
if (CollUtil.isNotEmpty(productInfoEntityList)) {
productInfoService.insertProductInfos(productInfoEntityList);
newUuid = productInfoEntityList.get(0).getUuid();
}
} else {
return ResultVOUtils.error(500, "实时获取国家库数据失败!");
}
udiInfoEntities = udiDlHttpClient.getUdiByUuid(newUuid);
udiProductService.deleteByUuid(udiCombineRequest.getUuid());
for (UdiProductEntity udiProductEntity : udiInfoEntities) {
udiProductEntity.setUuid(udiCombineRequest.getUuid());
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI);
udiProductEntity.setUpdateTime(new Date());
udiProductEntity.setId(IdUtil.getSnowflakeNextId());
}
udiProductService.insertUdiInfos(UdiInfoUtil.initUdiInfoEntitys(udiInfoEntities));
return ResultVOUtils.success("更新成功!");
} else {
return ResultVOUtils.error(500, "更新失败!");
}
}
//更改关联第三方产品产品信息
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/modifyRel")
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse modifyRel(@RequestBody UdiCombineRequest udiCombineRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiCombineRequest.getRelId());
udiRelevanceEntity = setThird(udiCombineRequest, udiRelevanceEntity);
udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date());
udiRelevanceEntity.setSupName(udiCombineRequest.getSupName());
udiRelevanceEntity.setUpdateUser(customerService.getUserId() + "");
UdiRelevanceResponse temp = udiContrastService.findById(udiRelevanceEntity.getId());
if (udiContrastService.isExit(temp.getOriginUuid(), udiRelevanceEntity.getMainId(), udiCombineRequest.getThirdSys())) {
return ResultVOUtils.error(500, "已存在相同的对照关系,对照失败!");
} else {
try {
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
} catch (Exception e) {
return ResultVOUtils.error(500, "已存在相同的对照关系,对照失败!");
}
}
//关联第三方产品信息若无值则由第三方产品信息带过来
UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiRelevanceEntity.getUuid());
if (StrUtil.isEmpty(udiProductEntity.getManufactory())) {
udiProductEntity.setManufactory(udiCombineRequest.getManufactory());
}
if (StrUtil.isEmpty(udiProductEntity.getMeasname())) {
udiProductEntity.setMeasname(udiCombineRequest.getMeasname());
}
udiProductService.updateUdiInfo(udiProductEntity);
return ResultVOUtils.success("更新成功");
}
//解除绑定第三方产品信息
@AuthRuleAnnotation("")
@GetMapping("/udiwms/udirl/thirdSys/remove")
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse removeThirdId(RemoveUdiRelRequest removeUdiRelRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(removeUdiRelRequest.getRelId());
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 0) {
for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
if (udiRelevanceEntity1.getThirdId() == null && udiRelevanceEntity1.getThirdId1() == null &&
udiRelevanceEntity1.getThirdId2() == null && udiRelevanceEntity1.getThirdId3() == null && udiRelevanceEntity1.getThirdId4() == null) {
return ResultVOUtils.error(500, "解除绑定失败!");
}
}
}
if (removeUdiRelRequest.getThirdSys().equals("thirdId")) {
udiRelevanceEntity.setThirdId("");
UdiRelevanceResponse temp = udiContrastService.findById(udiRelevanceEntity.getId());
if (udiContrastService.isExit(temp.getOriginUuid(), null, null)) {
return ResultVOUtils.error(500, "解除绑定失败!");
}
} else if (removeUdiRelRequest.getThirdSys().equals("thirdId1")) {
udiRelevanceEntity.setThirdId1("");
} else if (removeUdiRelRequest.getThirdSys().equals("thirdId2")) {
udiRelevanceEntity.setThirdId2("");
} else if (removeUdiRelRequest.getThirdSys().equals("thirdId3")) {
udiRelevanceEntity.setThirdId3("");
} else if (removeUdiRelRequest.getThirdSys().equals("thirdId4")) {
udiRelevanceEntity.setThirdId4("");
}
try {
UdiCombineRequest udiCombineRequest = new UdiCombineRequest();
udiCombineRequest.setRelId(removeUdiRelRequest.getRelId());
udiRelevanceEntity.setSupName("");
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
} catch (Exception e) {
e.printStackTrace();
return ResultVOUtils.error(500, "解除绑定失败!");
}
return ResultVOUtils.success("解除绑定成功!");
}
//解除绑定DI器械信息
@AuthRuleAnnotation("")
@GetMapping("/udiwms/udirl/di/remove")
@Log(title = "耗材字典", businessType = BusinessType.UPDATE)
public BaseResponse removeDI(RemoveUdiRelRequest removeRelRequest) {
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(removeRelRequest.getRelId());
if (StrUtil.isEmpty(udiRelevanceEntity.getMainId())) {
return ResultVOUtils.error(500, "未关联第三方产品ID无法解除绑定");
}
List<UdiRelevanceResponse> temps = udiRelevanceService.selectByMainId(udiRelevanceEntity.getMainId());
if (temps.size() > 0) {
for (UdiRelevanceResponse temp : temps) {
if (temp.getMainId() != null)
if (temp.getNameCode().equals(temp.getMainId())) {
return ResultVOUtils.error(500, "已存在未关联的第三方产品ID无法解除绑定");
}
}
}
//判断单据是否存在相关对照的产品组合
Boolean exitUuid = orderDetailCodeService.isExit(udiRelevanceEntity.getId(), udiRelevanceEntity.getUuid());
if (IntUtil.value(exitUuid)) {
return ResultVOUtils.error(500, "该产品已关联单据,无法解绑!");
}
ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys();
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getMainId(), thrSystemEntity.getThirdId());
UdiProductEntity UdiInfoRequest = new UdiProductEntity();
BeanUtil.copyProperties(thrProductsEntity, UdiInfoRequest);
UdiInfoRequest.setNameCode(thrProductsEntity.getCode());
UdiInfoRequest.setCpmctymc(thrProductsEntity.getName());
UdiInfoRequest.setManufactory(thrProductsEntity.getManufactory());
UdiInfoRequest.setYlqxzcrbarmc(thrProductsEntity.getManufactory());
UdiInfoRequest.setGgxh(thrProductsEntity.getSpec());
UdiInfoRequest.setZczbhhzbapzbh(thrProductsEntity.getRegisterNo());
UdiInfoRequest.setUuid(CustomUtil.getUUId());
UdiInfoRequest.setProductType(ConstantStatus.PRODUCT_TYPE_THIRD);
UdiInfoRequest.setDiType(1);
udiProductService.insertUdiInfo(UdiInfoRequest);
udiRelevanceEntity.setUuid(UdiInfoRequest.getUuid());
udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date());
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
return ResultVOUtils.success("解除绑定成功!");
}
//获取DI版本号
@AuthRuleAnnotation("")
@GetMapping("/udiwms/syncdi/version")
public BaseResponse getVersion(UdiCombineRequest udiCombineRequest) {
List<ProductInfoEntity> productInfoEntityList = new ArrayList<>();
List<UdiRelevanceResponse> udiRelevanceEntities = udiContrastService.findByUuid(udiCombineRequest.getUuid());
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
String originUuid = udiRelevanceEntities.get(0).getOriginUuid();
List<ProductInfoEntity> productInfoEntities = productInfoService.selectByUuid(originUuid);
if (CollUtil.isNotEmpty(productInfoEntities)) {
String deviceRecordKey = productInfoEntities.get(0).getDeviceRecordKey();
ProductInfoFilterRequest productInfoFilterRequest = new ProductInfoFilterRequest();
productInfoFilterRequest.setDeviceRecordKey(deviceRecordKey);
List<ProductInfoEntity> result = productInfoService.filterProductGroup(productInfoFilterRequest);
if (CollUtil.isNotEmpty(result)) {
productInfoEntityList.addAll(result);
}
}
}
PageInfo<ProductInfoEntity> pageInfo;
pageInfo = new PageInfo<>(productInfoEntityList);
PageSimpleResponse<ProductInfoEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(productInfoEntityList);
return ResultVOUtils.success(pageSimpleResponse);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/addDrug")
public BaseResponse addDrug(@RequestBody AddProductRequest addProductRequest) {
AddProductRequest udiRelevanceEntity = udiProductService.addDrug(addProductRequest);
return ResultVOUtils.success(udiRelevanceEntity);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/updatetDrug")
public BaseResponse updatetDrug(@RequestBody AddProductRequest addProductRequest) {
AddProductRequest udiRelevanceEntity = udiProductService.addDrug(addProductRequest);
return ResultVOUtils.success(udiRelevanceEntity);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/updateLevelDrug")
public BaseResponse updateLevelDrug(@RequestBody UpdateLevelDrugRequest updateLevelDrugRequest) {
udiProductService.saveOrUpadateLevelDrug(updateLevelDrugRequest);
return ResultVOUtils.success("更新成功");
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/updateLevelDrugAli")
public BaseResponse updateLevelDrugAli(@RequestBody ThirdAliDrugRequest thirdAliDrug) {
;
return udiProductService.saveOrUpadateLevelDrugAli(thirdAliDrug);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/calculateDistCount")
public BaseResponse calculateDistCount(@RequestBody UdiProductEntity udiProductEntity) {
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiProductService.calculateDistCount(udiProductEntity, udiRelevanceEntity);
return ResultVOUtils.success(udiRelevanceEntity);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/calculateUseCount")
public BaseResponse calculateUseCount(@RequestBody UdiProductEntity udiProductEntity) {
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
udiProductService.calculateUseCount(udiProductEntity, udiRelevanceEntity);
return ResultVOUtils.success(udiRelevanceEntity);
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/drug/delLevel")
public BaseResponse delLevel(@RequestBody AddProductRequest addProductRequest) {
boolean b = udiProductService.deleteByNameCode(addProductRequest.getNameCode());
if( b && StrUtil.isNotEmpty(addProductRequest.getYbbm()) && StrUtil.isNotEmpty(addProductRequest.getNameCode())){
CodeRel codeRel = new CodeRel();
codeRel.setYbbm(addProductRequest.getYbbm());
codeRel.setDrugCode(addProductRequest.getNameCode());
udiContrastService.deleteRelCode(codeRel);
}
return ResultVOUtils.success("删除成功!");
}
/**
* 耗材字典信息获取同一产品对应DI信息
*/
@AuthRuleAnnotation("")
@GetMapping("/udiwms/udi/local/levelByUuid")
public BaseResponse filterLocalByUuid(FilterUdiRelRequest filterUdiRelRequest) {
List<DiLevelResponse> diLevelResponses = udiProductService.findLevelByRelId(filterUdiRelRequest.getId());
return ResultVOUtils.success(diLevelResponses);
}
public void updateDi(UdiRelevanceEntity udiRelevanceEntity, String key) {
List<UdiProductEntity> udiInfoEntities = udiDlHttpClient.getOrUpdateByUuid(key);
List<UdiProductEntity> originProductEntities = udiProductService.findByUuids(udiRelevanceEntity.getUuid());
if (CollUtil.isNotEmpty(originProductEntities) && CollUtil.isNotEmpty(udiInfoEntities)) {
UdiProductEntity originProductEntity = originProductEntities.get(0);
for (UdiProductEntity udiProductEntity : udiInfoEntities) {
if (StrUtil.isEmpty(udiProductEntity.getSptm())) {
udiProductEntity.setSptm(originProductEntity.getSptm());
}
if (StrUtil.isEmpty(udiProductEntity.getYbbm())) {
udiProductEntity.setYbbm(originProductEntity.getYbbm());
}
if (StrUtil.isEmpty(udiProductEntity.getMeasname())) {
udiProductEntity.setMeasname(originProductEntity.getMeasname());
}
if (StrUtil.isEmpty(udiProductEntity.getManufactory())) {
udiProductEntity.setManufactory(originProductEntity.getManufactory());
}
if (StrUtil.isEmpty(udiProductEntity.getPrice())) {
udiProductEntity.setPrice(originProductEntity.getPrice());
}
if (StrUtil.isEmpty(udiProductEntity.getSpmc())) {
udiProductEntity.setSpmc(originProductEntity.getSpmc());
}
if (StrUtil.isEmpty(udiProductEntity.getCpms())) {
udiProductEntity.setCpms(originProductEntity.getCpms());
}
if (udiProductEntity.getProductsType() == null || udiProductEntity.getProductsType() == 0){
udiProductEntity.setProductsType(originProductEntity.getProductsType());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak1())) {
udiProductEntity.setBasicPrductRemak1(originProductEntity.getBasicPrductRemak1());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak2())) {
udiProductEntity.setBasicPrductRemak2(originProductEntity.getBasicPrductRemak2());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak3())) {
udiProductEntity.setBasicPrductRemak3(originProductEntity.getBasicPrductRemak3());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak4())) {
udiProductEntity.setBasicPrductRemak4(originProductEntity.getBasicPrductRemak4());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak5())) {
udiProductEntity.setBasicPrductRemak5(originProductEntity.getBasicPrductRemak5());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak6())) {
udiProductEntity.setBasicPrductRemak6(originProductEntity.getBasicPrductRemak6());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak7())) {
udiProductEntity.setBasicPrductRemak7(originProductEntity.getBasicPrductRemak7());
}
if (StrUtil.isEmpty(udiProductEntity.getBasicPrductRemak8())) {
udiProductEntity.setBasicPrductRemak8(originProductEntity.getBasicPrductRemak8());
}
}
}
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());
udiRelevanceEntity.setUuid(udiInfoEntities.get(0).getUuid());
udiRelevanceEntity.setUpdateTime(new Date());
udiRelevanceEntity.setModifyTime(new Date());
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
insertUdiInfos(udiInfoEntities);
udiProductService.updateLevelCount(udiRelevanceEntity);
}
public UdiRelevanceEntity setThird(UdiCombineRequest udiCombineRequest, UdiRelevanceEntity udiRelevanceEntity) {
FilterBasicThirdSysRequest request = new FilterBasicThirdSysRequest();
if ("thirdId".equals(udiCombineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId(udiCombineRequest.getThirdId());
request.setThirdId("thirdId");
} else if ("thirdId1".equals(udiCombineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId1(udiCombineRequest.getThirdId());
request.setThirdId("thirdId1");
} else if ("thirdId2".equals(udiCombineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId2(udiCombineRequest.getThirdId());
request.setThirdId("thirdId2");
} else if ("thirdId3".equals(udiCombineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId3(udiCombineRequest.getThirdId());
request.setThirdId("thirdId3");
} else if ("thirdId4".equals(udiCombineRequest.getThirdSys())) {
udiRelevanceEntity.setThirdId4(udiCombineRequest.getThirdId());
request.setThirdId("thirdId4");
}
ThrSystemEntity thrSystemEntity = thrSystemService.selectMainThrSys1(request);
String mainSys = thrSystemEntity.getThirdId();
if (mainSys.equals("thirdId")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId());
} else if (mainSys.equals("thirdId1")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId1());
} else if (mainSys.equals("thirdId2")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId2());
} else if (mainSys.equals("thirdId3")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId3());
} else if (mainSys.equals("thirdId4")) {
udiRelevanceEntity.setMainId(udiRelevanceEntity.getThirdId4());
}
return udiRelevanceEntity;
}
public void insertUdiInfos(List<UdiProductEntity> udiInfoEntities) {
if (CollUtil.isNotEmpty(udiInfoEntities)) {
UdiProductEntity udiProductEntity = udiProductService.findByUuid(udiInfoEntities.get(0).getUuid());
if (udiProductEntity == null) {
udiProductService.insertUdiInfos(UdiInfoUtil.initUdiInfoEntitys(udiInfoEntities));
}
}
}
}