Merge branch 'release/3.0.0.2311.01' into release/个税版本

This commit is contained in:
钱涛 2023-11-10 15:29:39 +08:00
commit 526c8f8514
25 changed files with 486 additions and 57 deletions

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_stats_report add time_type int;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_stats_report add time_type int;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_stats_report add time_type int;
/

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_stats_report add time_type int
;

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_stats_report add time_type int
/

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_stats_report add time_type int;
/

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_stats_report add time_type int
GO

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_stats_report add time_type int;
/

View File

@ -0,0 +1,221 @@
package com.engine.salary.action;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveImportActionParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam;
import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.enums.salarysob.TargetTypeEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.SalaryArchiveService;
import com.engine.salary.service.TaxAgentManageRangeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
import com.engine.salary.service.impl.TaxAgentManageRangeServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.wrapper.SalaryArchiveWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.Property;
import weaver.soa.workflow.request.RequestInfo;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class RehireAction implements Action {
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
}
private SalaryArchiveService getSalaryArchiveService(User user) {
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
}
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
private String tableName;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
@Override
public String execute(RequestInfo requestInfo) {
try {
User user = new User(1);
Property[] properties = requestInfo.getMainTableInfo().getProperty();
Map<String, String> fieldMap = Arrays.stream(properties).collect(Collectors.toMap(Property::getName,
property -> Util.null2String(property.getValue())));
RecordSet rs = new RecordSet();
String queryImageId = "select salaryname,processfield from " + tableName + " where workflowid = ?";
rs.executeQuery(queryImageId, requestInfo.getWorkflowid());
List<SalaryField> list = new ArrayList<>();
while (rs.next()) {
String processField = rs.getString("processfield");
String salaryName = rs.getString("salaryname");
String value = fieldMap.get(processField);
list.add(new SalaryField(processField, salaryName, value));
}
Map<String, String> salaryFieldMap = SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue);
String taxAgentName = salaryFieldMap.get("个税扣缴义务人");
String empIdStr = salaryFieldMap.get("员工id");
if (StringUtils.isBlank(taxAgentName) || StringUtils.isBlank(empIdStr)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人、或员工id不能为空");
return FAILURE_AND_CONTINUE;
}
// 获取义务人信息
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).list(TaxAgentQueryParam.builder().name(taxAgentName).build());
if (CollectionUtils.isEmpty(taxAgentPOS)) {
requestInfo.getRequestManager().setMessage("个税扣缴义务人不存在");
return FAILURE_AND_CONTINUE;
}
// 先获取该个税扣缴义务人下该员工的薪资档案
Long taxAgentId = taxAgentPOS.get(0).getId();
Long employeeId = Long.valueOf(empIdStr);
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).build());
if (CollectionUtils.isEmpty(salaryArchivePOS)){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下,该员工不存在薪资档案!");
return FAILURE_AND_CONTINUE;
} else if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())) {
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下,该员工没有发过薪。需取消停薪后,申请定薪流程!");
return FAILURE_AND_CONTINUE;
}
if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue())) {
// 停薪来自待停薪 1取消停薪
getSalaryArchiveWrapper(user).cancelStop(Collections.singletonList(salaryArchivePOS.get(0).getId()));
}
if (salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_SUSPEND.getValue()) || salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.SUSPEND.getValue())) {
// 1如果不在人员范围内则把他加入义务人的人员范围2删除待办
addTaxAgentRangeIfNotExist(taxAgentId, employeeId, user);
getSalaryArchiveWrapper(user).deleteSuspendTodo(Collections.singletonList(salaryArchivePOS.get(0).getId()));
}
// 调薪
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, SalaryField::getSalaryName, SalaryField::getValue));
SalaryArchiveImportActionParam build = SalaryArchiveImportActionParam.builder()
.importDatas(importData)
.build();
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(RehireAction.SalaryField::getValue).orElse("1");
Map<String, Object> map = getSalaryArchiveWrapper(new User(Integer.parseInt(uid))).adjustmentSalaryArchive(build);
List errorNotice = (List) map.get("errorNotice");
if (CollectionUtils.isNotEmpty(errorNotice)) {
// 回滚档案状态
getSalaryArchiveMapper().update(salaryArchivePOS.get(0));
log.error("调薪存在异常 requestId:{} map:{}", requestInfo.getRequestid(), map);
List<Map<String, String>> excelComments = (List<Map<String, String>>) map.get("errorNotice");
StringBuilder message = new StringBuilder("");
for (Map<String, String> comments : excelComments) {
message.append(comments.get("message")).append("\n");
}
requestInfo.getRequestManager().setMessage(message.toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("返聘调薪异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
private void addTaxAgentRangeIfNotExist(Long taxAgentId, Long employeeId, User user){
// 获取该义务人下人员范围
Collection<Long> empIds = getTaxAgentService(user).listEmployeeIdsInTaxAgent(taxAgentId);
if (!empIds.contains(employeeId)) {
//将人员添加进个税扣缴义务人中
TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam taxAgentSubAdminRangeTargetParam = new TaxAgentManageRangeSaveParam.TaxAgentSubAdminRangeTargetParam();
taxAgentSubAdminRangeTargetParam.setTargetId(employeeId);
taxAgentSubAdminRangeTargetParam.setTargetType(TargetTypeEnum.EMPLOYEE);
TaxAgentRangeSaveParam taxAgentRangeSaveParam = new TaxAgentRangeSaveParam();
taxAgentRangeSaveParam.setTaxAgentId(taxAgentId);
taxAgentRangeSaveParam.setIncludeType(1);
taxAgentRangeSaveParam.setEmployeeStatus(Arrays.asList("0", "1", "2", "3", "4", "5", "6"));
taxAgentRangeSaveParam.setTargetParams(Collections.singletonList(taxAgentSubAdminRangeTargetParam));
taxAgentRangeSaveParam.setSync(true);
getTaxAgentManageRangeService(user).save(taxAgentRangeSaveParam);
}
}
class SalaryField {
private String processField;
private String salaryName;
private String value;
public String getProcessField() {
return processField;
}
public void setProcessField(String processField) {
this.processField = processField;
}
public String getSalaryName() {
return salaryName;
}
public void setSalaryName(String salaryName) {
this.salaryName = salaryName;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public SalaryField(String processField, String salaryName, String value) {
this.processField = processField;
this.salaryName = salaryName;
this.value = value;
}
}
}

View File

@ -792,8 +792,7 @@
run_status='FIXED',
pay_end_date= null
</set>
WHERE run_status = 'SUSPEND'
and id IN
WHERE id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>

View File

@ -16,6 +16,7 @@
<result column="position_setting" property="positionSetting"/>
<result column="remark" property="remark"/>
<result column="report_name" property="reportName"/>
<result column="time_type" property="timeType"/>
<result column="salary_end_month" property="salaryEndMonth"/>
<result column="salary_start_month" property="salaryStartMonth"/>
<result column="second_dimension" property="secondDimension"/>
@ -56,6 +57,7 @@
, t.tax_agent_setting
, t.tenant_key
, t.update_time
, t.time_type
</sql>
<!-- 查询全部 -->
@ -123,6 +125,9 @@
<if test="reportName != null">
AND report_name = #{reportName}
</if>
<if test="timeType != null">
AND time_type = #{timeType}
</if>
<if test="salaryEndMonth != null">
AND salary_end_month = #{salaryEndMonth}
</if>
@ -210,6 +215,9 @@
<if test="reportName != null">
report_name,
</if>
<if test="timeType != null">
time_type,
</if>
<if test="salaryEndMonth != null">
salary_end_month,
</if>
@ -284,6 +292,9 @@
<if test="reportName != null">
#{reportName},
</if>
<if test="timeType != null">
#{timeType},
</if>
<if test="salaryEndMonth != null">
#{salaryEndMonth},
</if>
@ -334,6 +345,7 @@
position_setting=#{positionSetting},
remark=#{remark},
report_name=#{reportName},
time_type=#{timeType},
salary_end_month=#{salaryEndMonth},
salary_start_month=#{salaryStartMonth},
second_dimension=#{secondDimension},
@ -392,6 +404,9 @@
<if test="reportName != null">
report_name=#{reportName},
</if>
<if test="timeType != null">
time_type=#{timeType},
</if>
<if test="salaryEndMonth != null">
salary_end_month=#{salaryEndMonth},
</if>

View File

@ -14,6 +14,7 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
@ -131,12 +132,15 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
//假期余额信息
List<Map<String, String>> balanceOfLeaveDatas = getBalanceOfLeaveDatas(attend4Salary);
Map<String, String> balanceMap = SalaryEntityUtil.convert2Map(balanceOfLeaveDatas, m -> m.get("id"), m -> m.get("2"));
Map<String, Map<String, String>> balanceMap = SalaryEntityUtil.convert2Map(balanceOfLeaveDatas, m -> m.get("id"));
//给有考勤的赋值
List<String> attendEmpIds = list.stream().map(attend -> {
String resourceId = attend.get("resourceId");
attend.put("balanceOfLeave2", balanceMap.get(resourceId));
Map<String, String> map = balanceMap.getOrDefault(resourceId, new HashMap<>());
for (String key : map.keySet()) {
attend.put("balanceOfLeave_" + key, map.get(key));
}
return resourceId;
}).collect(Collectors.toList());
@ -144,10 +148,13 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
List<Map<String, String>> balanceOfLeaveList = balanceMap.keySet().stream()
.filter(k -> !attendEmpIds.contains(k))
.map(k -> {
Map<String, String> map = new HashMap<>();
map.put("resourceId", k);
map.put("balanceOfLeave2", balanceMap.get(k));
return map;
Map<String, String> result = new HashMap<>();
result.put("resourceId", k);
Map<String, String> map = balanceMap.get(k);
for (String key : map.keySet()) {
result.put("balanceOfLeave_" + key, map.get(key));
}
return result;
})
.collect(Collectors.toList());
list.addAll(balanceOfLeaveList);
@ -167,13 +174,16 @@ public class RemoteAttend4SalaryServiceImpl extends Service implements RemoteAtt
paramsMap.put("status", "9");
paramsMap.put("isNoAccount", true);
List<Map<String, String>> columns = (List<Map<String, String>>) commandExecutor.execute(new GetSearchListCmd(paramsMap, user)).get("columns");
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
//年假
map.put("code", "balanceOfLeave" + 2);
map.put("name", columns.stream().filter(m -> "2".equals(m.get("key"))).findFirst().map(m -> m.get("title")).orElse("年假余额"));
List<Map<String, String>> balanceOfLeaveColumns = new ArrayList<>();
balanceOfLeaveColumns.add(map);
List<Map<String, String>> balanceOfLeaveColumns = columns.stream()
.filter(column -> NumberUtils.isCreatable(column.get("key")))
.map(column -> {
Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
map.put("code", "balanceOfLeave_" + column.get("key"));
map.put("name", "假期余额-" + column.get("title"));
return map;
}).collect(Collectors.toList());
return balanceOfLeaveColumns;
}

View File

@ -99,19 +99,39 @@ public class SalaryStatisticsReportBO {
* @param po
*/
public static void poToQueryParam(SalaryStatisticsReportDataQueryParam param, SalaryStatisticsReportPO po) {
String salaryStartMonth = param.getSalaryStartMonth();
if (salaryStartMonth == null) {
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(po.getSalaryStartMonth()));
} else {
param.setSalaryStartMonth(SalaryDateUtil.getFormatYearMonth(SalaryDateUtil.dateStrToLocalDate(salaryStartMonth)));
}
String salaryEndMonth = param.getSalaryEndMonth();
if (salaryEndMonth == null) {
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(po.getSalaryEndMonth()));
} else {
param.setSalaryEndMonth(SalaryDateUtil.getFormatYearMonth(SalaryDateUtil.dateStrToLocalDate(salaryEndMonth)));
}
String key = "id";
if (po.getTaxAgentSetting() != null) {
param.setTaxAgent(((List<Map>) JSON.parseArray(po.getTaxAgentSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
// param.setIncomeCategory(((List<Map>) JSON.parseArray(po.getIncomeCategorySetting(), Map.class)).stream().map(m -> Integer.valueOf(m.get(key).toString())).collect(Collectors.toList()));
if (po.getSubCompanySetting() != null) {
param.setSubCompany(((List<Map>) JSON.parseArray(po.getSubCompanySetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (po.getDepartSetting() != null) {
param.setDepart(((List<Map>) JSON.parseArray(po.getDepartSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
// param.setGrade(((List<Map>) JSON.parseArray(po.getGradeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
// param.setPosition(((List<Map>) JSON.parseArray(po.getPositionSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
// param.setStatus(((List<Map>) JSON.parseArray(po.getStatusSetting(), Map.class)).stream().map(m -> m.get(key).toString()).collect(Collectors.toList()));
if (po.getEmployeeSetting() != null) {
param.setEmployee(((List<Map>) JSON.parseArray(po.getEmployeeSetting(), Map.class)).stream().map(m -> Long.valueOf(m.get(key).toString())).collect(Collectors.toList()));
}
if (po.getHiredateSetting() != null) {
param.setHiredate(JSON.parseArray(po.getHiredateSetting(), Date.class));
}
// param.setLeavedate(JSON.parseArray(po.getLeavedateSetting(), LocalDate.class));
}
@ -577,7 +597,7 @@ public class SalaryStatisticsReportBO {
* @param sameDetail
*/
private static void calculate4Frequent(Map<String, String> result, SalaryStatisticsItemPO item, List<Map<String, String>> nowDetail, List<Map<String, String>> lastDetail, List<Map<String, String>> sameDetail) {
SalaryStatisticsItemRuleDTO frequentRule = JSON.parseObject(item.getOldRule(), SalaryStatisticsItemRuleDTO.class);
SalaryStatisticsItemRuleDTO frequentRule = JSON.parseObject(item.getFrequentRule(), SalaryStatisticsItemRuleDTO.class);
if (frequentRule == null || frequentRule.getTotalValue() != 1) {
return;
}
@ -611,7 +631,7 @@ public class SalaryStatisticsReportBO {
* @param sameDetail
*/
private static void calculate4Tile(Map<String, String> result, SalaryStatisticsItemPO item, List<Map<String, String>> nowDetail, List<Map<String, String>> lastDetail, List<Map<String, String>> sameDetail) {
SalaryStatisticsItemRuleDTO tileRule = JSON.parseObject(item.getOldRule(), SalaryStatisticsItemRuleDTO.class);
SalaryStatisticsItemRuleDTO tileRule = JSON.parseObject(item.getTileRule(), SalaryStatisticsItemRuleDTO.class);
if (tileRule == null || tileRule.getTotalValue() != 1) {
return;
}
@ -812,6 +832,7 @@ public class SalaryStatisticsReportBO {
.map(Map.Entry::getKey)
.orElse("");
}
/**
* 平铺
*

View File

@ -28,6 +28,21 @@ public class SalaryStatisticsSearchConditionSaveParam {
//统计维度
private Long dimension;
/**
* 1上月
* 2本月
* 3一季度
* 4二季度
* 5三季度
* 6四季度
* 7上半年
* 8下半年
* 9本年
* 10自定义
*/
//事件类型
private Integer timeType;
//薪资所属月-开始月
private Date salaryStartMonth;

View File

@ -21,15 +21,15 @@ import java.util.Date;
@Builder
@NoArgsConstructor
@AllArgsConstructor
//hrsa_salary_stats_report")
//hrsa_salary_stats_report
public class SalaryStatisticsReportPO implements Serializable {
private static final long serialVersionUID = 6526480959578343197L;
//主键id")
//主键id
private Long id;
//报表名称")
//报表名称
private String reportName;
private String remark;
@ -38,58 +38,61 @@ public class SalaryStatisticsReportPO implements Serializable {
private String sortIndex;
private String sortType;
//统计维度")
//时间类型
private Integer timeType;
//统计维度
private String dimension;
//薪资所属月-起始")
//薪资所属月-起始
private Date salaryStartMonth;
//薪资所属月-截止")
//薪资所属月-截止
private Date salaryEndMonth;
//个税扣缴义务人配置")
//个税扣缴义务人配置
private String taxAgentSetting;
//收入所得项目配置")
//收入所得项目配置
private String incomeCategorySetting;
//分部配置")
//分部配置
private String subCompanySetting;
//部门配置")
//部门配置
private String departSetting;
//职级配置")
//职级配置
private String gradeSetting;
//岗位配置")
//岗位配置
private String positionSetting;
//人员状态配置")
//人员状态配置
private String statusSetting;
//人员配置")
//人员配置
private String employeeSetting;
//入职日期配置")
//入职日期配置
private String hiredateSetting;
//离职日期配置")
//离职日期配置
private String leavedateSetting;
//租户key", ignore = true)
//租户key
private String tenantKey;
//创建人id", ignore = true)
//创建人id
private Long creator;
//是否删除", ignore = true)
//是否删除
private Integer deleteType;
//创建时间", ignore = true)
//创建时间
private Date createTime;
//更新时间", ignore = true)
//更新时间
private Date updateTime;

View File

@ -272,6 +272,8 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
po.setLeavedateSetting(JSON.toJSONString(param.getLeavedate()));
}
po.setTimeType(param.getTimeType());
getSalaryStatisticsReportMapper().updateIgnoreNull(po);
// 获取自定义统计项目
@ -370,9 +372,9 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
public PageInfo<Map<String, Object>> buildReportRecords(SalaryStatisticsDimensionPO dimension, SalaryStatisticsReportDataQueryParam param, List<SalaryStatisticsItemPO> salaryStatisticsItemList) {
Map<String, Boolean> checkMap = SalaryStatisticsReportBO.checkLoad(salaryStatisticsItemList);
// 如果一个都没有直接返回
if (!checkMap.get("isNow")) {
return new PageInfo<Map<String, Object>>();
}
// if (!checkMap.get("isNow")) {
// return new PageInfo<Map<String, Object>>();
// }
// 获取本期报表分权后的核算人员
@ -1050,13 +1052,17 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
Map<Long, List<SalaryAcctEmployeePO>> lastEmployeeListMap = data.getLastList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
Map<Long, List<SalaryAcctEmployeePO>> sameEmployeeListMap = data.getSameList().stream().collect(Collectors.groupingBy(SalaryAcctEmployeePO::getEmployeeId));
List<Long> empIds = accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).getEmployeeByIdsAll(empIds)
.stream()
.collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
//人员维度扩展属性
EmployeeInfoExpandDTO employeeInfoExpandDTO = getSalaryStatisticsDimensionService(user).getExpandFieldSettings("dim_employee");
List<FieldSetting> fieldSettings = Optional.ofNullable(Optional.ofNullable(employeeInfoExpandDTO).orElse(new EmployeeInfoExpandDTO()).getFieldSettings()).orElse(new ArrayList<>());
Map<Long, Map<String, String>> expandEmployeeMap = getSalaryEmployeeService(user).expandEmployeeMap(empIds, employeeInfoExpandDTO);
Map<Long, DataCollectionEmployee> employeeByIdMap = getSalaryEmployeeService(user).expandEmployeeInfo(accountDetailPOList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), employeeInfoExpandDTO)
.stream()
.collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, o -> o));
log.info("扩展属性"+expandEmployeeMap);
// List<ExtEmployeePO> extEmployees = extEmployeeService.listByIdsWithDeleted(accountDetailPOList.stream().filter(e -> EmployeeTypeEnum.EXT_EMPLOYEE.getValue().equals(e.getEmployeeType())).map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList()), data.getTenantKey());
// Map<Long, String> employeeExtByIdMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId, ExtEmployeePO::getUsername);
@ -1069,7 +1075,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
temp.put(DM, employeeByIdMap.get(k).getUsername());
fieldSettings.forEach(
fieldSetting -> {
temp.put(fieldSetting.getField(), employeeByIdMap.get(k).getExtendData().get(fieldSetting.getField()));
temp.put(fieldSetting.getField(), expandEmployeeMap.getOrDefault(k,new HashMap<>()).get(fieldSetting.getField()));
}
);
temp.putAll(SalaryStatisticsReportBO.calculateItem(v, lastEmployeeListMap.get(k), sameEmployeeListMap.get(k), salaryAcctResultValueMap, data.getSalaryStatisticsItemList()));

View File

@ -165,6 +165,8 @@ public class SalaryStatisticsReportController {
SalaryStatisticsReportDataQueryParam param = SalaryStatisticsReportDataQueryParam.builder()
.id(Long.parseLong(request.getParameter("id")))
.dimensionId(Long.parseLong(request.getParameter("dimensionId")))
.salaryStartMonth(request.getParameter("salaryStartMonth"))
.salaryEndMonth(request.getParameter("salaryEndMonth"))
.isShare(StringUtils.equals(request.getParameter("isShare"), "true"))
.build();
try {

View File

@ -130,7 +130,9 @@ public class SalaryStatisticsReportWrapper extends Service {
Map<String, Object> temp = new HashMap<>();
temp.put("id", po.getId().toString());
temp.put("reportName", po.getReportName());
temp.put("timeType", po.getTimeType() == null ? 10 : po.getTimeType());
temp.put("salaryStartMonth", SalaryDateUtil.getFormatYearMonth(po.getSalaryStartMonth()));
temp.put("salaryEndMonth", SalaryDateUtil.getFormatYearMonth(po.getSalaryEndMonth()));
List<String> dimNames = Arrays.stream(po.getDimension().split(",")).map(dim -> Optional.ofNullable(salaryStatisticsDimensionMap.get(dim)).orElse("")).collect(Collectors.toList());
temp.put("dimension", StringUtils.join(dimNames, ","));
temp.put("dimensionId", po.getDimension());
@ -238,6 +240,7 @@ public class SalaryStatisticsReportWrapper extends Service {
SalaryAssert.notNull(po, SalaryI18nUtil.getI18nLabel(152563, "报表不存在"));
Map<String, Object> data = new HashMap<>();
data.put("timeType", po.getTimeType() == null ? 10 : po.getTimeType());
data.put("salaryStartMonth", SalaryDateUtil.getFormatYearMonth(po.getSalaryStartMonth()));
data.put("salaryEndMonth", SalaryDateUtil.getFormatYearMonth(po.getSalaryEndMonth()));
data.put("taxAgent", JSONArray.parseArray(po.getTaxAgentSetting()));

View File

@ -110,6 +110,8 @@ public interface SalaryEmployeeService {
*/
List<DataCollectionEmployee> expandEmployeeInfo(List<Long> ids, EmployeeInfoExpandDTO param);
Map<Long,Map<String,String>> expandEmployeeMap(List<Long> ids, EmployeeInfoExpandDTO param);
/**
* 保存扩展信息

View File

@ -216,6 +216,14 @@ public interface TaxAgentService {
*/
List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(Long employeeId);
/**
* 获取个税扣缴义务人和可查看的人员列表(扁平型)
*
* @param
* @return
*/
List<TaxAgentEmployeeDTO> listAllTaxAgentAndEmployee();
/**
* 获取个税扣缴义务人和可查看的人员列表(树型)
*

View File

@ -1198,7 +1198,8 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
// return StringUtils.EMPTY;
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(Long.valueOf(user.getUID()));
// Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(Long.valueOf(user.getUID()));
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree();
// 获取删除待停薪信息
List<SalaryArchiveListDTO> list = getSalaryArchiveMapper().list(SalaryArchiveQueryParam.builder().ids(ids).build());
if (list.size() != ids.size()) {
@ -1248,7 +1249,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
List<TaxAgentEmployeeDTO> taxAgentManageRangeEmployees = getTaxAgentService(user).listTaxAgentAndEmployee((long) user.getUID());
List<TaxAgentEmployeeDTO> taxAgentManageRangeEmployees = getTaxAgentService(user).listAllTaxAgentAndEmployee();
List<SalaryArchivePO> oldPendingList = oldList.stream().filter(f -> f.getRunStatus().equals(SalaryArchiveStatusEnum.STOP_FROM_PENDING.getValue())).collect(Collectors.toList());
boolean isNotExist = oldPendingList.stream().anyMatch(te -> taxAgentManageRangeEmployees.stream().noneMatch(p -> p.getEmployeeId() != null && p.getEmployeeId().equals(te.getEmployeeId()) && p.getTaxAgentId().equals(te.getTaxAgentId())));
if (isNotExist) {

View File

@ -29,6 +29,7 @@ import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@ -46,6 +47,7 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployeeService {
private EmployBiz employBiz = new EmployBiz();
@ -321,6 +323,41 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return employees;
}
@Override
public Map<Long, Map<String, String>> expandEmployeeMap(List<Long> ids, EmployeeInfoExpandDTO param) {
if (CollectionUtils.isNotEmpty(ids) && param != null) {
Map<Long, Map<String, String>> map = new HashMap<>();
List<List<Long>> partition = Lists.partition(ids, 5);
for (int i = 0; i < partition.size(); i++) {
List<Long> idList = partition.get(i);
RecordSet rs = new RecordSet();
String sql = param.getExpandSql().replace("=$人员id$", " in (" + StringUtils.join(idList, ",") + ")")
.replace("in($人员id$)", " in (" + StringUtils.join(idList, ",") + ")");
String primaryKey = param.getPk();
rs.executeQuery(sql);
log.info("扩展属性sql" + sql);
while (rs.next()) {
Map<String, String> extendData = new HashMap<>();
param.getFieldSettings().forEach(setting -> {
String field = setting.getField();
String value = rs.getString(field);
setting.setValue(value);
extendData.put(field, value);
});
String id = rs.getString(primaryKey);
map.put(Long.valueOf(id), extendData);
}
}
return map;
}
return new HashMap<>();
}
@Override
public void saveEmployeeExpandFieldSettings(EmployeeInfoExpandDTO param) {
String settings = JSON.toJSONString(param.getFieldSettings());

View File

@ -619,6 +619,33 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
return listTaxAgentAndEmployee(null, employeeId);
}
@Override
public List<TaxAgentEmployeeDTO> listAllTaxAgentAndEmployee() {
List<TaxAgentEmployeeDTO> taxAgentEmployeeList = Lists.newArrayList();
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree();
taxAgentManageRangeEmployeeList.forEach(m -> {
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> employeeList = m.getEmployeeList();
if (CollectionUtils.isEmpty(employeeList)) {
taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
.taxAgentId(m.getTaxAgentId())
.taxAgentName(m.getTaxAgentName())
.employeeId(null)
.username(null)
.build());
} else {
employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder()
.taxAgentId(m.getTaxAgentId())
.taxAgentName(m.getTaxAgentName())
.employeeId(f.getEmployeeId())
.username(f.getUsername())
.build()));
}
});
return taxAgentEmployeeList;
}
@Override
public List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) {
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
@ -793,6 +820,8 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
return taxAgentEmployeeList;
}
@Override
public Collection<Long> listEmployeeIdsInTaxAgent(Long taxAgentId) {
List<TaxAgentEmpPO> taxAgentEmpPOS = getTaxAgentEmpService(user).listByTaxAgentIds(Collections.singletonList(taxAgentId),UseEmployeeTypeEnum.ALL);

View File

@ -82,6 +82,7 @@ public interface SalarySysConfService {
Map<String, Object> getEncryptProgress(String progressId);
boolean encryptIsOpen();
void cleanEncryptStatus();
/**
* @description 获取个税申报功能重启日期

View File

@ -369,7 +369,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.erkai, "saveEncryptSetting", new LocalRunnable() {
@Override
public void execute() {
saveSettingByType(isOpenEncrypt, OPEN_APPLICATION_ENCRYPT, "开启加密设置", "app");
updateEncrypt(isOpenEncrypt);
Boolean aBoolean = encryptOrDecryptDbWithAsync(isOpenEncrypt, progressId);
}
});
@ -378,7 +378,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
@Override
public void execute() {
Boolean aBoolean = encryptOrDecryptDbWithAsync(isOpenEncrypt, progressId);
saveSettingByType(isOpenEncrypt, OPEN_APPLICATION_ENCRYPT, "开启加密设置", "app");
updateEncrypt(isOpenEncrypt);
}
});
//不要调换方法的位置
@ -408,6 +408,12 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return encryptStatus;
}
@Override
public void cleanEncryptStatus() {
encryptStatus = null;
}
@Override
public Map<String, Object> getEncryptProgress(String progressId) {
Map<String, Object> resultMap = new HashMap<>();
@ -503,6 +509,36 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
}
}
/**
* 开启/关闭加解密
* @param confValue
*/
public void updateEncrypt(String confValue) {
SalarySysConfPO po = getOneByCode(OPEN_APPLICATION_ENCRYPT);
String title = "1".equals(confValue) ? "开启加密设置" : "关闭加密设置";
if (po == null) {
SalarySysConfPO build = SalarySysConfPO.builder()
.id(IdGenerator.generate())
.confKey(OPEN_APPLICATION_ENCRYPT)
.confValue(confValue)
.title(title)
.orderWeight(0)
.module("app")
.updateTime(new Date())
.createTime(new Date())
.deleteType(0)
.build();
getSalarySysConfMapper().insertIgnoreNull(build);
} else {
po.setConfValue(confValue);
po.setTitle(title);
po.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(po);
}
//重新获取加解密
cleanEncryptStatus();
}
@Override
public AppSettingVO appSetting() {
AppSettingVO appSettingVO = AppSettingVO.builder().build();