|
|
|
@ -17,12 +17,11 @@ |
|
|
|
|
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.rocketmq.messages.ServerSatisfactionCalFormDTO; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
@ -33,11 +32,9 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.DictListResultDTO; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
import com.epmet.commons.tools.enums.PartyUnitTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
@ -45,7 +42,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.ExcelPoiUtils; |
|
|
|
import com.epmet.commons.tools.utils.FileUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.UserDemandConstant; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
@ -59,7 +56,7 @@ import com.epmet.dto.result.demand.ServiceStatDTO; |
|
|
|
import com.epmet.entity.IcCommunitySelfOrganizationEntity; |
|
|
|
import com.epmet.entity.IcPartyUnitEntity; |
|
|
|
import com.epmet.excel.IcPartyUnitImportExcel; |
|
|
|
import com.epmet.excel.IcPartyUnitImportFailedExcel; |
|
|
|
import com.epmet.excel.handler.IcPartyUnitExcelImportListener; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.service.IcCommunitySelfOrganizationService; |
|
|
|
import com.epmet.service.IcPartyUnitService; |
|
|
|
@ -75,18 +72,17 @@ import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.http.entity.ContentType; |
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -380,214 +376,6 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 导入数据 |
|
|
|
* |
|
|
|
* @param tokenDto |
|
|
|
* @param response |
|
|
|
* @param file |
|
|
|
* @Param tokenDto |
|
|
|
* @Param response |
|
|
|
* @Param file |
|
|
|
* @Return |
|
|
|
* @Author zhaoqifeng |
|
|
|
* @Date 2021/11/29 11:01 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException { |
|
|
|
List<IcPartyUnitImportFailedExcel> fileList = new ArrayList<>(); |
|
|
|
|
|
|
|
ExcelImportResult<IcPartyUnitImportExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcPartyUnitImportExcel.class); |
|
|
|
List<IcPartyUnitImportExcel> failList = importResult.getFailList(); |
|
|
|
//存放错误数据行号
|
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(failList)) { |
|
|
|
for (IcPartyUnitImportExcel entity : failList) { |
|
|
|
//打印失败的行 和失败的信息
|
|
|
|
log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg()); |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(entity, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo(entity.getErrorMsg()); |
|
|
|
fileList.add(failed); |
|
|
|
} |
|
|
|
} |
|
|
|
List<IcPartyUnitImportExcel> result = importResult.getList(); |
|
|
|
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
if (null == staffInfoCache) { |
|
|
|
throw new EpmetException(8000, "获取用户缓存失败"); |
|
|
|
} |
|
|
|
List<OptionDTO> serviceItemList = icServiceItemDictService.queryDictList(tokenDto.getCustomerId()); |
|
|
|
Map<String, String> categoryMap = serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); |
|
|
|
//1.数据校验
|
|
|
|
Iterator<IcPartyUnitImportExcel> iterator = result.iterator(); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
IcPartyUnitImportExcel obj = iterator.next(); |
|
|
|
//单位名称不能为空,不可重复
|
|
|
|
if (StringUtils.isBlank(obj.getUnitName())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("单位名称为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("单位名称为空,行号->%s", obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} else { |
|
|
|
LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(IcPartyUnitEntity::getAgencyId, staffInfoCache.getAgencyId()); |
|
|
|
wrapper.eq(IcPartyUnitEntity::getUnitName, obj.getUnitName()); |
|
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("单位名称已存在"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("单位名称已存在,行号->%s", obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
//分类校验
|
|
|
|
if (StringUtils.isBlank(obj.getType()) || null == PartyUnitTypeEnum.getCode(obj.getType())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("分类名不存在"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("分类名不存在,行号->%s", obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
//服务事项校验
|
|
|
|
/*if (StringUtils.isNotBlank(obj.getServiceMatter())) { |
|
|
|
List<String> matters = Arrays.asList(obj.getServiceMatter().split(StrConstant.COLON)); |
|
|
|
matters.forEach(item -> { |
|
|
|
if (null == categoryMap.get(item)) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("服务事项不存在"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}*/ |
|
|
|
//联系人 联系电话 在职党员 地址 中心位置经度 中心位置纬度 校验
|
|
|
|
if (StringUtils.isBlank(obj.getContact())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("联系人为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("联系人为空,行号->%s", obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} else if (StringUtils.isBlank(obj.getContactMobile())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("联系电话为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("联系电话为空,行号->%s", obj.getRowNum())); |
|
|
|
} else if (StringUtils.isBlank(obj.getAddress())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("地址为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("地址为空,行号->%s", obj.getRowNum())); |
|
|
|
} else if (null == obj.getMemberCount()) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("在职党员为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("在职党员为空,行号->%s", obj.getRowNum())); |
|
|
|
} /*else if (StringUtils.isBlank(obj.getLatitude())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("中心位置纬度为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("中心位置纬度为空,行号->%s", obj.getRowNum())); |
|
|
|
} else if (StringUtils.isBlank(obj.getLongitude())) { |
|
|
|
IcPartyUnitImportFailedExcel failed = ConvertUtils.sourceToTarget(obj, IcPartyUnitImportFailedExcel.class); |
|
|
|
failed.setErrorInfo("中心位置经度为空"); |
|
|
|
fileList.add(failed); |
|
|
|
log.warn(String.format("中心位置经度为空,行号->%s", obj.getRowNum())); |
|
|
|
}*/ |
|
|
|
|
|
|
|
} |
|
|
|
if (CollectionUtils.isNotEmpty(result)) { |
|
|
|
List<IcPartyUnitEntity> list = result.stream().map(item -> { |
|
|
|
IcPartyUnitEntity entity = new IcPartyUnitEntity(); |
|
|
|
entity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
entity.setAgencyId(staffInfoCache.getAgencyId()); |
|
|
|
entity.setPids(staffInfoCache.getAgencyPIds()); |
|
|
|
entity.setUnitName(item.getUnitName()); |
|
|
|
entity.setType(PartyUnitTypeEnum.getCode(item.getType())); |
|
|
|
// if (StringUtils.isNotBlank(item.getServiceMatter())) {
|
|
|
|
// entity.setServiceMatter(getServiceMatter(categoryMap, item.getServiceMatter()));
|
|
|
|
// }
|
|
|
|
entity.setContact(item.getContact()); |
|
|
|
entity.setContactMobile(item.getContactMobile()); |
|
|
|
entity.setAddress(item.getAddress()); |
|
|
|
// entity.setLatitude(item.getLatitude());
|
|
|
|
// entity.setLongitude(item.getLongitude());
|
|
|
|
entity.setMemberCount(item.getMemberCount()); |
|
|
|
entity.setRemark(item.getRemark()); |
|
|
|
return entity; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
insertBatch(list); |
|
|
|
} |
|
|
|
|
|
|
|
String str = String.format("共%s条,成功导入%s条。", fileList.size() + result.size(), fileList.size() + result.size() - fileList.size()); |
|
|
|
if (fileList.size() > NumConstant.ZERO) { |
|
|
|
List<Integer> numList = fileList.stream().map(IcPartyUnitImportFailedExcel::getRowNum).sorted().collect(Collectors.toList()); |
|
|
|
String subList = numList.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
log.warn(str + "第" + subList + "行未成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
//错误数据生成文件,修改导入任务状态
|
|
|
|
erroeImport(fileList, taskId, tokenDto.getUserId()); |
|
|
|
} |
|
|
|
|
|
|
|
private void erroeImport(List<IcPartyUnitImportFailedExcel> fileList, String importTaskId, String staffId) throws IOException { |
|
|
|
String url = ""; |
|
|
|
//1.有错误数据则生成错误数据存放文件传到阿里云服务
|
|
|
|
if (CollectionUtils.isNotEmpty(fileList)) { |
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表", "导入失败的数据列表"), |
|
|
|
IcPartyUnitImportFailedExcel.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上传结果描述文件失败"); |
|
|
|
} else { |
|
|
|
url = uploadResult.getData().getUrl(); |
|
|
|
} |
|
|
|
} |
|
|
|
//2.更新导入任务数据
|
|
|
|
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); |
|
|
|
importTaskForm.setOperatorId(staffId); |
|
|
|
importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_PARTY_UNIT); |
|
|
|
importTaskForm.setTaskId(importTaskId); |
|
|
|
importTaskForm.setResultDescFilePath(url); |
|
|
|
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
if (CollectionUtils.isNotEmpty(fileList)) { |
|
|
|
importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
importTaskForm.setResultDesc("联建单位导入存在错误数据"); |
|
|
|
} |
|
|
|
Result result = commonServiceOpenFeignClient.finishImportTask(importTaskForm); |
|
|
|
if (!result.success()) { |
|
|
|
throw new RenException(result.getInternalMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @Description 按类型统计单位数量 |
|
|
|
@ -798,4 +586,113 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
|
} |
|
|
|
return baseDao.getUnitNames(unitIds); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 执行Excel导入 |
|
|
|
* |
|
|
|
* @param filePath |
|
|
|
* @param importTaskId |
|
|
|
* @param customerId |
|
|
|
* @param userId |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void execAsyncExcelImport(Path filePath, String importTaskId, String customerId, String userId) { |
|
|
|
try { |
|
|
|
//获取当前登录用户所属组织id
|
|
|
|
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); |
|
|
|
//交通方式
|
|
|
|
Result<Map<String, String>> partyUnitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); |
|
|
|
Map<String, String> tMap = partyUnitTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); |
|
|
|
|
|
|
|
IcPartyUnitExcelImportListener listener = new IcPartyUnitExcelImportListener(customerId,staffInfo, this,tMap); |
|
|
|
|
|
|
|
EasyExcel.read(filePath.toFile(), IcPartyUnitImportExcel.class, listener).headRowNumber(1).sheet(0).doRead(); |
|
|
|
|
|
|
|
Path errorDescFile = null; |
|
|
|
String errorDesFileUrl = null; |
|
|
|
List<IcPartyUnitImportExcel.ErrorRow> errorRows = listener.getErrorRows(); |
|
|
|
|
|
|
|
boolean failed = errorRows.size() > 0; |
|
|
|
if (failed) { |
|
|
|
// 生成并上传错误文件
|
|
|
|
try { |
|
|
|
// 文件生成
|
|
|
|
Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_party_unit", "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, IcPartyUnitImportExcel.ErrorRow.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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); |
|
|
|
importFinishTaskForm.setTaskId(importTaskId); |
|
|
|
importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
importFinishTaskForm.setOperatorId(userId); |
|
|
|
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); |
|
|
|
|
|
|
|
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); |
|
|
|
importFinishTaskForm.setTaskId(importTaskId); |
|
|
|
importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
importFinishTaskForm.setOperatorId(userId); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员缓存信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
return staffInfo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量持久化 |
|
|
|
* @param entities |
|
|
|
*/ |
|
|
|
public void batchPersist(List<IcPartyUnitEntity> entities) { |
|
|
|
entities.forEach(e -> { |
|
|
|
String id = IdWorker.getIdStr(e); |
|
|
|
e.setId(id); |
|
|
|
baseDao.insert(e); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|