Commit b523aff7 authored by cq990612's avatar cq990612

Merge branch 'chenqi' into 'master'

Chenqi

See merge request !1
parents ba287222 df36920e
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<module>wisenergy-web-admin</module> <module>wisenergy-web-admin</module>
</modules> </modules>
<!-- POM属性变量 --> <!--POM属性变量-->
<properties> <properties>
<!-- 文件拷贝时的编码 --> <!-- 文件拷贝时的编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
...@@ -11,18 +11,19 @@ ...@@ -11,18 +11,19 @@
<result column="status" property="status" /> <result column="status" property="status" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" /> <result column="modify_time" property="modifyTime" />
<result column="reject_time" property="rejectTime" />
</resultMap> </resultMap>
<sql id="vals"> <sql id="vals">
#{userId},#{workDay},#{totalTime},#{status},now(),now() #{userId},#{workDay},#{totalTime},#{status},#{rejectTime},now(),now()
</sql> </sql>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, work_day, total_time, status, create_time, modify_time id, user_id, work_day, total_time, status,reject_time,create_time,modify_time
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id, work_day, total_time, status, create_time, modify_time user_id, work_day, total_time, status,reject_time,create_time,modify_time
</sql> </sql>
<sql id="table"> <sql id="table">
...@@ -46,10 +47,13 @@ ...@@ -46,10 +47,13 @@
<set> <set>
<if test="null != status"> <if test="null != status">
status=#{status}, status=#{status},
</if> </if>
<if test="null !=totalTime"> <if test="null !=totalTime">
total_time = #{totalTime}, total_time = #{totalTime},
</if>
<if test="3 ==status ">
reject_time = now(),
</if> </if>
modify_time = now() modify_time = now()
</set> </set>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result column="reason" property="reason" /> <result column="reason" property="reason" />
<result column="type" property="type" /> <result column="type" property="type" />
<result column="is_overtime" property="isOvertime" /> <result column="is_overtime" property="isOvertime" />
<result column="reject_time" property="rejectTime" />
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" /> <result column="modify_time" property="modifyTime" />
</resultMap> </resultMap>
...@@ -23,10 +24,10 @@ ...@@ -23,10 +24,10 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="vals"> <sql id="vals">
#{userId},#{projectId},#{deptId},#{workTime},#{workDay},#{status},#{reviewerId},#{des},#{reason},#{type},#{isOvertime},now(),now() #{userId},#{projectId},#{deptId},#{workTime},#{workDay},#{status},#{reviewerId},#{des},#{reason},#{type},#{isOvertime},#{rejectTime},now(),now()
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
user_id, project_id, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime, create_time, modify_time user_id, project_id, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime,reject_time, create_time, modify_time
</sql> </sql>
<sql id="criteria"> <sql id="criteria">
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,7 @@
<update id="updateStatusById"> <update id="updateStatusById">
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
SET status = 3,reason = #{reason},reviewer_id = #{reviewerId},modify_time=now() SET status = 3,reason = #{reason},reviewer_id = #{reviewerId},modify_time=now(),reject_time=now()
WHERE work_id = #{id} WHERE work_id = #{id}
</update> </update>
......
...@@ -41,6 +41,9 @@ public class WorkCollect implements Serializable { ...@@ -41,6 +41,9 @@ public class WorkCollect implements Serializable {
@ApiModelProperty(name = "status",value = "状态: 1:已填报 ,2:已审核,3:被驳回") @ApiModelProperty(name = "status",value = "状态: 1:已填报 ,2:已审核,3:被驳回")
private Integer status; private Integer status;
@ApiModelProperty(name = "rejectTime",value = "驳回时间")
private Date rejectTime;
@ApiModelProperty(name = "createTime",value = "创建时间") @ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime; private Date createTime;
......
...@@ -30,8 +30,11 @@ public class WorkSubmitAdopt implements Serializable { ...@@ -30,8 +30,11 @@ public class WorkSubmitAdopt implements Serializable {
@ApiModelProperty(name = "submitTime",value = "工时提交时限") @ApiModelProperty(name = "submitTime",value = "工时提交时限")
private Integer submitTime; private Integer submitTime;
@ApiModelProperty(name = "autoAdopt",value = "工时自动审批时限") @ApiModelProperty(name = "autoAdopt",value = "工时自动审批间隔")
private Integer autoAdopt; private Integer autoAdopt;
@ApiModelProperty(name = "autoExamine",value = "自动审批")
private Integer autoExamine;
} }
...@@ -67,5 +67,7 @@ public class WorkTimeOrder implements Serializable { ...@@ -67,5 +67,7 @@ public class WorkTimeOrder implements Serializable {
@ApiModelProperty(name = "modifyTime", value = "工单修改时间") @ApiModelProperty(name = "modifyTime", value = "工单修改时间")
private Date modifyTime; private Date modifyTime;
@ApiModelProperty(name = "rejectTime",value = "驳回时间")
private Date rejectTime;
} }
...@@ -31,4 +31,9 @@ public class SubtotalDto { ...@@ -31,4 +31,9 @@ public class SubtotalDto {
@ApiModelProperty(name = "rejectMonth",value = "当月被驳回待处理条数") @ApiModelProperty(name = "rejectMonth",value = "当月被驳回待处理条数")
private Integer rejectMonth; private Integer rejectMonth;
@ApiModelProperty(name = "modifyTime",value = "驳回时间")
private Integer modifyTime;
} }
...@@ -58,8 +58,10 @@ public class WorkTimeOrderDto { ...@@ -58,8 +58,10 @@ public class WorkTimeOrderDto {
@ApiModelProperty(name = "typeName",value = "项目类型名") @ApiModelProperty(name = "typeName",value = "项目类型名")
private String typeName; private String typeName;
@ApiModelProperty(name = "isOvertime",value = "0:正常工时,1:加班") @ApiModelProperty(name = "isOvertime", value = "0:正常工时,1:加班")
private Integer isOvertime; private Integer isOvertime;
@ApiModelProperty(name = "rejectTime",value = "驳回时间")
private Date rejectTime;
} }
package cn.wisenergy.service.impl; package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM; import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException; import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkCollectMapper; import cn.wisenergy.mapper.WorkCollectMapper;
import cn.wisenergy.mapper.WorkTimeOrderMapper; import cn.wisenergy.mapper.WorkTimeOrderMapper;
import cn.wisenergy.model.app.WorkCollect; import cn.wisenergy.model.app.WorkCollect;
import cn.wisenergy.model.app.WorkSubmitAdopt;
import cn.wisenergy.model.app.WorkTimeOrder; import cn.wisenergy.model.app.WorkTimeOrder;
import cn.wisenergy.model.dto.CalendarDto; import cn.wisenergy.model.dto.CalendarDto;
import cn.wisenergy.model.dto.SubtotalDto; import cn.wisenergy.model.dto.SubtotalDto;
import cn.wisenergy.service.WorkCollectService; import cn.wisenergy.service.WorkCollectService;
import cn.wisenergy.service.WorkSubmitAdoptService;
import cn.wisenergy.service.WorkTimeOrderService; import cn.wisenergy.service.WorkTimeOrderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -50,6 +53,9 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -50,6 +53,9 @@ public class WorkCollectServiceImpl implements WorkCollectService {
@Autowired @Autowired
private WorkTimeOrderMapper workTimeOrderMapper; private WorkTimeOrderMapper workTimeOrderMapper;
@Autowired
private WorkSubmitAdoptService workSubmitAdoptService;
/** /**
* 功能: 查询某年月的填报情况 * 功能: 查询某年月的填报情况
...@@ -95,6 +101,17 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -95,6 +101,17 @@ public class WorkCollectServiceImpl implements WorkCollectService {
if (workCollect != null) { if (workCollect != null) {
subtotalDto.setStatus(workCollect.getStatus()); subtotalDto.setStatus(workCollect.getStatus());
} }
int modifyTime = 1;
Date date = new Date();
WorkSubmitAdopt submitAdopt = workSubmitAdoptService.getById(1);
if (null != workCollect.getRejectTime()) {
Date rejectTime = workCollect.getRejectTime();
rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime, "yyyy-MM-dd"), "yyyy-MM-dd");
if (date.getTime() - rejectTime.getTime() > submitAdopt.getSubmitTime() * 24 * 60 * 60 * 1000) {
modifyTime = 0;
}
}
subtotalDto.setModifyTime(modifyTime);
return subtotalDto; return subtotalDto;
} }
......
...@@ -243,7 +243,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -243,7 +243,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
workTimeOrder.setDeptId(workUserDeptService.getDeptIdByUserId(dto.getUserId())); workTimeOrder.setDeptId(workUserDeptService.getDeptIdByUserId(dto.getUserId()));
BeanUtils.copyProperties(dto, workTimeOrder); BeanUtils.copyProperties(dto, workTimeOrder);
totalTime += dto.getWorkTime(); totalTime += dto.getWorkTime();
if (dto.getWorkId() != null) { if (null != dto.getWorkId()) {
WorkTimeOrder workTimeOrder1 = workTimeOrderMapper.selectById(dto.getWorkId()); WorkTimeOrder workTimeOrder1 = workTimeOrderMapper.selectById(dto.getWorkId());
if (2 == workTimeOrder1.getStatus() || 5 == workTimeOrder1.getStatus()) { if (2 == workTimeOrder1.getStatus() || 5 == workTimeOrder1.getStatus()) {
if (!dto.getStatus().equals(workTimeOrder1.getStatus())) { if (!dto.getStatus().equals(workTimeOrder1.getStatus())) {
...@@ -256,20 +256,24 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -256,20 +256,24 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
addList.add(workTimeOrder); addList.add(workTimeOrder);
} }
for (WorkTimeOrder dto : addList) { for (WorkTimeOrder dto : addList) {
// 4、默认设置超过系统默认3天(包括驳回3天)未填报的工时将不能填报
if (!REJECTED.equals(dto.getStatus()) && !RE_SUBMIT.equals(dto.getStatus())) { Date rejectTime1 = workCollectService.getByUserIdAndWorkDay(dto.getUserId(), dto.getWorkDay()).getRejectTime();
if (date.getTime() - dto.getWorkDay().getTime() > submitTime * 24 * 60 * 60 * 1000) { if (null != rejectTime1) {
dto.setStatus(RE_SUBMIT);
Date rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime1, "yyyy-MM-dd"), "yyyy-MM-dd");
if (date.getTime() - rejectTime.getTime() > submitTime * 24 * 60 * 60 * 1000) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE); throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE);
} }
} }
if (REJECTED.equals(dto.getStatus()) || RE_SUBMIT.equals(dto.getStatus())) { // 4、默认设置超过系统默认3天(包括驳回3天)未填报的工时将不能填报
Date modifyTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(workTimeOrderMapper.selectById(dto.getWorkId()).getModifyTime(), "yyyy-MM-dd"), "yyyy-MM-dd"); if (!REJECTED.equals(dto.getStatus()) && !RE_SUBMIT.equals(dto.getStatus())) {
System.out.println(modifyTime); if (date.getTime() - dto.getWorkDay().getTime() > submitTime * 24 * 60 * 60 * 1000) {
if (date.getTime() - modifyTime.getTime() > submitTime * 24 * 60 * 60 * 1000) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE); throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE);
} }
} }
} }
// 删除数据库还没有审批的工单,添加填报没有审批的工单 // 删除数据库还没有审批的工单,添加填报没有审批的工单
...@@ -302,8 +306,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -302,8 +306,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
} }
// 判断填写工时单是否重复 // 判断填写工时单是否重复
private void isRepeat(List<WorkTimeOrderDto> list) { private void isRepeat(List<WorkTimeOrderDto> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -338,7 +340,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -338,7 +340,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
isManager(userId); isManager(userId);
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
// PC端 // PC端
return pageExamine(user, projectId, type, page, size, status); return pageExamine(user, projectId, type, page, size, status);
} }
...@@ -355,6 +356,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -355,6 +356,10 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
log.info("WorkOrderServiceImpl[]getExamineApplets[]input.param.userId:{},projectId:{},type:{}" + userId, projectId, type); log.info("WorkOrderServiceImpl[]getExamineApplets[]input.param.userId:{},projectId:{},type:{}" + userId, projectId, type);
isManager(userId); isManager(userId);
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
if (null == projectId && null == type) {
return null;
}
if (0 != user.getLevel()) { if (0 != user.getLevel()) {
QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>(); QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>();
wrapper.in("status", COMPLETED, RE_SUBMIT); wrapper.in("status", COMPLETED, RE_SUBMIT);
...@@ -628,7 +633,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -628,7 +633,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
} }
// 判断工单是否合法 // 判断工单是否合法
private void isEmpty(WorkTimeOrderDto dto) { private void isEmpty(WorkTimeOrderDto dto) {
int size = 0; int size = 0;
......
...@@ -29,9 +29,6 @@ import java.util.List; ...@@ -29,9 +29,6 @@ import java.util.List;
@EnableScheduling @EnableScheduling
public class Trigger implements SchedulingConfigurer { public class Trigger implements SchedulingConfigurer {
@Autowired @Autowired
private WorkTimeOrderMapper workTimeOrderMapper; private WorkTimeOrderMapper workTimeOrderMapper;
...@@ -52,12 +49,12 @@ public class Trigger implements SchedulingConfigurer { ...@@ -52,12 +49,12 @@ public class Trigger implements SchedulingConfigurer {
() -> { () -> {
//这里写业务方法 //这里写业务方法
WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1); WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1);
Integer autoAdopt = workSubmitAdopt.getSubmitTime(); Integer autoExamine = workSubmitAdopt.getAutoExamine();
// 更新work_time_order表 // 更新work_time_order表
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DATE, -autoAdopt); c.add(Calendar.DATE, -(autoExamine+1));
Date start = c.getTime(); Date start = c.getTime();
String qyt= format.format(start); String qyt= format.format(start);
Date yesterdayDate = DateUtil.convertStrToDate(qyt, "yyyy-MM-dd"); Date yesterdayDate = DateUtil.convertStrToDate(qyt, "yyyy-MM-dd");
......
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