薪酬版本记录
This commit is contained in:
parent
91f1fda342
commit
c8d056ee2f
|
|
@ -0,0 +1,65 @@
|
|||
package com.engine.salary.mapper.sys;
|
||||
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SalarySysConfMapper {
|
||||
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalarySysConfPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalarySysConfPO> listSome(SalarySysConfPO SalarySysConfPO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
SalarySysConfPO getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param SalarySysConfPO 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(SalarySysConfPO SalarySysConfPO);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param SalarySysConfPO 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(SalarySysConfPO SalarySysConfPO);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param SalarySysConfPO 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(SalarySysConfPO SalarySysConfPO);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param salarySysConf 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(SalarySysConfPO salarySysConf);
|
||||
|
||||
SalarySysConfPO getOneByCode(String confKey);
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
<?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="com.engine.salary.mapper.sys.SalarySysConfMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="conf_key" property="confKey"/>
|
||||
<result column="conf_value" property="confValue"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="module" property="module"/>
|
||||
<result column="order_weight" property="orderWeight"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.conf_key
|
||||
, t.conf_value
|
||||
, t.title
|
||||
, t.module
|
||||
, t.order_weight
|
||||
, t.description
|
||||
, t.delete_type
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sys_conf t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sys_conf t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sys_conf t
|
||||
WHERE delete_type = 0
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="confKey != null">
|
||||
AND conf_key = #{confKey}
|
||||
</if>
|
||||
<if test="confValue != null">
|
||||
AND conf_value = #{confValue}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
AND title = #{title}
|
||||
</if>
|
||||
<if test="module != null">
|
||||
AND module = #{module}
|
||||
</if>
|
||||
<if test="orderWeight != null">
|
||||
AND order_weight = #{orderWeight}
|
||||
</if>
|
||||
<if test="description != null">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
ORDER BY order_weight DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
INSERT INTO hrsa_salary_sys_conf
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="confKey != null">
|
||||
conf_key,
|
||||
</if>
|
||||
<if test="confValue != null">
|
||||
conf_value,
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title,
|
||||
</if>
|
||||
<if test="module != null">
|
||||
module,
|
||||
</if>
|
||||
<if test="orderWeight != null">
|
||||
order_weight,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="confKey != null">
|
||||
#{confKey},
|
||||
</if>
|
||||
<if test="confValue != null">
|
||||
#{confValue},
|
||||
</if>
|
||||
<if test="title != null">
|
||||
#{title},
|
||||
</if>
|
||||
<if test="module != null">
|
||||
#{module},
|
||||
</if>
|
||||
<if test="orderWeight != null">
|
||||
#{orderWeight},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
UPDATE hrsa_salary_sys_conf
|
||||
<set>
|
||||
conf_key=#{confKey},
|
||||
conf_value=#{confValue},
|
||||
title=#{title},
|
||||
module=#{module},
|
||||
order_weight=#{orderWeight},
|
||||
description=#{description},
|
||||
delete_type=#{deleteType},
|
||||
create_time=#{createTime},
|
||||
update_time=#{updateTime},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
UPDATE hrsa_salary_sys_conf
|
||||
<set>
|
||||
<if test="confKey != null">
|
||||
conf_key=#{confKey},
|
||||
</if>
|
||||
<if test="confValue != null">
|
||||
conf_value=#{confValue},
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title=#{title},
|
||||
</if>
|
||||
<if test="module != null">
|
||||
module=#{module},
|
||||
</if>
|
||||
<if test="orderWeight != null">
|
||||
order_weight=#{orderWeight},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description=#{description},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
UPDATE hrsa_salary_sys_conf
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getOneByCode" resultMap="BaseResultMap" parameterType="com.engine.salary.sys.entity.po.SalarySysConfPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sys_conf t
|
||||
WHERE delete_type = 0
|
||||
AND conf_key = #{confKey}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -74,11 +74,8 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user);
|
||||
}
|
||||
|
||||
//
|
||||
// private LoggerTemplate salaryAcctRecordLoggerTemplate;
|
||||
//
|
||||
private TaxDeclarationService getTaxDeclarationService(User user) {
|
||||
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
|
|
@ -275,7 +272,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
* 保存之前检查一下是否可以新建核算
|
||||
*
|
||||
* @param saveParam
|
||||
|
||||
*/
|
||||
private void checkBeforeSave(SalaryAcctRecordSaveParam saveParam) {
|
||||
|
||||
|
|
@ -300,7 +296,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
// 如果某个月(薪资所属月)还未申报,不可以新建之后月份的薪资核算
|
||||
SalaryAcctRecordPO notDeclaredSalaryAcctRecordPO = salaryAcctRecords.stream()
|
||||
.filter(e -> !Objects.equals(e.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())
|
||||
&& e.getSalaryMonth().before(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))) )
|
||||
&& e.getSalaryMonth().before(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
if (Objects.nonNull(notDeclaredSalaryAcctRecordPO)) {
|
||||
|
|
@ -428,10 +424,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
// 生成工资单
|
||||
getSalarySendService(user).generateSalaryBill(salaryAcctRecordId);
|
||||
|
||||
//todo 薪酬核算完成,将数据存储到非加密表,删除人员信息,补充:分部、部门、岗位等其他字段,供数据中心引用
|
||||
|
||||
|
||||
|
||||
// 记录日志
|
||||
// String targetName = getLogTargetNameById(salaryAcctRecordId);
|
||||
// LoggerContext<SalaryAcctRecordPO> loggerContext = new LoggerContext<>();
|
||||
|
|
@ -553,7 +545,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
//开启分权
|
||||
if(openDevolution){
|
||||
if (openDevolution) {
|
||||
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByAdmin();
|
||||
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
||||
return salaryAcctRecords.stream().filter(record -> salarySobIds.contains(record.getSalarySobId())).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.engine.salary.sys.entity.po;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalarySysConfPO {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 标识
|
||||
*/
|
||||
private String confKey;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private String confValue;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 所属模块
|
||||
*/
|
||||
private String module;
|
||||
/**
|
||||
* 排序权重
|
||||
*/
|
||||
private Integer orderWeight;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 是否已删除,0否,1是
|
||||
*/
|
||||
private Integer deleteType;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 修改时间 */
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.engine.salary.sys.service.impl;
|
||||
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.weaverboot.frame.ioc.anno.classAnno.WeaSysInitComponent;
|
||||
import com.weaverboot.frame.ioc.anno.methodAnno.WeaSysInit;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@WeaSysInitComponent("initSalary")
|
||||
public class InitServiceImpl {
|
||||
|
||||
private SalarySysConfMapper getSalarySysConfMapper() {
|
||||
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
||||
}
|
||||
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
@WeaSysInit(order = 1, description = "升级版本")
|
||||
public void init() {
|
||||
String version = baseBean.getPropValue("hrmSalary", "version");
|
||||
Date date = new Date();
|
||||
|
||||
|
||||
//升级版本号
|
||||
//当前版本
|
||||
SalarySysConfPO currentVersion = getSalarySysConfMapper().getOneByCode("currentVersion");
|
||||
//前一个版本
|
||||
SalarySysConfPO previousVersion = getSalarySysConfMapper().getOneByCode("previousVersion");
|
||||
if (currentVersion == null) {
|
||||
//初始化版本
|
||||
SalarySysConfPO current = SalarySysConfPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.confKey("currentVersion")
|
||||
.confValue(version)
|
||||
.title("当前版本")
|
||||
.module("basic")
|
||||
.createTime(date)
|
||||
.updateTime(date)
|
||||
.deleteType(0).build();
|
||||
getSalarySysConfMapper().insertIgnoreNull(current);
|
||||
} else {
|
||||
//版本不一样
|
||||
if (!StringUtils.equals(version, currentVersion.getConfValue())) {
|
||||
//生成历史版本记录
|
||||
SalarySysConfPO previous = SalarySysConfPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.confKey("previousVersion")
|
||||
.confValue(currentVersion.getConfValue())
|
||||
.title("上一个版本")
|
||||
.module("basic")
|
||||
.createTime(date)
|
||||
.updateTime(date)
|
||||
.deleteType(0)
|
||||
.build();
|
||||
getSalarySysConfMapper().insertIgnoreNull(previous);
|
||||
|
||||
//更新当前版本
|
||||
currentVersion.setConfValue(version);
|
||||
currentVersion.setUpdateTime(date);
|
||||
getSalarySysConfMapper().updateIgnoreNull(currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue