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/UdiRelevanceController.java

679 lines
34 KiB
Java

2 years ago
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.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.entity.basic.*;
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.UdiCombineRequest;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.basic.LockUdiRequest;
import com.glxp.api.req.basic.UdiRelevanceSaveRequest;
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.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;
2 years ago
import com.glxp.api.util.udi.UdiInfoUtil;
2 years ago
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.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@RestController
public class UdiRelevanceController {
@Resource
GennerOrderUtils gennerOrderUtils;
@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;
//手持终端下载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<UdiRelevanceResponse> udiRelevanceResponses = null;
udiRelevanceResponses = udiRelevanceService.filterUdiRelevance(filterUdiRelRequest);
PageInfo<UdiRelevanceResponse> pageInfo;
pageInfo = new PageInfo<>(udiRelevanceResponses);
PageSimpleResponse<UdiRelevanceResponse> 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<UdiRelevanceResponse> udiRelevanceResponses = null;
if (StrUtil.isNotEmpty(filterUdiRelRequest.getBindRlIds())) {
String[] datas = filterUdiRelRequest.getBindRlIds().split(",");
List<String> list = Arrays.asList(datas);
filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setRelIds(list);
}
udiRelevanceResponses = udiRelevanceService.filterUdiJoinSup(filterUdiRelRequest);
PageInfo<UdiRelevanceResponse> pageInfo;
pageInfo = new PageInfo<>(udiRelevanceResponses);
PageSimpleResponse<UdiRelevanceResponse> 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())) {
2 years ago
if (StrUtil.isNotEmpty(filterUdiRelRequest.getUdiCode())) {
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterUdiRelRequest.getUdiCode());
filterUdiRelRequest.setNameCode(udiEntity.getUdi());
}
List<UdiRelevanceResponse> temps = udiRelevanceService.filterUdiGp(filterUdiRelRequest);
if (temps != null && temps.size() > 0) {
filterUdiRelRequest.setUuid(temps.get(0).getUuid());
filterUdiRelRequest.setNameCode(null);
}
} else {
filterUdiRelRequest.setDiType(1);
}
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.filterUdiGp(filterUdiRelRequest);
PageInfo<UdiRelevanceResponse> pageInfo = new PageInfo<>(udiRelevanceResponses);
PageSimpleResponse<UdiRelevanceResponse> 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<UdiRelevanceResponse> udiRelevanceResponses = null;
if (StrUtil.isNotEmpty(filterUdiRelRequest.getUnionCode())) {
filterUdiRelRequest.setNameCode(filterUdiRelRequest.getUnionCode());
List<UdiRelevanceResponse> temps = udiRelevanceService.filterUdiGp(filterUdiRelRequest);
if (temps != null && temps.size() > 0) {
filterUdiRelRequest.setUuid(temps.get(0).getUuid());
filterUdiRelRequest.setNameCode(null);
}
} else {
filterUdiRelRequest.setDiType(1);
}
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<UdiRelevanceResponse> pageInfo;
pageInfo = new PageInfo<>(udiRelevanceResponses);
PageSimpleResponse<UdiRelevanceResponse> 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<UdiProductEntity> udiInfoEntities = udiProductService.filterAllUdiInfo(tempRequest);
List<UdiRelevanceResponse> 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")
public BaseResponse deleteAll(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<String> ids = deleteRequest.getIds();
udiRelevanceService.deleteByIds(ids);
return ResultVOUtils.success("删除成功");
}
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/deleteById")
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));
//todo 单据未完成
// if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) {
// List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
// if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) {
// for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
// List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiRelevanceEntity1.getUuid());
// if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
// for (int i = 0; i < udiInfoEntities.size(); i++) {
// List<WarehouseEntity> warehouseEntityList = warehouseService.searchCode(udiInfoEntities.get(i).getNameCode());
// if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
// return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
// }
// }
// }
// }
// WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
// warehouseQueryRequest.setRelId(ids);
// if (StrUtil.isNotEmpty(ids)) {
// List<WarehouseEntity> warehouseEntityList = warehouseService.findByOrderId(warehouseQueryRequest);
// if (CollUtil.isNotEmpty(warehouseEntityList)) {
// return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
// }
// }
// }
// }
//
// CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(ids, null);
// if (companyProductRelevanceEntity != null) {
// return ResultVOUtils.error(500, "该产品已被已被供应商选入" + "不能删除!");
// }
//
udiRelevanceService.deleteById(ids);
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
if (udiRelevanceEntities == null || udiRelevanceEntities.isEmpty()) {
udiProductService.deleteByUuid(udiRelevanceEntity.getUuid());
}
//todo
// companyProductRelevanceService.deleteByRlId(ids);//删除供应商关联表产品信息
return ResultVOUtils.success("删除成功");
}
@Resource
CustomerService customerService;
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/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);
}
}
2 years ago
//更新关联表
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());
2 years ago
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);
2 years ago
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")
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<String> keys = udiCombineRequest.getKeys();
if (keys != null && keys.size() > 0) {
List<UdiRelevanceEntity> 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("后台已开始导入,请稍后刷新查看");
}
//查询产品是否可以被禁用 todo 库存还未完成
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/disable")
public BaseResponse disable(@RequestBody UdiCombineRequest udiCombineRequest) {
// InvProductEntity invProductEntity = invProductService.selectExit(combineRequest.getRelId());
// if (invProductEntity != null) {
// return ResultVOUtils.error(500, "库存已存在,无法禁用");
// }
//
// InvProductEntity invPreProductEntity = invPreProductService.selectExit(combineRequest.getRelId());
// if (invPreProductEntity != null) {
// 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<UdiProductEntity> 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")
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")
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<ThrSystemEntity> basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest);
List<FilterSysEntity> 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<FilterSysEntity> pageInfo;
pageInfo = new PageInfo<>(filterSysEntityList);
PageSimpleResponse<FilterSysEntity> 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<ThrSystemEntity> basicThirdSysEntities = thrSystemService.filterBasicThiSys(filterBasicThirdSysRequest);
List<BasicProductThirdSysResponse> 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());
2 years ago
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());
2 years ago
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());
2 years ago
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());
2 years ago
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());
2 years ago
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<BasicProductThirdSysResponse> pageInfo;
pageInfo = new PageInfo<>(basicProductThirdSysResponses);
PageSimpleResponse<BasicProductThirdSysResponse> 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")
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, "参数错误!!");
}
}
2 years ago
@AuthRuleAnnotation("")
@PostMapping("/udi/udirel/updateById")
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);
if (falg) {
2 years ago
return ResultVOUtils.success("更新成功");
} else {
return ResultVOUtils.error(999, "更新失败");
2 years ago
}
}
2 years ago
//业务单据选入耗材字典查询列表
/**
*
*
* @param relId
* @return
*/
@GetMapping("/udiwms/udiinfo/getGgxhList")
public BaseResponse getGgxhList(String relId) {
if (StrUtil.isBlank(relId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
List<String> ggxhList = udiProductService.getGgxhList(relId);
return ResultVOUtils.success(ggxhList);
}
}