|
|
|
|
@ -471,26 +471,24 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> mySalaryBill(Long salaryInfoId, Long currentEmployeeId) {
|
|
|
|
|
// List<SalarySendInfoPO> salarySendInfos = new LambdaQueryChainWrapper<>(salarySendInfoMapper)
|
|
|
|
|
// .eq(SalarySendInfoPO::getDeleteType, 0)
|
|
|
|
|
// .eq(SalarySendInfoPO::getTenantKey, currentTenantKey)
|
|
|
|
|
// .eq(SalarySendInfoPO::getId, salaryInfoId).list();
|
|
|
|
|
|
|
|
|
|
if (salaryInfoId == null) {
|
|
|
|
|
throw new SalaryRunTimeException("工资单记录不存在!");
|
|
|
|
|
throw new SalaryRunTimeException("工资单id为空!");
|
|
|
|
|
}
|
|
|
|
|
SalarySendInfoPO po = new SalarySendInfoPO();
|
|
|
|
|
po.setDeleteType(0);
|
|
|
|
|
po.setId(salaryInfoId);
|
|
|
|
|
|
|
|
|
|
List<SalarySendInfoPO> salarySendInfos = salarySendInfoMapper.listSome(po);
|
|
|
|
|
if (CollectionUtils.isEmpty(salarySendInfos)) {
|
|
|
|
|
SalarySendInfoPO salarySendInfo = getSalarySendInfoMapper().getById(salaryInfoId);
|
|
|
|
|
if (salarySendInfo == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
|
|
|
|
|
}
|
|
|
|
|
if (currentEmployeeId.compareTo(salarySendInfos.get(0).getEmployeeId()) != 0) {
|
|
|
|
|
|
|
|
|
|
if (currentEmployeeId.compareTo(salarySendInfo.getEmployeeId()) != 0) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单"));
|
|
|
|
|
}
|
|
|
|
|
SalarySendInfoPO salarySendInfo = salarySendInfos.get(0);
|
|
|
|
|
|
|
|
|
|
// 获取默认模板信息
|
|
|
|
|
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
|
|
|
|
|
if (salarySendPO == null) {
|
|
|
|
|
throw new SalaryRunTimeException("工资单记录不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//工资单查看时效性
|
|
|
|
|
Date limitMonth = getLimitMonth();
|
|
|
|
|
@ -499,11 +497,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "仅能查看" + salaryBillViewingLimitSetting.getLimitMonth() + "月内的工资单"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取默认模板信息
|
|
|
|
|
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
|
|
|
|
|
if (salarySendPO == null) {
|
|
|
|
|
throw new SalaryRunTimeException("工资单不存在");
|
|
|
|
|
}
|
|
|
|
|
// 获取、记录首次查看时间
|
|
|
|
|
Date firstReadingTime = new Date();
|
|
|
|
|
if (salarySendInfo.getFirstReadingTime() == null) {
|
|
|
|
|
@ -536,10 +529,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
// .eq(SalarySendPO::getTenantKey, currentTenantKey)
|
|
|
|
|
// .eq(SalarySendPO::getId, salarySendInfo.getSalarySendId()).list();
|
|
|
|
|
|
|
|
|
|
SalarySendPO sendPo = new SalarySendPO();
|
|
|
|
|
sendPo.setDeleteType(0);
|
|
|
|
|
sendPo.setId(salarySendInfo.getSalarySendId());
|
|
|
|
|
List<SalarySendPO> salarySends = mapper.listSome(sendPo);
|
|
|
|
|
List<SalarySendPO> salarySends = mapper.listSome(SalarySendPO.builder().id(salarySendInfo.getSalarySendId()).build());
|
|
|
|
|
if (CollectionUtils.isEmpty(salarySends)) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100512, "工资单发放不存在"));
|
|
|
|
|
}
|
|
|
|
|
@ -566,13 +556,12 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 获取薪资项目数据
|
|
|
|
|
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salarySendInfo.getSalaryAcctRecordId()).employeeId(currentEmployeeId).build());
|
|
|
|
|
if (CollUtil.isEmpty(salaryAcctResultPOS)) {
|
|
|
|
|
throw new SalaryRunTimeException("薪资核算结果不存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Long salaryAcctRecordId = salarySendInfo.getSalaryAcctRecordId();
|
|
|
|
|
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(currentEmployeeId).build());
|
|
|
|
|
encryptUtil.decryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
|
|
|
|
|
|
|
|
|
|
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salarySendInfo.getSalaryAcctRecordId());
|
|
|
|
|
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
|
|
|
|
|
if (salaryAcctRecordPO == null) {
|
|
|
|
|
throw new SalaryRunTimeException("薪资核算记录不存在!");
|
|
|
|
|
}
|
|
|
|
|
@ -1844,48 +1833,31 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
Long recipient = param.getRecipient();
|
|
|
|
|
|
|
|
|
|
if (salaryInfoId == null) {
|
|
|
|
|
throw new SalaryRunTimeException("工资单记录不存在!");
|
|
|
|
|
throw new SalaryRunTimeException("工资单id为空!");
|
|
|
|
|
}
|
|
|
|
|
SalarySendInfoPO po = new SalarySendInfoPO();
|
|
|
|
|
po.setDeleteType(0);
|
|
|
|
|
po.setId(salaryInfoId);
|
|
|
|
|
|
|
|
|
|
List<SalarySendInfoPO> salarySendInfos = salarySendInfoMapper.listSome(po);
|
|
|
|
|
if (CollectionUtils.isEmpty(salarySendInfos)) {
|
|
|
|
|
SalarySendInfoPO salarySendInfo = getSalarySendInfoMapper().getById(salaryInfoId);
|
|
|
|
|
if (salarySendInfo == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SalarySendInfoPO salarySendInfo = salarySendInfos.get(0);
|
|
|
|
|
|
|
|
|
|
// 获取默认模板信息
|
|
|
|
|
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
|
|
|
|
|
if (salarySendPO == null) {
|
|
|
|
|
throw new SalaryRunTimeException("工资单不存在");
|
|
|
|
|
throw new SalaryRunTimeException("工资单记录不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SalarySendPO sendPo = new SalarySendPO();
|
|
|
|
|
sendPo.setDeleteType(0);
|
|
|
|
|
sendPo.setId(salarySendInfo.getSalarySendId());
|
|
|
|
|
List<SalarySendPO> salarySends = mapper.listSome(sendPo);
|
|
|
|
|
if (CollectionUtils.isEmpty(salarySends)) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100512, "工资单发放不存在"));
|
|
|
|
|
}
|
|
|
|
|
SalarySendPO salarySend = salarySends.get(0);
|
|
|
|
|
Date salaryMonth = salarySend.getSalaryMonth();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取模板
|
|
|
|
|
SalarySobPO salarySob = getSalarySobService(user).getById(salarySend.getSalarySobId());
|
|
|
|
|
SalarySobPO salarySob = getSalarySobService(user).getById(salarySendPO.getSalarySobId());
|
|
|
|
|
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId());
|
|
|
|
|
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Arrays.asList(salarySend.getSalarySobId(), salarySob.getId()));
|
|
|
|
|
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Arrays.asList(salarySendPO.getSalarySobId(), salarySob.getId()));
|
|
|
|
|
if (CollectionUtils.isEmpty(salaryTemplates)) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100518, "没有默认模板,无法发送"));
|
|
|
|
|
}
|
|
|
|
|
SalaryBillSendDTO salaryBillSendDTO = getSalaryBillService(user).buildSendParams(sendPo, taxAgentPO.getName(), salaryTemplates.get(0));
|
|
|
|
|
SalaryBillSendDTO salaryBillSendDTO = getSalaryBillService(user).buildSendParams(salarySendPO, taxAgentPO.getName(), salaryTemplates.get(0));
|
|
|
|
|
|
|
|
|
|
SalaryTemplatePO salaryTemplate = salaryBillSendDTO.getSalaryTemplate();
|
|
|
|
|
if (salaryTemplate==null) {
|
|
|
|
|
if (salaryTemplate == null) {
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100513, "没有默认模板,无法查看"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1977,7 +1949,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|
|
|
|
map.put("employeeInformation", employeeInformation);
|
|
|
|
|
map.put("salaryGroups", itemSetListDTOS);
|
|
|
|
|
|
|
|
|
|
salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salaryMonth, recipient));
|
|
|
|
|
salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salarySendPO.getSalaryMonth(), recipient));
|
|
|
|
|
// 工资单水印文本型动态变量 == 处理
|
|
|
|
|
handleSalaryWatermark(salaryTemplate, salarySendInfo, recipient);
|
|
|
|
|
map.put("salaryTemplate", salaryTemplate);
|
|
|
|
|
|