Commit 199b578f by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!268
parents 117b7139 12ab9f41
package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @author Tang 2020-06-23
*/
@Data
@Builder
@Table(name = "kqgl_asso_leave_rules_t")
@ApiModel("假期规则")
public class KqglAssoLeaveRulesT extends Model<KqglAssoLeaveRulesT> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "假期规则编号 假期规则编号", example = "101")
private Integer id;
@ApiModelProperty(value = "假期名称 ", example = "假期名称")
private String name;
@ApiModelProperty(value = "请假单位 1:按天请假;2:按半天;3:按小时", example = "101")
private Integer company;
@ApiModelProperty(value = "假期类型 1:系统项;2:自定义项", example = "101")
private Integer leaveType;
@ApiModelProperty(value = "适用范围 0:全公司 >0:考勤组id", example = "101")
private Integer apply;
@ApiModelProperty(value = "是否开启 0:否;1:是 [只针对系统项]", example = "101")
private Integer isOpen;
@ApiModelProperty(value = "假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)", example = "101")
private Integer leaveBalance;
@ApiModelProperty(value = "1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假 1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假", example = "101")
private Integer rulesType;
}
\ No newline at end of file
package cn.timer.api.controller; package cn.timer.api.controller;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -33,7 +34,9 @@ import cn.hutool.core.util.StrUtil; ...@@ -33,7 +34,9 @@ import cn.hutool.core.util.StrUtil;
import cn.timer.api.aspect.lang.annotation.Log; import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType; import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.jxgl.JxglBasicSetting; import cn.timer.api.bean.jxgl.JxglBasicSetting;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules; import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT;
import cn.timer.api.bean.qyxx.CmsContent; import cn.timer.api.bean.qyxx.CmsContent;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso; import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin; import cn.timer.api.bean.qyzx.QyzxEmpLogin;
...@@ -561,15 +564,17 @@ public class LoginController { ...@@ -561,15 +564,17 @@ public class LoginController {
// *****************************考勤假期初始化 // *****************************考勤假期初始化
// 获取模板数据 // 获取模板数据
List<KqglAssoLeaveRules> ruless = new LambdaQueryChainWrapper<KqglAssoLeaveRules>(kqglassoleaverulesmapper) // List<KqglAssoLeaveRules> ruless = new LambdaQueryChainWrapper<KqglAssoLeaveRules>(kqglassoleaverulesmapper)
.eq(KqglAssoLeaveRules::getOrgCode, 0).list(); // .eq(KqglAssoLeaveRules::getOrgCode, 0).list();
List<KqglAssoLeaveRulesT> ruless = KqglAssoLeaveRulesT.builder().build().selectAll();
// 查询当前公司是否已初始化 // 查询当前公司是否已初始化
KqglAssoLeaveRules rule = kqglassoleaverulesmapper.selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda() KqglAssoLeaveRules rule = kqglassoleaverulesmapper.selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda()
.eq(KqglAssoLeaveRules::getOrgCode, qyzxEntInfoM.getId()).eq(KqglAssoLeaveRules::getLeaveType, 1) .eq(KqglAssoLeaveRules::getOrgCode, qyzxEntInfoM.getId()).eq(KqglAssoLeaveRules::getLeaveType, 1)
.last("LIMIT 1")); .last("LIMIT 1"));
if (rule == null) { if (rule == null) {
List<KqglAssoLeaveRules> rullist = new ArrayList<KqglAssoLeaveRules>(); List<KqglAssoLeaveRules> rullist = new ArrayList<KqglAssoLeaveRules>();
for (KqglAssoLeaveRules rul : ruless) {
for (KqglAssoLeaveRulesT rul : ruless) {
KqglAssoLeaveRules vice = KqglAssoLeaveRules.builder().name(rul.getName()).company(rul.getCompany()) KqglAssoLeaveRules vice = KqglAssoLeaveRules.builder().name(rul.getName()).company(rul.getCompany())
.leaveType(rul.getLeaveType()).apply(rul.getApply()).createTime(new Date().getTime()) .leaveType(rul.getLeaveType()).apply(rul.getApply()).createTime(new Date().getTime())
.createUserid(999).orgCode(qyzxEntInfoM.getId()).isOpen(rul.getIsOpen()) .createUserid(999).orgCode(qyzxEntInfoM.getId()).isOpen(rul.getIsOpen())
...@@ -583,6 +588,20 @@ public class LoginController { ...@@ -583,6 +588,20 @@ public class LoginController {
} else { } else {
System.out.println("重复初始化数据!"); System.out.println("重复初始化数据!");
} }
//假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, qyId));
for(KqglAssoLeaveRules r : rul) {
if(r.getLeaveBalance() == 0) {
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(login.getId()).balanceDays(-1).modifyUserid(login.getId()).modifyTimer(current_time).orgCode(qyId).build().insert();
}else {
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(login.getId()).balanceDays(0.0).modifyUserid(login.getId()).modifyTimer(current_time).orgCode(qyId).build().insert();
}
}
// 绩效设置初始化 // 绩效设置初始化
JxglBasicSetting bS = jxglService.selectAT(qyId); JxglBasicSetting bS = jxglService.selectAT(qyId);
......
package cn.timer.api.dao.kqmk;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT;
/**
* 假期规则
* @author Tang 2020-06-23
*/
@Repository
public interface KqglAssoLeaveRulesTMapper extends BaseMapper<KqglAssoLeaveRulesT> {
}
<?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.timer.api.dao.kqmk.KqglAssoLeaveRulesTMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT" >
<id column="id" property="id" />
<result column="name" property="name" />
<result column="company" property="company" />
<result column="leave_type" property="leaveType" />
<result column="apply" property="apply" />
<result column="is_open" property="isOpen" />
<result column="leave_balance" property="leaveBalance" />
<result column="rules_type" property="rulesType" />
</resultMap>
<sql id="Base_Column_List">
id,
name,
company,
leave_type,
apply,
is_open,
leave_balance,
rules_type
</sql>
<sql id="Base_Column_List_Alias">
id KqglAssoLeaveRulesT_id,
name KqglAssoLeaveRulesT_name,
company KqglAssoLeaveRulesT_company,
leave_type KqglAssoLeaveRulesT_leave_type,
apply KqglAssoLeaveRulesT_apply,
is_open KqglAssoLeaveRulesT_is_open,
leave_balance KqglAssoLeaveRulesT_leave_balance,
rules_type KqglAssoLeaveRulesT_rules_type
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT">
INSERT INTO kqgl_asso_leave_rules_t
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != name'>
name,
</if>
<if test ='null != company'>
company,
</if>
<if test ='null != leaveType'>
leave_type,
</if>
<if test ='null != apply'>
apply,
</if>
<if test ='null != isOpen'>
is_open,
</if>
<if test ='null != leaveBalance'>
leave_balance,
</if>
<if test ='null != rulesType'>
rules_type
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != name'>
#{name},
</if>
<if test ='null != company'>
#{company},
</if>
<if test ='null != leaveType'>
#{leaveType},
</if>
<if test ='null != apply'>
#{apply},
</if>
<if test ='null != isOpen'>
#{isOpen},
</if>
<if test ='null != leaveBalance'>
#{leaveBalance},
</if>
<if test ='null != rulesType'>
#{rulesType}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_asso_leave_rules_t
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT">
UPDATE kqgl_asso_leave_rules_t
<set>
<if test ='null != name'>name = #{name},</if>
<if test ='null != company'>company = #{company},</if>
<if test ='null != leaveType'>leave_type = #{leaveType},</if>
<if test ='null != apply'>apply = #{apply},</if>
<if test ='null != isOpen'>is_open = #{isOpen},</if>
<if test ='null != leaveBalance'>leave_balance = #{leaveBalance},</if>
<if test ='null != rulesType'>rules_type = #{rulesType}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_rules_t
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_rules_t
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_asso_leave_rules_t
</select>
-->
</mapper>
\ No newline at end of file
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