|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
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.metadata.IPage; |
|
|
@ -21,22 +22,19 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.FileUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.IcEnterpriseChangeRecordDTO; |
|
|
|
import com.epmet.dto.SysDictDataDTO; |
|
|
|
import com.epmet.dto.form.EnterpriseFormDTO; |
|
|
|
import com.epmet.dto.form.EnterprisePageFormDTO; |
|
|
|
import com.epmet.dto.form.EnterprisePatrolFormDTO; |
|
|
|
import com.epmet.dto.form.ImportTaskCommonFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcEnterpriseChangeRecordEntity; |
|
|
|
import com.epmet.entity.IcEnterpriseEntity; |
|
|
|
import com.epmet.entity.IcEnterprisePatrolAttachmentEntity; |
|
|
|
import com.epmet.entity.IcEnterprisePatrolRecordEntity; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.excel.EnterpriseImportExcelDTO; |
|
|
|
import com.epmet.excel.handler.IcEnterpriseExcelImportListener; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
@ -98,6 +96,10 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
private CustomerGridDao customerGridDao; |
|
|
|
@Autowired |
|
|
|
private IcEnterpriseChangeRecordService icEnterpriseChangeRecordService; |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
/** |
|
|
|
* 企事业单位巡查】新增/编辑 |
|
|
@ -133,7 +135,7 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
} |
|
|
|
|
|
|
|
// 历史记录
|
|
|
|
log(origin,"UPD"); |
|
|
|
log(origin, formDTO, "UPD"); |
|
|
|
|
|
|
|
enterpriseEntity.setId(formDTO.getEnterpriseId()); |
|
|
|
//获取一下最新的巡检时间和巡检结果
|
|
|
@ -211,6 +213,7 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
/** |
|
|
|
* 巡查记录列表 |
|
|
|
* 暂时不分页 |
|
|
|
* |
|
|
|
* @param enterpriseId |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -279,7 +282,7 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
} |
|
|
|
|
|
|
|
// 历史记录
|
|
|
|
log(origin,"DEL"); |
|
|
|
log(origin, null, "DEL"); |
|
|
|
|
|
|
|
baseDao.deleteById(enterpriseId); |
|
|
|
} |
|
|
@ -468,9 +471,50 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
* @author zhy |
|
|
|
* @date 2022/8/16 15:36 |
|
|
|
*/ |
|
|
|
private void log(IcEnterpriseEntity origin, String type){ |
|
|
|
private void log(IcEnterpriseEntity origin, EnterpriseFormDTO formDTO, String type) { |
|
|
|
// 历史记录
|
|
|
|
IcEnterpriseChangeRecordEntity record = ConvertUtils.sourceToTarget(origin, IcEnterpriseChangeRecordEntity.class); |
|
|
|
|
|
|
|
if (formDTO != null) { |
|
|
|
if (!origin.getPlaceType().equals(formDTO.getPlaceType())) { |
|
|
|
record.setPlaceType(record.getPlaceType().concat("->").concat(formDTO.getPlaceType())); |
|
|
|
List<IcCoverageCategoryDictListResultDTO> categoryList = coverageService.dictMap(loginUserUtil.getLoginUserCustomerId(), "enterprise_patrol"); |
|
|
|
Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); |
|
|
|
record.setPlaceType(categoryMap.get(record.getPlaceType()).concat("->").concat(categoryMap.get(formDTO.getPlaceType()))); |
|
|
|
} |
|
|
|
|
|
|
|
if (!origin.getGridId().equals(formDTO.getGridId())) { |
|
|
|
CustomerGridEntity originGrid = customerGridDao.selectById(record.getGridId()); |
|
|
|
CustomerGridEntity thisGrid = customerGridDao.selectById(formDTO.getGridId()); |
|
|
|
record.setGridId(record.getGridId().concat("->").concat(thisGrid.getGridName())); |
|
|
|
if (originGrid != null && thisGrid != null) { |
|
|
|
record.setGridId(originGrid.getGridName().concat("->").concat(formDTO.getGridId())); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!origin.getPlaceOrgName().equals(formDTO.getPlaceOrgName())) { |
|
|
|
record.setPlaceOrgName(record.getPlaceOrgName().concat("->").concat(record.getPlaceOrgName())); |
|
|
|
} |
|
|
|
if (!origin.getScale().equals(formDTO.getScale())) { |
|
|
|
record.setScale(record.getScale().concat("->").concat(formDTO.getScale())); |
|
|
|
Result<Map<String, String>> result = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.SCALE.getCode()); |
|
|
|
if (!result.success() || null == result.getData()) { |
|
|
|
throw new EpmetException("查询字典信息失败" + JSON.toJSONString(result)); |
|
|
|
} else { |
|
|
|
Map<String, String> scaleMap = result.getData(); |
|
|
|
record.setScale(scaleMap.get(record.getScale()).concat("->").concat(scaleMap.get(formDTO.getScale()))); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!origin.getPersonInCharge().equals(formDTO.getPersonInCharge())) { |
|
|
|
record.setPersonInCharge(record.getPersonInCharge().concat("->").concat(formDTO.getPersonInCharge())); |
|
|
|
} |
|
|
|
if (!origin.getMobile().equals(formDTO.getMobile())) { |
|
|
|
record.setMobile(record.getMobile().concat("->").concat(formDTO.getMobile())); |
|
|
|
} |
|
|
|
if (!origin.getAddress().equals(formDTO.getAddress())) { |
|
|
|
record.setAddress(record.getAddress().concat("->").concat(formDTO.getAddress())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
record.setId(null); |
|
|
|
record.setCreatedBy(null); |
|
|
|
record.setCreatedTime(null); |
|
|
|