Browse Source

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

master
yinzuomei 4 years ago
parent
commit
66fd50cef4
  1. 2
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java
  2. 46
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

2
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -29,6 +30,7 @@ public class UserGuideController {
@Autowired
private UserAccessService userAccessService;
@NoRepeatSubmit
@PostMapping("entergrid")
Result<UserInfoOnEnterGridResultDTO> enterGrid(@LoginUser TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){
logger.info("进网格TokenDto:"+ JSON.toJSON(token));

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

@ -442,38 +442,28 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询当前网格信息异常", "服务器开小差了...");
}
//修改register_relation表
//原始注册记录
LambdaQueryWrapper<RegisterRelationEntity> wrapper=new LambdaQueryWrapper();
wrapper.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
LambdaQueryWrapper<RegisterRelationEntity> originWrapper=new LambdaQueryWrapper();
originWrapper.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
.eq(RegisterRelationEntity::getUserId,formDTO.getUserId())
.eq(RegisterRelationEntity::getFirstRegister, NumConstant.ONE_STR);
RegisterRelationEntity originReg=registerRelationDao.selectOne(wrapper);
if(null==originReg){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民端_修改注册网格:查询用户原始注册网格记录异常", "服务器开小差了...");
}
//1、删除废弃网格的
registerRelationDao.deleteById(originReg.getId());
//2、当前选择的网格,是否有记录,有更新没有删除
LambdaQueryWrapper<RegisterRelationEntity> query=new LambdaQueryWrapper();
query.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
//1、删除废弃网格的(现在生产存在同一个用户相同的网格id多条记录,所以用delete方法)
registerRelationDao.delete(originWrapper);
//2、删除用户与当前选择的网格的关系,新插入一条注册关系,
LambdaQueryWrapper<RegisterRelationEntity> deleteWrapper=new LambdaQueryWrapper();
deleteWrapper.eq(RegisterRelationEntity::getCustomerId,formDTO.getCustomerId())
.eq(RegisterRelationEntity::getUserId,formDTO.getUserId())
.eq(RegisterRelationEntity::getGridId, formDTO.getGridId());
RegisterRelationEntity nowReg=registerRelationDao.selectOne(query);
if (null != nowReg) {
nowReg.setFirstRegister(NumConstant.ONE_STR);
nowReg.setRegister(NumConstant.ONE_STR);
nowReg.setParticipation(NumConstant.ONE_STR);
registerRelationDao.updateById(nowReg);
} else {
RegisterRelationEntity insert=new RegisterRelationEntity();
insert.setCustomerId(formDTO.getCustomerId());
insert.setGridId(formDTO.getGridId());
insert.setUserId(formDTO.getUserId());
insert.setFirstRegister(NumConstant.ONE_STR);
insert.setRegister(NumConstant.ONE_STR);
insert.setParticipation(NumConstant.ONE_STR);
registerRelationDao.insert(insert);
}
registerRelationDao.delete(deleteWrapper);
RegisterRelationEntity insert=new RegisterRelationEntity();
insert.setCustomerId(formDTO.getCustomerId());
insert.setGridId(formDTO.getGridId());
insert.setUserId(formDTO.getUserId());
insert.setFirstRegister(NumConstant.ONE_STR);
insert.setRegister(NumConstant.ONE_STR);
insert.setParticipation(NumConstant.ONE_STR);
registerRelationDao.insert(insert);
//2、修改历史徽章表
LambdaUpdateWrapper<UserBadgeCertificateRecordEntity> recUpdate=new LambdaUpdateWrapper<>();

Loading…
Cancel
Save