Browse Source

异常修改

master
yinzuomei 5 years ago
parent
commit
7020ec6f1e
  1. 13
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  2. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 14
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java
  4. 39
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  5. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ModuleUtils.java
  6. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Result.java
  7. 11
      epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java
  8. 8
      epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java
  9. 8
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java
  10. 2
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java
  11. 9
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  12. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java
  13. 16
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  14. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  15. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupStatisticalServiceImpl.java
  16. 6
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java
  17. 38
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  18. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  19. 53
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  20. 6
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java
  21. 11
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java
  22. 12
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java
  23. 10
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java
  24. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  25. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java
  26. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

13
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -82,8 +82,10 @@ public class LoginServiceImpl implements LoginService {
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(this.packagingUserToken(formDTO, userId, wxMaJscode2SessionResult));
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}else{
logger.error("登录失败userId为空");
throw new RenException("登录失败");
}
return new Result<UserTokenResultDTO>().error("登录失败");
}
/**
@ -267,7 +269,8 @@ public class LoginServiceImpl implements LoginService {
@Override
public Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO) {
if(LoginConstant.APP_RESI.equals(formDTO.getApp())){
return new Result<UserTokenResultDTO>().error("居民端请使用微信登录");
logger.error("居民端请使用微信登录");
throw new RenException("居民端请使用微信登录");
}
//1、验证码是否正确
boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha());
@ -282,7 +285,8 @@ public class LoginServiceImpl implements LoginService {
Result<PasswordLoginUserInfoResultDTO> userInfoResult = epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO);
logger.info(userInfoResult.getCode() + userInfoResult.getMsg());
if (!userInfoResult.success() || null == userInfoResult.getData()) {
return new Result<UserTokenResultDTO>().error("账号不存在");
logger.error("账号不存在");
throw new RenException("账号不存在");
}
//3、密码是否正确
//密码错误
@ -333,7 +337,8 @@ public class LoginServiceImpl implements LoginService {
//记录登出日志
//删除redis
if(null == tokenDto){
return new Result().error("当前用户信息获取失败!");
logger.error("账号不存在");
throw new RenException("当前用户信息获取失败");
}
cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId());

43
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -6,6 +6,31 @@ package com.epmet.commons.tools.exception;
* @Description:
*/
public enum EpmetErrorCode {
/*****************以下是框架自带的异常编码s****************************************************/
INTERNAL_SERVER_ERROR (500,"服务器内部异常"),
UNAUTHORIZED (401,"未授权"),
FORBIDDEN (403,"拒绝访问,没有权限"),
NOT_NULL (10001,"{0}不能为空"),
DB_RECORD_EXISTS ( 10002,"数据库中已存在该记录"),
PARAMS_GET_ERROR ( 10003,"获取参数失败"),
ACCOUNT_PASSWORD_ERROR ( 10004,"账号或密码错误"),
ACCOUNT_DISABLE (10005,"账号已被停用"),
IDENTIFIER_NOT_NULL (10006,"唯一标识不能为空"),
CAPTCHA_ERROR (10007,"验证码不正确"),
SUB_MENU_EXIST (10008,"先删除子菜单或按钮"),
PASSWORD_ERROR (10009,"原密码不正确"),
ACCOUNT_NOT_EXIST (10010,"账号不存在"),
SUPERIOR_DEPT_ERROR ( 10011,"上级部门选择错误"),
SUPERIOR_MENU_ERROR (10012,"上级菜单不能为自身"),
DATA_SCOPE_PARAMS_ERROR (10013,"数据权限接口,只能是Map类型参数"),
DEPT_SUB_DELETE_ERROR (10014,"请先删除下级部门"),
DEPT_USER_DELETE_ERROR (10015,"请先删除部门下的用户"),
JSON_FORMAT_ERROR (10016,"参数格式不正确,请使用JSON格式"),
SUPERIOR_REGION_ERROR (10017,"上级区域选择错误"),
REGION_SUB_DELETE_ERROR (10018,"请先删除下级区域"),
/*****************以上是框架自带的错误编码****************************************************/
SERVER_ERROR(8000, "服务器开小差了..."),
CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"),
CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"),
GROUP_ALREADY_EXISTED(8003,"您的组名已存在,请重新修改"),
@ -29,16 +54,26 @@ public enum EpmetErrorCode {
this.msg = msg;
}
public int getCode() {
return code;
public static String getMsg(Integer value) {
EpmetErrorCode[] businessModeEnums = values();
for (EpmetErrorCode epmetErrorCodeEnum : businessModeEnums) {
if (epmetErrorCodeEnum.getCode()==value) {
return epmetErrorCodeEnum.getMsg();
}
}
return null;
}
public int getCode(){
return this.code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
public String getMsg(){
return this.msg;
}
public void setMsg(String msg) {

14
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java

@ -9,7 +9,6 @@
package com.epmet.commons.tools.exception;
import com.epmet.commons.tools.utils.MessageUtils;
import org.apache.commons.lang3.StringUtils;
/**
@ -20,24 +19,23 @@ import org.apache.commons.lang3.StringUtils;
*/
public class RenException extends RuntimeException {
private static final long serialVersionUID = 1L;
private int code;
private String msg;
public RenException(int code) {
this.code = code;
this.msg = MessageUtils.getMessage(code);
this.msg = EpmetErrorCode.getMsg(code);
}
public RenException(int code, String... params) {
this.code = code;
this.msg = MessageUtils.getMessage(code, params);
this.msg = EpmetErrorCode.getMsg(code);
}
public RenException(int code, Throwable e) {
super(e);
this.code = code;
this.msg = MessageUtils.getMessage(code);
this.msg = EpmetErrorCode.getMsg(code);
}
public RenException(int code, Throwable e, String... params) {
@ -49,7 +47,7 @@ public class RenException extends RuntimeException {
public RenException(int code, String msg){
this.code = code;
if(StringUtils.isBlank(msg)){
this.msg = MessageUtils.getMessage(code, msg);
this.msg = EpmetErrorCode.getMsg(code);
}else{
this.msg = msg;
}
@ -58,13 +56,13 @@ public class RenException extends RuntimeException {
public RenException(String msg) {
super(msg);
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.msg = msg;
}
public RenException(String msg, Throwable e) {
super(msg, e);
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.msg = msg;
}

39
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -47,29 +47,46 @@ public class RenExceptionHandler {
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RenException.class)
public Result handleRRException(RenException ex){
Result result = new Result();
result.error(ex.getCode(), ex.getMsg());
logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error();
}
return result;
/**
* 运行时异常拦截
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RuntimeException.class)
public Result handleRuntimeException(RuntimeException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error();
}
/**
* 处理自定义异常
* "code": 10002,
* "msg": "数据库中已存在该记录",
*/
@ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex){
Result result = new Result();
result.error(ErrorCode.DB_RECORD_EXISTS);
return result;
logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error(ErrorCode.DB_RECORD_EXISTS);
}
/**
* 异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(Exception.class)
public Result handleException(Exception ex){
logger.error(ex.getMessage(), ex);
saveLog(ex);
logger.error(ExceptionUtils.getErrorStackTrace(ex));
// saveLog(ex);
return new Result().error();
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ModuleUtils.java

@ -37,7 +37,7 @@ public class ModuleUtils {
String errorMessage = "Failure to connect " + serverName;
String errorLog = errorMessage + "::[method]->{}::[params]->{}";
log.error(errorLog, methodName, JSON.toJSONString(params));
return new Result().error(errorMessage);
return new Result().error();
}
/**

30
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Result.java

@ -8,7 +8,7 @@
package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -48,26 +48,46 @@ public class Result<T> implements Serializable {
return code == 0 ? true : false;
}
/**
* 返回
* "code": 8000,
* "msg": "服务器开小差了...",
*/
public Result<T> error() {
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.msg = com.epmet.commons.tools.utils.MessageUtils.getMessage(this.code);
this.code = EpmetErrorCode.SERVER_ERROR.getCode();
this.msg = EpmetErrorCode.getMsg(code);
return this;
}
/**
* 根据错误编码查询msg返回
*/
public Result<T> error(int code) {
this.code = code;
this.msg = com.epmet.commons.tools.utils.MessageUtils.getMessage(this.code);
this.msg = EpmetErrorCode.getMsg(code);
return this;
}
/**
* 传入错误编码+msg返回
*/
public Result<T> error(int code, String msg) {
this.code = code;
this.msg = msg;
return this;
}
/**
*
* @param msg
* @return 此方法废弃统一使用
* logger.error(XXXX);
* throw new RenException(XXXX);
* XXXX定义常量里
*/
@Deprecated
public Result<T> error(String msg) {
this.code = ErrorCode.INTERNAL_SERVER_ERROR;
this.code = EpmetErrorCode.INTERNAL_SERVER_ERROR.getCode();
this.msg = msg;
return this;
}

11
epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/controller/DemoController.java

@ -17,6 +17,7 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -34,6 +35,8 @@ import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.excel.DemoExcel;
import com.epmet.service.DemoService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -51,7 +54,7 @@ import java.util.Map;
@RestController
@RequestMapping("demo")
public class DemoController {
private static final Logger logger = LoggerFactory.getLogger(DemoController.class);
@Autowired
private DemoService demoService;
@ -124,7 +127,8 @@ public class DemoController {
@GetMapping("/queryCustomInfo/{customerId}")
public Result<CustomerDTO> queryCustomInfo(@PathVariable("customerId") String customerId) {
if (StringUtils.isBlank(customerId)) {
return new Result<CustomerDTO>().error("customerId不能为空");
logger.error("账号不存在");
throw new RenException("customerId不能为空");
}
return demoService.queryCustomerInfo(customerId);
}
@ -139,7 +143,8 @@ public class DemoController {
@GetMapping("/queryCustomInfoByCustomerId")
public Result<CustomerDTO> queryCustomInfoByCustomerId(@RequestParam("customerId") String customerId) {
if (StringUtils.isBlank(customerId)) {
return new Result<CustomerDTO>().error("customerId不能为空");
logger.error("customerId不能为空");
throw new RenException("customerId不能为空");
}
return demoService.queryCustomInfoByCustomerId(customerId);
}

8
epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/service/impl/DemoServiceImpl.java

@ -21,6 +21,7 @@ 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.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -39,6 +40,8 @@ import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.DemoRedis;
import com.epmet.service.DemoService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -57,7 +60,7 @@ import java.util.Map;
*/
@Service
public class DemoServiceImpl extends BaseServiceImpl<DemoDao, DemoEntity> implements DemoService {
private static final Logger logger = LoggerFactory.getLogger(DemoServiceImpl.class);
@Autowired
private DemoRedis demoRedis;
@Autowired
@ -183,7 +186,8 @@ public class DemoServiceImpl extends BaseServiceImpl<DemoDao, DemoEntity> implem
@Override
public Result sendSmsCaptcha(String mobile) {
if(StringUtils.isBlank(mobile)){
return new Result().error("手机号不能为空");
logger.error("手机号不能为空");
throw new RenException("手机号不能为空");
}
return messageFeignClient.sendSmsCaptcha(mobile);
}

8
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java

@ -11,6 +11,7 @@ package com.epmet.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -26,6 +27,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -43,6 +46,7 @@ import java.util.Map;
@RequestMapping("mailtemplate")
@Api(tags="邮件模板")
public class MailTemplateController {
private static final Logger logger = LoggerFactory.getLogger(MailTemplateController.class);
@Autowired
private SysMailTemplateService sysMailTemplateService;
@Autowired
@ -134,8 +138,8 @@ public class MailTemplateController {
if(flag){
return new Result();
}
return new Result().error("邮件发送失败");
logger.error("邮件发送失败");
throw new RenException("邮件发送失败");
}
}

2
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java

@ -137,6 +137,6 @@ public class SysSmsServiceImpl extends BaseServiceImpl<SysSmsDao, SysSmsEntity>
e.printStackTrace();
logger.error(String.format("短信验证码发送失败,手机号:%s。errorMessage:%s", mobile, e.getMessage()));
}
return new Result().error(EpmetErrorCode.MESSAGE_SMS_SEND_ERROR.getCode(), EpmetErrorCode.MESSAGE_SMS_SEND_ERROR.getMsg());
return new Result().error(EpmetErrorCode.MESSAGE_SMS_SEND_ERROR.getCode());
}
}

9
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java

@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.cloud.OssFactory;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.OssDao;
@ -21,6 +22,8 @@ import com.epmet.entity.OssEntity;
import com.epmet.exception.ModuleErrorCode;
import com.epmet.service.OssService;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -29,7 +32,7 @@ import java.util.Map;
@Service
public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implements OssService {
private static final Logger logger = LoggerFactory.getLogger(OssServiceImpl.class);
@Override
public PageData<OssEntity> page(Map<String, Object> params) {
IPage<OssEntity> page = baseDao.selectPage(
@ -56,8 +59,8 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
url = OssFactory.build().uploadSuffix(file.getBytes(), extension);
} catch (IOException e) {
e.printStackTrace();
return new Result<UploadImgResultDTO>().error("图片上传异常");
logger.error("图片上传异常");
throw new RenException("图片上传异常");
}
//保存文件信息

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java

@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -36,6 +37,8 @@ import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedAuditFormD
import com.epmet.service.CustomerStaffGridService;
import com.epmet.util.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -52,7 +55,7 @@ import java.util.Map;
*/
@Service
public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffGridDao, CustomerStaffGridEntity> implements CustomerStaffGridService {
private static final Logger logger = LoggerFactory.getLogger(CustomerStaffGridServiceImpl.class);
@Autowired
private CustomerStaffGridRedis customerStaffGridRedis;
@Autowired
@ -118,7 +121,8 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl<CustomerStaffG
@Override
public Result manageAudit(TokenDto tokenDTO, ResiWarmheartedAuditFormDTO formDTO) {
if (null == tokenDTO || StringUtils.isBlank(tokenDTO.getUserId())) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
formDTO.setUserId(tokenDTO.getUserId());
return resiPartymemberFeignClient.manageAudit(formDTO);

16
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -18,6 +18,7 @@
package com.epmet.modules.group.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.RenException;
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,8 @@ import com.epmet.resi.group.dto.group.result.CreatedResultDTO;
import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO;
import com.epmet.resi.group.dto.group.result.MyGroupResultDTO;
import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -44,10 +47,15 @@ import java.util.List;
@RestController
@RequestMapping("group")
public class ResiGroupController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ResiGroupService resiGroupService;
@GetMapping("test/{test}")
public Result test(@PathVariable("test")String test){
int result=1/0;
return new Result().ok("请求成功啦❤");
}
/**
* @param tokenDto
* @param myGroupFormDTO
@ -155,7 +163,8 @@ public class ResiGroupController {
public Result initApplyGroup(@LoginUser TokenDto tokenDto,
@RequestBody InitApplyGroupFormDTO initApplyGroupFormDTO) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
initApplyGroupFormDTO.setUserId(tokenDto.getUserId());
ValidatorUtils.validateEntity(initApplyGroupFormDTO);
@ -174,7 +183,8 @@ public class ResiGroupController {
public Result initApplyCreatedGroup(@LoginUser TokenDto tokenDto,
@RequestBody InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
initApplyCreatedGroupFormDTO.setUserId(tokenDto.getUserId());
initApplyCreatedGroupFormDTO.setApp(tokenDto.getApp());

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -33,6 +34,7 @@ import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.modules.exception.ModuleErrorCode;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupOperationDao;
@ -225,7 +227,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//校验是否是群主
ResiGroupMemberDTO groupMemberDTO = resiGroupMemberService.getResiGroupMember(modifyGroupFormDTO.getGroupId(), modifyGroupFormDTO.getUserId());
if (null == groupMemberDTO || ModuleConstant.GROUP_MEMBER.equals(groupMemberDTO.getGroupLeaderFlag())) {
return new Result().error(ModuleConstant.REJECT_MODIFYGROUPINFO);
logger.error(ModuleConstant.REJECT_MODIFYGROUPINFO);
return new Result().error();
}
if (StringUtils.isBlank(modifyGroupFormDTO.getGroupHeadPhoto())
&& StringUtils.isBlank(modifyGroupFormDTO.getGroupName())
@ -236,7 +239,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (1 == updatedRows) {
return new Result().ok(ModuleConstant.UPDATE_SUCCESS);
}
return new Result().error(ModuleConstant.UPDATE_FAILED);
logger.error(ModuleConstant.UPDATE_FAILED);
throw new RenException(ModuleConstant.UPDATE_FAILED);
}
/**
@ -250,7 +254,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
public Result<GroupSummarizeResultDTO> getGroupSummarize(GroupSummarizeFormDTO groupSummarizeFormDTO) {
GroupSummarizeResultDTO groupSummarizeResultDTO = baseDao.selectGroupSummarize(groupSummarizeFormDTO);
if (null == groupSummarizeResultDTO) {
return new Result<GroupSummarizeResultDTO>().error(ModuleConstant.GETGROUPSUMMARIZE_FAILED);
logger.error(ModuleConstant.GETGROUPSUMMARIZE_FAILED);
return new Result<GroupSummarizeResultDTO>().error();
}
//获取组长信息
Result<UserResiInfoResultDTO> groupLeaderUserInfo = this.getGroupLeaderUserInfo(groupSummarizeFormDTO.getGroupId());
@ -298,7 +303,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//1、校验是否同名
List<ResiGroupEntity> resiGroupEntityList = this.getResiGroupEntityList(applyCreateGroupFormDTO);
if (null != resiGroupEntityList && resiGroupEntityList.size() > 0) {
return new Result().error(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(),EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg());
return new Result().error(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode());
}
//2、插入一条待审核的组信息
ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO);
@ -372,10 +377,12 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Override
public Result initApplyGroup(InitApplyGroupFormDTO initApplyGroupFormDTO) {
if (StringUtils.isBlank(initApplyGroupFormDTO.getCustomerId())) {
return new Result().error(ModuleConstant.CUSTOMERID_NOT_NULL);
logger.error(ModuleConstant.CUSTOMERID_NOT_NULL);
throw new RenException(ModuleConstant.CUSTOMERID_NOT_NULL);
}
if (StringUtils.isBlank(initApplyGroupFormDTO.getUserId())) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO();
resiUserInfoFormDTO.setUserId(initApplyGroupFormDTO.getUserId());
@ -383,7 +390,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
Result<UserResiInfoResultDTO> result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO);
if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) {
logger.info("居民注册信息查询失败");
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode(),EpmetErrorCode.CANNOT_JOIN_GROUP.getMsg());
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode());
}
return new Result();
}
@ -410,17 +417,19 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Override
public Result initApplyCreatedGroup(InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) {
if (StringUtils.isBlank(initApplyCreatedGroupFormDTO.getCustomerId())) {
return new Result().error(ModuleConstant.CUSTOMERID_NOT_NULL);
logger.error(ModuleConstant.CUSTOMERID_NOT_NULL);
throw new RenException(ModuleConstant.CUSTOMERID_NOT_NULL);
}
if (StringUtils.isBlank(initApplyCreatedGroupFormDTO.getUserId())) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(initApplyCreatedGroupFormDTO.getApp(),
initApplyCreatedGroupFormDTO.getUserId(),
initApplyCreatedGroupFormDTO.getCustomerId(),
initApplyCreatedGroupFormDTO.getGridId());
if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
return new Result().error(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode(),EpmetErrorCode.CANNOT_CREATE_GROUP.getMsg());
return new Result().error(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode());
}
return new Result();
}

18
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupStatisticalServiceImpl.java

@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -36,9 +37,12 @@ import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import com.epmet.modules.group.service.ResiGroupStatisticalService;
import com.epmet.modules.member.entity.ResiGroupMemberEntity;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.dto.group.ResiGroupStatisticalDTO;
import com.epmet.resi.group.dto.member.form.RemoveMemberFormDTO;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -55,7 +59,7 @@ import java.util.Map;
*/
@Service
public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupStatisticalDao, ResiGroupStatisticalEntity> implements ResiGroupStatisticalService {
private static final Logger logger = LoggerFactory.getLogger(ResiGroupStatisticalServiceImpl.class);
@Autowired
private ResiGroupServiceImpl resiGroupServiceImpl;
@Autowired
@ -125,8 +129,8 @@ public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupSt
Result result = new Result();
ResiGroupStatisticalEntity entity = baseDao.selectByResiGroupId(resiGroupMemberEntity.getResiGroupId());
if (null == entity) {
result.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
return result;
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
throw new RenException(ModuleErrorCode.DATA_ACQUISITION_FAILED);
}
//成员总数
entity.setTotalMembers(entity.getTotalMembers() - NumConstant.ONE);
@ -135,8 +139,8 @@ public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupSt
//1:根据组Id查询客户Id
ResiGroupEntity resiGroupEntity = resiGroupServiceImpl.selectById(entity.getResiGroupId());
if (null == resiGroupEntity) {
result.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
return result;
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
throw new RenException(ModuleErrorCode.DATA_ACQUISITION_FAILED);
}
//2:根据客户Id、用户Id查询被删除成员角色
UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO();
@ -145,8 +149,8 @@ public class ResiGroupStatisticalServiceImpl extends BaseServiceImpl<ResiGroupSt
userRoleFormDTO.setUserId(resiGroupMemberEntity.getCustomerUserId());
Result<List<UserRoleResultDTO>> resultList = epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
if (!resultList.success()) {
result.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
return result;
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
throw new RenException(ModuleErrorCode.DATA_ACQUISITION_FAILED);
}
for (UserRoleResultDTO userRole : resultList.getData()) {
if (EpmetRoleKeyConstant.WARMHEARTED.equals(userRole.getRoleKey())) {

6
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/service/impl/GroupInvitationServiceImpl.java

@ -25,6 +25,7 @@ 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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -164,7 +165,8 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
//2、审核通过(讨论中)的群才可以分享邀请连接
ResiGroupDTO resiGroupDTO = resiGroupService.get(formDTO.getGroupId());
if (!GroupStateConstant.GROUP_APPROVED.equals(resiGroupDTO.getState())) {
return new Result<CreateGroupInvitationResultDTO>().error(ModuleConstant.CANNOT_SHARED);
logger.error(ModuleConstant.CANNOT_SHARED);
throw new RenException(ModuleConstant.CANNOT_SHARED);
}
//3、插入一条邀请记录
GroupInvitationEntity groupInvitationEntity = new GroupInvitationEntity();
@ -317,7 +319,7 @@ public class GroupInvitationServiceImpl extends BaseServiceImpl<GroupInvitationD
resiGroupDTO.getCustomerId(),
resiGroupDTO.getGridId());
if (NumConstant.ZERO_STR.equals(userRoleDTO.getRegisteredResiFlag())) {
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode(), EpmetErrorCode.CANNOT_JOIN_GROUP.getMsg());
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode());
}
}
//3、新增一条邀请入群、直接审核通过的入群记录

38
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

@ -24,6 +24,7 @@ import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -187,16 +188,17 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
resiGroupDTO.getCustomerId(),
resiGroupDTO.getGridId());
if (NumConstant.ZERO_STR.equals(userRoleDTO.getRegisteredResiFlag())) {
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode(),EpmetErrorCode.CANNOT_JOIN_GROUP.getMsg());
return new Result().error(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode());
}
}
//查看用户最新一条成员处理记录,避免重复申请
GroupMemeberOperationDTO groupMember = baseDao.selectGroupMemberOperationLatest(applyJoinGroupFormDTO.getUserId(),applyJoinGroupFormDTO.getGroupId());
if(null!=groupMember&&MemberStateConstant.UNDER_AUDITTING.equals(groupMember.getOperateStatus())){
return new Result().error(EpmetErrorCode.ALREADY_APPLIED_GROUP.getCode(),EpmetErrorCode.ALREADY_APPLIED_GROUP.getMsg());
return new Result().error(EpmetErrorCode.ALREADY_APPLIED_GROUP.getCode());
}
if(null!=groupMember&&MemberStateConstant.APPROVED.equals(groupMember.getOperateStatus())){
return new Result().error(ModuleConstant.ALREADY_IN_GROUP);
logger.error(ModuleConstant.ALREADY_IN_GROUP);
throw new RenException(ModuleConstant.ALREADY_IN_GROUP);
}
//插入一条待审核的记录
GroupMemeberOperationDTO groupMemeberOperation = new GroupMemeberOperationDTO();
@ -295,12 +297,14 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.get(agreeApplyFormDTO.getApplyId());
//1、当前申请单是否是待审核
if (null == groupMemeberOperationDTO || !MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
return new Result().error(ModuleConstant.APPLY_NOEXISTS);
logger.error(ModuleConstant.APPLY_NOEXISTS);
throw new RenException(ModuleConstant.APPLY_NOEXISTS);
}
//2、只有群主才可以审批入群申请
ResiGroupMemberDTO leaderMember = baseDao.selectGroupMemberInfo(groupMemeberOperationDTO.getGroupId(), agreeApplyFormDTO.getUserId());
if (!LeaderFlagConstant.GROUP_LEADER.equals(leaderMember.getGroupLeaderFlag())) {
return new Result().error(ModuleConstant.CANNOT_AUDIT_APPLY);
logger.error(ModuleConstant.CANNOT_AUDIT_APPLY);
throw new RenException(ModuleConstant.CANNOT_AUDIT_APPLY);
}
//3、修改操作状态
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.APPROVED);
@ -368,12 +372,14 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
GroupMemeberOperationDTO groupMemeberOperationDTO = groupMemeberOperationService.get(disagreeApplyFormDTO.getApplyId());
//1、当前申请单是否是待审核
if (null == groupMemeberOperationDTO || !MemberStateConstant.UNDER_AUDITTING.equals(groupMemeberOperationDTO.getOperateStatus())) {
return new Result().error(ModuleConstant.APPLY_NOEXISTS);
logger.error(ModuleConstant.APPLY_NOEXISTS);
throw new RenException(ModuleConstant.APPLY_NOEXISTS);
}
//2、只有群主才可以审批入群申请
ResiGroupMemberDTO leaderMember = baseDao.selectGroupMemberInfo(groupMemeberOperationDTO.getGroupId(), disagreeApplyFormDTO.getUserId());
if (!LeaderFlagConstant.GROUP_LEADER.equals(leaderMember.getGroupLeaderFlag())) {
return new Result().error(ModuleConstant.CANNOT_AUDIT_APPLY);
logger.error(ModuleConstant.CANNOT_AUDIT_APPLY);
throw new RenException(ModuleConstant.CANNOT_AUDIT_APPLY);
}
//3、修改操作状态
groupMemeberOperationDTO.setOperateStatus(MemberStateConstant.REJECTED);
@ -439,16 +445,16 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
ResiGroupMemberEntity resiGroupMemberEntity = baseDao.selectById(removeMemberFormDTO.getMemberId());
if (null == resiGroupMemberEntity) {
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
result.error(ModuleErrorCode.DELETE_FAILED);
return result;
logger.error(ModuleErrorCode.DELETE_FAILED);
throw new RenException(ModuleErrorCode.DELETE_FAILED);
}
groupMemeberOperationService.saveMemberOperation(removeMemberFormDTO.getUserId(), MemberStateConstant.REMOVED, resiGroupMemberEntity);
//3、修改resi_group_statistical表数据:成员总数-1,普通居民总数-1,热心居民或者党员数根据被删除的用户身份来判断
result = resiGroupStatisticalService.upGroupStatistical(removeMemberFormDTO, resiGroupMemberEntity);
if (!result.success()) {
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
result.error(ModuleErrorCode.DELETE_FAILED);
return result;
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
logger.error(ModuleErrorCode.DELETE_FAILED);
throw new RenException(ModuleErrorCode.DELETE_FAILED);
}
//4、之前这个人发布的话题根据前端传过来的屏蔽标志更新话题状态(移除一条话题在话题操作日志表添加一条日志)
if (removeMemberFormDTO.getHideFlag().equals(NumConstant.ONE_STR)) {
@ -478,16 +484,16 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl<ResiGroupMemberD
ResiGroupMemberEntity resiGroupMemberEntity = baseDao.selectById(slientMemberFormDTO.getMemberId());
if (null == resiGroupMemberEntity) {
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
result.error(ModuleErrorCode.SLIENT_FAILED);
return result;
logger.error(ModuleErrorCode.SLIENT_FAILED);
throw new RenException(ModuleErrorCode.SLIENT_FAILED);
}
groupMemeberOperationService.saveMemberOperation(slientMemberFormDTO.getUserId(), MemberStateConstant.SILENT, resiGroupMemberEntity);
//3:用户消息(user_message)表新增消息数据
ResiGroupEntity resiGroupEntity = resiGroupService.selectById(resiGroupMemberEntity.getResiGroupId());
if (null == resiGroupEntity) {
logger.error(ModuleErrorCode.DATA_ACQUISITION_FAILED);
result.error(ModuleErrorCode.SLIENT_FAILED);
return result;
logger.error(ModuleErrorCode.SLIENT_FAILED);
throw new RenException(ModuleErrorCode.SLIENT_FAILED);
}
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(resiGroupEntity.getCustomerId());

21
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java

@ -21,6 +21,7 @@ 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.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -142,8 +143,8 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
//1.判断当前用户是否被禁言
ResiTopicDTO topic = resiTopicService.get(resiCommentFormDTO.getTopicId());
if(null == topic){
logger.warn(ModuleConstant.NO_SUCH_TOPIC);
return new Result().error(ModuleConstant.NO_SUCH_TOPIC);
logger.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}
ResiGroupMemberDTO resiGroupMemberDTO =
@ -152,23 +153,23 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
if(null != resiGroupMemberDTO){
if(MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())){
//当前用户被禁言
logger.warn(ModuleConstant.SLIENT_MEMBER);
return new Result().error(ModuleConstant.SLIENT_MEMBER);
logger.error(ModuleConstant.SLIENT_MEMBER);
throw new RenException(ModuleConstant.SLIENT_MEMBER);
}else if(MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())){
//当前用户已被移出群
logger.warn(ModuleConstant.REMOVED_MEMBER);
return new Result().error(ModuleConstant.REMOVED_MEMBER);
logger.error(ModuleConstant.REMOVED_MEMBER);
throw new RenException(ModuleConstant.REMOVED_MEMBER);
}
}else{
//当前用户非组内成员
logger.warn(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
return new Result().error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
}
if(resiCommentFormDTO.getCommentContent().length() > TopicConstant.MAX_NUMBER_OF_COMMENT){
logger.warn(ModuleConstant.COMMENT_NUMBER_OF_WORDS_EXCEEDED);
return new Result().error(ModuleConstant.COMMENT_NUMBER_OF_WORDS_EXCEEDED);
logger.error(ModuleConstant.COMMENT_NUMBER_OF_WORDS_EXCEEDED);
throw new RenException(ModuleConstant.COMMENT_NUMBER_OF_WORDS_EXCEEDED);
}
ResiTopicCommentEntity comment = ConvertUtils.sourceToTarget(resiCommentFormDTO,ResiTopicCommentEntity.class);
comment.setStatus(TopicConstant.PUBLISHMENT);

53
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -175,7 +176,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
public Result createTopic(TokenDto tokenDto, ResiTopicPublishFormDTO resiTopicPublishFormDTO) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
//1.身份校验,查看当前用户是否是组内成员,当前用户是否被禁言
@ -192,7 +194,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//2.创建话题
if(resiTopicPublishFormDTO.getTopicContent().length() > TopicConstant.MAX_NUMBER_OF_CONTENT){
//内容超过最大限制
return new Result().error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED);
logger.error(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED);
throw new RenException(ModuleConstant.TOPIC_CONTENT_NUMBER_OF_WORDS_EXCEEDED);
}
ResiTopicEntity topic = ConvertUtils.sourceToTarget(resiTopicPublishFormDTO,ResiTopicEntity.class);
topic.setCreatedBy(tokenDto.getUserId());
@ -200,8 +203,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
baseDao.insertOne(topic);
if(StringUtils.isBlank(topic.getId())){
//没有返回主键
logger.warn(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
return new Result().error(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
logger.error(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
throw new RenException(ModuleConstant.NO_PRIMARY_KEY_RETURNED);
}
if(null != resiTopicPublishFormDTO.getAttachmentList() && resiTopicPublishFormDTO.getAttachmentList().size() > 0){
ResiTopicAttachmentEntity attachment = new ResiTopicAttachmentEntity();
@ -230,8 +233,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
List<ResiGroupStatisticalEntity> statistical = resiGroupStatisticalDao.selectList(wrapper);
if(null != statistical && statistical.size() >= NumConstant.ONE){
if(statistical.size() != NumConstant.ONE){
logger.warn(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
return new Result().error(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
logger.error(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
throw new RenException(ModuleConstant.GROUP_STASTICAL_NOT_SINGLE);
}else{
ResiGroupStatisticalEntity statistical2Update = new ResiGroupStatisticalEntity();
statistical2Update.setId(statistical.get(NumConstant.ZERO).getId());
@ -241,8 +244,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
resiGroupStatisticalDao.updateById(statistical2Update);
}
}else{
logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
return new Result().error(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
logger.error(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
throw new RenException(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO);
}
@ -265,7 +268,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
public Result<List<ResiTopicInfoResultDTO>> getLatestTopics(TokenDto tokenDto, String groupId) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
if (StringUtils.isBlank(groupId)) {
return new Result<List<ResiTopicInfoResultDTO>>().error();
@ -301,7 +305,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
public Result<List<ResiTopicInfoResultDTO>> getPastTopicList(TokenDto tokenDto, ResiTopicPageFormDTO topicPageFormDTO) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
//1.查询历史话题列表
@ -340,7 +345,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
public Result hideTopic(TokenDto tokenDto, ResiTopicOperationFormDTO hiddenFormDTO) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
//1.1拿到组Id
@ -395,7 +401,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
public Result cancelHiddenTopics(TokenDto tokenDto, List<String> topicIds) {
if(null == topicIds || topicIds.size() <= 0){
return new Result().error(ModuleConstant.TOPIC_ID_LIST_NOT_NULL);
logger.error(ModuleConstant.TOPIC_ID_LIST_NOT_NULL);
throw new RenException(ModuleConstant.TOPIC_ID_LIST_NOT_NULL);
}
//1.1拿到组Id
@ -484,8 +491,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//1.获取话题基本信息
ResiTopicEntity topicDetail = baseDao.selectById(topicId);
if(null == topicDetail || !StringUtils.equals(topicDetail.getId(),topicId)){
logger.warn(ModuleConstant.NO_SUCH_TOPIC);
return new Result().error(ModuleConstant.NO_SUCH_TOPIC);
logger.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}
ResiTopicDetailResultDTO resultDTO = new ResiTopicDetailResultDTO();
resultDTO.setTopicId(topicId);
@ -574,18 +581,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
if(MemberStateConstant.SILENT.equals(resiGroupMemberDTO.getStatus())){
//当前用户被禁言
logger.error(ModuleConstant.SLIENT_MEMBER);
return new Result().error(ModuleConstant.SLIENT_MEMBER);
throw new RenException(ModuleConstant.SLIENT_MEMBER);
}else if(MemberStateConstant.REMOVED.equals(resiGroupMemberDTO.getStatus())){
//当前用户已被移出群
logger.error(ModuleConstant.REMOVED_MEMBER);
return new Result().error(ModuleConstant.REMOVED_MEMBER);
throw new RenException(ModuleConstant.REMOVED_MEMBER);
}else{
return new Result();
}
}else{
//当前用户非组内成员
logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
return new Result().error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
}
}
@ -603,21 +610,21 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//1.2判断是否是组长
if(!StringUtils.equals(leaderVerify.getCustomerUserId(),userId)){
//非组长,无权限进行操作
logger.warn(ModuleConstant.NO_TEAMLEADER_AUTH);
return new Result().error(ModuleConstant.NO_TEAMLEADER_AUTH);
logger.error(ModuleConstant.NO_TEAMLEADER_AUTH);
throw new RenException(ModuleConstant.NO_TEAMLEADER_AUTH);
}else{
//是组长
return new Result();
}
}else{
//未找到当前用户的成员信息
logger.warn(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
return new Result().error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
}
}else{
//未能识别该话题基本信息
logger.warn(ModuleConstant.NO_SUCH_TOPIC);
return new Result().error(ModuleConstant.NO_SUCH_TOPIC);
logger.error(ModuleConstant.NO_SUCH_TOPIC);
throw new RenException(ModuleConstant.NO_SUCH_TOPIC);
}
}

6
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/StrangerAccessRecordServiceImpl.java

@ -7,6 +7,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -41,7 +42,7 @@ import java.util.*;
@Service
public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements StrangerAccessRecordService {
private static final Logger log = LoggerFactory.getLogger(StrangerAccessRecordServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(StrangerAccessRecordServiceImpl.class);
@Autowired
private StrangerAccessRecordDao strangerAccessRecordDao;
@Autowired
@ -205,7 +206,8 @@ public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAcc
//1.先判断参数
//居民端 所以参数必须是居民端的参数 否则就是参数错误
if (!AppClientConstant.APP_RESI.equals(tokenDTO.getApp())) {
return new Result<HomeDesignByCustomerResultDTO>().error(StrangerResiGuideConstant.PARAMETER_EXCEPTION);
logger.error(StrangerResiGuideConstant.PARAMETER_EXCEPTION);
throw new RenException(StrangerResiGuideConstant.PARAMETER_EXCEPTION);
}
//token里边有所属端 userId这些参数 前台传递customerID和gridId
/*//2:调用epmet-user服务查询数据 新建网格记录数据

11
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.modules.grid.service.impl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.LatestGridInfoResultDTO;
@ -8,6 +9,8 @@ import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.grid.service.ResiMineGridService;
import com.epmet.modules.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -18,7 +21,7 @@ import org.springframework.stereotype.Service;
*/
@Service
public class ResiMineGridServiceImpl implements ResiMineGridService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@ -32,10 +35,12 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfo(TokenDto tokenDto) {
if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) {
return new Result<LatestGridInfoResultDTO>().error(ModuleConstant.USER_NOT_NULL);
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
if(!AppClientConstant.APP_RESI.equals(tokenDto.getApp())){
return new Result<LatestGridInfoResultDTO>().error(ModuleConstant.FOR_RESI_CALL);
logger.error(ModuleConstant.FOR_RESI_CALL);
throw new RenException(ModuleConstant.FOR_RESI_CALL);
}
return epmetUserFeignClient.getLatestGridInfoByUserId(tokenDto.getUserId());
}

12
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java

@ -110,17 +110,13 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService
partyMemberInfoParam.setCustomerId(fromDTO.getCustomerId());
PartymemberInfoDTO partyMemberInfoResult = partymemberInfoService.getPartyMemberInfoByMobile(partyMemberInfoParam);
if (null != partyMemberInfoResult) {
result.setCode(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
result.setMsg(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
}
//生成短信验证码
Map<String, String> message = (Map<String, String>) messageFeignClient.sendSmsCaptcha(fromDTO.getMobile()).getData();
if (null == message) {
result.setCode(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
result.setMsg(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
}
//删除旧验证码
partyMemberInfoRedis.deleteUserMobileCodeByPattern(fromDTO.getUserId(), fromDTO.getMobile());
@ -146,9 +142,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService
if (null == code) {
saveOrUpdateVisit(partyMemberInfoDTO.getPartymemberVisitId(), null,
PartyMemberConstant.OPERATE_AUTO_FAILED);
result.setCode(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
result.setMsg(EpmetErrorCode.MOBILE_CODE_ERROR.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//获取党员基本信息

10
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -34,6 +35,7 @@ import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant;
import com.epmet.modules.warmhearted.dao.ResiWarmheartedApplyDao;
import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity;
@ -67,7 +69,7 @@ import org.slf4j.LoggerFactory;
@Service
public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmheartedApplyDao, ResiWarmheartedApplyEntity> implements ResiWarmheartedApplyService {
private static final Logger log = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(ResiWarmheartedApplyServiceImpl.class);
@Autowired
private ResiWarmheartedApplyRedis resiWarmheartedApplyRedis;
@Autowired
@ -146,7 +148,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
//1:热心居民申请行为记录表新增数据
result = resiWarmheartedVisitService.saveResiWarmheartedVisit(formDTO);
if (!result.success()) {
log.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION);
logger.error(ResiWarmheartedVisitConstant.OPERATION_EXCEPTION);
}
ResiWarmheartedResultDTO resiWarmheartedResultDTO = result.getData();
//2:查询是否已申请热心居民(不查询审核未通过的)
@ -172,8 +174,8 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
ResiWarmheartedFormDTO.setAuditStatus(ResiWarmheartedVisitConstant.REJECTED);
ResiWarmheartedApplyDTO resiWarmheartedApplyDTO = resiWarmheartedApplyDao.selectResiWarmheartedApply(ResiWarmheartedFormDTO);
if (null != resiWarmheartedApplyDTO) {
result.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
return result;
logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
}else{
//1:将申请记录存入热心居民申请表中
saveResiWarmApply(formDTO);

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

@ -21,6 +21,7 @@ package com.epmet.service.impl;
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.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
@ -35,6 +36,8 @@ import com.epmet.entity.GridLatestEntity;
import com.epmet.redis.GridLatestRedis;
import com.epmet.service.GridLatestService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -52,7 +55,7 @@ import java.util.Map;
*/
@Service
public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLatestEntity> implements GridLatestService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private GridLatestRedis gridLatestRedis;
@Autowired
@ -147,7 +150,8 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
if(StringUtils.isBlank(userId)){
return new Result<LatestGridInfoResultDTO>().error(GridVisitedConstant.USER_ID_NOTNULL);
logger.error(GridVisitedConstant.USER_ID_NOTNULL);
throw new RenException(GridVisitedConstant.USER_ID_NOTNULL);
}
LatestGridInfoResultDTO latestGridInfoResultDTO = baseDao.selectLatestGridInfoByUserId(userId);
if (null == latestGridInfoResultDTO) {

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java

@ -21,6 +21,7 @@ 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.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -54,8 +55,7 @@ import java.util.Map;
*/
@Service
public class GridVisitedServiceImpl extends BaseServiceImpl<GridVisitedDao, GridVisitedEntity> implements GridVisitedService {
private static final Logger log = LoggerFactory.getLogger(GridVisitedServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(GridVisitedServiceImpl.class);
@Autowired
private GovOrgFeignClient govOrgFeignClient;
@Autowired
@ -131,19 +131,19 @@ public class GridVisitedServiceImpl extends BaseServiceImpl<GridVisitedDao, Grid
dto.setGridId(visitedFormDTO.getGridId());
Result<CustomerGridDTO> gridDTO = govOrgFeignClient.getCustomerGridByGridId(dto);
if (!gridDTO.success()) {
log.warn(GridVisitedConstant.QUERY_EXCEPTION);
result.error(GridVisitedConstant.QUERY_EXCEPTION);
logger.error(GridVisitedConstant.QUERY_EXCEPTION);
throw new RenException(GridVisitedConstant.QUERY_EXCEPTION);
}
CustomerGridDTO customerGridDTO = gridDTO.getData();
//2:网格访问记录表新增数据
if (!saveGridVisited(visitedFormDTO, customerGridDTO)) {
log.warn(GridVisitedConstant.SAVE_VISITED);
result.error(GridVisitedConstant.SAVE_VISITED);
logger.error(GridVisitedConstant.SAVE_VISITED);
throw new RenException(GridVisitedConstant.SAVE_VISITED);
}
//3:最近访问网格表新增数据
if (!gridLatestService.saveGridLatest(visitedFormDTO, customerGridDTO)) {
log.warn(GridVisitedConstant.SAVE_LATEST);
result.error(GridVisitedConstant.SAVE_LATEST);
logger.error(GridVisitedConstant.SAVE_LATEST);
throw new RenException(GridVisitedConstant.SAVE_LATEST);
}
return result;
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -156,17 +156,13 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
if(null == verificationCode || StringUtils.isBlank(verificationCode)){
//验证码校验失败则更新行为记录表数据 返回前台结果
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
result.setCode(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
result.setMsg(EpmetErrorCode.MOBILE_CODE_ERROR.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
//2:再次判断手机号是否可用
if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile())) {
//手机号验证失败则更新行为记录表数据 返回前台结果
userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO);
result.setCode(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
result.setMsg(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
}
//3:校验成功 数据存入居民注册表 更新行为记录表数据
saveUserResiInfo(userResiInfoDTO);
@ -209,17 +205,13 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO);
//2:判断手机号是否可用
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) {
result.setCode(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
result.setMsg(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode());
}
//3:调用短信服务 生成验证码发送短信
result = messageFeignClient.sendSmsCaptcha(verificationCodeFormDTO.getMobile());
Map<String,Object> map = (Map<String, Object>) result.getData();
if (null == map || null == map.get("code")) {
result.setCode(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
result.setMsg(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getMsg());
return result;
return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode());
}
//4:删除缓存中可能存在的旧验证码
userResiInfoRedis.deleteOldUserMobileCode(verificationCodeFormDTO.getUserId(), verificationCodeFormDTO.getMobile());

Loading…
Cancel
Save