Commit 87c9e60d authored by cq990612's avatar cq990612

优化代码结构

parent f3bcbe9d
......@@ -76,6 +76,7 @@
<if test="isOvertime != null">and is_overtime = #{isOvertime}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="modifyTime != null">and #{modifyTime} &gt;= modify_time</if>
<if test="rejectTime !=null">and reject_time = #{rejectTime}</if>
</sql>
<resultMap id="dayWorkTimeAndType" type="cn.wisenergy.model.dto.DayWorkTimeAndType">
......@@ -175,7 +176,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
work_id, user_id, project_id, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime, create_time, modify_time
work_id, user_id, project_id, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime, create_time, modify_time,reject_time
</sql>
<select id="statisticsByProjectType" resultMap="monthlyWorkHourStatistics">
......
......@@ -2,7 +2,6 @@ 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;
......@@ -27,8 +26,8 @@ public class WorkLevel {
@ApiModelProperty(name = "icon",value = "图标")
private String icon;
/**附加字段*/
@TableField(exist = false)
@ApiModelProperty(name = "path",value = "路径")
private String path;
......
......@@ -68,6 +68,7 @@ public class WorkTimeOrder implements Serializable {
@ApiModelProperty(name = "modifyTime", value = "工单修改时间")
private Date modifyTime;
@ApiModelProperty(name = "rejectTime",value = "驳回时间")
private Date rejectTime;
......
......@@ -2,6 +2,7 @@ package cn.wisenergy.model.dto;
import cn.wisenergy.model.app.WorkHoliday;
import cn.wisenergy.model.app.WorkSubmitAdopt;
import cn.wisenergy.model.app.WorkType;
import lombok.Data;
import lombok.experimental.Accessors;
......@@ -17,4 +18,6 @@ public class HolidayAndAutoDto {
List<WorkHoliday> workHolidays;
WorkSubmitAdopt workSubmitAdopt;
List<WorkType> workTypes;
}
......@@ -5,28 +5,24 @@ package cn.wisenergy.model.enums;
* @QQ1799796883
*/
public enum LevelEnum {
EXAMINE("工时审批","/index"),
STATISTICS("统计","/statistical"),
PROJECT_MANAGER( "项目/商机管理","/projects"),
TIMEEXPORT("工时导出","/export"),
SYSTEMSETTINGS("系统设置","/systemSettings"),
ACCOUNTMANAGEMENT("账号管理","/accountSetting"),
EXAMINE("工时审批"),
STATISTICS("统计"),
PROJECT_MANAGER( "项目/商机管理"),
TIMEEXPORT("工时导出"),
SYSTEMSETTINGS("系统设置"),
ACCOUNTMANAGEMENT("账号管理"),
;
private String LevelName;
public String getPath() {
return path;
}
private String path;
LevelEnum(String LevelName,String path) {
LevelEnum(String LevelName) {
this.LevelName = LevelName;
this.path = path;
}
public String getLevelName() {
......
......@@ -13,4 +13,8 @@ public interface WorkTypeService {
List<WorkType> getAll();
List<Integer> getIdByReviewer(Integer reviewer);
Boolean addAndModifyWorkType(WorkType workType);
Boolean deleteTypeById(Integer id);
}
......@@ -5,10 +5,12 @@ import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkHolidayMapper;
import cn.wisenergy.model.app.WorkHoliday;
import cn.wisenergy.model.app.WorkSubmitAdopt;
import cn.wisenergy.model.app.WorkType;
import cn.wisenergy.model.dto.HolidayAndAutoDto;
import cn.wisenergy.model.enums.LevelEnum;
import cn.wisenergy.service.WorkHolidayService;
import cn.wisenergy.service.WorkSubmitAdoptService;
import cn.wisenergy.service.WorkTypeService;
import cn.wisenergy.service.utils.UserRoleLevelUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
......@@ -39,6 +41,9 @@ public class WorkHolidayServiceImpl implements WorkHolidayService {
@Autowired
private WorkSubmitAdoptService workSubmitAdoptService;
@Autowired
private WorkTypeService workTypeService;
@Override
public Boolean isHoliday(Date date) {
log.info("WorkHolidayServiceImpl[]workHolidayMapper[]input.param.date:{}" + date);
......@@ -149,6 +154,10 @@ public class WorkHolidayServiceImpl implements WorkHolidayService {
List<WorkHoliday> workHolidays = workHolidayMapper.getByTypeAndStartDate(1, new Date());
WorkSubmitAdopt submitAdopt = workSubmitAdoptService.getById(1);
holidayAndAutoDto.setWorkHolidays(workHolidays).setWorkSubmitAdopt(submitAdopt);
List<WorkType> workTypes = workTypeService.getAll();
if (!CollectionUtils.isEmpty(workTypes)) {
holidayAndAutoDto.setWorkTypes(workTypes);
}
return holidayAndAutoDto;
}
......
......@@ -45,4 +45,34 @@ public class WorkTypeServiceImpl implements WorkTypeService {
}
return ids;
}
@Override
public Boolean addAndModifyWorkType(WorkType workType) {
log.info("WorkTypeServiceImpl[]modifyTypeById[]input.param.workType:{}" + workType);
if (null == workType || (null == workType.getName() && null == workType.getReviewer())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
if (null == workType.getId()) {
if (null == workType.getName() || null == workType.getReviewer()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
int insert = workTypeMapper.insert(workType);
return insert > 0;
}else{
int i = workTypeMapper.updateById(workType);
return i>0;
}
}
@Override
public Boolean deleteTypeById(Integer id) {
log.info("WorkTypeServiceImpl[]deleteTypeById[]input.param.id:{}" + id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
int i = workTypeMapper.deleteById(id);
return i>0;
}
}
......@@ -96,13 +96,7 @@ 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
......
......@@ -5,10 +5,12 @@ import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkHoliday;
import cn.wisenergy.model.app.WorkSubmitAdopt;
import cn.wisenergy.model.app.WorkType;
import cn.wisenergy.model.dto.AllRoleAndUserRoleDto;
import cn.wisenergy.model.dto.HolidayAndAutoDto;
import cn.wisenergy.service.WorkHolidayService;
import cn.wisenergy.service.WorkSubmitAdoptService;
import cn.wisenergy.service.WorkTypeService;
import cn.wisenergy.service.WorkUserService;
import cn.wisenergy.web.admin.controller.common.BaseController;
import io.swagger.annotations.Api;
......@@ -43,6 +45,9 @@ public class SystemController extends BaseController {
@Autowired
private WorkUserService workUserService;
@Autowired
private WorkTypeService workTypeService;
@ApiOperation(value = "添加和编辑工作日历", notes = "添加和编辑工作日历", httpMethod = "PUT")
@ApiImplicitParam(name = "workHoliday", value = "节假日实体类",dataType = "WorkHoliday",required = true)
......@@ -62,7 +67,7 @@ public class SystemController extends BaseController {
return getResult(aBoolean);
}
@ApiOperation(value = "获取工作日历和审批时限", notes = "获取工作日历和审批时限", httpMethod = "GET")
@ApiOperation(value = "获取工作日历、审批时限和工时类型", notes = "获取工作日历、审批时限和工时类型", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "管理员id", dataType = "int", required = true)
@GetMapping("/getHolidayAndAuto")
public Result<HolidayAndAutoDto> getHolidayAndAuto(Integer userId) {
......@@ -111,4 +116,23 @@ public class SystemController extends BaseController {
return getResult(aBoolean);
}
@ApiOperation(value = "添加和修改工时类型", notes = "添加和修改工时类型", httpMethod = "PUT")
@ApiImplicitParam(name = "workType",value = "工时类型",dataType ="WorkType", required = true)
@PutMapping("/addAndModifyWorkType")
public Result<Boolean> addAndModifyWorkType(@RequestBody WorkType workType) {
log.info("SystemController[]modifyRole[]input.param.workType:{}" + workType);
Boolean aBoolean = workTypeService.addAndModifyWorkType(workType);
return getResult(aBoolean);
}
@ApiOperation(value = "删除工时类型", notes = "删除工时类型", httpMethod = "PUT")
@ApiImplicitParam(name = "id",value = "类型id",dataType ="int", required = true)
@PutMapping("/modifyWorkType")
public Result<Boolean> deleteTypeById(Integer id) {
log.info("SystemController[]modifyRole[]input.param.id:{}" + id);
Boolean aBoolean = workTypeService.deleteTypeById(id);
return getResult(aBoolean);
}
}
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