|
|
|
@ -2,12 +2,15 @@ package com.glxp.api.controller.basic;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import com.glxp.api.dao.auth.WarehouseUserDao;
|
|
|
|
|
import com.glxp.api.dao.basic.UdiRelevanceDao;
|
|
|
|
|
import com.glxp.api.dto.DictDto;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.thrsys.CodeRel;
|
|
|
|
|
import com.glxp.api.entity.thrsys.YbDrug;
|
|
|
|
|
import com.glxp.api.http.ErpBasicClient;
|
|
|
|
|
import com.glxp.api.http.sync.SpsDirectClient;
|
|
|
|
|
import com.glxp.api.req.auth.FilterInvLinkDataRequest;
|
|
|
|
|
import com.glxp.api.res.chs.YbHcflEntityResponse;
|
|
|
|
|
import com.glxp.api.service.inout.impl.IoCodeService;
|
|
|
|
|
import com.glxp.api.service.inv.impl.InvProductService;
|
|
|
|
@ -54,10 +57,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@ -90,6 +90,8 @@ public class UdiRelevanceController extends BaseController {
|
|
|
|
|
YbDrugService ybDrugService;
|
|
|
|
|
@Resource
|
|
|
|
|
SpsDirectClient spsDirectClient;
|
|
|
|
|
@Resource
|
|
|
|
|
WarehouseUserDao warehouseUserDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//手持终端下载UDI产品信息
|
|
|
|
@ -653,112 +655,135 @@ public class UdiRelevanceController extends BaseController {
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
FilterBasicThirdSysRequest filterBasicThirdSysRequest = new FilterBasicThirdSysRequest();
|
|
|
|
|
filterBasicThirdSysRequest.setEnabled(true);
|
|
|
|
|
String customerId = getCustomerId();
|
|
|
|
|
if (!"110".equals(customerId)){
|
|
|
|
|
FilterInvLinkDataRequest filterInvLinkDataRequest = new FilterInvLinkDataRequest();
|
|
|
|
|
filterInvLinkDataRequest.setCustomerId(customerId);
|
|
|
|
|
List<InvWarehouseEntity> invWarehouseEntities = warehouseUserDao.authWarehouseListByCustomerId(filterInvLinkDataRequest);
|
|
|
|
|
if (CollUtil.isNotEmpty(invWarehouseEntities)){
|
|
|
|
|
|
|
|
|
|
List<String> thirdIds = invWarehouseEntities.stream()
|
|
|
|
|
.map(InvWarehouseEntity::getThirdId) // 提取 thirdId
|
|
|
|
|
.filter(Objects::nonNull) // 排除 null 值
|
|
|
|
|
.filter(s -> !s.isEmpty()) // 排除空字符串
|
|
|
|
|
.distinct() // 去重
|
|
|
|
|
.collect(Collectors.toList()); // 收集到 List
|
|
|
|
|
|
|
|
|
|
filterBasicThirdSysRequest.setThirdIds(thirdIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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());
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String thirdId = thrSystemEntity.getThirdId();
|
|
|
|
|
String correspondingId = null;
|
|
|
|
|
switch (thirdId) {
|
|
|
|
|
case "thirdId":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId1":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId1();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId3":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId3();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId4":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId4();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId5":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId5();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId6":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId6();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId7":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId7();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId8":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId8();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId9":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId9();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId10":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId10();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId11":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId11();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId12":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId12();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId13":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId13();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId14":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId14();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId15":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId15();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId16":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId16();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId17":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId17();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId18":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId18();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId19":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId19();
|
|
|
|
|
break;
|
|
|
|
|
case "thirdId20":
|
|
|
|
|
correspondingId = udiRelevanceEntity.getThirdId20();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
// 处理未知的 thirdId
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (correspondingId != null) {
|
|
|
|
|
BasicProductThirdSysResponse response = handleThirdId(thirdId, correspondingId, thrSystemEntity);
|
|
|
|
|
if (response != null) {
|
|
|
|
|
basicProductThirdSysResponses.add(response);
|
|
|
|
|
}
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
PageInfo<BasicProductThirdSysResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(basicProductThirdSysResponses);
|
|
|
|
|
PageSimpleResponse<BasicProductThirdSysResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(basicProductThirdSysResponses);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
|
|
|
|
|
}
|
|
|
|
|
if (thrSystemEntity.getThirdId().equals("thirdId4")) {
|
|
|
|
|
// 假设 handleThirdId 方法返回 null 或一个有效的 BasicProductThirdSysResponse 对象
|
|
|
|
|
private BasicProductThirdSysResponse handleThirdId(String thirdId, String value, ThrSystemEntity thrSystemEntity) {
|
|
|
|
|
BasicProductThirdSysResponse basicProductThirdSysResponse = new BasicProductThirdSysResponse();
|
|
|
|
|
if (StrUtil.isNotEmpty(udiRelevanceEntity.getThirdId4()))
|
|
|
|
|
basicProductThirdSysResponse.setThirdId(udiRelevanceEntity.getThirdId4());
|
|
|
|
|
if (StrUtil.isNotEmpty(value)) {
|
|
|
|
|
if (StrUtil.isNotEmpty(value))
|
|
|
|
|
basicProductThirdSysResponse.setThirdId(value);
|
|
|
|
|
basicProductThirdSysResponse.setSysName(thrSystemEntity.getThirdName());
|
|
|
|
|
basicProductThirdSysResponse.setSysId(thrSystemEntity.getThirdId());
|
|
|
|
|
if (udiRelevanceEntity.getThirdId4() != null && !udiRelevanceEntity.getThirdId4().isEmpty()) {
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(udiRelevanceEntity.getThirdId4(), "thirdId4");
|
|
|
|
|
if (value != null && !value.isEmpty()) {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
ThrProductsEntity thrProductsEntity = thrDataService.getProducts(value, thirdId);
|
|
|
|
|
if (thrProductsEntity != null) {
|
|
|
|
|
basicProductThirdSysResponse.setManufactory(thrProductsEntity.getManufactory());
|
|
|
|
|
basicProductThirdSysResponse.setRegisterNo(thrProductsEntity.getRegisterNo());
|
|
|
|
|
basicProductThirdSysResponse.setSpec(thrProductsEntity.getSpec());
|
|
|
|
|
basicProductThirdSysResponse.setThirdName(thrProductsEntity.getName());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
basicProductThirdSysResponses.add(basicProductThirdSysResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 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("")
|
|
|
|
|