Commit e712163f authored by cq990612's avatar cq990612

优化代码结构

parent 6caecce9
......@@ -119,7 +119,7 @@
<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,
cost as 'currentLaborCost',total_time as 'totalCurrentWorkingHours',
if(cost is NULL,0.00,cost) as 'currentLaborCost',if(total_time is NULL,0.00,total_time) as 'totalCurrentWorkingHours',
if(now() BETWEEN p.start_time and p.end_time,'否','是') 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'
......@@ -156,9 +156,7 @@ if(p.create_time = p.modify_time,'否','是') as 'isThereABudgetChange'
</where>
GROUP BY p.id
ORDER BY p.is_conclusion DESC
</select>
......
......@@ -2,6 +2,7 @@ package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -24,4 +25,8 @@ public class WorkLevel {
private Integer rank;
/**附加字段*/
@TableField(exist = false)
private String path;
}
......@@ -5,21 +5,28 @@ package cn.wisenergy.model.enums;
* @QQ1799796883
*/
public enum LevelEnum {
EXAMINE("审批"),
STATISTICS("统计"),
PROJECT_MANAGER( "项目/商机管理"),
TIMEEXPORT("工时导出"),
SYSTEMSETTINGS("系统设置"),
ACCOUNTMANAGEMENT("账号管理"),
EXAMINE("审批","/index"),
STATISTICS("统计","/statistical"),
PROJECT_MANAGER( "项目/商机管理","/projects"),
TIMEEXPORT("工时导出","/export"),
SYSTEMSETTINGS("系统设置","/systemSettings"),
ACCOUNTMANAGEMENT("账号管理","/accountSetting"),
;
private String LevelName;
public String getPath() {
return path;
}
private String path;
LevelEnum(String LevelName) {
LevelEnum(String LevelName,String path) {
this.LevelName = LevelName;
this.path = path;
}
public String getLevelName() {
......
......@@ -341,14 +341,14 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if (null != modifyProjectVo.getWorkTime()) {
workProjectChange.setChangeType(2);
workProjectChange.setModifyBefore(workProject.getWorkTime().toString());
workProjectChange.setModifyAfter(modifyProjectVo.getWorkTime().toString());
workProjectChange.setModifyAfter(modifyProjectVo.getWorkTime().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
workProjectChange.setReason(modifyProjectVo.getWorkTimeReason());
workProjectChanges.add(workProjectChange);
}
if (null != modifyProjectVo.getCostBudget()) {
workProjectChange.setChangeType(1);
workProjectChange.setModifyBefore(workProject.getCostBudget().toString());
workProjectChange.setModifyAfter(modifyProjectVo.getCostBudget().toString());
workProjectChange.setModifyAfter(modifyProjectVo.getCostBudget().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
workProjectChange.setReason(modifyProjectVo.getCostBudgetReason());
workProjectChanges.add(workProjectChange);
}
......@@ -388,8 +388,8 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if (BigDecimal.ZERO.compareTo(createProjectVo.getWorkTime())>0 ||BigDecimal.ZERO.compareTo(createProjectVo.getCostBudget())>0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.BUDGET_CANNOT_BELESSTHAN_ZERO);
}
// 判断oa编号是否重复 TODO
List<WorkProject> workProjects = workProjectMapper.selectList(new QueryWrapper<>());
// 判断oa编号是否重复
/* List<WorkProject> workProjects = workProjectMapper.selectList(new QueryWrapper<>());
if (CollectionUtils.isEmpty(workProjects)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_PROJECT_IS_NULL);
}
......@@ -397,7 +397,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if (workProject.getOaProjectId().equals(createProjectVo.getOaProjectId())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.ITEMOADUPLICATE);
}
}
}*/
// 插入项目信息
Date date = new Date();
......@@ -429,8 +429,6 @@ public class WorkProjectServiceImpl implements WorkProjectService {
* 判断更变内容是否等于原内容
*/
private void verificationItem(ModifyProjectVo modifyProjectVo, WorkProject workProject, List<Integer> userIds) {
if (null != modifyProjectVo.getStartTime()) {
if (StringUtils.isBlank(modifyProjectVo.getStartTimeReason())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.REASON_CANNOT_BE_EMPTY);
......@@ -469,7 +467,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if (StringUtils.isBlank(modifyProjectVo.getCostBudgetReason())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.REASON_CANNOT_BE_EMPTY);
}
if (workProject.getCostBudget().equals(modifyProjectVo.getCostBudget())) {
if (workProject.getCostBudget().compareTo(modifyProjectVo.getCostBudget())==0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.theNewContent_IsEqual_ToTheOriginal_Content);
}
}
......@@ -477,13 +475,13 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if (StringUtils.isBlank( modifyProjectVo.getWorkTimeReason())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.REASON_CANNOT_BE_EMPTY);
}
if (workProject.getWorkTime().equals(modifyProjectVo.getWorkTime())) {
if (workProject.getWorkTime().compareTo(modifyProjectVo.getWorkTime())==0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.theNewContent_IsEqual_ToTheOriginal_Content);
}
}
if (null != modifyProjectVo.getStartTime() && null != modifyProjectVo.getEndTime() && null != modifyProjectVo.getCostBudget() && null != modifyProjectVo.getWorkTime()) {
if (workProject.getStartTime().compareTo(modifyProjectVo.getStartTime()) == 0 && workProject.getEndTime().compareTo(modifyProjectVo.getEndTime()) == 0 && workProject.getCostBudget().equals(modifyProjectVo.getCostBudget()) &&
if (workProject.getStartTime().compareTo(modifyProjectVo.getStartTime()) == 0 && workProject.getEndTime().compareTo(modifyProjectVo.getEndTime()) == 0 && workProject.getCostBudget().compareTo(modifyProjectVo.getCostBudget())==0 &&
workProject.getWorkTime().equals(modifyProjectVo.getWorkTime())
&& userIds.containsAll(modifyProjectVo.getUserIds()) &&
modifyProjectVo.getUserIds().containsAll(userIds)) {
......
......@@ -48,14 +48,13 @@ public class WorkSubmitAdoptServiceImpl implements WorkSubmitAdoptService {
@Override
public Boolean modifyAuto(WorkSubmitAdopt workSubmitAdopt) {
log.info("WorkSubmitAdoptServiceImpl[]getById[]input.param.workSubmitAdopt:" + workSubmitAdopt);
if (null == workSubmitAdopt || null == workSubmitAdopt.getSubmitTime() || null == workSubmitAdopt.getAutoExamine() || null == workSubmitAdopt.getId()) {
if (null == workSubmitAdopt || (null == workSubmitAdopt.getSubmitTime() && null == workSubmitAdopt.getAutoExamine() )) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkSubmitAdopt workSubmitAdopt1 = workSubmitAdoptMapper.selectById(workSubmitAdopt.getId());
if (null == workSubmitAdopt1) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.QUERY_DATA_IS_NULL);
if (null != workSubmitAdopt.getAutoExamine() && workSubmitAdopt.getAutoExamine() < 1) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THEPERIOD_CANNOT_BELESS_THANONEDAY);
}
if (workSubmitAdopt.getAutoExamine() < 1 || workSubmitAdopt.getSubmitTime() <1) {
if (null !=workSubmitAdopt.getSubmitTime() && workSubmitAdopt.getSubmitTime() <1) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THEPERIOD_CANNOT_BELESS_THANONEDAY);
}
workSubmitAdopt.setAutoAdopt(1);
......
......@@ -9,6 +9,7 @@ import cn.wisenergy.mapper.WorkUserRoleMapper;
import cn.wisenergy.model.app.WorkLevel;
import cn.wisenergy.model.app.WorkRole;
import cn.wisenergy.model.dto.UserRoleLevelDto;
import cn.wisenergy.model.enums.LevelEnum;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -95,6 +96,14 @@ public class UserRoleLevelUtils {
if (CollectionUtils.isEmpty(workLevels)) {
return null;
}
for (LevelEnum value : LevelEnum.values()) {
for (WorkLevel workLevel : workLevels) {
if (value.getLevelName().equals(workLevel.getName())) {
workLevel.setPath(value.getPath());
}
}
}
workLevels.sort(new Comparator<WorkLevel>() {
@Override
public int compare(WorkLevel o1, WorkLevel o2) {
......
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