| 
						
						
						
					 | 
					@ -1,9 +1,13 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					package com.epmet.service.impl; | 
					 | 
					 | 
					package com.epmet.service.impl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.alibaba.excel.EasyExcel; | 
					 | 
					 | 
					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.LambdaQueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
					 | 
					 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.Constant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.Constant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.constant.StrConstant; | 
					 | 
					 | 
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
					 | 
					 | 
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -18,6 +22,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
					 | 
					 | 
					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.AgencyInfoCache; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
					 | 
					 | 
					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.ConvertUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.DateUtils; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.commons.tools.utils.FileUtils; | 
					 | 
					 | 
					import com.epmet.commons.tools.utils.FileUtils; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -28,9 +33,7 @@ import com.epmet.dao.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.SysDictDataDTO; | 
					 | 
					 | 
					import com.epmet.dto.SysDictDataDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.form.*; | 
					 | 
					 | 
					import com.epmet.dto.form.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.result.*; | 
					 | 
					 | 
					import com.epmet.dto.result.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import com.epmet.entity.IcEnterpriseEntity; | 
					 | 
					 | 
					import com.epmet.entity.*; | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.IcEnterprisePatrolAttachmentEntity; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.IcEnterprisePatrolRecordEntity; | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.excel.EnterpriseImportExcelDTO; | 
					 | 
					 | 
					import com.epmet.excel.EnterpriseImportExcelDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.excel.handler.IcEnterpriseExcelImportListener; | 
					 | 
					 | 
					import com.epmet.excel.handler.IcEnterpriseExcelImportListener; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.feign.EpmetAdminOpenFeignClient; | 
					 | 
					 | 
					import com.epmet.feign.EpmetAdminOpenFeignClient; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -38,6 +41,7 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.feign.EpmetMessageOpenFeignClient; | 
					 | 
					 | 
					import com.epmet.feign.EpmetMessageOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.feign.OssFeignClient; | 
					 | 
					 | 
					import com.epmet.feign.OssFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.CoverageService; | 
					 | 
					 | 
					import com.epmet.service.CoverageService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.service.IcEnterpriseChangeRecordService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.IcEnterpriseService; | 
					 | 
					 | 
					import com.epmet.service.IcEnterpriseService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
					 | 
					 | 
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.github.pagehelper.PageInfo; | 
					 | 
					 | 
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -90,6 +94,13 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private CustomerGridDao customerGridDao; | 
					 | 
					 | 
					    private CustomerGridDao customerGridDao; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Resource | 
					 | 
					 | 
					    @Resource | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private EpmetMessageOpenFeignClient messageOpenFeignClient; | 
					 | 
					 | 
					    private EpmetMessageOpenFeignClient messageOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private IcEnterpriseChangeRecordService icEnterpriseChangeRecordService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Autowired | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private LoginUserUtil loginUserUtil; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 企事业单位巡查】新增/编辑 | 
					 | 
					 | 
					     * 企事业单位巡查】新增/编辑 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -106,23 +117,27 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); | 
					 | 
					 | 
					        AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (null == agencyInfoCache) { | 
					 | 
					 | 
					        if (null == agencyInfoCache) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"组织信息查询异常","组织信息查询异常"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "组织信息查询异常", "组织信息查询异常"); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        IcEnterpriseEntity enterpriseEntity = ConvertUtils.sourceToTarget(formDTO, IcEnterpriseEntity.class); | 
					 | 
					 | 
					        IcEnterpriseEntity enterpriseEntity = ConvertUtils.sourceToTarget(formDTO, IcEnterpriseEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        enterpriseEntity.setAgencyPids(agencyInfoCache.getPids()); | 
					 | 
					 | 
					        enterpriseEntity.setAgencyPids(agencyInfoCache.getPids()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if(StringUtils.isBlank(formDTO.getEnterpriseId())){ | 
					 | 
					 | 
					        if (StringUtils.isBlank(formDTO.getEnterpriseId())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            enterpriseEntity.setLatestResult(StrConstant.EPMETY_STR); | 
					 | 
					 | 
					            enterpriseEntity.setLatestResult(StrConstant.EPMETY_STR); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            enterpriseEntity.setSourceType(CommonOperateTypeEnum.ADD.getCode()); | 
					 | 
					 | 
					            enterpriseEntity.setSourceType(CommonOperateTypeEnum.ADD.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            baseDao.insert(enterpriseEntity); | 
					 | 
					 | 
					            baseDao.insert(enterpriseEntity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        }else{ | 
					 | 
					 | 
					        } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //如果是编辑判断下权限
 | 
					 | 
					 | 
					            //如果是编辑判断下权限
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcEnterpriseEntity origin=baseDao.selectById(formDTO.getEnterpriseId()); | 
					 | 
					 | 
					            IcEnterpriseEntity origin = baseDao.selectById(formDTO.getEnterpriseId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); | 
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) { | 
					 | 
					 | 
					            if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId()); | 
					 | 
					 | 
					                AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; | 
					 | 
					 | 
					                String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("修改失败,当前场所属于%s", agencyName)); | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("修改失败,当前场所属于%s", agencyName)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 历史记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            log(origin, formDTO, "UPD"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            enterpriseEntity.setId(formDTO.getEnterpriseId()); | 
					 | 
					 | 
					            enterpriseEntity.setId(formDTO.getEnterpriseId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //获取一下最新的巡检时间和巡检结果
 | 
					 | 
					 | 
					            //获取一下最新的巡检时间和巡检结果
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper(); | 
					 | 
					 | 
					            LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -146,14 +161,14 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public String addOrUpdatePatrol(EnterprisePatrolFormDTO formDTO) { | 
					 | 
					 | 
					    public String addOrUpdatePatrol(EnterprisePatrolFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcEnterprisePatrolRecordEntity patrolRecordEntity=ConvertUtils.sourceToTarget(formDTO,IcEnterprisePatrolRecordEntity.class); | 
					 | 
					 | 
					        IcEnterprisePatrolRecordEntity patrolRecordEntity = ConvertUtils.sourceToTarget(formDTO, IcEnterprisePatrolRecordEntity.class); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if(StringUtils.isBlank(formDTO.getPatrolId())){ | 
					 | 
					 | 
					        if (StringUtils.isBlank(formDTO.getPatrolId())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            enterprisePatrolRecordDao.insert(patrolRecordEntity); | 
					 | 
					 | 
					            enterprisePatrolRecordDao.insert(patrolRecordEntity); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        }else{ | 
					 | 
					 | 
					        } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            patrolRecordEntity.setId(formDTO.getPatrolId()); | 
					 | 
					 | 
					            patrolRecordEntity.setId(formDTO.getPatrolId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            enterprisePatrolRecordDao.updateById(patrolRecordEntity); | 
					 | 
					 | 
					            enterprisePatrolRecordDao.updateById(patrolRecordEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //删除之前的图片
 | 
					 | 
					 | 
					            //删除之前的图片
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            enterprisePatrolAttachmentDao.deleteByPatrolId(formDTO.getPatrolId(),formDTO.getUserId()); | 
					 | 
					 | 
					            enterprisePatrolAttachmentDao.deleteByPatrolId(formDTO.getPatrolId(), formDTO.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        int sort = 1; | 
					 | 
					 | 
					        int sort = 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        for (String imgUrl : formDTO.getImgList()) { | 
					 | 
					 | 
					        for (String imgUrl : formDTO.getImgList()) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -168,7 +183,7 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            sort++; | 
					 | 
					 | 
					            sort++; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 更新主表的最新结果和最新检查时间
 | 
					 | 
					 | 
					        // 更新主表的最新结果和最新检查时间
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        baseDao.updateLatestPatrol(formDTO.getEnterpriseId(),patrolRecordEntity.getPatrolTime(),patrolRecordEntity.getResult(),formDTO.getUserId()); | 
					 | 
					 | 
					        baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), patrolRecordEntity.getPatrolTime(), patrolRecordEntity.getResult(), formDTO.getUserId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        return patrolRecordEntity.getId(); | 
					 | 
					 | 
					        return patrolRecordEntity.getId(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -179,26 +194,27 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void delPatrol(String patrolId,String currentUserId) { | 
					 | 
					 | 
					    public void delPatrol(String patrolId, String currentUserId) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcEnterprisePatrolRecordEntity origin=enterprisePatrolRecordDao.selectById(patrolId); | 
					 | 
					 | 
					        IcEnterprisePatrolRecordEntity origin = enterprisePatrolRecordDao.selectById(patrolId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if(null==origin){ | 
					 | 
					 | 
					        if (null == origin) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            return; | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //1、删除巡查记录
 | 
					 | 
					 | 
					        //1、删除巡查记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        enterprisePatrolRecordDao.deleteById(patrolId); | 
					 | 
					 | 
					        enterprisePatrolRecordDao.deleteById(patrolId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //2、删除之前的图片
 | 
					 | 
					 | 
					        //2、删除之前的图片
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        enterprisePatrolAttachmentDao.deleteByPatrolId(patrolId,currentUserId); | 
					 | 
					 | 
					        enterprisePatrolAttachmentDao.deleteByPatrolId(patrolId, currentUserId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        //3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空
 | 
					 | 
					 | 
					        //3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper=new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					        LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId,origin.getEnterpriseId()); | 
					 | 
					 | 
					        queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, origin.getEnterpriseId()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (NumConstant.ZERO == enterprisePatrolRecordDao.selectCount(queryWrapper)) { | 
					 | 
					 | 
					        if (NumConstant.ZERO == enterprisePatrolRecordDao.selectCount(queryWrapper)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            baseDao.updateLatestPatrol(origin.getEnterpriseId(),null,StrConstant.EPMETY_STR,currentUserId); | 
					 | 
					 | 
					            baseDao.updateLatestPatrol(origin.getEnterpriseId(), null, StrConstant.EPMETY_STR, currentUserId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 巡查记录列表 | 
					 | 
					 | 
					     * 巡查记录列表 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 暂时不分页 | 
					 | 
					 | 
					     * 暂时不分页 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @param enterpriseId | 
					 | 
					 | 
					     * @param enterpriseId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -230,9 +246,9 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            resultDto.setAgencyName(gridInfoCache.getAgencyName()); | 
					 | 
					 | 
					            resultDto.setAgencyName(gridInfoCache.getAgencyName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        String placeTypeName = coverageCategoryDictDao.selectCategoryName(customerId, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), resultDto.getPlaceType()); | 
					 | 
					 | 
					        String placeTypeName = coverageCategoryDictDao.selectCategoryName(customerId, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), resultDto.getPlaceType()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if(StringUtils.isNotBlank(placeTypeName)){ | 
					 | 
					 | 
					        if (StringUtils.isNotBlank(placeTypeName)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            resultDto.setPlaceTypeName(placeTypeName); | 
					 | 
					 | 
					            resultDto.setPlaceTypeName(placeTypeName); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        }else{ | 
					 | 
					 | 
					        } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            resultDto.setPlaceTypeName(coverageCategoryDictDao.selectCategoryName(Constant.DEFAULT_CUSTOMER, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), resultDto.getPlaceType())); | 
					 | 
					 | 
					            resultDto.setPlaceTypeName(coverageCategoryDictDao.selectCategoryName(Constant.DEFAULT_CUSTOMER, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), resultDto.getPlaceType())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //规模名称
 | 
					 | 
					 | 
					        //规模名称
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -258,12 +274,17 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void delete(String enterpriseId, String customerId, String userId) { | 
					 | 
					 | 
					    public void delete(String enterpriseId, String customerId, String userId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //如果是编辑判断下权限要删除的记录的agencyId要与当前登录用户的agencyId一致
 | 
					 | 
					 | 
					        //如果是编辑判断下权限要删除的记录的agencyId要与当前登录用户的agencyId一致
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        IcEnterpriseEntity origin = baseDao.selectById(enterpriseId); | 
					 | 
					 | 
					        IcEnterpriseEntity origin = baseDao.selectById(enterpriseId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); | 
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) { | 
					 | 
					 | 
					        if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId()); | 
					 | 
					 | 
					            AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; | 
					 | 
					 | 
					            String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("删除失败,当前场所属于%s", agencyName)); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("删除失败,当前场所属于%s", agencyName)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 历史记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        log(origin, null, "DEL"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        baseDao.deleteById(enterpriseId); | 
					 | 
					 | 
					        baseDao.deleteById(enterpriseId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -296,9 +317,9 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    detailDTO.setAgencyName(gridInfoCache.getAgencyName()); | 
					 | 
					 | 
					                    detailDTO.setAgencyName(gridInfoCache.getAgencyName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                String placeTypeName = coverageCategoryDictDao.selectCategoryName(formDTO.getCustomerId(), CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), detailDTO.getPlaceType()); | 
					 | 
					 | 
					                String placeTypeName = coverageCategoryDictDao.selectCategoryName(formDTO.getCustomerId(), CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), detailDTO.getPlaceType()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                if(StringUtils.isNotBlank(placeTypeName)){ | 
					 | 
					 | 
					                if (StringUtils.isNotBlank(placeTypeName)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    detailDTO.setPlaceTypeName(placeTypeName); | 
					 | 
					 | 
					                    detailDTO.setPlaceTypeName(placeTypeName); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }else{ | 
					 | 
					 | 
					                } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    detailDTO.setPlaceTypeName(coverageCategoryDictDao.selectCategoryName(Constant.DEFAULT_CUSTOMER, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), detailDTO.getPlaceType())); | 
					 | 
					 | 
					                    detailDTO.setPlaceTypeName(coverageCategoryDictDao.selectCategoryName(Constant.DEFAULT_CUSTOMER, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), detailDTO.getPlaceType())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                detailDTO.setScaleName(dictMap.containsKey(detailDTO.getScale()) ? dictMap.get(detailDTO.getScale()) : StrConstant.EPMETY_STR); | 
					 | 
					 | 
					                detailDTO.setScaleName(dictMap.containsKey(detailDTO.getScale()) ? dictMap.get(detailDTO.getScale()) : StrConstant.EPMETY_STR); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -309,26 +330,26 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Async | 
					 | 
					 | 
					    @Async | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public void execAsyncExcelImport(Path filePath, String importTaskId,String customerId,String userId) { | 
					 | 
					 | 
					    public void execAsyncExcelImport(Path filePath, String importTaskId, String customerId, String userId) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        try { | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //获取当前登录用户所属组织id
 | 
					 | 
					 | 
					            //获取当前登录用户所属组织id
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); | 
					 | 
					 | 
					            CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(customerId, userId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //1、查询 ic_coverage_category_dict 注意key:场所的名称  value:编码
 | 
					 | 
					 | 
					            //1、查询 ic_coverage_category_dict 注意key:场所的名称  value:编码
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(customerId, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode()); | 
					 | 
					 | 
					            List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(customerId, CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Map<String, String> placeTypeMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getLabel, IcCoverageCategoryDictListResultDTO::getValue)); | 
					 | 
					 | 
					            Map<String, String> placeTypeMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getLabel, IcCoverageCategoryDictListResultDTO::getValue)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //2、规模名称
 | 
					 | 
					 | 
					            //2、规模名称
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Result<List<SysDictDataDTO>> dictMapRes = adminOpenFeignClient.dictDataList(DictTypeEnum.SCALE.getCode()); | 
					 | 
					 | 
					            Result<List<SysDictDataDTO>> dictMapRes = adminOpenFeignClient.dictDataList(DictTypeEnum.SCALE.getCode()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Map<String, String> scaleMap = dictMapRes.success() && CollectionUtils.isNotEmpty(dictMapRes.getData()) ? dictMapRes.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictLabel,SysDictDataDTO::getDictValue)) : new HashMap<>(); | 
					 | 
					 | 
					            Map<String, String> scaleMap = dictMapRes.success() && CollectionUtils.isNotEmpty(dictMapRes.getData()) ? dictMapRes.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictLabel, SysDictDataDTO::getDictValue)) : new HashMap<>(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //3、当前工作人员所属组织下的网格列表
 | 
					 | 
					 | 
					            //3、当前工作人员所属组织下的网格列表
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            List<GridListResultDTO> gridList = customerGridDao.selectGridList(staffInfo.getAgencyId()); | 
					 | 
					 | 
					            List<GridListResultDTO> gridList = customerGridDao.selectGridList(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (CollectionUtils.isEmpty(gridList)) { | 
					 | 
					 | 
					            if (CollectionUtils.isEmpty(gridList)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下没有网格", "当前组织下没有直属网格"); | 
					 | 
					 | 
					                throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下没有网格", "当前组织下没有直属网格"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Map<String,String> gridMap=gridList.stream().collect(Collectors.toMap(GridListResultDTO::getGridName,GridListResultDTO::getGridId)); | 
					 | 
					 | 
					            Map<String, String> gridMap = gridList.stream().collect(Collectors.toMap(GridListResultDTO::getGridName, GridListResultDTO::getGridId)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcEnterpriseExcelImportListener listener = new IcEnterpriseExcelImportListener(customerId,staffInfo, this,placeTypeMap,scaleMap,gridMap); | 
					 | 
					 | 
					            IcEnterpriseExcelImportListener listener = new IcEnterpriseExcelImportListener(customerId, staffInfo, this, placeTypeMap, scaleMap, gridMap); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            EasyExcel.read(filePath.toFile(), EnterpriseImportExcelDTO.class, listener).headRowNumber(1).sheet(0).doRead(); | 
					 | 
					 | 
					            EasyExcel.read(filePath.toFile(), EnterpriseImportExcelDTO.class, listener).headRowNumber(1).sheet(0).doRead(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Path errorDescFile = null; | 
					 | 
					 | 
					            Path errorDescFile = null; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -403,13 +424,13 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public void sendEnterprisePatrolRemindMessage() { | 
					 | 
					 | 
					    public void sendEnterprisePatrolRemindMessage() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //一天后
 | 
					 | 
					 | 
					        //一天后
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        Date afterThreeDayDate=DateUtils.calDateBaseDay(new Date(), NumConstant.ONE); | 
					 | 
					 | 
					        Date afterThreeDayDate = DateUtils.calDateBaseDay(new Date(), NumConstant.ONE); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        String dateId= DateUtils.format(afterThreeDayDate, DateUtils.DATE_PATTERN_YYYYMMDD); | 
					 | 
					 | 
					        String dateId = DateUtils.format(afterThreeDayDate, DateUtils.DATE_PATTERN_YYYYMMDD); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> wrapper = new LambdaQueryWrapper<>(); | 
					 | 
					 | 
					        LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        wrapper.apply("DATE_FORMAT(REVIEW_TIME,'%Y%m%d') = " + dateId); | 
					 | 
					 | 
					        wrapper.apply("DATE_FORMAT(REVIEW_TIME,'%Y%m%d') = " + dateId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        List<IcEnterprisePatrolRecordEntity> list = enterprisePatrolRecordDao.selectList(wrapper); | 
					 | 
					 | 
					        List<IcEnterprisePatrolRecordEntity> list = enterprisePatrolRecordDao.selectList(wrapper); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(list)) { | 
					 | 
					 | 
					        if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            List<SendSmsFormDTO> smsList=new ArrayList<>(); | 
					 | 
					 | 
					            List<SendSmsFormDTO> smsList = new ArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            list.forEach(item -> { | 
					 | 
					 | 
					            list.forEach(item -> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                IcEnterpriseEntity enterprise = baseDao.selectById(item.getEnterpriseId()); | 
					 | 
					 | 
					                IcEnterpriseEntity enterprise = baseDao.selectById(item.getEnterpriseId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                if (null != enterprise) { | 
					 | 
					 | 
					                if (null != enterprise) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -418,8 +439,8 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    sms.setMobile(item.getMobile()); | 
					 | 
					 | 
					                    sms.setMobile(item.getMobile()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    sms.setAliyunTemplateCode(SmsTemplateConstant.ENTERPRISE_PATROL_TEM); | 
					 | 
					 | 
					                    sms.setAliyunTemplateCode(SmsTemplateConstant.ENTERPRISE_PATROL_TEM); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    Map<String, String> paramMap = new HashMap<>(); | 
					 | 
					 | 
					                    Map<String, String> paramMap = new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    paramMap.put("name",enterprise.getPlaceOrgName()); | 
					 | 
					 | 
					                    paramMap.put("name", enterprise.getPlaceOrgName()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                    paramMap.put("date",DateUtils.format(item.getReviewTime(),DateUtils.DATE_PATTERN)); | 
					 | 
					 | 
					                    paramMap.put("date", DateUtils.format(item.getReviewTime(), DateUtils.DATE_PATTERN)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    sms.setParamMap(paramMap); | 
					 | 
					 | 
					                    sms.setParamMap(paramMap); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    smsList.add(sms); | 
					 | 
					 | 
					                    smsList.add(sms); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                } | 
					 | 
					 | 
					                } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -428,6 +449,35 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    public PageData<EnterpriseDetailDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        IPage<IcEnterpriseEntity> page = baseDao.selectPage( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                getPage(params, FieldConstant.CREATED_TIME, false), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                getWrapper(params) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return getPageData(page, EnterpriseDetailDTO.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private QueryWrapper<IcEnterpriseEntity> getWrapper(Map<String, Object> params) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String id = (String) params.get(FieldConstant.ID_HUMP); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String placeOrgName = (String) params.get("placeOrgName"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String mobile = (String) params.get("mobile"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String gridId = (String) params.get("gridId"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String placeType = (String) params.get("placeType"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String scale = (String) params.get("scale"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        String result = (String) params.get("result"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        QueryWrapper<IcEnterpriseEntity> wrapper = new QueryWrapper<>(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(placeOrgName), "PLACE_ORG_NAME", placeOrgName); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(mobile), "MOBILE", mobile); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(placeType), "PLACE_TYPE", placeType); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(scale), "SCALE", scale); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wrapper.eq(StringUtils.isNotBlank(result), "LATEST_RESULT", result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return wrapper; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { | 
					 | 
					 | 
					    private CustomerStaffInfoCacheResult queryCurrentStaff(String customerId, String userId) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); | 
					 | 
					 | 
					        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (null == staffInfo) { | 
					 | 
					 | 
					        if (null == staffInfo) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -437,6 +487,79 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    public List<IcEnterpriseEntity> selectForUniqueName(String gridId, String placeOrgName, String enterpriseId) { | 
					 | 
					 | 
					    public List<IcEnterpriseEntity> selectForUniqueName(String gridId, String placeOrgName, String enterpriseId) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        return  baseDao.selectForUniqueName(gridId, placeOrgName, enterpriseId); | 
					 | 
					 | 
					        return baseDao.selectForUniqueName(gridId, placeOrgName, enterpriseId); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 记录操作日志 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param origin | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param type | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return void | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @author zhy | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @date 2022/8/16 15:36 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    private void log(IcEnterpriseEntity origin, EnterpriseFormDTO formDTO, String type) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 历史记录
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        IcEnterpriseChangeRecordEntity record = ConvertUtils.sourceToTarget(origin, IcEnterpriseChangeRecordEntity.class); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<IcCoverageCategoryDictListResultDTO> categoryList = coverageService.dictMap(loginUserUtil.getLoginUserCustomerId(), "enterprise_patrol"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, String> categoryMap = categoryList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        CustomerGridEntity originGrid = customerGridDao.selectById(origin.getGridId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Map<String, String> scaleMap; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        Result<Map<String, String>> result = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.SCALE.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (!result.success() || null == result.getData()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            throw new EpmetException("查询字典信息失败" + JSON.toJSONString(result)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            scaleMap = result.getData(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (formDTO != null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getPlaceType().equals(formDTO.getPlaceType())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setPlaceType(categoryMap.get(origin.getPlaceType()).concat("->").concat(categoryMap.get(formDTO.getPlaceType()))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setPlaceType(categoryMap.get(origin.getPlaceType())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getGridId().equals(formDTO.getGridId())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                CustomerGridEntity thisGrid = customerGridDao.selectById(formDTO.getGridId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setGridId(origin.getGridId().concat("->").concat(thisGrid.getGridName())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (originGrid != null && thisGrid != null) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    record.setGridId(originGrid.getGridName().concat("->").concat(formDTO.getGridId())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setGridId(originGrid.getGridName()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getPlaceOrgName().equals(formDTO.getPlaceOrgName())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setPlaceOrgName(origin.getPlaceOrgName().concat("->").concat(formDTO.getPlaceOrgName())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getScale().equals(formDTO.getScale())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setScale(scaleMap.get(origin.getScale()).concat("->").concat(scaleMap.get(formDTO.getScale()))); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setScale(scaleMap.get(origin.getScale())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getPersonInCharge().equals(formDTO.getPersonInCharge())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setPersonInCharge(origin.getPersonInCharge().concat("->").concat(formDTO.getPersonInCharge())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getMobile().equals(formDTO.getMobile())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setMobile(origin.getMobile().concat("->").concat(formDTO.getMobile())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (!origin.getAddress().equals(formDTO.getAddress())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                record.setAddress(origin.getAddress().concat("->").concat(formDTO.getAddress())); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setId(null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setCreatedBy(null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setCreatedTime(null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setUpdatedBy(null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setUpdatedTime(null); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setOriginId(origin.getId()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        record.setType(type); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        icEnterpriseChangeRecordService.insert(record); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} |