Browse Source

1.调整小组信息编辑异常抛出

dev_shibei_match
wxz 5 years ago
parent
commit
361edcb801
  1. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

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

@ -41,7 +41,6 @@ public enum EpmetErrorCode {
MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"),
MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"),
NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"),
GROUP_EDIT_ERROR(8107,"组信息编辑失败"),
ORG_IS_NOT_NULL(8107,"党组织关系不能为空"),
CANNOT_DELETE_PARTY_BRANCH(8108,"当前支部存在党员,不允许删除"),
@ -123,7 +122,12 @@ public enum EpmetErrorCode {
SELECT_CUSTOMER_ERROR(8652,"未查询到注册客户信息"),
SELECT_AGENCY_ERROR(8653,"根据客户信息未查询到注册客户组织信息"),
SELECT_USER_ERROR(8654,"根据客户信息未查询到注册客户管理员信息"),
UPDATE_CUSTOMER_ERROR(8655,"更新注册客户信息为已完成初始化失败");
UPDATE_CUSTOMER_ERROR(8655,"更新注册客户信息为已完成初始化失败"),
GROUP_EDIT_ERROR(9000,"组信息编辑失败"),
GROUP_NOT_EXISTS(9001,"该组不存在"),
GROUP_IN_AUDITING(9002,"该组已提交编辑,处于待审核状态,完成审核前不可再次提交"),
GROUP_EDIT_NUM_LIMITED(9003,"已达编辑次数上限");
private int code;

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

@ -1062,27 +1062,26 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
// 1.判断小组是否存在,判断是否已经在"待审核"状态
ResiGroupEntity group = resiGroupDao.selectById(groupId);
if (group == null) {
throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "组信息不存在");
throw new RenException(EpmetErrorCode.GROUP_NOT_EXISTS.getCode(), EpmetErrorCode.GROUP_NOT_EXISTS.getMsg());
}
// 2.判断是否可以提交编辑
GroupEditSubmitRecordEntity lre = groupEditSubmitRecordDao.getLatestEditSubmitRecord(groupId);
if (lre != null && GroupAuditStatusConstant.UNDER_AUDITING.equals(lre.getAuditStatus())) {
// 在待审核状态,不允许再次提交编辑
throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "该组已提交编辑,处于待审核状态,完成审核前不可再次提交");
throw new RenException(EpmetErrorCode.GROUP_IN_AUDITING.getCode(), EpmetErrorCode.GROUP_IN_AUDITING.getMsg());
}
if (resiGroupDao.countExistsGroupNameBeforeEdit(groupId, group.getGridId(), groupName) > 0) {
// 已存在组名,拒绝提交
throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(), "组名已存在");
throw new RenException(EpmetErrorCode.GROUP_ALREADY_EXISTED.getCode(), EpmetErrorCode.GROUP_ALREADY_EXISTED.getMsg());
}
Date now = new Date();
int usedEditNum = groupEditSubmitRecordDao.countEditNum(groupId, DateUtils.getMonthStart(now), DateUtils.getMonthEnd(now));
if (GroupLimitConstant.EDIT_NUM_LIMIT_MONTH <= usedEditNum) {
// 达到最大编辑次数了
throw new RenException(EpmetErrorCode.GROUP_EDIT_ERROR.getCode(),
String.format("本月可用修改次数为%s次,您已使用%s次", GroupLimitConstant.EDIT_NUM_LIMIT_MONTH, usedEditNum));
throw new RenException(EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getCode(), EpmetErrorCode.GROUP_EDIT_NUM_LIMITED.getMsg());
}
// 3.内容检查

Loading…
Cancel
Save