Merge branch 'release/2.10.1.2401.01' into feature/操作日志组件

This commit is contained in:
sy 2024-02-01 10:21:47 +08:00
commit f4ecb19ef2
43 changed files with 3099 additions and 87 deletions

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);
/

View File

@ -0,0 +1 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500)
/

View File

@ -0,0 +1 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);

View File

@ -0,0 +1,2 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500)
GO

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_template add mobile_feedback_url varchar(500);
/

View File

@ -0,0 +1,150 @@
package com.engine.salary.action;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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;
/**
* @Author: sy
* @Description: 拷贝福利档案并置为在缴
* @Date: 2024/1/29
**/
@Slf4j
public class CopyToPaySIArchiveAction implements Action {
private TaxAgentMapper getTaxAgentMapper() {
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
}
private SIArchivesService getSIArchivesService(User user) {
return ServiceUtil.getService(SIArchivesServiceImpl.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 {
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<CopyToPaySIArchiveAction.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 CopyToPaySIArchiveAction.SalaryField(processField, salaryName, value));
}
List<Map<String, Object>> importData = new ArrayList<>();
importData.add(SalaryEntityUtil.convert2Map(list, CopyToPaySIArchiveAction.SalaryField::getSalaryName, CopyToPaySIArchiveAction.SalaryField::getValue));
//操作人
String uid = list.stream().filter(f -> f.salaryName.equals("操作人")).findFirst().map(CopyToPaySIArchiveAction.SalaryField::getValue).orElse("1");
//增员
String toCopyTaxAgentName = importData.get(0).get("待复制个税扣缴义务人").toString();
String toUpdateTaxAgentName = importData.get(0).get("待更新个税扣缴义务人").toString();
String payStartYearMonth = importData.get(0).getOrDefault("起始缴纳月", "").toString();
if (StrUtil.isNotBlank(payStartYearMonth) && !SalaryDateUtil.checkYearMonth(payStartYearMonth)) {
requestInfo.getRequestManager().setMessage("起始缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
List<TaxAgentPO> toCopyTaxAgentPOS = getTaxAgentMapper().listByName(toCopyTaxAgentName);
List<TaxAgentPO> toUpdateTaxAgentPOS = getTaxAgentMapper().listByName(toUpdateTaxAgentName);
if(CollectionUtils.isEmpty(toCopyTaxAgentPOS)){
requestInfo.getRequestManager().setMessage("待复制个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
if(CollectionUtils.isEmpty(toUpdateTaxAgentPOS)){
requestInfo.getRequestManager().setMessage("待更新个税扣缴义务人不存在!");
return FAILURE_AND_CONTINUE;
}
Long toCopyTaxAgentId = toCopyTaxAgentPOS.get(0).getId();
Long toUpdateTaxAgentId = toUpdateTaxAgentPOS.get(0).getId();
Long employeeId = Long.valueOf(list.stream().filter(f -> "员工id".equals(f.salaryName)).findFirst().map(CopyToPaySIArchiveAction.SalaryField::getValue).orElse("-1"));
User user = new User(Integer.parseInt(uid));
user.setLanguage(7);
//拷贝福利档案并置为在缴
Map<String, Object> resultMap = getSIArchivesService(user).copyToPay(toCopyTaxAgentId, toUpdateTaxAgentId, employeeId, payStartYearMonth);
if (!"success".equals(resultMap.get("type").toString())) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString());
return FAILURE_AND_CONTINUE;
}
} catch (Exception e) {
log.error("福利档案复制并置为在缴异常", e);
requestInfo.getRequestManager().setMessage(e.getMessage());
return FAILURE_AND_CONTINUE;
}
return SUCCESS;
}
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

@ -1,14 +1,18 @@
package com.engine.salary.action;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.siaccount.EmployeeStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
import com.engine.salary.service.SIArchivesService;
import com.engine.salary.service.impl.SIArchivesServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -84,6 +88,12 @@ public class StayDelToStopSIArchiveAction implements Action {
Long taxAgentId = Long.valueOf( taxAgentPOS.get(0).getId() );
Long employeeId = Long.valueOf(importDataMap.getOrDefault("员工id", "-1").toString());
String payEndYearMonth = importDataMap.getOrDefault("最后缴纳月", "").toString();
if (StrUtil.isNotBlank(payEndYearMonth) && !SalaryDateUtil.checkYearMonth(payEndYearMonth)) {
requestInfo.getRequestManager().setMessage("最后缴纳月格式有误,正确格式示例为'2021-01'");
return FAILURE_AND_CONTINUE;
}
//操作人
String uid = importDataMap.getOrDefault("操作人","1").toString();
User user = new User(Integer.parseInt(uid));
@ -92,12 +102,17 @@ public class StayDelToStopSIArchiveAction implements Action {
if(insuranceArchivesBaseInfoPO == null){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工不存在福利档案,请检查后重试!");
return FAILURE_AND_CONTINUE;
} else if(!insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
} else if(StrUtil.isBlank(payEndYearMonth) && !insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())){
requestInfo.getRequestManager().setMessage("该个税扣缴义务人下该员工的福利档案状态不是待减员,无法进行减员操作,请检查后重试!");
return FAILURE_AND_CONTINUE;
}
//减员
Map<String, Object> resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
Map<String, Object> resultMap = new HashMap<>();
if (StrUtil.isBlank(payEndYearMonth)) {
resultMap = getSIArchivesService(user).stayDelToStop(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()));
} else {
resultMap = getSIArchivesService(user).stopWithoutLimit(Collections.singletonList(insuranceArchivesBaseInfoPO.getId()), payEndYearMonth);
}
if (resultMap.get("type").toString().equals("fail")) {
requestInfo.getRequestManager().setMessage(resultMap.get("msg").toString());
return FAILURE_AND_CONTINUE;

View File

@ -80,6 +80,7 @@ public class SalaryTemplateBO {
.ackFeedbackStatus(saveParam.getAckFeedbackStatus()?1:0)
.autoAckDays(saveParam.getAutoAckDays())
.feedbackUrl(saveParam.getFeedbackUrl())
.mobileFeedbackUrl(saveParam.getMobileFeedbackUrl())
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId)

View File

@ -27,6 +27,12 @@ public class SalaryBillAckFeedbackDTO {
*/
private String feedBackUrl;
/**
* 移动端反馈地址
*/
private String mobileFeedbackUrl;
/**
* 超时自动确认天数
*/

View File

@ -92,4 +92,10 @@ public class SalaryTemplateBaseSetDTO {
*
*/
private String feedbackUrl;
/**
* 移动端反馈流程地址
*
*/
private String mobileFeedbackUrl;
}

View File

@ -54,4 +54,7 @@ public class SalaryTemplateListDTO {
@SalaryTableColumn(text = "备注", width = "20%", column = "description")
@TableTitle(title = "备注", dataIndex = "description", key = "description")
private String description;
// 薪资账套id
private Long salarySobId;
}

View File

@ -16,6 +16,8 @@ public class SalaryBillSalaryItemQueryParam extends BaseQueryParam {
private Long groupId;
private String groupName;
private Boolean isReplenish;
private List<String> existSalaryItemIds;

View File

@ -23,6 +23,8 @@ public class SalaryTemplateCopyParam {
// 模板名称")
private String name;
private Long salarySobId;
public static void checkParam(SalaryTemplateCopyParam copyParam) {
if (copyParam.getId() == null) {
throw new SalaryRunTimeException("id必选");

View File

@ -110,6 +110,11 @@ public class SalaryTemplateSaveParam {
*/
private String feedbackUrl;
/**
* 移动端反馈流程地址
*/
private String mobileFeedbackUrl;
List<SalaryBillItemNameSaveParam> salaryBillItemNameSetting;
public static void checkParam(SalaryTemplateSaveParam saveParam) {

View File

@ -192,6 +192,13 @@ public class SalaryTemplatePO {
private String feedbackUrl;
/**
* 移动端反馈流程地址
*
*/
private String mobileFeedbackUrl;
private Collection<Long> salarySobIds;
}

View File

@ -73,7 +73,9 @@ public class SalaryAcctRecordBO {
} else if (SalaryAcctRecordStatusEnum.ARCHIVED == salaryAcctRecordStatusEnum && ( salarySendMap.get(salaryAcctRecordPO.getId()) ==Boolean.TRUE ) ){
btnList.add(new WeaTableOperate("查看", null, "3"));
btnList.add(new WeaTableOperate("重新核算", null, "4"));
btnList.add(new WeaTableOperate("回算", null, "5"));
if(salaryAcctRecordPO.getBackCalcStatus() == null || salaryAcctRecordPO.getBackCalcStatus() == NumberUtils.INTEGER_ZERO) {
btnList.add(new WeaTableOperate("回算", null, "5"));
}
} else {
btnList.add(new WeaTableOperate("查看", null, "3"));
btnList.add(new WeaTableOperate("重新核算", null, "4"));

View File

@ -57,7 +57,7 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam {
private LocalDateRange dismissDate;
//薪资核算人员列表主键id")
private Collection<Long> ids;
private List<Long> ids;
private String workcode;
}

View File

@ -34,7 +34,7 @@ public class SalarySobItemGroupPO {
private Long salarySobId;
/**
* 薪资账套的名称
* 薪资账套中薪资项目分组的名称
*/
private String name;

View File

@ -42,4 +42,7 @@ public class AccountParam {
@DataCheck(require = true,message = "个税扣缴义务人不能为空")
private Long paymentOrganization;
// 是否核算后归档
private boolean fileFlag = false;
}

View File

@ -19,6 +19,9 @@ public enum SalaryArchiveItemAdjustReasonEnum implements BaseEnum<String> {
ONBOARD("ONBOARD", "入职", 85901),
PROBATION_REVIEW("PROBATION_REVIEW", "转正", 85984),
SALARY_ADJUSTMENT("SALARY_ADJUSTMENT", "调薪", 85985),
PROMOTION("SALARY_ADJUSTMENT", "晋升", 85985),
DEMOTION("SALARY_ADJUSTMENT", "降职", 85985),
JOB_TRANSFER("SALARY_ADJUSTMENT", "调岗", 85985),
POSITION_OR_SALARY_ADJUSTMENT("POSITION_OR_SALARY_ADJUSTMENT", "调岗调薪", 85986),
DIMISSION("DIMISSION", "离职", 85902),
OTHER("OTHER", "其他", 84500),

View File

@ -59,6 +59,7 @@
, t.ack_feedback_status
, t.auto_ack_days
, t.feedback_url
, t.mobile_feedback_url
, t.create_time
, t.update_time
, t.creator
@ -92,6 +93,7 @@
ack_feedback_status,
auto_ack_days,
feedback_url,
mobile_feedback_url,
create_time,
update_time,
creator,
@ -366,7 +368,8 @@
t.replenish_name as replenishName,
s.name as salarysob,
t.use_type as useType,
t.description
t.description,
t.salary_sob_id
from
hrsa_salary_template t left join hrsa_salary_sob s on t.salary_sob_id = s.id
where t.delete_type = 0
@ -398,7 +401,8 @@
t.replenish_name as replenishName,
s.name as salarysob,
t.use_type as useType,
t.description
t.description,
t.salary_sob_id
from
hrsa_salary_template t left join hrsa_salary_sob s on t.salary_sob_id = s.id
where t.delete_type = 0
@ -430,7 +434,8 @@
t.replenish_name as replenishName,
s.name as salarysob,
t.use_type as useType,
t.description
t.description,
t.salary_sob_id
from
hrsa_salary_template t left join hrsa_salary_sob s on t.salary_sob_id = s.id
where t.delete_type = 0
@ -534,6 +539,9 @@
<if test="feedbackUrl != null">
feedback_url=#{feedbackUrl},
</if>
<if test="mobileFeedbackUrl != null">
mobile_feedback_url=#{mobileFeedbackUrl},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
@ -636,6 +644,9 @@
<if test="feedbackUrl != null">
feedback_url,
</if>
<if test="mobileFeedbackUrl != null">
mobile_feedback_url,
</if>
<if test="createTime != null">
create_time,
</if>
@ -734,6 +745,9 @@
<if test="feedbackUrl != null">
#{feedbackUrl},
</if>
<if test="mobileFeedbackUrl != null">
#{mobileFeedbackUrl},
</if>
<if test="createTime != null">
#{createTime},
</if>
@ -842,6 +856,9 @@
<if test="feedbackUrl != null">
feedback_url,
</if>
<if test="mobileFeedbackUrl != null">
mobile_feedback_url,
</if>
<if test="createTime != null">
create_time,
</if>
@ -940,6 +957,9 @@
<if test="feedbackUrl != null">
#{feedbackUrl},
</if>
<if test="mobileFeedbackUrl != null">
#{mobileFeedbackUrl},
</if>
<if test="createTime != null">
#{createTime},
</if>

View File

@ -36,6 +36,13 @@ public interface OtherSchemeMapper {
*/
List<InsuranceArchivesOtherSchemePO> getOtherById(@Param("ids")List<Long> ids);
/**
* 根据id获取单条
* @param id
* @return
*/
InsuranceArchivesOtherSchemePO getOneById(@Param("id")Long id);
/**
* 批量删除
* @param singletonList

View File

@ -80,6 +80,15 @@
</if>
</select>
<!-- 根据id获取单条记录 -->
<select id="getOneById" resultMap="BaseResultMap" >
SELECT
<include refid="baseColumns"/>
FROM hrsa_other_archives t
WHERE delete_type = 0
AND id = #{id}
</select>
<!-- 批量删除 -->
<delete id="batchDeleteByEmployeeIds">
UPDATE hrsa_other_archives

View File

@ -84,6 +84,13 @@ public interface SIAccountService {
*/
String save(AccountParam param);
/**
* 新建核算并归档
* @param param
* @return
*/
String saveAndFile(AccountParam param);
/**
* 正常缴纳页核算
* @param saveCommonAccountParam
@ -307,5 +314,7 @@ public interface SIAccountService {
boolean checkBalance(InsuranceAccountDetailPO po);
boolean checkBalancePayInsurance(InsuranceAccountDetailPO po);
List<InsuranceAccountViewListDTO> buildRecords(List<InsuranceAccountDetailPO> list, Map<Long, TaxAgentPO> paymentMap);
}

View File

@ -74,6 +74,11 @@ public interface SIArchivesService {
*/
Map<String, Object> stayDelToStop(Collection<Long> ids);
/**
* 批量减员直接减员并给予最后缴纳月
*/
Map<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth);
/**
* 全量减员
*/
@ -89,6 +94,15 @@ public interface SIArchivesService {
*/
Map<String, Object> stayAddToPay(Collection<Long> ids);
/**
* 拷贝福利档案到新的个税扣缴义务人并置为在缴
* @param toCopyTaxAgentId 被拷贝的福利档案所属个税扣缴义务人id
* @param toUpdateTaxAgentId 被更新的福利档案所属个税扣缴义务人id
* @param employeeId 福利档案所属人员id
* @return
*/
Map<String, Object> copyToPay(Long toCopyTaxAgentId, Long toUpdateTaxAgentId, Long employeeId, String payStartYearMonth);
/**
* 待减员页面的删除待办
*/

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.cmd.siarchives.SIArchivesTipsCmd;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siarchives.bo.InsuranceArchivesBaseInfoBO;
import com.engine.salary.entity.siarchives.dto.InsuranceArchivesBaseHistoryDTO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
@ -71,6 +72,8 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
private EncryptUtil encryptUtil = new EncryptUtil();
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@ -876,6 +879,44 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return resultMap;
}
@Override
public Map<String, Object> stopWithoutLimit(Collection<Long> ids, String yearMonth) {
if (CollectionUtils.isEmpty(ids)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(145969, "没有可以操作的记录"));
}
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listByIds(ids);
//分别新建福利档案基础信息相关的社保公积金其他福利档案列表
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
//获取待处理的福利档案基础信息id列表
List<Long> baseInfoIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList());
//分别获取福利档案基础信息相关的社保公积金其他福利档案id列表
List<Long> socialIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
List<Long> fundIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
List<Long> otherIds = baseInfoPOList.stream().map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
//进行减员操作
if (baseInfoIds.size() > 0) {
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
.ids(baseInfoIds).runStatus(EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue()).build());
getSocialSchemeMapper().batchUpdateEndTime(socialIds, yearMonth);
getFundSchemeMapper().batchUpdateEndTime(fundIds, yearMonth);
getOtherSchemeMapper().batchUpdateEndTime(otherIds, yearMonth);
}
Map<String, Object> resultMap = new HashMap<>(2);
String resultMsg = "操作成功";
String resultType = "success";
resultMap.put("type", resultType);
resultMap.put("msg", resultMsg);
return resultMap;
}
/**
* 全量减员
*/
@ -1159,6 +1200,20 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
public PageInfo<InsuranceArchivesBaseHistoryDTO> historyListByEmployeeIdAndOperator(SIArchiveBaseHistoryListParam param) {
List<InsuranceArchivesBaseHistoryDTO> adjustHistoryDTOS = siArchivesBiz.getBaseHistoryByEmployeeIdAndOperator(param.getOperator(), param.getEmployeeId());
// 分权逻辑
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)) {
//防止普通用户查询
adjustHistoryDTOS = new ArrayList<>();
} else {
adjustHistoryDTOS = adjustHistoryDTOS.stream().filter(f -> taxAgents.contains(f.getPaymentOrganization())).collect(Collectors.toList());
}
}
adjustHistoryDTOS.forEach(f -> {
if (StringUtils.isNotBlank(f.getPaymentScope())) {
if(f.getPaymentScope().equals(PaymentScopeEnum.SCOPE_PERSON.getValue().toString())) {
@ -1179,4 +1234,125 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
return listPage;
}
/**
* 拷贝福利档案到新的个税扣缴义务人并置为在缴
*/
@Override
public Map<String, Object> copyToPay(Long toCopyTaxAgentId, Long toUpdateTaxAgentId, Long employeeId, String payStartYearMonth) {
if (toCopyTaxAgentId == null || toUpdateTaxAgentId == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "个税扣缴义务人不能为空"));
}
if (employeeId == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "人员id不能为空"));
}
//获取待拷贝的福利档案明细
InsuranceArchivesBaseInfoPO toCopyBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(toCopyTaxAgentId, employeeId);
if(toCopyBaseInfoPO == null){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "待复制个税扣缴义务人下该员工不存在福利档案,请检查后重试!"));
}
InsuranceArchivesSocialSchemePO toCopySocialInfo = getSocialSchemeMapper().getOneById(toCopyBaseInfoPO.getSocialArchivesId());
InsuranceArchivesFundSchemePO toCopyFundInfo = getFundSchemeMapper().getOneById(toCopyBaseInfoPO.getFundArchivesId());
InsuranceArchivesOtherSchemePO toCopyOtherInfo = getOtherSchemeMapper().getOneById(toCopyBaseInfoPO.getOtherArchivesId());
//获取待更新的福利档案
InsuranceArchivesBaseInfoPO toUpdateBaseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(toUpdateTaxAgentId, employeeId);
if(toUpdateBaseInfoPO == null){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "待更新个税扣缴义务人下该员工不存在福利档案,请检查后重试!"));
}
InsuranceArchivesSocialSchemePO toUpdateSocialInfo = getSocialSchemeMapper().getOneById(toUpdateBaseInfoPO.getSocialArchivesId());
InsuranceArchivesFundSchemePO toUpdateFundInfo = getFundSchemeMapper().getOneById(toUpdateBaseInfoPO.getFundArchivesId());
InsuranceArchivesOtherSchemePO toUpdateOtherInfo = getOtherSchemeMapper().getOneById(toUpdateBaseInfoPO.getOtherArchivesId());
//设置福利档案基数调整记录数据
encryptUtil.decrypt(toCopySocialInfo, InsuranceArchivesSocialSchemePO.class);
encryptUtil.decrypt(toUpdateSocialInfo, InsuranceArchivesSocialSchemePO.class);
encryptUtil.decrypt(toCopyFundInfo, InsuranceArchivesFundSchemePO.class);
encryptUtil.decrypt(toUpdateFundInfo, InsuranceArchivesFundSchemePO.class);
encryptUtil.decrypt(toCopyOtherInfo, InsuranceArchivesOtherSchemePO.class);
encryptUtil.decrypt(toUpdateOtherInfo, InsuranceArchivesOtherSchemePO.class);
InsuranceArchivesBaseHistoryDTO socialAdjustInfo = InsuranceArchivesBaseHistoryDTO.builder()
.adjustAfterSchemeId(toCopySocialInfo.getSocialSchemeId())
.adjustAfterBaseJson(toCopySocialInfo.getSocialPaymentBaseString())
.adjustAfterComBaseJson(toCopySocialInfo.getSocialPaymentComBaseString())
.welfareType(toUpdateSocialInfo.getWelfareType())
.employeeId(toUpdateSocialInfo.getEmployeeId())
.paymentOrganization(toUpdateSocialInfo.getPaymentOrganization())
.adjustBeforeSchemeId(toUpdateSocialInfo.getSocialSchemeId())
.adjustBeforeBaseJson(toUpdateSocialInfo.getSocialPaymentBaseString())
.adjustBeforeComBaseJson(toUpdateSocialInfo.getSocialPaymentComBaseString())
.build();
InsuranceArchivesBaseHistoryDTO fundAdjustInfo = InsuranceArchivesBaseHistoryDTO.builder()
.adjustAfterSchemeId(toCopyFundInfo.getFundSchemeId())
.adjustAfterBaseJson(toCopyFundInfo.getFundPaymentBaseString())
.adjustAfterComBaseJson(toCopyFundInfo.getFundPaymentComBaseString())
.welfareType(toUpdateFundInfo.getWelfareType())
.employeeId(toUpdateFundInfo.getEmployeeId())
.paymentOrganization(toUpdateFundInfo.getPaymentOrganization())
.adjustBeforeSchemeId(toUpdateFundInfo.getFundSchemeId())
.adjustBeforeBaseJson(toUpdateFundInfo.getFundPaymentBaseString())
.adjustBeforeComBaseJson(toUpdateFundInfo.getFundPaymentComBaseString())
.build();
InsuranceArchivesBaseHistoryDTO otherAdjustInfo = InsuranceArchivesBaseHistoryDTO.builder()
.adjustAfterSchemeId(toCopyOtherInfo.getOtherSchemeId())
.adjustAfterBaseJson(toCopyOtherInfo.getOtherPaymentBaseString())
.adjustAfterComBaseJson(toCopyOtherInfo.getOtherPaymentComBaseString())
.welfareType(toUpdateOtherInfo.getWelfareType())
.employeeId(toUpdateOtherInfo.getEmployeeId())
.paymentOrganization(toUpdateOtherInfo.getPaymentOrganization())
.adjustBeforeSchemeId(toUpdateOtherInfo.getOtherSchemeId())
.adjustBeforeBaseJson(toUpdateOtherInfo.getOtherPaymentBaseString())
.adjustBeforeComBaseJson(toUpdateOtherInfo.getOtherPaymentComBaseString())
.build();
List<InsuranceArchivesBaseHistoryPO> adjustHistoryList = new ArrayList<>();
adjustHistoryList.addAll(siArchivesBiz.createAdjustInfo(socialAdjustInfo, (long) user.getUID()));
adjustHistoryList.addAll(siArchivesBiz.createAdjustInfo(fundAdjustInfo, (long) user.getUID()));
adjustHistoryList.addAll(siArchivesBiz.createAdjustInfo(otherAdjustInfo, (long) user.getUID()));
//更新字段
toUpdateBaseInfoPO.setRunStatus(EmployeeStatusEnum.PAYING.getValue());
toUpdateSocialInfo.setSocialAccount(toCopySocialInfo.getSocialAccount());
toUpdateSocialInfo.setSocialSchemeId(toCopySocialInfo.getSocialSchemeId());
toUpdateSocialInfo.setSocialPaymentBaseString(toCopySocialInfo.getSocialPaymentBaseString());
toUpdateSocialInfo.setSocialPaymentComBaseString(toCopySocialInfo.getSocialPaymentComBaseString());
toUpdateSocialInfo.setNonPayment(toCopySocialInfo.getNonPayment());
toUpdateSocialInfo.setUnderTake(toCopySocialInfo.getUnderTake());
toUpdateSocialInfo.setSocialStartTime(StringUtils.isNotBlank(payStartYearMonth) ? payStartYearMonth : toCopySocialInfo.getSocialStartTime());
toUpdateSocialInfo.setUpdateTime(new Date());
toUpdateFundInfo.setFundAccount(toCopyFundInfo.getFundAccount());
toUpdateFundInfo.setSupplementFundAccount(toCopyFundInfo.getSupplementFundAccount());
toUpdateFundInfo.setFundSchemeId(toCopyFundInfo.getFundSchemeId());
toUpdateFundInfo.setFundPaymentBaseString(toCopyFundInfo.getFundPaymentBaseString());
toUpdateFundInfo.setFundPaymentComBaseString(toCopyFundInfo.getFundPaymentComBaseString());
toUpdateFundInfo.setNonPayment(toCopyFundInfo.getNonPayment());
toUpdateFundInfo.setUnderTake(toCopyFundInfo.getUnderTake());
toUpdateFundInfo.setFundStartTime(StringUtils.isNotBlank(payStartYearMonth) ? payStartYearMonth : toCopyFundInfo.getFundStartTime());
toUpdateFundInfo.setUpdateTime(new Date());
toUpdateOtherInfo.setOtherSchemeId(toCopyOtherInfo.getOtherSchemeId());
toUpdateOtherInfo.setOtherPaymentBaseString(toCopyOtherInfo.getOtherPaymentBaseString());
toUpdateOtherInfo.setOtherPaymentComBaseString(toCopyOtherInfo.getOtherPaymentComBaseString());
toUpdateOtherInfo.setNonPayment(toCopyOtherInfo.getNonPayment());
toUpdateOtherInfo.setUnderTake(toCopyOtherInfo.getUnderTake());
toUpdateOtherInfo.setOtherStartTime(StringUtils.isNotBlank(payStartYearMonth) ? payStartYearMonth : toCopyOtherInfo.getOtherStartTime());
toUpdateOtherInfo.setUpdateTime(new Date());
//档案入库
encryptUtil.encrypt(toUpdateSocialInfo, InsuranceArchivesSocialSchemePO.class);
encryptUtil.encrypt(toUpdateFundInfo, InsuranceArchivesFundSchemePO.class);
encryptUtil.encrypt(toUpdateOtherInfo, InsuranceArchivesOtherSchemePO.class);
getInsuranceBaseInfoMapper().updateById(toUpdateBaseInfoPO);
getSocialSchemeMapper().updateById(toUpdateSocialInfo);
getFundSchemeMapper().updateById(toUpdateFundInfo);
getOtherSchemeMapper().updateById(toUpdateOtherInfo);
//基数调整记录入库
siArchivesBiz.batchInsertAdjustHistory(adjustHistoryList, (long) user.getUID());
Map<String, Object> resultMap = new HashMap<>(2);
String resultMsg = "操作成功";
String resultType = "success";
resultMap.put("type", resultType);
resultMap.put("msg", resultMsg);
return resultMap;
}
}

View File

@ -5,7 +5,6 @@ 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.biz.SIAccountBiz;
import com.engine.salary.biz.SIArchivesBiz;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
@ -68,7 +67,7 @@ public class SIExportServiceImpl extends Service implements SIExportService {
private EncryptUtil encryptUtil = new EncryptUtil();
private SIAccountBiz siAccountBiz = new SIAccountBiz();
// private SIAccountBiz siAccountBiz = new SIAccountBiz();
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
@ -117,7 +116,8 @@ public class SIExportServiceImpl extends Service implements SIExportService {
List<TaxAgentPO> paymentList =getTaxAgentMapper().listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人"));
Map<Long, TaxAgentPO> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgentPO::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap);
// List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap);
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = getSIAccountService(user).buildRecords(insuranceAccountDetailPOS, paymentMap);
List<List<Object>> excelSheetData = new ArrayList<>();
// 1.工作簿名称

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
@ -333,7 +334,18 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
// 查询合并计税的薪资核算人员
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(otherSalaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// 分页参数
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam);
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = new ArrayList<>();
if (CollUtil.isNotEmpty(queryParam.getIds())) {
List<SalaryAcctEmployeePO> list = new ArrayList<>();
List<List<Long>> partition = Lists.partition(queryParam.getIds(), 500);
partition.forEach(ids -> {
queryParam.setIds(ids);
list.addAll(getSalaryAcctEmployeeMapper().list4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam));
});
salaryAcctEmployeePOS = list;
} else {
salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam);
}
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
salaryAcctEmployeePOS, SalaryAcctEmployeePO.class);
}
@ -350,6 +362,17 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
}
// 查询合并计税的薪资核算人员
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(otherSalaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctEmployeePO> list = new ArrayList<>();
if (CollUtil.isNotEmpty(queryParam.getIds())) {
List<List<Long>> partition = Lists.partition(queryParam.getIds(), 500);
partition.forEach(ids -> {
queryParam.setIds(ids);
list.addAll(getSalaryAcctEmployeeMapper().list4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam));
});
return list;
}
return getSalaryAcctEmployeeMapper().list4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam);
}

View File

@ -473,7 +473,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId);
} else {
// 如果查询条件中没有包含"合并计税"那么就需要查询出存在合并计税的人标记给前端
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder().salaryAcctRecordId(queryParam.getSalaryAcctRecordId()).ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId)).build();
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder().salaryAcctRecordId(queryParam.getSalaryAcctRecordId()).ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList())).build();
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = getSalaryAcctEmployeeService(user).listByParam4ConsolidatedTax(accEmployeeQueryParam);
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);
}

View File

@ -404,7 +404,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
excelComments.add(new ExcelComment(7, 0, 9, 2, SalaryI18nUtil.getI18nLabel(100458, "格式样例为'2022-01-01'、'2022/1/1'")));
excelComments.add(new ExcelComment(8, 0, 10, 2, SalaryI18nUtil.getI18nLabel(100458, "必填,格式样例为'2022-01-01'、'2022/1/1'")));
} else if (isSalaryItemAdjust) {
excelComments.add(new ExcelComment(6, 0, 8, 2, SalaryI18nUtil.getI18nLabel(100458, "必填,可填写如:入职,转正,调薪,调岗调薪,离职,其他,初始化")));
excelComments.add(new ExcelComment(6, 0, 8, 2, SalaryI18nUtil.getI18nLabel(100458, "必填,可填写如:入职,转正,调薪,晋升,降职,调岗,调岗调薪,离职,其他,初始化")));
excelComments.add(new ExcelComment(7, 0, 9, 2, SalaryI18nUtil.getI18nLabel(100458, "必填,格式样例为'2022-01-01'、'2022/1/1'")));
}
} else if (isSuspendList) {

View File

@ -100,6 +100,7 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
if (StringUtils.equals(ackFeedbackSetting.getAckStatus(), "1")) {
// 2.保存反馈地址
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getFeedBackUrl(), SALARY_FEEDBACK_URL, "工资单反馈地址", "billSend");
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getMobileFeedbackUrl(), SALARY_FEEDBACK_URL_MOBILE, "移动端工资单反馈地址", "billSend");
// 3.保存自动确认时间
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getAutoAckDays().toString(), SALARY_AUTO_ACK_DAYS, "工资单反馈自动确认", "billSend");
}
@ -126,7 +127,7 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
@Override
public SalaryBillAckFeedbackDTO getDefaultAckFeedbackSetting() {
// 获取反馈开启状态自动确认时长反馈地址
List<String> codes = Arrays.asList(SalarySysConstant.SALARY_SEND_FEEDBACK, SalarySysConstant.SALARY_AUTO_ACK_DAYS, SalarySysConstant.SALARY_FEEDBACK_URL);
List<String> codes = Arrays.asList(SalarySysConstant.SALARY_SEND_FEEDBACK, SalarySysConstant.SALARY_AUTO_ACK_DAYS, SalarySysConstant.SALARY_FEEDBACK_URL, SALARY_FEEDBACK_URL_MOBILE);
List<SalarySysConfPO> sysConfList = getSalarySysConfService(user).getListByCodes(codes);
Map<String, String> sysConfMap = SalaryEntityUtil.convert2Map(sysConfList, SalarySysConfPO::getConfKey, SalarySysConfPO::getConfValue);
@ -137,6 +138,7 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
defaultAckFeedBackDTO.setAckStatus("0");
defaultAckFeedBackDTO.setAutoAckDays(0);
defaultAckFeedBackDTO.setFeedBackUrl("/");
defaultAckFeedBackDTO.setMobileFeedbackUrl("/");
return defaultAckFeedBackDTO;
}
defaultAckFeedBackDTO.setAckStatus(ackStatus);
@ -146,6 +148,9 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
// 反馈地址
String feedbackUrl = sysConfMap.getOrDefault(SalarySysConstant.SALARY_FEEDBACK_URL, "");
defaultAckFeedBackDTO.setFeedBackUrl(feedbackUrl);
String mobileFeedbackUrl = sysConfMap.getOrDefault(SALARY_FEEDBACK_URL_MOBILE, "");
defaultAckFeedBackDTO.setMobileFeedbackUrl(mobileFeedbackUrl);
return defaultAckFeedBackDTO;
}

View File

@ -215,7 +215,7 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary
} else {
SalaryAcctEmployeeQueryParam accEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder()
.salaryAcctRecordId(queryParam.getSalaryAcctRecordId())
.ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId))
.ids(SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()))
.build();
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS4ConsolidatedTax = getSalaryAcctEmployeeService(user).listByParam4ConsolidatedTax(accEmployeeQueryParam);
salaryAcctEmployeeIds4ConsolidatedTax = SalaryEntityUtil.properties(salaryAcctEmployeePOS4ConsolidatedTax, SalaryAcctEmployeePO::getId);

View File

@ -524,6 +524,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
}
SalaryTemplatePO salaryTemplate = buildSalaryTemplateContent(salaryTemplateContent);
if (StringUtils.isNotBlank(salaryTemplate.getFeedbackUrl()) && StringUtils.isBlank(salaryTemplate.getMobileFeedbackUrl())) {
// 如果设置了pc反馈地址没有设置移动端反馈地址则移动端反馈地址默认等于pc反馈地址
salaryTemplate.setMobileFeedbackUrl(salaryTemplate.getFeedbackUrl());
}
// 判断是否是补发
boolean isReplenish = NumberUtils.INTEGER_ONE.equals(salarySendInfo.getSalaryAcctType());
@ -826,6 +830,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
.ackFeedbackStatus(Integer.valueOf(map.getOrDefault("ackFeedbackStatus", "0").toString()))
.autoAckDays(Integer.valueOf(map.getOrDefault("autoAckDays", "0").toString()))
.feedbackUrl(map.getOrDefault("feedbackUrl", "").toString())
.mobileFeedbackUrl(map.getOrDefault("mobileFeedbackUrl", "").toString())
.name(map.getOrDefault("name", "").toString())
.salarySobId(Long.valueOf(map.getOrDefault("salarySobId", "0").toString()))
.useType(Integer.valueOf(map.getOrDefault("useType", "0").toString()))

View File

@ -1,7 +1,9 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobBiz;
@ -16,15 +18,18 @@ import com.engine.salary.entity.salaryBill.param.SalaryTemplateQueryParam;
import com.engine.salary.entity.salaryBill.param.SalaryTemplateSaveParam;
import com.engine.salary.entity.salaryBill.po.SalaryBillItemNamePO;
import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO;
import com.engine.salary.entity.salarysob.po.SalarySobItemHidePO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.enums.salarybill.SalaryTemplateWhetherEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salarysob.SalarySobEmpFieldMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.mzlion.core.utils.BeanUtils;
@ -68,6 +73,14 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
return ServiceUtil.getService(SalaryBillItemNameServiceImpl.class, user);
}
private SalarySobEmpFieldService getSalarySobEmpFieldService(User user) {
return (SalarySobEmpFieldService) ServiceUtil.getService(SalarySobEmpFieldServiceImpl.class, user);
}
private SalarySobEmpFieldMapper getSalarySobEmpFieldMapper() {
return MapperProxyFactory.getProxy(SalarySobEmpFieldMapper.class);
}
@Override
public SalaryTemplatePO getById(Long id) {
return mapper.getById(id);
@ -217,6 +230,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
salaryTemplateNew.setAckFeedbackStatus(saveParam.getAckFeedbackStatus() ? 1 : 0);
salaryTemplateNew.setAutoAckDays(saveParam.getAutoAckDays());
salaryTemplateNew.setFeedbackUrl(saveParam.getFeedbackUrl());
salaryTemplateNew.setMobileFeedbackUrl(saveParam.getMobileFeedbackUrl());
// todo 薪资项目设置检查校验
salaryTemplateNew.setSalaryItemSetting(saveParam.getSalaryItemSetting() != null ? JSONUtil.toJsonStr(saveParam.getSalaryItemSetting()) : "");
salaryTemplateNew.setReplenishSalaryItemSetting(saveParam.getReplenishSalaryItemSetting() != null ? JSONUtil.toJsonStr(saveParam.getReplenishSalaryItemSetting()) : "");
@ -271,7 +285,72 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
BeanUtils.copyProperties(salaryTemplate, salaryTemplateNew);
salaryTemplateNew.setId(null);
salaryTemplateNew.setName(copyParam.getName());
salaryTemplateNew.setReplenishName(copyParam.getName() + "-" + SalaryI18nUtil.getI18nLabel(0, "补发工资单"));
salaryTemplateNew.setUseType(SalaryTemplateWhetherEnum.FALSE.getValue());
//20240122逻辑变更拷贝工资单模板时可变更薪资账套
if (copyParam.getSalarySobId() != null && !copyParam.getSalarySobId().equals(salaryTemplate.getSalarySobId())) {
// 查询薪资账套的员工信息字段
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = getSalarySobEmpFieldService(user).listBySalarySobId(copyParam.getSalarySobId());
List<String> empFieldCodeList = salarySobEmpFieldPOS.stream().map(SalarySobEmpFieldPO::getFieldCode).collect(Collectors.toList());
Map<String, Long> empFieldCodeWithIdMap = SalaryEntityUtil.convert2Map(salarySobEmpFieldPOS, SalarySobEmpFieldPO::getFieldCode, SalarySobEmpFieldPO::getId);
// 查询薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobIdWithHideItem(copyParam.getSalarySobId());
List<Long> salaryItemIdList = salarySobItemPOS.stream().map(SalarySobItemPO::getSalaryItemId).collect(Collectors.toList());
//拷贝数据中的薪资项目
List<SalaryTemplateSalaryItemSetListDTO> salaryItemSettingList = StrUtil.isNotBlank(salaryTemplate.getSalaryItemSetting())
? JSONArray.parseArray(salaryTemplate.getSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class) : new ArrayList<>();
for (SalaryTemplateSalaryItemSetListDTO salaryItemSetting : salaryItemSettingList) {
if ("111111111111111111".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null) {
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
SalarySobEmpFieldPO empFieldPO = getSalarySobEmpFieldMapper().getById(Long.valueOf(templateItem.getSalaryItemId()));
if (empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
templateItem.setId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
templateItem.setSalaryItemId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
newItems.add(templateItem);
}
}
salaryItemSetting.setItems(newItems);
} else if (salaryItemSetting.getItems() != null){
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
if (salaryItemIdList.contains(Long.valueOf(templateItem.getSalaryItemId()))) {
newItems.add(templateItem);
}
}
salaryItemSetting.setItems(newItems);
}
}
List<SalaryTemplateSalaryItemSetListDTO> replenishSalaryItemSettingList = StrUtil.isNotBlank(salaryTemplate.getReplenishSalaryItemSetting())
? JSONArray.parseArray(salaryTemplate.getReplenishSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class): new ArrayList<>();
for (SalaryTemplateSalaryItemSetListDTO salaryItemSetting : replenishSalaryItemSettingList) {
if ("111111111111111111".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null) {
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
SalarySobEmpFieldPO empFieldPO = getSalarySobEmpFieldMapper().getById(Long.valueOf(templateItem.getSalaryItemId()));
if (empFieldCodeList.contains(empFieldPO.getFieldCode()) && empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()) != null) {
templateItem.setId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
templateItem.setSalaryItemId(empFieldCodeWithIdMap.get(empFieldPO.getFieldCode()).toString());
newItems.add(templateItem);
}
}
salaryItemSetting.setItems(newItems);
} else if (!"333333333333333333".equals(salaryItemSetting.getGroupId()) && salaryItemSetting.getItems() != null){
List<SalaryTemplateSalaryItemListDTO> newItems = new ArrayList<>();
for (SalaryTemplateSalaryItemListDTO templateItem : salaryItemSetting.getItems()) {
if (salaryItemIdList.contains(Long.valueOf(templateItem.getSalaryItemId()))) {
newItems.add(templateItem);
}
}
salaryItemSetting.setItems(newItems);
}
}
salaryTemplateNew.setSalaryItemSetting(salaryItemSettingList.size() > 0 ? JSONUtil.toJsonStr(salaryItemSettingList) : "");
salaryTemplateNew.setReplenishSalaryItemSetting(replenishSalaryItemSettingList.size() > 0 ? JSONUtil.toJsonStr(replenishSalaryItemSettingList) : "");
salaryTemplateNew.setSalarySobId(copyParam.getSalarySobId());
}
mapper.insert(salaryTemplateNew);
// 复制工资单自定义名称信息

View File

@ -96,6 +96,11 @@ public class SalarySysConstant {
*/
public static final String SALARY_FEEDBACK_URL = "SALARY_FEEDBACK_URL";
/**
* 工资单反馈地址-移动端
*/
public static final String SALARY_FEEDBACK_URL_MOBILE = "SALARY_FEEDBACK_URL_MOBILE";
/**
* 工资单查询限制
*/

View File

@ -0,0 +1,106 @@
package com.engine.salary.timer;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.common.SalaryContext;
import com.engine.salary.entity.siaccount.param.AccountParam;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.formlua.util.RegularUtil;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import lombok.extern.slf4j.Slf4j;
import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: sy
* @Description: 福利台账核算并归档任务
* @Date: 2024/1/15
**/
@Slf4j
public class AutoSiAccountAndFileJob extends BaseCronJob {
private String diffToCurrentMonth;
public String getDiffToCurrentMonth() {
return diffToCurrentMonth;
}
public void setDiffToCurrentMonth(String diffToCurrentMonth) {
this.diffToCurrentMonth = diffToCurrentMonth;
}
private String taxAgentNames;
public String getTaxAgentNames() {
return taxAgentNames;
}
public void setTaxAgentNames(String taxAgentNames) {
this.taxAgentNames = taxAgentNames;
}
private String fileFlag;
public String getFileFlag() {
return fileFlag;
}
public void setFileFlag(String fileFlag) {
this.fileFlag = fileFlag;
}
private TaxAgentService getTaxAgentService(User user) {
SalaryContext.get().setValue("user",user);
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
public SIAccountService getSIAccountService(User user) {
SalaryContext.get().setValue("user",user);
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
@Override
public void execute() {
if (StrUtil.isNotBlank(diffToCurrentMonth) && (RegularUtil.isInteger(diffToCurrentMonth) || "0".equals(diffToCurrentMonth))) {
User user = new User();
user.setUid(1);
user.setLoginid("sysadmin");
user.setLastname("sysadmin");
Calendar accountTime= Calendar.getInstance();
accountTime.set(Calendar.MONTH, accountTime.get(Calendar.MONTH) + Integer.parseInt(diffToCurrentMonth));
SimpleDateFormat s=new SimpleDateFormat("yyyy-MM");
String accountMonth = s.format(accountTime.getTime());
boolean isFile = false;
if (StrUtil.isNotBlank(fileFlag) && "true".equals(fileFlag)) {
isFile = true;
}
//核算并归档
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
//判断是否过滤个税扣缴义务人
if (StrUtil.isNotBlank(taxAgentNames)) {
List<String> taxAgentNameList = Arrays.stream(taxAgentNames.split(",")).map(String::new).collect(Collectors.toList());
taxAgentList = taxAgentList.stream().filter(f -> taxAgentNameList.contains(f.getName())).collect(Collectors.toList());
}
for (TaxAgentPO po : taxAgentList) {
try {
getSIAccountService(user).saveAndFile(AccountParam.builder().paymentOrganization(po.getId()).billMonth(accountMonth).flag(true).fileFlag(isFile).build());
} catch (Exception e) {
log.info("个税扣缴义务人-" + po.getName() + ",新建账单月份" + accountMonth + "的福利核算(并归档)过程失败,原因:" + e.getMessage());
}
}
}
}
}

View File

@ -0,0 +1,357 @@
package com.engine.salary.util;
import lombok.extern.slf4j.Slf4j;
import sun.reflect.ConstructorAccessor;
import sun.reflect.FieldAccessor;
import sun.reflect.MethodAccessor;
import sun.reflect.ReflectionFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Slf4j
public class EnumUtil {
/**
* 扩展枚举把新枚举的值加入旧枚举里从旧枚举里删除不要的枚举值
* @param oldEnumClass 旧枚举类
* @param newEnumClass 需要扩展的枚举类
* @param removeOldEnums 需要删除的旧枚举值
* @param <O>
* @param <N>
* @throws Exception
*/
public static <O extends Enum,N extends Enum> void extendEnum(Class<O> oldEnumClass,Class<N> newEnumClass,O... removeOldEnums) throws Exception {
boolean needToRemoveOldEnum = removeOldEnums!=null&&removeOldEnums.length>0;
if(needToRemoveOldEnum){
removeEnum(oldEnumClass,removeOldEnums);
}
List newEnums = values(newEnumClass);
Field[] fields = getFields(newEnumClass);
for (Object newEnumObject : newEnums) {
Enum newEnum = Enum.class.cast(newEnumObject);
List<Class> fieldTypeList = new ArrayList<>();
//枚举名称的类型String.class
fieldTypeList.add(String.class);
for (Field field : fields) {
fieldTypeList.add(field.getType());
}
List<Object> fieldValueList = new ArrayList<>();
//枚举名称
fieldValueList.add(newEnum.name());
for (Field field : fields) {
Object value = field.get(newEnum);
fieldValueList.add(value);
}
Class[] fieldTypes = fieldTypeList.toArray(new Class[]{});
String[] fieldValues = fieldValueList.toArray(new String[]{});
addEnum(oldEnumClass,fieldTypes,fieldValues);
}
}
/**
* 新增枚举值
* @param enumClass 枚举类型
* @param fieldTypes 字段的类型第一个是枚举名类型String
* @param fieldValues 字段的值第一个是枚举名称
* @throws Exception
*/
public static <T extends Enum<T>> T addEnum(Class<T> enumClass, Class[] fieldTypes, Object[] fieldValues) throws Exception {
if(fieldTypes==null||fieldTypes.length==0){
throw new RuntimeException("参数fieldTypes为空");
}
if(fieldValues==null||fieldValues.length==0){
throw new RuntimeException("参数fieldValues为空");
}
if(fieldTypes[0]!=String.class){
throw new RuntimeException("参数fieldTypes[0]不是String.class");
}
if(!(fieldValues[0] instanceof String)){
throw new RuntimeException("参数fieldValues[0]不是字符串");
}
if(fieldTypes.length!=fieldValues.length){
throw new RuntimeException("参数fieldTypes和参数fieldValues的长度不一致");
}
ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
String enumName = fieldValues[0].toString();
synchronized (enumClass){
//判断name是否已经添加过了
if(hasEnumName(enumClass,enumName)){
log.info("枚举类{}中已存在该枚举名:{}",enumClass.getSimpleName(),enumName);
return getEnum(enumClass,enumName);
}
//name,ordinal,其他自定义字段
List<Class> allFieldClass = new ArrayList<>(fieldTypes.length + 1);
allFieldClass.add(String.class);
allFieldClass.add(int.class);
for (int i = 1; i < fieldTypes.length; i++) {
allFieldClass.add(fieldTypes[i]);
}
Class[] classes = allFieldClass.toArray(new Class[]{});
Constructor<T> constructor = enumClass.getDeclaredConstructor(classes);
ConstructorAccessor constructorAccessor = reflectionFactory.newConstructorAccessor(constructor);
List<Object> allFields = new ArrayList<>(fieldValues.length + 1);
allFields.add(enumName);
int maxOrdinal = getMaxOrdinal(enumClass);
allFields.add(maxOrdinal+1);
for (int i = 1; i < fieldValues.length; i++) {
allFields.add(fieldValues[i]);
}
//调用枚举的构造方法创建新的枚举值
T newEnum = (T) constructorAccessor.newInstance(allFields.toArray());
log.info("新增枚举:{}" , newEnum);
Field valuesField = enumClass.getDeclaredField("$VALUES");
valuesField.setAccessible(true);
//解除values属性的final限制
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
int modifiers = modifiersField.getInt(valuesField);
modifiers &= ~Modifier.FINAL;
modifiersField.setInt(valuesField, modifiers);
//将新增的枚举值加入values属性里
FieldAccessor fieldAccessor = reflectionFactory.newFieldAccessor(valuesField, false);
T[] ts = (T[]) fieldAccessor.get(enumClass);
List<T> list = new ArrayList<>(Arrays.asList(ts));
list.add(newEnum);
fieldAccessor.set(enumClass, list.toArray(ts));
//将Class对象的enumConstants和enumConstantDirectory清空Enum.valueOf()方法会给它们赋值
/**
* Enum.valueOf()逻辑
* 1.取enumConstantDirectory
* 1.1如果有值则直接返回
* 1.2如果没值则取enumConstants并拷贝到enumConstantDirectory下次可直接返回
* 1.2.1如果enumConstants有值则返回
* 1.2.2如果enumConstants没值则取枚举的values属性并拷贝到enumConstants下次可直接返回
* 2.enumConstantDirectory.get(name)返回
*/
Field enumConstantDirectoryField = enumClass.getClass().getDeclaredField("enumConstantDirectory");
enumConstantDirectoryField.setAccessible(true);
FieldAccessor enumConstantDirectoryFieldAccessor = reflectionFactory.newFieldAccessor(enumConstantDirectoryField, false);
enumConstantDirectoryFieldAccessor.set(enumClass,null);
Field enumConstantsField = enumClass.getClass().getDeclaredField("enumConstants");
enumConstantsField.setAccessible(true);
FieldAccessor enumConstantsFieldAccessor = reflectionFactory.newFieldAccessor(enumConstantsField, false);
enumConstantsFieldAccessor.set(enumClass,null);
return newEnum;
}
}
/**
* 获取枚举类当前最大序号
* @param enumClass 枚举类型
* @param <T>
* @return
* @throws Exception
*/
public static <T extends Enum<T>> int getMaxOrdinal(Class<T> enumClass) throws Exception {
List<T> values = values(enumClass);
if(values==null||values.size()==0){
return 0;
}
int maxOrdinal = 0;
for (T value : values) {
if(maxOrdinal<value.ordinal()){
maxOrdinal = value.ordinal();
}
}
return maxOrdinal;
}
/**
* 删除枚举值
* @param enumClass 枚举类型
* @param removeOldEnums 需要删除的枚举值
* @param <T>
*/
public static <T extends Enum<T>> void removeEnum(Class<T> enumClass, Enum<T>... removeOldEnums) throws Exception {
if(removeOldEnums==null||removeOldEnums.length==0){
log.warn("removeOldEnums为空");
return;
}
ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
synchronized (enumClass){
Field valuesField = enumClass.getDeclaredField("$VALUES");
valuesField.setAccessible(true);
//解除values属性的final限制
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
int modifiers = modifiersField.getInt(valuesField);
modifiers &= ~Modifier.FINAL;
modifiersField.setInt(valuesField, modifiers);
FieldAccessor fieldAccessor = reflectionFactory.newFieldAccessor(valuesField, false);
T[] oldEnumArray = (T[]) fieldAccessor.get(enumClass);
List<T> enumList = new ArrayList<>(Arrays.asList(oldEnumArray));
for (Enum removeOldEnum : removeOldEnums) {
//将指定的枚举值从values属性里删除
enumList.remove(removeOldEnum);
log.info("删除枚举值:{}",removeOldEnum);
}
//把List转成数组
T[] newEnumArray = (T[]) Arrays.copyOf(enumList.toArray(), enumList.size(), oldEnumArray.getClass());
fieldAccessor.set(enumClass, newEnumArray);
}
}
/**
* 修改枚举属性
* @param enumClass 枚举类型
* @param enumName 枚举名称
* @param attributeName 属性名
* @param attributeValue 属性值
* @param <T>
* @throws Exception
*/
public static <T extends Enum<T>> void setAttribute(Class<T> enumClass,String enumName,String attributeName,Object attributeValue) throws Exception {
List<T> values = values(enumClass);
T target = null;
for (T t:values){
if(t.name().equals(enumName)){
target = t;
break;
}
}
if(target==null){
throw new RuntimeException("该枚举类没有枚举名:"+enumName);
}
Field declaredField = target.getClass().getDeclaredField(attributeName);
declaredField.setAccessible(true);
declaredField.set(target,attributeValue);
}
/**
* 修改枚举属性
* @param targetEnum 枚举值
* @param attributeName 属性名
* @param attributeValue 属性值
* @param <T>
* @throws Exception
*/
public static <T extends Enum<T>> void setAttribute(T targetEnum,String attributeName,Object attributeValue) throws Exception {
Field declaredField = targetEnum.getClass().getDeclaredField(attributeName);
declaredField.setAccessible(true);
declaredField.set(targetEnum,attributeValue);
}
/**
* 判断枚举类是否包含了指定枚举名
* @param clazz
* @param enumName
* @param <T>
* @return
*/
public static <T extends Enum<T>> boolean hasEnumName(Class<T> clazz, String enumName) throws Exception {
// 不要用valueOf方法因为它会初始化enumConstantDirectory使得后续调用valueOf方法后拿不到后面加入的枚举值
// try{
// T t = Enum.valueOf(clazz, enumName);
// if(t!=null){
// return true;
// }
// }catch (Exception e){
// e.printStackTrace();
// System.err.println(e.getMessage());
// }
List<T> values = values(clazz);
for (T t:values){
if(t.name().equals(enumName)){
return true;
}
}
return false;
}
/**
* 根据枚举类型和枚举名获取枚举值
* @param clazz 枚举类型
* @param enumName 枚举名称
* @param <T>
* @return
* @throws Exception
*/
public static <T extends Enum<T>> T getEnum(Class<T> clazz, String enumName) throws Exception {
List<T> values = values(clazz);
for (T t:values){
if(t.name().equals(enumName)){
return t;
}
}
return null;
}
/**
* 获取枚举类的所有枚举值
* @param clazz 枚举类型
* @param <T>
* @return
* @throws Exception
*/
public static <T extends Enum<T>> List<T> values(Class<T> clazz) throws Exception {
ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
Field valuesField = clazz.getDeclaredField("$VALUES");
valuesField.setAccessible(true);
FieldAccessor fieldAccessor = reflectionFactory.newFieldAccessor(valuesField, false);
T[] ts = (T[]) fieldAccessor.get(clazz);
List<T> list = new ArrayList<>(Arrays.asList(ts));
return list;
}
/**
* 获取枚举类的所有枚举值
* @param clazz 枚举类型
* @param <T>
* @return
* @throws Exception
*/
public static <T extends Enum<T>> List<T> values2(Class<T> clazz) throws Exception {
ReflectionFactory reflectionFactory = ReflectionFactory.getReflectionFactory();
Method valuesMethod = clazz.getDeclaredMethod("values");
valuesMethod.setAccessible(true);
MethodAccessor methodAccessor = reflectionFactory.newMethodAccessor(valuesMethod);
T[] ts = (T[]) methodAccessor.invoke(clazz, null);
List<T> list = new ArrayList<>(Arrays.asList(ts));
return list;
}
/**
* 获取枚举的字段排除数组类型枚举类型
* @param enumClass
* @return
*/
public static Field[] getFields(Class<? extends Enum> enumClass){
List<Field> result = new ArrayList<>();
Field[] declaredFields = enumClass.getDeclaredFields();
for (Field field : declaredFields) {
Class<?> type = field.getType();
//排除数组类型(values)枚举类型(枚举值)
if(type!=enumClass && !type.isArray()){
field.setAccessible(true);
result.add(field);
}
}
return result.toArray(new Field[]{});
}
/**
* 打印枚举值
* @param enumClass 枚举类型
* @throws Exception
*/
public static void printEnum(Class<? extends Enum> enumClass) throws Exception {
System.out.println("+++++++++++++++++++++++");
List values = values(enumClass);
values.stream().forEach(System.out::println);
System.out.println("+++++++++++++++++++++++");
}
}

View File

@ -2,7 +2,6 @@ package com.engine.salary.web;
import cn.hutool.core.util.BooleanUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
@ -85,8 +84,9 @@ public class SIExportController {
@QueryParam("ids")List<Long> ids,@QueryParam("billMonth") String billMonth) {
InspectAccountParam param = InspectAccountParam.builder().ids(ids).billMonth(billMonth).build();
User user = HrmUserVarify.getUser(request, response);
SIAccountBiz siAccountBiz = new SIAccountBiz();
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountBiz.allInspects(param.getIds(), param.getBillMonth());
// SIAccountBiz siAccountBiz = new SIAccountBiz();
// List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountBiz.allInspects(param.getIds(), param.getBillMonth());
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getService(user).allInspects(param.getIds(), param.getBillMonth());
InsuranceArchivesListParam req = new InsuranceArchivesListParam();
req.setEmployeeIds(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getEmployeeId).distinct().collect(Collectors.toList()));
XSSFWorkbook workbook = getSIExportWrapper(user).export(req);
@ -236,12 +236,13 @@ public class SIExportController {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
InsuranceArchivesListParam param = buildParam(request);
SIAccountBiz siAccountBiz = new SIAccountBiz();
User user = HrmUserVarify.getUser(request, response);
// SIAccountBiz siAccountBiz = new SIAccountBiz();
if (param.getInspectAll() != null && param.getInspectAll()) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountBiz.allInspects(param.getIds(), param.getBillMonth());
// List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = siAccountBiz.allInspects(param.getIds(), param.getBillMonth());
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getService(user).allInspects(param.getIds(), param.getBillMonth());
param.setEmployeeIds(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getEmployeeId).distinct().collect(Collectors.toList()));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIImportWrapper(user).exportTemplate(param);
String time = LocalDate.now().toString();
String fileName = "";

View File

@ -9,16 +9,19 @@ import com.engine.salary.entity.salaryBill.po.SalaryBillItemNamePO;
import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.salarybill.SalaryTemplateReplenishRuleEnum;
import com.engine.salary.enums.salarybill.SalaryTemplateVarEnum;
import com.engine.salary.enums.salarybill.SalaryTemplateWhetherEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salarysob.SalarySobItemGroupMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.mzlion.core.utils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
@ -71,6 +74,10 @@ public class SalaryTemplateWrapper extends Service {
return ServiceUtil.getService(SalaryBillItemNameServiceImpl.class, user);
}
private SalarySobItemGroupMapper getSalarySobItemGroupMapper() {
return MapperProxyFactory.getProxy(SalarySobItemGroupMapper.class);
}
/**
* 工资单模板列表
*
@ -176,6 +183,7 @@ public class SalaryTemplateWrapper extends Service {
}
// 查询所有启用的薪资账套
List<SalarySobPO> salarySobs = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
List<Map<String, Object>> salarySobOptions = salarySobs.stream().map(salarySobPO -> {
@ -199,7 +207,14 @@ public class SalaryTemplateWrapper extends Service {
salaryTemplateBaseSetDTO.setAckFeedbackStatus(StringUtils.equals(defaultAckFeedback.getAckStatus(), "1"));
salaryTemplateBaseSetDTO.setAutoAckDays(defaultAckFeedback.getAutoAckDays());
salaryTemplateBaseSetDTO.setFeedbackUrl(defaultAckFeedback.getFeedBackUrl());
salaryTemplateBaseSetDTO.setMobileFeedbackUrl(defaultAckFeedback.getMobileFeedbackUrl());
}
// 如果设置了pc端反馈流程地址移动端没有设置,则移动端与pc端一致
if (StringUtils.isNotBlank(salaryTemplateBaseSetDTO.getFeedbackUrl()) && StringUtils.isBlank(salaryTemplateBaseSetDTO.getMobileFeedbackUrl())) {
salaryTemplateBaseSetDTO.setMobileFeedbackUrl(salaryTemplateBaseSetDTO.getFeedbackUrl());
}
Map<String, Object> salaryTemplateBase = new HashMap<>();
salaryTemplateBase.put("data", salaryTemplateBaseSetDTO);
salaryTemplateBase.put("salarySobOptions", salarySobOptions);
@ -479,7 +494,13 @@ public class SalaryTemplateWrapper extends Service {
Boolean isReplenish = Optional.ofNullable(param.getIsReplenish()).orElse(false);
List<SalaryTemplateSalaryItemSetListDTO> salaryItemSet = getSalaryTemplateService(user).getSalaryItemSetContainHide(param.getSalarySobId(), param.getSalaryTemplateId(), isReplenish);
Long groupId = param.getGroupId();
return salaryItemSet.stream().filter(s -> Objects.equals(s.getGroupId(), groupId + "")).map(SalaryTemplateSalaryItemSetListDTO::getItems).findFirst().orElse(Collections.emptyList()).stream().filter(item -> !Optional.ofNullable(param.getExistSalaryItemIds()).orElse(Collections.emptyList()).contains(item.getId())).collect(Collectors.toList());
//工资单模板copy可能导致groupId不匹配
List<SalarySobItemGroupPO> salarySobItemGroupPOS = getSalarySobItemGroupMapper().listSome(SalarySobItemGroupPO.builder().salarySobId(param.getSalarySobId()).name(param.getGroupName()).build());
if (salarySobItemGroupPOS != null && salarySobItemGroupPOS.size() > 0) {
groupId = salarySobItemGroupPOS.get(0).getId();
}
Long finalGroupId = groupId;
return salaryItemSet.stream().filter(s -> Objects.equals(s.getGroupId(), finalGroupId + "")).map(SalaryTemplateSalaryItemSetListDTO::getItems).findFirst().orElse(Collections.emptyList()).stream().filter(item -> !Optional.ofNullable(param.getExistSalaryItemIds()).orElse(Collections.emptyList()).contains(item.getId())).collect(Collectors.toList());
}
/**