累计bug

This commit is contained in:
钱涛 2022-03-11 16:19:47 +08:00
parent 692a57ae63
commit 1c46bd28f7
19 changed files with 1171 additions and 26 deletions

View File

@ -60,18 +60,18 @@ public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
queryParam.setEmployeeId(po.getEmployeeId());
String fields = " t1.id," +
" t1.declare_month," +
" t1.employee_id," +
" t2.name AS tax_agent_name," +
" t1.declare_month as declareMonth," +
" t1.employee_id as employeeId," +
" t2.name AS taxAgentName," +
" e.lastname as username," +
" d.departmentname AS departmentName," +
" e.mobile," +
" e.workcode as job_num," +
" e.workcode as jobNum," +
" e.companystartdate as hiredate," +
" t1.business_healthy_insurance," +
" t1.tax_delay_endowment_insurance," +
" t1.other_deduction," +
" t1.deduction_allowed_donation";
" t1.business_healthy_insurance as businessHealthyInsurance," +
" t1.tax_delay_endowment_insurance as taxDelayEndowmentInsurance," +
" t1.other_deduction as otherDeduction," +
" t1.deduction_allowed_donation as deductionAllowedDonation";
String fromSql = " FROM" +
" hrsa_other_deduction t1" +

View File

@ -33,18 +33,18 @@ public class OtherDeductionListCmd extends AbstractCommonCommand<Map<String, Obj
public Map<String, Object> execute(CommandContext commandContext) {
String fields = " t1.id," +
" t1.declare_month," +
" t1.employee_id," +
" t2.name AS tax_agent_name," +
" t1.declare_month as declareMonth," +
" t1.employee_id as employeeId," +
" t2.name AS taxAgentName," +
" e.lastname as username," +
" d.departmentname AS departmentName," +
" e.mobile," +
" e.workcode as job_num," +
" e.workcode as jobNum," +
" e.companystartdate as hiredate," +
" t1.business_healthy_insurance," +
" t1.tax_delay_endowment_insurance," +
" t1.other_deduction," +
" t1.deduction_allowed_donation";
" t1.business_healthy_insurance as businessHealthyInsurance," +
" t1.tax_delay_endowment_insurance as taxDelayEndowmentInsurance," +
" t1.other_deduction as otherDeduction," +
" t1.deduction_allowed_donation as deductionAllowedDonation";
String fromSql = " FROM" +
" hrsa_other_deduction t1" +

View File

@ -14,15 +14,15 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
//@ApiModel("员工基本信息")
////员工基本信息")
public class DataCollectionEmployee {
// @ApiModelProperty("员工id")
// //员工id")
private Long employeeId;
// @ApiModelProperty("姓名")
// //姓名")
private String username;
// @ApiModelProperty("部门")
// //部门")
private String deparmentName;
}

View File

@ -0,0 +1,27 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 数据采集-考勤模块字段参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendModuleSettingFieldParam {
//字段id
private Long id;
//是否选中
private Boolean checked;
}

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
import java.util.Collection;
/**
* @Description: 数据采集-考勤引用数据导出模板参数
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AttendQuoteDataExportTemplateParam {
//薪资所属月
private YearMonth salaryYearMonth;
//薪资账套id
private Long salarySobId;
//主键id
private Collection<Long> ids;
}

View File

@ -0,0 +1,40 @@
package com.engine.salary.entity.datacollection.param;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
/**
* @Description: 数据采集-考勤引用数据
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用数据查询参数")
public class AttendQuoteDataQueryParam {
//主键id")
private Collection<Long> ids;
@JsonIgnore
private Long id;
//关键字姓名/部门名称/手机号/工号")
private String keyword;
//是否仅查看异动人员")
private Boolean isViewChangeEmployee;
//考勤引用表的主键id(获取明细)")
private Long attendQuoteId;
//
// //人员信息表的主键id")
// private Long employeeId;
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 数据采集-考勤引用数据
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用数据保存参数")
public class AttendQuoteDataSaveParam {
//主键")
private Long id;
//人员信息表的主键id")
private Long employeeId;
//考勤引用表的主键id")
private Long attendQuoteId;
}

View File

@ -0,0 +1,43 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
/**
* @Description: 数据采集-考勤引用数据
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用数据同步参数")
public class AttendQuoteDataSyncParam {
//薪资所属月")
private String salaryYearMonth;
//关联账套id")
private Long salarySobId;
//账套外人员主键id")
private Collection<Long> employeeIds;
//备注")
private String description;
// public static WeaResult<String> checkParam(AttendQuoteDataSyncParam saveParam, Long employeeId, String tenantKey) {
// if (StringUtils.isEmpty(saveParam.getSalaryYearMonth())) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100294, "薪资所属月必传"));
// }
// if (saveParam.getSalarySobId() == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100295, "薪资账套必传"));
// }
// return WeaResult.success(StringUtils.EMPTY);
// }
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
/**
* @Description: 数据采集-考勤引用字段
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用字段查询参数")
public class AttendQuoteFieldQueryParam {
private Collection<Long> ids;
private Long id;
//字段名称")
private String fieldName;
}

View File

@ -0,0 +1,51 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.enums.datacollection.AttendQuoteFieldTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 数据采集-考勤引用字段
* @Author: wangxiangzhong
* @Date: 2021-11-17 14:37
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用字段保存参数")
public class AttendQuoteFieldSaveParam {
//主键")
private Long id;
//字段名称")
private String fieldName;
//字段类型1数值2文本")
private AttendQuoteFieldTypeEnum fieldType;
//是否启用falsetrue")
private Boolean enableStatus;
//备注")
private String description;
// public static WeaResult<String> checkParam(AttendQuoteFieldSaveParam saveParam, Long employeeId, String tenantKey) {
// if (StringUtils.isEmpty(saveParam.getFieldName())) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100296, "字段名称必填"));
// }
// if (saveParam.getFieldType() == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100297, "字段类型必传"));
// }
// if (saveParam.getEnableStatus() == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100298, "是否启用必传"));
// }
// if (saveParam.getEnableStatus().equals(0) && saveParam.getEnableStatus().equals(1)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100299, "是否启用参数有误"));
// }
// return WeaResult.success(StringUtils.EMPTY);
// }
}

View File

@ -0,0 +1,29 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 数据采集-考勤引用字段设置
* @Author: wangxiangzhong
* @Date: 2021-12-01 13:43
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用字段设置查询参数")
public class AttendQuoteFieldSettingQueryParam {
//考勤字段来源类型QUOTE引用IMPORT导入")
private AttendQuoteSourceTypeEnum sourceType;
//关键字")
private String keyword;
//是否只显示已选中字段")
private Boolean isViewChecked;
}

View File

@ -0,0 +1,23 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description: 数据采集-考勤引用字段设置
* @Author: wangxiangzhong
* @Date: 2021-12-01 13:43
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用字段设置恢复默认设置参数")
public class AttendQuoteFieldSettingRecoverParam {
//考勤字段来源类型QUOTE引用IMPORT导入")
private AttendQuoteSourceTypeEnum sourceType;
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.datacollection.param;
import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Description: 数据采集-考勤引用字段设置
* @Author: wangxiangzhong
* @Date: 2021-12-01 13:43
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-考勤引用字段设置保存参数")
public class AttendQuoteFieldSettingSaveParam {
//考勤字段来源类型QUOTE引用IMPORT导入")
private AttendQuoteSourceTypeEnum sourceType;
//当前设置内容")
private List<AttendModuleSettingFieldParam> currentSettingFields;
}

View File

@ -21,12 +21,12 @@ public class TaxRateSaveParam {
/**
* 基本信息不允许为空
*/
// @ApiModelProperty("基本信息")
// //基本信息")
private TaxRateBaseSaveParam taxRateBatch;
/**
* 详细设置不允许为空
*/
// @ApiModelProperty("详细设置")
// //详细设置")
private List<TaxRateDetailSaveParam> taxRateRecords;
}

View File

@ -16,16 +16,16 @@ import java.util.List;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
//@ApiModel("税率表税表")
////税率表税表")
public class TaxRateFormVo {
// @ApiModelProperty("是否是系统默认。CUSTOM自定义、SYSTEM系统")
// //是否是系统默认CUSTOM自定义SYSTEM系统")
private SalarySystemTypeEnum systemType;
// @ApiModelProperty("基本信息")
// //基本信息")
private TaxRateBase taxRateBatch;
// @ApiModelProperty("详细设置")
// //详细设置")
private List<TaxRateDetail> taxRateRecords;
}

View File

@ -0,0 +1,79 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO;
import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam;
import com.engine.salary.entity.datacollection.po.AttendQuotePO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@Mapper
public interface AttendQuoteMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<AttendQuotePO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
AttendQuotePO getById(Long id);
/**
* 新增忽略null字段
*
* @param AttendQuotePO 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(AttendQuotePO AttendQuotePO);
/**
* 修改修改所有字段
*
* @param AttendQuotePO 修改的记录
* @return 返回影响行数
*/
int update(AttendQuotePO AttendQuotePO);
/**
* 修改忽略null字段
*
* @param AttendQuotePO 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(AttendQuotePO AttendQuotePO);
/**
* 删除记录
*
* @param AttendQuotePO 待删除的记录
* @return 返回影响行数
*/
int delete(AttendQuotePO AttendQuotePO);
/**
* 查询数据采集-考勤引用列表
* @param param
* @return
*/
List<AttendQuoteListDTO> list(@Param("param") AttendQuoteQueryParam param);
/**
* 批量删除数据采集-考勤引用
* @param ids
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
}

View File

@ -0,0 +1,300 @@
<?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.datacollection.AttendQuoteMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.AttendQuotePO">
<result column="id" property="id"/>
<result column="salary_year_month" property="salaryYearMonth"/>
<result column="year" property="year"/>
<result column="month" property="month"/>
<result column="salary_sob_id" property="salarySobId"/>
<result column="source_type" property="sourceType"/>
<result column="salary_accounting_status" property="salaryAccountingStatus"/>
<result column="attend_cycle" property="attendCycle"/>
<result column="salary_cycle" property="salaryCycle"/>
<result column="description" property="description"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.salary_year_month
, t.year
, t.month
, t.salary_sob_id
, t.source_type
, t.salary_accounting_status
, t.attend_cycle
, t.salary_cycle
, t.description
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_attend_quote t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_attend_quote t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AttendQuotePO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_attend_quote
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="salaryYearMonth != null">
salary_year_month,
</if>
<if test="year != null">
year,
</if>
<if test="month != null">
month,
</if>
<if test="salarySobId != null">
salary_sob_id,
</if>
<if test="sourceType != null">
source_type,
</if>
<if test="salaryAccountingStatus != null">
salary_accounting_status,
</if>
<if test="attendCycle != null">
attend_cycle,
</if>
<if test="salaryCycle != null">
salary_cycle,
</if>
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="salaryYearMonth != null">
#{salaryYearMonth},
</if>
<if test="year != null">
#{year},
</if>
<if test="month != null">
#{month},
</if>
<if test="salarySobId != null">
#{salarySobId},
</if>
<if test="sourceType != null">
#{sourceType},
</if>
<if test="salaryAccountingStatus != null">
#{salaryAccountingStatus},
</if>
<if test="attendCycle != null">
#{attendCycle},
</if>
<if test="salaryCycle != null">
#{salaryCycle},
</if>
<if test="description != null">
#{description},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.AttendQuotePO">
UPDATE hrsa_attend_quote
<set>
salary_year_month=#{salaryYearMonth},
year=#{year},
month=#{month},
salary_sob_id=#{salarySobId},
source_type=#{sourceType},
salary_accounting_status=#{salaryAccountingStatus},
attend_cycle=#{attendCycle},
salary_cycle=#{salaryCycle},
description=#{description},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.AttendQuotePO">
UPDATE hrsa_attend_quote
<set>
<if test="salaryYearMonth != null">
salary_year_month=#{salaryYearMonth},
</if>
<if test="year != null">
year=#{year},
</if>
<if test="month != null">
month=#{month},
</if>
<if test="salarySobId != null">
salary_sob_id=#{salarySobId},
</if>
<if test="sourceType != null">
source_type=#{sourceType},
</if>
<if test="salaryAccountingStatus != null">
salary_accounting_status=#{salaryAccountingStatus},
</if>
<if test="attendCycle != null">
attend_cycle=#{attendCycle},
</if>
<if test="salaryCycle != null">
salary_cycle=#{salaryCycle},
</if>
<if test="description != null">
description=#{description},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.AttendQuotePO">
UPDATE hrsa_attend_quote
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<sql id="attendQuoteColumn">
t1.id,
t1.salary_year_month,
t1.salary_sob_id,
t2.name AS salary_sob_name,
t1.source_type,
t1.attend_cycle,
t1.salary_cycle,
t1.description,
e.lastname AS creator,
t1.salary_accounting_status
</sql>
<sql id="paramSql">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 薪资所属月 -->
<if test="param.salaryYearMonth != null">
<if test="param.salaryYearMonth.size() == 1">
AND t1.salary_year_month = #{param.salaryYearMonth[0]}
</if>
<if test="param.salaryYearMonth.size() == 2">
AND (t1.salary_year_month BETWEEN #{param.salaryYearMonth[0]} AND #{param.salaryYearMonth[1]})
</if>
</if>
</sql>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO">
SELECT
<include refid="attendQuoteColumn"/>
FROM
hrsa_attend_quote t1
LEFT JOIN hrsa_salary_sob t2 ON t1.salary_sob_id = t2.id
LEFT JOIN hrmresource e ON e.id = t1.creator
WHERE
t1.delete_type = 0 AND t2.delete_type = 0
<include refid="paramSql"/>
ORDER BY t1.id DESC
</select>
<update id="deleteByIds">
UPDATE hrsa_attend_quote
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,83 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import java.util.Map;
/**
* 数据采集-考勤引用字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface AttendQuoteFieldService {
/**
* 数据采集-考勤引用字段列表
* @param queryParam
* @return
*/
Map<String, Object> list(AttendQuoteFieldQueryParam queryParam);
// /**
// * 获取数据采集-考勤引用字段表单
// * @param id
// * @param employeeId
// * @param tenantKey
// * @return
// */
// WeaForm getFrom(Long id, Long employeeId, String tenantKey);
//
// /**
// * 新建数据采集-考勤引用字段
// * @param saveParam
// * @param employeeId
// * @param tenantKey
// * @return
// */
// WeaResult<String> save(AttendQuoteFieldSaveParam saveParam, Long employeeId, String tenantKey);
//
// /**
// * 编辑数据采集-考勤引用字段
// * @param saveParam
// * @param employeeId
// * @param tenantKey
// * @return
// */
// WeaResult<String> update(AttendQuoteFieldSaveParam saveParam, Long employeeId, String tenantKey);
//
// /**
// * 删除数据采集-考勤引用字段
// * @param ids
// * @param employeeId
// * @param tenantKey
// * @return
// */
// WeaResult<String> delete(Collection<Long> ids, Long employeeId, String tenantKey);
//
// /**
// * 启用/停用自定义字段
// * @param id
// * @param enableStatus
// * @return
// */
// WeaResult<String> updateEnableStatus(Long id, Boolean enableStatus, Long currentEmployeeId, String currentTenantKey);
//
// /**
// * 同步考勤模块字段
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// WeaResult<String> syncAttendFields(Long currentEmployeeId, String currentTenantKey);
//
// /**
// * 获取当前租户下所有的考勤引用字段
// *
// * @param tenantKey
// * @return
// */
// List<AttendQuoteFieldListDTO> listAll(String tenantKey);
}

View File

@ -0,0 +1,357 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.param.AttendQuoteFieldQueryParam;
import com.engine.salary.service.AttendQuoteFieldService;
import java.util.Map;
/**
* 数据采集-考勤引用字段
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class AttendQuoteFieldServiceImpl extends Service implements AttendQuoteFieldService {
//
// @Resource
// private AttendQuoteFieldMapper mapper;
// @RpcReference
// private RemoteAttendInitVacationService remoteAttendInitVacationService;
// @Autowired
// private LoggerTemplate attendQuoteFieldLoggerTemplate;
@Override
public Map<String, Object> list(AttendQuoteFieldQueryParam queryParam) {
int uid = user.getUID();
// todo 同步字段
// syncAttendFields(employeeId, tenantKey);
// Page<AttendQuoteFieldListDTO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
// mapper.list(page, queryParam, tenantKey);
//
// List<AttendQuoteFieldListDTO> list = page.getRecords();
// list.forEach(m->{
// Integer sourceType = Integer.valueOf(m.getSourceType());
// m.setSourceType(AttendQuoteFieldSourceTypeEnum.getDefaultLabelByValue(sourceType, employeeId, tenantKey));
// m.setSourceTypeValue(AttendQuoteFieldSourceTypeEnum.getNameByValue(sourceType));
// m.setFieldType(AttendQuoteFieldTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getFieldType()), employeeId, tenantKey));
// });
//
// WeaTable<AttendQuoteFieldListDTO> weaTable = FormatManager.<AttendQuoteFieldListDTO>getInstance()
// .genTable(AttendQuoteFieldListDTO.class, page);
//
// EditableTable<Map<String, Object>> editableTable = new EditableTable<>(weaTable);
// editableTable.setColumns(AttendQuoteFieldBO.buildRecordTableColumns(employeeId, tenantKey));
// editableTable.setComProps(AttendQuoteFieldBO.buildEditableTableItemMap());
// editableTable.setPageSize(page.getSize());
// editableTable.setModule("hrmsalary");
// return editableTable;
return null;
}
// @Override
// public WeaForm getFrom(Long id, Long employeeId, String tenantKey) {
// AttendQuoteFieldFormDTO formDTO = new AttendQuoteFieldFormDTO();
// if (id != null) {
// AttendQuoteFieldPO po = mapper.getById(id, tenantKey);
// if (po == null) {
// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100370, "字段不存在")+"[id:%s]", id));
// }
// BeanUtils.copyProperties(po, formDTO);
// } else {
// formDTO.setEnableStatus(0);
// }
// WeaForm weaForm = FormatManager.<AttendQuoteFieldFormDTO>getInstance().genForm(AttendQuoteFieldFormDTO.class, formDTO);
// weaForm.setData(JsonUtil.parseMap(formDTO, Object.class));
// return weaForm;
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public WeaResult<String> save(AttendQuoteFieldSaveParam saveParam, Long employeeId, String tenantKey) {
// WeaResult<String> checkResult = AttendQuoteFieldSaveParam.checkParam(saveParam, employeeId, tenantKey);
// if (checkResult.getCode() == WeaResultCodeEnum.ERROR.getCode()) {
// return checkResult;
// }
// List<AttendQuoteFieldPO> attendQuoteFields = new LambdaQueryChainWrapper<>(mapper)
// .eq(AttendQuoteFieldPO::getDeleteType, 0)
// .eq(AttendQuoteFieldPO::getTenantKey, tenantKey)
// .eq(AttendQuoteFieldPO::getFieldName, saveParam.getFieldName()).list();
// if (CollectionUtils.isNotEmpty(attendQuoteFields)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100371, "字段名称不允许重复"));
// }
//
// AttendQuoteFieldPO attendQuoteField = AttendQuoteFieldPO.builder()
// .id(IdGenerator.generate())
// .fieldName(saveParam.getFieldName())
// .sourceType(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())
// .fieldType(saveParam.getFieldType().getValue())
// .enableStatus(saveParam.getEnableStatus()?1:0)
// .description(saveParam.getDescription())
// .createTime(LocalDateTime.now())
// .updateTime(LocalDateTime.now())
// .creator(employeeId)
// .tenantKey(tenantKey)
// .build();
// // 保存
// mapper.insert(attendQuoteField);
// // 记录日志
// SalaryLoggerUtil.recordAddSingleLog(attendQuoteFieldLoggerTemplate,
// attendQuoteField.getId(),
// attendQuoteField.getFieldName(),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100374, "新增字段"),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100374, "新增字段"),
// attendQuoteField);
//
// return WeaResult.success(StringUtils.EMPTY);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public WeaResult<String> update(AttendQuoteFieldSaveParam saveParam, Long employeeId, String tenantKey) {
// WeaResult<String> checkResult = AttendQuoteFieldSaveParam.checkParam(saveParam, employeeId, tenantKey);
// if (checkResult.getCode() == WeaResultCodeEnum.ERROR.getCode()) {
// return checkResult;
// }
// // 校验是否可以编辑
// if (saveParam.getId() == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84026, "参数错误"));
// }
// AttendQuoteFieldPO attendQuoteField = mapper.getById(saveParam.getId(), tenantKey);
// if (attendQuoteField == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100375, "该字段不存在"));
// }
// if (!attendQuoteField.getSourceType().equals(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100376, "来源只能为自定义"));
// }
// List<AttendQuoteFieldPO> attendQuoteFields = new LambdaQueryChainWrapper<>(mapper)
// .eq(AttendQuoteFieldPO::getDeleteType, 0)
// .eq(AttendQuoteFieldPO::getTenantKey, tenantKey)
// .eq(AttendQuoteFieldPO::getFieldName, saveParam.getFieldName()).list();
// boolean fieldNameExist = CollectionUtils.emptyIfNull(attendQuoteFields).stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId()));
// if (fieldNameExist) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100371, "字段名称不允许重复"));
// }
//
// AttendQuoteFieldPO newAttendQuoteField = new AttendQuoteFieldPO();
// BeanUtils.copyProperties(attendQuoteField, newAttendQuoteField);
// newAttendQuoteField.setFieldName(saveParam.getFieldName());
// newAttendQuoteField.setFieldType(saveParam.getFieldType().getValue());
// newAttendQuoteField.setEnableStatus(saveParam.getEnableStatus()?1:0);
// newAttendQuoteField.setDescription(saveParam.getDescription());
// newAttendQuoteField.setUpdateTime(LocalDateTime.now());
// // 更新
// mapper.updateById(newAttendQuoteField);
//
// // 记录日志
// SalaryLoggerUtil.recordUpdateSingleLog(attendQuoteFieldLoggerTemplate,
// attendQuoteField.getId(),
// newAttendQuoteField.getFieldName(),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100378, "修改字段"),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100378, "修改字段"),
// attendQuoteField,
// newAttendQuoteField);
//
// return WeaResult.success(StringUtils.EMPTY);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public WeaResult<String> delete(Collection<Long> ids, Long employeeId, String tenantKey) {
// if (CollectionUtils.isEmpty(ids)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84026, "参数错误"));
// }
// List<AttendQuoteFieldListDTO> attendQuoteFields = mapper.list(AttendQuoteFieldQueryParam.builder().ids(ids).build(), tenantKey);
// if (CollectionUtils.isEmpty(attendQuoteFields)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 87637, "要删除的数据在不存在或已删除"));
// }
//
// List<AttendQuoteFieldListDTO> attendQuoteAttendFields = attendQuoteFields.stream().filter(e-> e.getSourceType().equals(String.valueOf(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue()))).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(attendQuoteAttendFields)) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 87652, "考勤模块的字段不能删除"));
// }
//
// // TODO 正在使用的记录不允许删除
// mapper.deleteByIds(ids, tenantKey);
//
// // 记录日志
// attendQuoteFields.forEach(e -> {
// SalaryLoggerUtil.recordDeleteSingleLog(attendQuoteFieldLoggerTemplate,
// e.getId(),
// e.getFieldName(),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100380, "删除字段"),
// SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100380, "删除字段"),
// e);
// });
// return WeaResult.success(StringUtils.EMPTY);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public WeaResult<String> updateEnableStatus(Long id, Boolean enableStatus, Long currentEmployeeId, String currentTenantKey) {
// // 校验是否可以编辑
// if (id == null || enableStatus == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 84026, "参数错误"));
// }
// AttendQuoteFieldPO attendQuoteField = mapper.getById(id, currentTenantKey);
// if (attendQuoteField == null) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100375, "该字段不存在"));
// }
// if (!attendQuoteField.getSourceType().equals(AttendQuoteFieldSourceTypeEnum.DEFAULT.getValue())) {
// return WeaResult.fail(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100376, "来源只能为自定义"));
// }
//
// AttendQuoteFieldPO newAttendQuoteField = new AttendQuoteFieldPO();
// BeanUtils.copyProperties(attendQuoteField, newAttendQuoteField);
// newAttendQuoteField.setEnableStatus(enableStatus?1:0);
// newAttendQuoteField.setUpdateTime(LocalDateTime.now());
// // 更新
// mapper.updateById(newAttendQuoteField);
// String action = enableStatus?SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 87070, "启用"):SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100386, "停用");
// // 记录日志
// SalaryLoggerUtil.recordUpdateSingleLog(attendQuoteFieldLoggerTemplate,
// attendQuoteField.getId(),
// newAttendQuoteField.getFieldName(),
// action+SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100387, "字段"),
// action+SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100387, "字段"),
// attendQuoteField,
// newAttendQuoteField);
//
// return WeaResult.success(StringUtils.EMPTY);
// }
//
// @Override
// @Transactional(rollbackFor = Exception.class)
// public WeaResult<String> syncAttendFields(Long currentEmployeeId, String currentTenantKey) {
// // 所有字段管理的考勤模块引用字段
// List<AttendQuoteFieldPO> attendQuoteFields = new LambdaQueryChainWrapper<>(mapper)
// .eq(AttendQuoteFieldPO::getTenantKey, currentTenantKey)
// .eq(AttendQuoteFieldPO::getDeleteType, 0)
// .eq(AttendQuoteFieldPO::getSourceType, AttendQuoteFieldSourceTypeEnum.ATTEND.getValue())
// .orderByDesc(AttendQuoteFieldPO::getId).list();
// // 1.本地字段
// List<String> localFieldCodes = CollectionUtils.emptyIfNull(attendQuoteFields).stream().map(AttendQuoteFieldPO::getCode).collect(Collectors.toList());
//
// // 2.考勤模块字段
// // 请假类型
// List<AttendVacationType> attendVacationTypes;
// try {
// attendVacationTypes = remoteAttendInitVacationService.queryVacationTypes(Boolean.TRUE, currentTenantKey);
// } catch (Exception e) {
// log.error("同步考勤字段失败,请检查接口服务remoteAttendInitVacationService.queryVacationTypes:{}", e.getMessage());
// return WeaResult.success(StringUtils.EMPTY);
// }
// // 请假类型:按小时
// List<String> attendLeaveHourFieldCodes = CollectionUtils.emptyIfNull(attendVacationTypes).stream().map(m->m.getId()+"_leave_hour").collect(Collectors.toList());
// // 请假类型:按天
// List<String> attendLeaveDayFieldCodes = CollectionUtils.emptyIfNull(attendVacationTypes).stream().map(m->m.getId()+"_leave_day").collect(Collectors.toList());
// List<String> attendLeaveFieldCodes = Lists.newArrayList();
// attendLeaveFieldCodes.addAll(attendLeaveHourFieldCodes);
// attendLeaveFieldCodes.addAll(attendLeaveDayFieldCodes);
// // 所有考勤模块字段编码
// List<String> attendFieldCodes = Lists.newArrayList();
// attendFieldCodes.addAll(attendLeaveFieldCodes);
// // 考勤模块固定字段
// List<Map<String, String>> attendFixedFieldCodes = AttendQuoteFieldBO.buildAttendFixedFields();
// attendFieldCodes.addAll(attendFixedFieldCodes.stream().map(m->m.get("code")).collect(Collectors.toList()));
//
// // 本地已存在则更新交集
// List<String> updateCodes = localFieldCodes.stream().filter(item -> attendFieldCodes.contains(item)).collect(Collectors.toList());
// // 本地比attend多则删除差集(local - attend)
// List<String> deleteCodes = localFieldCodes.stream().filter(item -> !attendFieldCodes.contains(item)).collect(Collectors.toList());
// // attend比本地多则新增差集(attend - local)
// List<String> saveCodes = attendFieldCodes.stream().filter(item -> !localFieldCodes.contains(item)).collect(Collectors.toList());
// String hourI18n = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100743, "小时");
// String dayI18n = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100744, "");
// // 1.更新 == 目前除了请假类型其余都是固定故只需更新请假类型部分
// List<AttendQuoteFieldPO> updates = Lists.newArrayList();
// CollectionUtils.emptyIfNull(updateCodes).forEach(e -> {
// Optional<AttendVacationType> optionalHour = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m->(m.getId()+"_leave_hour").equals(e)).findFirst();
// if (optionalHour.isPresent()) {
// AttendVacationType hour = optionalHour.get();
// updates.add(AttendQuoteFieldPO.builder()
// .code(e)
// .fieldName(hour.getName()+"("+hourI18n+")")
// .updateTime(LocalDateTime.now())
// .build());
// }
// Optional<AttendVacationType> optionalDay = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m->(m.getId()+"_leave_day").equals(e)).findFirst();
// if (optionalDay.isPresent()) {
// AttendVacationType day = optionalDay.get();
// updates.add(AttendQuoteFieldPO.builder()
// .code(e)
// .fieldName(day.getName()+"("+dayI18n+")")
// .updateTime(LocalDateTime.now())
// .build());
// }
// });
// if (CollectionUtils.isNotEmpty(updates)) {
// mapper.updateNameByCode(updates);
// }
// // 2.删除
// if (CollectionUtils.isNotEmpty(deleteCodes)) {
// new LambdaUpdateChainWrapper<>(mapper)
// .eq(AttendQuoteFieldPO::getDeleteType, 0)
// .eq(AttendQuoteFieldPO::getTenantKey, currentTenantKey)
// .eq(AttendQuoteFieldPO::getSourceType, AttendQuoteFieldSourceTypeEnum.ATTEND.getValue())
// .in(AttendQuoteFieldPO::getCode, deleteCodes)
// .set(AttendQuoteFieldPO::getDeleteType, 1).update();
// }
// // 3.新增
// List<AttendQuoteFieldPO> saves = new ArrayList<>();
// saves.addAll(CollectionUtils.emptyIfNull(attendFixedFieldCodes).stream().filter(e -> saveCodes.contains(e.get("code"))).map(m ->
// buildAttendQuoteField(m.get("code"), m.get("name"), currentEmployeeId, currentTenantKey)
// ).collect(Collectors.toList()));
// CollectionUtils.emptyIfNull(saveCodes).forEach(e -> {
// Optional<AttendVacationType> optionalHour = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m->(m.getId()+"_leave_hour").equals(e)).findFirst();
// if (optionalHour.isPresent()) {
// AttendVacationType hour = optionalHour.get();
// saves.add(buildAttendQuoteField(e, hour.getName()+"("+hourI18n+")", currentEmployeeId, currentTenantKey));
// }
// Optional<AttendVacationType> optionalDay = CollectionUtils.emptyIfNull(attendVacationTypes).stream().filter(m->(m.getId()+"_leave_day").equals(e)).findFirst();
// if (optionalDay.isPresent()) {
// AttendVacationType day = optionalDay.get();
// saves.add(buildAttendQuoteField(e, day.getName()+"("+dayI18n+")", currentEmployeeId, currentTenantKey));
// }
// });
//
// if (CollectionUtils.isNotEmpty(saves)) {
// mapper.saveBatch(saves);
// }
//
// return WeaResult.success(StringUtils.EMPTY);
// }
//
// /**
// * 构建考勤字段
// * @param code
// * @param name
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// private AttendQuoteFieldPO buildAttendQuoteField(String code, String name, Long currentEmployeeId, String currentTenantKey) {
// return AttendQuoteFieldPO.builder()
// .id(IdGenerator.generate())
// .code(code)
// .fieldName(name)
// .sourceType(AttendQuoteFieldSourceTypeEnum.ATTEND.getValue())
// .fieldType(AttendQuoteFieldTypeEnum.NUMBER.getValue())
// .enableStatus(1)
// .description("")
// .createTime(LocalDateTime.now())
// .updateTime(LocalDateTime.now())
// .creator(currentEmployeeId)
// .tenantKey(currentTenantKey)
// .build();
// }
//
// @Override
// public List<AttendQuoteFieldListDTO> listAll(String tenantKey) {
// return mapper.list(AttendQuoteFieldQueryParam.builder().build(), tenantKey);
// }
}