Commit dd280035 authored by cq990612's avatar cq990612

优化代码结构

parent 6469e966
...@@ -844,6 +844,9 @@ public class DateUtil { ...@@ -844,6 +844,9 @@ public class DateUtil {
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
//设置日历中月份的最大天数 //设置日历中月份的最大天数
cal.set(Calendar.DAY_OF_MONTH, lastDay); cal.set(Calendar.DAY_OF_MONTH, lastDay);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
//格式化日期 //格式化日期
return cal.getTime(); return cal.getTime();
} }
......
...@@ -29,7 +29,7 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -29,7 +29,7 @@ public enum BASE_RESP_CODE_ENUM {
STATISTICS_RECORD_DATA_FAIL("609", "统计档案数据失败"), STATISTICS_RECORD_DATA_FAIL("609", "统计档案数据失败"),
EQUIPMENT_INFO_IS_NULL("610", "设备信息为空"), EQUIPMENT_INFO_IS_NULL("610", "设备信息为空"),
QUERY_DATA_IS_NULL("611", "获取数据为空"), QUERY_DATA_IS_NULL("611", "获取数据为空"),
WORK_TIME_NOT_OVER_EIGHT("611", "每日累计工时不超过8小时"), WORK_TIME_NOT_OVER_EIGHT("611", "当日总工时超出8小时,请核对后提交"),
USER_ACCOUNT_ALREADY_EXIST("612", "用户账号已存在"), USER_ACCOUNT_ALREADY_EXIST("612", "用户账号已存在"),
USER_PHONE_ALREADY_EXIST("613", "该手机号已被注册"), USER_PHONE_ALREADY_EXIST("613", "该手机号已被注册"),
INSERT_DATA_IS_FAIL("614", "插入数据失败"), INSERT_DATA_IS_FAIL("614", "插入数据失败"),
...@@ -39,7 +39,7 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -39,7 +39,7 @@ public enum BASE_RESP_CODE_ENUM {
QUERY_USER_INFO_FAIL("618", "该用户不存在"), QUERY_USER_INFO_FAIL("618", "该用户不存在"),
WORK_ORDER_ALREADY_COMMIT("619", "工单类型重复,不能重复填报"), WORK_ORDER_ALREADY_COMMIT("619", "工单类型重复,不能重复填报"),
WORK_TIME_OVER_NOW_DAY("620", "工单日期不能大于当天"), WORK_TIME_OVER_NOW_DAY("620", "工单日期不能大于当天"),
INSERT_WORK_COLLECT_DATA_FAIL("621", "插入工时单汇总信息失败"), WORKORDERHOURS_MUSTBEGREATERTHAN0("621", "工时不能小于等于0"),
NO_JOIN_EVERY_PROJECT_PLASE_JION("622", "请选择项目名称"), NO_JOIN_EVERY_PROJECT_PLASE_JION("622", "请选择项目名称"),
THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN("623", "您不是管理员,请登录管理员账号"), THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN("623", "您不是管理员,请登录管理员账号"),
DEPT_NOT_HAVE_USER("624", "该部门下没有人员"), DEPT_NOT_HAVE_USER("624", "该部门下没有人员"),
...@@ -59,7 +59,7 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -59,7 +59,7 @@ public enum BASE_RESP_CODE_ENUM {
WORKDAY_NOT_NULL("637","工时日期不能为空"), WORKDAY_NOT_NULL("637","工时日期不能为空"),
PROJECT_NOT_NULL("638","项目类型不能为空"), PROJECT_NOT_NULL("638","项目类型不能为空"),
NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD("639","新密码不能与旧密码相同"), NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD("639","新密码不能与旧密码相同"),
PASSWORD_FORMAT_ERROR("640","密码由6到16位数字组成"), THEWORKORDERDATE_HASEXCEEDED_THECHANGERANGE("640","该工单日期已经超出更变范围"),
INCOMPLETE_WORK_ORDER_INFORMATION("621","请填写完整的工单信息"), INCOMPLETE_WORK_ORDER_INFORMATION("621","请填写完整的工单信息"),
HAVE_ORDER_DELETE("643", "有工单被用户删除,审批失败,请重新审批"), HAVE_ORDER_DELETE("643", "有工单被用户删除,审批失败,请重新审批"),
ORDER_EXAMINE("644","该工单已经被审批,请刷新查看"), ORDER_EXAMINE("644","该工单已经被审批,请刷新查看"),
...@@ -85,6 +85,7 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -85,6 +85,7 @@ public enum BASE_RESP_CODE_ENUM {
DOWNLOAD_ERROR("668", "下载出错"), DOWNLOAD_ERROR("668", "下载出错"),
PLEASE_CANCELTHE_MANAGEMENTROLE("669", "注销账号,请取消管理角色"), PLEASE_CANCELTHE_MANAGEMENTROLE("669", "注销账号,请取消管理角色"),
ATLEASTONEADMINISTRATORISREQUIRED("670", "至少需要一个系统管理员!"), ATLEASTONEADMINISTRATORISREQUIRED("670", "至少需要一个系统管理员!"),
PLEASESELECTANITEM("671", "请至少选择一个项目"),
; ;
......
package cn.wisenergy.mapper; package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkDept; import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.model.dto.DeptOfProjectAndOrderType;
import cn.wisenergy.model.dto.OrganizationStructureDto; import cn.wisenergy.model.dto.OrganizationStructureDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -26,4 +27,6 @@ public interface WorkDeptMapper extends BaseMapper<WorkDept> { ...@@ -26,4 +27,6 @@ public interface WorkDeptMapper extends BaseMapper<WorkDept> {
int updateManagerIdISNullById(Integer id); int updateManagerIdISNullById(Integer id);
List<WorkDept> getDeptByManagerId(Integer userId); List<WorkDept> getDeptByManagerId(Integer userId);
List<DeptOfProjectAndOrderType> getDeptOfProjectAndOrderType(Integer userId);
} }
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkOrderChange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface WorkOrderChangeMapper extends BaseMapper<WorkOrderChange> {
}
...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper; ...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkTimeOrder; import cn.wisenergy.model.app.WorkTimeOrder;
import cn.wisenergy.model.dto.*; import cn.wisenergy.model.dto.*;
import cn.wisenergy.model.vo.OrderChangeManagerVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -107,4 +108,6 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> { ...@@ -107,4 +108,6 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
List<UserWorkTimeStatisticsByProject> selectListByType(Map<String,Object> map); List<UserWorkTimeStatisticsByProject> selectListByType(Map<String,Object> map);
List<DeptUserCollectDto> getDeptNotOrderInfo(@Param("userId") Integer userId,@Param("depts") List<Integer> depts,@Param("startDate") Date startDate, @Param("endDate") Date endDate); List<DeptUserCollectDto> getDeptNotOrderInfo(@Param("userId") Integer userId,@Param("depts") List<Integer> depts,@Param("startDate") Date startDate, @Param("endDate") Date endDate);
List<OrderChangePageDto> getOrderChangePage(OrderChangeManagerVo vo);
} }
...@@ -47,10 +47,10 @@ ...@@ -47,10 +47,10 @@
<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>
<if test="3 ==status "> <if test="3 ==status ">
reject_time = now(), reject_time = now(),
......
...@@ -4,19 +4,18 @@ ...@@ -4,19 +4,18 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkDept"> <resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkDept">
<id column="id" property="id" /> <id column="id" property="id"/>
<result column="dept_name" property="deptName" /> <result column="dept_name" property="deptName"/>
<result column="oa_dept_id" property="oaDeptId"/> <result column="oa_dept_id" property="oaDeptId"/>
<result column="centre_id" property="centreId"/> <result column="centre_id" property="centreId"/>
<result column="dept_manager_id" property="deptManagerId"/> <result column="dept_manager_id" property="deptManagerId"/>
<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="sort" property="sort"/> <result column="sort" property="sort"/>
</resultMap> </resultMap>
<resultMap id="CentreDeptMap" type="cn.wisenergy.model.dto.OrganizationStructureDto"> <resultMap id="CentreDeptMap" type="cn.wisenergy.model.dto.OrganizationStructureDto">
<id column="centre_id" property="centreId" /> <id column="centre_id" property="centreId"/>
<result column="centre_name" property="centreName"/> <result column="centre_name" property="centreName"/>
<collection property="deptUserDtos" ofType="cn.wisenergy.model.dto.DeptUserDto"> <collection property="deptUserDtos" ofType="cn.wisenergy.model.dto.DeptUserDto">
<id column="dept_id" property="deptId"/> <id column="dept_id" property="deptId"/>
...@@ -24,14 +23,24 @@ ...@@ -24,14 +23,24 @@
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="ProjectAndOrderType" type="cn.wisenergy.model.dto.DeptOfProjectAndOrderType">
<id column="dept_id" property="deptId"/>
<result column="dept_name" property="deptName"/>
<collection property="projectManagerDtos" ofType="cn.wisenergy.model.dto.ProjectManagerDto">
<id column="project_id" property="id"/>
<result column="project_name" property="projectName"/>
</collection>
</resultMap>
<sql id="table"> <sql id="table">
work_dept work_dept
</sql> </sql>
<sql id="cols_all"> <sql id="cols_all">
id, <include refid="cols_exclude_id"/> id,
<include refid="cols_exclude_id"/>
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
dept_name,oa_dept_id,dept_manager_id,centre_id, create_time, modify_time,sort dept_name,oa_dept_id,dept_manager_id,centre_id, create_time, modify_time,sort
</sql> </sql>
...@@ -51,18 +60,21 @@ ...@@ -51,18 +60,21 @@
id,dept_name, oa_dept_id,centre_id, dept_name, create_time, modify_time,sort id,dept_name, oa_dept_id,centre_id, dept_name, create_time, modify_time,sort
</sql> </sql>
<update id="updateManagerIdISNullById"> <update id="updateManagerIdISNullById">
UPDATE <include refid="table"/> UPDATE
<include refid="table"/>
SET dept_manager_id = NULL SET dept_manager_id = NULL
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="getDeptByCondition" resultMap="BaseResultMap" parameterType="integer"> <select id="getDeptByCondition" resultMap="BaseResultMap" parameterType="integer">
select <include refid="cols_all"/> select
from <include refid="table"/> <include refid="cols_all"/>
<where> from
<include refid="criteria"/> <include refid="table"/>
</where> <where>
order by sort <include refid="criteria"/>
</where>
order by sort
</select> </select>
<select id="getAllDeptByAllCentre" resultMap="CentreDeptMap"> <select id="getAllDeptByAllCentre" resultMap="CentreDeptMap">
...@@ -72,16 +84,33 @@ ORDER BY c.id,d.sort ...@@ -72,16 +84,33 @@ ORDER BY c.id,d.sort
</select> </select>
<select id="getById" resultMap="BaseResultMap"> <select id="getById" resultMap="BaseResultMap">
select <include refid="cols_all"/> select
from <include refid="table"/> <include refid="cols_all"/>
from
<include refid="table"/>
where id =#{deptId} where id =#{deptId}
</select> </select>
<select id="getDeptByManagerId" resultType="cn.wisenergy.model.app.WorkDept"> <select id="getDeptByManagerId" resultType="cn.wisenergy.model.app.WorkDept">
select <include refid="cols_all"/> select
from <include refid="table"/> <include refid="cols_all"/>
from
<include refid="table"/>
where dept_manager_id = #{userId} where dept_manager_id = #{userId}
</select> </select>
<select id="getDeptOfProjectAndOrderType" resultMap="ProjectAndOrderType">
select d.id 'dept_id',d.dept_name,p.id 'project_id',p.project_name
from work_dept d LEFT JOIN work_project p on d.id = p.dept_id
<where>
<if test="userId !=null">
p.manager_id = #{userId}
</if>
</where>
ORDER BY d.sort
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.WorkOrderChangeMapper">
</mapper>
\ No newline at end of file
...@@ -56,10 +56,10 @@ ...@@ -56,10 +56,10 @@
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="vals"> <sql id="vals">
#{userId},#{projectId},#{deptId},#{workTime},#{workDay},#{status},#{reviewerId},#{des},#{reason},#{type},#{isOvertime},#{rejectTime},now() #{userId},#{projectId},#{deptId},#{workTime},#{workDay},#{status},#{reviewerId},#{des},#{reason},#{type},#{isOvertime},#{rejectTime},now(),#{modifyTime}
</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,reject_time, create_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">
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
</update> </update>
<select id="getByDay" resultType="cn.wisenergy.model.app.WorkTimeOrder"> <select id="getByDay" resultType="cn.wisenergy.model.app.WorkTimeOrder" flushCache="true">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM FROM
...@@ -258,8 +258,10 @@ ...@@ -258,8 +258,10 @@
IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day), IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day),
'年')) AS statistics_time ,SUM(t.work_time)/8 AS '年')) AS statistics_time ,SUM(t.work_time)/8 AS
total_time, SUM(t.work_time * s.day_salary)/8 AS cost,ty.sort AS ty_sort, d.sort AS d_sort total_time, SUM(t.work_time * s.day_salary)/8 AS cost,ty.sort AS ty_sort, d.sort AS d_sort
FROM work_time_order t join work_dept d on d.id = t.dept_id join work_user_salary s on s.user_id = t.user_id join work_type ty on t.type = ty.id FROM work_time_order t join work_dept d on d.id = t.dept_id join work_user_salary s on s.user_id = t.user_id
WHERE t.status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day AND year(t.work_day) &lt; year(NOW()) join work_type ty on t.type = ty.id
WHERE t.status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day AND year(t.work_day) &lt;
year(NOW())
<if test="firstDayOfMonth != null"> <if test="firstDayOfMonth != null">
AND work_day >= #{firstDayOfMonth} AND work_day >= #{firstDayOfMonth}
</if> </if>
...@@ -281,8 +283,10 @@ ...@@ -281,8 +283,10 @@
IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day), IF (YEAR (work_day) = YEAR (NOW()), concat(YEAR (work_day),'年',MONTH (work_day),'月') , concat(YEAR(work_day),
'年')) AS statistics_time ,SUM(t.work_time)/8 AS '年')) AS statistics_time ,SUM(t.work_time)/8 AS
total_time, SUM(t.work_time * s.day_salary)/8 AS cost,ty.sort AS ty_sort, d.sort AS d_sort total_time, SUM(t.work_time * s.day_salary)/8 AS cost,ty.sort AS ty_sort, d.sort AS d_sort
FROM work_time_order t join work_dept d on d.id = t.dept_id join work_user_salary s on s.user_id = t.user_id join work_type ty on t.type = ty.id FROM work_time_order t join work_dept d on d.id = t.dept_id join work_user_salary s on s.user_id = t.user_id
WHERE t.status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day AND year(t.work_day) = year(NOW()) join work_type ty on t.type = ty.id
WHERE t.status IN (2,5) AND s.create_time &lt; t.work_day AND s.end_time > t.work_day AND year(t.work_day) =
year(NOW())
<if test="firstDayOfMonth != null"> <if test="firstDayOfMonth != null">
AND work_day >= #{firstDayOfMonth} AND work_day >= #{firstDayOfMonth}
</if> </if>
...@@ -342,13 +346,18 @@ ...@@ -342,13 +346,18 @@
<select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject"> <select id="getUserProjectWorkTimeStatistics" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll">u.id AS user_id, u.`name` AS user_name,</if> SELECT
<if test="!isAll">'合计' AS user_name ,</if> t.project_id AS project_id, t.type AS work_time_type, p.project_name <if test="isAll">u.id AS user_id, u.`name` AS user_name,</if>
<if test="!isAll">'合计' AS user_name ,</if>
t.project_id AS project_id, t.type AS work_time_type, p.project_name
AS project_name, AS project_name,
IF(t.is_overtime = 0, <if test="!isAll">0</if> IF(t.is_overtime = 0,
<if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1, <if test="!isAll">0</if> <if test="!isAll">0</if>
<if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1,
<if test="!isAll">0</if>
<if test="isAll">null</if>, sum(t.work_time)) AS normal_time <if test="isAll">null</if>, sum(t.work_time)) AS normal_time
from work_time_order t left join work_project p on t.project_id = p.id join work_user u on t.user_id = u.id join work_type ty on t.type = ty.id from work_time_order t left join work_project p on t.project_id = p.id join work_user u on t.user_id = u.id join
work_type ty on t.type = ty.id
where where
t.status in (2,5) AND t.status in (2,5) AND
t.work_day &lt;= #{endDate} t.work_day &lt;= #{endDate}
...@@ -357,8 +366,10 @@ ...@@ -357,8 +366,10 @@
AND t.work_day >= #{startDate} AND t.work_day >= #{startDate}
</if> </if>
GROUP BY <if test="isAll">u.id,u.`name`,</if> t.project_id,t.type,p.project_name, t.is_overtime GROUP BY <if test="isAll">u.id,u.`name`,</if> t.project_id,t.type,p.project_name, t.is_overtime
ORDER BY <if test="isAll">convert(u.`name` using gbk) asc</if> ORDER BY
<if test="!isAll">ty.sort</if> ,t.project_id <if test="isAll">convert(u.`name` using gbk) asc</if>
<if test="!isAll">ty.sort</if>
,t.project_id
</select> </select>
<select id="selectCountByTypeAndStatus" resultType="cn.wisenergy.model.dto.MonthlyWorkingHoursStatistics"> <select id="selectCountByTypeAndStatus" resultType="cn.wisenergy.model.dto.MonthlyWorkingHoursStatistics">
...@@ -373,10 +384,14 @@ ...@@ -373,10 +384,14 @@
</select> </select>
<select id="selectListByType" resultMap="userWorkTimeStatisticsByProject"> <select id="selectListByType" resultMap="userWorkTimeStatisticsByProject">
SELECT <if test="isAll">u.id AS user_id, u.`name` AS user_name,</if> SELECT
<if test="!isAll">'合计' AS user_name,</if> t.type AS work_time_type, <if test="isAll">u.id AS user_id, u.`name` AS user_name,</if>
IF(t.is_overtime = 0, <if test="!isAll">0</if> <if test="!isAll">'合计' AS user_name,</if>
<if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1, <if test="!isAll">0</if> t.type AS work_time_type,
IF(t.is_overtime = 0,
<if test="!isAll">0</if>
<if test="isAll">null</if>, sum(t.work_time)) AS over_time, IF(t.is_overtime=1,
<if test="!isAll">0</if>
<if test="isAll">null</if>, sum(t.work_time)) AS normal_time <if test="isAll">null</if>, sum(t.work_time)) AS normal_time
from work_time_order t JOIN work_user u ON t.user_id = u.id from work_time_order t JOIN work_user u ON t.user_id = u.id
where where
...@@ -415,7 +430,7 @@ ...@@ -415,7 +430,7 @@
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<collection property="workDay" <collection property="workDay"
javaType="ArrayList" javaType="ArrayList"
ofType = "java.util.Date"> ofType="java.util.Date">
<result column="work_day"/> <result column="work_day"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -441,11 +456,37 @@ ...@@ -441,11 +456,37 @@
<foreach collection="depts" item="dept" open="(" close=")" separator=","> <foreach collection="depts" item="dept" open="(" close=")" separator=",">
#{dept} #{dept}
</foreach> </foreach>
</if>) </if>
)
</where> </where>
ORDER BY CONVERT( u.name USING gbk ) ORDER BY CONVERT( u.name USING gbk )
</select> </select>
<select id="getOrderChangePage" resultType="cn.wisenergy.model.dto.OrderChangePageDto">
select o.project_id,p.project_name,u.name 'user_name',o.work_day,
o.work_time,t.name 'type_name',o.des,o.status
from work_time_order o LEFT JOIN work_type t on o.type = t.id
LEFT JOIN work_user u on o.user_id = u.id
LEFT JOIN work_project p on o.project_id = p.id
<where>
<if test="projectId !=null">
AND o.project_id = #{projectId}
</if>
<if test="type !=null and type>2">
AND o.type = #{type}
</if>
<if test="startDate !=null">
AND o.work_day >= #{startDate}
</if>
<if test="endDate !=null">
AND o.work_day &lt;= #{endDate}
</if>
<if test="userName !=null">
AND u.name like concat('%',#{userName},'%')
</if>
</where>
ORDER BY CONVERT( u.name USING gbk ), o.work_day desc
</select>
</mapper> </mapper>
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -20,6 +21,7 @@ import java.util.Date; ...@@ -20,6 +21,7 @@ import java.util.Date;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="WorkCollect", description="工时汇总实体类") @ApiModel(value="WorkCollect", description="工时汇总实体类")
public class WorkCollect implements Serializable { public class WorkCollect implements Serializable {
......
package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="WorkOrderChange", description="工单变更记录")
public class WorkOrderChange {
@ApiModelProperty(name = "id",value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "changeDate",value = "变更日期")
private Date changeDate;
@ApiModelProperty(name = "content",value = "操作内容:1:增加 2:删除 3:修改")
private Integer content;
@ApiModelProperty(name = "operatorId",value = "操作人id")
private Integer operatorId;
@ApiModelProperty(name = "deptId",value = "操作人部门id")
private Integer deptId;
@ApiModelProperty(name = "projectId",value = "项目id")
private Integer projectId;
@ApiModelProperty(name = "type",value = "工时类型")
private Integer type;
@ApiModelProperty(name = "workDay",value = "工单日期")
private Date workDay;
@ApiModelProperty(name = "userId",value = "填报人Id")
private Integer userId;
@ApiModelProperty(name = "workTime",value = "工时")
private Integer workTime;
@ApiModelProperty(name = "des",value = "工作说明")
private String des;
@ApiModelProperty(name = "changeReason",value = "修改原因")
private String changeReason;
}
...@@ -2,9 +2,11 @@ package cn.wisenergy.model.app; ...@@ -2,9 +2,11 @@ package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -19,6 +21,7 @@ import java.util.Objects; ...@@ -19,6 +21,7 @@ import java.util.Objects;
* @since 2021-01-19 * @since 2021-01-19
*/ */
@Data @Data
@Accessors(chain = true)
@ApiModel(value = "WorkTimeOrder", description = "工时单实体类") @ApiModel(value = "WorkTimeOrder", description = "工时单实体类")
public class WorkTimeOrder implements Serializable { public class WorkTimeOrder implements Serializable {
...@@ -40,6 +43,7 @@ public class WorkTimeOrder implements Serializable { ...@@ -40,6 +43,7 @@ public class WorkTimeOrder implements Serializable {
@ApiModelProperty(name = "workTime", value = "工时(整数)") @ApiModelProperty(name = "workTime", value = "工时(整数)")
private Integer workTime; private Integer workTime;
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "workDay", value = "工单日期") @ApiModelProperty(name = "workDay", value = "工单日期")
private Date workDay; private Date workDay;
...@@ -72,8 +76,12 @@ public class WorkTimeOrder implements Serializable { ...@@ -72,8 +76,12 @@ public class WorkTimeOrder implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (!(o instanceof WorkTimeOrder)) return false; return true;
}
if (!(o instanceof WorkTimeOrder)) {
return false;
}
WorkTimeOrder that = (WorkTimeOrder) o; WorkTimeOrder that = (WorkTimeOrder) o;
if (null != getProjectId() && null != that.getProjectId()) { if (null != getProjectId() && null != that.getProjectId()) {
return getWorkId().equals(that.getWorkId()) && return getWorkId().equals(that.getWorkId()) &&
......
package cn.wisenergy.model.dto;
import lombok.Data;
import java.util.List;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class DeptOfProjectAndOrderType {
private Integer deptId;
private String deptName;
List<ProjectManagerDto> projectManagerDtos;
}
package cn.wisenergy.model.dto;
import lombok.Data;
import java.util.List;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class OrderChangeDto {
private List<DeptOfProjectAndOrderType> projectAndOrderTypes;
private List<OrderChangeTypeDto> orderChangeTypeDtos;
}
package cn.wisenergy.model.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class OrderChangePageDto {
private Integer projectId;
private String projectName;
private String userName;
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private Date workDay;
private Integer workTime;
private Integer status;
private String statusName;
private String typeName;
private String des;
}
package cn.wisenergy.model.dto;
import java.util.List;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
public class OrderChangeProjectDto {
private Integer projectId;
private String projectName;
private List<UserDto> userDtos;
}
package cn.wisenergy.model.dto;
import lombok.Data;
import java.util.List;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class OrderChangeTypeDto {
private Integer type;
private String typeName;
private List<UserDto> userDtos;
private List<OrderChangeTypeDto> orderChangeTypeDtos;
}
...@@ -12,7 +12,8 @@ public enum LevelEnum { ...@@ -12,7 +12,8 @@ public enum LevelEnum {
TIMEEXPORT("工时导出"), TIMEEXPORT("工时导出"),
SYSTEMSETTINGS("系统设置"), SYSTEMSETTINGS("系统设置"),
ACCOUNTMANAGEMENT("账号管理"), ACCOUNTMANAGEMENT("账号管理"),
MISSING("填报缺失"), WORKORDER_CHANGEMANAGEMENT("工单变更管理"),
WORKORDER_CHANGERECORD("工单变更记录"),
; ;
private String LevelName; private String LevelName;
......
package cn.wisenergy.model.enums;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
public enum OrderChangeEnum {
CREATE(1,"新增工单"),
DELETE(2,"删除工单"),
UPDATE(3, "修改工单"),
;
private Integer content;
private String contentName;
OrderChangeEnum(Integer content, String contentName) {
this.content = content;
this.contentName = contentName;
}
public Integer getContent() {
return content;
}
public String getContentName() {
return contentName;
}}
package cn.wisenergy.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class OrderChangeManagerVo {
private Integer projectId;
private Integer type;
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private Date startDate;
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private Date endDate;
private String userName;
private Integer page;
private Integer pageSize;
}
package cn.wisenergy.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
public class OrderChangeVo {
private Integer workId;
private Integer projectId;
private Integer type;
private Integer projectName;
private Integer userId;
private Integer userName;
private Integer operatorId;
@JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd")
private Date workDay;
private Integer workTime;
private String des;
private String changeReason;
}
...@@ -62,4 +62,5 @@ public interface WorkCollectService { ...@@ -62,4 +62,5 @@ public interface WorkCollectService {
Boolean updateByWorkTimeOrder(List<WorkTimeOrder> workTimeOrders); Boolean updateByWorkTimeOrder(List<WorkTimeOrder> workTimeOrders);
Boolean deleteByUserIdAndWorkDay(Integer userId, Date workDay);
} }
package cn.wisenergy.service; package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkDept; import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.model.dto.DeptOfProjectAndOrderType;
import cn.wisenergy.model.dto.OrganizationStructureDto; import cn.wisenergy.model.dto.OrganizationStructureDto;
import java.util.List; import java.util.List;
...@@ -38,4 +39,6 @@ public interface WorkDeptService { ...@@ -38,4 +39,6 @@ public interface WorkDeptService {
* @return * @return
*/ */
List<WorkDept> getDeptOfProjectOfManager(Integer userId); List<WorkDept> getDeptOfProjectOfManager(Integer userId);
List<DeptOfProjectAndOrderType> getDeptOfProjectAndOrderType(Integer userId);
} }
package cn.wisenergy.service;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
public interface WorkOrderChangeService {
}
package cn.wisenergy.service; package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkProject; import cn.wisenergy.model.app.WorkProject;
import cn.wisenergy.model.dto.DeptOfProjectAndOrderType;
import cn.wisenergy.model.dto.ProjectDto; import cn.wisenergy.model.dto.ProjectDto;
import cn.wisenergy.model.vo.CreateProjectVo; import cn.wisenergy.model.vo.CreateProjectVo;
import cn.wisenergy.model.vo.GetManagerProjectsVo; import cn.wisenergy.model.vo.GetManagerProjectsVo;
...@@ -71,5 +72,9 @@ public interface WorkProjectService { ...@@ -71,5 +72,9 @@ public interface WorkProjectService {
Boolean addProject(CreateProjectVo createProjectVo); Boolean addProject(CreateProjectVo createProjectVo);
/**
* 获取管理员所管理的项目+后五种类型/所属部门(工单变更)
* @param userId 管理员id
*/
List<DeptOfProjectAndOrderType> getProjectAndOrderTypeAndDept(Integer userId);
} }
...@@ -2,6 +2,8 @@ package cn.wisenergy.service; ...@@ -2,6 +2,8 @@ package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkTimeOrder; import cn.wisenergy.model.app.WorkTimeOrder;
import cn.wisenergy.model.dto.*; import cn.wisenergy.model.dto.*;
import cn.wisenergy.model.vo.OrderChangeManagerVo;
import cn.wisenergy.model.vo.OrderChangeVo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.Date; import java.util.Date;
...@@ -125,4 +127,19 @@ public interface WorkTimeOrderService { ...@@ -125,4 +127,19 @@ public interface WorkTimeOrderService {
* @return * @return
*/ */
NotWorkSubmitOrderDto getDeptNotOrderInfo(Integer userId); NotWorkSubmitOrderDto getDeptNotOrderInfo(Integer userId);
/**
* 工单变更管理分页
* @param vo 条件
* @return 分页
*/
PageInfo<OrderChangePageDto> getOrderChangePage(OrderChangeManagerVo vo);
Boolean createOrderChange(OrderChangeVo vo);
Boolean updateOrderChange(OrderChangeVo vo);
Boolean deleteOrderChange(Integer workId, Integer operator);
} }
...@@ -17,8 +17,8 @@ import java.util.HashMap; ...@@ -17,8 +17,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
* @Authotr:陈奇 * @author ASUS
* @QQ1799796883 *
*/ */
@Service @Service
......
...@@ -16,6 +16,7 @@ import cn.wisenergy.model.dto.SubtotalDto; ...@@ -16,6 +16,7 @@ import cn.wisenergy.model.dto.SubtotalDto;
import cn.wisenergy.model.enums.StatusEnum; import cn.wisenergy.model.enums.StatusEnum;
import cn.wisenergy.service.*; import cn.wisenergy.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -67,6 +68,8 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -67,6 +68,8 @@ public class WorkCollectServiceImpl implements WorkCollectService {
private StatisticsService statisticsService; private StatisticsService statisticsService;
private static final int NEEDSUBMITORDER = 1;
/** /**
* 功能: 查询某年月的填报情况 * 功能: 查询某年月的填报情况
* *
...@@ -96,8 +99,7 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -96,8 +99,7 @@ public class WorkCollectServiceImpl implements WorkCollectService {
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
// 如果查询的日期大于本月的日期,则不查询 // 如果查询的日期大于本月的日期,则不查询
if (NEEDSUBMITORDER == user.getSubmitOrder() && workMonth.compareTo(new Date())<=0) {
if (1 == user.getSubmitOrder() && workMonth.compareTo(new Date())<=0) {
List<Date> notCompletedByMonth = getNotCompletedByMonth(user, workMonth); List<Date> notCompletedByMonth = getNotCompletedByMonth(user, workMonth);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (!CollectionUtils.isEmpty(notCompletedByMonth)) { if (!CollectionUtils.isEmpty(notCompletedByMonth)) {
...@@ -196,7 +198,7 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -196,7 +198,7 @@ public class WorkCollectServiceImpl implements WorkCollectService {
boolean flag = DateUtil.isYearAndMonthEqual(month, new Date()); boolean flag = DateUtil.isYearAndMonthEqual(month, new Date());
List<Date> workDays = statisticsService.currentMonthWorkDays(month, flag); List<Date> workDays = statisticsService.currentMonthWorkDays(month, flag);
Date createDate = DateUtils.bigDateToShortDate(user.getCreateTime()); Date createDate = DateUtils.bigDateToShortDate(user.getCreateTime());
workDays.removeIf(date1 -> date1.compareTo(createDate) < 0); workDays.removeIf(workDay -> workDay.compareTo(createDate) < 0);
List<WorkCollect> completedCollect = workCollectMapper.getCompletedByUserIdAndMonth(user.getId(), month); List<WorkCollect> completedCollect = workCollectMapper.getCompletedByUserIdAndMonth(user.getId(), month);
List<Date> completedDays = new ArrayList<>(); List<Date> completedDays = new ArrayList<>();
completedCollect.forEach(collect -> completedDays.add(collect.getWorkDay())); completedCollect.forEach(collect -> completedDays.add(collect.getWorkDay()));
...@@ -242,4 +244,17 @@ public class WorkCollectServiceImpl implements WorkCollectService { ...@@ -242,4 +244,17 @@ public class WorkCollectServiceImpl implements WorkCollectService {
return true; return true;
} }
@Override
public Boolean deleteByUserIdAndWorkDay(Integer userId, Date workDay) {
log.info("WorkCollectServiceImpl[]deleteByUserIdAndWorkDay[]input.param.userId:{}, workDay:{}" + userId, workDay);
if (null == userId || null == workDay) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
UpdateWrapper<WorkCollect> wrapper = new UpdateWrapper<>();
wrapper.eq("user_id", userId);
wrapper.eq("work_day", workDay);
int delete = workCollectMapper.delete(wrapper);
return delete>0;
}
} }
...@@ -6,6 +6,7 @@ import cn.wisenergy.common.utils.exception.BaseCustomException; ...@@ -6,6 +6,7 @@ import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkDeptMapper; import cn.wisenergy.mapper.WorkDeptMapper;
import cn.wisenergy.model.app.WorkDept; import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.model.app.WorkUser; import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.model.dto.DeptOfProjectAndOrderType;
import cn.wisenergy.model.dto.OrganizationStructureDto; import cn.wisenergy.model.dto.OrganizationStructureDto;
import cn.wisenergy.model.dto.ProjectDto; import cn.wisenergy.model.dto.ProjectDto;
import cn.wisenergy.model.dto.UserRoleLevelDto; import cn.wisenergy.model.dto.UserRoleLevelDto;
...@@ -179,4 +180,10 @@ public class WorkDeptServiceImpl implements WorkDeptService { ...@@ -179,4 +180,10 @@ public class WorkDeptServiceImpl implements WorkDeptService {
} }
return null; return null;
} }
@Override
public List<DeptOfProjectAndOrderType> getDeptOfProjectAndOrderType(Integer userId) {
log.info("WorkDeptServiceImpl[]getDeptOfProjectAndOrderType[]input.param.userId:{}" + userId);
return workDeptMapper.getDeptOfProjectAndOrderType(userId);
}
} }
package cn.wisenergy.service.impl;
import cn.wisenergy.service.WorkOrderChangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Service
@Slf4j
public class WorkOrderChangeImpl implements WorkOrderChangeService {
}
...@@ -5,13 +5,9 @@ import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM; ...@@ -5,13 +5,9 @@ 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.WorkCentreMapper; import cn.wisenergy.mapper.WorkCentreMapper;
import cn.wisenergy.mapper.WorkDeptMapper; import cn.wisenergy.mapper.WorkDeptMapper;
import cn.wisenergy.mapper.WorkProjectChangeMapper;
import cn.wisenergy.mapper.WorkProjectMapper; import cn.wisenergy.mapper.WorkProjectMapper;
import cn.wisenergy.model.app.*; import cn.wisenergy.model.app.*;
import cn.wisenergy.model.dto.ManagerProjectsDto; import cn.wisenergy.model.dto.*;
import cn.wisenergy.model.dto.ProjectDto;
import cn.wisenergy.model.dto.UserProjectDto;
import cn.wisenergy.model.dto.UserRoleLevelDto;
import cn.wisenergy.model.enums.LevelEnum; import cn.wisenergy.model.enums.LevelEnum;
import cn.wisenergy.model.enums.LevelRankEnum; import cn.wisenergy.model.enums.LevelRankEnum;
import cn.wisenergy.model.enums.ManagerEnum; import cn.wisenergy.model.enums.ManagerEnum;
...@@ -72,7 +68,7 @@ public class WorkProjectServiceImpl implements WorkProjectService { ...@@ -72,7 +68,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
private WorkProjectChangeService workProjectChangeService; private WorkProjectChangeService workProjectChangeService;
@Autowired @Autowired
private WorkProjectChangeMapper workProjectChangeMapper; private WorkTypeService workTypeService;
/** /**
...@@ -570,6 +566,78 @@ public class WorkProjectServiceImpl implements WorkProjectService { ...@@ -570,6 +566,78 @@ public class WorkProjectServiceImpl implements WorkProjectService {
return true; return true;
} }
/**
* 获取管理员所管理的项目+后五种类型/所属部门(工单变更)
*
* @param userId 管理员id
*/
@Override
public List<DeptOfProjectAndOrderType> getProjectAndOrderTypeAndDept(Integer userId) {
log.info("WorkProjectServiceImpl[]getProjectAndOrderTypeAndDept[]input.param.userId:{}" + userId);
if (null == userId) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkUser user = workUserService.getById(userId);
WorkDept dept = workDeptService.getById(user.getDeptId());
List<Integer> ranks = UserRoleLevelUtils.getRankByUserAndLevelName(userId, LevelEnum.WORKORDER_CHANGEMANAGEMENT.getLevelName());
if (CollectionUtils.isEmpty(ranks)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN);
}
List<DeptOfProjectAndOrderType> projectAndOrderTypes = new ArrayList<>();
// 后五种类型
List<ProjectManagerDto> projectManagerDtos = new ArrayList<>();
List<WorkType> workTypeServiceAll = workTypeService.getAll(1);
if (!CollectionUtils.isEmpty(workTypeServiceAll)) {
for (WorkType workType : workTypeServiceAll) {
if (1 !=workType.getReviewer()) {
ProjectManagerDto projectManagerDto = new ProjectManagerDto();
projectManagerDto.setType(workType.getId());
projectManagerDto.setTypeName(workType.getName());
projectManagerDtos.add(projectManagerDto);
}
}
}
// 中心级(系统管理员)
for (Integer rank : ranks) {
if (LevelRankEnum.CENTRAL_LEVEL.getRank().equals(rank)) {
projectAndOrderTypes = workDeptService.getDeptOfProjectAndOrderType(null);
if (!CollectionUtils.isEmpty(projectAndOrderTypes)) {
for (DeptOfProjectAndOrderType projectAndOrderType : projectAndOrderTypes) {
projectAndOrderType.getProjectManagerDtos().addAll(projectManagerDtos);
}
}
return projectAndOrderTypes;
}
}
for (Integer rank : ranks) {
// 项目级
if (LevelRankEnum.PROJECT_LEVEL.getRank().equals(rank)) {
projectAndOrderTypes= workDeptService.getDeptOfProjectAndOrderType(userId);
}
}
for (Integer rank : ranks) {
// 部门级
if (LevelRankEnum.DEPARTMENT_LEVEL.getRank().equals(rank)) {
if (!CollectionUtils.isEmpty(projectAndOrderTypes)) {
for (DeptOfProjectAndOrderType projectAndOrderType : projectAndOrderTypes) {
if (projectAndOrderType.getDeptId().equals(user.getDeptId())) {
projectAndOrderType.getProjectManagerDtos().addAll(projectManagerDtos);
}
}
}else{
DeptOfProjectAndOrderType projectAndOrderType = new DeptOfProjectAndOrderType();
projectAndOrderType.setDeptId(user.getDeptId());
projectAndOrderType.setDeptName(dept.getDeptName());
projectAndOrderType.setProjectManagerDtos(projectManagerDtos);
projectAndOrderTypes.add(projectAndOrderType);
}
}
}
return projectAndOrderTypes;
}
private PageInfo<ManagerProjectsDto> returnPageInfo(List<ManagerProjectsDto> managerProjectsDto) { private PageInfo<ManagerProjectsDto> returnPageInfo(List<ManagerProjectsDto> managerProjectsDto) {
if (CollectionUtils.isEmpty(managerProjectsDto)) { if (CollectionUtils.isEmpty(managerProjectsDto)) {
return null; return null;
......
...@@ -4,6 +4,7 @@ import cn.wisenergy.common.utils.DateUtil; ...@@ -4,6 +4,7 @@ import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.DateUtils; import cn.wisenergy.common.utils.DateUtils;
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.WorkOrderChangeMapper;
import cn.wisenergy.mapper.WorkProjectMapper; import cn.wisenergy.mapper.WorkProjectMapper;
import cn.wisenergy.mapper.WorkTimeOrderMapper; import cn.wisenergy.mapper.WorkTimeOrderMapper;
import cn.wisenergy.mapper.WorkUserMapper; import cn.wisenergy.mapper.WorkUserMapper;
...@@ -11,7 +12,10 @@ import cn.wisenergy.model.app.*; ...@@ -11,7 +12,10 @@ import cn.wisenergy.model.app.*;
import cn.wisenergy.model.dto.*; import cn.wisenergy.model.dto.*;
import cn.wisenergy.model.enums.LevelEnum; import cn.wisenergy.model.enums.LevelEnum;
import cn.wisenergy.model.enums.LevelRankEnum; import cn.wisenergy.model.enums.LevelRankEnum;
import cn.wisenergy.model.enums.OrderChangeEnum;
import cn.wisenergy.model.enums.StatusEnum; import cn.wisenergy.model.enums.StatusEnum;
import cn.wisenergy.model.vo.OrderChangeManagerVo;
import cn.wisenergy.model.vo.OrderChangeVo;
import cn.wisenergy.service.*; import cn.wisenergy.service.*;
import cn.wisenergy.service.utils.UserRoleLevelUtils; import cn.wisenergy.service.utils.UserRoleLevelUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -82,6 +86,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -82,6 +86,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
@Autowired @Autowired
private StatisticsService statisticsService; private StatisticsService statisticsService;
@Autowired
private WorkOrderChangeMapper workOrderChangeMapper;
// 工单状态 // 工单状态
...@@ -108,7 +115,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -108,7 +115,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
} }
List<WorkTimeOrder> workTimeOrders = workTimeOrderMapper.getByDay(userId, workDay); List<WorkTimeOrder> workTimeOrders = workTimeOrderMapper.getByDay(userId, workDay);
if (CollectionUtils.isEmpty(workTimeOrders)) { if (CollectionUtils.isEmpty(workTimeOrders)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_ORDER_INFO_IS_NULL); return null;
} }
return workTimeOrders; return workTimeOrders;
...@@ -143,7 +150,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -143,7 +150,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
for (WorkTimeOrder wto : workTimeOrders) { for (WorkTimeOrder wto : workTimeOrders) {
totalTime += wto.getWorkTime(); totalTime += wto.getWorkTime();
if (null != wto.getReason() && REJECTED.equals(wto.getStatus()) && reason.toString().equals("")) { if (null != wto.getReason() && REJECTED.equals(wto.getStatus()) && "".equals(reason.toString())) {
if (!CollectionUtils.isEmpty(typeIds)) { if (!CollectionUtils.isEmpty(typeIds)) {
if (typeIds.contains(wto.getType())) { if (typeIds.contains(wto.getType())) {
reason.append(workProjectService.getById(wto.getProjectId()).getProjectName()).append(":").append(wto.getReason()).append(";"); reason.append(workProjectService.getById(wto.getProjectId()).getProjectName()).append(":").append(wto.getReason()).append(";");
...@@ -208,7 +215,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -208,7 +215,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 1.判断是否重复填报 // 1.判断是否重复填报
isRepeat(workTimeOrders); isRepeat(workTimeOrders);
// 2.每天工时累加不得超过八小时 // 2.每天工时累加不得超过八小时
timeNotEight(workTimeOrders); timeNotEight(0, workTimeOrders);
int totalTime = 0; int totalTime = 0;
List<WorkTimeOrder> addList = new ArrayList<>(8); List<WorkTimeOrder> addList = new ArrayList<>(8);
List<WorkType> workTypes = workTypeService.getAll(null); List<WorkType> workTypes = workTypeService.getAll(null);
...@@ -262,7 +269,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -262,7 +269,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
for (WorkTimeOrder dto : addList) { for (WorkTimeOrder dto : addList) {
if (null != workCollect && null != workCollect.getRejectTime()) { if (null != workCollect && null != workCollect.getRejectTime()) {
Date rejectTime1 = workCollect.getRejectTime(); Date rejectTime1 = workCollect.getRejectTime();
//dto.setStatus(RE_SUBMIT);
Date rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime1, "yyyy-MM-dd"), "yyyy-MM-dd"); Date rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime1, "yyyy-MM-dd"), "yyyy-MM-dd");
if (DateUtil.isThanDay(rejectTime, date, submitTime)) { if (DateUtil.isThanDay(rejectTime, date, submitTime)) {
throw new BaseCustomException("627", "超过" + submitTime + "天的不能填报"); throw new BaseCustomException("627", "超过" + submitTime + "天的不能填报");
...@@ -337,10 +343,12 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -337,10 +343,12 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
} }
// 判断填写工时单是否重复 // 判断填写工时单是否重复
private void isRepeat(List<WorkTimeOrderDto> list) { private void isRepeat(List<?> ts) {
if (CollectionUtils.isEmpty(list)) { List<WorkTimeOrder> list = new ArrayList<>();
if (CollectionUtils.isEmpty(ts)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
} }
ts.forEach(t -> list.add((WorkTimeOrder) t));
List<Integer> typeIds = workTypeService.getIdByReviewer(1); List<Integer> typeIds = workTypeService.getIdByReviewer(1);
int size = list.size(); int size = list.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
...@@ -545,7 +553,19 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -545,7 +553,19 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (!UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.EXAMINE.getLevelName())) { if (!UserRoleLevelUtils.isManagerLevel(userId, LevelEnum.EXAMINE.getLevelName())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_NOT_LEVEL);
} }
Date startDate;
Date endDate;
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
WorkSubmitAdopt submitAdopt = workSubmitAdoptService.getById(1);
Integer orderChange = submitAdopt.getOrderChange();
calendar.add(Calendar.DAY_OF_MONTH, -orderChange);
startDate = DateUtil.getFirstDayOfMonth(calendar.getTime());
endDate = DateUtil.getLastDayByMonth2(calendar.getTime());
QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>(); QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>();
wrapper.ge("work_day", startDate);
wrapper.le("work_day", endDate);
wrapper.eq("reviewer_id", userId); wrapper.eq("reviewer_id", userId);
wrapper.eq("status", REJECTED); wrapper.eq("status", REJECTED);
wrapper.orderByDesc("work_day"); wrapper.orderByDesc("work_day");
...@@ -797,15 +817,20 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -797,15 +817,20 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
} }
//3.每天工时累加不得超过八小时 //3.每天工时累加不得超过八小时
private void timeNotEight(List<WorkTimeOrderDto> list) { private int timeNotEight(int totalTime, List<?> ts) {
int count = 0; List<WorkTimeOrder> list = new ArrayList<>(8);
for (WorkTimeOrderDto workOrder : list) { if (!CollectionUtils.isEmpty(ts)) {
isEmpty(workOrder); ts.forEach(t -> list.add((WorkTimeOrder) t));
count = count + workOrder.getWorkTime(); }
if (count > 8) { if (!CollectionUtils.isEmpty(list)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_TIME_NOT_OVER_EIGHT); for (WorkTimeOrder workOrder : list) {
totalTime = totalTime + workOrder.getWorkTime();
} }
} }
if (totalTime > 8) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_TIME_NOT_OVER_EIGHT);
}
return totalTime;
} }
//判断填报是否超过今天 //判断填报是否超过今天
...@@ -934,8 +959,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -934,8 +959,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
/** /**
* 获取本部门 填报缺失信息 * 获取本部门 填报缺失信息
* *
* @param userId * @param userId 管理员id
* @return * @return 填报缺失信息
*/ */
@Override @Override
public NotWorkSubmitOrderDto getDeptNotOrderInfo(Integer userId) { public NotWorkSubmitOrderDto getDeptNotOrderInfo(Integer userId) {
...@@ -962,17 +987,19 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -962,17 +987,19 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
Integer submitTime = adopt.getSubmitTime(); Integer submitTime = adopt.getSubmitTime();
Date date = new Date(); Date date = new Date();
Date startDate = null; Date startDate;
Date endDate = null; Date endDate;
if (DateUtil.getDay(date) <= submitTime) { Calendar calendar = Calendar.getInstance();
date.setMonth(DateUtil.getMonth(date) - 1); calendar.setTime(date);
startDate = DateUtil.getFirstDayOfMonth(date); calendar.set(Calendar.DAY_OF_MONTH, -submitTime);
endDate = DateUtil.getLastDayByMonth2(date); if (DateUtil.isYearAndMonthEqual(date, calendar.getTime())) {
} else {
startDate = DateUtil.getFirstDayOfMonth(date); startDate = DateUtil.getFirstDayOfMonth(date);
endDate = date; endDate = date;
} else {
startDate = DateUtil.getFirstDayOfMonth(calendar.getTime());
endDate = DateUtil.getLastDayByMonth2(calendar.getTime());
} }
boolean flag = DateUtil.isYearAndMonthEqual(date, new Date()); boolean flag = DateUtil.isYearAndMonthEqual(date, date);
List<Date> workDays = statisticsService.currentMonthWorkDays(date, flag); List<Date> workDays = statisticsService.currentMonthWorkDays(date, flag);
List<DeptUserDto> deptUserDtos = new ArrayList<>(); List<DeptUserDto> deptUserDtos = new ArrayList<>();
...@@ -1031,5 +1058,237 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -1031,5 +1058,237 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
return notWorkSubmitOrderDto; return notWorkSubmitOrderDto;
} }
/**
* 工单变更管理分页
*
* @param vo 条件
* @return 分页
*/
@Override
public PageInfo<OrderChangePageDto> getOrderChangePage(OrderChangeManagerVo vo) {
log.info("WorkOrderServiceImpl[]getOrderChangePage[]input.param.OrderChangeManagerVo" + vo);
if (null == vo) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
if (null == vo.getProjectId() && null == vo.getType()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.PLEASESELECTANITEM);
}
vo.setPage(null == vo.getPage() ? 1 : vo.getPage());
vo.setPageSize(null == vo.getPageSize() ? 10 : vo.getPageSize());
PageHelper.startPage(vo.getPage(), vo.getPageSize());
List<OrderChangePageDto> orderChangePage = workTimeOrderMapper.getOrderChangePage(vo);
if (!CollectionUtils.isEmpty(orderChangePage)) {
for (OrderChangePageDto orderChangePageDto : orderChangePage) {
for (StatusEnum value : StatusEnum.values()) {
if (orderChangePageDto.getStatus().equals(value.getCode())) {
orderChangePageDto.setStatusName(value.getMsg());
}
}
}
}
PageInfo<OrderChangePageDto> pageInfo = new PageInfo<>(orderChangePage);
pageInfo.setList(orderChangePage);
return pageInfo;
}
@Transactional
@Override
public Boolean createOrderChange(OrderChangeVo vo) {
log.info("WorkTimeOrderServiceImpl[]createOrderChange[]input.param.OrderChangeVo:{}" + vo);
// 1.判断参数是否为空
OrderChangeVoIsNull(vo, false);
// 2.是否超过8小时
int totalTime = vo.getWorkTime();
List<WorkTimeOrder> workTimeOrders = getByDay(vo.getUserId(), vo.getWorkDay());
List<WorkTimeOrder> workTimeOrderList = new ArrayList<>(8);
if (!CollectionUtils.isEmpty(workTimeOrders)) {
workTimeOrderList.addAll(workTimeOrders);
}
totalTime = timeNotEight(totalTime, workTimeOrders);
// 3.判断工时类型和项目是否重复
WorkTimeOrder workTimeOrder = new WorkTimeOrder();
BeanUtils.copyProperties(vo, workTimeOrder);
workTimeOrderList.add(workTimeOrder);
isRepeat(workTimeOrderList);
// 4.插入workTimeOrder表
WorkTimeOrder timeOrder = getOrderChangeWorkTimeOrder(vo, workTimeOrder);
int saveTimeOrderRow = workTimeOrderMapper.save(timeOrder);
if (saveTimeOrderRow == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INSERT_DATA_IS_FAIL);
}
// 5.插入workCollect表
insertWorkCollect(vo, totalTime, CollectionUtils.isEmpty(workTimeOrders), false, null);
// 增加记录
addWorkOrderChange(OrderChangeEnum.CREATE.getContent(), vo);
return true;
}
@Transactional
@Override
public Boolean updateOrderChange(OrderChangeVo vo) {
log.info("WorkTimeOrderServiceImpl[]updateOrderChange[]input.param.OrderChangeVo:{}" + vo);
// 1.判断参数是否为空
OrderChangeVoIsNull(vo, true);
List<WorkTimeOrder> workTimeOrders = getByDay(vo.getUserId(), vo.getWorkDay());
// 2.判断是否超过8小时
int totalTime = vo.getWorkTime();
if (!CollectionUtils.isEmpty(workTimeOrders)) {
workTimeOrders.removeIf(workTimeOrder -> workTimeOrder.getWorkId().equals(vo.getWorkId()));
}
totalTime = timeNotEight(totalTime, workTimeOrders);
// 3.判断工时类型是否重复
List<WorkTimeOrder> workTimeOrderList = new ArrayList<>(8);
if (!CollectionUtils.isEmpty(workTimeOrders)) {
workTimeOrderList.addAll(workTimeOrders);
}
WorkTimeOrder workTimeOrder = new WorkTimeOrder();
BeanUtils.copyProperties(vo, workTimeOrder);
workTimeOrderList.add(workTimeOrder);
isRepeat(workTimeOrderList);
// 4.获取原工单
WorkTimeOrder workTimeOrderOld = workTimeOrderMapper.selectById(vo.getWorkId());
System.out.println(workTimeOrderOld);
// 5.修改workTimeOrder工单
WorkTimeOrder timeOrder = getOrderChangeWorkTimeOrder(vo, workTimeOrder);
int i = workTimeOrderMapper.updateById(timeOrder);
if (i == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INSERT_DATA_IS_FAIL);
}
// 判断是否是同一天
if (vo.getWorkDay().compareTo(workTimeOrderOld.getWorkDay()) == 0) {
insertWorkCollect(vo, totalTime, false, false, null);
}else {
// 6.修改或插入workCollect表
insertWorkCollect(vo, totalTime, CollectionUtils.isEmpty(workTimeOrders), false, null);
// 7.修改或删除原workCollect表
List<WorkTimeOrder> workTimeOrdersOld = getByDay(workTimeOrderOld.getUserId(), workTimeOrderOld.getWorkDay());
System.out.println(workTimeOrdersOld);
if (!CollectionUtils.isEmpty(workTimeOrdersOld)) {
totalTime = 0;
for (WorkTimeOrder order : workTimeOrdersOld) {
totalTime += order.getWorkTime();
}
}
insertWorkCollect(vo, totalTime, false, CollectionUtils.isEmpty(workTimeOrdersOld), workTimeOrderOld);
}
// 增加记录
addWorkOrderChange(OrderChangeEnum.UPDATE.getContent(), vo);
return true;
}
@Transactional
@Override
public Boolean deleteOrderChange(Integer workId, Integer operator) {
log.info("WorkTimeOrderServiceImpl[]deleteOrderChange[]input.param.workId:{},operator:{}" + workId, operator);
if (null == workId || null == operator) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
// 查询原工单
WorkTimeOrder workTimeOrder = workTimeOrderMapper.selectById(workId);
OrderChangeVo vo = new OrderChangeVo();
BeanUtils.copyProperties(vo, workTimeOrder);
vo.setOperatorId(operator);
// 删除记录
workTimeOrderMapper.deleteById(workId);
// 增加记录
addWorkOrderChange(OrderChangeEnum.CREATE.getContent(), vo);
return true;
}
private void addWorkOrderChange(Integer content, OrderChangeVo vo) {
WorkOrderChange workOrderChange = new WorkOrderChange();
WorkUser operator = workUserService.getById(vo.getOperatorId());
workOrderChange.setChangeDate(new Date()).setContent(content).setOperatorId(vo.getOperatorId()).setDeptId(operator.getDeptId()).setWorkDay(vo.getWorkDay()).setUserId(vo.getUserId()).setWorkTime(vo.getWorkTime()).setDes(vo.getDes()).setChangeReason(vo.getChangeReason());
if (null == vo.getProjectId()) {
workOrderChange.setType(vo.getType());
} else {
workOrderChange.setProjectId(vo.getProjectId());
}
int insert = workOrderChangeMapper.insert(workOrderChange);
if (insert == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INSERT_DATA_IS_FAIL);
}
}
// 获取完整工单变更WorkTimeOrder
private WorkTimeOrder getOrderChangeWorkTimeOrder(OrderChangeVo vo, WorkTimeOrder workTimeOrder) {
WorkUser user = workUserService.getById(vo.getUserId());
Boolean holiday = workHolidayService.isHoliday(vo.getWorkDay());
int status = 2;
int deptId = user.getDeptId();
int reviewerId = vo.getOperatorId();
int isOvertime = holiday ? 1 : 0;
Date date = new Date();
workTimeOrder.setStatus(status).setDeptId(deptId).setReviewerId(reviewerId).setIsOvertime(isOvertime).setModifyTime(date);
return workTimeOrder;
}
private void insertWorkCollect(OrderChangeVo vo, int totalTime, Boolean isInsert, Boolean isDelete, WorkTimeOrder workTimeOrderOld) {
if (isDelete) {
Boolean aBoolean = workCollectService.deleteByUserIdAndWorkDay(workTimeOrderOld.getUserId(), workTimeOrderOld.getWorkDay());
if (!aBoolean) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.FAILEDTO_DELETE_DATA);
}
} else {
WorkCollect workCollect = new WorkCollect();
int i = statusYes(vo.getUserId(), vo.getWorkDay());
if (null == workTimeOrderOld) {
workCollect.setUserId(vo.getUserId()).setWorkDay(vo.getWorkDay()).setTotalTime(totalTime).setStatus(i);
}else {
workCollect.setUserId(workTimeOrderOld.getUserId()).setWorkDay(workTimeOrderOld.getWorkDay()).setTotalTime(totalTime).setStatus(i);
}
Boolean aBoolean;
if (isInsert) {
aBoolean = workCollectService.insertCollect(workCollect);
if (!aBoolean) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INSERT_DATA_IS_FAIL);
}
} else {
aBoolean = workCollectService.update(workCollect);
if (!aBoolean) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
}
}
}
}
// 判断新增的工单变更是否为空
private void OrderChangeVoIsNull(OrderChangeVo vo, Boolean workIdIsNeed) {
if (null == vo || (null == vo.getProjectId() && null == vo.getType())
|| null == vo.getWorkDay() || null == vo.getWorkTime() || StringUtils.isBlank(vo.getDes()) || StringUtils.isBlank(vo.getChangeReason())) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
if (workIdIsNeed && null == vo.getWorkId()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
} else if (null == vo.getUserId()) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
Date workDay = vo.getWorkDay();
Date date = new Date();
if (workDay.compareTo(date) > 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_TIME_OVER_NOW_DAY);
}
Integer orderChange = workSubmitAdoptService.getById(1).getOrderChange();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, -orderChange);
Date firstDay = DateUtil.getFirstDayOfMonth(calendar.getTime());
if (firstDay.compareTo(vo.getWorkDay()) > 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.THEWORKORDERDATE_HASEXCEEDED_THECHANGERANGE);
}
if (vo.getWorkTime() <= 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORKORDERHOURS_MUSTBEGREATERTHAN0);
}
}
} }
...@@ -334,7 +334,7 @@ public class WorkUserServiceImpl implements WorkUserService { ...@@ -334,7 +334,7 @@ public class WorkUserServiceImpl implements WorkUserService {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_LOGIN_NAME_OR_PASSWORD_IS_ERROR); throw new BaseCustomException(BASE_RESP_CODE_ENUM.USER_LOGIN_NAME_OR_PASSWORD_IS_ERROR);
} }
// 是否离职状态 // 是否离职状态
if (user.getStatus() != ON_THE_JOB_STATUS) { if (!user.getStatus().equals(ON_THE_JOB_STATUS)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.LEAVE_JOB_USER); throw new BaseCustomException(BASE_RESP_CODE_ENUM.LEAVE_JOB_USER);
} }
......
...@@ -3,6 +3,7 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -3,6 +3,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.exception.Result; import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkDept; import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.model.app.WorkProjectChange; import cn.wisenergy.model.app.WorkProjectChange;
import cn.wisenergy.model.dto.DeptOfProjectAndOrderType;
import cn.wisenergy.model.vo.CreateProjectVo; import cn.wisenergy.model.vo.CreateProjectVo;
import cn.wisenergy.model.vo.GetManagerProjectsVo; import cn.wisenergy.model.vo.GetManagerProjectsVo;
import cn.wisenergy.model.vo.ModifyProjectVo; import cn.wisenergy.model.vo.ModifyProjectVo;
...@@ -90,8 +91,8 @@ public class WorkProjectController extends BaseController { ...@@ -90,8 +91,8 @@ public class WorkProjectController extends BaseController {
return getResult(aBoolean); return getResult(aBoolean);
} }
@ApiOperation(value = "获取所管理项目的部门", notes = "获取所管理项目的部门") @ApiOperation(value = "获取所管理项目的部门(项目/商机管理)", notes = "获取所管理项目的部门(项目/商机管理)")
@ApiImplicitParam(name = "userId", value = "管理员id") @ApiImplicitParam(name = "userId", value = "管理员id",required = true)
@GetMapping("/getDeptOfProject") @GetMapping("/getDeptOfProject")
public Result<List<WorkDept>> getDeptOfProject(Integer userId) { public Result<List<WorkDept>> getDeptOfProject(Integer userId) {
log.info("WorkProjectController[]getDeptOfProject[]input.param.userId" + userId); log.info("WorkProjectController[]getDeptOfProject[]input.param.userId" + userId);
...@@ -99,5 +100,14 @@ public class WorkProjectController extends BaseController { ...@@ -99,5 +100,14 @@ public class WorkProjectController extends BaseController {
return getResult(deptOfProjectOfManager); return getResult(deptOfProjectOfManager);
} }
@ApiOperation(value = "查询所管理的项目和所属部门(工单变更管理)", notes = "查询所管理的项目和所属部门(工单变更管理)", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "管理员Id", dataType = "int", required = true)
@GetMapping("/getProjectAndTypeAndDept")
public Result getProjectAndOrderTypeAndDept(Integer userId) {
log.info("WorkProjectController[]getProjectAndOrderTypeAndDept[]input.param.userId" + userId);
List<DeptOfProjectAndOrderType> projectAndOrderTypeAndDept = workProjectService.getProjectAndOrderTypeAndDept(userId);
return getResult(projectAndOrderTypeAndDept);
}
} }
...@@ -6,6 +6,8 @@ import cn.wisenergy.common.utils.exception.RESP_CODE_ENUM; ...@@ -6,6 +6,8 @@ import cn.wisenergy.common.utils.exception.RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.Result; import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkTimeOrder; import cn.wisenergy.model.app.WorkTimeOrder;
import cn.wisenergy.model.dto.*; import cn.wisenergy.model.dto.*;
import cn.wisenergy.model.vo.OrderChangeManagerVo;
import cn.wisenergy.model.vo.OrderChangeVo;
import cn.wisenergy.service.WorkTimeOrderService; import cn.wisenergy.service.WorkTimeOrderService;
import cn.wisenergy.web.admin.controller.common.BaseController; import cn.wisenergy.web.admin.controller.common.BaseController;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -168,4 +170,45 @@ public class WorkTimeOrderController extends BaseController { ...@@ -168,4 +170,45 @@ public class WorkTimeOrderController extends BaseController {
} }
@ApiOperation(value = "工单变更分页",notes = "工单变更分页",httpMethod = "POST")
@ApiImplicitParam(name = "vo", value = "工单变更分页条件Vo", dataType = "OrderChangeManagerVo")
@PostMapping("/orderChangePage")
public Result orderChangePage(@RequestBody OrderChangeManagerVo vo) {
log.info("WorkTimeOrderController[]orderChangePage[]input.param.OrderChangeManagerVo:{}" + vo);
PageInfo<OrderChangePageDto> orderChangePage = workTimeOrderService.getOrderChangePage(vo);
return getResult(orderChangePage);
}
@ApiOperation(value = "新增变更工单", notes = "新增变更工单", httpMethod = "POST")
@ApiImplicitParam(name = "vo", value = "新增变更工单vo",dataType = "OrderChangeVo")
@PostMapping("/createOrderChange")
public Result createOrderChange(@RequestBody OrderChangeVo vo) {
log.info("WorkTimeOrderController[]createOrderChange[]input.param.OrderChangeVo:{}" + vo);
Boolean orderChange = workTimeOrderService.createOrderChange(vo);
return getResult(orderChange);
}
@ApiOperation(value = "修改变更工单",notes = "修改变更工单",httpMethod = "PUT")
@ApiImplicitParam(name = "vo", value = "修改变更工单vo",dataType = "OrderChangeVo")
@PutMapping("/updateOrderChange")
public Result updateOrderChange(@RequestBody OrderChangeVo vo) {
log.info("WorkTimeOrderController[]updateOrderChange[]input.param.OrderChangeVo:{}" + vo);
Boolean aBoolean = workTimeOrderService.updateOrderChange(vo);
return getResult(aBoolean);
}
@ApiOperation(value = "删除工单",notes = "删除工单",httpMethod = "DELETE")
@ApiImplicitParams({
@ApiImplicitParam(name = "workId",value = "工单id",dataType = "int",required = true),
@ApiImplicitParam(name = "operator",value = "操作者",dataType = "int",required = true)
})
@DeleteMapping("/deleteOrderChange")
public Result deleteOrderChange(Integer workId,Integer operator) {
log.info("WorkTimeOrderController[]deleteOrderChange[]input.param.workId:{},operator:{}" + workId,operator);
Boolean aBoolean = workTimeOrderService.deleteOrderChange(workId, operator);
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