|
|
|
@ -3,16 +3,19 @@ package com.glxp.sale.admin.thread;
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.io.file.FileWriter;
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.glxp.sale.admin.constant.BasicProcessStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.sale.admin.constant.UdiInfoImportStatus;
|
|
|
|
|
import com.glxp.sale.admin.dao.basic.UdiInfoDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.basic.UdiRelevanceDao;
|
|
|
|
|
import com.glxp.sale.admin.dao.thrsys.ThrProductsDao;
|
|
|
|
|
import com.glxp.sale.admin.entity.basic.*;
|
|
|
|
|
import com.glxp.sale.admin.entity.info.CompanyProductRelevanceEntity;
|
|
|
|
|
import com.glxp.sale.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
|
import com.glxp.sale.admin.req.basic.*;
|
|
|
|
|
import com.glxp.sale.admin.req.info.FilterCompanyProductRelevanceRequest;
|
|
|
|
|
import com.glxp.sale.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.UdiExportJsonResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.UdiRelevanceExportJsonResponse;
|
|
|
|
|
import com.glxp.sale.admin.res.basic.UdiRelevanceResponse;
|
|
|
|
@ -21,13 +24,13 @@ import com.glxp.sale.admin.service.info.CompanyProductRelevanceService;
|
|
|
|
|
import com.glxp.sale.admin.util.ExcelUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
@ -52,6 +55,8 @@ public class BasicGenExcelService {
|
|
|
|
|
UdiInfoDao udiInfoDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private CompanyProductRelevanceService companyProductRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
ThrProductsDao thrProductsDao;
|
|
|
|
|
|
|
|
|
|
//往来单位
|
|
|
|
|
@Async
|
|
|
|
@ -364,6 +369,29 @@ public class BasicGenExcelService {
|
|
|
|
|
});
|
|
|
|
|
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);
|
|
|
|
|
udiRelevanceEntities.forEach(udiRelevanceEntity -> {
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
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 (CollUtil.isNotEmpty(thrProductsEntities)) {
|
|
|
|
|
exportData.setThrProductsEntities(thrProductsEntities);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<UdiInfoEntity> udiInfo = exportData.getUdiInfoEntities();
|
|
|
|
|
List<UdiRelevanceEntity> udiRelevance = exportData.getUdiRelevanceEntities();
|
|
|
|
|
udiInfo.addAll(udiInfoEntities);
|
|
|
|
|