Merge branch 'release/3.0.1.2503.01' into release/个税&业务线

# Conflicts:
#	src/com/engine/salary/service/SalaryAcctResultService.java
#	src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java
#	src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java
#	src/com/engine/salary/wrapper/SalarySobWrapper.java
This commit is contained in:
钱涛 2025-03-26 15:48:02 +08:00
commit b1c1587344
61 changed files with 813 additions and 508 deletions

View File

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

View File

@ -96,15 +96,18 @@ public class CheckStopSalaryAction implements Action {
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
@ -115,15 +118,17 @@ public class CheckStopSalaryAction implements Action {
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪检查异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("停薪校验异常", e);
log.error("停薪检查异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}

View File

@ -107,15 +107,18 @@ public class StopSalaryAction implements Action {
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listByName(taxAgentName);
if(CollectionUtils.isEmpty(taxAgentPOS)){
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentName + "个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
if( importDataMap.get("最后发薪日期") == null || StringUtils.isBlank(importDataMap.get("最后发薪日期").toString())){
requestInfo.getRequestManager().setMessage("缺少最后发薪日期字段!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "缺少最后发薪日期字段!");
return FAILURE_AND_CONTINUE;
}else if(SalaryDateUtil.stringToDate(importDataMap.get("最后发薪日期").toString()) == null){
requestInfo.getRequestManager().setMessage("最后发薪日期格式错误格式为yyyy-MM-dd");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), "最后发薪日期格式错误格式为yyyy-MM-dd" + importDataMap.get("最后发薪日期").toString());
return FAILURE_AND_CONTINUE;
}
@ -123,10 +126,12 @@ public class StopSalaryAction implements Action {
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).deleteType(NumberUtils.INTEGER_ZERO).build());
if(CollectionUtils.isEmpty(salaryArchiveList)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工不存在薪资档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
if(salaryArchiveList.size() > 1){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
log.error("停薪异常 requestId:{} msg:{}", requestInfo.getRequestid(), taxAgentId +"_"+ employeeId+"该个税扣缴义务人下该员工存在多条薪资档案记录,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
// 设置最后发薪日期

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.datacollection.bo;
import cn.hutool.core.util.NumberUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryArchiveConstant;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.param.VariableArchiveImportHandleParam;
@ -23,7 +23,6 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@ -232,7 +231,7 @@ public class VariableArchiveExcelBO extends Service {
if (optionalVariableItem.isPresent()) {
VariableItemPO variableItemPO = optionalVariableItem.get();
// 数值类型判断
boolean isNotNumber = variableItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !Pattern.matches(SalaryArchiveConstant.NUMBER_REGEX, cellVal);
boolean isNotNumber = variableItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !NumberUtil.isNumber(cellVal);
if (isNotNumber) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + key + numberErr);

View File

@ -10,6 +10,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.Set;
@Data
@ -18,6 +19,7 @@ import java.util.Date;
@AllArgsConstructor
//数据采集-累计专项附加扣除记录
@SalaryTable(pageId = "a4f85287-3354-4275-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX)
@Auth(page = "addUpDeduction")
public class AddUpDeductionRecordDTO {
//主键id
@ -124,4 +126,6 @@ public class AddUpDeductionRecordDTO {
@Encrypt
private String addUpInfantCare;
private Set<String> opts;
}

View File

@ -1,10 +1,7 @@
package com.engine.salary.entity.datacollection.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.Encrypt;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.annotation.*;
import com.engine.salary.util.excel.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
@ -28,6 +25,7 @@ import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a5f85287-3354-4275-adn9-7d06e54y6rj8",tableType = WeaTableType.CHECKBOX)
@Auth(page = "addUpSituation")
public class AddUpSituationRecordDTO {
@SalaryTableColumn(column = "id", display = false)

View File

@ -0,0 +1,57 @@
package com.engine.salary.entity.extemp.dto;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 外部人员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_external_employee
@ElogTransform( name = "非系统人员")
public class ExtEmpDTO {
@ElogTransform(name = "主键id")
private Long id;
/**
* 姓名
*/
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
private String username;
/**
* 部门
*/
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
private String departmentName;
/**
* 分部
*/
@TableTitle(title = "分部", dataIndex = "subcompanyName", key = "subcompanyName")
private String subcompanyName;
/**
* 入职日期
*/
@TableTitle(title = "入职日期", dataIndex = "companystartdate", key = "companystartdate")
private String companystartdate;
/**
* 工号
*/
@TableTitle(title = "工号", dataIndex = "workcode", key = "workcode")
private String workcode;
}

View File

@ -104,6 +104,11 @@ public class CalculateFormulaVarBO {
*/
private List<Map<String, Object>> variableArchiveList;
/**
* 上月核算结果
*/
List<SalaryAcctResultPO> lastMonthResultPOS;
public CalculateFormulaVarBO(List<DataCollectionEmployee> simpleEmployees,
List<SalaryArchiveDataDTO> salaryArchiveData,
List<AddUpSituation> addUpSituationPOS,
@ -112,7 +117,8 @@ public class CalculateFormulaVarBO {
List<Map<String, Object>> welfareData,
List<AttendQuoteDataDTO> attendQuoteDataDTOS,
List<SalaryAcctResultPO> salaryAcctResultPOS,
List<Map<String, Object>> variableArchiveList) {
List<Map<String, Object>> variableArchiveList,
List<SalaryAcctResultPO> lastMonthResultPOS) {
this.simpleEmployees = simpleEmployees;
this.salaryArchiveData = salaryArchiveData;
this.addUpSituationPOS = addUpSituationPOS;
@ -122,6 +128,7 @@ public class CalculateFormulaVarBO {
this.attendQuoteDataDTOS = attendQuoteDataDTOS;
this.salaryAcctResultPOS = salaryAcctResultPOS;
this.variableArchiveList = variableArchiveList;
this.lastMonthResultPOS = lastMonthResultPOS;
}
/**
@ -150,7 +157,10 @@ public class CalculateFormulaVarBO {
handleAttendQuoteData(salaryAcctCalculateBO, resultMap);
//处理核算人员信息
handleSalaryAcctEmployee(salaryAcctCalculateBO, resultMap);
//处理人员信息
handleSimpleEmployees(resultMap);
//处理上月薪资核算结果
handleLastMonthResult(salaryAcctCalculateBO, resultMap);
return resultMap;
}
@ -234,6 +244,25 @@ public class CalculateFormulaVarBO {
});
}
private void handleLastMonthResult(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap) {
// key:薪资项目的idvalue:薪资项目的code
Map<Long, String> salaryItemCodeMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalaryItemPOS(), SalaryItemPO::getId, SalaryItemPO::getCode);
// key:employeeId_taxAgentIdvalue:薪资核算结果集合
Map<String, List<SalaryAcctResultPO>> salaryAcctResultMap = SalaryEntityUtil.group2Map(lastMonthResultPOS,
salaryAcctResultPO -> salaryAcctResultPO.getEmployeeId() + "_" + salaryAcctResultPO.getTaxAgentId());
// 填充到返回结果集中
salaryAcctResultMap.forEach((key, salaryAcctResultPOS) -> {
List<FormulaVarValue> formulaVarValues = resultMap.computeIfAbsent(key, k -> Lists.newArrayList());
formulaVarValues.addAll(salaryAcctResultPOS.stream()
.map(salaryAcctResultPO -> {
String fieldId = SalaryFormulaReferenceEnum.LAST_MONTH_CALC.getValue()
+ SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR
+ salaryItemCodeMap.getOrDefault(salaryAcctResultPO.getSalaryItemId(), StringUtils.EMPTY);
return new FormulaVarValue().setFieldId(fieldId).setFieldValue(salaryAcctResultPO.getResultValue());
})
.collect(Collectors.toList()));
});
}
/**
* 处理薪资档案会涉及调薪计薪规则+处理核算日期
@ -256,7 +285,7 @@ public class CalculateFormulaVarBO {
}
private void handleVariableArchiveData(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap) {
Map<String, Map<String, Object>> variableArchiveMap = SalaryEntityUtil.convert2Map(variableArchiveList, map -> map.getOrDefault("taxAgentId", "").toString() + "-" + map.getOrDefault("employeeId", "").toString());
Map<String, Map<String, Object>> variableArchiveMap = SalaryEntityUtil.convert2Map(variableArchiveList, map -> map.getOrDefault("taxAgentIds", "").toString() + "-" + map.getOrDefault("employeeId", "").toString());
// 填充到返回结果集中
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
List<FormulaVarValue> formulaVarValues = resultMap.computeIfAbsent(salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId(),

View File

@ -1,7 +1,7 @@
package com.engine.salary.entity.salaryarchive.bo;
import cn.hutool.core.util.NumberUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryArchiveConstant;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveInitImportDTO;
@ -35,7 +35,6 @@ import weaver.hrm.User;
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@ -826,7 +825,7 @@ public class SalaryArchiveExcelBO extends Service {
if (isEnable) {
SalaryItemPO salaryItemPO = optionalSalaryItem.get();
// 数值类型判断
boolean isNotNumber = salaryItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !Pattern.matches(SalaryArchiveConstant.NUMBER_REGEX, cellVal);
boolean isNotNumber = salaryItemPO.getDataType().equals(SalaryArchiveFieldTypeEnum.NUMBER.getValue()) && StringUtils.isNotEmpty(cellVal) && !NumberUtil.isNumber(cellVal);
if (isNotNumber) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowindex + key + numberErr);

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryarchive.dto;
import com.engine.salary.annotation.Encrypt;
import com.engine.salary.annotation.I18n;
import com.engine.salary.annotation.TableTitle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
@ -42,6 +43,7 @@ public class SalaryItemAdjustRecordListDTO {
private String username;
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
@I18n
private String departmentName;
@TableTitle(title = "员工状态", dataIndex = "employeeStatus", key = "employeeStatus")
@ -66,6 +68,7 @@ public class SalaryItemAdjustRecordListDTO {
private Date effectiveTime;
@TableTitle(title = "操作人", dataIndex = "operator", key = "operator")
@I18n
private String operator;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

View File

@ -59,6 +59,7 @@ public class SalarySobPO {
@Deprecated
private Long taxAgentId;
@XStreamOmitField
List<Long> taxAgentIds;
/**

View File

@ -17,6 +17,7 @@ public enum SalaryFormulaReferenceEnum implements BaseEnum<String> {
SALARY_ITEM("salaryItem", "薪资项目", 84960),
// SALARY_ITEM_OF_HISTORY("salaryItemOfHistory", "历史台账薪资项目", 85364),
LAST_MONTH_CALC("lastMonthCalc", "上月核算", 257728),
EMPLOYEE_INFO("employeeInfo", "员工基本信息", 85366),
SALARY_ARCHIVES("salaryArchives", "薪资档案", 85368),
ATTEND("attend", "考勤引用", 85367),

View File

@ -192,4 +192,12 @@ public interface InsuranceAccountDetailMapper {
* 获取补差数据(账单月份+人员id+个税扣缴义务人)
*/
List<InsuranceAccountDetailPO> queryBalanceList(InsuranceAccountDetailPO po);
/**
* 根据id删除
* @param ids
*/
void deleteByIds(@Param("ids")List<Long> ids);
void deleteByEmpIds(@Param("employeeIds")List<Long> deleteEmployeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization);
}

View File

@ -553,6 +553,7 @@
<select id="selectList" resultMap="BaseResultMap">
SELECT
t.id,
t.employee_id,t.social_sum,t.fund_sum,t.other_sum,t.fund_pay_org,t.social_pay_org,
t.other_pay_org, t.payment_status
FROM
@ -1563,6 +1564,29 @@
AND employee_id = #{employeeId}
</delete>
<delete id="deleteByIds">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE delete_type = 0
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</delete>
<delete id="deleteByEmpIds">
UPDATE hrsa_bill_detail
SET delete_type = 1
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND payment_organization = #{paymentOrganization}
AND employee_id in
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</delete>
<select id="getOneByBpep" resultMap="BaseResultMap">
SELECT
t.id,t.employee_id,t.social_per_json,t.social_com_json,

View File

@ -20,6 +20,8 @@ public interface InsuranceBaseInfoMapper {
*/
List<InsuranceArchivesBaseInfoPO> listAll();
List<InsuranceArchivesBaseInfoPO> listByEmployeeIds(@Param("employeeIds")Collection<Long> employeeIds);
/**
* 查询对应id集合的记录
*

View File

@ -43,6 +43,18 @@
WHERE delete_type = 0
</select>
<select id="listByEmployeeIds"
resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_insurance_base_info t
WHERE delete_type = 0
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</select>
<!-- 查询对应id的数据 -->
<select id="listByIds" resultMap="BaseResultMap">
SELECT

View File

@ -25,6 +25,9 @@ public class SalaryStatisticsEmployeeSalaryQueryParam extends BaseQueryParam {
// 关键字
private String keyword;
//人员ids
private List<Long> employeeIds;
// 起始年月
private String startDateStr;
private Date startDate;

View File

@ -16,6 +16,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
@ -221,12 +222,23 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listAll();
Map<Long, Integer> salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, SalaryAcctRecordPO::getAcctTimes);
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
Map<Long, String> itemDataTypeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId, SalaryItemPO::getDataType);
Map<Long, List<SalaryAcctResultPO>> acctResultValueList = SalaryEntityUtil.group2Map(salaryStatisticsEmployeeDetailResult.getSalaryAcctResultValueList(), SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, Map<String, String>> acctResultValueMap = new HashMap<>();
Map<Long, Map<String, Object>> acctResultValueMap = new HashMap<>();
acctResultValueList.forEach((k, v) -> {
Map<String, String> map = new HashMap();
Map<String, Object> map = new HashMap();
v.forEach(l -> {
map.put(l.getSalaryItemId() + "", l.getResultValue());
String dataType = itemDataTypeMap.getOrDefault(l.getSalaryItemId(), "string");
SalaryDataTypeEnum typeEnum = SalaryDataTypeEnum.parseByValue(dataType);
String resultValue = l.getResultValue();
if (typeEnum == SalaryDataTypeEnum.NUMBER && NumberUtil.isNumber(resultValue)) {
map.put(l.getSalaryItemId() + "", Double.valueOf(resultValue));
} else {
map.put(l.getSalaryItemId() + "", resultValue);
}
});
acctResultValueMap.put(k, map);
});
@ -238,7 +250,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
Map<String, Object> map;
for (SalaryAcctEmployeePO se : salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList()) {
map = Maps.newHashMap();
Map<String, String> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> finalMap = map;
resultValueMap.forEach((k, v) -> {
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);
@ -309,6 +321,13 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<Long> employeeIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList());
}
//人员浏览按钮筛选
List<Long> employeeIds = queryParam.getEmployeeIds();
if(CollectionUtils.isNotEmpty(employeeIds)){
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmp -> employeeIds.contains(acctEmp.getEmployeeId())).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(salaryAcctEmployeeList)) {
return new PageInfo<>();
}

View File

@ -108,11 +108,8 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
private List<Map<String, Object>> buildReportIdsOptions(Long employeeId) {
List<Map<String, Object>> reportIdsOptions = new ArrayList<>();
List<SalaryStatisticsReportPO> reportPOS = getSalaryStatisticsReportService(user).listAll();
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
// 只能够分享创建人是本人的报表
reportPOS = reportPOS.stream().filter(po -> po.getCreator().compareTo(employeeId) == 0).collect(Collectors.toList());
}
reportPOS.forEach(po -> {
Map<String, Object> option = new HashMap<>();
option.put("id", po.getId().toString());
@ -129,10 +126,6 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
if (Objects.isNull(salaryStatisticsPushPO)) {
throw new SalaryRunTimeException("该分享记录不存在");
}
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth && salaryStatisticsPushPO.getCreator().compareTo(Long.valueOf(user.getUID())) != 0) {
throw new SalaryRunTimeException("无权查看该分享记录");
}
SalaryStatisticsPushDetail result = new SalaryStatisticsPushDetail();
result.setDetailForm(buildDetailForm(salaryStatisticsPushPO));
result.setDetailTable(buildDetailTable(param));
@ -342,7 +335,6 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
}
// public CancleMessageEntity buildCancelMessageEntity(SalaryStatisticsPushDetailPO po, Long employeeId, String tenantKey) {
// SalaryStatisticsPushPO pushPO = salaryStatisticsPushMapper.selectById(po.getBatchId());
// CancleMessageEntity cancleMessageEntity = new CancleMessageEntity();
@ -650,7 +642,7 @@ public class SalaryStatisticsPushServiceImpl extends Service implements SalarySt
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
List<SalaryStatisticsPushPO> salaryStatisticsPushPOS;
if (needAuth) {
salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().creator(Long.valueOf(user.getUID())).build());
salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().creator((long) user.getUID()).build());
} else {
salaryStatisticsPushPOS = getSalaryStatisticsPushMapper().listSome(SalaryStatisticsPushPO.builder().build());
}

View File

@ -439,7 +439,7 @@ public class SalaryStatisticsReportWrapper extends Service {
Map<String, Object> countResultMap = (Map<String, Object>) result.get("countResult");
List<Map<String, Object>> list = page.getList();
// 获取数据
List<Map<String, Object>> records = list.stream().map(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()))).collect(Collectors.toList());
List<Map<String, Object>> records = list.stream().map(m -> m.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue() == null ? "" : e.getValue()))).collect(Collectors.toList());
records.add(countResultMap);
List rows = new ArrayList<>();

View File

@ -44,11 +44,10 @@ public interface AddUpDeductionService {
/**
* 下载模板
* @param isChief
* @param queryParam
* @return
*/
XSSFWorkbook downloadTemplate(boolean isChief,AddUpDeductionQueryParam queryParam);
XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam);
/**

View File

@ -1,6 +1,7 @@
package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -19,7 +20,7 @@ public interface ExtEmpService {
List<ExtEmpPO> list(ExtEmpQueryParam param);
PageInfo<ExtEmpPO> listPage (ExtEmpQueryParam param);
PageInfo<ExtEmpDTO> listPage (ExtEmpQueryParam param);
void save(ExtEmpSaveParam po);

View File

@ -320,5 +320,9 @@ public interface SIAccountService {
void cacheWelfareField(List<String> welfareNames);
void cacheBalanceWelfareField(List<String> welfareNames);
void deleteSocialAcctEmp(SaveCommonAccountParam param);
String addSocialAcctEmp(SaveCommonAccountParam param);
}

View File

@ -11,6 +11,7 @@ import com.engine.salary.enums.common.SalaryLogOperateTypeEnum;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -169,6 +170,7 @@ public interface SalaryAcctResultService {
/**
* 锁定单元格
*
* @param param
*/
void lock(SalaryAcctResultLockParam param);
@ -189,8 +191,8 @@ public interface SalaryAcctResultService {
void batchUpdateOriginResultValue(List<SalaryAcctResultPO> salaryAcctResultValues);
/**
* @description 薪资回算
* @return void
* @description 薪资回算
* @author Harryxzy
* @date 2022/11/24 20:26
*/
@ -206,8 +208,8 @@ public interface SalaryAcctResultService {
List<SalaryAcctResultPO> listBySalaryAcctRecordIdsAndSalaryItemIds(Collection<Long> salaryAcctRecordIds, Collection<Long> salaryItemIds);
/**
* @description 根据薪资核算人员id薪资项目id获取薪资核算结果
* @return List<SalaryAesultPO>
* @description 根据薪资核算人员id薪资项目id获取薪资核算结果
* @author Harryxzy
* @date 2022/12/26 22:24
*/
@ -217,6 +219,7 @@ public interface SalaryAcctResultService {
/**
* 检查当前用户是否有查看权限
*
* @param salaryAcctRecordId
* @return
*/
@ -224,10 +227,21 @@ public interface SalaryAcctResultService {
/**
* 薪资核算结果批量更新
*
* @param param
*/
void batchUpdate(SalaryAcctResultBatchUpdateParam param);
/**
* 查询指定账套月份的数据
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
List<SalaryAcctResultPO> listBySobSalaryMonth(Date salaryMonth, Long salarySobId, List<Long> employeeIds);
/**
* 记录日志
*

View File

@ -65,7 +65,7 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
List<AuthRolePO> authRolePOS = getAuthRoleMapper().list(param);
int total = authRolePOS.size();
List<AuthRoleDTO> collect = SalaryPageUtil.subList(param.getCurrent(), param.getPageSize(), authRolePOS)
List<AuthRoleDTO> list = SalaryPageUtil.subList(param.getCurrent(), param.getPageSize(), authRolePOS)
.stream().map(po -> {
Long roleId = po.getId();
AuthMemberQueryParam roleQueryParam = AuthMemberQueryParam.builder().roleId(roleId).build();
@ -84,7 +84,8 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
.resources(authResources.size())
.build();
}).collect(Collectors.toList());
PageInfo<AuthRoleDTO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), collect, AuthRoleDTO.class);
PageInfo<AuthRoleDTO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), AuthRoleDTO.class);
pageInfo.setList(list);
pageInfo.setTotal(total);
return pageInfo;
}

View File

@ -61,10 +61,6 @@ public class AuthServiceImpl extends Service implements AuthService {
Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
boolean isAuth = clazz.isAnnotationPresent(Auth.class);
if (!isOpenDevolution || !isAuth) {
return list;
}
Auth auth = clazz.getAnnotation(Auth.class);
String taxAgentIdField = auth.taxAgentIdField();
String taxAgentIdFieldGetter = "get" + taxAgentIdField.substring(0, 1).toUpperCase() + taxAgentIdField.substring(1);
@ -76,6 +72,34 @@ public class AuthServiceImpl extends Service implements AuthService {
String optsFieldGetter = "get" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
String optsFieldSetter = "set" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
//不开启分权
if (!isOpenDevolution) {
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
list.forEach(t -> {
try {
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
opts = new HashSet<>();
}
opts.add("query");
opts.add("admin");
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SalaryRunTimeException(e);
}
});
}
return list;
}
//未配置分权
if (!isAuth) {
return list;
}
//给总管理员赋值最大权限
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
if (isChief || filterType == AuthFilterTypeEnum.NO_AUTH) {

View File

@ -1006,18 +1006,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
@Override
public PageInfo<AddUpDeductionRecordDTO> recordListPage(AddUpDeductionQueryParam queryParam) {
long employeeId = (long) user.getUID();
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
if (needAuth) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionRecordDTO.class);
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
List<AddUpDeductionRecordDTO> list = getAddUpDeductionMapper().recordList(queryParam);
list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, AddUpDeductionRecordDTO.class);
PageInfo<AddUpDeductionRecordDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionRecordDTO.class);
encryptUtil.decryptList(page.getList(), AddUpDeductionRecordDTO.class);
return page;
@ -1119,7 +1109,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
@Override
public XSSFWorkbook downloadTemplate(boolean isChief, AddUpDeductionQueryParam queryParam) {
public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) {
String sheetName = SalaryI18nUtil.getI18nLabel(101603, "累计专项附加扣除导入模板");
String[] header = {SalaryI18nUtil.getI18nLabel(85429, "姓名"), SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), SalaryI18nUtil.getI18nLabel(86185, "部门"), SalaryI18nUtil.getI18nLabel(86186, "手机号"), SalaryI18nUtil.getI18nLabel(86317, "工号"), SalaryI18nUtil.getI18nLabel(86318, "证件号码"), SalaryI18nUtil.getI18nLabel(86319, "入职日期"), SalaryI18nUtil.getI18nLabel(86321, "累计子女教育"), SalaryI18nUtil.getI18nLabel(86323, "累计继续教育"), SalaryI18nUtil.getI18nLabel(86324, "累计住房贷款利息"), SalaryI18nUtil.getI18nLabel(86325, "累计住房租金"), SalaryI18nUtil.getI18nLabel(86326, "累计赡养老人"), SalaryI18nUtil.getI18nLabel(105142, "累计大病医疗"), SalaryI18nUtil.getI18nLabel(105142, "累计婴幼儿照护")};

View File

@ -374,7 +374,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
* @return
*/
private List<List<Object>> getExcelRowDetailList(AddUpSituationQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<Object> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用",
"累计社保个人合计", "累计公积金个人合计", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额",
@ -383,15 +382,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<AddUpSituationRecordDTO> list = biz.recordList(param);
list = getAuthService(user).auth(list, AuthFilterTypeEnum.QUERY_DATA, AddUpSituationRecordDTO.class);
// 开启了分权
if (getTaxAgentService(user).isOpenDevolution() || !getTaxAgentService(user).isChief(employeeId)) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
}
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -83,9 +84,21 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
}
@Override
public PageInfo<ExtEmpPO> listPage(ExtEmpQueryParam param) {
public PageInfo<ExtEmpDTO> listPage(ExtEmpQueryParam param) {
List<ExtEmpPO> extEmpPOS = list(param);
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), extEmpPOS, ExtEmpPO.class);
List<ExtEmpDTO> list = extEmpPOS.stream().map(po -> {
return ExtEmpDTO.builder()
.id(po.getId())
.username(po.getUsername())
.departmentName(po.getDepartmentName())
.subcompanyName(po.getSubcompanyName())
.companystartdate(po.getCompanystartdate())
.workcode(po.getWorkcode())
.build();
}).collect(Collectors.toList());
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), list, ExtEmpDTO.class);
}

View File

@ -289,7 +289,7 @@ public class PushServiceImpl extends Service implements PushService {
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>());
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>(),new ArrayList<>());
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
@ -403,7 +403,7 @@ public class PushServiceImpl extends Service implements PushService {
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>());
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>(), new ArrayList<>());
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
List<PushSettingPO> pushSettingPOS = getPushSettingMapper().listSome(PushSettingPO.builder().able(1).build());

View File

@ -17,8 +17,10 @@ import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxrate.TaxRateBase;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salaryformula.ReferenceTypeEnum;
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
@ -141,6 +143,7 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
if (referenceEnum != null) {
switch (referenceEnum) {
case SALARY_ITEM:
case LAST_MONTH_CALC:
case ISSUED:
vars = salaryItem2FormulaVar(referenceEnum, extendParam);
break;
@ -239,6 +242,8 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
if (ReferenceTypeEnum.FORMULA.equals(referenceTypeEnum)) {
result.put(SalaryFormulaReferenceEnum.SALARY_ITEM.getDefaultLabel(),
salaryItem2FormulaVar(SalaryFormulaReferenceEnum.SALARY_ITEM, null));
result.put(SalaryFormulaReferenceEnum.LAST_MONTH_CALC.getDefaultLabel(),
salaryItem2FormulaVar(SalaryFormulaReferenceEnum.LAST_MONTH_CALC, null));
result.put(SalaryFormulaReferenceEnum.ISSUED.getDefaultLabel(),
salaryItem2FormulaVar(SalaryFormulaReferenceEnum.ISSUED, null));
result.put(SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getDefaultLabel(),
@ -365,9 +370,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
} else {
salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
}
Set<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId)
.collect(Collectors.toSet());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Set<Long> taxAgentIds = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
return salaryItems.stream()
//薪资项目取消过滤档案使得导入功能一页面为准
// .filter(e -> e.getUseInEmployeeSalary() == 0)
@ -397,8 +402,10 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
} else {
salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
}
Set<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Set<Long> taxAgentIds = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
return salaryItems.stream()
.filter(e -> e.getUseInEmployeeSalary() == 1)
.filter(e-> getSalaryItemService(user).filterInRange(taxAgentIds, e))

View File

@ -32,6 +32,7 @@ import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
@ -398,19 +399,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long) user.getUID();
Map<String, Object> datas = new HashMap<>();
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgents)) {
//防止普通用户查询
queryParam.setTaxAgents(Collections.singletonList(-1L));
} else {
queryParam.setTaxAgents(taxAgents);
}
}
//退差列表
queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
@ -458,19 +446,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long) user.getUID();
Map<String, Object> datas = new HashMap<>();
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgents)) {
//防止普通用户查询
queryParam.setTaxAgents(Collections.singletonList(-1L));
} else {
queryParam.setTaxAgents(taxAgents);
}
}
//补差列表
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
@ -1514,7 +1489,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public Collection<TaxAgentPO> getAdminTaxAgentList() {
return getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
return getTaxAgentService(user).listAuth(param);
}
@Override
@ -4223,18 +4200,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long) user.getUID();
Map<String, Object> datas = new HashMap<>();
queryParam.setPageSize(10000000);
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgents)) {
//防止普通用户查询
queryParam.setTaxAgents(Collections.singletonList(-1L));
} else {
queryParam.setTaxAgents(taxAgents);
}
}
//退差列表
queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
@ -4261,18 +4226,6 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Long employeeId = (long) user.getUID();
Map<String, Object> datas = new HashMap<>();
queryParam.setPageSize(10000000);
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgents)) {
//防止普通用户查询
queryParam.setTaxAgents(Collections.singletonList(-1L));
} else {
queryParam.setTaxAgents(taxAgents);
}
}
//补差列表
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
@ -4970,6 +4923,15 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
validIds.addAll(emp2);
validIds.addAll(emp3);
if (!param.isFlag()) {
// 不是首次创建核算 还需要添加历史核算人员
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(param.getBillMonth(), param.getPaymentOrganization());
List<Long> historyEmpIds = insuranceAccountDetailPOS.stream().filter(po -> po.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())).map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
validIds.addAll(historyEmpIds);
List<Long> finalEmpIds = empIds;
empIds.addAll(historyEmpIds.stream().filter(empId -> !finalEmpIds.contains(empId)).collect(Collectors.toList()));
}
List<Long> finalValidIds = validIds.stream().distinct().collect(Collectors.toList());
ids = empIds.stream().filter(finalValidIds::contains).collect(Collectors.toList());
} else {
@ -5027,14 +4989,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
List<InsuranceAccountDetailPO> historyDetailData = new ArrayList<>();
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(ids);
if (!isFirstFlag) {
// 不是首次核算需要把社保历史数据取出
List<List<Long>> partition = Lists.partition(ids, 100);
partition.forEach(part -> {
historyDetailData.addAll(getInsuranceAccountDetailMapper().list(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
historyDetailData.addAll(getInsuranceAccountDetailMapper().extList(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(part).build()));
});
}
Map<Long, InsuranceAccountDetailPO> historyDetailDataMap = SalaryEntityUtil.convert2Map(historyDetailData, InsuranceAccountDetailPO::getEmployeeId);
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
@ -5110,14 +5069,18 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
//临时表入库前先对可能存在的历史数据进行删除
// List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
// partition.forEach(part -> {
// getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
// });
// 根据人员id删会少删不再参与社保核算的人
getSIAccountDetailTempMapper().batchDelByMonthAndPayOrg(billMonth, paymentOrganization);
partition.forEach(part -> {
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
});
// // 根据人员id删会少删不再参与社保核算的人
// getSIAccountDetailTempMapper().batchDelByMonthAndPayOrg(billMonth, paymentOrganization);
//临时表数据入库
if (CollectionUtils.isNotEmpty(list)) {
if (!isFirstFlag) {
// 点击台账内的核算按钮核算人员不变(不增加人)
List<String> existDataKey = historyDetailData.stream().map(po -> po.getPaymentOrganization() + "_" + po.getEmployeeId()).collect(Collectors.toList());
list = list.stream().filter(po -> existDataKey.contains(po.getPaymentOrganization() + "_" + po.getEmployeeId())).collect(Collectors.toList());
}
encryptUtil.encryptList(list, InsuranceAccountDetailTempPO.class);
List<List<InsuranceAccountDetailTempPO>> lists = splitList(list, 20);
lists.forEach(subList -> {
@ -6842,4 +6805,188 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
/*****以上代码为SIAccountBiz中方法逻辑迁移旨在减少Biz类的使用*****/
/**
* 正常缴纳页 删除社保核算人员
* @param param
*/
@Override
public void deleteSocialAcctEmp(SaveCommonAccountParam param) {
if (StringUtils.isBlank(param.getBillMonth()) || param.getPaymentOrganization() == null) {
throw new SalaryRunTimeException("参数错误");
}
if (CollectionUtils.isEmpty(param.getIds())) {
return;
}
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(param.getBillMonth(), param.getPaymentOrganization());
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream().filter(detailPO -> param.getIds().contains(detailPO.getId())).collect(Collectors.toList());
List<Long> deleteEmployeeIds = insuranceAccountDetailPOS.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
deleteAccountDetailsByEmpIds(deleteEmployeeIds, param.getBillMonth(), param.getPaymentOrganization());
if (CollectionUtils.isNotEmpty(deleteEmployeeIds)) {
// 重新计算合计值
updateBatchAccount((AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization())).build());
}
}
public void deleteAccountDetailsByEmpIds(List<Long> deleteEmployeeIds, String billMonth, Long paymentOrganization) {
if (CollectionUtils.isNotEmpty(deleteEmployeeIds)) {
List<List<Long>> partition = Lists.partition(deleteEmployeeIds, 100);
partition.forEach(part -> {
// 删除该台账下员工的所有数据
getInsuranceAccountDetailMapper().deleteByEmpIds(part, billMonth, paymentOrganization);
});
}
}
/**
* 正常缴纳页 添加社保核算人员
* @param param
*/
@Override
public String addSocialAcctEmp(SaveCommonAccountParam param) {
if (StringUtils.isBlank(param.getBillMonth()) || param.getPaymentOrganization() == null) {
throw new SalaryRunTimeException("参数错误");
}
if (CollectionUtils.isEmpty(param.getIncludes())) {
return "";
}
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
if (insuranceAccountBatchPO == null) {
throw new SalaryRunTimeException("台账不存在或已被删除");
}
// 校验是否可以添加这些员工
List<Long> empIds = param.getIncludes();
List<Long> validIds = new ArrayList<>();
// 获取当前台账已经存在的人员
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
List<Long> existEmpIds = insuranceAccountDetailPOS.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList());
Optional<Long> existOptional = empIds.stream().filter(existEmpIds::contains).findFirst();
if (existOptional.isPresent()) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(101581, "人员已存在,请勿重复添加"));
}
//过滤出需要核算的人员即福利档案基础信息表中runStatus为正在缴纳和待减员的人员
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listByEmployeeIds(empIds);
List<Long> canAccountIds = baseInfoPOList.stream()
.filter(f->f.getPaymentOrganization().equals(param.getPaymentOrganization()))
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
.collect(Collectors.toList());
//20231122逻辑优化过滤出不在起始缴纳月和最后缴纳月区间的人员
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(param.getPaymentOrganization(), param.getBillMonth());
empIds = empIds.stream().filter(f->canAccountIds.contains(f) && empIdsInPayMonthRange.contains(f)).collect(Collectors.toList());
List<InsuranceArchivesSocialSchemePO> socials = getSIArchivesService(user).getSocialByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
socials = socials.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> emp1 = socials.stream()
.filter(s -> !(StringUtils.isBlank(s.getSocialEndTime()) && StringUtils.isBlank(s.getSocialStartTime())) &&
(StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01")))) )
.map(InsuranceArchivesSocialSchemePO::getEmployeeId)
.collect(Collectors.toList());
List<InsuranceArchivesFundSchemePO> funds = getSIArchivesService(user).getFundByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
funds = funds.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> emp2 = funds.stream()
.filter(s -> !(StringUtils.isBlank(s.getFundStartTime()) && StringUtils.isBlank(s.getFundEndTime())) &&
(StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01")))))
.map(InsuranceArchivesFundSchemePO::getEmployeeId)
.collect(Collectors.toList());
List<InsuranceArchivesOtherSchemePO> others = getSIArchivesService(user).getOtherByEmployeeIds(empIds);
//过滤出目标个税扣缴义务人相关信息
others = others.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
List<Long> emp3 = others.stream()
.filter(s -> !(StringUtils.isBlank(s.getOtherStartTime()) && StringUtils.isBlank(s.getOtherEndTime())) &&
(StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))))
.map(InsuranceArchivesOtherSchemePO::getEmployeeId)
.collect(Collectors.toList());
validIds.addAll(emp1);
validIds.addAll(emp2);
validIds.addAll(emp3);
List<Long> finalValidIds = validIds.stream().distinct().collect(Collectors.toList());
List<Long> conNotAddEmpIds = param.getIncludes().stream().filter(empId -> !finalValidIds.contains(empId)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(conNotAddEmpIds)) {
String canNotAddName = getSalaryEmployeeService(user).listByIds(conNotAddEmpIds).stream().map(DataCollectionEmployee::getUsername).collect(Collectors.joining(","));
throw new SalaryRunTimeException("添加失败,员工:" +canNotAddName + ",社保、公积金、其他福利需至少有一种在当前账单月需缴纳,并且社保档案需为在缴员工");
}
addCommonEmpAndAccount(param.getBillMonth(), empIds, param.getPaymentOrganization());
return "success";
}
/**
* 添加正常缴纳人员并核算
* @param billMonth
* @param ids
* @param paymentOrganization
*/
public void addCommonEmpAndAccount(String billMonth, List<Long> ids, Long paymentOrganization) {
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(ids);
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
for (Map.Entry<Long, InsuranceArchivesAccountPO> entry : insuranceArchivesAccountPOS.entrySet()) {
Long k = entry.getKey();
InsuranceArchivesAccountPO v = entry.getValue();
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
insuranceAccountDetailPO.setBillMonth(billMonth);
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
insuranceAccountDetailPO.setCreator((long) user.getUID());
insuranceAccountDetailPO.setCreateTime(new Date());
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
insuranceAccountDetailPO.setEmployeeId(k);
insuranceAccountDetailPO.setUpdateTime(new Date());
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.COMMON.getValue());
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
DataCollectionEmployee employee = employeeMap.get(k);
if (employee != null) {
insuranceAccountDetailPO.setSubcompanyName(employee.getSubcompanyName());
insuranceAccountDetailPO.setSubcompanyId(employee.getSubcompanyid());
insuranceAccountDetailPO.setDepartmentName(employee.getDepartmentName());
insuranceAccountDetailPO.setDepartmentId(employee.getDepartmentId());
insuranceAccountDetailPO.setJobtitleName(employee.getJobtitleName());
insuranceAccountDetailPO.setJobtitleId(employee.getJobtitleId());
insuranceAccountDetailPO.setJobcall(employee.getJobcall());
insuranceAccountDetailPO.setJobcallId(employee.getJobcallId());
insuranceAccountDetailPO.setStatus(employee.getStatus());
}
//核算社保
accountSocial(insuranceAccountDetailPO, v, billMonth);
//核算公积金
accountFund(insuranceAccountDetailPO, v, billMonth);
//核算其他福利
accountOther(insuranceAccountDetailPO, v, billMonth);
//计算合计
account(insuranceAccountDetailPO);
//临时表PO
InsuranceAccountDetailTempPO insuranceAccountDetailTempPO = new InsuranceAccountDetailTempPO();
BeanUtils.copyProperties(insuranceAccountDetailPO, insuranceAccountDetailTempPO);
list.add(insuranceAccountDetailTempPO);
}
// 入库
//生成bill_detail入库数据
List<InsuranceAccountDetailPO> collect = list.stream().map(item -> {
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
BeanUtils.copyProperties(item, insuranceAccountDetailPO);
return insuranceAccountDetailPO;
}).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
encryptUtil.encryptList(collect, InsuranceAccountDetailPO.class);
List<List<InsuranceAccountDetailPO>> lists = splitDetailList(collect, 20);
lists.forEach(subList -> {
getInsuranceAccountDetailMapper().batchSaveAccountDetails(subList);
});
updateBatchAccount((AccountParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization)).build());
}
}
}

View File

@ -1582,14 +1582,14 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
List<Map<String, Object>> records = new ArrayList<>();
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = encryptUtil.decryptList(this.getSocialByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS), InsuranceArchivesSocialSchemePO.class)
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getId, Function.identity()));
.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getId, Function.identity(), (a, b) -> a));
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = encryptUtil.decryptList(this.getFundByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS), InsuranceArchivesFundSchemePO.class)
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getId, Function.identity()));
.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getId, Function.identity(), (a, b) -> a));
List<InsuranceArchivesOtherSchemePO> otherByEmployeeList = this.getOtherByEmployeeIdAndPayOrg(insuranceArchivesEmployeePOS);
encryptUtil.decryptList(otherByEmployeeList, InsuranceArchivesOtherSchemePO.class);
Map<Long, InsuranceArchivesOtherSchemePO> otherSchemePOMap = otherByEmployeeList
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getId, Function.identity()));
.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getId, Function.identity(), (a, b) -> a));
insuranceArchivesEmployeePOS.forEach(item -> {
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getSocialId());
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getFundId());

View File

@ -5,8 +5,8 @@ import com.alibaba.fastjson.TypeReference;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
@ -39,11 +39,10 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.excel.ExcelUtilPlus;
import org.springframework.beans.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
@ -176,20 +175,6 @@ public class SIExportServiceImpl extends Service implements SIExportService {
//非系统人员核算明细
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(paymentStatus, param);
accountExportPOS.addAll(extAccountExportPOS);
// 分权逻辑
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgents)) {
//防止普通用户查询
accountExportPOS = new ArrayList<>();
param = new InsuranceExportParam();
} else {
accountExportPOS.stream().filter(f -> taxAgents.contains(f.getPaymentOrganization())).collect(Collectors.toList());
param.setTaxAgents(taxAgents);
}
}
} else {
accountExportPOS = getInsuranceExportMapper().exportAccount(paymentStatus, param);
//非系统人员核算明细

View File

@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
@ -14,9 +14,10 @@ import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam;
import com.engine.salary.entity.siaccount.param.RecessionParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
@ -25,11 +26,14 @@ import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.SIRecessionService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.auth.AuthService;
import com.engine.salary.service.auth.AuthServiceImpl;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -69,6 +73,7 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic
private SIAccountService getSIAccountService(User user) {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class);
}
@ -81,6 +86,14 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
}
public AuthService getAuthService(User user) {
return ServiceUtil.getService(AuthServiceImpl.class, user);
}
@Override
public void save(RecessionParam param, Long employeeId) {
@ -208,7 +221,6 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic
}
private void recessionBaseBuild(RecessionParam param, InsuranceAccountDetailPO temp, InsuranceAccountDetailPO insuranceAccountDetailPO, DataCollectionEmployee employee) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), Long.valueOf(param.getPaymentOrganization()));
temp.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
@ -253,6 +265,7 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic
temp.setFundPaymentComBaseString(insuranceAccountDetailPO.getFundPaymentComBaseString());
temp.setOtherPaymentComBaseString(insuranceAccountDetailPO.getOtherPaymentComBaseString());
}
private void recessionSocial(RecessionParam param, InsuranceAccountDetailPO temp, InsuranceAccountDetailPO insuranceAccountDetailPO) {
//退差社保个人缴费
String socialPerJson = insuranceAccountDetailPO.getSocialPerJson();
@ -396,15 +409,12 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic
@Override
public PageInfo<HrmInfoDTO> getEmployeeListByTaxAgent(HrmQueryParam param) {
// 当前登录人员
Long currentEmployeeId = (long) user.getUID();
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(currentEmployeeId);
Set<Long> employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
List<Long> empIds = new ArrayList<Long>(employeeIds);
List<InsuranceArchivesBaseInfoPO> list = getInsuranceBaseInfoMapper().listAll();
list = getAuthService(user).auth(list, AuthFilterTypeEnum.ADMIN_DATA, InsuranceArchivesBaseInfoPO.class);
List<Long> employeeIds = SalaryEntityUtil.properties(list, InsuranceArchivesBaseInfoPO::getEmployeeId, Collectors.toList());
List<HrmInfoDTO> resultData = new ArrayList<>();
if (employeeIds.size() > 0) {
List<List<Long>> partition = Lists.partition(empIds, 1000);
List<List<Long>> partition = Lists.partition(employeeIds, 1000);
partition.forEach(p -> {
param.setIds(p);
resultData.addAll(getEmployMapper().listHrmInfoByIdAndName(param));

View File

@ -28,7 +28,6 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.entity.sischeme.vo.InsuranceSchemeFormVO;
import com.engine.salary.entity.sischeme.vo.SISchemeTableVO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
@ -54,6 +53,8 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.auth.AuthService;
import com.engine.salary.service.auth.AuthServiceImpl;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.enums.OpenEnum;
@ -179,6 +180,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
return MapperProxyFactory.getProxy(EmployMapper.class);
}
public AuthService getAuthService(User user) {
return ServiceUtil.getService(AuthServiceImpl.class, user);
}
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>(16);
@ -356,16 +361,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
param.setOrderRule(orderRule);
Boolean needAuth = getTaxAgentService().isNeedAuth(currentEmployeeId);
if (needAuth) {
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee(currentEmployeeId);
// Set<Long> employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getTaxAgentId);
List<InsuranceArchivesEmployeePO> list = getSocialSchemeMapper().queryEmployeeList(param);
return list.stream().filter(f -> taxAgentIds.contains(f.getPaymentOrganization())).collect(Collectors.toList());
}
return getSocialSchemeMapper().queryEmployeeList(param);
list = getAuthService(user).auth(list, AuthFilterTypeEnum.QUERY_DATA, InsuranceArchivesEmployeePO.class);
return list;
}
@Override
@ -1014,7 +1012,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
singleAccount.add(cellData);
}
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param);
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, taxAgentManageRangeEmployeeTree, param);
if (isError) {
errorCount += 1;
// 添加错误数据
@ -1073,7 +1071,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
public boolean singleAccountCheck(List<Map<String, Object>> singleAccount, Map<Long, String> welfareMap,
List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS, List<DataCollectionEmployee> employeeByIds,
List<Map<String, String>> excelComments, int i, Map<String, Long> schemeNameIdMap,
Map<String, Long> paymentNameIdMap, Long creator, int index, Boolean openDevolution,
Map<String, Long> paymentNameIdMap, Long creator, int index,
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree, SIArchiveImportParam param) {
boolean isError = false;
String runStatus = param.getRunStatus();
@ -2088,19 +2086,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
//获取所有福利类型的id-name结合
Map<String, Long> schemeNameIdMap = schemeNameIdMap();
Map<Long, String> welfareMap = welfareMap();
// 获取所有个税扣缴义务人的名称和id的map
Map<String, Long> paymentNameIdMap;
//分权
// Boolean openDevolution = getTaxAgentService().isOpenDevolution();
// 流程处理默认不开启分权
Boolean openDevolution = false;
if (openDevolution) {
paymentNameIdMap = getTaxAgentService().listAllTaxAgentsAsAdmin((long) user.getUID()).stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
} else {
paymentNameIdMap = getTaxAgentService().listAll().stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
}
Map<String, Long> paymentNameIdMap = getTaxAgentService().listAll().stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
//获取所有个税扣缴义务人树型
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree = getTaxAgentService().listTaxAgentAndEmployeeTree();
@ -2158,7 +2146,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
singleAccount.add(cellData);
}
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree, param);
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, taxAgentManageRangeEmployeeTree, param);
if (isError) {
errorCount += 1;
// 添加错误数据

View File

@ -27,6 +27,7 @@ import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.formlua.entity.standard.ExcelResult;
import com.engine.salary.service.*;
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
@ -189,9 +190,13 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
sw.stop();
// 查询上个薪资所属月核算人员薪资数据
sw.start("查询上个薪资所属月核算人员薪资数据");
List<SalaryAcctResultPO> lastMonthResultPOS = getSalaryAcctResultService(user).listBySobSalaryMonth(SalaryDateUtil.toDate(salarySobCycleDTO.getSalaryMonth().minusMonths(1), 1), salaryAcctCalculateBO.getSalarySobPO().getId(), employeeIds);
sw.stop();
// 10转换成公式编辑器中的变量
sw.start("转换成公式编辑器中的变量");
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList);
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList,lastMonthResultPOS);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
sw.stop();
sw.start("数据结构准备");

View File

@ -1,5 +1,6 @@
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;
@ -82,6 +83,8 @@ import java.util.concurrent.LinkedBlockingDeque;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import static com.engine.salary.sys.constant.SalarySysConstant.SALARY_ACCT_SYNC_TYPE;
import static com.engine.salary.constant.SalaryFormulaFieldConstant.SALARY_PATTERN;
/**
@ -201,6 +204,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
private VariableItemService getVariableItemService(User user) {
return ServiceUtil.getService(VariableItemServiceImpl.class, user);
}
private SalaryApprovalRuleService getSalaryApprovalRuleService(User user) {
return ServiceUtil.getService(SalaryApprovalRuleServiceImpl.class, user);
}
@ -887,6 +891,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 12.4是否采用系统算税
TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration();
// 12.5多线程运算运算结果存放在临时表中
//是否同步计算
boolean isSync = "0".equals(getSalarySysConfService(user).getValueByCode(SALARY_ACCT_SYNC_TYPE));
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO()
.setSalaryAcctRecordPO(salaryAcctRecordPO)
@ -909,6 +915,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
.setTaxDeclarationFunction(taxDeclarationFunction)
.setTaxIds(taxIds);
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
if (isSync) {
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
} else {
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
@ -917,6 +926,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
}
}
// 13等待所有子线程执行完毕
childMonitor.await();
@ -952,6 +962,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 记录日志
// 查询操作日志的targetName
String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(calculateParam.getSalaryAcctRecordId());
Collection<Long> ids = calculateParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
targetName += ids;
}
LoggerContext<SalaryCheckResultPO> loggerContext = new LoggerContext<>();
loggerContext.setUser(user);
loggerContext.setTargetId(String.valueOf(calculateParam.getSalaryAcctRecordId()));
@ -1492,6 +1506,31 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}
}
@Override
public List<SalaryAcctResultPO> listBySobSalaryMonth(Date salaryMonth, Long salarySobId, List<Long> employeeIds) {
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listSome(SalaryAcctRecordPO.builder().salarySobId(salarySobId).salaryMonth(salaryMonth).build());
List<Long> recordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, Collectors.toList());
if (CollUtil.isEmpty(recordIds)) {
return new ArrayList<>();
}
List<SalaryAcctResultPO> salaryAcctResultPOS = new ArrayList<>();
SalaryAcctResultPO resultParam = SalaryAcctResultPO.builder().salaryAcctRecordIds(recordIds).build();
if (CollUtil.isNotEmpty(employeeIds)) {
List<List<Long>> partition = Lists.partition(employeeIds, 500);
for (List<Long> ids : partition){
resultParam.setEmployeeIds(ids);
List<SalaryAcctResultPO> acctResultPOS = getSalaryAcctResultMapper().listSome(resultParam);
salaryAcctResultPOS.addAll(acctResultPOS);
}
} else {
salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(resultParam);
}
encryptUtil.decryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
return salaryAcctResultPOS;
}
@Override
public void writeBatchLog(SalaryAcctRecordPO salaryAcctRecord,
Map<String, String> newResultValueMap,

View File

@ -12,14 +12,17 @@ import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO;
import com.engine.salary.entity.salaryarchive.param.*;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveFieldTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum;
@ -629,8 +632,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
*/
@Override
public List<SalaryItemPO> getCanAdjustSalaryItems() {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
List<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
List<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentList, TaxAgentPO::getId, Collectors.toList());
List<SalaryItemPO> canAdjustSalaryItems = salaryItemMapper.getCanAdjustSalaryItems();
canAdjustSalaryItems = canAdjustSalaryItems.stream()
@ -678,22 +684,11 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItemList = getCanAdjustSalaryItems();
List<Long> salaryItemIds = salaryItemList.stream().map(SalaryItemPO::getId).collect(Collectors.toList());
// 获取记录
long currentEmployeeId = user.getUID();
//是否开启分权
Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
if (needAuth) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId);
List<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIds)) {
// return new PageInfo<SalaryItemAdjustRecordListDTO>();
}
List<SalaryArchivePO> salaryArchives = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentIds(taxAgentIds).build());
List<Long> salaryArchiveIds = SalaryEntityUtil.properties(salaryArchives, SalaryArchivePO::getId, Collectors.toList());
//分权
SalaryArchiveQueryParam archiveQueryParam = new SalaryArchiveQueryParam();
archiveQueryParam.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
List<Long> salaryArchiveIds = getSalaryArchiveService(user).list(archiveQueryParam).stream().map(SalaryArchiveListDTO::getId).collect(Collectors.toList());
queryParam.setSalaryArchiveIds(salaryArchiveIds);
}
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
@ -718,6 +713,7 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
;
})
.collect(Collectors.toList());
SalaryI18nUtil.i18nList(listResult);
List<SalaryItemAdjustRecordListDTO> listAll = salaryArchiveItemMapper.salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam.builder().build(), salaryItemIds);

View File

@ -22,6 +22,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
@ -312,11 +313,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return;
}
// 当前可以管辖的人员
Collection<TaxAgentPO> taxAgentList = new ArrayList<>();
if (currentEmployeeId != 1L) {
taxAgentList = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
Collection<TaxAgentPO> finalTaxAgentList = taxAgentList;
taxAgentEmpChangeList = taxAgentEmpChangeList.stream().filter(f -> finalTaxAgentList.stream().anyMatch(e -> e.getId().equals(f.getTaxAgentId()))).collect(Collectors.toList());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
Collection<TaxAgentPO> taxAgentList =getTaxAgentService(user).listAuth(param);
taxAgentEmpChangeList = taxAgentEmpChangeList.stream().filter(f -> taxAgentList.stream().anyMatch(e -> e.getId().equals(f.getTaxAgentId()))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentEmpChangeList)) {
return;
}
@ -360,13 +361,13 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException("不允许删除薪资档案,请先开启删除档案规则配置!");
}
List<SalaryArchivePO> salaryArchiveList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(salaryArchiveIds).build());
//查询当前登录人员管理的个税扣缴义务人
List<Long> canDeleteTaxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID())
.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
boolean err = salaryArchiveList.stream().anyMatch(po -> !canDeleteTaxAgentIds.contains(po.getTaxAgentId()));
if (CollectionUtils.isEmpty(salaryArchiveList) || err) {
throw new SalaryRunTimeException("薪资档案不存在,或没有权限删除该薪资档案!");
if (CollectionUtils.isEmpty(salaryArchiveList)) {
throw new SalaryRunTimeException("薪资档案不存在");
}
//权限可操作的档案
salaryArchiveList = getAuthService(user).auth(salaryArchiveList, AuthFilterTypeEnum.ADMIN_DATA, SalaryArchivePO.class);
if (CollectionUtils.isEmpty(salaryArchiveList)) {
throw new SalaryRunTimeException("没有权限删除该薪资档案!");
}
Optional<SalaryArchivePO> fixedList = salaryArchiveList.stream().filter(archive -> !StringUtils.equals(archive.getRunStatus(), SalaryArchiveStatusEnum.PENDING.getValue())
&& !StringUtils.equals(archive.getRunStatus(), SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())).findFirst();
@ -1097,9 +1098,13 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
return StringUtils.EMPTY;
}
// 从待定薪到停薪
getSalaryArchiveMapper().deletePendingTodo(ids);
List<List<Long>> partition = Lists.partition((List<Long>) ids, 800);
partition.forEach(getSalaryArchiveMapper()::deletePendingTodo);
// 记录日志
List<SalaryArchivePO> newList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(ids).build());
List<SalaryArchivePO> newList = new ArrayList<>();
partition.forEach(part -> {
newList.addAll(getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(part).build()));
});
String operatedesc = SalaryI18nUtil.getI18nLabel(0, "删除待办");
recordLog(oldList, newList, operatedesc);
@ -1129,11 +1134,14 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
// 从待定薪到定薪
List<List<Long>> partition = Lists.partition((List<Long>) ids, 1000);
List<List<Long>> partition = Lists.partition((List<Long>) ids, 800);
partition.forEach(getSalaryArchiveMapper()::gotoFixed);
// 记录日志
List<SalaryArchivePO> newList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(ids).build());
List<SalaryArchivePO> newList = new ArrayList<>();
partition.forEach(part -> {
newList.addAll(getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(part).build()));
});
String operateDesc = SalaryI18nUtil.getI18nLabel(0, "设为发薪员工");
recordLog(salaryArchiveList, newList, operateDesc);
@ -1199,10 +1207,14 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
// 从待停薪到停薪
getSalaryArchiveMapper().gotoStop(ids);
List<List<Long>> partition = Lists.partition((List<Long>) ids, 800);
partition.forEach(getSalaryArchiveMapper()::gotoStop);
// 记录日志
List<SalaryArchivePO> newList = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(ids).build());
List<SalaryArchivePO> newList = new ArrayList<>();
partition.forEach(part -> {
newList.addAll( getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(part).build()));
});
String operatedesc = SalaryI18nUtil.getI18nLabel(0, "停薪");
recordLog(oldList, newList, operatedesc);

View File

@ -1,6 +1,5 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
@ -20,6 +19,7 @@ import com.engine.salary.entity.salaryitem.config.SalaryItemExcelConfig;
import com.engine.salary.entity.salaryitem.param.*;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
import com.engine.salary.entity.salarysob.param.SalarySobQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
@ -34,6 +34,8 @@ import com.engine.salary.enums.sicategory.SharedTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.auth.AuthService;
import com.engine.salary.service.auth.AuthServiceImpl;
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
@ -112,6 +114,10 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
return SqlProxyHandle.getProxy(SalaryItemMapper.class);
}
public AuthService getAuthService(User user) {
return ServiceUtil.getService(AuthServiceImpl.class, user);
}
@Override
public SalaryItemPO getById(Long id) {
return salaryItemBiz.getById(id);
@ -448,16 +454,10 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
@Override
public List<Map<String, Object>> getSalarySobBySalaryItem(Long salaryItemId) {
// 查询所有启用的薪资账套
List<SalarySobItemPO> salarySobItemList = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(salaryItemId));
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobItemList, SalarySobItemPO::getSalarySobId);
List<SalarySobPO> salarySobs = getSalarySobService(user).listByIds(salarySobIds);
// 获取能够管理的义务人
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
if (!isChief) {
Set<Long> taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()), TaxAgentPO::getId);
salarySobs = salarySobs.stream().filter(sob -> CollectionUtil.intersection(taxAgentIds, sob.getTaxAgentIds()).size() > 0).collect(Collectors.toList());
}
// 查询所有管理的薪资账套
SalarySobQueryParam salarySobQueryParam = new SalarySobQueryParam();
salarySobQueryParam.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
List<SalarySobPO> salarySobs = getSalarySobService(user).listAuth(salarySobQueryParam);
return salarySobs.stream().map(m -> {
Map<String, Object> map = new HashMap<>();
map.put("id", String.valueOf(m.getId()));

View File

@ -18,8 +18,6 @@ import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryformula.config.FormluaConfig;
import com.engine.salary.entity.salaryformula.po.FormulaPO;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
import com.engine.salary.entity.salarysob.dto.SalaryItemTopologyDTO;
@ -28,11 +26,13 @@ import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
import com.engine.salary.entity.salarysob.param.SalaryItemTopologyQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salarysob.SalarySobDefaultItemMapper;
import com.engine.salary.mapper.salarysob.SalarySobEmpFieldMapper;
@ -194,15 +194,12 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
Set<Long> backCalcItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId);
salaryItemIds.addAll(backCalcItemIds);
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
final Set<Long> ids = new HashSet<Long>();
if (needAuth) {
Set<Long> collect = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
ids.addAll(collect);
}
//账套项目分权
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Set<Long> ids = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds).stream()
.filter(po -> Boolean.FALSE.equals(needAuth) || getSalaryItemService(user).filterInRange(ids, po))
.filter(po -> getSalaryItemService(user).filterInRange(ids, po))
.collect(Collectors.toList());
//获取系统值
@ -247,13 +244,10 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
Set<Long> backCalcItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId);
salaryItemIds.addAll(backCalcItemIds);
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
final Set<Long> ids = new HashSet<Long>();
if (needAuth) {
Set<Long> collect = getTaxAgentService(user).listAllTaxAgents((long) user.getUID()).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
ids.addAll(collect);
}
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds).stream().filter(po -> Boolean.FALSE.equals(needAuth) || getSalaryItemService(user).filterInRange(ids, po)).collect(Collectors.toList());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Set<Long> ids = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds).stream().filter(po -> getSalaryItemService(user).filterInRange(ids, po)).collect(Collectors.toList());
//获取系统值
List<SalarySobDefaultItemPO> salarySobDefaultItemPOS = getSalarySobDefaultItemMapper().listAll();

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
@ -1051,14 +1052,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
@Override
public void handleHistory() {
int count = getSobTaxLinkMapper().count();
if (count > 0) {
return;
}
List<SalarySobPO> salarySobPOS = getSalarySobMapper().listAll();
salarySobPOS.forEach(sobPO -> {
List<SobTaxLinkPO> sobTaxLinkPOS = getSobTaxLinkMapper().listSome(SobTaxLinkPO.builder().sobId(sobPO.getId()).build());
if(CollUtil.isEmpty(sobTaxLinkPOS)){
SobTaxLinkPO taxLinkPO = SobTaxLinkPO.builder()
.id(IdGenerator.generate())
.taxAgentId(sobPO.getTaxAgentId())
@ -1070,6 +1067,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
getSobTaxLinkMapper().insertIgnoreNull(taxLinkPO);
}
});
}
}

View File

@ -18,7 +18,6 @@ import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
@ -130,26 +129,6 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
return page;
}
private void putQueryRange(SpecialAddDeductionQueryParam queryParam) {
Long employeeId = (long) user.getUID();
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user)
.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId)
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
// 不是个税扣缴义务人管理员限定搜索范围为当前登录人
List<Long> taxAgentIdsAsEmployee = getTaxAgentService(user)
.listAllTaxAgentsAsRange(Collections.singletonList(employeeId))
.stream().filter(t -> t.getEmployeeId().equals(employeeId))
.map(TaxAgentEmployeeTaxAgentDTO::getTaxAgentIds)
.flatMap(Collection::stream)
.collect(Collectors.toList());
queryParam.setTaxAgentIds(taxAgentIdsAsEmployee);
queryParam.setEmployeeId(employeeId);
} else {
//管理员设置相应的个税扣缴义务人来筛选
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}
}
@Override

View File

@ -313,21 +313,9 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
@Override
public Collection<TaxAgentPO> listAllTaxAgentsAsAdmin(Long employeeId) {
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
// 是否开启分权
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
if (!isOpenDevolution) {
return taxAgents;
}
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<Long> enableTaxAgentIds = Lists.newArrayList();
// 1.判断自己是否是管理员 如果是管理员就是能够查看所属个税扣缴义务人
List<TaxAgentAdminPO> taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(taxAgentIds);
// 是管理员的列表
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
enableTaxAgentIds.addAll(adminTaxAgentIds);
return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
return listAuth(param);
}
@Override
@ -493,8 +481,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
}
// 删除管理员
getTaxAgentAdminService(user).deleteByTaxAgentIds(ids);
// 删除分管理员和对应管理范围
// todo taxAgentSubAdminService.deleteByTaxAgentIds(ids);
// 删除人员范围
getTaxAgentManageRangeService(user).deleteByTaxAgentIds(ids);

View File

@ -4,7 +4,6 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailBO;
import com.engine.salary.entity.taxdeclaration.dto.*;
@ -27,7 +26,6 @@ import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import weaver.hrm.User;
import java.util.*;
@ -204,66 +202,13 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
return TaxDeclarationDetailBO.convert2ListDTO4Annual(taxDeclarationDetailPOS, taxDeclarationEmployees, simpleEmployees);
}
/**
* 根据权限范围过滤
*
* @param taxDeclarationPO
* @param taxDeclarationEmployeeDTOS
* @return
*/
private List<TaxDeclarationEmployeeDTO> filterByAuthority(TaxDeclarationPO taxDeclarationPO, List<TaxDeclarationEmployeeDTO> taxDeclarationEmployeeDTOS) {
long employeeId = user.getUID();
if (CollectionUtils.isEmpty(taxDeclarationEmployeeDTOS)) {
return Collections.emptyList();
}
// 判断是否开启了分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
// 是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
if (BooleanUtils.isFalse(openDevolution) || isChief) {
return taxDeclarationEmployeeDTOS;
}
// 查询权限范围内的人员
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId);
Set<String> simpleEmployeeKeySet = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, taxAgentEmployeeDTO -> taxAgentEmployeeDTO.getEmployeeId() + "-" + taxAgentEmployeeDTO.getTaxAgentId());
// 查询权限范围内的外部人员
// List<ExtEmployeePO> extEmployeePOS = extEmployeeService.listCanUseByEmployeeId(employeeId, tenantKey);
// Set<String> extEmployeeKeySet = SalaryEntityUtil.properties(extEmployeePOS, extEmployeePO -> extEmployeePO.getId() + "-" + extEmployeePO.getTaxAgentId());
// 根据权限范围过滤
return taxDeclarationEmployeeDTOS.stream().filter(taxDeclarationEmployeeDTO -> {
if (taxDeclarationEmployeeDTO.getEmployeeType() == null || Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())
&& simpleEmployeeKeySet.contains(taxDeclarationEmployeeDTO.getEmployeeId() + "-" + taxDeclarationPO.getTaxAgentId())) {
return true;
}
// if (Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())
// && extEmployeeKeySet.contains(taxDeclarationEmployeeDTO.getEmployeeId() + "-" + taxDeclarationPO.getTaxAgentId())) {
// return true;
// }
return false;
}).collect(Collectors.toList());
}
@Override
public PageInfo<TaxDeclarationWageListDTO> listDtoPageByParam4Wage(TaxDeclarationDetailListQueryParam queryParam) {
// 查询个税申报主表
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId());
// 查询个税申报表明细的人员
PageInfo<TaxDeclarationEmployeeDTO> employeeIdPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// 判断是否开启了分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
// 是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
// if (BooleanUtils.isTrue(openDevolution) && !isChief) {
// List<TaxDeclarationEmployeeDTO> taxDeclarationEmployeeDTOS = getTaxDeclarationDetailMapper().list4EmployeeId(queryParam.getTaxDeclarationId());
// // 根据权限过滤
// taxDeclarationEmployeeDTOS = filterByAuthority(taxDeclarationPO, taxDeclarationEmployeeDTOS);
// employeeIdPage.setTotal(taxDeclarationEmployeeDTOS.size());
// employeeIdPage.setList(SalaryPageUtil.subList((int) employeeIdPage.getPageNum(), (int) employeeIdPage.getPageSize(), taxDeclarationEmployeeDTOS));
// } else {
employeeIdPage = listPage4EmployeeIdByParam(queryParam);
// }
PageInfo<TaxDeclarationEmployeeDTO> employeeIdPage = listPage4EmployeeIdByParam(queryParam);
PageInfo<TaxDeclarationWageListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclarationWageListDTO.class);
dtoPage.setTotal(employeeIdPage.getTotal());
if (CollectionUtils.isNotEmpty(employeeIdPage.getList())) {
@ -279,15 +224,6 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
.map(TaxDeclarationEmployeeDTO::getEmployeeId)
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
// List<SimpleUserInfo> simpleUserInfos = salaryEmployeeService.listByEmployeeIds(simpleEmployeeIds, tenantKey);
// 查询外部人员
// Set<Long> extEmployeeIds = employeeIdPage.getRecords().stream()
// .filter(taxDeclarationEmployeeDTO -> Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
// .map(TaxDeclarationEmployeeDTO::getEmployeeId)
// .collect(Collectors.toSet());
// List<ExtEmployeePO> extEmployees = extEmployeeService.listByIds(extEmployeeIds, tenantKey);
// 转换成列表dto
List<TaxDeclarationWageListDTO> taxDeclarationWageListDTOS = TaxDeclarationDetailBO.convert2ListDTO4Wage(taxDeclarationDetailPOS,
employeeIdPage.getList(), simpleEmployees);
dtoPage.setList(taxDeclarationWageListDTOS);

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationAddParam;
@ -44,7 +45,6 @@ import com.engine.salary.util.page.SalaryPageUtil;
import com.engine.salary.util.valid.ValidUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import weaver.general.BaseBean;
import weaver.hrm.User;
@ -193,33 +193,15 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
@Override
public void save(TaxDeclarationSaveParam saveParam) {
long currentEmployeeId = user.getUID();
// 个税扣缴义务人id
Set<Long> taxAgentIds;
Long taxAgentId = saveParam.getTaxAgentId();
if (taxAgentId == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "请选择要申报的扣缴义务人!"));
}
if (taxAgentId != null) {
taxAgentIds = Collections.singleton(taxAgentId);
} else {
//管理的扣缴义务人一次性申报逻辑
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
if (BooleanUtils.isFalse(openDevolution)) {
taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAll(), TaxAgentPO::getId);
} else {
taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId), TaxAgentPO::getId);
}
}
// 个税扣缴义务人id
Set<Long> taxAgentIds = Collections.singleton(taxAgentId);
// 检查是否具有权限
if (CollectionUtils.isEmpty(taxAgentIds)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "对不起,您不具备任何个税扣缴义务人的管理权限"));
}
// 查询个税扣缴义务人
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
@ -263,6 +245,11 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
// 查询薪资所属月的薪资核算记录
salaryAcctRecordPOS = listBySalaryMonth(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).build());
// 无薪资核算记录不允许生成个税申报表
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据").replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 如果当前薪资所属月下存在不同的税款所属期属于异常业务场景不允许生成个税申报表
taxCycle = salaryAcctRecordPOS.get(0).getTaxCycle();
boolean differentTaxCycle = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> salaryAcctRecordPO.getTaxCycle().compareTo(taxCycle) != 0);
@ -404,20 +391,14 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
public boolean checkByAuthority(TaxDeclarationPO taxDeclarationPO, Long employeeId) {
// 判断是否开启了分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
// 判断是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
if (openDevolution && !isChief) {
// 查询负责管理的个税扣缴义务人
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
if (CollectionUtils.isEmpty(taxAgentPOS)) {
return false;
}
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
// 获取所有个税扣缴义务人
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentList, TaxAgentPO::getId);
return taxAgentIds.contains(taxDeclarationPO.getTaxAgentId());
}
// 查询个税申报表
return true;
}
@Override
public void withDrawTaxDeclaration(Long taxDeclarationId) {

View File

@ -175,6 +175,7 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
map.put("idNo", e.getIdNo());
map.put("companystartdate", e.getCompanystartdate());
map.put("dismissdate", e.getDismissdate());
map.put("opts", e.getOpts());
// 浮动薪资项目动态
Optional<Map<String, Object>> optionalItem = variableArchiveItemData.stream().filter(f -> f.get("variableArchiveId").toString().equals(e.getId().toString())).findFirst();

View File

@ -71,6 +71,11 @@ public class SalarySysConstant {
*/
public static final String SALARY_ACCT_EMPLOYEE_RULE = "salaryAcctEmployeeRule";
/**
* 是否采用线程池同步异步/1异步 0同步
*/
public static final String SALARY_ACCT_SYNC_TYPE = "SALARY_ACCT_SYNC_TYPE";
/**
* 工资单二次验证方式
*/

View File

@ -42,6 +42,11 @@ import java.util.stream.Collectors;
@Slf4j
public class AutoSyncEmpArchiveStartDateJob extends BaseCronJob {
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
@ -55,12 +60,6 @@ public class AutoSyncEmpArchiveStartDateJob extends BaseCronJob {
return ServiceUtil.getService(SIArchivesServiceImpl.class, user);
}
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveBiz getSalaryArchiveMapper = new SalaryArchiveBiz();
private SocialSchemeMapper getSocialSchemeMapper() {

View File

@ -31,6 +31,13 @@ import java.util.*;
*/
public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
private String syncInsuranceArchive;
private String syncSalaryArchive;
private String allStayAddToPay;
private String allGotoFixed;
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class,user);
}
@ -73,6 +80,8 @@ public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
}
cal.add(Calendar.MONTH, preMonthValue);
Map<Long, String> resignationMap = getSalaryEmployeeService(user).getResignationMapByDate(SalaryDateUtil.getFormatDate(cal.getTime()));
if (StringUtils.isBlank(syncSalaryArchive) || !StringUtils.equals(syncSalaryArchive, "false")) {
// 获取离职人员中没有设置最后发薪日期的薪资档案
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listPayEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
Date now = new Date();
@ -88,7 +97,8 @@ public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
if (CollectionUtils.isNotEmpty(needUpdateSalaryArchiveList)) {
getSalaryArchiveMapper.batchUpdate(needUpdateSalaryArchiveList);
}
}
if (StringUtils.isBlank(syncInsuranceArchive) || !StringUtils.equals(syncInsuranceArchive, "false")) {
// 获取离职人员中没有设置最后缴纳月的社保福利档案
// List<InsuranceArchivesBaseInfoPO> needSyncList = siArchivesBiz.listEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
List<InsuranceArchivesBaseInfoPO> needSyncList = getSIArchivesService(user).listEndDateIsNull(new ArrayList<>(resignationMap.keySet()));
@ -109,5 +119,6 @@ public class AutoSyncResignationEmpArchiveJob extends BaseCronJob {
}
}
}
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -48,7 +49,7 @@ public class ExtEmpController {
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ExtEmpQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<ExtEmpQueryParam, PageInfo<ExtEmpPO>>(user).run(getExtEmpWrapper(user)::listPage, param);
return new ResponseResult<ExtEmpQueryParam, PageInfo<ExtEmpDTO>>(user).run(getExtEmpWrapper(user)::listPage, param);
}
@POST

View File

@ -243,6 +243,38 @@ public class SIAccountController {
}
}
/**
* 正常缴纳页 删除社保核算人员
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/deleteSocialAcctEmp")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSocialAcctEmp(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveCommonAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SaveCommonAccountParam, String>(user).run(getService(user)::deleteSocialAcctEmp, param);
}
/**
* 正常缴纳页 添加社保核算人员
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/addSocialAcctEmp")
@Produces(MediaType.APPLICATION_JSON)
public String addSocialAcctEmp(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody SaveCommonAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SaveCommonAccountParam, String>(user).run(getService(user)::addSocialAcctEmp, param);
}
/**
* 删除月份表单

View File

@ -129,9 +129,7 @@ public class AddUpDeductionWrapper extends Service {
* @return
*/
public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) {
// 构建异步导出参数
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
return getAddUpDeductionService(user).downloadTemplate(isChief, queryParam);
return getAddUpDeductionService(user).downloadTemplate(queryParam);
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.extemp.dto.ExtEmpDTO;
import com.engine.salary.entity.extemp.param.ExtEmpImportParam;
import com.engine.salary.entity.extemp.param.ExtEmpQueryParam;
import com.engine.salary.entity.extemp.param.ExtEmpSaveParam;
@ -30,7 +31,7 @@ public class ExtEmpWrapper extends Service {
}
public PageInfo<ExtEmpPO> listPage(ExtEmpQueryParam param) {
public PageInfo<ExtEmpDTO> listPage(ExtEmpQueryParam param) {
return getExtEmpService(user).listPage(param);
}

View File

@ -12,7 +12,6 @@ import com.engine.salary.entity.salaryarchive.dto.SingleSalaryItemAdjustRecordLi
import com.engine.salary.entity.salaryarchive.param.*;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
@ -102,11 +101,8 @@ public class SalaryArchiveItemWrapper extends Service implements SalaryArchiveIt
columns.add(SalaryI18nUtil.getI18nLabel(85434, "调整后"));
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItemList = getSalaryArchiveItemService(user).getCanAdjustSalaryItems();
Set<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId)
.collect(Collectors.toSet());
List<Map<String, Object>> salaryItems = salaryItemList.stream()
.filter(po -> getSalaryItemService(user).filterInRange(taxAgentIds, po))
.map(m -> {
Map<String, Object> salaryItemMap = new LinkedHashMap<>();
salaryItemMap.put("id", String.valueOf(m.getId()));

View File

@ -10,8 +10,10 @@ import com.engine.salary.entity.salaryarchive.param.SingleTaxAgentAdjustRecordQu
import com.engine.salary.entity.salaryarchive.param.TaxAgentAdjustRecordQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO;
import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalaryArchiveTaxAgentService;
@ -88,7 +90,10 @@ public class SalaryArchiveTaxAgentWrapper extends Service {
private Map<String, Object> buildTaxAgentForm(Date effectiveTime, String adjustReason, String adjustBefore, Long adjustAfter) {
// 个税扣缴义务人下拉列表
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long)user.getUID());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAuth(param);
Map<String, Object> map = new HashMap<>();
map.put("adjustReasonList", SalaryArchiveTaxAgentAdjustReasonEnum.getList());
map.put("taxAgentList", taxAgentList);

View File

@ -4,9 +4,9 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.bo.SalaryArchiveBO;
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveBaseInfoFormDTO;
@ -147,12 +147,6 @@ public class SalaryArchiveWrapper extends Service {
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItems = getSalaryArchiveItemService(user).getCanAdjustSalaryItems();
Set<Long> userTaxAgentIds = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
salaryItems = salaryItems.stream()
.filter(po -> getSalaryItemService(user).filterInRange(userTaxAgentIds, po))
.collect(Collectors.toList());
//整合所有的显示列固定列+薪资项目动态列
List<Map<String, Object>> listMaps = getSalaryArchiveService(user).buildSalaryArchiveData(salaryArchives, taxAgentLists, salaryItems, Boolean.TRUE);

View File

@ -17,7 +17,9 @@ import com.engine.salary.entity.salarysob.param.SalaryItemTopologyQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobItemSaveParam;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryEntityUtil;
@ -79,9 +81,10 @@ public class SalarySobItemWrapper extends Service {
List<SalaryItemPO> salaryItemList = getSalaryItemService(user).listByParam(queryParam);
Set<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgents((long) user.getUID())
.stream().map(TaxAgentPO::getId)
.collect(Collectors.toSet());
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.QUERY_DATA);
Set<Long> taxAgentIds = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toSet());
salaryItemList = salaryItemList.stream()
.filter(po -> getSalaryItemService(user).filterInRange(taxAgentIds, po))
.collect(Collectors.toList());

View File

@ -1,6 +1,5 @@
package com.engine.salary.wrapper;
import cn.hutool.core.collection.CollectionUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
@ -17,10 +16,13 @@ import com.engine.salary.entity.salarysob.po.SalarySobDefaultBackItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salarysob.DeclareReportTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
import com.engine.salary.service.auth.AuthService;
import com.engine.salary.service.auth.AuthServiceImpl;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -69,6 +71,9 @@ public class SalarySobWrapper extends Service {
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
public AuthService getAuthService(User user) {
return ServiceUtil.getService(AuthServiceImpl.class, user);
}
/**
* 薪资账套列表
@ -286,15 +291,7 @@ public class SalarySobWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 判断是否开启了分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
if (!openDevolution) {
return true;
}
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
Collection intersection = CollectionUtil.intersection(taxAgentIds, salarySobPO.getTaxAgentIds());
return intersection.size() > 0;
return getAuthService(user).auth(salarySobPO, AuthFilterTypeEnum.DATA_OPT, SalarySobPO.class);
}
public List<SalarySobPO> listByTaxAgent(SalarySobQueryParam param) {

View File

@ -14,6 +14,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.*;
@ -116,8 +117,6 @@ public class TaxAgentWrapper extends Service {
* @return
*/
public PageInfo<Map<String, Object>> list(TaxAgentQueryParam queryParam) {
// 是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
// 是否开启分权
boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution();
@ -448,11 +447,12 @@ public class TaxAgentWrapper extends Service {
*/
public String syncRange() {
long currentEmployeeId = (long) user.getUID();
List<Long> taxAgentIds = this.getTaxAgentService(user).listAllTaxAgents(currentEmployeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
String index = SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC + "-" + currentEmployeeId;
String syncRange = Util.null2String(Util_DataCache.getObjVal(index));
if (StringUtils.isEmpty(syncRange)) {
TaxAgentQueryParam param = TaxAgentQueryParam.builder().build();
param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA);
List<Long> taxAgentIds = getTaxAgentService(user).listAuth(param).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
getTaxAgentManageRangeService(user).syncManageRange(taxAgentIds, index);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "人员范围同步过于频繁,请稍后再试"));