Commit ceb5dcfb authored by cq990612's avatar cq990612

优化代码结构

parent 95b909aa
......@@ -51,7 +51,7 @@ public enum BASE_RESP_CODE_ENUM {
WORK_PROJECT_IS_NULL("629","项目或商机为空"),
WORK_ORDER_END("630", "该项目暂无待审批工单"),
DEPT_IS_NULL("631","该部门不存在"),
MANAGER_NOT_PROJECT("632","该管理没有可管理的项目"),
USER_NOT_LEVEL("632","该用户没有权限,请联系管理员添加权限"),
DEPT_NOT_FOUND("633", "部门信息未找到"),
FAILEDTO_DELETE_DATA("634","删除数据失败"),
CENTRE_NOT_FOUND("635","中心信息未找到"),
......
......@@ -44,6 +44,6 @@ public interface WorkUserMapper extends BaseMapper<WorkUser> {
List<WorkRole> getUserRole(Integer id);
int updateStatusById(Integer userId, Integer status);
int updateStatusById(@Param("userId") Integer userId,@Param("status") Integer status);
}
......@@ -119,10 +119,10 @@
<select id="getManagerProjectsDto" resultType="cn.wisenergy.model.dto.ManagerProjectsDto">
select p.id,p.oa_project_id,p.project_name,p.type,p.create_time,p.is_conclusion,
GROUP_CONCAT(DISTINCT(u.name)) as 'participants',p.cost_budget,p.work_time,p.start_time,p.end_time,
if(cost is NULL,0.00,cost) as 'currentLaborCost',if(total_time is NULL,0.00,total_time) as 'totalCurrentWorkingHours',
if(cost is NULL,0,0 + cast(cost as char)) as 'currentLaborCost',if(total_time is NULL,0,0 + cast(total_time as char)) as 'totalCurrentWorkingHours',
if(p.end_time>=curdate(),'否','是') as 'isItOverdue',
if(p.create_time = p.modify_time,'否','是') as 'isThereABudgetChange'
from work_project p LEFT JOIN (select project_id,SUM(total_time) as 'total_time',SUM(cost) as 'cost'
from work_project p LEFT JOIN (select project_id,SUM(total_time) as 'total_time',SUM(cost)/10000 as 'cost'
FROM work_project_time_cost
GROUP BY project_id) o on p.id = o.project_id
LEFT JOIN work_user_project up ON p.id = up.project_id
......
......@@ -348,7 +348,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
public PageInfo<WorkTimeOrderDto> getExamine(Integer userId, Integer projectId, Integer type, Integer page, Integer pageSize, List<Integer> status) {
log.info("WorkOrderServiceImpl[]getExamine[]input.param.userId:{},projectId:{},type:{},page:{},size:{},status:{}" + userId, projectId, type, page, pageSize, status);
// 判断当前用户是否是管理员
isManager(userId);
if (UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
}
WorkUser user = workUserService.getById(userId);
// PC端
return pageExamine(user, projectId, type, page, pageSize, status);
......@@ -365,7 +367,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
@Override
public List<AppletsPendApprovalDto> getExamineApplets(Integer userId, Integer projectId, Integer type) {
log.info("WorkOrderServiceImpl[]getExamineApplets[]input.param.userId:{},projectId:{},type:{}" + userId, projectId, type);
isManager(userId);
if (UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
}
WorkUser user = workUserService.getById(userId);
if (null == projectId && null == type) {
return null;
......@@ -444,8 +448,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (CollectionUtils.isEmpty(ids)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
isManager(reviewerId);
if (UserRoleLevelUtils.isManagerLevel(reviewerId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
}
int i = workTimeOrderMapper.updateByIds(reviewerId, ids);
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
......@@ -477,7 +482,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
// 判断当前用户是否有权限
isManager(reviewerId);
if (UserRoleLevelUtils.isManagerLevel(reviewerId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
}
// 修改工单状态
int i = workTimeOrderMapper.updateStatusById(reviewerId, id, reason);
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
......@@ -503,7 +511,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
@Override
public List<WorkTimeOrderDto> rejectNotSubmit(Integer userId) {
log.info("WorkOrderServiceImpl[]rejectById[]input.param.id:{}" + userId);
isManager(userId);
if (UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
}
QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>();
wrapper.eq("reviewer_id", userId);
wrapper.eq("status", REJECTED);
......
......@@ -100,13 +100,13 @@ public class SystemController extends BaseController {
return getResult(allRoleAndUserRoleDto);
}
@ApiOperation(value = "设置角色", notes = "设置角色", httpMethod = "POST")
@ApiOperation(value = "设置角色", notes = "设置角色", httpMethod = "PUT")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId",value = "用户id",dataType = "int",required = true),
@ApiImplicitParam(name = "roleIds", value = "角色ids", dataType = "String", required = true),
@ApiImplicitParam(name = "status",value = "用户状态",dataType = "int",required = true)
})
@PostMapping("/modifyRole")
@PutMapping("/modifyRole")
public Result<Boolean> modifyRole(Integer userId,String roleIds,Integer status) {
log.info("SystemController[]modifyRole[]input.param.userId:{},roleIds:{},status:{}" + userId, roleIds,status);
if (null == userId || StringUtils.isBlank(roleIds) || null == status) {
......@@ -129,9 +129,9 @@ public class SystemController extends BaseController {
return getResult(aBoolean);
}
@ApiOperation(value = "删除工时类型", notes = "删除工时类型", httpMethod = "PUT")
@ApiOperation(value = "删除工时类型", notes = "删除工时类型", httpMethod = "DELETE")
@ApiImplicitParam(name = "id",value = "类型id",dataType ="int", required = true)
@PutMapping("/modifyWorkType")
@DeleteMapping("/modifyWorkType")
public Result<Boolean> deleteTypeById(Integer id) {
log.info("SystemController[]modifyRole[]input.param.id:{}" + id);
Boolean aBoolean = workTypeService.deleteTypeById(id);
......
......@@ -58,9 +58,9 @@ public class WorkProjectController extends BaseController {
}
@ApiOperation(value = "编辑项目/商机", notes = "编辑项目/商机", httpMethod = "POST")
@ApiOperation(value = "编辑项目/商机", notes = "编辑项目/商机", httpMethod = "PUT")
@ApiImplicitParam(name = "modifyProjectVo", value = "编辑内容", dataType = "ModifyProjectVo", required = true)
@PostMapping(value = "/modifyProject")
@PutMapping(value = "/modifyProject")
public Result<Boolean> modifyProject(@RequestBody ModifyProjectVo modifyProjectVo) {
log.info("WorkProjectController[]endProject[]input.param.modifyProjectVo:{}" + modifyProjectVo);
Boolean aBoolean = workProjectService.modifyProject(modifyProjectVo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment