|
|
@ -19,6 +19,7 @@ package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
@ -26,6 +27,8 @@ import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.IcResiUserConstant; |
|
|
|
import com.epmet.constant.SystemMessageType; |
|
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
|
import com.epmet.dao.IcUserChangeRecordDao; |
|
|
|
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|
|
@ -33,16 +36,21 @@ import com.epmet.dto.IcUserChangeRecordDTO; |
|
|
|
import com.epmet.dto.form.IcResiUserChangeRecordFormDTO; |
|
|
|
import com.epmet.dto.form.IcUserChangeRecordInitFormDTO; |
|
|
|
import com.epmet.dto.form.IcUsercategoryAnalysisFormDTO; |
|
|
|
import com.epmet.dto.form.SystemMsgFormDTO; |
|
|
|
import com.epmet.dto.form.dataSync.AddRecordByResidentCategoryFormDTO; |
|
|
|
import com.epmet.dto.result.AllGridsByUserIdResultDTO; |
|
|
|
import com.epmet.dto.result.BuildingResultDTO; |
|
|
|
import com.epmet.dto.result.IcUserChangeRecordResultDTO; |
|
|
|
import com.epmet.dto.result.IcUsercategoryAnalysisResultDTO; |
|
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.entity.IcUserChangeDetailedEntity; |
|
|
|
import com.epmet.entity.IcUserChangeRecordEntity; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
|
import com.epmet.service.IcUserChangeDetailedService; |
|
|
|
import com.epmet.service.IcUserChangeRecordService; |
|
|
|
import com.epmet.util.ModuleConstant; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -77,7 +85,8 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR |
|
|
|
private IcUserChangeRecordService icUserChangeRecordService; |
|
|
|
@Autowired |
|
|
|
private IcUserChangeDetailedService icUserChangeDetailedService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
@ -176,6 +185,64 @@ public class IcUserChangeRecordServiceImpl extends BaseServiceImpl<IcUserChangeR |
|
|
|
return baseDao.deleteByIcResiUserId(icResiUserId,currentStaffId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 根据居民类别新增变更记录 |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/10/14 09:04 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void addRecordByResidentCategory(AddRecordByResidentCategoryFormDTO formDTO) { |
|
|
|
formDTO.getIcResiUserIds().forEach(i -> { |
|
|
|
IcResiUserEntity entity = icResiUserDao.selectById(i.getIcResiUserId()); |
|
|
|
// 未变更前的记录
|
|
|
|
Map<String, String> categoryMap = icResiUserDao.getCategoryListMap(Arrays.asList(formDTO.getColumnName()), entity.getId()); |
|
|
|
// 修改前跟要修改的值一样,不新增变更记录
|
|
|
|
if (!categoryMap.get(formDTO.getColumnName()).equals(i.getCategoryStatus())) { |
|
|
|
IcUserChangeRecordEntity icUserChangeRecordEntity = new IcUserChangeRecordEntity(); |
|
|
|
icUserChangeRecordEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
icUserChangeRecordEntity.setOperatorId(formDTO.getUserId()); |
|
|
|
icUserChangeRecordEntity.setIcUserId(entity.getId()); |
|
|
|
icUserChangeRecordEntity.setOperatorName(formDTO.getUserName()); |
|
|
|
icUserChangeRecordEntity.setIcUserName(entity.getName()); |
|
|
|
icUserChangeRecordEntity.setType(IcResiUserConstant.USER_CATEGORY); |
|
|
|
icUserChangeRecordEntity.setTypeName(IcResiUserConstant.USER_CATEGORY_CN); |
|
|
|
icUserChangeRecordEntity.setBeforeChangeName(categoryMap.get(formDTO.getColumnName()).equals(NumConstant.ONE_STR) ? formDTO.getLabel().concat(":是") : formDTO.getLabel().concat(":否")); |
|
|
|
icUserChangeRecordEntity.setAfterChangeName(i.getCategoryStatus().equals(NumConstant.ONE_STR) ? formDTO.getLabel().concat(":是") : formDTO.getLabel().concat(":否")); |
|
|
|
icUserChangeRecordEntity.setChangeTime(new Date()); |
|
|
|
icUserChangeRecordEntity.setRemark(formDTO.getColumnName().concat("数据更新")); |
|
|
|
baseDao.insert(icUserChangeRecordEntity); |
|
|
|
|
|
|
|
IcUserChangeDetailedEntity icUserChangeDetailedEntity = new IcUserChangeDetailedEntity(); |
|
|
|
icUserChangeDetailedEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
icUserChangeDetailedEntity.setIcUserChangeRecordId(icUserChangeRecordEntity.getId()); |
|
|
|
icUserChangeDetailedEntity.setPids(StringUtils.isNotBlank(entity.getPids()) && entity.getPids().contains(":") ? entity.getPids().substring(NumConstant.ZERO, entity.getPids().lastIndexOf(":")) : ""); |
|
|
|
icUserChangeDetailedEntity.setAgencyId(entity.getAgencyId()); |
|
|
|
icUserChangeDetailedEntity.setGridId(entity.getGridId()); |
|
|
|
icUserChangeDetailedEntity.setNeighborHoodId(entity.getVillageId()); |
|
|
|
icUserChangeDetailedEntity.setBuildingId(entity.getBuildId()); |
|
|
|
icUserChangeDetailedEntity.setBuildingUnitId(entity.getUnitId()); |
|
|
|
icUserChangeDetailedEntity.setHouseId(entity.getHomeId()); |
|
|
|
icUserChangeDetailedEntity.setIcUserId(entity.getId()); |
|
|
|
icUserChangeDetailedEntity.setType(IcResiUserConstant.USER_CATEGORY); |
|
|
|
icUserChangeDetailedEntity.setTypeName(IcResiUserConstant.USER_CATEGORY_CN); |
|
|
|
icUserChangeDetailedEntity.setFieldName(formDTO.getColumnName()); |
|
|
|
icUserChangeDetailedEntity.setValue(i.getCategoryStatus().equals(NumConstant.ONE_STR) ? NumConstant.ONE : NumConstant.ONE_NEG); |
|
|
|
icUserChangeDetailedService.insert(icUserChangeDetailedEntity); |
|
|
|
|
|
|
|
// 发送消息
|
|
|
|
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); |
|
|
|
mqMsg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
mqMsg.setIcResiUser(formDTO.getUserId()); |
|
|
|
SystemMsgFormDTO form = new SystemMsgFormDTO(); |
|
|
|
form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT); |
|
|
|
form.setContent(mqMsg); |
|
|
|
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 按客户初始化客户下居民的变更记录、变更明细数据 |
|
|
|