package com.glxp.api.controller.basic; import cn.hutool.core.collection.CollUtil; 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.enums.ResultEnum; 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.controller.BaseController; import com.glxp.api.entity.basic.*; import com.glxp.api.entity.inv.InvProductEntity; import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.entity.thrsys.ThrSystemEntity; import com.glxp.api.req.basic.*; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.thrsys.FilterBasicThirdSysRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.basic.BasicProductThirdSysResponse; 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.IoCodeService; import com.glxp.api.service.inv.InvPreProductService; import com.glxp.api.service.inv.InvProductService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.service.thrsys.ThrDataService; import com.glxp.api.service.thrsys.ThrSystemService; import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.udi.FilterUdiUtils; import com.glxp.api.util.udi.UdiInfoUtil; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindingResult; 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.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; @RestController public class UdiRelevanceController extends BaseController { @Resource UdiRelevanceService udiRelevanceService; @Resource UdiProductService udiProductService; @Resource BasicBackUpdateProductService basicBackUpdateProductService; @Resource BasicUpdateProductService basicUpdateProductService; @Resource private SystemParamConfigService systemParamConfigService; @Resource private ThrSystemService thrSystemService; @Resource ThrDataService thrDataService; @Resource UdiRlSupService udiRlSupService; @Resource ProductInfoService productInfoService; //手持终端下载UDI产品信息 @AuthRuleAnnotation("") @GetMapping("/udi/udirel/download") public BaseResponse downloadProducts(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List udiRelevanceResponses = null; udiRelevanceResponses = udiRelevanceService.filterUdiRelevance(filterUdiRelRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(udiRelevanceResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(udiRelevanceResponses); return ResultVOUtils.success(pageSimpleResponse); } @AuthRuleAnnotation("") @GetMapping("/udi/udirel/mutil/download") public BaseResponse downloadMutilProducts(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List udiRelevanceResponses = null; if (StrUtil.isNotEmpty(filterUdiRelRequest.getBindRlIds())) { String[] datas = filterUdiRelRequest.getBindRlIds().split(","); List list = Arrays.asList(datas); filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setRelIds(list); } udiRelevanceResponses = udiRelevanceService.filterUdiJoinSup(filterUdiRelRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(udiRelevanceResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(udiRelevanceResponses); return ResultVOUtils.success(pageSimpleResponse); } //基础信息-耗材字典-查询页面、业务单据-选入耗材字典-查询页面 @AuthRuleAnnotation("") @GetMapping("/udi/udirel/filterUdi") public BaseResponse filterUdiGp(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode()) && StrUtil.isEmpty(filterUdiRelRequest.getUnionCode())) { if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) { UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode()); filterUdiRelRequest.setNameCode(udiEntity.getUdi()); } List temps = udiRelevanceService.filterUdiGp(filterUdiRelRequest); if (temps != null && temps.size() > 0) { filterUdiRelRequest.setOriginUuid(temps.get(0).getOriginUuid()); filterUdiRelRequest.setNameCode(null); } } else { filterUdiRelRequest.setDiType(1); } List udiRelevanceResponses = udiRelevanceService.filterUdiGp(filterUdiRelRequest); PageInfo pageInfo = new PageInfo<>(udiRelevanceResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(udiRelevanceResponses); return ResultVOUtils.success(pageSimpleResponse); } //供应商器械信息选入 @AuthRuleAnnotation("") @GetMapping("/udi/udirel/filterSmUdi") public BaseResponse filterSmUdi(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List udiRelevanceResponses = null; if (StrUtil.isNotEmpty(filterUdiRelRequest.getUnionCode())) { filterUdiRelRequest.setNameCode(filterUdiRelRequest.getUnionCode()); List temps = udiRelevanceService.filterUdiGp(filterUdiRelRequest); if (temps != null && temps.size() > 0) { filterUdiRelRequest.setOriginUuid(temps.get(0).getOriginUuid()); filterUdiRelRequest.setNameCode(null); } } else { filterUdiRelRequest.setDiType(1); } if (isHosUser()) { filterUdiRelRequest.setUnitFk(null); } else { filterUdiRelRequest.setUnitFk(getCustomerId()); } udiRelevanceResponses = udiRelevanceService.filterUdiGp(filterUdiRelRequest); if (udiRelevanceResponses != null && udiRelevanceResponses.size() > 0) { for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) { UdiRlSupEntity companyProductRelevanceEntity = udiRlSupService.findCompanyProductRelevanceByUdiRlIdFk(udiRelevanceResponse.getId() + "", filterUdiRelRequest.getCustomerId()); if (companyProductRelevanceEntity != null) { udiRelevanceResponse.setIsSelect(true); } else { udiRelevanceResponse.setIsSelect(false); } } } PageInfo pageInfo; pageInfo = new PageInfo<>(udiRelevanceResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(udiRelevanceResponses); return ResultVOUtils.success(pageSimpleResponse); } //资质证书选入产品列表 产品名称,生产企业过滤 @AuthRuleAnnotation("") @GetMapping("/udi/cert/filterUdi") public BaseResponse filterCertUdi(FilterUdiRelRequest filterUdiRelRequest) { List udiRelevanceResponses = udiRelevanceService.filterCertUdi(filterUdiRelRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(udiRelevanceResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(udiRelevanceResponses); return ResultVOUtils.success(pageSimpleResponse); } /** * 耗材字典信息获取同一产品对应DI信息 */ @AuthRuleAnnotation("") @GetMapping("udiwms/udiinfo/local/filterByUuid") public BaseResponse filterLocalByUuid(FilterUdiRelRequest filterUdiRelRequest) { if (filterUdiRelRequest.getId() == null) { return ResultVOUtils.error(500, "产品ID主键不能为空!"); } UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(filterUdiRelRequest.getId()); FilterUdiRelRequest tempRequest = new FilterUdiRelRequest(); tempRequest.setUuid(udiRelevanceEntity.getUuid()); List udiInfoEntities = udiProductService.filterAllUdiInfo(tempRequest); List udiRelevanceResponses = new ArrayList<>(); if (CollUtil.isNotEmpty(udiInfoEntities)) { for (UdiProductEntity udiProductEntity : udiInfoEntities) { UdiRelevanceResponse udiRelevanceResponse = new UdiRelevanceResponse(); BeanUtils.copyProperties(udiProductEntity, udiRelevanceResponse); BeanUtils.copyProperties(udiRelevanceEntity, udiRelevanceResponse); udiRelevanceResponses.add(udiRelevanceResponse); } } return ResultVOUtils.success(udiRelevanceResponses); } //多选删除 @AuthRuleAnnotation("") @PostMapping("/udi/udirel/deleteAll") @Log(title = "单据管理", businessType = BusinessType.DELETE) public BaseResponse deleteAll(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List ids = deleteRequest.getIds(); udiRelevanceService.deleteByIds(ids); return ResultVOUtils.success("删除成功"); } @Resource IoCodeService codeService; @Resource CompanyProductRelevanceService companyProductRelevanceService; @AuthRuleAnnotation("") @PostMapping("/udi/udirel/deleteById") @Log(title = "单据管理", businessType = BusinessType.DELETE) public BaseResponse deleteById(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } String ids = deleteRequest.getId(); UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids)); if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) { if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) { return ResultVOUtils.error(500, "该产品已关联单据,无法删除!"); } if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) { return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!"); } } udiRelevanceService.deleteById(ids); List udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) { udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); } return ResultVOUtils.success("删除成功"); } @Resource CustomerService customerService; @AuthRuleAnnotation("") @PostMapping("/udi/udirel/update") @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse updateRelevanceEntity(@RequestBody UdiRelevanceSaveRequest udiRelevanceSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } //更新关联表 if (udiRelevanceSaveRequest.getIsDateBy() != null && udiRelevanceSaveRequest.getIsDateBy() == 1) { if (udiRelevanceSaveRequest.getRecentDateTime() != null) { int time = udiRelevanceSaveRequest.getRecentDateTime() * 24; udiRelevanceSaveRequest.setRecentDateTime(time); } } //更新关联表 UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); BeanUtils.copyProperties(udiRelevanceSaveRequest, udiRelevanceEntity); udiRelevanceEntity.setId(udiRelevanceSaveRequest.getId()); udiRelevanceEntity.setUpdateTime(new Date()); udiRelevanceEntity.setModifyTime(new Date()); udiRelevanceEntity.setUpdateUser(customerService.getUserId() + ""); udiRelevanceEntity.setUseMuti(udiRelevanceEntity.getUseMuti()); udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); //关联更新 UdiProductEntity udiProductEntity = new UdiProductEntity(); udiProductEntity.setYbbm(udiRelevanceSaveRequest.getYbbm()); udiProductEntity.setMeasname(udiRelevanceSaveRequest.getMeasname()); udiProductEntity.setManufactory(udiRelevanceSaveRequest.getManufactory()); udiProductEntity.setCpms(udiRelevanceSaveRequest.getCpms()); udiProductEntity.setPrice(udiRelevanceSaveRequest.getPrice()); udiProductEntity.setSpmc(udiRelevanceSaveRequest.getSpmc()); udiProductEntity.setAllowNoBatch(udiRelevanceSaveRequest.getAllowNoBatch()); udiProductEntity.setAllowNoExpire(udiRelevanceSaveRequest.getAllowNoExpire()); udiProductEntity.setAllowNoProduct(udiRelevanceSaveRequest.getAllowNoProduct()); udiProductEntity.setAllowNoSerial(udiRelevanceSaveRequest.getAllowNoSerial()); udiProductEntity.setZxxsbzbhsydysl(udiRelevanceEntity.getUseNum()); udiProductEntity.setBasicPrductRemak1(udiRelevanceSaveRequest.getBasicPrductRemak1()); udiProductEntity.setBasicPrductRemak2(udiRelevanceSaveRequest.getBasicPrductRemak2()); udiProductEntity.setBasicPrductRemak3(udiRelevanceSaveRequest.getBasicPrductRemak3()); udiProductEntity.setBasicPrductRemak4(udiRelevanceSaveRequest.getBasicPrductRemak4()); udiProductEntity.setBasicPrductRemak5(udiRelevanceSaveRequest.getBasicPrductRemak5()); udiProductEntity.setBasicPrductRemak6(udiRelevanceSaveRequest.getBasicPrductRemak6()); udiProductEntity.setBasicPrductRemak7(udiRelevanceSaveRequest.getBasicPrductRemak7()); udiProductEntity.setBasicPrductRemak8(udiRelevanceSaveRequest.getBasicPrductRemak8()); // udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); if (StrUtil.isNotEmpty(udiRelevanceSaveRequest.getOriginUuid())) { udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI); } udiProductEntity.setUuid(udiRelevanceSaveRequest.getUuid()); udiProductService.updateUdiInfoByUuid(udiProductEntity); return ResultVOUtils.success("更新成功"); } @AuthRuleAnnotation("") @PostMapping("/udi/udirel/update/di") @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse updateSingel(@RequestBody UdiRelevanceSaveRequest udiRelevanceSaveRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } //更新关联表 UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); udiRelevanceEntity.setId(udiRelevanceSaveRequest.getId()); udiRelevanceEntity.setUpdateTime(new Date()); udiRelevanceEntity.setModifyTime(new Date()); udiRelevanceEntity.setUpdateUser(customerService.getUserId() + ""); udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); //单独更新DI UdiProductEntity diEntity = new UdiProductEntity(); // diEntity.setMeasname(udiRelevanceSaveRequest.getMeasname()); diEntity.setPackUnit(udiRelevanceSaveRequest.getPackUnit()); diEntity.setSptm(udiRelevanceSaveRequest.getSptm()); diEntity.setUuid(udiRelevanceSaveRequest.getUuid()); diEntity.setNameCode(udiRelevanceSaveRequest.getNameCode()); udiProductService.updateUdiInfo(diEntity); return ResultVOUtils.success("更新成功"); } //新增或修改关联 @AuthRuleAnnotation("") @PostMapping("/udi/udirel/check/udi") public BaseResponse checkUdi(@RequestBody UdiCombineRequest udiCombineRequest) { List keys = udiCombineRequest.getKeys(); if (keys != null && keys.size() > 0) { List datas = udiRelevanceService.batchSelectByUuid(keys); if (datas.isEmpty()) { return ResultVOUtils.success("无被选入!"); } else { return ResultVOUtils.error(499, "所选产品DI已经被" + "第三方产品ID" + "绑定,您确定继续对照"); } } return ResultVOUtils.success("未选择产品"); } //选入查询结果的所有DI @AuthRuleAnnotation("") @GetMapping("/udi/udirel/combineAll") public BaseResponse combineAll(FilterUdiRelRequest productInfoFilterRequest) { basicUpdateProductService.relAllUdi(productInfoFilterRequest); return ResultVOUtils.success("后台已开始导入,请稍后刷新查看"); } @Resource InvProductService invProductService; @Resource InvPreProductService invPreProductService; //查询产品是否可以被禁用 todo 库存还未完成 @AuthRuleAnnotation("") @PostMapping("/udi/udirel/disable") public BaseResponse disable(@RequestBody UdiCombineRequest udiCombineRequest) { if (invProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) { return ResultVOUtils.error(500, "库存已存在,无法禁用"); } if (invPreProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) { return ResultVOUtils.error(500, "寄售库存已存在,无法禁用"); } return ResultVOUtils.success("更新成功"); } public UdiProductEntity getUdiInfo(UdiCombineRequest udiCombineRequest) { UdiRelevanceEntity temp = udiRelevanceService.selectById(udiCombineRequest.getRelId()); FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); filterUdiRelRequest.setNameCode(udiCombineRequest.getThirdId()); filterUdiRelRequest.setUuid(temp.getUuid()); List udiInfoEntities = udiProductService.filterUdiInfo(filterUdiRelRequest); if (udiInfoEntities != null && udiInfoEntities.size() > 0) { UdiProductEntity udiProductEntity = udiInfoEntities.get(0); return udiProductEntity; } return null; } //单独选入ERP产品 @AuthRuleAnnotation("") @PostMapping("/udi/udirel/addErp") @Log(title = "单据管理", businessType = BusinessType.INSERT) public BaseResponse addErp(@RequestBody UdiCombineRequest udiCombineRequest) { String errMsg = null; if (!udiCombineRequest.getSupEnable()) { errMsg = basicUpdateProductService.addLocalProduct(udiCombineRequest); } if (StrUtil.isEmpty(errMsg)) return ResultVOUtils.success("添加成功!"); else { return ResultVOUtils.error(500, errMsg); } } //一键选入ERP产品 @AuthRuleAnnotation("") @PostMapping("/udi/udirel/addAllErp") @Log(title = "单据管理", businessType = BusinessType.INSERT) public BaseResponse addAllErp(@RequestBody UdiCombineRequest udiCombineRequest) { if (udiCombineRequest.getIsRlInv() != null && udiCombineRequest.getIsRlInv()) { basicBackUpdateProductService.loadLocal(udiCombineRequest.getQuery(), udiCombineRequest.getThirdSys(), null, true); } else { basicBackUpdateProductService.loadLocal(udiCombineRequest.getQuery(), udiCombineRequest.getThirdSys(), null, null); } return ResultVOUtils.success("后台正在添加,请稍后刷新查看!"); } //获取产品信息详情(多平台) @AuthRuleAnnotation("") @GetMapping("/udiwms/udirel/thirdSys/filter") public BaseResponse getThirdSysfilter(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest(); filterBasicThirdSysRequest.setEnabled(true); List basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest); List filterSysEntityList = new ArrayList<>(); filterSysEntityList.add(new FilterSysEntity(0, "全部")); filterSysEntityList.add(new FilterSysEntity(1, "对照完成")); filterSysEntityList.add(new FilterSysEntity(2, "未对照DI")); if (basicThirdSysEntities != null && basicThirdSysEntities.size() > 0) { for (int i = 0; i < basicThirdSysEntities.size(); i++) { filterSysEntityList.add(new FilterSysEntity(i + 3, "未对照" + basicThirdSysEntities.get(i).getThirdName())); } } filterSysEntityList.add(new FilterSysEntity(10, "最新同步")); PageInfo pageInfo; pageInfo = new PageInfo<>(filterSysEntityList); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(filterSysEntityList); return ResultVOUtils.success(pageSimpleResponse); } //获取对照过滤列表 @AuthRuleAnnotation("") @GetMapping("/udiwms/udirel/thirdSys/detail") public BaseResponse getThirdSysDetail(FilterUdiRelRequest filterUdiRelRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } UdiRelevanceEntity udiRelevanceEntity = null; if (filterUdiRelRequest.getUuid() != null) { udiRelevanceEntity = udiRelevanceService.selectUpdateByUuid(filterUdiRelRequest.getUuid()); } else { udiRelevanceEntity = udiRelevanceService.selectById(filterUdiRelRequest.getId()); } FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest(); filterBasicThirdSysRequest.setEnabled(true); List basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest); List basicProductThirdSysResponses = new ArrayList<>(); if (basicThirdSysEntities != null && basicThirdSysEntities.size() > 0) { for (ThrSystemEntity thrSystemEntity : basicThirdSysEntities) { if (thrSystemEntity.getThirdId().equals("thirdId")) { BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse(); if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId())) basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId()); basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName()); basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId()); if (udiRelevanceEntity.getThirdId() != null && !udiRelevanceEntity.getThirdId().isEmpty()) { if (udiRelevanceEntity.getThirdId() != null) { ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId(), "thirdId"); if (thrProductsEntity != null) { basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory()); basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo()); basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec()); basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName()); } } } basicProductThirdSysResponses.add(basicProductThirdSysResponse); } if (thrSystemEntity.getThirdId().equals("thirdId1")) { BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse(); if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId1())) basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId1()); basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName()); basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId()); if (udiRelevanceEntity.getThirdId1() != null && !udiRelevanceEntity.getThirdId1().isEmpty()) { ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId1(), "thirdId1"); if (thrProductsEntity != null) { basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory()); basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo()); basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec()); basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName()); } } basicProductThirdSysResponses.add(basicProductThirdSysResponse); } if (thrSystemEntity.getThirdId().equals("thirdId2")) { BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse(); if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId2())) basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId2()); basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName()); basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId()); if (udiRelevanceEntity.getThirdId2() != null && !udiRelevanceEntity.getThirdId2().isEmpty()) { ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId2(), "thirdId2"); if (thrProductsEntity != null) { basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory()); basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo()); basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec()); basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName()); } } basicProductThirdSysResponses.add(basicProductThirdSysResponse); } if (thrSystemEntity.getThirdId().equals("thirdId3")) { BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse(); if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId3())) basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId3()); basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName()); basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId()); if (udiRelevanceEntity.getThirdId3() != null && !udiRelevanceEntity.getThirdId3().isEmpty()) { ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId3(), "thirdId3"); if (thrProductsEntity != null) { basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory()); basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo()); basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec()); basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName()); } } basicProductThirdSysResponses.add(basicProductThirdSysResponse); } if (thrSystemEntity.getThirdId().equals("thirdId4")) { BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse(); if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId4())) basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId4()); basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName()); basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId()); if (udiRelevanceEntity.getThirdId4() != null && !udiRelevanceEntity.getThirdId4().isEmpty()) { ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId4(), "thirdId4"); if (thrProductsEntity != null) { basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory()); basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo()); basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec()); basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName()); } } basicProductThirdSysResponses.add(basicProductThirdSysResponse); } } } PageInfo pageInfo; pageInfo = new PageInfo<>(basicProductThirdSysResponses); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); pageSimpleResponse.setList(basicProductThirdSysResponses); return ResultVOUtils.success(pageSimpleResponse); } //获取是否启用供应商维护产品信息 @AuthRuleAnnotation("") @GetMapping("/udiwms/udiinfo/spcombie") public BaseResponse getSBCombie() { SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("sp_combie_products"); return ResultVOUtils.success(systemParamConfigEntity); } @AuthRuleAnnotation("") @PostMapping("/udiwms/udirl/lock/status") @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse uploadThirdServcie(@RequestBody LockUdiRequest lockUdiRequest) { if (lockUdiRequest.getLockStatus() != null && lockUdiRequest.getIds().size() > 0) { for (Long id : lockUdiRequest.getIds()) { UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); udiRelevanceEntity.setId(id); udiRelevanceEntity.setLockStatus(lockUdiRequest.getLockStatus()); udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); } return ResultVOUtils.success("更新成功!"); } else { return ResultVOUtils.error(500, "参数错误!!"); } } @AuthRuleAnnotation("") @PostMapping("/udi/udirel/updateById") @Log(title = "单据管理", businessType = BusinessType.UPDATE) public BaseResponse updateById(@RequestBody UdiProductEntity udiProductEntity, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } boolean falg = udiProductService.updateUdiInfoById(udiProductEntity); UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity(); udiRelevanceEntity.setId(udiProductEntity.getUid()); udiRelevanceEntity.setGroupBuy(udiProductEntity.isGroupBuy()); boolean b = udiRelevanceService.updateUdiRelevance(udiRelevanceEntity); if (udiProductEntity.getRelSupId() != null) { UdiRlSupEntity udiRlSupEntity = new UdiRlSupEntity(); udiRlSupEntity.setUpdateTime(new Date()); udiRlSupEntity.setPrice(new BigDecimal(udiProductEntity.getPrice())); udiRlSupEntity.setId(udiProductEntity.getRelSupId()); udiRlSupService.updateCompanyProductRelevance(udiRlSupEntity); } if (falg) { return ResultVOUtils.success("更新成功"); } else { return ResultVOUtils.error(999, "更新失败"); } } //业务单据选入耗材字典查询列表 /** * 查询产品规格型号列表 * * @param relId * @return */ @GetMapping("/udiwms/udiinfo/getGgxhList") public BaseResponse getGgxhList(String relId) { if (StrUtil.isBlank(relId)) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } List ggxhList = udiProductService.getGgxhList(relId); return ResultVOUtils.success(ggxhList); } //国家库uuid获取产品 @PostMapping("/udi/udirel/selectOriginuuid") @Log(title = "单据管理", businessType = BusinessType.INSERT) public BaseResponse selectOriginuuid(@RequestBody ProductInfoFilterRequest productInfoFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } List udiProductEntities = productInfoService.findAll(productInfoFilterRequest); return ResultVOUtils.success(udiProductEntities); } }