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