回算工资单发放调整

This commit is contained in:
Harryxzy 2022-12-19 11:12:26 +08:00
parent eaa9b7515f
commit ddea8c9066
9 changed files with 69 additions and 2 deletions

View File

@ -35,4 +35,10 @@ public class SalarySendBaseInfoDTO {
// @ApiModelProperty("薪资账套的周期")
private SalarySobCycleDTO salarySobCycle;
// 工资单发放类型 1正常 2补发
private String salaryAcctType;
// 是否回算过 0没有回算过1回算过
private Integer haveBackCalc;
}

View File

@ -112,6 +112,10 @@ public class SalarySendListDTO {
@SalaryTableColumn(text = "最后发送时间", width = "15%", column = "lastSendTime")
private Date lastSendTime;
/**
* 薪资核算ID
*/
private Long salaryAcctId;
/**
* 发放状态0未冻结1已冻结
@ -123,5 +127,10 @@ public class SalarySendListDTO {
*/
private Integer salaryAcctType;
/**
* 是否回算过 0没有回算过1回算过
*/
private Integer haveBackCalc;
}

View File

@ -76,4 +76,6 @@ public interface SalaryAcctRecordMapper {
List<SalaryAcctRecordPO> listByCreateDate(@Param(value = "createRange") LocalDateRange createRange, @Param(value = "salarySobIds") Set<Long> salarySobIds);
void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord);
List<SalaryAcctRecordPO> getBackCalcRecordByIds(@Param("collection") Set<Long> salaryAcctIds);
}

View File

@ -142,6 +142,20 @@
ORDER BY id DESC
</select>
<select id="getBackCalcRecordByIds" resultType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO">
select
<include refid="baseColumns"/>
FROM hrsa_salary_acct_record t
where delete_type = 0
AND back_calc_status = 1
<if test="collection != null and collection.size()>0">
AND id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO"

View File

@ -34,6 +34,7 @@
</sql>
<sql id="salarySendColumn">
t1.id,
t1.salary_accounting_id AS salaryAcctId,
t1.send_status AS sendStatus,
t1.salary_acct_type AS salaryAcctType,
t2.salary_month AS salaryYearMonth,

View File

@ -10,6 +10,7 @@ import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 薪资核算记录
@ -190,4 +191,12 @@ public interface SalaryAcctRecordService {
* @date 2022/11/24 16:09
*/
void backCalculate(Long salaryAcctRecordId);
/**
* @description 获取是回算的薪资核算
* @return List<SalaryAecordPO>
* @author Harryxzy
* @date 2022/12/19 9:05
*/
List<SalaryAcctRecordPO> getBackCalcRecordByIds(Set<Long> salaryAcctIds);
}

View File

@ -743,6 +743,14 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
reCalcOrBackCalc(salaryAcctRecordPO, false);
}
@Override
public List<SalaryAcctRecordPO> getBackCalcRecordByIds(Set<Long> salaryAcctIds) {
if (CollectionUtils.isEmpty(salaryAcctIds)) {
return Collections.emptyList();
}
return getSalaryAcctRecordMapper().getBackCalcRecordByIds(salaryAcctIds);
}
/**
* 开启分权后需要判断是否能查看对应的薪资核算记录

View File

@ -406,8 +406,12 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100512, "工资单发放不存在"));
}
Long salaryAcctId = salarySend.getSalaryAccountingId();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
SalarySobCycleDTO salarySobCycleDTO = getSalaryAcctRecordService(user).getSalarySobCycleById(salaryAcctId);
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIds(Collections.singletonList(salarySobCycleDTO.getSalarySobId()));
// 是否有回算记录
boolean haveBackCalc = salaryAcctRecordPOS.stream().filter(PO -> Objects.equals(PO.getBackCalcStatus(), NumberUtils.INTEGER_ONE) &&
Objects.equals(sdf.format(PO.getSalaryMonth()), SalaryDateUtil.MONTH_FORMATTER.format(salarySobCycleDTO.getSalaryMonth())) ).collect(Collectors.toList()).size() > 0;
String template = "";
// 获取默认模板
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Collections.singletonList(salarySend.getSalarySobId()));
@ -419,13 +423,14 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
template = salaryTemplates.get(0).getName();
}
}
return SalarySendBaseInfoDTO.builder()
.salaryMonth(salarySobCycleDTO == null ? null : salarySobCycleDTO.getSalaryMonth())
.template(template)
.salarySobCycle(salarySobCycleDTO)
.sendNum(salarySend.getSendNum())
.sendTotal(salarySend.getSendTotal())
.salaryAcctType(salarySend.getSalaryAcctType().toString())
.haveBackCalc(haveBackCalc ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)
.build();
}

View File

@ -122,8 +122,21 @@ public class SalarySendWrapper extends Service {
e.setTemplate(NumberUtils.INTEGER_ONE.equals(e.getSalaryAcctType()) ? optional.get().getReplenishName() : optional.get().getName());
e.setTemplateId(optional.get().getId());
}
e.setHaveBackCalc(NumberUtils.INTEGER_ZERO);
});
}
// 薪资核算ID
Set<Long> salaryAcctIds = SalaryEntityUtil.properties(pageList, SalarySendListDTO::getSalaryAcctId);
// 获取是回算的薪资核算ID
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).getBackCalcRecordByIds(salaryAcctIds);
Set<String> backCalcSalarySobs = SalaryEntityUtil.properties(salaryAcctRecordPOS, salaryAcctRecordPO -> salaryAcctRecordPO.getSalarySobId() + "-" + sdf.format(salaryAcctRecordPO.getSalaryMonth()));
// 判断是否回算过haveBackCalc 属性
pageList.stream().forEach(salarySendDTO -> {
if(backCalcSalarySobs.contains(salarySendDTO.getSalarySobId() + "-" + sdf.format(salarySendDTO.getSalaryYearMonth()))){
salarySendDTO.setHaveBackCalc(NumberUtils.INTEGER_ONE);
}
});
List<WeaTableColumn> columns = buildWeaTableColumns();
WeaTable table = new WeaTable();
table.setColumns(columns);