|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.sale.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.UdiInfoEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsAddDiEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
@ -15,6 +16,8 @@ import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
import com.glxp.sale.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.thrsys.ThrProductsAddDiResponse;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiContrastService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiInfoService;
|
|
|
|
|
import com.glxp.sale.admin.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
|
|
|
|
import com.glxp.sale.admin.service.thrsys.ThrProductsAddDiService;
|
|
|
|
|
import com.glxp.sale.common.enums.ResultEnum;
|
|
|
|
@ -44,6 +47,10 @@ public class ThrProductsAddDiController {
|
|
|
|
|
private UdiContrastService udiContrastService;
|
|
|
|
|
@Resource
|
|
|
|
|
private CompanyProductRelevanceService companyProductRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiInfoService udiInfoService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询DI产品信息列表
|
|
|
|
@ -65,7 +72,6 @@ public class ThrProductsAddDiController {
|
|
|
|
|
/**
|
|
|
|
|
* 添加DI产品信息
|
|
|
|
|
*
|
|
|
|
|
* @param thrProductsAddDiEntity
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@ -74,7 +80,7 @@ public class ThrProductsAddDiController {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
|
|
|
|
}
|
|
|
|
|
thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest.getUuids(), addThrDiProductsRequest.getCustomerId());
|
|
|
|
|
thrProductsAddDiService.addThrAddDiProducts(addThrDiProductsRequest);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -90,28 +96,43 @@ public class ThrProductsAddDiController {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
thrProductsAddDiEntity.setAuditTime(new Date());
|
|
|
|
|
thrProductsAddDiService.updateDiProduct(thrProductsAddDiEntity);
|
|
|
|
|
ThrProductsAddDiResponse thrProductsAddDiResponse = thrProductsAddDiService.selecById(thrProductsAddDiEntity.getId());
|
|
|
|
|
|
|
|
|
|
if (thrProductsAddDiEntity.getStatus() == 2) { //审核通过
|
|
|
|
|
ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
|
|
|
|
|
UdiInfoEntity udiInfoEntity = thrProductsAddDiService.getDiProductDetail(thrProductsAddDiEntity.getUuid());
|
|
|
|
|
BeanUtil.copyProperties(udiInfoEntity, thrProductsEntity);
|
|
|
|
|
//审核通过后追加到耗材字典中
|
|
|
|
|
CombineRequest combineRequest = new CombineRequest();
|
|
|
|
|
combineRequest.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
|
|
|
|
//插入数据,并获取关联主键
|
|
|
|
|
Long udiRelIdFk = udiContrastService.createOnlyUuid(combineRequest, thrProductsAddDiEntity.getUuid());
|
|
|
|
|
//回填关联关系到关联表
|
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = new CompanyProductRelevanceEntity();
|
|
|
|
|
companyProductRelevanceEntity.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
|
|
|
|
companyProductRelevanceEntity.setUdiRlIdFk(udiRelIdFk.intValue());
|
|
|
|
|
companyProductRelevanceEntity.setCreate_time(new Date());
|
|
|
|
|
companyProductRelevanceEntity.setUpdate_time(new Date());
|
|
|
|
|
companyProductRelevanceEntity.setUnitFk(thrProductsAddDiEntity.getCustomerId().toString());
|
|
|
|
|
companyProductRelevanceEntity.setAuditStatus("1");
|
|
|
|
|
|
|
|
|
|
companyProductRelevanceService.insertCompanyProductRelevance(companyProductRelevanceEntity);
|
|
|
|
|
if (udiContrastService.isExit(thrProductsAddDiEntity.getUuid(), null, null)) {
|
|
|
|
|
return ResultVOUtils.error(500, "已存在该DI,且未对照,请联系供应商自行选入产品!");
|
|
|
|
|
} else {
|
|
|
|
|
Long udiRelIdFk = udiContrastService.createOnlyUuid(combineRequest, thrProductsAddDiEntity.getUuid());
|
|
|
|
|
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(udiRelIdFk + "");
|
|
|
|
|
udiRelevanceEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setSptm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setMeasname(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiRelevanceEntity.setYbbm(thrProductsAddDiResponse.getYbbm());
|
|
|
|
|
udiInfoEntity.setSpmc(thrProductsAddDiResponse.getSpmc());
|
|
|
|
|
udiInfoEntity.setCpms(thrProductsAddDiResponse.getCpms());
|
|
|
|
|
udiRelevanceService.updateUdiRelevance(udiRelevanceEntity);
|
|
|
|
|
udiInfoService.updateUdiInfo(udiInfoEntity);
|
|
|
|
|
//回填关联关系到关联表
|
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = new CompanyProductRelevanceEntity();
|
|
|
|
|
companyProductRelevanceEntity.setCustomerId(thrProductsAddDiEntity.getCustomerId());
|
|
|
|
|
companyProductRelevanceEntity.setUdiRlIdFk(udiRelIdFk.intValue());
|
|
|
|
|
companyProductRelevanceEntity.setCreate_time(new Date());
|
|
|
|
|
companyProductRelevanceEntity.setUpdate_time(new Date());
|
|
|
|
|
companyProductRelevanceEntity.setUnitFk(thrProductsAddDiEntity.getCustomerId().toString());
|
|
|
|
|
companyProductRelevanceEntity.setAuditStatus("1");
|
|
|
|
|
|
|
|
|
|
companyProductRelevanceService.insertCompanyProductRelevance(companyProductRelevanceEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|