|
|
@ -30,10 +30,7 @@ import com.elink.esua.epdc.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.enums.EpdcDelFlagEnum; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.StrConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.*; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.UserAuthTypeEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.UserSexEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.UserTagEnum; |
|
|
@ -57,6 +54,12 @@ import com.elink.esua.epdc.dto.epdc.EpdcGridLeaderRegisterDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.UserCarInfoDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.*; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.*; |
|
|
|
import com.elink.esua.epdc.dto.management.form.GridDelFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.management.form.UserAddFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.management.form.UserDelFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.management.form.UserUpdFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.management.result.GlobalResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.result.SysDeptInfoResultDTO; |
|
|
|
import com.elink.esua.epdc.entity.*; |
|
|
|
import com.elink.esua.epdc.enums.AppUserAuditStateEnum; |
|
|
|
import com.elink.esua.epdc.enums.AppUserStatesEnum; |
|
|
@ -64,6 +67,7 @@ import com.elink.esua.epdc.enums.PartyMemberRegFlagEnum; |
|
|
|
import com.elink.esua.epdc.excel.UserExcel; |
|
|
|
import com.elink.esua.epdc.exception.UserModuleErrorCode; |
|
|
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.feign.CommunityManageFeignClient; |
|
|
|
import com.elink.esua.epdc.feign.PointsFeignClient; |
|
|
|
import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; |
|
|
|
import com.elink.esua.epdc.rocketmq.dto.UserModifyDTO; |
|
|
@ -71,7 +75,9 @@ import com.elink.esua.epdc.rocketmq.producer.UserModifyProducer; |
|
|
|
import com.elink.esua.epdc.service.*; |
|
|
|
import com.elink.esua.epdc.util.AppUserUtils; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import net.bytebuddy.implementation.bytecode.constant.FieldConstant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -126,6 +132,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
@Autowired |
|
|
|
private PointsFeignClient pointsFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CommunityManageFeignClient communityManageFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
@DataSource(value = DataSourceNames.FIRST) |
|
|
|
public PageData<UserDTO> page(Map<String, Object> params) { |
|
|
@ -197,6 +206,109 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|
|
|
|
|
|
|
insert(entity); |
|
|
|
|
|
|
|
// 社区管理推送
|
|
|
|
sendInfo(dto, entity, 0); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 推送处理 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @param entity |
|
|
|
* @param type 0:新增 1:编辑 2:删除 |
|
|
|
* @return void |
|
|
|
* @author wgf |
|
|
|
* @date 2022/12/9 04:56 |
|
|
|
*/ |
|
|
|
private void sendInfo(UserDTO dto, UserEntity entity, int type) { |
|
|
|
try { |
|
|
|
// 获取网格的ManageId
|
|
|
|
Result<SysDeptInfoResultDTO> resultDept = adminFeignClient.getSysDeptInfoByDeptId(entity.getDeptId().toString()); |
|
|
|
SysDeptInfoResultDTO sysDeptInfoResultDTO = resultDept.getData(); |
|
|
|
if (type == NumConstant.ZERO) { |
|
|
|
if(sysDeptInfoResultDTO.getGridManageId() != null && sysDeptInfoResultDTO.getCommunityManageId() != null){ |
|
|
|
UserAddFormDTO userAddFormDTO = new UserAddFormDTO(); |
|
|
|
userAddFormDTO.setGridId(sysDeptInfoResultDTO.getGridManageId()); |
|
|
|
userAddFormDTO.setCircleId(sysDeptInfoResultDTO.getCommunityManageId()); |
|
|
|
userAddFormDTO.setGridNum(sysDeptInfoResultDTO.getGridName()); |
|
|
|
userAddFormDTO.setUserRealName(entity.getRealName()); |
|
|
|
userAddFormDTO.setUserAddress(entity.getAddress()); |
|
|
|
userAddFormDTO.setUserAddressDetails(entity.getAddress()); |
|
|
|
userAddFormDTO.setCreateTime(entity.getCreatedTime().toString()); |
|
|
|
userAddFormDTO.setPhone(entity.getTelephone()); |
|
|
|
userAddFormDTO.setOldGridUserId(entity.getId()); |
|
|
|
userAddFormDTO.setRemark(entity.getRemark()); |
|
|
|
userAddFormDTO.setIdentityCard(entity.getIdentityNo()); |
|
|
|
|
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userAddFormDTO:" + userAddFormDTO); |
|
|
|
Result<GlobalResultDTO> result = communityManageFeignClient.addUser(userAddFormDTO); |
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userAdd result:" + result); |
|
|
|
communityManageHandle(result, dto, entity); |
|
|
|
} |
|
|
|
} else if (type == NumConstant.ONE) { |
|
|
|
UserEntity userEntity = baseDao.selectById(dto.getId()); |
|
|
|
if (userEntity != null && userEntity.getManageId() != null) { |
|
|
|
UserUpdFormDTO userUpdFormDTO = new UserUpdFormDTO(); |
|
|
|
userUpdFormDTO.setGridNum(sysDeptInfoResultDTO.getGridName()); |
|
|
|
userUpdFormDTO.setUserRealName(entity.getRealName()); |
|
|
|
userUpdFormDTO.setUserAddress(entity.getAddress()); |
|
|
|
userUpdFormDTO.setUserAddressDetails(entity.getAddress()); |
|
|
|
userUpdFormDTO.setRemark(entity.getRemark()); |
|
|
|
userUpdFormDTO.setIdentityCard(entity.getIdentityNo()); |
|
|
|
userUpdFormDTO.setBirthday(entity.getBirthday() == null ? "" : entity.getBirthday().toString()); |
|
|
|
userUpdFormDTO.setGender(entity.getSex() == null ? null : Integer.parseInt(entity.getSex())); |
|
|
|
userUpdFormDTO.setUserGridId(userEntity.getManageId()); |
|
|
|
|
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userUpdFormDTO:" + userUpdFormDTO); |
|
|
|
Result<GlobalResultDTO> result = communityManageFeignClient.updUser(userUpdFormDTO); |
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userUpd result:" + result); |
|
|
|
communityManageHandle(result, dto, entity); |
|
|
|
} |
|
|
|
} else if (type == NumConstant.TWO) { |
|
|
|
UserEntity userEntity = baseDao.selectById(dto.getId()); |
|
|
|
if (userEntity != null && userEntity.getManageId() != null) { |
|
|
|
UserDelFormDTO userDelFormDTO = new UserDelFormDTO(); |
|
|
|
userDelFormDTO.setUserGridId(userEntity.getManageId()); |
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userDelFormDTO:" + userDelFormDTO); |
|
|
|
Result<GlobalResultDTO> result = communityManageFeignClient.delUser(userDelFormDTO); |
|
|
|
log.info("++++++++++++++++++++++++++++++++++++++++++++userDel result:" + result); |
|
|
|
// communityManageHandle(result, dto, entity);
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("推送社区管理接口失败:type>>" + type + "||id>>" + entity.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置ManageId |
|
|
|
* @param result |
|
|
|
* @param dto |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
private void communityManageHandle(Result<GlobalResultDTO> result, UserDTO dto, UserEntity entity) { |
|
|
|
if (result.success()) { |
|
|
|
Object resultObject = result.getData().getResult(); |
|
|
|
Integer mId = null; |
|
|
|
// 只有新增操作result才会有值,编辑删除是null,直接通过这个来判断是不是新增操作
|
|
|
|
if (resultObject != null) { |
|
|
|
mId = Integer.valueOf(resultObject.toString()); |
|
|
|
} |
|
|
|
UserEntity userEntity = baseDao.selectById(entity.getId()); |
|
|
|
// 表里没有直接插入
|
|
|
|
if (userEntity == null) { |
|
|
|
// 插入信息表
|
|
|
|
UserEntity addUserEntity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|
|
|
addUserEntity.setManageId(mId); |
|
|
|
baseDao.insert(addUserEntity); |
|
|
|
} else { |
|
|
|
// 更新信息表
|
|
|
|
userEntity.setManageId(mId); |
|
|
|
baseDao.updateById(userEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -205,12 +317,22 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|
|
|
|
|
|
|
updateById(entity); |
|
|
|
|
|
|
|
// 社区管理推送
|
|
|
|
sendInfo(dto, entity, 1); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
|
|
|
|
UserEntity entity = new UserEntity(); |
|
|
|
UserDTO dto = new UserDTO(); |
|
|
|
entity.setId(ids[0]); |
|
|
|
dto.setId(ids[0]); |
|
|
|
// 社区管理推送
|
|
|
|
sendInfo(dto, entity, 2); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|