Browse Source

Merge remote-tracking branch 'remotes/origin/dev_abandon_grid' into develop

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
dev
jianjun 4 years ago
parent
commit
65ecc910b2
  1. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
  2. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
  3. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  4. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  5. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  6. 1
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  7. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java
  8. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java
  9. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java
  10. 41
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java
  11. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java
  12. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  13. 32
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
  14. 14
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql
  15. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml
  16. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java

@ -39,15 +39,6 @@ public interface CommonAggFeignClient {
@PostMapping("/data/aggregator/org/agency") @PostMapping("/data/aggregator/org/agency")
Result<AgencyInfoCache> getAgencyInfo(@RequestParam("agencyId")String agencyId); Result<AgencyInfoCache> getAgencyInfo(@RequestParam("agencyId")String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/grid")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId);
/** /**
* 查询楼栋信息 * 查询楼栋信息
* @param buildingId * @param buildingId

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java

@ -29,11 +29,6 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId); return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId);
} }
@Override
public Result<GridInfoCache> getGridInfo(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId);
}
/** /**
* 查询楼栋信息 * 查询楼栋信息
* *

11
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -157,11 +157,20 @@ public interface EpmetUserFeignClient {
Result<CustomerStaffListResultDTO> getCustomerStaffList(List<String> staffIdList); Result<CustomerStaffListResultDTO> getCustomerStaffList(List<String> staffIdList);
/** /**
* desc:删除审核中的徽章认证记录 * desc:删除审核中的徽章认证记录-弃用网格是调用
* @param customerId * @param customerId
* @param gridId * @param gridId
* @return * @return
*/ */
@PostMapping("/epmetuser/badge/deleteBadgeCertificateAuditing") @PostMapping("/epmetuser/badge/deleteBadgeCertificateAuditing")
Result<Integer> deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId, @RequestParam("gridId") String gridId); Result<Integer> deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId, @RequestParam("gridId") String gridId);
/**
* desc:删除弃用网格的访问记录-弃用网格是调用
* @param customerId
* @param gridId
* @return
*/
@PostMapping("/epmetuser/gridlatest/deleteGridLatestData")
Result<Integer> deleteGridLatestData(@RequestParam("customerId") String customerId, @RequestParam("gridId") String gridId);
} }

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -96,4 +96,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result<Integer> deleteBadgeCertificateAuditing(String customerId, String gridId) { public Result<Integer> deleteBadgeCertificateAuditing(String customerId, String gridId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deleteBadgeCertificateAuditing", customerId, gridId); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deleteBadgeCertificateAuditing", customerId, gridId);
} }
@Override
public Result<Integer> deleteGridLatestData(String customerId, String gridId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deleteGridLatestData", customerId, gridId);
}
} }

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -1046,7 +1046,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
if (badgeResult == null || !badgeResult.success()){ if (badgeResult == null || !badgeResult.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除未审核徽章失败,请稍后重试"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除未审核徽章失败,请稍后重试");
} }
//删除废弃网格的访问记录
Result<Integer> gridLatestResult = epmetUserFeignClient.deleteGridLatestData(customerId,gridId);
if (gridLatestResult == null || !gridLatestResult.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"删除网格访问记录失败,请稍后重试");
}
//处理成功,隐藏网格 //处理成功,隐藏网格
LambdaUpdateWrapper<CustomerGridEntity> updateGrid=new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<CustomerGridEntity> updateGrid=new LambdaUpdateWrapper<>();
updateGrid.set(CustomerGridEntity::getAbandonFlag,NumConstant.ONE); updateGrid.set(CustomerGridEntity::getAbandonFlag,NumConstant.ONE);

1
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -342,7 +342,6 @@
WHERE cg.del_flag = '0' WHERE cg.del_flag = '0'
AND ca.del_flag = '0' AND ca.del_flag = '0'
AND cg.SYNC_FLAG='1' AND cg.SYNC_FLAG='1'
and cg.ABANDON_FLAG='0'
AND cg.id IN AND cg.id IN
<foreach item="id" collection="gridIdList" open="(" separator="," close=")"> <foreach item="id" collection="gridIdList" open="(" separator="," close=")">
#{id} #{id}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java

@ -1,7 +1,9 @@
package com.epmet.controller; package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
@ -218,11 +220,12 @@ public class BadgeController {
} }
/** /**
* Desc: 查询网格下是否存在未审核的徽章truefalse * desc:删除审核中的徽章认证记录-弃用网格是调用
* @param customerId
* @param gridId * @param gridId
* @author zxc * @return
* @date 2022/3/16 9:42 上午
*/ */
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_DELETE)
@PostMapping("deleteBadgeCertificateAuditing") @PostMapping("deleteBadgeCertificateAuditing")
public Result<Integer> deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId,@RequestParam("gridId")String gridId){ public Result<Integer> deleteBadgeCertificateAuditing(@RequestParam("customerId") String customerId,@RequestParam("gridId")String gridId){
return new Result<Integer>().ok(badgeService.deleteBadgeCertificateAuditing(customerId,gridId)); return new Result<Integer>().ok(badgeService.deleteBadgeCertificateAuditing(customerId,gridId));

11
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java

@ -143,4 +143,15 @@ public class GridLatestController {
return new Result<LatestGridInfoResultDTO>().ok(gridLatestService.latestGridInfo(formDTO)); return new Result<LatestGridInfoResultDTO>().ok(gridLatestService.latestGridInfo(formDTO));
} }
/**
* desc:删除弃用网格的访问记录-弃用网格是调用
* @param customerId
* @param gridId
* @return
*/
@PostMapping("deleteGridLatestData")
public Result<Integer> deleteGridLatestData(@RequestParam("customerId") String customerId,@RequestParam("gridId")String gridId){
return new Result<Integer>().ok(gridLatestService.deleteGridLatestData(customerId,gridId));
}
} }

16
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRegGridChangeRecDao.java

@ -0,0 +1,16 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.UserRegGridChangeRecEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户注册网格变更记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-03-17
*/
@Mapper
public interface UserRegGridChangeRecDao extends BaseDao<UserRegGridChangeRecEntity> {
}

41
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserRegGridChangeRecEntity.java

@ -0,0 +1,41 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 用户注册网格变更记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-03-17
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("user_reg_grid_change_rec")
public class UserRegGridChangeRecEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 居民端用户id
*/
private String userId;
/**
* 原始网格id
*/
private String originGridId;
/**
* 当前所选择的注册网格
*/
private String gridId;
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java

@ -140,4 +140,12 @@ public interface GridLatestService extends BaseService<GridLatestEntity> {
* @Date 2020/8/3 * @Date 2020/8/3
**/ **/
LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO); LatestGridInfoResultDTO latestGridInfo(LatestGridInfoFormDTO formDTO);
/**
* desc:删除弃用网格的访问记录-弃用网格是调用
* @param customerId
* @param gridId
* @return
*/
Integer deleteGridLatestData(String customerId, String gridId);
} }

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java

@ -19,6 +19,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
@ -36,7 +37,6 @@ import com.epmet.dto.result.CustomerUser4PointResultDTO;
import com.epmet.dto.result.LatestGridInfoResultDTO; import com.epmet.dto.result.LatestGridInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.entity.GridLatestEntity; import com.epmet.entity.GridLatestEntity;
import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.redis.UserBaseInfoRedis; import com.epmet.redis.UserBaseInfoRedis;
import com.epmet.service.GridLatestService; import com.epmet.service.GridLatestService;
import com.epmet.util.ModuleConstant; import com.epmet.util.ModuleConstant;
@ -210,4 +210,13 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
return baseDao.selectLatestGridInfo(formDTO); return baseDao.selectLatestGridInfo(formDTO);
} }
@Override
public Integer deleteGridLatestData(String customerId, String gridId) {
LambdaUpdateWrapper<GridLatestEntity> wrapper = new LambdaUpdateWrapper();
wrapper.eq(GridLatestEntity::getCustomerId,customerId)
.eq(GridLatestEntity::getGridId,gridId)
.set(GridLatestEntity::getUpdatedTime,System.currentTimeMillis());
return baseDao.delete(wrapper);
}
} }

32
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

@ -75,6 +75,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
private UserBadgeCertificateRecordDao userBadgeCertificateRecordDao; private UserBadgeCertificateRecordDao userBadgeCertificateRecordDao;
@Autowired @Autowired
private UserBaseInfoRedis userBaseInfoRedis; private UserBaseInfoRedis userBaseInfoRedis;
@Autowired
private UserRegGridChangeRecDao UserRegGridChangeRecDao;
private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
@ -438,8 +441,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Override @Override
public void modifyRegGrid(ModifyRegGridFormDTO formDTO) { public void modifyRegGrid(ModifyRegGridFormDTO formDTO) {
GridInfoCache newGridInfo= CustomerOrgRedis.getGridInfo(formDTO.getGridId()); GridInfoCache newGridInfo= CustomerOrgRedis.getGridInfo(formDTO.getGridId());
if (null == newGridInfo) { RegisterRelationEntity originReg=registerRelationDao.selectRegisteredGridIdByUserIdAndCustomerId(formDTO.getUserId(),formDTO.getCustomerId());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询当前网格信息异常", "服务器开小差了..."); if (null == newGridInfo || null == originReg) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询网格信息异常", "服务器开小差了...");
} }
//修改register_relation表 //修改register_relation表
LambdaQueryWrapper<RegisterRelationEntity> originWrapper=new LambdaQueryWrapper(); LambdaQueryWrapper<RegisterRelationEntity> originWrapper=new LambdaQueryWrapper();
@ -467,18 +471,36 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
//2、修改历史徽章表 //2、修改历史徽章表
LambdaUpdateWrapper<UserBadgeCertificateRecordEntity> recUpdate=new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<UserBadgeCertificateRecordEntity> recUpdate=new LambdaUpdateWrapper<>();
recUpdate.set(UserBadgeCertificateRecordEntity::getGridId,newGridInfo.getId()); recUpdate.set(UserBadgeCertificateRecordEntity::getGridId,newGridInfo.getId())
.set(UserBadgeCertificateRecordEntity::getUpdatedBy,formDTO.getUserId())
.set(UserBadgeCertificateRecordEntity::getUpdatedTime,new Date());
recUpdate.eq(UserBadgeCertificateRecordEntity::getCustomerId,formDTO.getCustomerId()) recUpdate.eq(UserBadgeCertificateRecordEntity::getCustomerId,formDTO.getCustomerId())
.eq(UserBadgeCertificateRecordEntity::getUserId,formDTO.getUserId()); .eq(UserBadgeCertificateRecordEntity::getUserId,formDTO.getUserId());
userBadgeCertificateRecordDao.update(null,recUpdate); userBadgeCertificateRecordDao.update(null,recUpdate);
LambdaUpdateWrapper<ResiUserBadgeEntity> badgeUpdate=new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<ResiUserBadgeEntity> badgeUpdate=new LambdaUpdateWrapper<>();
badgeUpdate.set(ResiUserBadgeEntity::getGridId,newGridInfo.getId()); badgeUpdate.set(ResiUserBadgeEntity::getGridId,newGridInfo.getId())
.set(ResiUserBadgeEntity::getUpdatedBy,formDTO.getUserId())
.set(ResiUserBadgeEntity::getUpdatedTime,new Date());;
badgeUpdate.eq(ResiUserBadgeEntity::getCustomerId,formDTO.getCustomerId()) badgeUpdate.eq(ResiUserBadgeEntity::getCustomerId,formDTO.getCustomerId())
.eq(ResiUserBadgeEntity::getUserId,formDTO.getUserId()); .eq(ResiUserBadgeEntity::getUserId,formDTO.getUserId());
resiUserBadgeDao.update(null,badgeUpdate); resiUserBadgeDao.update(null,badgeUpdate);
//3、修改支援者信息表 //3、修改支援者信息表
modifyVolunteerGrid(formDTO,newGridInfo);
//4、删除用户缓存信息
userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId()));
//5、插入用户注册网格变更记录
UserRegGridChangeRecEntity log=new UserRegGridChangeRecEntity();
log.setCustomerId(formDTO.getCustomerId());
log.setUserId(formDTO.getUserId());
log.setOriginGridId(originReg.getGridId());
log.setGridId(formDTO.getGridId());
UserRegGridChangeRecDao.insert(log);
}
private void modifyVolunteerGrid(ModifyRegGridFormDTO formDTO, GridInfoCache newGridInfo) {
VolunteerInfoDTO volunteerInfoDTO=new VolunteerInfoDTO(); VolunteerInfoDTO volunteerInfoDTO=new VolunteerInfoDTO();
volunteerInfoDTO.setCustomerId(formDTO.getCustomerId()); volunteerInfoDTO.setCustomerId(formDTO.getCustomerId());
volunteerInfoDTO.setUserId(formDTO.getUserId()); volunteerInfoDTO.setUserId(formDTO.getUserId());
@ -490,8 +512,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
if (!volunteerRes.success()) { if (!volunteerRes.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:修改用户志愿者信息异常", "服务器开小差了..."); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:修改用户志愿者信息异常", "服务器开小差了...");
} }
//4、删除用户缓存信息
userBaseInfoRedis.clearUserCache(Arrays.asList(formDTO.getUserId()));
} }
} }

14
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.25__create_user_reg_grid_rec.sql

@ -0,0 +1,14 @@
CREATE TABLE `user_reg_grid_change_rec` (
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`USER_ID` varchar(64) NOT NULL COMMENT '居民端用户id',
`ORIGIN_GRID_ID` varchar(64) NOT NULL COMMENT '原始网格id',
`GRID_ID` varchar(64) NOT NULL COMMENT '当前所选择的注册网格',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户注册网格变更记录表';

2
epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml

@ -79,7 +79,7 @@
<!-- 根据userId查询注册网格ID --> <!-- 根据userId查询注册网格ID -->
<select id="selectRegisterGridIdByUserId" resultType="java.lang.String"> <select id="selectRegisterGridIdByUserId" resultType="java.lang.String">
SELECT GRID_ID FROM register_relation WHERE DEL_FLAG = 0 and USER_ID = #{userId} SELECT GRID_ID FROM register_relation WHERE DEL_FLAG = 0 AND FIRST_REGISTER = 1 and USER_ID = #{userId}
</select> </select>
<!-- 居民注册关系 --> <!-- 居民注册关系 -->

8
epmet-user/epmet-user-server/src/main/resources/mapper/UserRegGridChangeRecDao.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.UserRegGridChangeRecDao">
</mapper>
Loading…
Cancel
Save