|
|
@ -4,18 +4,23 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.io.file.FileWriter;
|
|
|
|
import cn.hutool.core.io.file.FileWriter;
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import com.glxp.api.admin.constant.BasicProcessStatus;
|
|
|
|
import com.glxp.api.admin.constant.BasicProcessStatus;
|
|
|
|
import com.glxp.api.admin.dao.basic.UdiInfoDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.UdiInfoDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
|
|
|
|
import com.glxp.api.admin.dao.basic.UdiRelevanceDao;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.dao.thrsys.ThrCorpDao;
|
|
|
|
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
|
|
|
|
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
|
|
|
|
import com.glxp.api.admin.entity.basic.*;
|
|
|
|
import com.glxp.api.admin.entity.basic.*;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
|
|
|
|
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.BasicUnitMaintainFilterRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.CorpsExportRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.CorpsExportRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.UdiInfoExportRequest;
|
|
|
|
import com.glxp.api.admin.req.basic.UdiInfoExportRequest;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.req.thrsys.FilterThrCorpRequest;
|
|
|
|
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
import com.glxp.api.admin.req.thrsys.FilterThrProductsRequest;
|
|
|
|
|
|
|
|
import com.glxp.api.admin.res.basic.BasicUnitMaintainExportResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
|
|
|
|
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
|
|
|
|
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
|
|
|
@ -51,33 +56,72 @@ public class BasicGenJsonService {
|
|
|
|
UdiInfoDao udiInfoDao;
|
|
|
|
UdiInfoDao udiInfoDao;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
ThrProductsDao thrProductsDao;
|
|
|
|
ThrProductsDao thrProductsDao;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
ThrCorpDao thrCorpDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void exportCorp(String genKey, CorpsExportRequest corpsExportRequest) {
|
|
|
|
public void exportCorp(String genKey, CorpsExportRequest corpsExportRequest) {
|
|
|
|
CorpExportLogEntity corpExportLogEntity = corpExportLogService.selectByGenKey(genKey);
|
|
|
|
CorpExportLogEntity corpExportLogEntity = corpExportLogService.selectByGenKey(genKey);
|
|
|
|
List<BasicUnitMaintainEntity> exportData = new ArrayList<>();
|
|
|
|
BasicUnitMaintainExportResponse exportData = new BasicUnitMaintainExportResponse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BasicUnitMaintainEntity> unitMaintainEntities = new ArrayList<>();
|
|
|
|
if (corpsExportRequest.getIds() != null && corpsExportRequest.getIds().size() > 0) {
|
|
|
|
if (corpsExportRequest.getIds() != null && corpsExportRequest.getIds().size() > 0) {
|
|
|
|
List<Integer> ids = corpsExportRequest.getIds();
|
|
|
|
List<Integer> ids = corpsExportRequest.getIds();
|
|
|
|
ids.forEach(id -> {
|
|
|
|
ids.forEach(id -> {
|
|
|
|
BasicUnitMaintainFilterRequest request = new BasicUnitMaintainFilterRequest();
|
|
|
|
BasicUnitMaintainFilterRequest request = new BasicUnitMaintainFilterRequest();
|
|
|
|
request.setId(id);
|
|
|
|
request.setId(id);
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(request);
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(request);
|
|
|
|
exportData.addAll(basicUnitMaintainEntities);
|
|
|
|
unitMaintainEntities.addAll(basicUnitMaintainEntities);
|
|
|
|
|
|
|
|
getThrCorpList(exportData, basicUnitMaintainEntities);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else { //一键导出
|
|
|
|
} else { //一键导出
|
|
|
|
BasicUnitMaintainFilterRequest filterRequest = new BasicUnitMaintainFilterRequest();
|
|
|
|
BasicUnitMaintainFilterRequest filterRequest = new BasicUnitMaintainFilterRequest();
|
|
|
|
BeanUtils.copyProperties(corpsExportRequest, filterRequest);
|
|
|
|
BeanUtils.copyProperties(corpsExportRequest, filterRequest);
|
|
|
|
filterRequest.setPage(null);
|
|
|
|
filterRequest.setPage(null);
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(filterRequest);
|
|
|
|
List<BasicUnitMaintainEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(filterRequest);
|
|
|
|
exportData.addAll(basicUnitMaintainEntities);
|
|
|
|
unitMaintainEntities.addAll(basicUnitMaintainEntities);
|
|
|
|
|
|
|
|
getThrCorpList(exportData, basicUnitMaintainEntities);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exportData.setCorpList(unitMaintainEntities);
|
|
|
|
FileWriter writer = new FileWriter(corpExportLogEntity.getFilePath());
|
|
|
|
FileWriter writer = new FileWriter(corpExportLogEntity.getFilePath());
|
|
|
|
writer.write(JSONUtil.toJsonStr(exportData));
|
|
|
|
writer.write(JSONUtil.toJsonStr(exportData));
|
|
|
|
corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
|
|
|
|
corpExportLogService.updateCorpExportLog(corpExportLogEntity);
|
|
|
|
corpExportLogService.updateCorpExportLog(corpExportLogEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询第三方往来单位信息
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param exportData
|
|
|
|
|
|
|
|
* @param basicUnitMaintainEntities
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void getThrCorpList(BasicUnitMaintainExportResponse exportData, List<BasicUnitMaintainEntity> basicUnitMaintainEntities) {
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(basicUnitMaintainEntities)) {
|
|
|
|
|
|
|
|
List<ThrCorpEntity> thrCorpEntities = new ArrayList<>();
|
|
|
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(BasicUnitMaintainEntity.class);
|
|
|
|
|
|
|
|
basicUnitMaintainEntities.forEach(basicUnitMaintainEntity -> {
|
|
|
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
|
|
|
if (field.getName().contains("thirdId")) {
|
|
|
|
|
|
|
|
String value = String.valueOf(ReflectUtil.getFieldValue(basicUnitMaintainEntity, field));
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(value)) {
|
|
|
|
|
|
|
|
FilterThrCorpRequest thrCorpRequest = new FilterThrCorpRequest();
|
|
|
|
|
|
|
|
thrCorpRequest.setThirdSysFk("thirdId");
|
|
|
|
|
|
|
|
thrCorpRequest.setUnitId(value);
|
|
|
|
|
|
|
|
List<ThrCorpEntity> result = thrCorpDao.filterThrCorps(thrCorpRequest);
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(result)) {
|
|
|
|
|
|
|
|
thrCorpEntities.addAll(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(thrCorpEntities)) {
|
|
|
|
|
|
|
|
exportData.setThrCorpEntities(thrCorpEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 导出json格式医疗器械信息
|
|
|
|
* 导出json格式医疗器械信息
|
|
|
|
*
|
|
|
|
*
|
|
|
|