|
|
@ -1,39 +1,75 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
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.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.IcNeighborHoodPropertyDao; |
|
|
|
import com.epmet.dao.IcPropertyManagementDao; |
|
|
|
import com.epmet.dto.IcNeighborHoodDTO; |
|
|
|
import com.epmet.dto.IcPropertyManagementDTO; |
|
|
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.result.IcPropertyManagementResultDTO; |
|
|
|
import com.epmet.dto.result.UploadImgResultDTO; |
|
|
|
import com.epmet.entity.IcNeighborHoodPropertyEntity; |
|
|
|
import com.epmet.entity.IcPropertyManagementEntity; |
|
|
|
import com.epmet.excel.handler.IcPropertyManagementImportListener; |
|
|
|
import com.epmet.excel.yt.IcPropertyManagementImportExcelData; |
|
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
import com.epmet.service.PropertyManagementService; |
|
|
|
import com.epmet.utils.ImportTaskUtils; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.http.entity.ContentType; |
|
|
|
import org.apache.poi.util.IOUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class PropertyManagementServiceImpl implements PropertyManagementService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 物业表 |
|
|
|
*/ |
|
|
|
@Resource |
|
|
|
private IcPropertyManagementDao icPropertyManagementDao; |
|
|
|
@Resource |
|
|
|
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
|
|
|
@Autowired |
|
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询当前客户下的物业 |
|
|
@ -57,72 +93,289 @@ public class PropertyManagementServiceImpl implements PropertyManagementService |
|
|
|
/** |
|
|
|
* 新增物业 |
|
|
|
* 名称客户下唯一 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String add(IcPropertyManagementFormDTO formDTO) { |
|
|
|
//物业名字平台内唯一
|
|
|
|
//如果输入的物业名字已经存在,直接返回物业id
|
|
|
|
// 物业名字平台内唯一
|
|
|
|
// 如果输入的物业名字已经存在,直接返回物业id
|
|
|
|
formDTO.setName(formDTO.getName().trim()); |
|
|
|
IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getCustomerId(),formDTO.getName(),null); |
|
|
|
IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getCustomerId(), formDTO.getName(), null); |
|
|
|
if (null != entity) { |
|
|
|
return entity.getId(); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "物业名称已存在", "物业名称已存在"); |
|
|
|
} |
|
|
|
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); |
|
|
|
icPropertyManagementDao.insert(icPropertyManagementEntity); |
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getNeighborHoodIdList())) { |
|
|
|
formDTO.getNeighborHoodIdList().forEach(neighborHoodId -> { |
|
|
|
// 插入小区物业关系表
|
|
|
|
IcNeighborHoodPropertyEntity neighborHoodPropertyEntity = new IcNeighborHoodPropertyEntity(); |
|
|
|
neighborHoodPropertyEntity.setPropertyId(icPropertyManagementEntity.getId()); |
|
|
|
neighborHoodPropertyEntity.setNeighborHoodId(neighborHoodId); |
|
|
|
icNeighborHoodPropertyDao.insert(neighborHoodPropertyEntity); |
|
|
|
}); |
|
|
|
} |
|
|
|
return icPropertyManagementEntity.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 物业管理-修改 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcPropertyManagementFormDTO formDTO) { |
|
|
|
IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(EpmetRequestHolder.getLoginUserCustomerId(),formDTO.getName(),formDTO.getId()); |
|
|
|
IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(EpmetRequestHolder.getLoginUserCustomerId(), formDTO.getName(), formDTO.getId()); |
|
|
|
if (null != entity) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"物业名称已存在","物业名称已存在"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "物业名称已存在", "物业名称已存在"); |
|
|
|
} |
|
|
|
LambdaUpdateWrapper<IcPropertyManagementEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(IcPropertyManagementEntity::getId, formDTO.getId()) |
|
|
|
.set(IcPropertyManagementEntity::getName, formDTO.getName()) |
|
|
|
.set(IcPropertyManagementEntity::getContactName, formDTO.getContactName()) |
|
|
|
.set(IcPropertyManagementEntity::getContactMobile, formDTO.getContactMobile()) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedTime, new Date()) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedBy, EpmetRequestHolder.getLoginUserId()); |
|
|
|
icPropertyManagementDao.update(null, updateWrapper); |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId()); |
|
|
|
|
|
|
|
// 查询当前物业,在本组织及下级范围内,管理的小区
|
|
|
|
List<IcNeighborHoodDTO> originNeighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(formDTO.getId(), staffInfoCacheResult.getAgencyId()); |
|
|
|
// 原来存在关联的小区,现在取消勾选了,需要删除物业小区关系表
|
|
|
|
originNeighborHoodList.forEach(origin -> { |
|
|
|
// 举例:原来管理A小区,现在取消勾选
|
|
|
|
if (!formDTO.getNeighborHoodIdList().contains(origin.getId())) { |
|
|
|
LambdaUpdateWrapper<IcNeighborHoodPropertyEntity> updateWrapper1 = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper1.eq(IcNeighborHoodPropertyEntity::getPropertyId, formDTO.getId()) |
|
|
|
.eq(IcNeighborHoodPropertyEntity::getNeighborHoodId, origin.getId()) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getDelFlag, NumConstant.ONE_STR) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getUpdatedTime, new Date()) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getUpdatedBy, EpmetRequestHolder.getLoginUserId()); |
|
|
|
icNeighborHoodPropertyDao.update(null, updateWrapper1); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (CollectionUtils.isNotEmpty(formDTO.getNeighborHoodIdList())) { |
|
|
|
formDTO.getNeighborHoodIdList().forEach(neighborHoodId -> { |
|
|
|
LambdaQueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId, formDTO.getId()) |
|
|
|
.eq(IcNeighborHoodPropertyEntity::getNeighborHoodId, neighborHoodId); |
|
|
|
if (icNeighborHoodPropertyDao.selectCount(queryWrapper) < NumConstant.ONE) { |
|
|
|
// 插入小区物业关系表
|
|
|
|
IcNeighborHoodPropertyEntity neighborHoodPropertyEntity = new IcNeighborHoodPropertyEntity(); |
|
|
|
neighborHoodPropertyEntity.setPropertyId(formDTO.getId()); |
|
|
|
neighborHoodPropertyEntity.setNeighborHoodId(neighborHoodId); |
|
|
|
icNeighborHoodPropertyDao.insert(neighborHoodPropertyEntity); |
|
|
|
} |
|
|
|
//原本已经存在小区和物业的关系,不用再插入
|
|
|
|
}); |
|
|
|
} |
|
|
|
LambdaUpdateWrapper<IcPropertyManagementEntity> updateWrapper=new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(IcPropertyManagementEntity::getId,formDTO.getId()) |
|
|
|
.set(IcPropertyManagementEntity::getName,formDTO.getName()) |
|
|
|
.set(IcPropertyManagementEntity::getContactName,formDTO.getContactName()) |
|
|
|
.set(IcPropertyManagementEntity::getContactMobile,formDTO.getContactMobile()) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedTime,new Date()) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedBy,EpmetRequestHolder.getLoginUserId()); |
|
|
|
icPropertyManagementDao.update(null,updateWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 单个删除 |
|
|
|
* @param formDTO |
|
|
|
* |
|
|
|
* @param id |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(IcPropertyManagementFormDTO formDTO) { |
|
|
|
LambdaQueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper=new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId,formDTO.getId()); |
|
|
|
if (icNeighborHoodPropertyDao.selectCount(queryWrapper) > 0) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"物业存在与小区关联,无法删除","已与小区关联,无法删除"); |
|
|
|
public void delete(String id) { |
|
|
|
Date now = new Date(); |
|
|
|
// 删除物业与小区关联关系表
|
|
|
|
LambdaUpdateWrapper<IcNeighborHoodPropertyEntity> updateWrapper1 = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper1.eq(IcNeighborHoodPropertyEntity::getPropertyId, id) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getDelFlag, NumConstant.ONE_STR) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getUpdatedTime, now) |
|
|
|
.set(IcNeighborHoodPropertyEntity::getUpdatedBy, EpmetRequestHolder.getLoginUserId()); |
|
|
|
icNeighborHoodPropertyDao.update(null, updateWrapper1); |
|
|
|
// 删除物业表
|
|
|
|
LambdaUpdateWrapper<IcPropertyManagementEntity> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(IcPropertyManagementEntity::getId, id) |
|
|
|
.set(IcPropertyManagementEntity::getDelFlag, NumConstant.ONE_STR) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedTime, now) |
|
|
|
.set(IcPropertyManagementEntity::getUpdatedBy, EpmetRequestHolder.getLoginUserId()); |
|
|
|
icPropertyManagementDao.update(null, updateWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 物业管理批量删除 |
|
|
|
* |
|
|
|
* @param ids |
|
|
|
* @return 返回失败的id列表 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public List<String> deleteBatch(List<String> ids) { |
|
|
|
if (CollectionUtils.isEmpty(ids)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
List<String> failedIdList = new ArrayList<>(); |
|
|
|
for (String id : ids) { |
|
|
|
Boolean res =true; |
|
|
|
try{ |
|
|
|
//调用单挑删除方法
|
|
|
|
delete(id); |
|
|
|
}catch(EpmetException e){ |
|
|
|
res=false; |
|
|
|
} |
|
|
|
if (!res) { |
|
|
|
failedIdList.add(id); |
|
|
|
} |
|
|
|
} |
|
|
|
icPropertyManagementDao.deleteById(formDTO.getId()); |
|
|
|
return failedIdList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 物业管理-列表查询 |
|
|
|
* |
|
|
|
* @param pageNo |
|
|
|
* @param pageSize |
|
|
|
* @param name |
|
|
|
* @param name 物业名称 |
|
|
|
* @param contactName 物业联系人 |
|
|
|
* @param contactMobile 联系电话 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<IcPropertyManagementDTO> page(Integer pageNo, Integer pageSize, String name,String contactName,String contactMobile) { |
|
|
|
PageHelper.startPage(pageNo,pageSize); |
|
|
|
List<IcPropertyManagementDTO> list=icPropertyManagementDao.queryList(EpmetRequestHolder.getLoginUserCustomerId(),name,contactName,contactMobile); |
|
|
|
public PageData<IcPropertyManagementDTO> page(Integer pageNo, Integer pageSize, String name, String contactName, String contactMobile) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); |
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
List<IcPropertyManagementDTO> list = icPropertyManagementDao.queryList(EpmetRequestHolder.getLoginUserCustomerId(), name, contactName, contactMobile, staffInfoCacheResult.getAgencyId()); |
|
|
|
PageInfo<IcPropertyManagementDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal(),pageSize); |
|
|
|
// 导出时需要导出关联的小区名称
|
|
|
|
pageInfo.getList().forEach(result -> { |
|
|
|
List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(result.getId(), staffInfoCacheResult.getAgencyId()); |
|
|
|
List<String> neighborHoodNames = neighborHoodList.stream() |
|
|
|
.map(IcNeighborHoodDTO::getNeighborHoodName) |
|
|
|
.distinct().collect(Collectors.toList()); |
|
|
|
result.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); |
|
|
|
result.setNeighborHoodList(neighborHoodList); |
|
|
|
result.setTotalNeighborHood(CollectionUtils.isNotEmpty(neighborHoodList)?neighborHoodList.size():NumConstant.ZERO); |
|
|
|
}); |
|
|
|
return new PageData<>(list, pageInfo.getTotal(), pageSize); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查看物业详情 |
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public IcPropertyManagementDTO getDetail(String id) { |
|
|
|
CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId()); |
|
|
|
IcPropertyManagementEntity icPropertyManagementEntity = icPropertyManagementDao.selectById(id); |
|
|
|
if (null == icPropertyManagementEntity) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
IcPropertyManagementDTO resultDto = ConvertUtils.sourceToTarget(icPropertyManagementEntity, IcPropertyManagementDTO.class); |
|
|
|
List<IcNeighborHoodDTO> neighborHoodList = icNeighborHoodPropertyDao.getNeighborHoodList(id,staffInfoCacheResult.getAgencyId()); |
|
|
|
List<String> neighborHoodNames = neighborHoodList.stream() |
|
|
|
.map(IcNeighborHoodDTO::getNeighborHoodName) |
|
|
|
.distinct().collect(Collectors.toList()); |
|
|
|
resultDto.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); |
|
|
|
resultDto.setNeighborHoodList(neighborHoodList); |
|
|
|
resultDto.setTotalNeighborHood(CollectionUtils.isNotEmpty(neighborHoodList)?neighborHoodList.size():NumConstant.ZERO); |
|
|
|
return resultDto; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 执行Excel导入 |
|
|
|
* |
|
|
|
* @param filePath |
|
|
|
* @param importTaskId |
|
|
|
*/ |
|
|
|
@Async |
|
|
|
@Override |
|
|
|
public void execAsyncExcelImport(Path filePath, String importTaskId) { |
|
|
|
String userId = null; |
|
|
|
try { |
|
|
|
userId = EpmetRequestHolder.getLoginUserId(); |
|
|
|
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|
|
|
|
|
|
|
IcPropertyManagementImportListener listener = new IcPropertyManagementImportListener(customerId, SpringContextUtils.getBean(IcPropertyManagementServiceImpl.class)); |
|
|
|
|
|
|
|
EasyExcel.read(filePath.toFile(), IcPropertyManagementImportExcelData.class, listener).headRowNumber(1).sheet(0).doRead(); |
|
|
|
|
|
|
|
String errorDesFileUrl = null; |
|
|
|
|
|
|
|
List<IcPropertyManagementImportExcelData.ErrorRow> errorRows = listener.getErrorRows(); |
|
|
|
|
|
|
|
boolean failed = errorRows.size() > 0; |
|
|
|
|
|
|
|
// 合并到一起写入
|
|
|
|
// errorRows.addAll(otherRows);
|
|
|
|
|
|
|
|
// 生成并上传描述文件
|
|
|
|
OutputStream os = null; |
|
|
|
FileItem fileItem = null; |
|
|
|
if (errorRows.size() > 0) { |
|
|
|
try { |
|
|
|
// 文件生成
|
|
|
|
Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir(ImportTaskConstants.IC_PROPERTY_MANAGEMENT, "import", "error_des"); |
|
|
|
String fileName = UUID.randomUUID().toString().concat(".xlsx"); |
|
|
|
|
|
|
|
fileItem = new DiskFileItemFactory(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD, errorDescDir.toFile()) |
|
|
|
.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName); |
|
|
|
os = fileItem.getOutputStream(); |
|
|
|
|
|
|
|
EasyExcel.write(os, IcPropertyManagementImportExcelData.ErrorRow.class).sheet("信息列表").doWrite(errorRows); |
|
|
|
// 文件上传oss
|
|
|
|
Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); |
|
|
|
if (errorDesFileUploadResult.success()) { |
|
|
|
errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); |
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
IOUtils.closeQuietly(os); |
|
|
|
if (!fileItem.isInMemory()) { |
|
|
|
try { |
|
|
|
fileItem.delete(); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("【物业管理表ic_property_management】删除错误描述临时文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Result result = ImportTaskUtils.finishImportTask( |
|
|
|
importTaskId, |
|
|
|
failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, |
|
|
|
errorDesFileUrl, |
|
|
|
""); |
|
|
|
|
|
|
|
if (!result.success()) { |
|
|
|
log.error("【物业管理表ic_property_management】finishImportTask失败"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
String errorMsg = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
log.error("【物业管理表ic_property_management】出错:{}", 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("【物业管理表ic_property_management】导入记录状态修改为'完成'失败"); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
// 删除临时文件
|
|
|
|
if (Files.exists(filePath)) { |
|
|
|
try { |
|
|
|
Files.delete(filePath); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|