Merge branch 'release/2.18.1.2412.01' into custom/欧姆龙

This commit is contained in:
Harryxzy 2024-12-17 14:17:30 +08:00
commit ba99bbcc48
4 changed files with 37 additions and 73 deletions

View File

@ -15,4 +15,6 @@ import java.util.Map;
**/
public interface SQLMapper {
List<Map> runSQL(@Param("sql") String sql);
List<Long> listLong(@Param("sql") String sql);
}

View File

@ -4,4 +4,9 @@
<select id="runSQL" resultType="java.util.Map">
${sql}
</select>
<select id="listLong" resultType="long">
${sql}
</select>
</mapper>

View File

@ -472,7 +472,7 @@ public class SalaryStatisticsReportWrapper extends Service {
SalaryStatisticsItemPO salaryStatisticsItemPO = salaryStatisticsItemMap.get(salaryItemId);
if (salaryStatisticsItemPO != null) {
Optional<String> textItemOptional = Arrays.stream(salaryStatisticsItemPO.getItemValue().split(",")).filter(itemId -> !numberItemIds.contains(itemId)).findFirst();
row.add((!textItemOptional.isPresent() && NumberUtils.isCreatable(Utils.null2String(map.get(k)))) ? new BigDecimal(Utils.null2String(map.get(k))) : map.getOrDefault(k, StringUtils.EMPTY));
row.add((!textItemOptional.isPresent() && NumberUtils.isCreatable(Utils.null2String(map.get(k)).replaceAll(",", ""))) ? new BigDecimal(Utils.null2String(map.get(k)).replaceAll(",", "")) : map.getOrDefault(k, StringUtils.EMPTY));
} else {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
}

View File

@ -50,6 +50,7 @@ import com.engine.salary.enums.salarybill.*;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysend.SalarySendGrantTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.SQLMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
@ -65,6 +66,7 @@ import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
@ -198,6 +200,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
return ServiceUtil.getService(SalaryBillBaseSetServiceImpl.class, user);
}
private SQLMapper getSQLMapper() {
return MapperProxyFactory.getProxy(SQLMapper.class);
}
@Override
public SalarySendPO getById(Long salarySendId) {
return mapper.getById(salarySendId);
@ -479,9 +485,18 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
if (salarySendInfo == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "工资单信息不存在"));
}
Long employeeId = salarySendInfo.getEmployeeId();
if (currentEmployeeId.compareTo(employeeId) != 0) {
if (currentEmployeeId.compareTo(salarySendInfo.getEmployeeId()) != 0) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单"));
//主账号可以查看次账号工资单
String sql = "select id from Hrmresource a where belongto= " + currentEmployeeId;
List<Long> belongtoIds = getSQLMapper().listLong(sql);
if (CollUtil.isNotEmpty(belongtoIds) && belongtoIds.contains(employeeId)) {
//切换user
// this.user = new User(new Integer(employeeId + ""));
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单"));
}
}
// 获取默认模板信息
@ -562,7 +577,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
// 获取薪资项目数据
Long salaryAcctRecordId = salarySendInfo.getSalaryAcctRecordId();
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(currentEmployeeId).build());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordId(salaryAcctRecordId).employeeId(employeeId).build());
if (CollUtil.isEmpty(salaryAcctResultPOS)) {
throw new SalaryRunTimeException("薪资核算结果不存在!");
}
@ -641,16 +656,16 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
}
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId());
DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salarySendInfo.getEmployeeId());
DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(employeeId);
SalaryAcctEmployeePO acctEmployeePO = getSalaryAcctEmployeeService(user).getById(salaryAcctResultPOS.get(0).getSalaryAcctEmpId());
SalaryAcctEmployeeBO.copyAcctEmp(simpleEmployee, acctEmployeePO);
buildEmployeeInfo(employeeInformation, simpleEmployee, taxAgentPO.getName(), SalaryAcctResultBO.buildEmployeeFieldName());
map.put("employeeInformation", employeeInformation);
map.put("salaryGroups", itemSetListDTOS);
salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salaryMonth, currentEmployeeId));
salaryTemplate.setTheme(getBillTitle(salaryTemplate.getTheme(), salaryMonth, employeeId));
// 工资单水印文本型动态变量 == 处理
handleSalaryWatermark(salaryTemplate, salarySendInfo, currentEmployeeId);
handleSalaryWatermark(salaryTemplate, salarySendInfo, employeeId);
map.put("salaryTemplate", salaryTemplate);
map.put("salaryAcctResult", salaryAcctResultS);
@ -704,7 +719,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
MonthTypeEnum monthType = salaryBillViewingLimitSetting.getMonthType();
LocalDate localDate;
if (monthType == MonthTypeEnum.SALARY_DATE) {
localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth()+1).withDayOfMonth(1);
localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth() + 1).withDayOfMonth(1);
} else {
localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth());
}
@ -720,7 +735,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
* @param salaryTemplate
* @param salarySendInfo
*/
private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long currentEmployeeId) {
private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long employeeId) {
SalaryBillWatermarkDTO salaryBillWatermark = JsonUtil.parseObject(salaryTemplate.getSalaryWatermark(), SalaryBillWatermarkDTO.class);
if (Objects.isNull(salaryBillWatermark) || Boolean.FALSE.equals(salaryBillWatermark.getWatermarkStatus())) {
return;
@ -734,7 +749,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
boolean needQueryEmp = (boolean) salaryBillWatermark.getWmSetting().getOrDefault("needQueryEmp", false);
DataCollectionEmployee simpleEmployee = null;
if (needQueryEmp) {
simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(currentEmployeeId);
simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(employeeId);
}
String wmText = salaryBillWatermark.getWmSetting().getOrDefault("wmText", StringUtils.EMPTY).toString();
@ -865,12 +880,12 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
*
* @param theme
* @param salaryMonth
* @param currentEmployeeId
* @param employeeId
* @return
*/
private String getBillTitle(String theme, Date salaryMonth, Long currentEmployeeId) {
private String getBillTitle(String theme, Date salaryMonth, Long employeeId) {
String companyName = "";
if (currentEmployeeId != null) {
if (employeeId != null) {
ResourceComInfo resourceComInfo = null;
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
try {
@ -879,7 +894,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
} catch (Exception e) {
log.error("资源异常", e);
}
companyName = subCompanyComInfo.getSubCompanyname(resourceComInfo.getSubCompanyID(currentEmployeeId + ""));
companyName = subCompanyComInfo.getSubCompanyname(resourceComInfo.getSubCompanyID(employeeId + ""));
}
return theme.replace("${companyName}", companyName)
.replace("${salaryMonth}", new SimpleDateFormat("yyyy年MM月").format(salaryMonth))
@ -934,7 +949,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
.jobtitleName(simpleEmployee.getJobtitleName())
.jobtitleId(simpleEmployee.getJobtitleId())
.status(simpleEmployee.getStatus() == null ? "" : simpleEmployee.getStatus())
.statusName(simpleEmployee.getStatus() == null ? "" : UserStatusEnum.parseByValue(new Integer(Util.null2s(simpleEmployee.getStatus(),"1"))).getDefaultLabel())
.statusName(simpleEmployee.getStatus() == null ? "" : UserStatusEnum.parseByValue(new Integer(Util.null2s(simpleEmployee.getStatus(), "1"))).getDefaultLabel())
.accountTypeName(simpleEmployee.getAccountType() == null ? "" : AccountTypeEnum.parseByValue(simpleEmployee.getAccountType()).getDefaultLabel())
.telephone(StringUtils.isEmpty(simpleEmployee.getTelephone()) ? "" : simpleEmployee.getTelephone())
.username(StringUtils.isEmpty(simpleEmployee.getUsername()) ? "" : simpleEmployee.getUsername())
@ -1328,64 +1343,6 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
}
// /**
// * 发送消息
// *
// * @param salarySend
// * @param enableSendList
// * @param salaryTemplate
// * @param currentTenantKey
// */
// private void sendMessage(SalarySendPO salarySend, List<Map<String, Object>> enableSendList, SalaryTemplatePO salaryTemplate, String tenantName, Long currentEmployeeId, String currentTenantKey) {
// if (StringUtils.isNotBlank(salaryTemplate.getBackground())) {
// FileData fileByte = fileDownloadClient.getFileByte(Long.valueOf(salaryTemplate.getBackground()), currentTenantKey);
// String encode = Base64Encoder.encode(fileByte.getData());
// salaryTemplate.setBackground(encode);
// }
// // 邮箱打开
// boolean isEmailOpen = salaryTemplate.getEmailStatus().equals(SalaryTemplateWhetherEnum.TRUE.getValue());
//
// LocalDate salaryMonth = salarySend.getSalaryMonth();
// String yearI18n = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100325, "");
// String monthI18n = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100326, "");
// String text = salaryMonth.getYear() +
// yearI18n +
// salaryMonth.getMonth().getValue() +
// monthI18n +
// SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100520, "工资待发明细");
//
// UserEntity sendUser = null;
// // 标题
// String title = getBillTitle(salaryTemplate.getTheme(), salaryMonth, tenantName, currentEmployeeId, currentTenantKey);
//
// // 获取所有人员信息
// List<Long> ids = enableSendList.stream().map(e->Long.valueOf(e.get("employeeId").toString())).collect(Collectors.toList());
// List<DataCollectionEmployee> allEmployees = hrmCommonEmployeeService.getEmployeeByIds(ids, currentTenantKey);
// List<SalaryTemplateSalaryItemSetListDTO> listDTOS = JSONArray.parseArray(salaryTemplate.getSalaryItemSetting(), SalaryTemplateSalaryItemSetListDTO.class);
// Optional<SalaryTemplateSalaryItemSetListDTO> optionalEmployeeInformation = listDTOS.stream().filter(e -> SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID.equals(e.getGroupId())).findFirst();
// SalaryTemplateSalaryItemSetListDTO employeeInformation = optionalEmployeeInformation.orElse(null);
// Map<String, String> employeeField = SalaryAcctResultBO.buildEmployeeFieldName();
// enableSendList.forEach(e -> {
// Optional<DataCollectionEmployee> optionalSimpleEmployee = allEmployees.stream().filter(f->f.getEmployeeId().equals(Long.valueOf(e.get("employeeId").toString()))).findFirst();
// if (optionalSimpleEmployee.isPresent()) {
// buildEmployeeInfo(employeeInformation, optionalSimpleEmployee.get(), e.get("taxAgent").toString(), employeeField);
// }
//
// List<UserEntity> receivers = Collections.singletonList(
// SalarySendBO.buildUser(Long.valueOf(e.get("employeeId").toString()), e.get("email") == null ? "" : e.get("email").toString(), currentTenantKey));
// Entity entity = SalarySendBO.buildEntity(e.get("id").toString(), SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94626, "工资单"));
// EmailEntity emailInfo = new EmailEntity();
// // 邮箱打开
// if (isEmailOpen) {
// String emailContent = SalarySendBO.buildEmailContent(e, employeeInformation, title, salaryTemplate);
// emailInfo = SalarySendBO.buildEmailInfo(text, emailContent, salaryTemplate.getSendEmailId());
// }
// SendMessageEntity message = SalarySendBO.buildSendMessageEntity(text, sendUser, receivers, entity, emailInfo);
// log.info("开始发送============:{}", JsonUtil.toJsonString(message));
// // 开始发送
// log.info("发送结果===:{}", JsonUtil.toJsonString(asyncSystemMessageRest.sendMsg(message)));
// });
// }
@Override
public Map<String, Object> withdraw(SalarySendWithdrawParam param) {