Merge branch 'release/2.16.1.2410.01' into custom/领悦

This commit is contained in:
Harryxzy 2024-10-21 18:05:27 +08:00
commit dd7905ac1c
41 changed files with 390 additions and 184 deletions

View File

@ -1,5 +1,5 @@
log=false
defaultCloseNonStandard149=true
AESEncryptScrect=990EB004A1C862721C1513AE90038C9E
version=2.15.2.2409.01
version=2.16.1.2410.01
openFormulaForcedEditing=false

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_acct_emp add lock_items varchar2(4000) NULL;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_acct_emp add lock_items varchar2(4000) NULL;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_acct_emp add lock_items varchar2(4000) NULL;
/

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_salary_acct_emp ADD COLUMN lock_items varchar(4000);

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_acct_emp add lock_items varchar2(4000) NULL
/

View File

@ -0,0 +1 @@
alter table hrsa_salary_acct_emp add lock_items varchar(4000);

View File

@ -0,0 +1,2 @@
ALTER TABLE hrsa_salary_acct_emp ADD lock_items varchar(4000)
GO

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_acct_emp add lock_items varchar2(4000) NULL;
/

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.datacollection.po;
import com.engine.salary.annotation.Encrypt;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -41,6 +42,7 @@ public class VariableArchiveItemPO {
/**
* 浮动值
*/
@Encrypt
private String itemValue;
/**

View File

@ -4,7 +4,6 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.datacollection.po.VariableItemPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
@ -49,13 +48,6 @@ public class SalaryAcctCalculateBO {
*/
private SalarySobCycleDTO salarySobCycleDTO;
/**
* 核算锁定值
*/
private Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS;
private List<Long> lockSalaryItemIds;
/**
* 相同税款所属期内其他薪资核算记录薪资类型为工资薪金的账套的
*/

View File

@ -316,8 +316,8 @@ public class SalaryAcctResultBO {
}
// 主键id
map.put("id", e.getId());
//锁定状态
map.put("lockStatus", LockStatusEnum.getByValue(e.getLockStatus()).getDefaultLabel());
//锁定数据
map.put("lockItems", e.getLockItems() != null ? e.getLockItems().stream().filter(Objects::nonNull).map(Object::toString).collect(Collectors.toList()) : new ArrayList<>());
//人员id
map.put("employeeId", e.getEmployeeId());
// 个税扣缴义务人

View File

@ -0,0 +1,34 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 薪资数据单元格锁定
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SalaryAcctResultLockParam {
//锁定状态
@DataCheck(require = true,message = "锁定状态不能为空")
private LockStatusEnum lockStatus;
//薪资核算人员Id
@DataCheck(require = true,message = "薪资核算人员不能为空")
private Long acctEmpId;
//薪资项目的Id
@DataCheck(require = true,message = "薪资项目不能为空")
private Long salaryItemId;
}

View File

@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* 薪资核算人员
@ -110,6 +111,7 @@ public class SalaryAcctEmployeePO {
private Date updateTime;
@Deprecated
@ElogTransform(name = "锁定状态")
private Integer lockStatus;
@ -142,6 +144,9 @@ public class SalaryAcctEmployeePO {
*/
private String status;
//锁定的项目
private List<Long> lockItems;
//--------条件----------
//主键id集合

View File

@ -131,6 +131,7 @@ public class SalaryAcctRecordPO {
/**
* 锁定的薪资项目
*/
@Deprecated
private List<Long> lockSalaryItemIds;
//查询条件-------------------------------

View File

@ -261,8 +261,11 @@ public class SalaryAcctManager extends Service {
// 7查询考勤引用的所有字段
List<AttendQuoteFieldListDTO> attendQuoteFieldListDTOS = getAttendQuoteFieldService(user).listAll();
// //核算锁定值
// List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
//fixme 先全部锁定
// //将除重新核算的项目外的所有的值都锁定
// List<Long> salaryItemIds = calculateParam.getSalaryItemIds();
// List<Long> lockSalaryItemIds = salaryItemPOS.stream().map(SalaryItemPO::getId).filter(id -> !salaryItemIds.contains(id)).collect(Collectors.toList());
// Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
// if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
// List<SalaryAcctResultPO> acctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
@ -273,19 +276,6 @@ public class SalaryAcctManager extends Service {
// .collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
// }
//将除重新核算的项目外的所有的值都锁定
List<Long> salaryItemIds = calculateParam.getSalaryItemIds();
List<Long> lockSalaryItemIds = salaryItemPOS.stream().map(SalaryItemPO::getId).filter(id -> !salaryItemIds.contains(id)).collect(Collectors.toList());
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
List<SalaryAcctResultPO> acctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
acctResults = Optional.ofNullable(acctResultPOS)
.orElse(new ArrayList<>())
.stream()
.filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId()))
.collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
}
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
@ -323,8 +313,6 @@ public class SalaryAcctManager extends Service {
.setSalarySobPO(salarySobPO)
.setSalarySobCycleDTO(salarySobCycleDTO)
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
.setLockSalaryItemIds(lockSalaryItemIds)
.setSalarySobItemPOS(salarySobItemPOS)
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
.setExpressFormulas(expressFormulas)

View File

@ -84,4 +84,6 @@ public interface VariableArchiveItemMapper {
void deleteByIds(@Param("collection")List<Long> part);
void deleteByArchiveIds(@Param("collection")List<Long> part);
void updateBatchSelective(@Param("list")List<VariableArchiveItemPO> variableArchiveItemPOS);
}

View File

@ -312,6 +312,22 @@
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateBatchSelective">
update hrsa_variable_archive_item
<trim prefix="set" suffixOverrides=",">
<trim prefix="item_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.itemValue != null">
when id = #{item.id} then #{item.itemValue}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<!-- 根据主键删除记录 -->

View File

@ -257,7 +257,7 @@
</if>
<!-- 工号 -->
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{workcode}+'%'
AND e.workcode like '%'+#{param.workcode}+'%'
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">

View File

@ -124,4 +124,6 @@ public interface SalaryAcctEmployeeMapper {
void lockByRecordId(@Param("lockStatus") Integer lockStatus, @Param("recordId") Long recordId);
void updateIgnoreNull(@Param("salaryAcctEmployeePO")SalaryAcctEmployeePO salaryAcctEmployeePO);
void lock(SalaryAcctEmployeePO salaryAcctEmployeePO);
}

View File

@ -25,6 +25,7 @@
<result column="jobcall" property="jobcall"/>
<result column="jobcall_id" property="jobcallId"/>
<result column="status" property="status"/>
<result column="lock_items" property="lockItems" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
</resultMap>
<resultMap id="SalaryAccEmployeeCountMap"
@ -58,7 +59,8 @@
t.jobtitle_id,
t.jobcall,
t.jobcall_id,
t.status
t.status,
t.lock_items
</sql>
<sql id="emp1Column">
@ -966,6 +968,7 @@
<result column="jobcall" property="jobcall"/>
<result column="jobcall_id" property="jobcallId"/>
<result column="status" property="status"/>
<result column="lock_items" property="lockItems" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
</resultMap>
<!-- 表字段 -->
@ -994,6 +997,7 @@
, t.jobcall
, t.jobcall_id
, t.status
, t.lock_items
</sql>
@ -1166,4 +1170,13 @@
WHERE id = #{salaryAcctEmployeePO.id} AND delete_type = 0
</update>
<update id="lock" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO">
UPDATE hrsa_salary_acct_emp
<set>
lock_items =
#{lockItems, jdbcType=ARRAY, typeHandler=com.engine.salary.handle.SalaryListTypeHandler},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
</mapper>

View File

@ -265,7 +265,7 @@
AND payment_organization = #{paymentOrganization}
AND fund_scheme_id is not null
AND fund_start_time is not null AND fund_start_time <![CDATA[ <= ]]> #{billMonth}
AND (fund_end_time is null OR fund_end_time <![CDATA[ >= ]]> #{billMonth})
AND (fund_end_time is null OR fund_end_time <![CDATA[ >= ]]> #{billMonth} OR fund_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -248,7 +248,7 @@
AND payment_organization = #{paymentOrganization}
AND other_scheme_id is not null
AND other_start_time is not null AND other_start_time <![CDATA[ <= ]]> #{billMonth}
AND (other_end_time is null OR other_end_time <![CDATA[ >= ]]> #{billMonth})
AND (other_end_time is null OR other_end_time <![CDATA[ >= ]]> #{billMonth} OR other_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -909,7 +909,7 @@
AND payment_organization = #{paymentOrganization}
AND social_scheme_id is not null
AND social_start_time is not null AND social_start_time <![CDATA[ <= ]]> #{billMonth}
AND (social_end_time is null OR social_end_time <![CDATA[ >= ]]> #{billMonth})
AND (social_end_time is null OR social_end_time <![CDATA[ >= ]]> #{billMonth} OR social_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -131,11 +131,10 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
@Override
public List<Map<String, String>> getDatas(Attend4Salary attend4Salary) {
ValidUtil.doValidator(attend4Salary);
log.info("salaryAttend开始获取的考勤数据参数{}", attend4Salary);
List<Map<String, String>> list = new ArrayList<>();
try {
ValidUtil.doValidator(attend4Salary);
Map<String, Object> paramsMap = new HashMap<String, Object>();
paramsMap.put("pageIndex", 1);
paramsMap.put("pageSize", 500);
@ -152,6 +151,8 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("data", JSONObject.toJSONString(paramsMap));
temp.put("reportType", "month");
log.info("salaryAttend开始获取的考勤数据参数{}", temp);
list = (List<Map<String, String>>) commandExecutor.execute(new GetKQReportCmd(temp, user)).get("datas");
if (isLog) {
log.info("salaryAttend获取的考勤数据{}", JSONUtils.toJSONString(list));

View File

@ -267,4 +267,6 @@ public interface SalaryAcctEmployeeService {
* @param salaryAcctEmployeePO
*/
void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO);
void lock(SalaryAcctEmployeePO salaryAcctEmployeePO);
}

View File

@ -157,6 +157,13 @@ public interface SalaryAcctResultService {
*/
List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndTaxAgentIds(Collection<Long> salaryAcctRecordIds, Collection<Long> taxAgentIds);
/**
* 锁定单元格
* @param param
*/
void lock(SalaryAcctResultLockParam param);
/**
* 锁定项目
*

View File

@ -12,6 +12,7 @@ import java.util.List;
*/
public interface VariableArchiveItemService {
List<VariableArchiveItemPO> listAll();
/**
* 根据浮动薪资档案id获取
*

View File

@ -40,7 +40,7 @@ public interface VariableArchiveService {
* @param variableArchives
* @return
*/
List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives);
List<Map<String, Object>> buildVariableArchiveData(List<VariableArchiveListDTO> variableArchives);
/**
* 创建浮动薪酬档案
@ -70,4 +70,6 @@ public interface VariableArchiveService {
void deleteSelectVariableArchive(Collection<Long> deleteIds);
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, Long taxAgentId);
void updateData(VariableArchiveSaveParam updateParam);
}

View File

@ -382,7 +382,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
List<Long> employeeIds = SalaryEntityUtil.properties(salaryEmployees, DataCollectionEmployee::getEmployeeId, Collectors.toList());
List<SalaryArchiveDataDTO> salaryArchiveDataDTOS = getSalaryArchiveService(user).getSalaryArchiveTaxAgentData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
// 转换成薪资核算人员po
Date salaryDate = SalaryDateUtil.dateStrToLocalTime(salaryYearMonth + "-01");
Date salaryDate = SalaryDateUtil.dateStrToLocalDate(salaryYearMonth + "-01");
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = SalaryAcctEmployeeBO.convert2Employee(salaryEmployees, SalaryAcctRecordPO.builder().salarySobId(salarySobId).salaryMonth(salaryDate).build(), salaryArchiveDataDTOS, (long) user.getUID());
//过滤掉不属于当前账套扣缴义务人的人员

View File

@ -31,7 +31,6 @@ import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.StopWatch;
@ -162,6 +161,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
sw.start("查询薪资核算人员的薪资核算结果");
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
Map<String, String> empItemValueMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOS, p -> p.getSalaryAcctEmpId() + "_" + p.getSalaryItemId(), SalaryAcctResultPO::getResultValue);
sw.stop();
// 查询浮动薪资
sw.start("查询浮动薪资");
@ -174,8 +174,6 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
salaryAcctResultPOMap.put(et.getKey(), et.getValue().get(0).getOriginResultValue());
}
//核算锁定的值
Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS());
sw.stop();
// 9查询相同税款所属期内涉及合并计税的其他薪资核算结果
sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果");
@ -210,6 +208,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
StringBuffer noticeMsg = new StringBuffer();
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
List<Long> lockItems = salaryAcctEmployeePO.getLockItems();
//1 获取当前薪资核算人员的公式中的变量的值
List<CalculateFormulaVarBO.FormulaVarValue> formulaVarValues = formulaVarMap.get(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
//2 人员信息
@ -272,9 +271,10 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 处理小数点
resultValue = SalaryAcctFormulaBO.roundResultValue(resultValue, salaryItemPO, salarySobBackItems, salarySobBackItemMap, salaryItemIdKeySalarySobItemPOMap);
//是否锁定
if (salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId) != null) {
resultValue = salaryAcctLockResultPOS.get(salaryItemId + "_" + salaryAcctEmployeePOId).getResultValue();
if (lockItems != null && lockItems.contains(salaryItemId)) {
resultValue = empItemValueMap.get(salaryAcctEmployeePOId + "_" + salaryItemId);
}
// 将已经计算过的薪资项目的值转换成公式变量的值添加到集合中
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();

View File

@ -9,6 +9,7 @@ import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctConfig;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeCountDTO;
import com.engine.salary.entity.salaryacct.param.*;
@ -16,6 +17,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
@ -108,6 +110,11 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
}
private SalaryAcctSobConfigService getSalaryAcctSobConfigService(User user) {
return ServiceUtil.getService(SalaryAcctSobConfigServiceImpl.class, user);
}
private boolean isRealOrg = "1".equals(getSalaryCacheService(user).get(REPORT_ORGANIZATIN_TYPE));
@Override
@ -695,7 +702,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
if (isRealOrg) {
employeeList = employeeList.stream().filter(emp -> subCompanyIds.contains(emp.getSubcompanyid())).collect(Collectors.toList());
} else {
list.stream().filter(emp -> subCompanyIds.contains(emp.getSubcompanyId())).collect(Collectors.toList());
list = list.stream().filter(emp -> subCompanyIds.contains(emp.getSubcompanyId())).collect(Collectors.toList());
}
}
@ -769,12 +776,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
@Override
public void lockEmp(SalaryAcctResultUpdateLockStatusParam updateParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(updateParam.getSalaryAcctRecordId());
if (CollectionUtils.isEmpty(salaryAcctRecord.getLockSalaryItemIds())) {
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<>());
}
List<SalaryAcctEmployeePO> salaryAcctEmployees = listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
List<SalaryAcctEmployeePO> salaryAcctEmployees = listByIds(updateParam.getAcctEmpIds());
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
return;
}
@ -784,13 +786,20 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
throw new SalaryRunTimeException("锁定状态异常!");
}
Set<Long> acctEmpIds = updateParam.getAcctEmpIds();
if (CollUtil.isNotEmpty(acctEmpIds)) {
//锁定指定人员
getSalaryAcctEmployeeMapper().lockByAcctEmpIds(lockStatus.getValue(), acctEmpIds);
} else {
//锁定全部
getSalaryAcctEmployeeMapper().lockByRecordId(lockStatus.getValue(), updateParam.getSalaryAcctRecordId());
if (updateParam.getLockStatus() == LockStatusEnum.LOCK){
SalaryAcctConfig salaryAcctSobConfig = getSalaryAcctSobConfigService(user).getSalaryAcctConfig(updateParam.getSalaryAcctRecordId());
List<SalarySobItemPO> salarySobItems = salaryAcctSobConfig.getSalarySobItems();
List<Long> itemIds = SalaryEntityUtil.properties(salarySobItems, SalarySobItemPO::getSalaryItemId,Collectors.toList());
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
salaryAcctEmployeePO.setLockItems(itemIds);
lock(salaryAcctEmployeePO);
});
}else {
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
salaryAcctEmployeePO.setLockItems(new ArrayList<>());
lock(salaryAcctEmployeePO);
});
}
}
@ -798,4 +807,9 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
public void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO) {
getSalaryAcctEmployeeMapper().updateIgnoreNull(salaryAcctEmployeePO);
}
@Override
public void lock(SalaryAcctEmployeePO salaryAcctEmployeePO) {
getSalaryAcctEmployeeMapper().lock(salaryAcctEmployeePO);
}
}

View File

@ -58,11 +58,9 @@ import com.engine.salary.wrapper.SalarySobItemWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.wbi.util.Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
@ -70,7 +68,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StopWatch;
import weaver.file.ImageFileManager;
import weaver.hrm.User;
@ -1036,6 +1034,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
}
private Map<String, Object> batchImport(SalaryAcctImportParam param, String importType) {
StopWatch stopWatch = new StopWatch("导入核算数据");
stopWatch.start("数据准备");
Map<String, Object> apidatas = new HashMap<String, Object>();
ValidUtil.doValidator(param);
Date now = new Date();
@ -1053,27 +1053,38 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (salaryAcctRecordPO == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
}
stopWatch.stop();
// 薪资账套下的薪资项目副本
stopWatch.start("薪资账套下的薪资项目副本");
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
// 薪资项目
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
Map<String, Long> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getName, SalaryItemPO::getId);
stopWatch.stop();
// 薪资核算确认的人员
stopWatch.start("薪资核算确认的人员");
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salaryAcctRecordId);
Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, e -> e.getEmployeeId() + "-" + e.getTaxAgentId());
stopWatch.stop();
// 租户下所有的人员
stopWatch.start("薪资核算确认的人员");
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);
stopWatch.stop();
// 租户下所有的个税扣缴义务人
stopWatch.start("租户下所有的个税扣缴义务人");
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
stopWatch.stop();
// 薪资核算人员信息字段
stopWatch.start("薪资核算人员信息字段");
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
List<String> salarySobEmpFields = SalaryEntityUtil.properties(new SalarySobItemAggregateBO().buildEmpField(salarySobEmpFieldPOS), SalarySobEmpFieldDTO::getFieldName, Collectors.toList());
List<String> excludeFields = Arrays.asList("个税扣缴义务人", "部门", "姓名");
salarySobEmpFields = salarySobEmpFields.stream().filter(field -> !excludeFields.contains(field)).collect(Collectors.toList());
stopWatch.stop();
// 索引(用于计算进度)
int index = 0;
// 失败的数量
@ -1103,10 +1114,10 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
stopWatch.start("解析文件");
Workbook workbook = ExcelSupport.parseFile(fileInputStream, EXCEL_TYPE_XLSX);
Sheet sheet = workbook.getSheetAt(0);
stopWatch.stop();
// 错误提示信息
List<Map> excelComments = Lists.newArrayList();
@ -1125,7 +1136,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
List<Map<String, Object>> data;
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
data = ExcelParseHelper.parse2Map(workbook, 0, 2, 1);
data = ExcelParseHelper.parse2Map(sheet, 2, 1);
// } else {
// data = ExcelParseHelper.parse2Map(sheet, 1);
// }
@ -1136,6 +1147,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (CollectionUtils.isEmpty(data)) {
throw new RuntimeException("无数据");
}
stopWatch.start("解析数据");
for (int i = 0; i < data.size(); i++) {
String row = "" + (i + 3) + "";
@ -1257,19 +1269,19 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
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);
// 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);
}
}
}
@ -1346,29 +1358,31 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
salaryAcctResultPO.setSalaryAcctEmpId(salaryAcctEmpId);
}
for (SalaryAcctResultReportPO po : salaryAcctResultReportOfOneEmp) {
po.setEmployeeId(Util.null2String(employeeId));
po.setTaxAgentId(taxAgentId);
po.setSalaryAcctEmpId(Util.null2String(salaryAcctEmpId));
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());
}
// for (SalaryAcctResultReportPO po : salaryAcctResultReportOfOneEmp) {
// po.setEmployeeId(Util.null2String(employeeId));
// po.setTaxAgentId(taxAgentId);
// po.setSalaryAcctEmpId(Util.null2String(salaryAcctEmpId));
//
// 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);
// salaryAcctReports.addAll(salaryAcctResultReportOfOneEmp);
}
successCount++;
}
stopWatch.stop();
// 如果sheet包含错误数据
// if (CollectionUtils.isNotEmpty(errorDatas)) {
// salaryBatchService.createErrorExcelSheet(headers, errorDatas, excelSheet.getName(), excelComments, errorExcelSheets);
// }
stopWatch.start("插入数据");
if (StringUtils.equals("importExcelAcctResult", importType)) {
getSalaryComparisonResultService(user).deleteBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecordId));
if (CollectionUtils.isNotEmpty(excelAcctResults)) {
@ -1392,16 +1406,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (CollectionUtils.isNotEmpty(salaryAcctResults)) {
// 处理导入薪资项的回算值
handleOriginResultValue(deleteResults, salaryAcctResults);
// 备份一份加密前的值
List<SalaryAcctResultPO> list4log = new ArrayList<>();
salaryAcctResults.stream().forEach(source -> {
SalaryAcctResultPO target = new SalaryAcctResultPO();
BeanUtils.copyProperties(source, target);
list4log.add(target);
});
getSalaryAcctResultService(user).batchSave(salaryAcctResults);
// 记录操作日志 TODO 这里的数据没有idid是自增的重新查数据太多效率太低
// 记录操作日志
SalarySobPO salarySobPO = getSalarySobService(user).getById(salaryAcctRecordPO.getSalarySobId());
String targetName = salarySobPO.getName() + ":" + SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth());
LoggerContext loggerContext = new LoggerContext<>();
@ -1411,16 +1418,17 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "导入薪资核算数据"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "导入薪资核算数据 ") + targetName);
loggerContext.setOldValueList(list4log);
SalaryElogConfig.salaryAcctRecordLoggerTemplate.write(loggerContext);
//报表
getSalaryAcctReportService(user).batchSave(salaryAcctReports);
// //报表
// getSalaryAcctReportService(user).batchSave(salaryAcctReports);
}
if (CollectionUtils.isNotEmpty(newSalaryAcctEmployees)) {
getSalaryAcctEmployeeService(user).batchSave(newSalaryAcctEmployees);
}
}
stopWatch.stop();
stopWatch.start("锁定数据");
SalarySysConfPO autoLock = getSalarySysConfService(user).getOneByCode(SalarySysConstant.EDIT_IMPORT_AUTO_LOCK);
if (autoLock != null && StringUtils.equals(autoLock.getConfValue(), "1")) {
// 导入的列都自动锁定
@ -1430,6 +1438,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
.lockStatus(LockStatusEnum.LOCK).build();
getSalaryAcctResultService(user).updateLockStatusByParam(updateLockStatusParam);
}
stopWatch.stop();
log.info(stopWatch.prettyPrint());
apidatas.put("successCount", successCount);
apidatas.put("errorCount", failCount);

View File

@ -1,6 +1,5 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
@ -17,7 +16,6 @@ import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.report.bo.SalaryAcctResultReportBO;
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
import com.engine.salary.entity.salaryacct.bo.*;
import com.engine.salary.entity.salaryacct.dto.ConsolidatedTaxDetailDTO;
@ -52,7 +50,6 @@ import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
@ -682,12 +679,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
List<List<SalaryAcctResultPO>> partition = Lists.partition(salaryAcctResultPOS, 100);
partition.forEach(getSalaryAcctResultMapper()::batchInsert);
}
//报表 todo
getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(Collections.singletonList(saveParam.getSalaryAcctEmpId()), saveItemIds);
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2PO(saveParam, salaryAcctEmployeePO, (long) user.getUID(), emps);
if (CollectionUtils.isNotEmpty(salaryAcctResultReportPOS)) {
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
}
//报表
// getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(Collections.singletonList(saveParam.getSalaryAcctEmpId()), saveItemIds);
// List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2PO(saveParam, salaryAcctEmployeePO, (long) user.getUID(), emps);
// if (CollectionUtils.isNotEmpty(salaryAcctResultReportPOS)) {
// getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
// }
// 存储薪资核算结果数据来源日志
@ -833,21 +830,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
}
//核算锁定值
List<Long> lockSalaryItemIds = salaryAcctRecordPO.getLockSalaryItemIds();
Map<String, SalaryAcctResultPO> acctResults = new HashMap<>();
if (CollUtil.isNotEmpty(lockSalaryItemIds)) {
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()), lockSalaryItemIds);
acctResults = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId())).collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
}
List<Long> lockEmpIds = salaryAcctEmployeePOS.stream().filter(po -> LockStatusEnum.LOCK.getValue().equals(po.getLockStatus())).map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(lockEmpIds)) {
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctEmployeeIds(lockEmpIds);
Map<String, SalaryAcctResultPO> acctResultMaps = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
acctResults.putAll(acctResultMaps);
}
stopWatch.stop();
stopWatch.start("核算耗时");
@ -876,8 +858,6 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
.setSalarySobPO(salarySobPO)
.setSalarySobCycleDTO(salarySobCycleDTO)
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
.setLockSalaryItemIds(lockSalaryItemIds)
.setSalarySobItemPOS(salarySobItemPOS)
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
.setExpressFormulas(expressFormulas)
@ -1020,13 +1000,32 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// return salaryAcctEmployeeService.filterByAuthority(salaryAcctEmployees, employeeId);
// }
@Override
public void lock(SalaryAcctResultLockParam param) {
ValidUtil.doValidator(param);
SalaryAcctEmployeePO salaryAcctEmployeePO = getSalaryAcctEmployeeService(user).getById(param.getAcctEmpId());
if (salaryAcctEmployeePO == null) {
return;
}
List<Long> lockItemIds = salaryAcctEmployeePO.getLockItems() == null ? new ArrayList<>() : salaryAcctEmployeePO.getLockItems();
Long salaryItemId = param.getSalaryItemId();
if (param.getLockStatus() == LockStatusEnum.LOCK) {
lockItemIds.add(salaryItemId);
} else {
lockItemIds.removeIf(salaryItemId::equals);
}
salaryAcctEmployeePO.setLockItems(Lists.newArrayList(new HashSet(lockItemIds)));
getSalaryAcctEmployeeService(user).lock(salaryAcctEmployeePO);
}
@Override
public void updateLockStatusByParam(SalaryAcctResultUpdateLockStatusParam updateParam) {
// 查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecord = getSalaryAcctRecordService(user).getById(updateParam.getSalaryAcctRecordId());
if (CollectionUtils.isEmpty(salaryAcctRecord.getLockSalaryItemIds())) {
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<>());
}
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(updateParam.getSalaryAcctRecordId());
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
return;
@ -1038,15 +1037,18 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
} else {
salaryItemIds = Collections.singleton(updateParam.getSalaryItemId());
}
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
Set<Long> lockSalaryItemIds = new HashSet<>();
lockSalaryItemIds.addAll(salaryAcctRecord.getLockSalaryItemIds());
lockSalaryItemIds.addAll(salaryItemIds);
salaryAcctRecord.setLockSalaryItemIds(new ArrayList<Long>(lockSalaryItemIds));
} else {
salaryAcctRecord.getLockSalaryItemIds().removeAll(salaryItemIds);
}
getSalaryAcctRecordService(user).updateLockSalaryItemIds(salaryAcctRecord);
salaryAcctEmployees.forEach(salaryAcctEmployeePO -> {
List<Long> lockItemIds = salaryAcctEmployeePO.getLockItems() == null ? new ArrayList<>() : salaryAcctEmployeePO.getLockItems();
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
lockItemIds.addAll(salaryItemIds);
} else {
lockItemIds.removeAll(salaryItemIds);
}
salaryAcctEmployeePO.setLockItems(Lists.newArrayList(new HashSet(lockItemIds)));
getSalaryAcctEmployeeService(user).lock(salaryAcctEmployeePO);
});
}
@ -1076,7 +1078,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
return Collections.emptyList();
}
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 200);
List<List<Long>> partition = Lists.partition(salaryAcctEmployeeIds, 200);
List<SalaryAcctResultPO> result = new ArrayList<>();
partition.forEach(empIds -> {
SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).salaryItemIds(salaryItemIds).build();
@ -1189,30 +1191,30 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
// 报表
SalaryAcctResultReportPO po = SalaryAcctResultReportPO.builder()
.id(IdGenerator.generate())
.salarySobId(salaryAcctRecordPO.getSalarySobId())
.salaryItemId(param.getSalaryItemId())
.salaryAcctRecordId(param.getSalaryAcctRecordId())
.salaryAcctEmpId(salaryAcctEmployeePO.getId().toString())
.employeeId(salaryAcctEmployeePO.getEmployeeId().toString())
.taxAgentId(salaryAcctEmployeePO.getTaxAgentId())
.resultValue(param.getValue())
.creator(Long.valueOf(user.getUID()))
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
DataCollectionEmployee dataCollectionEmployee = emps.get(salaryAcctEmployeePO.getEmployeeId());
if (dataCollectionEmployee != null) {
po.setDepartmentId(dataCollectionEmployee.getDepartmentId());
po.setSubcompanyId(dataCollectionEmployee.getSubcompanyid());
po.setCostcenterId(dataCollectionEmployee.getCostcenterId());
po.setJobtitleId(dataCollectionEmployee.getJobtitleId());
po.setLocationId(dataCollectionEmployee.getLocationId());
}
salaryAcctResultReportPOS.add(po);
// SalaryAcctResultReportPO po = SalaryAcctResultReportPO.builder()
// .id(IdGenerator.generate())
// .salarySobId(salaryAcctRecordPO.getSalarySobId())
// .salaryItemId(param.getSalaryItemId())
// .salaryAcctRecordId(param.getSalaryAcctRecordId())
// .salaryAcctEmpId(salaryAcctEmployeePO.getId().toString())
// .employeeId(salaryAcctEmployeePO.getEmployeeId().toString())
// .taxAgentId(salaryAcctEmployeePO.getTaxAgentId())
// .resultValue(param.getValue())
// .creator(Long.valueOf(user.getUID()))
// .createTime(now)
// .updateTime(now)
// .deleteType(NumberUtils.INTEGER_ZERO)
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
// .build();
// DataCollectionEmployee dataCollectionEmployee = emps.get(salaryAcctEmployeePO.getEmployeeId());
// if (dataCollectionEmployee != null) {
// po.setDepartmentId(dataCollectionEmployee.getDepartmentId());
// po.setSubcompanyId(dataCollectionEmployee.getSubcompanyid());
// po.setCostcenterId(dataCollectionEmployee.getCostcenterId());
// po.setJobtitleId(dataCollectionEmployee.getJobtitleId());
// po.setLocationId(dataCollectionEmployee.getLocationId());
// }
// salaryAcctResultReportPOS.add(po);
});
// 入库
@ -1225,8 +1227,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
batchSave(needInsertList);
// 报表入库前先删除
getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(param.getIdList(), Collections.singletonList(param.getSalaryItemId()));
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
// getSalaryAcctReportService(user).deleteByAcctEmployeeIdsAndSalaryItemIds(param.getIdList(), Collections.singletonList(param.getSalaryItemId()));
// getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.mapper.datacollection.VariableArchiveItemMapper;
import com.engine.salary.service.VariableArchiveItemService;
@ -18,11 +19,17 @@ import java.util.List;
* @description 浮动薪酬档案明细
*/
public class VariableArchiveItemServiceImpl extends Service implements VariableArchiveItemService {
private EncryptUtil encryptUtil = new EncryptUtil();
private VariableArchiveItemMapper getVariableArchiveItemMapper(){
return MapperProxyFactory.getProxy(VariableArchiveItemMapper.class);
}
@Override
public List<VariableArchiveItemPO> listAll() {
return getVariableArchiveItemMapper().listAll();
}
/**
* 根据浮动薪资档案id获取
*
@ -34,7 +41,8 @@ public class VariableArchiveItemServiceImpl extends Service implements VariableA
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return Collections.emptyList();
}
return getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
return encryptUtil.decryptList(variableArchiveItemPOS, VariableArchiveItemPO.class);
}
/**
@ -52,6 +60,7 @@ public class VariableArchiveItemServiceImpl extends Service implements VariableA
if (CollectionUtils.isEmpty(insertList)) {
return 0;
}
encryptUtil.encryptList(insertList, VariableArchiveItemPO.class);
List<List<VariableArchiveItemPO>> partition = Lists.partition(insertList, 50);
partition.forEach(part -> getVariableArchiveItemMapper().batchInsert(part));
return 0;

View File

@ -151,10 +151,7 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
* @return
*/
@Override
public List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives) {
if (CollectionUtils.isEmpty(variableArchives)) {
// 无数据
}
public List<Map<String, Object>> buildVariableArchiveData(List<VariableArchiveListDTO> variableArchives) {
List<Long> variableArchiveIds = variableArchives.stream().map(VariableArchiveListDTO::getId).collect(Collectors.toList());
// 获取浮动薪资档案所对应的浮动薪资项目数据
List<VariableArchiveItemPO> variableArchiveItemList = getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
@ -209,9 +206,7 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(saveParam.getSalaryMonthDate()).taxAgentId(saveParam.getTaxAgentIds()).employeeId(saveParam.getEmployeeId()).build());
if (CollectionUtils.isNotEmpty(variableArchivePOList)) {
// 先删除原有档案
List<Long> variableArchiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
getVariableArchiveMapper().deleteByIds(variableArchiveIds);
throw new SalaryRunTimeException("已存在浮动薪酬数据");
}
// 保存浮动薪资档案信息
@ -602,4 +597,41 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
List<VariableArchiveListDTO> variableArchiveListDTO = list(queryParam);
return buildVariableArchiveData(variableArchiveListDTO);
}
@Override
public void updateData(VariableArchiveSaveParam updateParam) {
if (updateParam.getId() == null) {
throw new SalaryRunTimeException("参数错误");
}
// 获取浮动薪酬档案
VariableArchivePO variableArchivePO = getVariableArchiveMapper().getById(updateParam.getId());
if (variableArchivePO == null) {
throw new SalaryRunTimeException("浮动薪酬档案不存在或已被删除");
}
// 删除原有的浮动薪酬档案明细
getVariableArchiveItemService(user).deleteByArchiveIds(Collections.singletonList(updateParam.getId()));
// 保存浮动薪资档案详细信息
List<VariableArchiveItemPO> variableArchiveItemList = new ArrayList<>();
Date now = new Date();
updateParam.getItemValueList().forEach(e -> {
variableArchiveItemList.add(VariableArchiveItemPO.builder()
.id(IdGenerator.generate())
.employeeId(updateParam.getEmployeeId())
.variableArchiveId(variableArchivePO.getId())
.variableItemId(e.getVariableItemId())
.itemValue(e.getItemValue())
.creator(Long.valueOf(user.getUID()))
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
});
if (CollectionUtils.isNotEmpty(variableArchiveItemList)) {
getVariableArchiveItemService(user).batchInsert(variableArchiveItemList);
}
}
}

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
@ -24,10 +25,7 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
import com.engine.salary.mapper.datacollection.*;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper;
@ -39,6 +37,8 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.service.VariableArchiveItemService;
import com.engine.salary.service.impl.VariableArchiveItemServiceImpl;
import com.engine.salary.sys.config.SysConfig;
import com.engine.salary.sys.constant.SalarySysConstant;
import com.engine.salary.sys.entity.param.AppSettingSaveParam;
@ -157,6 +157,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private VariableArchiveItemService getVariableArchiveItemService(User user) {
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
}
/**
* 操作是否需要申报功能
@ -1234,14 +1237,42 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return 1;
});
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get() + submit13.get() + submit14.get();
if (flag == 15) {
Future<Integer> submit15 = fixedThreadPool.submit(() -> {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemService(user).listAll();
if (CollectionUtils.isNotEmpty(variableArchiveItemPOS)) {
variableArchiveItemPOS.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setItemValue(AESEncryptUtil.closeEncryptSetting(po.getItemValue(), sysConfPo));
} else {
po.setItemValue(AESEncryptUtil.encrypt(po.getItemValue()));
}
});
List<List<VariableArchiveItemPO>> partition = Lists.partition(variableArchiveItemPOS, 10);
VariableArchiveItemMapper mapper = sqlSession.getMapper(VariableArchiveItemMapper.class);
partition.forEach(mapper::updateBatchSelective);
sqlSession.commit();
log.info("finish hrsa_variable_archive_item");
}
} catch (Exception e) {
sqlSession.rollback();
log.error("fail hrsa_variable_archive_item", e);
return 0;
} finally {
sqlSession.close();
}
return 1;
});
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get() + submit13.get() + submit14.get() + submit15.get();
if (flag == 16) {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "success", 30);
} else {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
}
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
return flag == 15;
return flag == 16;
} catch (Exception e) {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);

View File

@ -464,6 +464,14 @@ public class SalaryAcctController {
}
@POST
@Path("/acctresult/lock")
@Produces(MediaType.APPLICATION_JSON)
public String lock(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultLockParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctResultLockParam, String>(user).run(getSalaryAcctResultWrapper(user)::lock, param);
}
//更新薪资项目锁定状态
@POST
@Path("/acctresult/updateLockStatus")

View File

@ -111,7 +111,12 @@ public class VariableArchiveController {
@Produces(MediaType.APPLICATION_JSON)
public String createData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::createData, saveParam);
if (saveParam.getId() == null) {
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::createData, saveParam);
} else {
// 更新
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::updateData, saveParam);
}
}

View File

@ -189,6 +189,11 @@ public class SalaryAcctResultWrapper extends Service implements SalaryAcctResult
getSalaryAcctResultService(user).save(saveParam);
}
public void lock(SalaryAcctResultLockParam param) {
getSalaryAcctResultService(user).lock(param);
}
/**
* 更新薪资核算结果的值的锁定状态
*

View File

@ -52,7 +52,7 @@ public class VariableArchiveWrapper extends Service {
//薪资档案列表
PageInfo<VariableArchiveListDTO> pageInfo = getVariableArchiveService(user).listPage(queryParam);
Collection<VariableArchiveListDTO> salaryArchives = pageInfo.getList();
List<VariableArchiveListDTO> salaryArchives = pageInfo.getList();
// 获取所有浮动薪酬项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
@ -123,4 +123,8 @@ public class VariableArchiveWrapper extends Service {
public void deleteSelectVariableArchive(Collection<Long> deleteIds) {
getVariableArchiveService(user).deleteSelectVariableArchive(deleteIds);
}
public void updateData(VariableArchiveSaveParam updateParam) {
getVariableArchiveService(user).updateData(updateParam);
}
}