Commit a3ba0140 authored by cq990612's avatar cq990612

第一次提交

parent 8d7b946e
package cn.wisenergy.common.utils.exception;
/**
* 响应码基类
*
* @author wyy
* @data 2019/08/15
*/
public enum BASE_RESP_CODE_ENUM {
/********************* SpringMBoot 系统异常 **********************/
MIS_REQ_PARAM("400", "请求参数丢失"),
NO_AUTH_REQUEST("401", "未授权"),
REJECT_REQUEST("403", "未授权"),
RESOURCE_NOT_FOUND("404", "请求的资源不存在"),
METHOD_NOT_SUPPORTED("405", "不支持的请求方法"),
MEDIA_TYPE_NOT_ACCEPT("406", "无法接受请求中的媒体类型"),
REQUEST_TIME_OUT("408", "无法接受请求中的媒体类型"),
MEDIA_TYPE_NOT_SUPPORTED("415", "不支持的媒体类型"),
SERVER_ERROR("500", "获取数据异常"),
INPUT_PARAM_IS_NULL("600", "入参为空"),
WORK_ORDER_INFO_IS_NULL("601", "工单信息为空"),
USER_ADD_FAIL("602", "新建用户失败"),
UPDATE_DATA_FAIL("603", "更新数据失败"),
USER_UPDATE_PASSWORD_FAIL("604", "用户修改密码失败"),
UPDATE_PASSWORD_FAIL_OLD_PASSWORD_ERROR("605", "修改密码失败,旧密码错误"),
RECORD_WORD_ADD_FAIL("606", "字段添加失败"),
USER_RESET_PASSWORD_FAIL("607", "用户重置密码失败"),
FILE_NOT_NULL("608", "上传文件不能为空"),
STATISTICS_RECORD_DATA_FAIL("609", "统计档案数据失败"),
EQUIPMENT_INFO_IS_NULL("610", "设备信息为空"),
QUERY_WORK_ORDER_DATA_IS_NULL("611", "获取工单数据为空"),
WORK_TIME_NOT_OVER_EIGHT("611", "每日累计工时不超过8小时"),
USER_ACCOUNT_ALREADY_EXIST("612", "用户账号已存在"),
USER_PHONE_ALREADY_EXIST("613", "该手机号已被注册"),
INSERT_DATA_IS_FAIL("614", "插入数据失败"),
FILE_INCORRETC_FORMAT("615", "文件格式不正确"),
RECORD_WORD_REPEAT("616", "字段名称重复"),
WORD_NAME_REPEAT("617", "字段名称请勿重复"),
QUERY_USER_INFO_FAIL("618", "获取用户信息失败"),
WORK_ORDER_ALREADY_COMMIT("619", "工单已填报,不能重复填报"),
WORK_TIME_OVER_NOW_DAY("620", "工单日期不能大于当天"),
INSERT_WORK_COLLECT_DATA_FAIL("621", "插入工时单汇总信息失败"),
NO_JOIN_EVERY_PROJECT_PLASE_JION("622", "您还没有加入项目中,请先去加入项目"),
THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN("623", "您不是管理员,请登录管理员账号"),
DEPT_NOT_HAVE_USER("624", "该部门下没有人员"),
PROJECT_NOT_HAVE_USER("624", "该部门下没有项目"),
USER_PHONE_IS_ERROR("625", "用户名/手机号不正确"),
DELETE_OLD_WORK_ORDER_FAIL("626","删除旧工单数据失败"),
WORK_DAY_THAN_DATE("627","填报的日期超过系统默认日期"),
DES_NOT_NULL("628","工作简述不能为空"),
WORK_PROJECT_IS_NULL("629","项目为空"),
WORK_ORDER_END("630", "该项目的工单已经全部审批"),
DEPT_IS_NULL("631","该部门不存在"),
MANAGER_NOT_PROJECT("632","该管理没有可管理的项目"),
;
/**
* 错误编码
*/
public String code;
/**
* 错误编码信息
*/
public String msg;
/**
* 构造函数
*
* @param code 编码
* @param msg 编码信息
*/
BASE_RESP_CODE_ENUM(String code, String msg) {
this.code = code;
this.msg = msg;
}
/**
* 获取编码
*/
public String getCode() {
return code;
}
/**
* 设置编码
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取编码信息
*/
public String getMsg() {
return msg;
}
/**
* 设置编码信息
*/
public void setMsg(String msg) {
this.msg = msg;
}
}
package cn.wisenergy.common.utils.exception;
/**
* 接口异常对象
*/
public class CustomException extends RuntimeException {
private static final long serialVersionUID = -4974461182923482972L;
// 错误编码
private String errorCode;
// 错误编码信息
private String errorMsg;
/**
* 应用接口有参构造函数
*
* @param errorCode 错误编码
* @param errorMsg 错误信息
*/
public CustomException(String errorCode, String errorMsg) {
super("errorCode:" + errorCode + " errorMsg:" + errorMsg);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
/**
* 应用接口有参构造函数
*
* @param respCodeEnum 基本响应枚举类
*/
public CustomException(RESP_CODE_ENUM respCodeEnum) {
super(respCodeEnum.getMsg());
this.errorCode = respCodeEnum.getCode();
this.errorMsg = respCodeEnum.getMsg();
}
/**
* 获取错误编码
*/
public String getErrorCode() {
return errorCode;
}
/**
* 设置错误编码
*/
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
/**
* 获取异常编码
*/
public String getErrorMsg() {
return errorMsg;
}
/**
* 设置异常编码
*/
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
}
package cn.wisenergy.common.utils.exception;
/**
* 响应编码
*/
public enum RESP_CODE_ENUM {
/* ******************** 业务自定义异常 ********************* */
RSA_PRIVATE_KEY_ERROR("1001", "生成RSA非对称加密公钥出错"),
RSA_NOT_EXIST("1002", "RSA非对称加密公钥不存在"),
RSA_DECRYPTION_ERROR("1003", "RSA解密错误"),
TOKEN_IS_NOT_EXIST("1004", "TOKEN已失效"),
REQUIRED_IDENTIFY_NOT_EXIST("1005", "请求标识对象不存在"),
ILLEGAL_PARAMETER("1006", "非法参数"),
MISS_PARAMETER("1007", "缺少必须的参数"),
ACCT_NOT_EXIST("1008", "账号不存在"),
ACCT_OR_ACCOPASS_ERROR("1009", "账号或密码错误"),
ACCT_HAS_FROZEN("1010", "账号已禁用"),
NOT_LOGIN_ERROR("1011", "用户未登录"),
CAPTCHA_CODE_INVALID("1012", "验证码失效"),
CAPTCHA_CODE_ERROR("1013", "验证码错误"),
NO_DATA("1014", "数据为空"),
CAPTCHA_EXIST("1015", "验证码已发送,请稍等"),
LOGIN_FAILURE("1016", "登录已失效,请重新登录"),
PHONE_ERROE("1017", "绑定手机号错误"),
RECORD_WORD_ADD_FAIL("1018", "字段添加失败"),
INPUT_PARAM_IS_NULL("1019", "入参为空"),
CREATE_WORK_ORDER_FAIL("1020", "创建工单失败"),
QUERY_WORK_ORDER_INFO_FAIL("1021", "获取工单信息失败"),
QUERY_WORK_ORDER_LISt_FAIL("1021", "获取工单列表失败"),
AUDIT_WORK_ORDER_FAIL("1022","审核工单失败"),
QUERY_USER_INFO_FAIL("1023","获取用户信息失败")
;
// 错误编码
private String code;
// 错误信息
private String msg;
// 相应编码有参构造函数
RESP_CODE_ENUM(String code, String msg) {
this.code = code;
this.msg = msg;
}
/**
* 获取编码
*/
public String getCode() {
return code;
}
/**
* 设置编码
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取编码信息
*/
public String getMsg() {
return msg;
}
/**
* 设置编码信息
*/
public void setMsg(String msg) {
this.msg = msg;
}
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkCollect;
import cn.wisenergy.model.dto.CalendarDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.Date;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkCollectMapper extends BaseMapper<WorkCollect> {
List<CalendarDto> getWorkMonth(Integer userId, Date workMonth);
int inserWorkCollect(WorkCollect workCollect);
int updateStatusOrTotaltime(Integer id, Integer status, Integer totalTime);
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkDept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkDeptMapper extends BaseMapper<WorkDept> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkHoliday;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkHolidayMapper extends BaseMapper<WorkHoliday> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkProjectChange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkProjectChangeMapper extends BaseMapper<WorkProjectChange> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkProjectMapper extends BaseMapper<WorkProject> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkSbumitAdopt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkSbumitAdoptMapper extends BaseMapper<WorkSbumitAdopt> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkTimeOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
List<WorkTimeOrder> getByDay(Integer userId, Date workDay);
int save(WorkTimeOrder workTimeOrder);
int updateByIds(@Param("reviewerId") Integer reviewerId,@Param("ids") List<Integer> ids);
int updateStatusById(Integer reviewerId,Integer id, String reason);
List<WorkTimeOrder> queryByPage(@Param("status") Integer status,@Param("projectId") Integer projectId,@Param("types") List<Integer> types);
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkUserDept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserDeptMapper extends BaseMapper<WorkUserDept> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserMapper extends BaseMapper<WorkUser> {
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkUserProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserProjectMapper extends BaseMapper<WorkUserProject> {
}
<?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.WorkCollectMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkCollect">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="work_day" property="workDay"/>
<result column="total_time" property="totalTime"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="modify_time" property="modifyTime"/>
</resultMap>
<sql id="vals">
#{userId},#{workDay},#{totalTime},#{status},now(),now()
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, work_day, total_time, status, create_time, modify_time
</sql>
<sql id="cols_exclude_id">
user_id, work_day, total_time, status, create_time, modify_time
</sql>
<sql id="table">
work_collect
</sql>
<sql id="CalendarDto_List" >
user_id, work_day,status
</sql>
<insert id="inserWorkCollect">
INSERT INTO
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
VALUES (
<include refid="vals"/>
)
</insert>
<update id="updateStatusOrTotaltime">
UPDATE
<include refid="table"/>
<set>
<if test="null != status">
status=#{status},
</if>
<if test="null !=totalTime">
total_time = total_time + #{totalTime},
</if>
modify_time = now()
</set>
WHERE id = #{id}
</update>
<select id="getWorkMonth" resultType="cn.wisenergy.model.dto.CalendarDto">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="table"/>
<where>
<if test="null != userId">
AND user_id = #{userId}
</if>
<if test="null != workMonth">
AND DATE_FORMAT(work_day, '%Y%m') = DATE_FORMAT(#{workMonth} ,'%Y%m')
</if>
</where>
</select>
</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.WorkDeptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkDept">
<id column="id" property="id" />
<result column="dept_name" property="deptName" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, dept_name, create_time, modify_time
</sql>
</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.WorkHolidayMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkHoliday">
<id column="id" property="id" />
<result column="day_start" property="dayStart" />
<result column="day_end" property="dayEnd" />
<result column="day_type" property="dayType" />
<result column="des" property="des" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, day_start, day_end, day_type, des
</sql>
</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.WorkProjectChangeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkProjectChange">
<id column="id" property="id" />
<result column="project_id" property="projectId" />
<result column="type" property="type" />
<result column="content" property="content" />
<result column="reason" property="reason" />
<result column="change_date" property="changeDate" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, project_id, type, content, reason, change_date
</sql>
</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.WorkProjectMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkProject">
<id column="id" property="id" />
<result column="peoject_num" property="peojectNum" />
<result column="project_name" property="projectName" />
<result column="type" property="type" />
<result column="manager_id" property="managerId" />
<result column="manager_name" property="managerName" />
<result column="dept_id" property="deptId" />
<result column="work_time" property="workTime" />
<result column="cost_budget" property="costBudget" />
<result column="project_status" property="projectStatus" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, peoject_num, project_name, type, manager_id, manager_name, dept_id, work_time, cost_budget, project_status, create_time, modify_time
</sql>
</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.WorkSbumitAdoptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkSbumitAdopt">
<id column="id" property="id" />
<result column="submit_time" property="submitTime" />
<result column="auto_adopt" property="autoAdopt" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, submit_time, auto_adopt
</sql>
</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.WorkTimeOrderMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkTimeOrder">
<id column="work_id" property="workId"/>
<result column="user_id" property="userId"/>
<result column="user_name" property="userName"/>
<result column="project_id" property="projectId"/>
<result column="project_name" property="projectName"/>
<result column="dept_id" property="deptId"/>
<result column="work_time" property="workTime"/>
<result column="work_day" property="workDay"/>
<result column="status" property="status"/>
<result column="reviewer_id" property="reviewerId"/>
<result column="des" property="des"/>
<result column="reason" property="reason"/>
<result column="type" property="type"/>
<result column="is_overtime" property="isOvertime"/>
<result column="create_time" property="createTime"/>
<result column="modify_time" property="modifyTime"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
work_id, user_id, user_name, project_id, project_name, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime, create_time, modify_time
</sql>
<sql id="vals">
#{userId},#{userName},#{projectId},#{projectName},#{deptId},#{workTime},#{workDay},#{status},#{reviewerId},#{des},#{reason},#{type},#{isOvertime},now(),now()
</sql>
<sql id="cols_exclude_id">
user_id, user_name, project_id, project_name, dept_id, work_time, work_day, status, reviewer_id, des, reason, type, is_overtime, create_time, modify_time
</sql>
<sql id="table">
work_time_order
</sql>
<insert id="save" keyProperty="workId" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="updateByIds">
UPDATE
<include refid="table"/>
SET status = 2,reviewer_id = #{reviewerId}
WHERE work_id IN
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
<update id="updateStatusById">
UPDATE
<include refid="table"/>
SET status = 3,reason = #{reason},reviewer_id = #{reviewerId},modify_time=now()
WHERE work_id = #{id}
</update>
<select id="getByDay" resultType="cn.wisenergy.model.app.WorkTimeOrder">
SELECT <include refid="Base_Column_List"/>
FROM <include refid="table"/>
<where>
<if test="null !=userId">
<if test="null != userId">
AND user_id = #{userId}
</if>
<if test="null != workDay">
AND DATE_FORMAT(work_day, '%Y%m%d') = DATE_FORMAT(#{workDay} ,'%Y%m%d')
</if>
</if>
</where>
</select>
<select id="queryByPage" resultType="cn.wisenergy.model.app.WorkTimeOrder">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="table"/>
<where>
<if test="null != projectId">
AND project_id = #{projectId}
</if>
<if test="null != status">
AND status = #{status}
</if>
<if test="null != types">
AND type IN
<foreach collection="types" item="type" open="(" close=")" separator=",">
#{type}
</foreach>
</if>
</where>
ORDER BY work_day,project_name DESC
</select>
</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.WorkUserDeptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkUserDept">
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="dept_id" property="deptId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, dept_id
</sql>
</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.WorkUserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkUser">
<id column="id" property="id" />
<result column="dept_id" property="deptId" />
<result column="name" property="name" />
<result column="login_name" property="loginName" />
<result column="password" property="password" />
<result column="phone" property="phone" />
<result column="email" property="email" />
<result column="role" property="role" />
<result column="type" property="type" />
<result column="status" property="status" />
<result column="wx_id" property="wxId" />
<result column="level" property="level" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, dept_id, name, login_name, password, phone, email, role, type, status, wx_id, level, create_time, modify_time
</sql>
</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.WorkUserProjectMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkUserProject">
<id column="id" property="id" />
<result column="user_id" property="userId" />
<result column="project_id" property="projectId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, user_id, project_id
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="callSettersOnNulls" value="true"/>
<!--<setting name="proxyFactory" value="CGLIB"/>-->
<!-- <setting name="lazyLoadingEnabled" value="true"/>-->
<!-- 打印查询语句 -->
<setting name="logImpl" value="STDOUT_LOGGING" />
</settings>
<typeHandlers>
<typeHandler handler="cn.wisenergy.common.utils.mybatis.DecimalHandler" jdbcType="DECIMAL" javaType="java.math.BigDecimal"/>
</typeHandlers>
</configuration>
\ No newline at end of file
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkCollect", description="工时汇总实体类")
public class WorkCollect implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "userId",value = "填报工时人员")
private Integer userId;
@ApiModelProperty(name = "workDay",value = "工时的日期")
private Date workDay;
@ApiModelProperty(name = "totalTime",value = "总工时")
private Integer totalTime;
@ApiModelProperty(name = "status",value = "状态: 1:已填报 ,2:已审核,3:被驳回")
private Integer status;
@ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime;
@ApiModelProperty(name = "modifyTime",value = "修改时间")
private Date modifyTime;
}
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkDept", description="工单部门实体类")
public class WorkDept implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "deptName",value = "部门名称(行业应用、平台产品、业务探索、解决方案本部、遵义巴)")
private String deptName;
@ApiModelProperty(name = "oaDeptId",value = "OA")
private String oaDeptId;
@ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime;
@ApiModelProperty(name = "modifyTime",value = "修改时间")
private Date modifyTime;
@ApiModelProperty(name = "deptManagerId", value = "部门经理id")
private Integer deptManagerId;
}
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkHoliday", description="节假日实体类")
public class WorkHoliday implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "dayStart",value = "开始日期")
private Date dayStart;
@ApiModelProperty(name = "dayEnd",value = "结束日期")
private Date dayEnd;
@ApiModelProperty(name = "dayType",value = "日期类型:0工作日 1节日")
private Integer dayType;
@ApiModelProperty(name = "des",value = "日期说明")
private String des;
}
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 java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkProject", description="工单项目实体类")
public class WorkProject implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "peojectNum",value = "项目编号")
private String peojectNum;
@ApiModelProperty(name = "projectName",value = "项目名称")
private String projectName;
@ApiModelProperty(name = "type",value = "1:项目,2:商机")
private Integer type;
@ApiModelProperty(name = "managerId",value = "项目经理userId")
private Integer managerId;
@ApiModelProperty(name = "managerName",value = "项目经理姓名")
private String managerName;
@ApiModelProperty(name = "deptId",value = "部门id")
private Integer deptId;
@ApiModelProperty(name = "workTime",value = "工时预算")
private Integer workTime;
@ApiModelProperty(name = "costBudget",value = "成本预算,以万为单位")
private BigDecimal costBudget;
@ApiModelProperty(name = "projectStatus",value = "是否结项:0:结项,1:未结束")
private Integer isConclusion;
@ApiModelProperty(name = "startTime",value = "项目开始时间")
private Date startTime;
@ApiModelProperty(name = "endTime",value = "项目结束时间")
private Date endTime;
@ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime;
@ApiModelProperty(name = "modifyTime",value = "修改时间")
private Date modifyTime;
@ApiModelProperty(name = "oaPeojectNumbel",value = "oa中的项目编号")
private String oaPeojectNumbel;
}
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkProjectChange", description="项目更改类")
public class WorkProjectChange implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "projectId;",value = "项目编号")
private Integer projectId;
@ApiModelProperty(name = "type",value = "1:成本预算变更,2:工时预算变更")
private Integer type;
@ApiModelProperty(name = "modifyBefore",value = "修改后预算之前")
private String modifyBefore;
@ApiModelProperty(name = "modifyAfter",value = "修改后的预算")
private String modifyAfter;
@ApiModelProperty(name = "reason",value = "变更原因")
private String reason;
@ApiModelProperty(name = "changeDate",value = "变更日期")
private Date modifyTime;
}
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 java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkSbumitAdopt", description="自动提交审核类")
public class WorkSbumitAdopt implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "submitTime",value = "工时提交时限")
private Integer submitTime;
@ApiModelProperty(name = "autoAdopt",value = "工时自动审批时限")
private Integer autoAdopt;
}
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkTimeOrder", description="工时单实体类")
public class WorkTimeOrder implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "workId",value = "主键id")
@TableId(value = "work_id", type = IdType.AUTO)
private Integer workId;
@ApiModelProperty(name = "userId",value = "用户id")
private Integer userId;
@ApiModelProperty(name = "userName",value = "用户名")
private String userName;
@ApiModelProperty(name = "projectId",value = "项目id")
private Integer projectId;
@ApiModelProperty(name = "projectName",value = "项目名称")
private String projectName;
@ApiModelProperty(name = "deptId",value = "用户部门主键")
private Integer deptId;
@ApiModelProperty(name = "workTime",value = "工时(整数)")
private Integer workTime;
@ApiModelProperty(name = "workDay",value = "工单日期")
private Date workDay;
@ApiModelProperty(name = "status",value = "工单审核状态 1:已填报,2:已审批,3:被驳回 4:重新提交 5:自动审核")
private Integer status;
@ApiModelProperty(name = "reviewerId",value = "审核人userId")
private Integer reviewerId;
@ApiModelProperty(name = "des",value = "工作简述")
private String des;
@ApiModelProperty(name = "reason",value = "审核理由")
private String reason;
@ApiModelProperty(name = "type",value = "1:项目,2:商机,3:请假,4:调休,5:外部商务、技术交流 6:内部培训、技术准备、管理 7:其他非项目/商机工作")
private Integer type;
@ApiModelProperty(name = "isOvertime",value = "工时类型:0:正常工时,1:加班")
private Integer isOvertime;
@ApiModelProperty(name = "createTime",value = "工单创建时间")
private Date createTime;
@ApiModelProperty(name = "modifyTime",value = "工单修改时间")
private Date modifyTime;
}
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 java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkUser", description="用户实体类")
public class WorkUser implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "deptId",value = "部门id")
private Integer deptId;
@ApiModelProperty(name = "name",value = "用户名")
private String name;
@ApiModelProperty(name = "loginName",value = "登录名")
private String loginName;
@ApiModelProperty(name = "password",value = "密码")
private String password;
@ApiModelProperty(name = "phone",value = "手机号")
private String phone;
@ApiModelProperty(name = "email",value = "邮箱")
private String email;
@ApiModelProperty(name = "role",value = "角色(产品、开发、测试、售前)")
private String role;
@ApiModelProperty(name = "type",value = "类型(公司、外协)")
private String type;
@ApiModelProperty(name = "status",value = "状态(1:在职、0:离职)")
private Integer status;
@ApiModelProperty(name = "wxId",value = "微信id")
private String wxId;
@ApiModelProperty(name = "level",value = "权限级别:普通用户:0,项目/商机级别:1,部门级别:2,中心级别:3,系统管理员:4")
private Integer level;
@ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime;
@ApiModelProperty(name = "modifyTime",value = "更新时间")
private Date modifyTime;
}
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 java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkUserDept", description="工单用户部门关联实体类")
public class WorkUserDept implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "userId",value = "用户id")
private Integer userId;
@ApiModelProperty(name = "deptId",value = "部门id")
private Integer deptId;
}
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 java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="WorkUserProject", description="工单用户项目关联实体类")
public class WorkUserProject implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "userId",value = "用户id")
private Integer userId;
@ApiModelProperty(name = "projectId",value = "项目id")
private Integer projectId;
}
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel(value="CalendarDto", description="日历展示类")
public class CalendarDto implements Serializable {
private static final long serialVersionUID = -1678604782365034642L;
@ApiModelProperty(name = "userId",value = "填报工时人员")
private Integer userId;
@ApiModelProperty(name = "status",value = "状态: 1:已填报 ,2:已审核,3:被驳回")
private Integer status;
@ApiModelProperty(name = "workDay",value = "工时的日期")
private Date workDay;
}
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @ Description : 创建工单dto
* @ Author : lcc
* @ CreateDate : 2020/5/11 15:26
*/
@Data
@ApiModel(value = "CreateWorkOrderDto", description = "创建工单dto")
public class CreateWorkOrderDto implements Serializable {
private static final long serialVersionUID = -6490634928080769463L;
/**
* 工单信息列表
*/
@ApiModelProperty(name = "workOrders", value = "工单信息列表")
private List<WorkTimeOrderDto> workTimeOrders;
}
package cn.wisenergy.model.dto;
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 java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel(value="ExamineGroupbyProjectDto", description="待审核通过项目分组类")
public class ExamineGroupbyProjectDto {
@TableId(value = "work_id", type = IdType.AUTO)
private Integer workId;
@ApiModelProperty(name = "projectId",value = "项目id")
private Integer projectId;
@ApiModelProperty(name = "projectName",value = "项目名称")
private String projectName;
@ApiModelProperty(name = "userName",value = "用户名")
private String userName;
@ApiModelProperty(name = "workTime",value = "工时(整数)")
private Integer workTime;
@ApiModelProperty(name = "workDay",value = "工单日期")
private Date workDay;
@ApiModelProperty(name = "isOvertime",value = "工时类型:0:正常工时,1:加班")
private Integer isOvertime;
@ApiModelProperty(name = "status",value = "工单审核状态 1:已填报,2:已审批,3:被驳回 4:重新提交 5:自动审核")
private Integer status;
@ApiModelProperty(name = "des",value = "工作内容")
private String des;
}
package cn.wisenergy.model.dto;
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;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ProjectDto", description="项目id和项目名实体类")
public class ProjectDto {
@ApiModelProperty(name = "id",value = "主键id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(name = "projectName",value = "项目名称")
private String projectName;
@ApiModelProperty(name = "type",value = "1:项目,2:商机")
private Integer type;
@ApiModelProperty(name = "managerName", value = "项目经理")
private String managerName;
@ApiModelProperty
private String deptManagerName;
}
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel(value="SubtotalDto", description="填报小计")
public class SubtotalDto {
@ApiModelProperty(name = "userId",value = "填报工时人员")
private Integer userId;
@ApiModelProperty(name = "workDay",value = "工时的日期")
private Date workDay;
@ApiModelProperty(name = "totalTime",value = "今日总工时")
private Integer totalTime;
@ApiModelProperty(name = "reason",value = "驳回原因")
private String reason;
@ApiModelProperty(name = "rejectMonth",value = "当月被驳回待处理条数")
private Integer rejectMonth;
}
package cn.wisenergy.model.dto;
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 java.util.Date;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel(value="WorkTimeOrderDto", description="工时填报详细类")
public class WorkTimeOrderDto {
@ApiModelProperty(name = "workId",value = "主键id")
@TableId(value = "work_id", type = IdType.AUTO)
private Integer workId;
@ApiModelProperty(name = "userId",value = "用户id")
private Integer userId;
@ApiModelProperty(name = "userName", value = "用户名")
private String userName;
@ApiModelProperty(name = "type",value = "1:项目,2:商机,3:请假,4:调休,5:外部商务、技术交流 6:内部培训、技术准备、管理 7:其他非项目/商机工作")
private Integer type;
@ApiModelProperty(name = "status",value = "工单审核状态 1:已填报,2:已审批,3:被驳回 4:重新提交 5:自动审核")
private Integer status;
@ApiModelProperty(name = "projectId",value = "项目id")
private Integer projectId;
@ApiModelProperty(name = "projectName",value = "项目名称")
private String projectName;
@ApiModelProperty(name = "projectManagerName",value = "项目经理")
private String projectManagerName;
@ApiModelProperty(name = "workTime",value = "工时(整数)")
private Integer workTime;
@ApiModelProperty(name = "workDay",value = "工单日期")
private Date workDay;
@ApiModelProperty(name = "des",value = "工作简述")
private String des;
@ApiModelProperty(name = "reason",value = "驳回理由")
private String reason;
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkCollect;
import cn.wisenergy.model.dto.CalendarDto;
import cn.wisenergy.model.dto.SubtotalDto;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkCollectService {
/**
* 功能: 查询某年月的填报情况
* @param userId 用户id
* @param workMonth 查询年月
* @return List<CalendarDto>
*/
List<CalendarDto> calendarMonth(Integer userId, Date workMonth);
/**
* 功能: 查询某日的填报小计
* @param userId 用户id
* @param workDay 某日
* @return List<CalendarDto>
*/
SubtotalDto calendarDay(Integer userId, Date workDay);
/**
* 功能:插入
* @param workCollect
* @return
*/
Boolean insertCollect(WorkCollect workCollect);
/**
* 功能:判断当日是否已经填报
* @param userId
* @param workDay
* @return
*/
WorkCollect getByUserIdAndWorkDay(Integer userId, Date workDay);
Boolean update(WorkCollect workCollect);
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkDept;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkDeptService {
WorkDept getById(Integer id);
}
package cn.wisenergy.service;
import java.util.Date;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkHolidayService {
Boolean isHoliday(Date date);
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkProjectChange;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkProjectChangeService {
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkProject;
import cn.wisenergy.model.dto.ProjectDto;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkProjectService {
/**
* 功能:根据项目id获取项目
* @param id
* @return
*/
WorkProject getById(Integer id);
List<ProjectDto> getNameById(List<Integer> ids);
/**
* 功能: 查询当前用户所管理的项目
* @param id
* @return
*/
List<ProjectDto> getByManagerId(Integer id);
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkSbumitAdopt;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkSbumitAdoptService {
/**
* 功能: 获取自动审批和默认填报限制
* @param id
* @return
*/
WorkSbumitAdopt getById(Integer id);
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkTimeOrder;
import cn.wisenergy.model.dto.CreateWorkOrderDto;
import cn.wisenergy.model.dto.ExamineGroupbyProjectDto;
import cn.wisenergy.model.dto.SubtotalDto;
import cn.wisenergy.model.dto.WorkTimeOrderDto;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkTimeOrderService {
/**
* 功能; 获取某日填报信息
*
* @param userId
* @param workDay
* @return
*/
List<WorkTimeOrder> getByDay(Integer userId, Date workDay);
/**
* 功能:获取某日填报小计
*
* @param userId
* @param workDay
* @return
*/
SubtotalDto getSubtotalReport(Integer userId, Date workDay);
/**
* 功能; 获取某日填报信息
*
* @param userId
* @param workDay
* @return DTO
*/
List<WorkTimeOrderDto> getByDayToDto(Integer userId, Date workDay);
/**
* 功能:工时填报
*
* @param createWorkOrderDto
* @return
*/
List<WorkTimeOrderDto> add(CreateWorkOrderDto createWorkOrderDto);
/**
* 功能: 驳回重新填报
*
* @param createWorkOrderDto
* @return
*/
List<WorkTimeOrderDto> update(CreateWorkOrderDto createWorkOrderDto);
/**
* 功能:获取待审批数据
*
* @param userId
* @return
*/
List<ExamineGroupbyProjectDto> getExamine(Integer userId, Integer projectId, Integer type,Integer page,Integer size,Integer status);
/**
* 功能:批量审批
*
* @param ids
* @return
*/
Boolean examinsByIds(Integer reviewerId, List<Integer> ids);
/**
* 功能: 驳回
*
* @param id
* @param reason
* @return
*/
Boolean rejectById(Integer reviewerId, Integer id, String reason);
/**
* 功能:查询驳回未提交的
*
* @param userId
* @return
*/
List<WorkTimeOrderDto> rejectNotSubmit(Integer userId);
}
package cn.wisenergy.service;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserDeptService {
Integer getDeptIdByUserId(Integer id);
List<Integer> getUserIdsByDeptId(Integer deptId);
}
package cn.wisenergy.service;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserProjectService {
/**
* 功能:根据userId获取项目id
* @param userId
* @return
*/
List<Integer> getProjectIdByUserId(Integer userId);
}
package cn.wisenergy.service;
import cn.wisenergy.model.app.WorkUser;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
public interface WorkUserService {
WorkUser getById(Integer id);
WorkUser getDeptManagerByIds(List<Integer> ids);
}
package cn.wisenergy.service.impl;
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.model.app.WorkCollect;
import cn.wisenergy.model.dto.CalendarDto;
import cn.wisenergy.model.dto.SubtotalDto;
import cn.wisenergy.service.WorkCollectService;
import cn.wisenergy.service.WorkTimeOrderService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkCollectServiceImpl implements WorkCollectService {
@Autowired
private WorkCollectMapper workCollectMapper;
@Autowired
private WorkTimeOrderService workTimeOrderService;
/**
* 功能: 查询某年月的填报情况
*
* @param userId 用户id
* @param workMonth 查询年月
* @return List<CalendarDto>
*/
@Override
public List<CalendarDto> calendarMonth(Integer userId, Date workMonth) {
log.info("WorkCollectServiceImpl[]calendarMonth[]input.param.userId:{},workMonth:{}", userId, workMonth);
if (null == userId || StringUtils.isEmpty(workMonth)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<CalendarDto> calendarDtoList = workCollectMapper.getWorkMonth(userId, workMonth);
if (CollectionUtils.isEmpty(calendarDtoList)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_ORDER_INFO_IS_NULL);
}
return calendarDtoList;
}
/**
* 功能: 查询某日的填报小计
*
* @param userId 用户id
* @param workDay 某日
* @return List<CalendarDto>
*/
@Override
public SubtotalDto calendarDay(Integer userId, Date workDay) {
log.info("WorkCollectServiceImpl[]calendarDay[]input.param.userId:{},workDay:{}", userId, workDay);
if (null == userId || StringUtils.isEmpty(workDay)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
SubtotalDto subtotalDto = workTimeOrderService.getSubtotalReport(userId, workDay);
if (null == subtotalDto) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_ORDER_INFO_IS_NULL);
}
return subtotalDto;
}
@Override
public Boolean insertCollect(WorkCollect workCollect) {
log.info("WorkCollectServiceImpl[]insertCollect[]input.param.WorkCollect{}" + workCollect);
if (null == workCollect) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
int insertRow = workCollectMapper.inserWorkCollect(workCollect);
if (insertRow == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INSERT_DATA_IS_FAIL);
}
return true;
}
/**
* 功能:判断当日是否已经填报
*
* @param userId
* @param workDay
* @return
*/
@Override
public WorkCollect getByUserIdAndWorkDay(Integer userId, Date workDay) {
log.info("WorkCollectServiceImpl[]getByUserIdAndWorkDay[]input.param.userId:{}, workDay:{}" + userId, workDay);
if (null == userId || null == workDay) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkCollect> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", userId);
wrapper.eq("work_day", workDay);
WorkCollect workCollect = workCollectMapper.selectOne(wrapper);
if (null == workCollect) {
return null;
}
return workCollect;
}
@Override
public Boolean update(WorkCollect workCollect) {
log.info("WorkCollectServiceImpl[]getByUserIdAndWorkDay[]input.param.workCollect:{}, " + workCollect);
if (null == workCollect) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
Integer id = getByUserIdAndWorkDay(workCollect.getUserId(), workCollect.getWorkDay()).getId();
int updateRow = workCollectMapper.updateStatusOrTotaltime(id, workCollect.getStatus(), workCollect.getTotalTime());
if (updateRow == 0) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.UPDATE_DATA_FAIL);
}
return true;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkDeptMapper;
import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.service.WorkDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkDeptServiceImpl implements WorkDeptService {
@Autowired
private WorkDeptMapper workDeptMapper;
@Override
public WorkDept getById(Integer id) {
log.info("WorkDeptServiceImpl[]getById[]input.param.id" + id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkDept workDept = workDeptMapper.selectById(id);
if (null == workDept) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_IS_NULL);
}
return workDept;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.mapper.WorkHolidayMapper;
import cn.wisenergy.model.app.WorkHoliday;
import cn.wisenergy.service.WorkHolidayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
public class WorkHolidayServiceImpl implements WorkHolidayService {
@Autowired
private WorkHolidayMapper workHolidayMapper;
@Override
public Boolean isHoliday(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
List<WorkHoliday> workHolidays = workHolidayMapper.selectList(null);
for (WorkHoliday holiday : workHolidays) {
if (!yearMonthBetween(date, holiday.getDayStart(), holiday.getDayEnd())) {
continue;
}
if (1 == holiday.getDayType()) {
return true;
}
}
if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY ||
calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY
) {
return true;
}
return false;
}
// 获取某时间段内的所有日期
public List<Date> findDates(Date dBegin, Date dEnd) {
List<Date> lDate = new ArrayList<>();
lDate.add(dBegin);
Calendar calBegin = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calBegin.setTime(dBegin);
Calendar calEnd = Calendar.getInstance();
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 测试此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则,为给定的日历字段添加或减去指定的时间量
calBegin.add(Calendar.DAY_OF_MONTH, 1);
lDate.add(calBegin.getTime());
}
return lDate;
}
// 判断某个时间是否在时间段内
public static boolean yearMonthBetween(Date nowDate, Date startDate, Date endDate) {
long nowTime = nowDate.getTime();
long startTime = startDate.getTime();
long endTime = endDate.getTime();
return nowTime >= startTime && nowTime <= endTime;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.service.WorkProjectChangeService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
public class WorkProjectChangeServiceImpl implements WorkProjectChangeService {
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkProjectMapper;
import cn.wisenergy.model.app.WorkProject;
import cn.wisenergy.model.dto.ProjectDto;
import cn.wisenergy.service.WorkProjectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkProjectServiceImpl implements WorkProjectService {
@Autowired
private WorkProjectMapper workProjectMapper;
/**
* 功能:根据项目id获取项目
*
* @param id
* @return
*/
@Override
public WorkProject getById(Integer id) {
log.info("WorkProjectServiceImpl[]getById[]input.param.id:"+id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkProject workProject = workProjectMapper.selectById(id);
if (null == workProject) {
return null;
}
return workProject;
}
@Override
public List<ProjectDto> getNameById(List<Integer> ids){
log.info("WorkProjectServiceImpl[]getNameById[]input.param.ids:"+ids);
if (CollectionUtils.isEmpty(ids)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<WorkProject> workProjects = workProjectMapper.selectBatchIds(ids);
ArrayList<ProjectDto> list = new ArrayList<>();
for (WorkProject workProject : workProjects) {
ProjectDto projectDto = new ProjectDto();
BeanUtils.copyProperties(workProject,projectDto);
list.add(projectDto);
}
return list;
}
/**
* 功能: 查询当前用户所管理的项目
*
* @param id
* @return
*/
@Override
public List<ProjectDto> getByManagerId(Integer id) {
log.info("WorkProjectServiceImpl[]getByManagerId[]input.param.id:"+id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkProject> wrapper = new QueryWrapper<>();
wrapper.eq("manager_id", id);
List<WorkProject> workProjects = workProjectMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(workProjects)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.MANAGER_NOT_PROJECT);
}
List<ProjectDto> projectDtos = new ArrayList<>();
for (WorkProject workProject : workProjects) {
ProjectDto projectDto = new ProjectDto();
BeanUtils.copyProperties(workProject,projectDto);
projectDtos.add(projectDto);
}
return projectDtos;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkSbumitAdoptMapper;
import cn.wisenergy.model.app.WorkSbumitAdopt;
import cn.wisenergy.service.WorkSbumitAdoptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkSbumitAdoptServiceImpl implements WorkSbumitAdoptService {
@Autowired
private WorkSbumitAdoptMapper workSbumitAdoptMapper;
/**
* 功能: 获取自动审批和默认填报限制
*
* @param id
* @return
*/
@Override
public WorkSbumitAdopt getById(Integer id) {
log.info("WorkSbumitAdoptServiceImpl[]getById[]input.param.id:" + id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkSbumitAdopt workSbumitAdopt = workSbumitAdoptMapper.selectById(id);
if (null == workSbumitAdopt) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.RESOURCE_NOT_FOUND);
}
return workSbumitAdopt;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkUserDeptMapper;
import cn.wisenergy.model.app.WorkUserDept;
import cn.wisenergy.service.WorkUserDeptService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkUserDeptServiceImpl implements WorkUserDeptService {
@Autowired
private WorkUserDeptMapper workUserDeptMapper;
@Override
public Integer getDeptIdByUserId(Integer id) {
log.info("WorkUserDeptServiceImpl[]getDeptIdByUserId[]input.param.id;{}" + id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkUserDept> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", id);
WorkUserDept workUserDept = workUserDeptMapper.selectOne(wrapper);
if (null == workUserDept) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_NOT_HAVE_USER);
}
Integer deptId = workUserDept.getDeptId();
if (null == deptId) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_NOT_HAVE_USER);
}
return deptId;
}
@Override
public List<Integer> getUserIdsByDeptId(Integer deptId) {
log.info("WorkUserDeptServiceImpl[]getUserIdsByDeptId[]input.param.deptId;{}" + deptId);
if (null == deptId) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkUserDept> wrapper = new QueryWrapper<>();
wrapper.eq("dept_id", deptId);
List<WorkUserDept> workUserDepts = workUserDeptMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(workUserDepts)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_NOT_HAVE_USER);
}
ArrayList<Integer> userIds = new ArrayList<>();
for (WorkUserDept workUserDept : workUserDepts) {
userIds.add(workUserDept.getUserId());
}
return userIds;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkUserProjectMapper;
import cn.wisenergy.model.app.WorkUserProject;
import cn.wisenergy.service.WorkUserProjectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkUserProjectServiceImpl implements WorkUserProjectService {
@Autowired
private WorkUserProjectMapper workUserProjectMapper;
/**
* 功能:根据userId获取项目id
*
* @param userId
* @return
*/
@Override
public List<Integer> getProjectIdByUserId(Integer userId) {
log.info("WorkUserProjectServiceImpl[]getProjectIdByUserId[]input.param.userId:{}" + userId);
if (null == userId) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkUserProject> wrapper = new QueryWrapper<>();
wrapper.eq("user_id", userId);
List<WorkUserProject> workUserProjects = workUserProjectMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(workUserProjects)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_PROJECT_IS_NULL);
}
ArrayList<Integer> list = new ArrayList<>();
for (WorkUserProject project : workUserProjects) {
list.add(project.getProjectId());
}
return list;
}
}
package cn.wisenergy.service.impl;
import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkUserMapper;
import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.service.WorkUserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chenqi
* @since 2021-01-19
*/
@Service
@Slf4j
public class WorkUserServiceImpl implements WorkUserService {
@Autowired
private WorkUserMapper workUserMapper;
@Override
public WorkUser getById(Integer id) {
log.info("WorkUserServiceImpl[]getById[]input.param.id:{}"+id);
if (null == id) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkUser workUser = workUserMapper.selectById(id);
if (null == workUser) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_NOT_HAVE_USER);
}
return workUser;
}
@Override
public WorkUser getDeptManagerByIds(List<Integer> ids) {
log.info("WorkUserServiceImpl[]getDeptManagerByIds[]input.param.ids:{}" + ids);
if (CollectionUtils.isEmpty(ids)) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
QueryWrapper<WorkUser> wrapper = new QueryWrapper<>();
wrapper.eq("level", 2);
wrapper.in("id",ids);
WorkUser workUser = workUserMapper.selectOne(wrapper);
return workUser;
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.dto.CalendarDto;
import cn.wisenergy.model.dto.SubtotalDto;
import cn.wisenergy.service.WorkCollectService;
import cn.wisenergy.web.admin.controller.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@RestController
@Slf4j
@Api(tags = "小程序工单日历模块")
@RequestMapping(value = "/work/collect")
public class WorkCollectController extends BaseController {
@Autowired
private WorkCollectService workCollectService;
@ApiOperation(value = "日历->月详细", notes = "日历展示", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "workMonth", value = "工单日期(yyyy-MM)", dataType = "String", required = true)
})
@GetMapping(value = "/month")
public Result<List<CalendarDto>> calendarMonth(Integer userId, String workMonth) {
log.info("WorkCollectController[]calendarMonth[]input.param.userId:{},workMonth:{}", userId, workMonth);
Date date = DateUtil.convertStrToDate(workMonth, "yyyy-MM");
List<CalendarDto> calendarDtos = workCollectService.calendarMonth(userId, date);
return getResult( calendarDtos);
}
@ApiOperation(value = "日历->日详细", notes = "某日填报情况", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "workDay", value = "工单日期(yyyy-MM-dd)", dataType = "String", required = true)
})
@GetMapping(value = "/day")
public Result<SubtotalDto> calendarDay(Integer userId, String workDay) {
log.info("WorkCollectController[]calendarDay[]input.param.userId:{},workDay:{}", userId, workDay);
Date date = DateUtil.convertStrToDate(workDay, "yyyy-MM-dd");
SubtotalDto subtotalDto = workCollectService.calendarDay(userId, date);
return getResult(subtotalDto);
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.exception.CustomException;
import cn.wisenergy.common.utils.exception.RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.model.dto.CreateWorkOrderDto;
import cn.wisenergy.model.dto.ExamineGroupbyProjectDto;
import cn.wisenergy.model.dto.ProjectDto;
import cn.wisenergy.model.dto.WorkTimeOrderDto;
import cn.wisenergy.service.*;
import cn.wisenergy.web.admin.controller.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(value = "/work/order")
@Api(tags = "工时模块接口")
public class WorkTimeOrderController extends BaseController {
@Autowired
private WorkTimeOrderService workTimeOrderService;
@Autowired
private WorkProjectService workProjectService;
@Autowired
private WorkUserProjectService workUserProjectService;
@Autowired
private WorkUserDeptService workUserDeptService;
@Autowired
private WorkUserService workUserService;
@ApiOperation(value = "获取某日工单详情", notes = "获取某日工单详情", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户ID", dataType = "int", required = true),
@ApiImplicitParam(name = "workDay", value = "工单日期(yyyy-MM-dd)", dataType = "String", required = true)
})
@GetMapping(value = "/query")
public Result<List<WorkTimeOrderDto>> query(Integer userId, String workDay) {
log.info("WorkOrderController[]query[]input.param.id" + userId, workDay);
if (null == userId || StringUtils.isEmpty(workDay)) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
Date date = DateUtil.convertStrToDate(workDay, "yyyy-MM-dd");
List<WorkTimeOrderDto> dtos = workTimeOrderService.getByDayToDto(userId, date);
return getResult(dtos);
}
@ApiOperation(value = "工时填报", notes = "工时填报", httpMethod = "POST")
@ApiImplicitParam(name = "dto", value = "创建工单dto", dataType = "CreateWorkOrderDto")
@PostMapping(value = "/add")
public Result<List<WorkTimeOrderDto>> add(@RequestBody CreateWorkOrderDto dto) {
log.info("WorkTimeOrderController[]add[]input.param" + dto);
if (null == dto || CollectionUtils.isEmpty(dto.getWorkTimeOrders())) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<WorkTimeOrderDto> workOrderList = workTimeOrderService.add(dto);
return getResult(workOrderList);
}
@ApiOperation(value = "工时驳回重新填报", notes = "工时驳回重新填报", httpMethod = "PUT")
@ApiImplicitParam(name = "dto", value = "创建工单dto", dataType = "CreateWorkOrderDto")
@PutMapping(value = "/update")
public Result<List<WorkTimeOrderDto>> update(@RequestBody CreateWorkOrderDto dto) {
log.info("WorkTimeOrderController[]update[]input.param" + dto);
if (null == dto || CollectionUtils.isEmpty(dto.getWorkTimeOrders())) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<WorkTimeOrderDto> updateData = workTimeOrderService.update(dto);
return getResult(updateData);
}
@ApiOperation(value = "查询待审批", notes = "查询待审批", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true),
@ApiImplicitParam(name = "projectId", value = "项目id,不给就默认项目", dataType = "int"),
@ApiImplicitParam(name = "type", value = "给部门经理:工单类型type(5,6,7)", dataType = "int"),
@ApiImplicitParam(name = "page", value = "PC端当前页", dataType = "int"),
@ApiImplicitParam(name = "size", value = "PC端一页多少条记录", dataType = "int"),
@ApiImplicitParam(name = "status", value = "PC端审批状态", dataType = "int"),
})
@GetMapping(value = "/getExamine")
public Result<List<ExamineGroupbyProjectDto>> getExamine(Integer userId, Integer projectId, Integer type, Integer page, Integer size, Integer status) {
log.info("WorkTimeOrderController[]getExamine[]input.param.userId:{},projectId:{},type:{},page:{},size:{},status:{}" + userId, projectId, type, page, size, status);
if (null == userId) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<ExamineGroupbyProjectDto> examines = workTimeOrderService.getExamine(userId, projectId, type, page, size, status);
return getResult(examines);
}
@ApiOperation(value = "查询用户的所有项目和部门经理", notes = "查询用户的所有项目和部门经理", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true)
@GetMapping(value = "/getproject")
public Result<List<ProjectDto>> getProjectByUserId(Integer userId) {
log.info("WorkTimeOrderController[]getProjectByUserId[]input.param.userId:{}" + userId);
if (null == userId) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<Integer> ids = workUserProjectService.getProjectIdByUserId(userId);
List<ProjectDto> list = workProjectService.getNameById(ids);
Integer deptId = workUserDeptService.getDeptIdByUserId(userId);
List<Integer> idsByDeptId = workUserDeptService.getUserIdsByDeptId(deptId);
WorkUser workUser = workUserService.getDeptManagerByIds(idsByDeptId);
list.stream().forEach(index -> index.setDeptManagerName(workUser.getName()));
return getResult(list);
}
@ApiOperation(value = "单个或批量审批", notes = "单个或批量审批", httpMethod = "GET")
// @ApiImplicitParam(name = "ids", value = "工单id", dataType = "list", required = true)
@ApiImplicitParam(name = "reviewerId", value = "审核人id", dataType = "int", required = true)
@GetMapping(value = "/examins")
public Result<Boolean> examinsByIds(Integer reviewerId, @RequestParam List<Integer> ids) {
log.info("WorkTimeOrderController[]examinsByIds[]input.param.reviewerId:{},ids:{}" + reviewerId, ids);
if (null == reviewerId || CollectionUtils.isEmpty(ids)) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
Boolean aBoolean = workTimeOrderService.examinsByIds(reviewerId, ids);
return getResult(aBoolean);
}
@ApiOperation(value = "工单驳回", notes = "工单驳回", httpMethod = "PUT")
@ApiImplicitParams({
@ApiImplicitParam(name = "reviewerId", value = "审核人id", dataType = "int", required = true),
@ApiImplicitParam(name = "id", value = "工单id", dataType = "int", required = true),
@ApiImplicitParam(name = "reason", value = "驳回理由", dataType = "String", required = true)
})
@PutMapping(value = "/reject")
public Result<Boolean> rejectById(Integer reviewerId, Integer id, String reason) {
log.info("WorkTimeOrderController[]rejectById[]input.param.reviewerId:{},id:{},reason:{}" + reviewerId, id, reason);
if (null == reviewerId || null == id || StringUtils.isEmpty(reason)) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
Boolean aBoolean = workTimeOrderService.rejectById(reviewerId, id, reason);
return getResult(aBoolean);
}
@ApiOperation(value = "查询驳回未提交的", notes = "查询驳回未提交的", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int", required = true)
@GetMapping(value = "/nosubmit")
public Result<List<WorkTimeOrderDto>> rejectNotSubmit(Integer userId) {
log.info("WorkTimeOrderController[]rejectNotSubmit[]input.param.userId:{}" + userId);
if (null == userId) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
List<WorkTimeOrderDto> workTimeOrderDtos = workTimeOrderService.rejectNotSubmit(userId);
return getResult(workTimeOrderDtos);
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.exception.CustomException;
import cn.wisenergy.common.utils.exception.RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.service.WorkUserService;
import cn.wisenergy.web.admin.controller.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@RestController
@Api(tags = "用户模块")
@Slf4j
public class WorkUserController extends BaseController {
@Autowired
private WorkUserService workUserService;
@ApiOperation(value = "根据id获取用户信息", notes = "根据id获取用户信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "用户id", dataType = "int", required = true)
@GetMapping(value = "/getUserInfo")
public Result<WorkUser> getUserInfo(Integer id) {
log.info("UserController[]getUserInfo[]input.param.id" + id);
if (null == id) {
throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
}
WorkUser workUser = workUserService.getById(id);
return getResult(workUser);
}
}
package cn.wisenergy.web.admin.controller.common;
import cn.wisenergy.common.utils.exception.*;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* 控制器基类
*
* @author wyy
* @date 2019年08月15日
*/
public abstract class BaseController {
private static final long serialVersionUID = -6344078923170236539L;
protected Logger log = LoggerFactory.getLogger(this.getClass());
/**
* 应用接口异常处理
*
* @param response Response相应对象
* @param ex
*/
@ResponseBody
@ExceptionHandler(Exception.class)
public void handleException(HttpServletResponse response, Exception ex) {
Class eClass = ex.getClass();
Result<Object> result = new Result<>();
result.setResult(Result.RESULT_FLG.FAIL.getValue());
if (!eClass.equals(BaseCustomException.class)) {
log.error(ExceptionUtils.getStackTrace(ex));
}
//以下异常中,除注释过的,其他异常可不关注
if (eClass.equals(MissingServletRequestParameterException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.MIS_REQ_PARAM, result);
} else if (eClass.equals(TypeMismatchException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.MIS_REQ_PARAM, result);
} else if (eClass.equals(HttpMessageNotReadableException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.MIS_REQ_PARAM, result);
} else if (eClass.equals(HttpRequestMethodNotSupportedException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.METHOD_NOT_SUPPORTED, result);
} else if (eClass.equals(HttpMediaTypeNotAcceptableException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.MEDIA_TYPE_NOT_ACCEPT, result);
} else if (eClass.equals(HttpMediaTypeNotSupportedException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.MEDIA_TYPE_NOT_SUPPORTED, result);
} else if (eClass.equals(ConversionNotSupportedException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.SERVER_ERROR, result);
} else if (eClass.equals(HttpMessageNotWritableException.class)) {
addResCodeToMap(BASE_RESP_CODE_ENUM.SERVER_ERROR, result);
} else if (eClass.equals(BaseCustomException.class)) { //系统业务异常
addExceptionToMap((BaseCustomException) ex, result);
} else if (eClass.equals(CustomException.class)) { //系统业务异常
CustomException ce = (CustomException) ex;
addExceptionToMap(new CustomException(ce.getErrorCode(), ce.getMessage()), result);
} else {
addResCodeToMap(BASE_RESP_CODE_ENUM.SERVER_ERROR, result);
}
// 错误相应编码回写
PrintWriter writer = null;
try {
response.setContentType("application/json; charset=UTF-8");
writer = response.getWriter();
writer.write(JSONObject.fromObject(result).toString());
writer.flush();
} catch (Exception e) {
IOUtils.closeQuietly(writer);
log.error("接口异常:{}", ExceptionUtils.getFullStackTrace(e));
}
}
/**
* 添加系统异常信息到map中
*
* @param responseCodeEnum 错误响应编码枚举类对象
* @param result 响应错误编码集合
*/
protected void addResCodeToMap(BASE_RESP_CODE_ENUM responseCodeEnum, Result<Object> result) {
result.setErrorCode(responseCodeEnum.getCode());
result.setErrorMsg(responseCodeEnum.getMsg());
}
/**
* 添加业务异常信息到map中
*
* @param responseCodeEnum 错误响应编码枚举类对象
* @param result 响应错误编码集合
*/
protected void addResCodeToMap(RESP_CODE_ENUM responseCodeEnum, Result<Object> result) {
result.setErrorCode(responseCodeEnum.getCode());
result.setErrorMsg(responseCodeEnum.getMsg());
}
/**
* 添加异常信息到map中
*
* @param baseCustomException 接口异常类
* @param result 接口异常集合
*/
protected void addExceptionToMap(BaseCustomException baseCustomException, Result<Object> result) {
result.setErrorCode(baseCustomException.getErrorCode());
result.setErrorMsg(baseCustomException.getErrorMsg());
}
/**
* 添加异常信息到map中
*
* @param customException 接口异常类
* @param result 接口异常集合
*/
protected void addExceptionToMap(CustomException customException, Result<Object> result) {
result.setErrorCode(customException.getErrorCode());
result.setErrorMsg(customException.getErrorMsg());
}
/**
* 添加数据到结果对象中
*
* @param data 封装接口集合参数
* @return
*/
public Result getResult(Object data) {
Result result = new Result();
result.setResult(Result.RESULT_FLG.SUCCESS.getValue());
result.setData(data);
return result;
}
}
package cn.wisenergy.web.config.auto;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.mapper.WorkCollectMapper;
import cn.wisenergy.mapper.WorkSbumitAdoptMapper;
import cn.wisenergy.mapper.WorkTimeOrderMapper;
import cn.wisenergy.model.app.WorkCollect;
import cn.wisenergy.model.app.WorkSbumitAdopt;
import cn.wisenergy.model.app.WorkTimeOrder;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 自动审批定时器
*/
@Slf4j
@Configuration //1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class Examin {
@Autowired
private WorkTimeOrderMapper workTimeOrderMapper;
@Autowired
private WorkCollectMapper workCollectMapper;
@Autowired
private WorkSbumitAdoptMapper workSbumitAdoptMapper;
@Scheduled(cron = "0 0 0 * * ?")
public void autoExamin() {
log.info("admin[]config[]auto[]Examin[]autoExamin");
WorkSbumitAdopt workSbumitAdopt = workSbumitAdoptMapper.selectById(1);
Integer autoAdopt = workSbumitAdopt.getAutoAdopt();
Date yesterdayDate = getAutoExaminDay(autoAdopt);
Date now = DateUtil.getToday();
UpdateWrapper<WorkTimeOrder> WTOwrapper = new UpdateWrapper<>();
WTOwrapper.eq("status", 1);
WTOwrapper.le("work_day", yesterdayDate);
WorkTimeOrder workTimeOrder = new WorkTimeOrder();
workTimeOrder.setStatus(5);
workTimeOrder.setModifyTime(now);
int wtoRow = workTimeOrderMapper.update(workTimeOrder, WTOwrapper);
System.out.println("一共审核:" + wtoRow + "条工单");
WorkCollect workCollect = new WorkCollect();
UpdateWrapper<WorkCollect> wcw = new UpdateWrapper<>();
wcw.eq("status", 1);
wcw.le("work_day", yesterdayDate);
workCollect.setStatus(2);
workCollect.setModifyTime(now);
int wcRow = workCollectMapper.update(workCollect, wcw);
System.out.println("一共审核:" + wcRow + "条工单");
}
public static Date getAutoExaminDay(Integer day) {
day = -(day + 1);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.DATE, -2);
Date start = c.getTime();
String qyt= format.format(start);
System.out.println(qyt);
Date date = DateUtil.convertStrToDate(qyt, "yyyy-MM-dd");
return date;
}
}
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