薪酬报表-薪酬核算完成,将数据存储到非加密表,删除人员信息,补充:分部、部门、岗位等其他字段,供数据中心引用
This commit is contained in:
parent
97763cc280
commit
bf31d993a7
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Description:
|
||||
* @Date 2022/3/12
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.engine.salary.encrypt.report;
|
||||
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 薪资核算报表
|
||||
*/
|
||||
public class SalaryAcctResultReportPOEncrypt {
|
||||
|
||||
public static Collection<SalaryAcctResultReportPO> encryptList(Collection<SalaryAcctResultReportPO> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return list;
|
||||
}
|
||||
list.forEach(item -> {
|
||||
item.setEmployeeId(AESEncryptUtil.encrypt(item.getEmployeeId()));
|
||||
item.setSalaryAcctEmpId(AESEncryptUtil.encrypt(item.getSalaryAcctEmpId()));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Collection<SalaryAcctResultReportPO> decryptList(Collection<SalaryAcctResultReportPO> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return list;
|
||||
}
|
||||
list.forEach(item -> {
|
||||
item.setEmployeeId(AESEncryptUtil.decrypt(item.getEmployeeId()));
|
||||
item.setSalaryAcctEmpId(AESEncryptUtil.decrypt(item.getSalaryAcctEmpId()));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,9 +39,16 @@ public class DataCollectionEmployee {
|
|||
@SalaryFormulaVar(defaultLabel = "部门ID", labelId = 86185, dataType = "string")
|
||||
private Long departmentId;
|
||||
|
||||
//分部
|
||||
private String subcompanyName;
|
||||
private Long subcompanyid;
|
||||
|
||||
//所属成本中心
|
||||
private Long costcenterId;
|
||||
|
||||
//工作地点
|
||||
private Long locationId;
|
||||
|
||||
//岗位
|
||||
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
|
||||
private String jobtitleName;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
package com.engine.salary.entity.report.bo;
|
||||
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryacct.param.SalaryAcctResultSaveParam;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultTempPO;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SalaryAcctResultReportBO {
|
||||
|
||||
|
||||
/**
|
||||
* 薪资核算结果保存参数转换成薪资核算结果po
|
||||
*
|
||||
* @param saveParam 前端保存参数
|
||||
* @param salaryAcctEmployee 薪资核算人员po
|
||||
* @param employeeId 当前登陆人员id
|
||||
* @return
|
||||
*/
|
||||
public static List<SalaryAcctResultReportPO> convert2PO(SalaryAcctResultSaveParam saveParam,
|
||||
SalaryAcctEmployeePO salaryAcctEmployee,
|
||||
Long employeeId, Map<Long, DataCollectionEmployee> emps) {
|
||||
if (CollectionUtils.isEmpty(saveParam.getItems())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Date now = new Date();
|
||||
return saveParam.getItems().stream()
|
||||
.map(e -> {
|
||||
SalaryAcctResultReportPO po = SalaryAcctResultReportPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.salarySobId(salaryAcctEmployee.getSalarySobId())
|
||||
.salaryItemId(e.getSalaryItemId())
|
||||
.salaryAcctRecordId(salaryAcctEmployee.getSalaryAcctRecordId())
|
||||
.salaryAcctEmpId(salaryAcctEmployee.getId().toString())
|
||||
.employeeId(salaryAcctEmployee.getEmployeeId().toString())
|
||||
.taxAgentId(salaryAcctEmployee.getTaxAgentId())
|
||||
.resultValue(e.getResultValue())
|
||||
.creator(employeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
|
||||
DataCollectionEmployee dataCollectionEmployee = emps.get(salaryAcctEmployee.getEmployeeId());
|
||||
if (dataCollectionEmployee != null) {
|
||||
po.setDepartmentId(dataCollectionEmployee.getDepartmentId());
|
||||
po.setSubcompanyId(dataCollectionEmployee.getSubcompanyid());
|
||||
po.setCostcenterId(dataCollectionEmployee.getCostcenterId());
|
||||
po.setJobtitleId(dataCollectionEmployee.getJobtitleId());
|
||||
po.setLocationId(dataCollectionEmployee.getLocationId());
|
||||
}
|
||||
return po;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static List<SalaryAcctResultReportPO> convert2ReportPO(Collection<SalaryAcctResultTempPO> temps, Map<Long, DataCollectionEmployee> emps) {
|
||||
// Map<Long, DataCollectionEmployee> longDataCollectionEmployeeMap = SalaryEntityUtil.convert2Map(emps, DataCollectionEmployee::getEmployeeId);
|
||||
if (CollectionUtils.isEmpty(temps)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return temps.stream().map(e -> {
|
||||
SalaryAcctResultReportPO po = SalaryAcctResultReportPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.salarySobId(e.getSalarySobId())
|
||||
.salaryAcctEmpId(e.getSalaryAcctEmpId().toString())
|
||||
.salaryAcctRecordId(e.getSalaryAcctRecordId())
|
||||
.employeeId(e.getEmployeeId().toString())
|
||||
.taxAgentId(e.getTaxAgentId())
|
||||
.salaryItemId(e.getSalaryItemId())
|
||||
.resultValue(e.getResultValue())
|
||||
.creator(e.getCreator())
|
||||
.createTime(e.getCreateTime())
|
||||
.updateTime(e.getUpdateTime())
|
||||
.deleteType(e.getDeleteType())
|
||||
.tenantKey(e.getTenantKey())
|
||||
.build();
|
||||
|
||||
Long employeeId = e.getEmployeeId();
|
||||
DataCollectionEmployee dataCollectionEmployee = emps.get(employeeId);
|
||||
if (dataCollectionEmployee != null) {
|
||||
po.setDepartmentId(dataCollectionEmployee.getDepartmentId());
|
||||
po.setSubcompanyId(dataCollectionEmployee.getSubcompanyid());
|
||||
po.setCostcenterId(dataCollectionEmployee.getCostcenterId());
|
||||
po.setJobtitleId(dataCollectionEmployee.getJobtitleId());
|
||||
po.setLocationId(dataCollectionEmployee.getLocationId());
|
||||
}
|
||||
return po;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.engine.salary.entity.report.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 薪资核算结果表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryAcctResultReportPO {
|
||||
private Long id;
|
||||
/**
|
||||
* 薪资帐套id
|
||||
*/
|
||||
private Long salarySobId;
|
||||
/**
|
||||
* 薪资核算人员id
|
||||
*/
|
||||
private String salaryAcctEmpId;
|
||||
/**
|
||||
* 薪资核算的id
|
||||
*/
|
||||
private Long salaryAcctRecordId;
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String employeeId;
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
private Long taxAgentId;
|
||||
/**
|
||||
* 薪资项目的id
|
||||
*/
|
||||
private Long salaryItemId;
|
||||
/**
|
||||
* 计算后的值
|
||||
*/
|
||||
private String resultValue;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 是否已删除。0:未删除、1:已删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantKey;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private Long departmentId;
|
||||
/**
|
||||
* 所属分部
|
||||
*/
|
||||
private Long subcompanyId;
|
||||
/**
|
||||
* 所属成本中心
|
||||
*/
|
||||
private Long costcenterId;
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
private Long jobtitleId;
|
||||
/**
|
||||
* 工作地点
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
}
|
||||
|
|
@ -153,6 +153,7 @@ public class SalaryAcctResultBO {
|
|||
|
||||
/**
|
||||
* 构建核算结果表头-供报表使用
|
||||
*
|
||||
* @param salarySobItemAggregateDTO
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -567,4 +568,7 @@ public class SalaryAcctResultBO {
|
|||
return salaryAcctResult;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.entity.salaryacct.param;
|
||||
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -7,6 +8,7 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 薪资核算的参数
|
||||
|
|
@ -27,4 +29,9 @@ public class SalaryAcctCalculateParam {
|
|||
|
||||
@DataCheck(require = true,message = "参数错误,薪资核算记录ID不能为空")
|
||||
private Long salaryAcctRecordId;
|
||||
|
||||
/**
|
||||
* 人员信息,报表使用
|
||||
*/
|
||||
private Map<Long, DataCollectionEmployee> emps;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.util.Objects;
|
|||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
* @Description: TODO
|
||||
* @Description:
|
||||
* @Date 2022/3/15
|
||||
* @Version V1.0
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.engine.salary.entity.hrm.DeptInfo;
|
|||
import com.engine.salary.entity.hrm.PositionInfo;
|
||||
import com.engine.salary.entity.hrm.SubCompanyInfo;
|
||||
import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -40,6 +39,12 @@ public interface EmployMapper {
|
|||
|
||||
List<DataCollectionEmployee> listAllFields();
|
||||
|
||||
/**
|
||||
* 报表专用
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listAllForReport();
|
||||
|
||||
List<PositionInfo> listPositionInfo(@Param("collection") List<Long> ids);
|
||||
|
||||
List<DeptInfo> getDeptInfoList(@Param("departmentIds") List<Long> departmentIds);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
e.LASTNAME as username,
|
||||
d.DEPARTMENTNAME as departmentName,
|
||||
e.status,
|
||||
e.mobile
|
||||
e.mobile
|
||||
from hrmresource e
|
||||
left join hrmdepartment d on e.departmentid = d.id
|
||||
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
||||
where e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
</select>
|
||||
|
||||
<select id="getEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
||||
|
|
@ -136,14 +137,14 @@
|
|||
#{status}
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- -- 在职-->
|
||||
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'normal'">-->
|
||||
<!-- AND em.status in (0,1,2,3)-->
|
||||
<!-- </if>-->
|
||||
<!-- -- 离职-->
|
||||
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'unavailable'">-->
|
||||
<!-- AND em.status in (4,5,6)-->
|
||||
<!-- </if>-->
|
||||
<!-- -- 在职-->
|
||||
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'normal'">-->
|
||||
<!-- AND em.status in (0,1,2,3)-->
|
||||
<!-- </if>-->
|
||||
<!-- -- 离职-->
|
||||
<!-- <if test="param.employeeStatus != null and param.employeeStatus == 'unavailable'">-->
|
||||
<!-- AND em.status in (4,5,6)-->
|
||||
<!-- </if>-->
|
||||
)
|
||||
</foreach>
|
||||
)
|
||||
|
|
@ -155,7 +156,7 @@
|
|||
select e.id as employeeId,
|
||||
e.lastname as username,
|
||||
e.status as status,
|
||||
e.certificatenum as idNo,
|
||||
e.certificatenum as idNo,
|
||||
e.workcode as workcode,
|
||||
d.departmentname as departmentName,
|
||||
d.id as departmentId,
|
||||
|
|
@ -168,7 +169,8 @@
|
|||
left join hrmdepartment d on e.departmentid = d.id
|
||||
left join hrmjobtitles c on e.jobtitle = c.id
|
||||
left join bill_hrmdismiss b on e.id = b.resource_n
|
||||
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
|
||||
where e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
AND e.id = #{id}
|
||||
</select>
|
||||
|
||||
|
|
@ -214,10 +216,10 @@
|
|||
e.lastname as username,
|
||||
e.status as status,
|
||||
e.workcode as workcode,
|
||||
e.certificatenum as idNo,
|
||||
e.certificatenum as idNo,
|
||||
e.companystartdate as companystartdate,
|
||||
e.mobile as mobile,
|
||||
e.subcompanyid1 as subcompanyid,
|
||||
e.subcompanyid1 as subcompanyid,
|
||||
d.departmentname as departmentName,
|
||||
d.id as departmentId,
|
||||
c.jobtitlename as jobtitleName,
|
||||
|
|
@ -230,6 +232,25 @@
|
|||
</select>
|
||||
|
||||
|
||||
<select id="listAllForReport" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
|
||||
select e.id as employeeId,
|
||||
e.lastname as username,
|
||||
e.status as status,
|
||||
e.workcode as workcode,
|
||||
e.certificatenum as idNo,
|
||||
e.companystartdate as companystartdate,
|
||||
e.mobile as mobile,
|
||||
e.departmentid as departmentId,
|
||||
e.subcompanyid1 as subcompanyid,
|
||||
e.costcenterid as costcenterId,
|
||||
e.locationid as locationId,
|
||||
e.jobtitle as jobtitleId
|
||||
from hrmresource e
|
||||
where e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDeptInfoList" resultType="com.engine.salary.entity.hrm.DeptInfo">
|
||||
select d.departmentname as name,
|
||||
d.id as id
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.engine.salary.mapper.report;
|
||||
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface SalaryAcctResultReportMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<SalaryAcctResultReportPO> listSome(SalaryAcctResultReportPO salaryAcctResultReportPO);
|
||||
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param salaryAcctResultReportPO 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(SalaryAcctResultReportPO salaryAcctResultReportPO);
|
||||
|
||||
/**
|
||||
* 批量新增
|
||||
*/
|
||||
void batchInsert(@Param("collection") Collection<SalaryAcctResultReportPO> reports);
|
||||
|
||||
void deleteBySalaryAcctRecordIds(@Param("list") Collection<Long> list);
|
||||
|
||||
void deleteBySalaryAcctRecordId(Long salaryAcctRecordId);
|
||||
|
||||
void deleteBySalaryAcctEmpIds(@Param("list") Collection<String> salaryAcctEmpIds);
|
||||
|
||||
/**
|
||||
* 根据薪资核算id、薪资项目id删除薪资核算结果
|
||||
*
|
||||
* @param salaryAcctEmpIds
|
||||
* @param salaryItemIds
|
||||
*/
|
||||
void deleteByAcctEmpIdsAndSalaryItemIds(@Param("salaryAcctEmpIds") Collection<String> salaryAcctEmpIds,
|
||||
@Param("salaryItemIds") Collection<Long> salaryItemIds);
|
||||
}
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
<?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.report.SalaryAcctResultReportMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.report.po.SalaryAcctResultReportPO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="salary_sob_id" property="salarySobId"/>
|
||||
<result column="salary_acct_emp_id" property="salaryAcctEmpId"/>
|
||||
<result column="salary_acct_record_id" property="salaryAcctRecordId"/>
|
||||
<result column="employee_id" property="employeeId"/>
|
||||
<result column="tax_agent_id" property="taxAgentId"/>
|
||||
<result column="salary_item_id" property="salaryItemId"/>
|
||||
<result column="result_value" property="resultValue"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="subcompany_id" property="subcompanyId"/>
|
||||
<result column="costcenter_id" property="costcenterId"/>
|
||||
<result column="jobtitle_id" property="jobtitleId"/>
|
||||
<result column="location_id" property="locationId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
id
|
||||
, t.salary_sob_id
|
||||
, t.salary_acct_emp_id
|
||||
, t.salary_acct_record_id
|
||||
, t.employee_id
|
||||
, t.tax_agent_id
|
||||
, t.salary_item_id
|
||||
, t.result_value
|
||||
, t.creator
|
||||
, t.create_time
|
||||
, t.update_time
|
||||
, t.delete_type
|
||||
, t.tenant_key
|
||||
, t.department_id
|
||||
, t.subcompany_id
|
||||
, t.costcenter_id
|
||||
, t.jobtitle_id
|
||||
, t.location_id
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.report.po.SalaryAcctResultReportPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_acct_result_report t
|
||||
WHERE delete_type = 0
|
||||
<if test="salarySobId != null">
|
||||
AND salary_sob_id = #{salarySobId}
|
||||
</if>
|
||||
<if test="salaryAcctEmpId != null">
|
||||
AND salary_acct_emp_id = #{salaryAcctEmpId}
|
||||
</if>
|
||||
<if test="salaryAcctRecordId != null">
|
||||
AND salary_acct_record_id = #{salaryAcctRecordId}
|
||||
</if>
|
||||
<if test="employeeId != null">
|
||||
AND employee_id = #{employeeId}
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
AND tax_agent_id = #{taxAgentId}
|
||||
</if>
|
||||
<if test="salaryItemId != null">
|
||||
AND salary_item_id = #{salaryItemId}
|
||||
</if>
|
||||
<if test="resultValue != null">
|
||||
AND result_value = #{resultValue}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
AND department_id = #{departmentId}
|
||||
</if>
|
||||
<if test="subcompanyId != null">
|
||||
AND subcompany_id = #{subcompanyId}
|
||||
</if>
|
||||
<if test="costcenterId != null">
|
||||
AND costcenter_id = #{costcenterId}
|
||||
</if>
|
||||
<if test="jobtitleId != null">
|
||||
AND jobtitle_id = #{jobtitleId}
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
AND location_id = #{locationId}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete" parameterType="com.engine.salary.entity.report.po.SalaryAcctResultReportPO">
|
||||
UPDATE hrsa_salary_acct_result_report
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO hrsa_salary_acct_result_report(
|
||||
id
|
||||
, salary_sob_id
|
||||
, salary_acct_emp_id
|
||||
, salary_acct_record_id
|
||||
, employee_id
|
||||
, tax_agent_id
|
||||
, salary_item_id
|
||||
, result_value
|
||||
, creator
|
||||
, create_time
|
||||
, update_time
|
||||
, delete_type
|
||||
, tenant_key
|
||||
, department_id
|
||||
, subcompany_id
|
||||
, costcenter_id
|
||||
, jobtitle_id
|
||||
, location_id)
|
||||
VALUES
|
||||
<foreach collection="collection" item="item" separator=",">
|
||||
(
|
||||
#{item.id}
|
||||
, #{item.salarySobId}
|
||||
, #{item.salaryAcctEmpId}
|
||||
, #{item.salaryAcctRecordId}
|
||||
, #{item.employeeId}
|
||||
, #{item.taxAgentId}
|
||||
, #{item.salaryItemId}
|
||||
, #{item.resultValue}
|
||||
, #{item.creator}
|
||||
, #{item.createTime}
|
||||
, #{item.updateTime}
|
||||
, #{item.deleteType}
|
||||
, #{item.tenantKey}
|
||||
, #{item.departmentId}
|
||||
, #{item.subcompanyId}
|
||||
, #{item.costcenterId}
|
||||
, #{item.jobtitleId}
|
||||
, #{item.locationId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_salary_acct_result_report(
|
||||
id
|
||||
, salary_sob_id
|
||||
, salary_acct_emp_id
|
||||
, salary_acct_record_id
|
||||
, employee_id
|
||||
, tax_agent_id
|
||||
, salary_item_id
|
||||
, result_value
|
||||
, creator
|
||||
, create_time
|
||||
, update_time
|
||||
, delete_type
|
||||
, tenant_key
|
||||
, department_id
|
||||
, subcompany_id
|
||||
, costcenter_id
|
||||
, jobtitle_id
|
||||
, location_id)
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select
|
||||
#{item.id}
|
||||
, #{item.salarySobId}
|
||||
, #{item.salaryAcctEmpId}
|
||||
, #{item.salaryAcctRecordId}
|
||||
, #{item.employeeId}
|
||||
, #{item.taxAgentId}
|
||||
, #{item.salaryItemId}
|
||||
, #{item.resultValue}
|
||||
, #{item.creator}
|
||||
, #{item.createTime}
|
||||
, #{item.updateTime}
|
||||
, #{item.deleteType}
|
||||
, #{item.tenantKey}
|
||||
, #{item.departmentId}
|
||||
, #{item.subcompanyId}
|
||||
, #{item.costcenterId}
|
||||
, #{item.jobtitleId}
|
||||
, #{item.locationId}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
<foreach collection="collection" item="item" separator=";">
|
||||
INSERT INTO hrsa_salary_acct_result_report
|
||||
(
|
||||
id
|
||||
, salary_sob_id
|
||||
, salary_acct_emp_id
|
||||
, salary_acct_record_id
|
||||
, employee_id
|
||||
, tax_agent_id
|
||||
, salary_item_id
|
||||
, result_value
|
||||
, creator
|
||||
, create_time
|
||||
, update_time
|
||||
, delete_type
|
||||
, tenant_key
|
||||
, department_id
|
||||
, subcompany_id
|
||||
, costcenter_id
|
||||
, jobtitle_id
|
||||
, location_id)
|
||||
VALUES
|
||||
(
|
||||
#{item.id}
|
||||
, #{item.salarySobId}
|
||||
, #{item.salaryAcctEmpId}
|
||||
, #{item.salaryAcctRecordId}
|
||||
, #{item.employeeId}
|
||||
, #{item.taxAgentId}
|
||||
, #{item.salaryItemId}
|
||||
, #{item.resultValue}
|
||||
, #{item.creator}
|
||||
, #{item.createTime}
|
||||
, #{item.updateTime}
|
||||
, #{item.deleteType}
|
||||
, #{item.tenantKey}
|
||||
, #{item.departmentId}
|
||||
, #{item.subcompanyId}
|
||||
, #{item.costcenterId}
|
||||
, #{item.jobtitleId}
|
||||
, #{item.locationId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteBySalaryAcctRecordIds">
|
||||
DELETE FROM hrsa_salary_acct_result_report
|
||||
WHERE delete_type = 0
|
||||
AND salary_acct_record_id IN
|
||||
<foreach collection="list" open="(" item="salaryAcctRecordId" separator="," close=")">
|
||||
#{salaryAcctRecordId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBySalaryAcctRecordId">
|
||||
DELETE
|
||||
FROM hrsa_salary_acct_result_report
|
||||
WHERE delete_type = 0
|
||||
AND salary_acct_record_id = #{salaryAcctRecordId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBySalaryAcctEmpIds">
|
||||
DELETE FROM hrsa_salary_acct_result_report
|
||||
WHERE delete_type = 0
|
||||
AND salary_acct_emp_id IN
|
||||
<foreach collection="list" open="(" item="salaryAcctEmpId" separator="," close=")">
|
||||
#{salaryAcctEmpId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteByAcctEmpIdsAndSalaryItemIds">
|
||||
DELETE FROM hrsa_salary_acct_result_report
|
||||
WHERE delete_type = 0
|
||||
AND salary_acct_emp_id IN
|
||||
<foreach collection="salaryAcctEmpIds" open="(" item="salaryAcctEmpId" separator="," close=")">
|
||||
#{salaryAcctEmpId}
|
||||
</foreach>
|
||||
AND salary_item_id IN
|
||||
<foreach collection="salaryItemIds" open="(" item="salaryItemId" separator="," close=")">
|
||||
#{salaryItemId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -29,4 +32,28 @@ public interface SalaryAcctReportService {
|
|||
*/
|
||||
String decrypt(String s);
|
||||
|
||||
/**
|
||||
* 保存核算记录报表数据
|
||||
* @param pos
|
||||
*/
|
||||
void batchSave(Collection<SalaryAcctResultReportPO> pos);
|
||||
|
||||
/**
|
||||
* 根据核算记录删除
|
||||
* @param salaryAcctRecordIds
|
||||
*/
|
||||
void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
|
||||
|
||||
void deleteBySalaryAcctRecordId(Long salaryAcctRecordId);
|
||||
|
||||
void deleteBySalaryAcctEmpIds(Collection<Long> salaryAcctEmpIds);
|
||||
|
||||
/**
|
||||
* 根据薪资核算人员id、薪资项目id删除薪资核算结果
|
||||
*
|
||||
* @param salaryAcctEmployeeIds 薪资核算人员id
|
||||
* @param salaryItemIds 薪资项目id
|
||||
*/
|
||||
void deleteByAcctEmployeeIdsAndSalaryItemIds(Collection<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ public interface SalaryEmployeeService {
|
|||
*/
|
||||
List<DataCollectionEmployee> listAll();
|
||||
|
||||
/**
|
||||
* 获取报表人员字段
|
||||
* @return
|
||||
*/
|
||||
List<DataCollectionEmployee> listAllForReport();
|
||||
|
||||
/**
|
||||
* 根据薪资账套id查询人员
|
||||
*
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryAcctResultService getSalaryAcctResultService(User user) {
|
||||
// return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
|
||||
// }
|
||||
private SalaryAcctReportServiceImpl getSalaryAcctReportService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryCheckResultDetailService salaryCheckResultDetailService;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
}
|
||||
|
||||
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
|
|
@ -131,20 +131,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
}
|
||||
// 添加薪资核算人员
|
||||
Date now = new Date();
|
||||
List<SalaryAcctEmployeePO> newSalaryAcctEmployeePOS = salaryAcctEmployeePOS.stream()
|
||||
.map(salaryAcctEmployeePO -> new SalaryAcctEmployeePO()
|
||||
List<SalaryAcctEmployeePO> newSalaryAcctEmployeePOS = salaryAcctEmployeePOS.stream().map(salaryAcctEmployeePO -> new SalaryAcctEmployeePO()
|
||||
// .setId(IdGenerator.generate())
|
||||
.setSalaryAcctRecordId(salaryAcctRecordPO.getId())
|
||||
.setSalarySobId(salaryAcctRecordPO.getSalarySobId())
|
||||
.setSalaryMonth(salaryAcctRecordPO.getSalaryMonth())
|
||||
.setEmployeeId(salaryAcctEmployeePO.getEmployeeId())
|
||||
.setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId())
|
||||
.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
.setCreator((long) user.getUID())
|
||||
.setDeleteType(0))
|
||||
.collect(Collectors.toList());
|
||||
.setSalaryAcctRecordId(salaryAcctRecordPO.getId()).setSalarySobId(salaryAcctRecordPO.getSalarySobId()).setSalaryMonth(salaryAcctRecordPO.getSalaryMonth()).setEmployeeId(salaryAcctEmployeePO.getEmployeeId()).setTaxAgentId(salaryAcctEmployeePO.getTaxAgentId()).setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).setCreateTime(now).setUpdateTime(now).setCreator((long) user.getUID()).setDeleteType(0)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(newSalaryAcctEmployeePOS)) {
|
||||
batchSave(newSalaryAcctEmployeePOS);
|
||||
}
|
||||
|
|
@ -340,6 +329,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
getSalaryAcctEmployeeMapper().deleteByIds(ids);
|
||||
// 删除薪资核算人员对应的薪资核算结果
|
||||
getSalaryAcctResultService(user).deleteBySalaryAcctEmployeeIds(ids);
|
||||
// 删除报表
|
||||
getSalaryAcctReportService(user).deleteBySalaryAcctEmpIds(ids);
|
||||
|
||||
// 删除薪资核算人员对应的校验异常明细
|
||||
// salaryCheckResultDetailService.deleteBySalaryAcctEmployeeIds(ids);
|
||||
// 删除薪资核算人员对应的线下对比结果
|
||||
|
|
@ -401,17 +393,11 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
|
||||
List<DataCollectionEmployee> finalSalaryEmployees = new ArrayList<>();
|
||||
// 根据薪资账套的"核算人员范围"过滤入职日期大于薪资周期止的人员
|
||||
salaryEmployees = salaryEmployees.stream()
|
||||
.filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getCompanystartdate())
|
||||
|| (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) <= 0))
|
||||
.collect(Collectors.toList());
|
||||
salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getCompanystartdate()) || (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) <= 0)).collect(Collectors.toList());
|
||||
|
||||
|
||||
// 根据薪资账套的"核算人员范围"过滤离职日期小于薪资周期起的人员
|
||||
salaryEmployees = salaryEmployees.stream()
|
||||
.filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getDismissdate())
|
||||
|| (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getDismissdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) > 0))
|
||||
.collect(Collectors.toList());
|
||||
salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getDismissdate()) || (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getDismissdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) > 0)).collect(Collectors.toList());
|
||||
|
||||
|
||||
//查询账套对应的扣缴义务人
|
||||
|
|
@ -419,9 +405,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
Long taxAgentId = salarySobPO.getTaxAgentId();
|
||||
//过滤扣税扣缴义务人不包含的人员
|
||||
Collection<Long> employeeIdsInTaxAgent = getTaxAgentService(user).listEmployeeIdsInTaxAgent(taxAgentId);
|
||||
salaryEmployees = salaryEmployees.stream()
|
||||
.filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId()))
|
||||
.collect(Collectors.toList());
|
||||
salaryEmployees = salaryEmployees.stream().filter(salaryEmployee -> employeeIdsInTaxAgent.contains(salaryEmployee.getEmployeeId())).collect(Collectors.toList());
|
||||
|
||||
// 查询薪资档案,获取人员的个税扣缴义务人
|
||||
Set<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
|
|
@ -430,7 +414,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2EmployeePO(employeeIds, salaryAcctRecordPO, salaryArchiveDataDTOS, (long) user.getUID());
|
||||
|
||||
//过滤掉不属于当前账套扣缴义务人的人员
|
||||
salaryAcctEmployeePOS = salaryAcctEmployeePOS.stream().filter(po->Objects.equals(taxAgentId,po.getTaxAgentId())).collect(Collectors.toList());
|
||||
salaryAcctEmployeePOS = salaryAcctEmployeePOS.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList());
|
||||
|
||||
// 保存薪资核算人员
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployeePOS)) {
|
||||
|
|
@ -452,8 +436,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
|
||||
}
|
||||
// 查询薪资核算记录所用的帐套的薪资周期
|
||||
SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(),
|
||||
SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()));
|
||||
SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(), SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()));
|
||||
// 查询薪资档案,获取人员的个税扣缴义务人
|
||||
List<SalaryArchiveDataDTO> salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds);
|
||||
// 转换成薪资核算人员po
|
||||
|
|
@ -462,7 +445,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
|
|||
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
|
||||
//过滤掉不属于当前账套扣缴义务人的人员
|
||||
Long taxAgentId = salarySobPO.getTaxAgentId();
|
||||
newSalaryAcctEmployeePOS = newSalaryAcctEmployeePOS.stream().filter(po->Objects.equals(taxAgentId,po.getTaxAgentId())).collect(Collectors.toList());
|
||||
newSalaryAcctEmployeePOS = newSalaryAcctEmployeePOS.stream().filter(po -> Objects.equals(taxAgentId, po.getTaxAgentId())).collect(Collectors.toList());
|
||||
// 删除以前的薪资核算人员
|
||||
getSalaryAcctEmployeeMapper().deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
|
||||
// 插入新的薪资核算人员
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.salary.component.WeaTableColumnGroup;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
|
||||
|
|
@ -36,6 +37,7 @@ import com.engine.salary.util.valid.ValidUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import dm.jdbc.util.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -110,6 +112,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
|
||||
private SalarySobCheckRuleService salarySobCheckRuleService;
|
||||
|
||||
private SalaryAcctReportService getSalaryAcctReportService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XSSFWorkbook exportSalaryAcctEmployee(SalaryAcctEmployeeQueryParam queryParam) {
|
||||
|
|
@ -502,8 +507,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordId);
|
||||
Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, e -> e.getEmployeeId() + "-" + e.getTaxAgentId());
|
||||
// 租户下所有的人员
|
||||
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll();
|
||||
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAllForReport();
|
||||
Map<String, Long> salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getUsername, DataCollectionEmployee::getEmployeeId);
|
||||
Map<Long, DataCollectionEmployee> emps = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
// 租户下所有的个税扣缴义务人
|
||||
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
|
||||
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
|
||||
|
|
@ -527,6 +533,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
// excel导入了哪些薪资项目
|
||||
Set<Long> excelSalaryItemIds = Sets.newHashSet();
|
||||
List<SalaryAcctResultPO> salaryAcctResults = Lists.newArrayList();
|
||||
List<SalaryAcctResultReportPO> salaryAcctReports = Lists.newArrayList();
|
||||
List<SalaryAcctEmployeePO> newSalaryAcctEmployees = Lists.newArrayList();
|
||||
|
||||
List<ExcelAcctResultPO> excelAcctResults = Lists.newArrayList();
|
||||
|
|
@ -562,6 +569,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
Long employeeId = 0L;
|
||||
Long taxAgentId = 0L;
|
||||
List<SalaryAcctResultPO> salaryAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
|
||||
List<SalaryAcctResultReportPO> salaryAcctResultReportOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
|
||||
List<ExcelAcctResultPO> excelAcctResultsOfOneEmp = Lists.newArrayListWithExpectedSize(headers.size() - 1);
|
||||
for (int j = 0; j < headers.size(); j++) {
|
||||
String header = headers.get(j);
|
||||
|
|
@ -644,6 +652,21 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
salaryAcctResultsOfOneEmp.add(salaryAcctResult);
|
||||
|
||||
|
||||
SalaryAcctResultReportPO reportPO = SalaryAcctResultReportPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.salaryAcctRecordId(salaryAcctRecordPO.getId())
|
||||
.salarySobId(salaryAcctRecordPO.getSalarySobId())
|
||||
.salaryItemId(salaryItemId)
|
||||
.resultValue(dataValue)
|
||||
.creator(currentEmployeeId)
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.deleteType(0)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
salaryAcctResultReportOfOneEmp.add(reportPO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -703,8 +726,24 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
salaryAcctResultPO.setTaxAgentId(taxAgentId);
|
||||
salaryAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
|
||||
}
|
||||
|
||||
for (SalaryAcctResultReportPO po : salaryAcctResultReportOfOneEmp) {
|
||||
po.setEmployeeId(employeeId.toString());
|
||||
po.setTaxAgentId(taxAgentId);
|
||||
po.setSalaryAcctEmpId(salaryAcctEmpId.toString());
|
||||
|
||||
|
||||
DataCollectionEmployee emp = emps.get(employeeId);
|
||||
po.setSubcompanyId(emp.getSubcompanyid());
|
||||
po.setDepartmentId(emp.getDepartmentId());
|
||||
po.setCostcenterId(emp.getCostcenterId());
|
||||
po.setJobtitleId(emp.getJobtitleId());
|
||||
po.setLocationId(emp.getLocationId());
|
||||
|
||||
}
|
||||
salaryAcctEmpIds.add(salaryAcctEmpId);
|
||||
salaryAcctResults.addAll(salaryAcctResultsOfOneEmp);
|
||||
salaryAcctReports.addAll(salaryAcctResultReportOfOneEmp);
|
||||
}
|
||||
successCount++;
|
||||
}
|
||||
|
|
@ -721,9 +760,13 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
if (StringUtils.equals("importSalaryAcctResult", importType)) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmpIds)) {
|
||||
getSalaryAcctResultService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, excelSalaryItemIds);
|
||||
//删除报表
|
||||
getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, excelSalaryItemIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctResults)) {
|
||||
getSalaryAcctResultService(user).batchSave(salaryAcctResults);
|
||||
//报表
|
||||
getSalaryAcctReportService(user).batchSave(salaryAcctReports);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(newSalaryAcctEmployees)) {
|
||||
getSalaryAcctEmployeeService(user).batchSave(newSalaryAcctEmployees);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctReportService getSalaryAcctReportService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalaryAcctRecordPO getById(Long id) {
|
||||
return getSalaryAcctRecordMapper().getById(id);
|
||||
|
|
@ -369,6 +373,8 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
|||
getSalaryAcctEmployeeService(user).deleteBySalaryAcctRecordIds(ids);
|
||||
// 删除薪资核算结果
|
||||
getSalaryAcctResultService(user).deleteBySalaryAcctRecordIds(ids);
|
||||
//报表
|
||||
getSalaryAcctReportService(user).deleteBySalaryAcctRecordIds(ids);
|
||||
// 删除校验异常
|
||||
// salaryCheckResultService.deleteBySalaryAcctRecordIds(ids);
|
||||
// 删除校验异常明细
|
||||
|
|
|
|||
|
|
@ -2,9 +2,15 @@ package com.engine.salary.service.impl;
|
|||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.encrypt.AESEncryptUtil;
|
||||
import com.engine.salary.encrypt.report.SalaryAcctResultReportPOEncrypt;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.mapper.report.SalaryAcctResultReportMapper;
|
||||
import com.engine.salary.service.SalaryAcctReportService;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -18,6 +24,10 @@ import java.util.stream.Collectors;
|
|||
**/
|
||||
public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctReportService {
|
||||
|
||||
private SalaryAcctResultReportMapper getSalaryAcctResultReportMapper() {
|
||||
return MapperProxyFactory.getProxy(SalaryAcctResultReportMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 薪酬解密方法
|
||||
*
|
||||
|
|
@ -43,4 +53,46 @@ public class SalaryAcctReportServiceImpl extends Service implements SalaryAcctRe
|
|||
return AESEncryptUtil.decrypt(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存核算报表数据
|
||||
*
|
||||
* @param pos
|
||||
*/
|
||||
@Override
|
||||
public void batchSave(Collection<SalaryAcctResultReportPO> pos) {
|
||||
if (CollectionUtils.isNotEmpty(pos)) {
|
||||
SalaryAcctResultReportPOEncrypt.encryptList(pos);
|
||||
List<List<SalaryAcctResultReportPO>> partition = Lists.partition((List) pos, 100);
|
||||
partition.forEach(getSalaryAcctResultReportMapper()::batchInsert);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctRecordIds)) {
|
||||
List<List<Long>> partition = Lists.partition((List) salaryAcctRecordIds, 100);
|
||||
partition.forEach(getSalaryAcctResultReportMapper()::deleteBySalaryAcctRecordIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBySalaryAcctRecordId(Long salaryAcctRecordId) {
|
||||
getSalaryAcctResultReportMapper().deleteBySalaryAcctRecordId(salaryAcctRecordId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBySalaryAcctEmpIds(Collection<Long> salaryAcctEmpIds) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmpIds)) {
|
||||
List<String> collect = salaryAcctEmpIds.stream().map(e -> AESEncryptUtil.encrypt(e.toString())).collect(Collectors.toList());
|
||||
getSalaryAcctResultReportMapper().deleteBySalaryAcctEmpIds(collect);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByAcctEmployeeIdsAndSalaryItemIds(Collection<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployeeIds) && CollectionUtils.isNotEmpty(salaryItemIds)) {
|
||||
List<String> salaryAcctEmployeeIdsStr = salaryAcctEmployeeIds.stream().map(e -> AESEncryptUtil.encrypt(e.toString())).collect(Collectors.toList());
|
||||
getSalaryAcctResultReportMapper().deleteByAcctEmpIdsAndSalaryItemIds(salaryAcctEmployeeIdsStr, salaryItemIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.engine.salary.common.LocalDateRange;
|
|||
import com.engine.salary.encrypt.salaryacct.SalaryAcctResultPOEncrypt;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
|
||||
import com.engine.salary.entity.report.bo.SalaryAcctResultReportBO;
|
||||
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculateBO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
|
||||
import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO;
|
||||
|
|
@ -73,27 +75,27 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
|
||||
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
|
||||
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobItemService getSalarySobItemService(User user) {
|
||||
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryItemService getSalaryItemService(User user) {
|
||||
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
|
||||
return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobService getSalarySobService(User user) {
|
||||
return (SalarySobService) ServiceUtil.getService(SalarySobServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
||||
return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
|
|
@ -101,38 +103,42 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||||
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobAdjustRuleService getSalarySobAdjustRuleService(User user) {
|
||||
return (SalarySobAdjustRuleService) ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobAdjustRuleServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctCalculateService getSalaryAcctCalculateService(User user) {
|
||||
return (SalaryAcctCalculateService) ServiceUtil.getService(SalaryAcctCalculateServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctCalculateServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private DataSourceTransactionManager dataSourceTransactionManager;
|
||||
|
||||
private SalaryAcctResultTempService getSalaryAcctResultTempService(User user) {
|
||||
return (SalaryAcctResultTempService) ServiceUtil.getService(SalaryAcctResultTempServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctResultTempServiceImpl.class, user);
|
||||
}
|
||||
// private LoggerTemplate salaryAcctRecordLoggerTemplate;
|
||||
|
||||
private SIAccountService getSIAccountService(User user) {
|
||||
return (SIAccountService) ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private AttendQuoteFieldService getAttendQuoteFieldService(User user) {
|
||||
return (AttendQuoteFieldService) ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
|
||||
return ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctReportService getSalaryAcctReportService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryCheckResultService salaryCheckResultService;
|
||||
|
|
@ -142,8 +148,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS =
|
||||
getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordIds(salaryAcctRecordIds).build());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordIds(salaryAcctRecordIds).build());
|
||||
SalaryAcctResultPOEncrypt.decryptList(salaryAcctResultPOS);
|
||||
return salaryAcctResultPOS;
|
||||
}
|
||||
|
|
@ -231,8 +236,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
* @param queryParam 列表查询条件
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> listBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployeePOS,
|
||||
SalaryAcctResultQueryParam queryParam) {
|
||||
private List<Map<String, Object>> listBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployeePOS, SalaryAcctResultQueryParam queryParam) {
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -263,10 +267,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
|
||||
} else {
|
||||
// 如果查询条件中没有包含"合并计税",那么就需要查询出存在合并计税的人,标记给前端
|
||||
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder()
|
||||
.salaryAcctRecordId(queryParam.getSalaryAcctRecordId())
|
||||
.ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId))
|
||||
.build();
|
||||
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder().salaryAcctRecordId(queryParam.getSalaryAcctRecordId()).ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId)).build();
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = getSalaryAcctEmployeeService(user).listByParam4ConsolidatedTax(accEmployeeQueryParam);
|
||||
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
|
||||
}
|
||||
|
|
@ -281,8 +282,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
return expressFormulaMap.getOrDefault(salarySobItemPO.getFormulaId(), StringUtils.EMPTY);
|
||||
});
|
||||
// 转换成薪资核算结果列表
|
||||
return SalaryAcctResultBO
|
||||
.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, salaryAcctEmployeeIds4ConsolidatedTax, customParameters);
|
||||
return SalaryAcctResultBO.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, salaryAcctEmployeeIds4ConsolidatedTax, customParameters);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -317,8 +317,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(salarySobIds, taxCycleDateRange);
|
||||
// 查询当前薪资核算人员所涉及的合并计税的所有薪资核算人员
|
||||
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
|
||||
salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds,
|
||||
salaryAcctEmployeePO.getEmployeeId(), salaryAcctEmployeePO.getTaxAgentId());
|
||||
salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, salaryAcctEmployeePO.getEmployeeId(), salaryAcctEmployeePO.getTaxAgentId());
|
||||
}
|
||||
// 查询薪资核算人员的薪资核算结果
|
||||
Set<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
|
||||
|
|
@ -332,12 +331,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||
// 转换成合并计税详情dto
|
||||
return SalaryAcctResultBO.convert2ConsolidatedTaxDetailDTO(simpleEmployee, taxAgentPO, salarySobEmpFieldPOS, salaryItemPOS,
|
||||
salaryAcctEmployeePOS, salarySobPOS, salaryAcctRecordPOS, salaryAcctResultPOS);
|
||||
return SalaryAcctResultBO.convert2ConsolidatedTaxDetailDTO(simpleEmployee, taxAgentPO, salarySobEmpFieldPOS, salaryItemPOS, salaryAcctEmployeePOS, salarySobPOS, salaryAcctRecordPOS, salaryAcctResultPOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(SalaryAcctResultSaveParam saveParam) {
|
||||
|
||||
List<DataCollectionEmployee> dataCollectionEmployees = getSalaryEmployeeService(user).listAllForReport();
|
||||
Map<Long, DataCollectionEmployee> emps = SalaryEntityUtil.convert2Map(dataCollectionEmployees, DataCollectionEmployee::getEmployeeId);
|
||||
|
||||
// 查询薪资核算人员
|
||||
SalaryAcctEmployeePO salaryAcctEmployeePO = getSalaryAcctEmployeeService(user).getById(saveParam.getSalaryAcctEmpId());
|
||||
if (Objects.isNull(salaryAcctEmployeePO)) {
|
||||
|
|
@ -353,10 +355,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
SalaryAcctResultPOEncrypt.encryptList(salaryAcctResultPOS);
|
||||
List<List<SalaryAcctResultPO>> partition = Lists.partition(salaryAcctResultPOS, 100);
|
||||
partition.forEach(getSalaryAcctResultMapper()::batchInsert);
|
||||
|
||||
//todo 报表
|
||||
}
|
||||
|
||||
//报表
|
||||
getSalaryAcctReportService(user).deleteBySalaryAcctEmpIds(Collections.singleton(saveParam.getSalaryAcctEmpId()));
|
||||
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2PO(saveParam, salaryAcctEmployeePO, (long) user.getUID(), emps);
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctResultReportPOS)) {
|
||||
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
|
||||
}
|
||||
|
||||
// 查询操作日志的targetName
|
||||
// String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctEmployeePO.getSalaryAcctRecordId());
|
||||
|
|
@ -379,16 +385,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
@Override
|
||||
public void batchSave(Collection<SalaryAcctResultPO> salaryAcctResultPOS) {
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctResultPOS)) {
|
||||
List<SalaryAcctResultPO> list = (List<SalaryAcctResultPO>)salaryAcctResultPOS;
|
||||
List<SalaryAcctResultPO> list = (List<SalaryAcctResultPO>) salaryAcctResultPOS;
|
||||
// 数据加密
|
||||
SalaryAcctResultPOEncrypt.encryptList(list);
|
||||
List<List<SalaryAcctResultPO>> partition = Lists.partition(list, 100);
|
||||
partition.forEach(getSalaryAcctResultMapper()::batchInsert);
|
||||
|
||||
//todo 报表
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteBySalaryAcctEmployeeIds(Collection<Long> salaryAcctEmployeeIds) {
|
||||
getSalaryAcctResultMapper().deleteBySalaryAcctEmpIds(salaryAcctEmployeeIds);
|
||||
|
|
@ -456,14 +461,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
|
||||
}
|
||||
// 11.1、初始化进度
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO()
|
||||
.setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中"))
|
||||
.setTitleLabelId(97515L)
|
||||
.setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1)
|
||||
.setCalculatedQuantity(0)
|
||||
.setProgress(BigDecimal.ZERO)
|
||||
.setStatus(true)
|
||||
.setMessage(StringUtils.EMPTY);
|
||||
SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 500);
|
||||
|
|
@ -475,22 +473,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
String calculateKey = UUID.randomUUID().toString();
|
||||
// 12.4、多线程运算,运算结果存放在临时表中
|
||||
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
|
||||
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
|
||||
.setSalaryAcctRecordPO(salaryAcctRecordPO)
|
||||
.setSalarySobPO(salarySobPO)
|
||||
.setSalarySobCycleDTO(salarySobCycleDTO)
|
||||
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
|
||||
.setSalarySobItemPOS(salarySobItemPOS)
|
||||
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
|
||||
.setExpressFormulas(expressFormulas)
|
||||
.setSalaryItemPOS(salaryItemPOS)
|
||||
.setSalarySobAdjustRulePOS(salarySobAdjustRulePOS)
|
||||
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
|
||||
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
|
||||
.setSalaryAcctEmployeePOS(acctEmployeePOS)
|
||||
.setChildMonitor(childMonitor)
|
||||
.setResults(calculateResults)
|
||||
.setCalculateKey(calculateKey);
|
||||
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO().setSalaryAcctRecordPO(salaryAcctRecordPO).setSalarySobPO(salarySobPO).setSalarySobCycleDTO(salarySobCycleDTO).setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS).setSalarySobItemPOS(salarySobItemPOS).setSalaryItemIdWithPriorityList(salarySobItemsWithPriority).setExpressFormulas(expressFormulas).setSalaryItemPOS(salaryItemPOS).setSalarySobAdjustRulePOS(salarySobAdjustRulePOS).setWelfareColumns(MapUtils.emptyIfNull(welfareColumns)).setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS).setSalaryAcctEmployeePOS(acctEmployeePOS).setChildMonitor(childMonitor).setResults(calculateResults).setCalculateKey(calculateKey);
|
||||
LocalRunnable localRunnable = new LocalRunnable() {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
|
@ -505,10 +488,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus);
|
||||
if (!allSuccess) {
|
||||
// 薪资核算实现的线程的错误信息
|
||||
String errorMsg = calculateResults.stream()
|
||||
.filter(result -> !result.isStatus())
|
||||
.map(SalaryAcctCalculateBO.Result::getErrMsg)
|
||||
.collect(Collectors.joining("|"));
|
||||
String errorMsg = calculateResults.stream().filter(result -> !result.isStatus()).map(SalaryAcctCalculateBO.Result::getErrMsg).collect(Collectors.joining("|"));
|
||||
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), errorMsg);
|
||||
// 删除薪资核算临时存储表中的数据
|
||||
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
|
||||
|
|
@ -558,10 +538,14 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
getSalaryAcctResultMapper().deleteBySalaryAcctEmpIds(calculateParam.getIds());
|
||||
} else {
|
||||
getSalaryAcctResultMapper().deleteBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()));
|
||||
getSalaryAcctReportService(user).deleteBySalaryAcctRecordId(calculateParam.getSalaryAcctRecordId());
|
||||
}
|
||||
// 保存薪资的薪资核算结果
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2ResultPO(salaryAcctResultTempPOS);
|
||||
batchSave(salaryAcctResultPOS);
|
||||
//保存核算报表数据
|
||||
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2ReportPO(salaryAcctResultTempPOS, calculateParam.getEmps());
|
||||
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
|
||||
// 删除薪资核算临时存储表中的数据
|
||||
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
|
||||
// // 提交事务
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
return employBiz.listEmployee();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCollectionEmployee> listAllForReport() {
|
||||
return getEmployMapper().listAllForReport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCollectionEmployee> listBySalarySobId(Long salarySobId) {
|
||||
// 查询薪资账套的人员范围
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ import java.util.stream.Collectors;
|
|||
public class SalaryAcctEmployeeWrapper extends Service {
|
||||
|
||||
private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) {
|
||||
return (SalaryAcctEmployeeService) ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
}
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.impl.*;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
|
|
@ -38,30 +39,34 @@ import java.util.*;
|
|||
public class SalaryAcctResultWrapper extends Service {
|
||||
|
||||
private SalaryAcctResultService getSalaryAcctResultService(User user) {
|
||||
return (SalaryAcctResultService) ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
||||
return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobItemService getSalarySobItemService(User user) {
|
||||
return (SalarySobItemService) ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctEmployeeWrapper getSalaryAcctEmployeeWrapper(User user) {
|
||||
return (SalaryAcctEmployeeWrapper) ServiceUtil.getService(SalaryAcctEmployeeWrapper.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctEmployeeWrapper.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctProgressService getSalaryAcctProgressService(User user) {
|
||||
return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user);
|
||||
}
|
||||
|
||||
// private SalaryCheckResultService salaryCheckResultService;
|
||||
|
||||
|
||||
private SalaryAcctExcelService getSalaryAcctExcelService(User user) {
|
||||
return (SalaryAcctExcelService) ServiceUtil.getService(SalaryAcctExcelServiceImpl.class, user);
|
||||
return ServiceUtil.getService(SalaryAcctExcelServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,6 +188,11 @@ public class SalaryAcctResultWrapper extends Service {
|
|||
*/
|
||||
public void calculate(SalaryAcctCalculateParam calculateParam) {
|
||||
log.info("开始核算V1{}", calculateParam);
|
||||
|
||||
//报表参数
|
||||
List<DataCollectionEmployee> emps = getSalaryEmployeeService(user).listAllForReport();
|
||||
calculateParam.setEmps(SalaryEntityUtil.convert2Map(emps,DataCollectionEmployee::getEmployeeId));
|
||||
|
||||
//当前登陆人员
|
||||
DataCollectionEmployee simpleEmployee = new DataCollectionEmployee();
|
||||
simpleEmployee.setEmployeeId((long) user.getUID());
|
||||
|
|
|
|||
Loading…
Reference in New Issue