Commit 89f51fe568e43f4ac05870f6dfcacba513aeb9f2

Authored by jason
1 parent 9dc7d2d1

修改code review

yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java
... ... @@ -15,13 +15,12 @@ public interface BpmErrorCodeConstants {
15 15  
16 16  
17 17 // ========== OA 流程模块 1-003-001-000 ==========
18   - // TODO @jason:前缀
19   - ErrorCode LEAVE_NOT_EXISTS = new ErrorCode(1003001001, "请假申请不存在");
20   - ErrorCode PM_POST_NOT_EXISTS = new ErrorCode(1003001002, "项目经理岗位未设置");
21   - ErrorCode DEPART_PM_POST_NOT_EXISTS = new ErrorCode(1003001003, "部门的项目经理不存在");
22   - ErrorCode BM_POST_NOT_EXISTS = new ErrorCode(1003001004, "部门经理岗位未设置");
23   - ErrorCode DEPART_BM_POST_NOT_EXISTS = new ErrorCode(1003001005, "部门的部门经理不存在");
24   - ErrorCode HR_POST_NOT_EXISTS = new ErrorCode(1003001006, "HR岗位未设置");
25   - ErrorCode DAY_LEAVE_ERROR = new ErrorCode(1003001007, "请假天数必须>=1");
  18 + ErrorCode OA_LEAVE_NOT_EXISTS = new ErrorCode(1003001001, "请假申请不存在");
  19 + ErrorCode OA_PM_POST_NOT_EXISTS = new ErrorCode(1003001002, "项目经理岗位未设置");
  20 + ErrorCode OA_DEPART_PM_POST_NOT_EXISTS = new ErrorCode(1003001003, "部门的项目经理不存在");
  21 + ErrorCode OA_BM_POST_NOT_EXISTS = new ErrorCode(1003001004, "部门经理岗位未设置");
  22 + ErrorCode OA_DEPART_BM_POST_NOT_EXISTS = new ErrorCode(1003001005, "部门的部门经理不存在");
  23 + ErrorCode OA_HR_POST_NOT_EXISTS = new ErrorCode(1003001006, "HR岗位未设置");
  24 + ErrorCode OA_DAY_LEAVE_ERROR = new ErrorCode(1003001007, "请假天数必须>=1");
26 25  
27 26 }
... ...
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/oa/impl/OALeaveServiceImpl.java
... ... @@ -8,7 +8,6 @@ import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.leave.OALeaveDO;
8 8 import cn.iocoder.yudao.adminserver.modules.bpm.dal.mysql.oa.OALeaveMapper;
9 9 import cn.iocoder.yudao.adminserver.modules.bpm.enums.FlowStatusEnum;
10 10 import cn.iocoder.yudao.adminserver.modules.bpm.service.oa.OALeaveService;
11   -import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.SysUserBaseVO;
12 11 import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO;
13 12 import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.dept.SysPostMapper;
14 13 import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.user.SysUserMapper;
... ... @@ -71,7 +70,7 @@ public class OALeaveServiceImpl implements OALeaveService {
71 70 Date endTime = createReqVO.getEndTime();
72 71 long day = DateUtil.betweenDay(startTime, endTime, false);
73 72 if (day <= 0) {
74   - throw ServiceExceptionUtil.exception(DAY_LEAVE_ERROR);
  73 + throw ServiceExceptionUtil.exception(OA_DAY_LEAVE_ERROR);
75 74 }
76 75 Map<String, Object> taskVariables = createReqVO.getTaskVariables();
77 76 taskVariables.put("day", day);
... ... @@ -125,7 +124,7 @@ public class OALeaveServiceImpl implements OALeaveService {
125 124  
126 125 private void validateLeaveExists(Long id) {
127 126 if (leaveMapper.selectById(id) == null) {
128   - throw exception(LEAVE_NOT_EXISTS);
  127 + throw exception(OA_LEAVE_NOT_EXISTS);
129 128 }
130 129 }
131 130  
... ... @@ -161,32 +160,32 @@ public class OALeaveServiceImpl implements OALeaveService {
161 160 //TODO jason 定义enum
162 161 SysPostDO pmPostDO = sysPostMapper.selectByCode("pm");
163 162 if (Objects.isNull(pmPostDO)) {
164   - throw ServiceExceptionUtil.exception(PM_POST_NOT_EXISTS);
  163 + throw ServiceExceptionUtil.exception(OA_PM_POST_NOT_EXISTS);
165 164 }
166 165 SysUserDO userDO = sysUserMapper.selectById(id);
167 166 final List<SysUserDO> pmUsers = sysUserMapper.selectListByDepartIdAndPostId(userDO.getDeptId(), pmPostDO.getId());
168 167 if (CollUtil.isEmpty(pmUsers)) {
169   - throw ServiceExceptionUtil.exception(DEPART_PM_POST_NOT_EXISTS);
  168 + throw ServiceExceptionUtil.exception(OA_DEPART_PM_POST_NOT_EXISTS);
170 169 }
171 170  
172 171 //部门经理
173 172 SysPostDO bmPostDO = sysPostMapper.selectByCode("bm");
174 173 if (Objects.isNull(bmPostDO)) {
175   - throw ServiceExceptionUtil.exception(BM_POST_NOT_EXISTS);
  174 + throw ServiceExceptionUtil.exception(OA_BM_POST_NOT_EXISTS);
176 175 }
177 176  
178 177 final List<SysUserDO> bmUsers = sysUserMapper.selectListByDepartIdAndPostId(userDO.getDeptId(), bmPostDO.getId());
179 178 if (CollUtil.isEmpty(bmUsers)) {
180   - throw ServiceExceptionUtil.exception(DEPART_BM_POST_NOT_EXISTS);
  179 + throw ServiceExceptionUtil.exception(OA_DEPART_BM_POST_NOT_EXISTS);
181 180 }
182 181 //人事
183 182 SysPostDO hrPostDO = sysPostMapper.selectByCode("hr");
184 183 if (Objects.isNull(hrPostDO)) {
185   - throw ServiceExceptionUtil.exception(HR_POST_NOT_EXISTS);
  184 + throw ServiceExceptionUtil.exception(OA_HR_POST_NOT_EXISTS);
186 185 }
187 186 final List<SysUserDO> hrUsers = sysUserMapper.selectListByDepartIdAndPostId(userDO.getDeptId(), hrPostDO.getId());
188 187 if (CollUtil.isEmpty(hrUsers)) {
189   - throw ServiceExceptionUtil.exception(DEPART_BM_POST_NOT_EXISTS);
  188 + throw ServiceExceptionUtil.exception(OA_DEPART_BM_POST_NOT_EXISTS);
190 189 }
191 190 return OALeaveApplyMembersVO.builder().pm(pmUsers.get(0).getUsername())
192 191 .bm(bmUsers.get(0).getUsername())
... ...