Browse Source

Merge remote-tracking branch 'origin/dev_tripreport' into dev_tripreport

dev
yinzuomei 3 years ago
parent
commit
c2a1d6568a
  1. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EmphasisTripPieDetailFormDTO.java
  3. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java
  4. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java
  5. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java
  6. 120
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java
  7. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcTripReportExcelData.java
  8. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcPsTripReportRecordErrorExcel.java
  9. 178
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java
  10. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcTripReportExcelImportListener.java
  11. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java
  12. 302
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java
  13. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -287,7 +287,7 @@ public class IcTripReportRecordDTO implements Serializable {
/**
* 来曹事由磐石
*/
private String describe;
private String describeContent;
/**
* 48小时核算检查结果(0:阴性 1:阳性)磐石
*/

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EmphasisTripPieDetailFormDTO.java

@ -15,7 +15,7 @@ public class EmphasisTripPieDetailFormDTO implements Serializable {
public interface EmphasisTripPieDetailForm{}
@NotBlank(message = "code不能为空",groups = {EmphasisTripPieDetailForm.class})
// @NotBlank(message = "code不能为空",groups = {EmphasisTripPieDetailForm.class})
private String code;
private String customerId;

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EmphasisTripListResultDTO.java

@ -26,7 +26,7 @@ public class EmphasisTripListResultDTO implements Serializable {
/**
* 来曹事由
*/
private String describe;
private String describeContent;
/**
* 核酸检测结果

33
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java

@ -337,13 +337,37 @@ public class IcTripReportRecordController implements ResultDataResolver {
if (file.isEmpty()) {
throw new RenException("请上传文件");
}
// 1.暂存文件
String originalFilename = file.getOriginalFilename();
String extName = originalFilename.substring(originalFilename.lastIndexOf("."));
Path fileSavePath;
try {
Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_trip_preport", "import");
fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName));
} catch (IOException e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【行程上报导入】创建临时存储文件失败:{}", errorMsg);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败");
}
InputStream is = null;
FileOutputStream os = null;
try {
is = file.getInputStream();
os = new FileOutputStream(fileSavePath.toString());
IOUtils.copy(is, os);
} catch (Exception e) {
log.error("method exception", e);
} finally {
org.apache.poi.util.IOUtils.closeQuietly(is);
org.apache.poi.util.IOUtils.closeQuietly(os);
}
// 校验文件类型
//校验文件类型
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (!"xls".equals(extension) && !"xlsx".equals(extension)) {
throw new RenException("文件类型不匹配");
}
//1.查询当前工作人员是否有再导入的党员先锋数据,有则不允许导入,没有则进行新的导入
//2.查询当前工作人员是否有再导入的党员先锋数据,有则不允许导入,没有则进行新的导入
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO();
importTaskForm.setOriginFileName(file.getOriginalFilename());
importTaskForm.setOperatorId(tokenDto.getUserId());
@ -363,8 +387,8 @@ public class IcTripReportRecordController implements ResultDataResolver {
commonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
//2.执行导入程序
icTripReportRecordService.psExecAsyncExcelImport(tokenDto, response, inputStream, result.getData().getTaskId());
//3.执行导入程序
icTripReportRecordService.psExecAsyncExcelImport(fileSavePath, result.getData().getTaskId(),tokenDto);
return new Result();
}
@ -440,7 +464,6 @@ public class IcTripReportRecordController implements ResultDataResolver {
*/
@PostMapping("emphasisTripPieDetail")
public Result<List<EmphasisTripPieDetailResultDTO>> emphasisTripPieDetail(@RequestBody EmphasisTripPieDetailFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO,EmphasisTripPieDetailFormDTO.EmphasisTripPieDetailForm.class);
formDTO.setStaffId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<EmphasisTripPieDetailResultDTO>>().ok(icTripReportRecordService.emphasisTripPieDetail(formDTO));

2
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcTripReportRecordEntity.java

@ -146,7 +146,7 @@ public class IcTripReportRecordEntity extends BaseEpmetEntity {
/**
* 来曹事由磐石
*/
private String describe;
private String describeContent;
/**
* 48小时核算检查结果(0:阴性 1:阳性)磐石
*/

120
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPsTripReportRecordExcel.java

@ -1,12 +1,13 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.alibaba.excel.annotation.ExcelProperty;
import com.epmet.commons.tools.utils.ExcelVerifyInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Date;
/**
* 磐石-行程上报信息
@ -15,110 +16,87 @@ import java.util.List;
@Data
public class IcPsTripReportRecordExcel extends ExcelVerifyInfo {
@Excel(name = "姓名", needMerge = true)
@NotBlank(message = "不能为空")
@ExcelProperty("姓名")
@NotBlank(message = "姓名不能为空")
private String name;
@Excel(name = "年龄", needMerge = true)
//@NotNull(message = "不能为空")
@ExcelProperty("年龄")
//@NotNull(message = "年龄不能为空")
private Integer age;
@Excel(name = "证件号", needMerge = true)
@NotBlank(message = "不能为空")
private Integer idCard;
@ExcelProperty("证件号")
@NotBlank(message = "证件号不能为空")
private String idCard;
@Excel(name = "户籍地(省市县区)", needMerge = true)
@NotBlank(message = "不能为空")
@ExcelProperty("户籍地(省市县区)")
@NotBlank(message = "户籍地不能为空")
private String registeredResidence;
@Excel(name = "手机号", needMerge = true)
@NotBlank(message = "不能为空")
@ExcelProperty("手机号")
@NotBlank(message = "手机号不能为空")
private String mobile;
/* @ExcelCollection(name = "来源地")
private List<Source> source;*/
@Excel(name = "来自地区(格式:省-市-区-街道-社区)")
@NotBlank(message = "不能为空")
@ExcelProperty("来自地区(格式:省-市-区-街道-社区)")
@NotBlank(message = "来自地区不能为空")
private String sourceAddress;
@Excel(name = "来自地区详细地址")
@ExcelProperty("来自地区详细地址")
@NotBlank(message = "来自地区详细地址不能为空")
private String sourceDetailAddress;
@Excel(name = "来曹事由(100字以内)", needMerge = true)
@NotBlank(message = "不能为空")
private String describe;
@ExcelProperty("来曹事由(100字以内)")
@NotBlank(message = "来曹事由不能为空")
private String describeContent;
@Excel(name = "48小时核酸检测", needMerge = true)
@NotBlank(message = "不能为空")
@ExcelProperty("48小时核酸检测")
@NotBlank(message = "48小时核酸检测不能为空")
private String natOutcome;
@Excel(name = "来到本地时间(2022-01-01)", needMerge = true)
@NotBlank(message = "不能为空")
private String arriveDate;
@ExcelProperty("来到本地时间\n" +
"(2022-01-01)")
//@NotBlank(message = "来到本地时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date arriveDate;
/*@ExcelCollection(name = "在曹居住地点")
private List<Present> present;*/
@Excel(name = "现居地")
@NotBlank(message = "不能为空")
@ExcelProperty("现居地")
@NotBlank(message = "现居地不能为空")
private String presentAddress;
@Excel(name = "现居地详细地址")
@ExcelProperty("现居地详细地址")
@NotBlank(message = "现居地详细地址不能为空")
private String detailAddress;
/*@ExcelCollection(name = "返回方式")
private List<Traffic> traffic;*/
@Excel(name = "返回方式")
@NotBlank(message = "不能为空")
@ExcelProperty("返回方式")
@NotBlank(message = "返回方式不能为空")
private String trafficType;
@Excel(name = "其他返回方式")
@ExcelProperty("其他返回方式")
private String trafficTypeExplain;
@Excel(name = "7天内旅居史情况", needMerge = true)
@ExcelProperty("7天内旅居史情况")
private String sojournHistory;
@Excel(name = "隔离状态", needMerge = true)
@ExcelProperty("隔离状态")
private String isolateType;
@Excel(name = "备注(500字以内)", needMerge = true)
@ExcelProperty("备注(500字以内)")
private String remark;
@Excel(name = "是否落实“落地检”", needMerge = true)
@ExcelProperty("是否落实“落地检”")
private String isArriveCheck;
@Excel(name = "是否达到曹县", needMerge = true)
@ExcelProperty("是否达到曹县")
private String isArrive;
@Excel(name = "上报时间(2022-01-01)", needMerge = true)
private String reportingTime;
@ExcelProperty("上报时间\n" +
"(2022-01-01)")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date reportingTime;
@Excel(name = "管控措施(500字以内)", needMerge = true)
@ExcelProperty("管控措施\n" +
"(500字以内)")
private String controlMeasures;
@Excel(name = "类型(省内、省外、市内、县内)", needMerge = true)
@ExcelProperty("类型\n" +
"(省内、省外、市内、县内)")
private String tripDataType;
@Data
public class Source {
@Excel(name = "社区(省-市-区-街道-社区)")
@NotBlank(message = "不能为空")
private String sourceAddress;
@Excel(name = "详细地址", width = 20)
private String sourceDetailAddress;
}
@Data
public class Present {
@Excel(name = "村/居")
@NotBlank(message = "不能为空")
private String presentAddress;
@Excel(name = "详细地址", width = 20)
private String detailAddress;
}
@Data
public class Traffic {
@Excel(name = "返回方式")
@NotBlank(message = "不能为空")
private String trafficType;
@Excel(name = "其他返回方式", width = 20)
private String trafficTypeExplain;
}
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcTripReportExcelData.java

@ -2,6 +2,7 @@ package com.epmet.excel.data;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@ -45,6 +46,7 @@ public class IcTripReportExcelData {
@NotNull(message = "来到本地时间为必填项")
@ExcelProperty("来到本地时间(格式:2022-01-01)")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date arriveDate;
@ExcelProperty("返回方式")
@ -63,6 +65,7 @@ public class IcTripReportExcelData {
private String vaccineNum;
@ExcelProperty("离开本地时间(格式:2022-01-01)")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date leaveDate;
/**
@ -80,7 +83,7 @@ public class IcTripReportExcelData {
private String name;
@ColumnWidth(20)
@ExcelProperty("身份证号")
@ExcelProperty("证号")
private String idCard;
@ExcelProperty("手机号")

19
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/IcPsTripReportRecordErrorExcel.java

@ -1,6 +1,8 @@
package com.epmet.excel.error;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -13,19 +15,20 @@ import java.util.Date;
@Data
public class IcPsTripReportRecordErrorExcel {
@Excel(name = "姓名", width = 20)
@ExcelProperty("姓名")
@ColumnWidth(20)
private String name;
@Excel(name = "证件号", width = 25)
private Integer idCard;
@ColumnWidth(20)
@ExcelProperty("证件号")
private String idCard;
@Excel(name = "户籍地(省市县区)", width = 40)
private String presentAddress;
@Excel(name = "手机号", width = 20)
@ExcelProperty("手机号")
@ColumnWidth(20)
private String mobile;
@Excel(name = "社会自组织名称", width = 40)
@ColumnWidth(60)
@ExcelProperty("错误信息")
private String errorInfo;

178
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcPsTripReportExcelImportListener.java

@ -0,0 +1,178 @@
package com.epmet.excel.handler;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.excel.IcPsTripReportRecordExcel;
import com.epmet.excel.data.IcTripReportExcelData;
import com.epmet.excel.error.IcPsTripReportRecordErrorExcel;
import com.epmet.service.impl.IcTripReportRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* 磐石-行程上报excel导入监听器
*/
@Slf4j
public class IcPsTripReportExcelImportListener implements ReadListener<IcPsTripReportRecordExcel> {
/**
* 最大条数阈值
*/
public static final int MAX_THRESHOLD = 200;
/**
* 当前操作用户
*/
private CustomerStaffInfoCacheResult staffInfo;
private String customerId;
//字典表数据
private Map<String, String> trafficTypeMap;
private Map<String, String> sojournHistoryMap;
private Map<String, String> isolateTypeMap;
private Map<String, String> tripDataTypeMap;
private Map<String, String> areaMap;
/**
* 数据
*/
private List<IcTripReportRecordEntity> datas = new ArrayList<>();
/**
* 错误项列表
*/
private List<IcPsTripReportRecordErrorExcel> errorRows = new ArrayList<>();
private IcTripReportRecordServiceImpl tripReportRecordService;
public IcPsTripReportExcelImportListener(String customerId, CustomerStaffInfoCacheResult staffInfo, IcTripReportRecordServiceImpl tripReportRecordService,
Map<String, String> trafficTypeMap, Map<String, String> sojournHistoryMap, Map<String, String> isolateTypeMap, Map<String, String> tripDataTypeMap, Map<String, String> areaMap) {
this.customerId=customerId;
this.staffInfo = staffInfo;
this.tripReportRecordService = tripReportRecordService;
this.trafficTypeMap = trafficTypeMap;
this.sojournHistoryMap = sojournHistoryMap;
this.isolateTypeMap = isolateTypeMap;
this.tripDataTypeMap = tripDataTypeMap;
this.areaMap = areaMap;
}
@Override
public void invoke(IcPsTripReportRecordExcel data, AnalysisContext context) {
try {
// 先校验数据
ValidatorUtils.validateEntity(data);
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcTripReportRecordEntity e = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class);
e.setCustomerId(customerId);
e.setAgencyId(staffInfo.getAgencyId());
e.setPids(staffInfo.getAgencyPIds());
e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
e.setNatOutcome("阳性".equals(e.getNatOutcome()) ? "1" : "0");
if (trafficTypeMap.containsKey(data.getTrafficType())) {
e.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
}
if ("其他".equals(data.getTrafficType()) && StringUtils.isBlank(data.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充“其他返回方式”;");
bl.set(true);
}
if (StringUtils.isNotBlank(data.getSojournHistory())) {
e.setSojournHistory(sojournHistoryMap.get(data.getSojournHistory()));
} else {
String[] str = e.getSourceAddress().split("-");
if (str.length < 3) {
errMsg.append("数据不完整,‘来源地’信息填写格式错误;");
bl.set(true);
}
e.setSojournHistory("3");//无风险
if (areaMap.containsKey(str[2])) {
e.setSojournHistory(areaMap.get(str[2]));
}
}
if (StringUtils.isNotBlank(data.getIsolateType())) {
e.setIsolateType(isolateTypeMap.get(data.getIsolateType()));
}
if (StringUtils.isNotBlank(data.getTripDataType())) {
e.setTripDataType(tripDataTypeMap.get(data.getTripDataType()));
}
e.setIsArriveCheck("是".equals(data.getIsArriveCheck()) ? "1" : "0");
e.setIsArrive("是".equals(data.getIsArrive()) ? "1" : "0");
//必要字段没值的
if (StringUtils.isEmpty(e.getSourceAddress()) || StringUtils.isEmpty(e.getPresentAddress())
|| StringUtils.isEmpty(e.getTrafficType())) {
errMsg.append("数据不完整,请检查‘来源地’、‘在曹居住地点’、‘返回方式’信息是否填写完整;");
bl.set(true);
}
if (bl.get()) {
IcPsTripReportRecordErrorExcel errorRow = new IcPsTripReportRecordErrorExcel();
errorRow.setName(data.getName());
errorRow.setMobile(data.getMobile());
errorRow.setIdCard(data.getIdCard());
errorRow.setErrorInfo(errMsg.toString());
errorRows.add(errorRow);
return;
}
datas.add(e);
if (datas.size() == MAX_THRESHOLD) {
execPersist();
}
} catch (Exception e) {
String errorMsg = null;
if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg();
} else {
errorMsg = "未知错误";
log.error("【行程上报导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
}
IcPsTripReportRecordErrorExcel errorRow = new IcPsTripReportRecordErrorExcel();
errorRow.setName(data.getName());
errorRow.setMobile(data.getMobile());
errorRow.setIdCard(data.getIdCard());
errorRow.setErrorInfo(errorMsg);
errorRows.add(errorRow);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 最后几条达不到阈值,这里必须再调用一次
execPersist();
}
/**
* 执行持久化
*/
private void execPersist() {
try {
if (datas != null && datas.size() > 0) {
tripReportRecordService.batchPersist(datas);
}
} finally {
datas.clear();
}
}
/**
* 获取错误行
* @return
*/
public List<IcPsTripReportRecordErrorExcel> getErrorRows() {
return errorRows;
}
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcTripReportExcelImportListener.java

@ -10,11 +10,15 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.IcResiUserConstant;
import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.excel.data.IcTripReportExcelData;
import com.epmet.excel.error.IcPsTripReportRecordErrorExcel;
import com.epmet.service.impl.IcTripReportRecordServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -33,6 +37,8 @@ public class IcTripReportExcelImportListener implements ReadListener<IcTripRepor
*/
private CustomerStaffInfoCacheResult staffInfo;
private String customerId;
//字典表数据
private Map<String, String> trafficTypeMap;
/**
* 数据
@ -46,10 +52,11 @@ public class IcTripReportExcelImportListener implements ReadListener<IcTripRepor
private IcTripReportRecordServiceImpl tripReportRecordService;
public IcTripReportExcelImportListener(String customerId,CustomerStaffInfoCacheResult staffInfo, IcTripReportRecordServiceImpl tripReportRecordService) {
public IcTripReportExcelImportListener(String customerId,CustomerStaffInfoCacheResult staffInfo, IcTripReportRecordServiceImpl tripReportRecordService, Map<String, String> trafficTypeMap) {
this.customerId=customerId;
this.staffInfo = staffInfo;
this.tripReportRecordService = tripReportRecordService;
this.trafficTypeMap = trafficTypeMap;
}
@Override
@ -59,12 +66,33 @@ public class IcTripReportExcelImportListener implements ReadListener<IcTripRepor
// 先校验数据
ValidatorUtils.validateEntity(data);
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcTripReportRecordEntity tripReportRecordEntity = ConvertUtils.sourceToTarget(data, IcTripReportRecordEntity.class);
tripReportRecordEntity.setCustomerId(customerId);
tripReportRecordEntity.setAgencyId(staffInfo.getAgencyId());
tripReportRecordEntity.setPids(staffInfo.getAgencyPIds());
tripReportRecordEntity.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
tripReportRecordEntity.setIsNatRecord("是".equals(data.getIsNatRecord()) ? "1" : "0");
tripReportRecordEntity.setVaccineNum(tripReportRecordEntity.getVaccineNum().replace("次",""));
if (trafficTypeMap.containsKey(data.getTrafficType())) {
tripReportRecordEntity.setTrafficType(trafficTypeMap.get(data.getTrafficType()));
}
if ("其他".equals(data.getTrafficType()) && StringUtils.isBlank(data.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充“其他返回方式”;");
bl.set(true);
}
if (bl.get()) {
IcTripReportExcelData.ErrorRow errorRow = new IcTripReportExcelData.ErrorRow();
errorRow.setName(data.getName());
errorRow.setMobile(data.getMobile());
errorRow.setIdCard(data.getIdCard());
errorRow.setErrorInfo(errMsg.toString());
errorRows.add(errorRow);
return;
}
datas.add(tripReportRecordEntity);
if (datas.size() == MAX_THRESHOLD) {

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java

@ -106,7 +106,7 @@ public interface IcTripReportRecordService extends BaseService<IcTripReportRecor
*/
void execAsyncExcelImport(Path filePath, String importTaskId,String customerId,String userId);
void psExecAsyncExcelImport(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId);
void psExecAsyncExcelImport(Path filePath, String taskId, TokenDto tokenDto);
/**
* @Description 重点行程名单列表

302
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java

@ -43,6 +43,7 @@ import com.epmet.entity.IcTripReportRecordEntity;
import com.epmet.excel.IcPsTripReportRecordExcel;
import com.epmet.excel.data.IcTripReportExcelData;
import com.epmet.excel.error.IcPsTripReportRecordErrorExcel;
import com.epmet.excel.handler.IcPsTripReportExcelImportListener;
import com.epmet.excel.handler.IcTripReportExcelImportListener;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -76,7 +77,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
@ -125,16 +125,16 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
//获取需要的字典表数据
//交通方式
Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode());
Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//7天内旅居史情况
Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode());
Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//隔离状态
Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode());
Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//行程记录类型
Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode());
Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//3.查询最近一次通知时间、核算检测关注名单
if (CollectionUtils.isNotEmpty(list)) {
Map<String, Date> latestNotice = new HashMap<>();
@ -160,15 +160,15 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard()));
}
//字典表字段、是否字段赋值对应中国字
dto.setTrafficTypeName(tMap.containsKey(dto.getTrafficType()) ? tMap.get(dto.getTrafficType()) : "无");
dto.setTrafficTypeName(trafficTypeMap.getData().containsKey(dto.getTrafficType()) ? trafficTypeMap.getData().get(dto.getTrafficType()) : "无");
dto.setVaccineNumName(StringUtils.isNotBlank(dto.getVaccineNum()) ? dto.getVaccineNum().concat("针") : "");
dto.setIsNatRecordName("1".equals(dto.getIsNatRecord()) ? "是" : "否");
dto.setNatOutcomeName("1".equals(dto.getIsNatRecord()) ? "阳性" : "阴性");
dto.setSojournHistoryName(sMap.containsKey(dto.getSojournHistory()) ? sMap.get(dto.getSojournHistory()) : "无");
dto.setIsolateTypeName(iMap.containsKey(dto.getIsolateType()) ? iMap.get(dto.getIsolateType()) : "无");
dto.setSojournHistoryName(sojournHistoryMap.getData().containsKey(dto.getSojournHistory()) ? sojournHistoryMap.getData().get(dto.getSojournHistory()) : "无");
dto.setIsolateTypeName(isolateTypeMap.getData().containsKey(dto.getIsolateType()) ? isolateTypeMap.getData().get(dto.getIsolateType()) : "无");
dto.setIsArriveCheckName("1".equals(dto.getIsArriveCheck()) ? "是" : "否");
dto.setIsArriveName("1".equals(dto.getIsArrive()) ? "是" : "否");
dto.setTripDataTypeName(tdMap.containsKey(dto.getTripDataType()) ? tdMap.get(dto.getTripDataType()) : "无");
dto.setTripDataTypeName(tripDataTypeMap.getData().containsKey(dto.getTripDataType()) ? tripDataTypeMap.getData().get(dto.getTripDataType()) : "无");
}
}
return new PageData(list, data.getTotal());
@ -361,27 +361,27 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
//获取需要的字典表数据
//交通方式
Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode());
Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//7天内旅居史情况
Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode());
Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//隔离状态
Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode());
Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//行程记录类型
Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode());
Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
for (IcTripReportRecordDTO dto : result.getList()) {
//字典表字段、是否字段赋值对应中国字
dto.setTrafficTypeName(tMap.containsKey(dto.getTrafficType()) ? tMap.get(dto.getTrafficType()) : "无");
dto.setTrafficTypeName(trafficTypeMap.getData().containsKey(dto.getTrafficType()) ? trafficTypeMap.getData().get(dto.getTrafficType()) : "无");
dto.setVaccineNumName(StringUtils.isNotBlank(dto.getVaccineNum()) ? dto.getVaccineNum().concat("针") : "");
dto.setIsNatRecordName("1".equals(dto.getIsNatRecord()) ? "是" : "否");
dto.setNatOutcomeName("1".equals(dto.getIsNatRecord()) ? "阳性" : "阴性");
dto.setSojournHistoryName(sMap.containsKey(dto.getSojournHistory()) ? sMap.get(dto.getSojournHistory()) : "无");
dto.setIsolateTypeName(iMap.containsKey(dto.getIsolateType()) ? iMap.get(dto.getIsolateType()) : "无");
dto.setSojournHistoryName(sojournHistoryMap.getData().containsKey(dto.getSojournHistory()) ? sojournHistoryMap.getData().get(dto.getSojournHistory()) : "无");
dto.setIsolateTypeName(isolateTypeMap.getData().containsKey(dto.getIsolateType()) ? isolateTypeMap.getData().get(dto.getIsolateType()) : "无");
dto.setIsArriveCheckName("1".equals(dto.getIsArriveCheck()) ? "是" : "否");
dto.setIsArriveName("1".equals(dto.getIsArrive()) ? "是" : "否");
dto.setTripDataTypeName(tdMap.containsKey(dto.getTripDataType()) ? tdMap.get(dto.getTripDataType()) : "无");
dto.setTripDataTypeName(tripDataTypeMap.getData().containsKey(dto.getTripDataType()) ? tripDataTypeMap.getData().get(dto.getTripDataType()) : "无");
}
return result.getList();
@ -422,8 +422,11 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
try {
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId);
//交通方式
Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode());
Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
IcTripReportExcelImportListener listener = new IcTripReportExcelImportListener(customerId,staffInfo, this);
IcTripReportExcelImportListener listener = new IcTripReportExcelImportListener(customerId,staffInfo, this, tMap);
EasyExcel.read(filePath.toFile(), IcTripReportExcelData.class, listener).headRowNumber(2).sheet(0).doRead();
@ -550,139 +553,105 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
*/
@Async
@Override
public void psExecAsyncExcelImport(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) {
public void psExecAsyncExcelImport(Path filePath, String importTaskId, TokenDto tokenDto) {
try {
log.info("磐石街道行程上报导入,子线程开始执行");
//异常数据集合
List<IcPsTripReportRecordErrorExcel> fileList = new ArrayList<>();
IcPsTripReportRecordErrorExcel excel = null;
//1.读取Excel数据
ExcelImportResult<IcPsTripReportRecordExcel> testExcelImportResult = ExcelPoiUtils.importExcel1(inputStream, 0, 2, IcPsTripReportRecordExcel.class);
//2.存在错误行数据时存入错误数据集合中
if (CollectionUtils.isNotEmpty(testExcelImportResult.getFailList())) {
for (IcPsTripReportRecordExcel entity : testExcelImportResult.getFailList()) {
//打印失败的行 和失败的信息
log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());
excel = new IcPsTripReportRecordErrorExcel();
excel.setName(entity.getName());
excel.setIdCard(entity.getIdCard());
excel.setPresentAddress(entity.getPresentAddress());
excel.setMobile(entity.getMobile());
excel.setErrorInfo(entity.getErrorMsg());
fileList.add(excel);
}
}
//3.正确行数据集合
List<IcPsTripReportRecordExcel> list = testExcelImportResult.getList();
if (CollectionUtils.isNotEmpty(list)) {
//3-1.校验数据值,把填写不对的数据剔除
Iterator<IcPsTripReportRecordExcel> iterator = list.iterator();
while (iterator.hasNext()) {
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcPsTripReportRecordExcel obj = iterator.next();
//返回方式为其他时需要填写"其他返回方式"
if ("其他".equals(obj.getTrafficType()) && StringUtils.isBlank(obj.getTrafficTypeExplain())) {
errMsg.append("返回方式为其他时,请补充“其他返回方式”;");
bl.set(true);
}
if (bl.get()) {
excel = new IcPsTripReportRecordErrorExcel();
excel.setName(obj.getName());
excel.setIdCard(obj.getIdCard());
excel.setPresentAddress(obj.getPresentAddress());
excel.setMobile(obj.getMobile());
excel.setErrorInfo(errMsg.toString());
fileList.add(excel);
iterator.remove();
}
}
//3-2.获取需要的字典表数据
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(tokenDto.getCustomerId(), tokenDto.getUserId());
//获取需要的字典表数据
//交通方式
Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode());
Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//7天内旅居史情况
Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode());
Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//隔离状态
Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode());
Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//行程记录类型
Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode());
//获取当前登录用户所属组织id
CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(tokenDto.getCustomerId(), tokenDto.getUserId());
Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
//风险地区数据
LambdaQueryWrapper<IcDangerAreaEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcDangerAreaEntity::getCustomerId, tokenDto.getCustomerId());
wrapper.eq(IcDangerAreaEntity::getDelFlag, DelFlagEnum.NORMAL.value());
List<IcDangerAreaEntity> areaList = icDangerAreaDao.selectList(wrapper);
Map<String, String> map1 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getDistrict, IcDangerAreaEntity::getDangerLevel));
Map<String, String> map2 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getCity, IcDangerAreaEntity::getDangerLevel));
Map<String, String> map3 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getProvince, IcDangerAreaEntity::getDangerLevel));
list.forEach(l -> {
//3-3.数据赋值
AtomicBoolean bl = new AtomicBoolean(false);
StringBuffer errMsg = new StringBuffer("");
IcTripReportRecordEntity e = ConvertUtils.sourceToTarget(l, IcTripReportRecordEntity.class);
e.setCustomerId(tokenDto.getCustomerId());
e.setAgencyId(staffInfo.getAgencyId());
e.setPids(staffInfo.getAgencyPIds());
e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT);
if (trafficTypeMap.getData().containsKey(l.getTrafficType())) {
e.setTrafficType(trafficTypeMap.getData().get(l.getTrafficType()));
e.setTrafficTypeExplain(l.getTrafficTypeExplain());
}
if (StringUtils.isNotBlank(l.getSojournHistory())) {
e.setSojournHistory(sojournHistoryMap.getData().get(l.getSojournHistory()));
} else {
String[] str = e.getSourceAddress().split("-");
if (str.length < 3) {
bl.set(true);
errMsg.append("数据不完整,‘来源地’信息填写格式错误;");
}
e.setSojournHistory("3");//无风险
if (map1.containsKey(str[2])) {//高风险
e.setSojournHistory(map1.get(str[2]));
} else if (map2.containsKey(str[1])) {//中风险
e.setSojournHistory(map2.get(str[1]));
} else if (map3.containsKey(str[0])) {//低风险
e.setSojournHistory(map3.get(str[0]));
}
}
if (StringUtils.isNotBlank(l.getIsolateType())) {
e.setIsolateType(isolateTypeMap.getData().get(l.getIsolateType()));
}
if (StringUtils.isNotBlank(l.getTripDataType())) {
e.setTripDataType(tripDataTypeMap.getData().get(l.getTripDataType()));
}
e.setIsArriveCheck("是".equals(l.getIsArriveCheck()) ? "1" : "0");
e.setIsArrive("是".equals(l.getIsArrive()) ? "1" : "0");
//必要字段没值的
if (StringUtils.isEmpty(e.getSourceAddress()) || StringUtils.isEmpty(e.getPresentAddress())
|| StringUtils.isEmpty(e.getTrafficType())) {
errMsg.append("数据不完整,请检查‘来源地’、‘在曹居住地点’、‘返回方式’信息是否填写完整;");
bl.set(true);
}
if (bl.get()) {
IcPsTripReportRecordErrorExcel el = new IcPsTripReportRecordErrorExcel();
el.setName(l.getName());
el.setIdCard(l.getIdCard());
el.setPresentAddress(l.getPresentAddress());
el.setMobile(l.getMobile());
el.setErrorInfo(errMsg.toString());
fileList.add(el);
return;
}
//3-4.保存数据
baseDao.insert(e);
Map<String, String> areaMap = new HashMap<>();
areaList.forEach(a->{
if(StringUtils.isNotBlank(a.getDistrict())){
areaMap.put(a.getDistrict(), a.getDangerLevel());
}
});
IcPsTripReportExcelImportListener listener = new IcPsTripReportExcelImportListener(tokenDto.getCustomerId(), staffInfo, this,
tMap, sMap, iMap, tdMap, areaMap);
EasyExcel.read(filePath.toFile(), IcPsTripReportRecordExcel.class, listener).headRowNumber(2).sheet(0).doRead();
Path errorDescFile = null;
String errorDesFileUrl = null;
List<IcPsTripReportRecordErrorExcel> errorRows = listener.getErrorRows();
boolean failed = errorRows.size() > 0;
if (failed) {
// 生成并上传错误文件
try {
// 文件生成
Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_trip_preport", "import", "error_des");
String fileName = UUID.randomUUID().toString().concat(".xlsx");
errorDescFile = errorDescDir.resolve(fileName);
FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile());
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName);
OutputStream os = fileItem.getOutputStream();
EasyExcel.write(os, IcPsTripReportRecordErrorExcel.class).sheet("导入失败列表").doWrite(errorRows);
// 文件上传oss
Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem));
if (errorDesFileUploadResult.success()) {
errorDesFileUrl = errorDesFileUploadResult.getData().getUrl();
}
} finally {
if (Files.exists(errorDescFile)) {
Files.delete(errorDescFile);
}
}
}
//4.错误数据生成文件,修改导入任务状态
String url = erroeImport(fileList);
upImportTask(url, taskId, tokenDto.getUserId(), true);
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS);
importFinishTaskForm.setOperatorId(tokenDto.getCustomerId());
importFinishTaskForm.setResultDesc("");
importFinishTaskForm.setResultDescFilePath(errorDesFileUrl);
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【行程上报导入】finishImportTask失败");
}
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【行程上报数据导入】程序错误:{}", errorMsg);
upImportTask(null, taskId, tokenDto.getUserId(), false);
log.error("【行程上报导入】出错:{}", errorMsg);
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
importFinishTaskForm.setOperatorId(tokenDto.getCustomerId());
importFinishTaskForm.setResultDesc("导入失败");
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【行程上报导入】导入记录状态修改为'完成'失败");
}
} finally {
// 删除临时文件
if (Files.exists(filePath)) {
try {
Files.delete(filePath);
} catch (IOException e) {
log.error("method exception", e);
}
}
}
}
@ -784,74 +753,5 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR
return result;
}
/**
* @Author sun
* @Description 行程上报数据导入错误数据生成导入失败文件存到阿里云修改导入任务为已结束
**/
private String erroeImport(List<IcPsTripReportRecordErrorExcel> fileList) throws IOException {
String url = "";
//1.有错误数据则生成错误数据存放文件传到阿里云服务
if (!org.springframework.util.CollectionUtils.isEmpty(fileList)) {
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表", "导入失败的数据列表"),
IcPsTripReportRecordErrorExcel.class, fileList);
// 文件名
String resultDescFileName = UUID.randomUUID().toString().concat(".xlsx");
FileItemFactory factory = new DiskFileItemFactory(16, null);
FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName);
OutputStream os = fileItem.getOutputStream();
Result<UploadImgResultDTO> uploadResult = null;
try {
workbook.write(os);
uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem));
} catch (Exception e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【行程上报数据导入】上传错误描述文件:{}", errormsg);
} finally {
try {
os.close();
} catch (IOException e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【行程上报数据导入】上传错误描述文件关闭输出流:{}", errormsg);
}
try {
fileItem.delete();
} catch (Exception e) {
String errormsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【行程上报数据导入】上传错误描述文件删除临时文件:{}", errormsg);
}
}
if (uploadResult == null || !uploadResult.success()) {
log.error("【行程上报数据导入】调用OSS上传结果描述文件失败");
}
url = uploadResult.getData().getUrl();
}
return url;
}
/**
* @Author sun
* @Description 行程上报数据导入修改导入任务状态
**/
private void upImportTask(String url, String importTaskId, String staffId, Boolean status) {
//2.更新导入任务数据
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO();
importTaskForm.setOperatorId(staffId);
importTaskForm.setBizType(ImportTaskConstants.PS_BIZ_TYPE_IC_TRIP_REPORT);
importTaskForm.setTaskId(importTaskId);
importTaskForm.setResultDescFilePath(url);
if (status && StringUtils.isBlank(url)) {
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS);
} else {
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
importTaskForm.setResultDesc("行程上报数据导入存在程序错误");
}
Result result = commonServiceOpenFeignClient.finishImportTask(importTaskForm);
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
}
}

2
epmet-user/epmet-user-server/src/main/resources/mapper/IcTripReportRecordDao.xml

@ -78,7 +78,7 @@
ID,
AGENCY_ID,
SOURCE_ADDRESS,
IFNULL(`describe`,'') as `describe`,
IFNULL(`describe_content`,'') as describeContent,
ifnull(sojourn_history,'3') as sojournHistory,
IFNULL(isolate_type,'4') as isolateType,
ARRIVE_DATE,

Loading…
Cancel
Save