|
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.io.file.FileWriter;
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
|
|
|
|
@ -36,10 +37,7 @@ import javax.annotation.Resource;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
@ -64,8 +62,11 @@ public class BasicGenExcelService {
|
|
|
|
|
ThrProductsDao thrProductsDao;
|
|
|
|
|
@Resource
|
|
|
|
|
ThrCorpDao thrCorpDao;
|
|
|
|
|
@Resource
|
|
|
|
|
BasicExportService basicExportService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//往来单位
|
|
|
|
|
//往来单位导出json文件
|
|
|
|
|
@Async
|
|
|
|
|
public void exportCorp(String genKey, CorpsExportRequest corpsExportRequest) {
|
|
|
|
|
CorpExportLogEntity corpExportLogEntity = corpExportLogService.selectByGenKey(genKey);
|
|
|
|
@ -97,6 +98,49 @@ public class BasicGenExcelService {
|
|
|
|
|
corpExportLogService.updateCorpExportLog(corpExportLogEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//往来单位导出到日志状态表等待下载
|
|
|
|
|
@Async
|
|
|
|
|
public void exportCorpStatusLog(String genKey, CorpsExportRequest corpsExportRequest) {
|
|
|
|
|
CorpExportLogEntity corpExportLogEntity = corpExportLogService.selectByGenKey(genKey);
|
|
|
|
|
List<String> results = new ArrayList<>();
|
|
|
|
|
if (corpsExportRequest.getIds() != null && corpsExportRequest.getIds().size() > 0) {
|
|
|
|
|
List<Integer> ids = corpsExportRequest.getIds();
|
|
|
|
|
ids.forEach(id -> {
|
|
|
|
|
results.add(id + "");
|
|
|
|
|
});
|
|
|
|
|
} else { //一键导出
|
|
|
|
|
BasicUnitMaintainFilterRequest filterRequest = new BasicUnitMaintainFilterRequest();
|
|
|
|
|
BeanUtils.copyProperties(corpsExportRequest, filterRequest);
|
|
|
|
|
filterRequest.setPage(null);
|
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(filterRequest);
|
|
|
|
|
basicUnitMaintainEntities.forEach(
|
|
|
|
|
item -> {
|
|
|
|
|
results.add(item.getId() + "");
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.BASIC_CORP);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setIdDatas(JSON.toJSON(results).toString());
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
corpExportLogService.updateCorpExportLog(corpExportLogEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//往来单位下载返回json数据
|
|
|
|
|
public BasicUnitMaintainExportResponse genCorpJsonData(CorpsExportRequest corpsExportRequest) {
|
|
|
|
|
BasicUnitMaintainExportResponse exportData = new BasicUnitMaintainExportResponse();
|
|
|
|
|
List<BasicUnitMaintainEntity> unitMaintainEntities = new ArrayList<>();
|
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.batchSelectByIds(corpsExportRequest.getIds());
|
|
|
|
|
unitMaintainEntities.addAll(basicUnitMaintainEntities);
|
|
|
|
|
getThrCorpList(exportData, basicUnitMaintainEntities);
|
|
|
|
|
exportData.setCorpList(unitMaintainEntities);
|
|
|
|
|
return exportData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询第三方往来单位信息
|
|
|
|
|
*
|
|
|
|
@ -123,6 +167,72 @@ public class BasicGenExcelService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Map<String, List<String>> codesMap = new HashMap<>();
|
|
|
|
|
basicUnitMaintainEntities.forEach(basicUnitMaintainEntity -> {
|
|
|
|
|
for (Field field : fields) { //过滤分类,不止thirdId,其他系统也要
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(basicUnitMaintainEntity, field);
|
|
|
|
|
if (field.getName().contains("thirdId")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId") != null) {
|
|
|
|
|
codesMap.get("thirdId").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId1")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId1") != null) {
|
|
|
|
|
codesMap.get("thirdId1").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId1", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId2")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId2") != null) {
|
|
|
|
|
codesMap.get("thirdId2").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId2", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId3")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId3") != null) {
|
|
|
|
|
codesMap.get("thirdId3").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId3", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId4")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId4") != null) {
|
|
|
|
|
codesMap.get("thirdId4").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId4", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : codesMap.entrySet()) {
|
|
|
|
|
System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue());
|
|
|
|
|
FilterThrCorpRequest filter = new FilterThrCorpRequest();
|
|
|
|
|
filter.setCodes(entry.getValue());
|
|
|
|
|
filter.setThirdSysFk(entry.getKey());
|
|
|
|
|
List<ThrCorpEntity> result = thrCorpDao.batchSelectByIds(filter);
|
|
|
|
|
thrCorpEntities.addAll(result);
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(thrCorpEntities)) {
|
|
|
|
|
exportData.setThrCorpEntities(thrCorpEntities);
|
|
|
|
|
}
|
|
|
|
@ -257,6 +367,8 @@ public class BasicGenExcelService {
|
|
|
|
|
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//耗材字典导出json文件
|
|
|
|
|
@Async
|
|
|
|
|
public void exportJsonUdiInfo(String genKey, UdiInfoExportRequest udiInfoExportRequest) {
|
|
|
|
|
UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey);
|
|
|
|
@ -301,6 +413,62 @@ public class BasicGenExcelService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//耗材字典导出到日志状态表等待下载
|
|
|
|
|
@Async
|
|
|
|
|
public void exportStatusLog(String genKey, UdiInfoExportRequest udiInfoExportRequest) {
|
|
|
|
|
UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey);
|
|
|
|
|
UdiRelevanceExportJsonResponse exportData = new UdiRelevanceExportJsonResponse();
|
|
|
|
|
//选中导出
|
|
|
|
|
List<String> results = new ArrayList<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(udiInfoExportRequest.getUuids())) {
|
|
|
|
|
List<String> uuids = udiInfoExportRequest.getUuids();
|
|
|
|
|
|
|
|
|
|
uuids.forEach(uuid -> {
|
|
|
|
|
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
|
|
|
|
filterUdiInfoRequest.setUuid(uuid);
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
|
udiRelevanceResponses.forEach(
|
|
|
|
|
item -> {
|
|
|
|
|
results.add(item.getId() + "");
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
//一键导出
|
|
|
|
|
FilterUdiInfoRequest filterUdiInfoRequest = new FilterUdiInfoRequest();
|
|
|
|
|
BeanUtil.copyProperties(udiInfoExportRequest, filterUdiInfoRequest);
|
|
|
|
|
filterUdiInfoRequest.setPage(null);
|
|
|
|
|
List<UdiRelevanceResponse> data = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
|
data.forEach(
|
|
|
|
|
item -> {
|
|
|
|
|
results.add(item.getId() + "");
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
BasicExportStatusEntity basicExportStatusEntity = new BasicExportStatusEntity();
|
|
|
|
|
basicExportStatusEntity.setStatus(0);
|
|
|
|
|
basicExportStatusEntity.setType(BasicProcessStatus.BASIC_UDI);
|
|
|
|
|
basicExportStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
basicExportStatusEntity.setIdDatas(JSON.toJSON(results).toString());
|
|
|
|
|
basicExportService.insertExportStatus(basicExportStatusEntity);
|
|
|
|
|
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
|
udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//耗材字典下载返回json数据
|
|
|
|
|
public UdiRelevanceExportJsonResponse genJsonData(FilterUdiInfoRequest filterUdiInfoRequest) {
|
|
|
|
|
|
|
|
|
|
UdiRelevanceExportJsonResponse udiExportJsonResponse = new UdiRelevanceExportJsonResponse();
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevanceResponses = udiRelevanceService.batchSelectByIds(filterUdiInfoRequest.getRelIds());
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceResponses)) {
|
|
|
|
|
parseUdiRelevanceEntitys(udiExportJsonResponse, udiRelevanceResponses);
|
|
|
|
|
}
|
|
|
|
|
List<CompanyProductRelevanceEntity> companyProductRelevanceEntities = companyProductRelevanceService.filterCompanyProductRelevance(new FilterCompanyProductRelevanceRequest());
|
|
|
|
|
udiExportJsonResponse.setCompanyProductRelevanceEntities(companyProductRelevanceEntities);
|
|
|
|
|
return udiExportJsonResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
public void uploadProductsSmp(String genKey, UdiInfoExportRequest udiInfoExportRequest) {
|
|
|
|
|
UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey);
|
|
|
|
@ -354,26 +522,6 @@ public class BasicGenExcelService {
|
|
|
|
|
return excelData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UdiExportJsonResponse genJsonData(FilterUdiInfoRequest filterUdiInfoRequest) {
|
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevanceEntities = new ArrayList<>();
|
|
|
|
|
Map<String, String> filterUuid = new HashMap<>();
|
|
|
|
|
for (UdiRelevanceResponse udiRelevanceResponse : udiRelevanceResponses) {
|
|
|
|
|
UdiRelevanceEntity udiRelevanceEntity = new UdiRelevanceEntity();
|
|
|
|
|
BeanUtils.copyProperties(udiRelevanceResponse, udiRelevanceEntity);
|
|
|
|
|
udiRelevanceEntities.add(udiRelevanceEntity);
|
|
|
|
|
filterUuid.put(udiRelevanceEntity.getUuid(), udiRelevanceEntity.getUuid());
|
|
|
|
|
}
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities = new ArrayList<>();
|
|
|
|
|
filterUuid.forEach((key, value) -> {
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities1 = udiInfoService.findByUuids(key);
|
|
|
|
|
udiInfoEntities.addAll(udiInfoEntities1);
|
|
|
|
|
});
|
|
|
|
|
UdiExportJsonResponse udiExportJsonResponse = new UdiExportJsonResponse();
|
|
|
|
|
udiExportJsonResponse.setUdiInfoEntities(udiInfoEntities);
|
|
|
|
|
udiExportJsonResponse.setUdiRelevanceEntities(udiRelevanceEntities);
|
|
|
|
|
return udiExportJsonResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<UdiInfoImportDetailEntity> genSmpData(FilterUdiInfoRequest filterUdiInfoRequest) {
|
|
|
|
|
List<UdiInfoImportDetailEntity> udiInfoImportDetailEntities = new ArrayList<>();
|
|
|
|
@ -415,22 +563,164 @@ public class BasicGenExcelService {
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
|
|
|
|
|
List<ThrProductsEntity> thrProductsEntities = new ArrayList<>(udiRelevanceEntities.size());
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(UdiRelevanceEntity.class);
|
|
|
|
|
|
|
|
|
|
Map<String, List<String>> codesMap = new HashMap<>();
|
|
|
|
|
udiRelevanceEntities.forEach(udiRelevanceEntity -> {
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
for (Field field : fields) { //过滤分类,不止thirdId,其他系统也要
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(udiRelevanceEntity, field);
|
|
|
|
|
if (field.getName().contains("thirdId")) {
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(udiRelevanceEntity, field);
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
FilterThrProductsRequest filter = new FilterThrProductsRequest();
|
|
|
|
|
filter.setCode(String.valueOf(fieldValue));
|
|
|
|
|
filter.setThirdSysFk("thirdId");
|
|
|
|
|
List<ThrProductsEntity> result = thrProductsDao.filterThrProductsRequest(filter);
|
|
|
|
|
if (CollUtil.isNotEmpty(result)) {
|
|
|
|
|
thrProductsEntities.addAll(result);
|
|
|
|
|
if (codesMap.get("thirdId") != null) {
|
|
|
|
|
codesMap.get("thirdId").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId1")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId1") != null) {
|
|
|
|
|
codesMap.get("thirdId1").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId1", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId2")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId2") != null) {
|
|
|
|
|
codesMap.get("thirdId2").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId2", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId3")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId3") != null) {
|
|
|
|
|
codesMap.get("thirdId3").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId3", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId4")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId4") != null) {
|
|
|
|
|
codesMap.get("thirdId4").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId4", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : codesMap.entrySet()) {
|
|
|
|
|
System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue());
|
|
|
|
|
FilterThrProductsRequest filter = new FilterThrProductsRequest();
|
|
|
|
|
filter.setCodes(entry.getValue());
|
|
|
|
|
filter.setThirdSysFk(entry.getKey());
|
|
|
|
|
List<ThrProductsEntity> result = thrProductsDao.batchSelectByIds(filter);
|
|
|
|
|
thrProductsEntities.addAll(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(thrProductsEntities)) {
|
|
|
|
|
exportData.setThrProductsEntities(thrProductsEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<UdiInfoEntity> udiInfo = exportData.getUdiInfoEntities();
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevance = exportData.getUdiRelevanceEntities();
|
|
|
|
|
udiInfo.addAll(udiInfoEntities);
|
|
|
|
|
udiRelevance.addAll(udiRelevanceEntities);
|
|
|
|
|
exportData.setUdiInfoEntities(udiInfo);
|
|
|
|
|
exportData.setUdiRelevanceEntities(udiRelevance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void parseUdiRelevanceEntitys(UdiRelevanceExportJsonResponse exportData, List<UdiRelevanceEntity> udiRelevanceResponses) {
|
|
|
|
|
List<String> uuids = new ArrayList<>(udiRelevanceResponses.size());
|
|
|
|
|
udiRelevanceResponses.forEach(udi -> {
|
|
|
|
|
uuids.add(udi.getUuid());
|
|
|
|
|
});
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities = udiInfoDao.batchSelectByUuid(uuids);
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceDao.batchSelectByUuid(uuids);
|
|
|
|
|
if (CollUtil.isNotEmpty(udiRelevanceEntities)) {
|
|
|
|
|
List<ThrProductsEntity> thrProductsEntities = new ArrayList<>(udiRelevanceEntities.size());
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(UdiRelevanceEntity.class);
|
|
|
|
|
|
|
|
|
|
Map<String, List<String>> codesMap = new HashMap<>();
|
|
|
|
|
udiRelevanceEntities.forEach(udiRelevanceEntity -> {
|
|
|
|
|
for (Field field : fields) { //过滤分类,不止thirdId,其他系统也要
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(udiRelevanceEntity, field);
|
|
|
|
|
if (field.getName().contains("thirdId")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId") != null) {
|
|
|
|
|
codesMap.get("thirdId").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId1")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId1") != null) {
|
|
|
|
|
codesMap.get("thirdId1").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId1", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId2")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId2") != null) {
|
|
|
|
|
codesMap.get("thirdId2").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId2", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId3")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId3") != null) {
|
|
|
|
|
codesMap.get("thirdId3").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId3", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (field.getName().contains("thirdId4")) {
|
|
|
|
|
if (null != fieldValue) {
|
|
|
|
|
if (codesMap.get("thirdId4") != null) {
|
|
|
|
|
codesMap.get("thirdId4").add(String.valueOf(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
List<String> temps = new ArrayList<>();
|
|
|
|
|
temps.add(String.valueOf(fieldValue));
|
|
|
|
|
codesMap.put("thirdId4", temps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<String>> entry : codesMap.entrySet()) {
|
|
|
|
|
System.out.println("key = " + entry.getKey() + ", value = " + entry.getValue());
|
|
|
|
|
FilterThrProductsRequest filter = new FilterThrProductsRequest();
|
|
|
|
|
filter.setCodes(entry.getValue());
|
|
|
|
|
filter.setThirdSysFk(entry.getKey());
|
|
|
|
|
List<ThrProductsEntity> result = thrProductsDao.batchSelectByIds(filter);
|
|
|
|
|
thrProductsEntities.addAll(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(thrProductsEntities)) {
|
|
|
|
|
exportData.setThrProductsEntities(thrProductsEntities);
|
|
|
|
|
}
|
|
|
|
|