Merge branch 'feature/支持工资单短信' into release/2.9.8.2311.02

This commit is contained in:
钱涛 2023-11-22 10:40:30 +08:00
commit addd937b7b
20 changed files with 248 additions and 135 deletions

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_template ADD sms_setting CLOB NULL;
/

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_template ADD sms_setting CLOB NULL;
/

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_template ADD sms_setting CLOB NULL;
/

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_salary_template ADD COLUMN sms_setting text NULL ;

View File

@ -0,0 +1,2 @@
ALTER TABLE hrsa_salary_template ADD sms_setting CLOB NULL
/

View File

@ -0,0 +1 @@
ALTER TABLE hrsa_salary_template ADD COLUMN sms_setting text NULL ;

View File

@ -0,0 +1,2 @@
ALTER TABLE hrsa_salary_template ADD sms_setting text NULL
GO

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_salary_template ADD sms_setting CLOB NULL;
/

View File

@ -72,6 +72,8 @@ public class DataCollectionEmployee {
@SalaryFormulaVar(defaultLabel = "状态编码", labelId = 98624, dataType = "string")
private String status;
@SalaryFormulaVar(defaultLabel = "状态", labelId = 98622, dataType = "string")
private String statusName;
//工号

View File

@ -10,10 +10,7 @@ import com.engine.salary.constant.SalaryArchiveConstant;
import com.engine.salary.constant.SalaryBillConstant;
import com.engine.salary.constant.SalaryTemplateSalaryItemSetGroupConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryBill.dto.SalaryBillSendDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemListDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
import com.engine.salary.entity.salaryBill.dto.*;
import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.enums.salarybill.MessageChannelEnum;
@ -129,21 +126,21 @@ public class SalaryBillBO {
if (employeeInformation == null || simpleEmployee == null) {
return;
}
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(employeeInformation.getItems())) {
if (CollectionUtils.isNotEmpty(employeeInformation.getItems())) {
//获取员工信息的字段名和中文描述的map关系
SalaryFormulaEmployeeDTO salaryFormulaEmployeeDTO = SalaryFormulaEmployeeDTO.builder().employeeId(simpleEmployee.getEmployeeId())
SalaryFormulaEmployeeDTO salaryFormulaEmployeeDTO = SalaryFormulaEmployeeDTO.builder()
.employeeId(simpleEmployee.getEmployeeId())
.taxAgentName(salaryBillSendParam.getTaxAgentName())
.departmentName(simpleEmployee.getDepartmentName())
.email(org.apache.commons.lang3.StringUtils.isEmpty(simpleEmployee.getEmail()) ? "" : simpleEmployee.getEmail())
// .gradeName(simpleEmployee.getGrade() == null ? "" : simpleEmployee.getGrade().getName())
// .hireDate(SalaryDateUtil.getFormatLocalDate(simpleEmployee.getHiredate()))
// .sex(simpleEmployee.getSex() == null ? "" : simpleEmployee.getSex().getDescription())
.mobile(org.apache.commons.lang3.StringUtils.isEmpty(simpleEmployee.getMobile()) ? "" : simpleEmployee.getMobile())
.jobtitleName(simpleEmployee.getJobtitleName())
// .status(StringUtils.isEmpty(simpleEmployee.getPersonnelStatus()) ? "" : simpleEmployee.getPersonnelStatus())
.telephone(org.apache.commons.lang3.StringUtils.isEmpty(simpleEmployee.getTelephone()) ? "" : simpleEmployee.getTelephone())
.username(org.apache.commons.lang3.StringUtils.isEmpty(simpleEmployee.getUsername()) ? "" : simpleEmployee.getUsername())
.email(StringUtils.isEmpty(simpleEmployee.getEmail()) ? "" : simpleEmployee.getEmail())
.sex(simpleEmployee.getSex() == null ? "" : simpleEmployee.getSex())
.mobile(StringUtils.isEmpty(simpleEmployee.getMobile()) ? "" : simpleEmployee.getMobile()).jobtitleName(simpleEmployee.getJobtitleName())
.status(StringUtils.isEmpty(simpleEmployee.getStatus()) ? "" : simpleEmployee.getStatus())
.telephone(StringUtils.isEmpty(simpleEmployee.getTelephone()) ? "" : simpleEmployee.getTelephone())
.username(StringUtils.isEmpty(simpleEmployee.getUsername()) ? "" : simpleEmployee.getUsername())
.workcode(simpleEmployee.getWorkcode())
.idNo(simpleEmployee.getIdNo())
.statusName(simpleEmployee.getStatusName())
.build();
List<SalaryTemplateSalaryItemListDTO> items = employeeInformation.getItems();
// 1.SalaryAcctResultBO.buildEmployeeFieldName()的取法
@ -152,7 +149,7 @@ public class SalaryBillBO {
// Optional<Map.Entry<String, String>> entry = entries.stream().filter(f -> Objects.equals(e.getName(), f.getValue())).findFirst();
// if (entry.isPresent()) {
// String key = entry.get().getKey();
// if (org.apache.commons.lang3.StringUtils.isNotBlank(key)) {
// if (StringUtils.isNotBlank(key)) {
// String getter = "get" + key.substring(0, 1).toUpperCase() + key.substring(1);
// try {
// Method method = salaryFormulaEmployeeDTO.getClass().getMethod(getter);
@ -203,9 +200,7 @@ public class SalaryBillBO {
}
}
return theme
.replace("${companyName}", companyName)
.replace("${salaryMonth}", new SimpleDateFormat("yyyy年MM月").format(salaryMonth));
return theme.replace("${companyName}", companyName).replace("${salaryMonth}", new SimpleDateFormat("yyyy年MM月").format(salaryMonth));
}
// /**
@ -289,7 +284,7 @@ public class SalaryBillBO {
File touch = FileUtil.touch(htmlPath);
FileUtil.appendUtf8String(content, touch);
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator+ sendId + File.separator + id + ".pdf";
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator + sendId + File.separator + id + ".pdf";
FileUtil.del(pdfPath);
HtmlToPdf.convert(HrmSalaryPayrollConf.TO_PDF_TOOL_PATH, htmlPath, pdfPath);
}
@ -364,14 +359,37 @@ public class SalaryBillBO {
public static void sendSMS(Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
System.out.println(111);
// try {
// MessageUtil.sendSMS(mobile, content);
// } catch (Exception e) {
// kqLog.info("SendSMS error.resourceId:" + resourceId + ">>>>>>mobile>>>>>>" + mobile);
// log.writeLog(e);
// }
SalaryTemplateSMSSetDTO smsSetting = salaryBillSendParam.getSmsSetting();
String content = smsSetting != null ? smsSetting.getContent() : "";
if (StringUtils.isBlank(content)) {
return;
}
content = content.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate()));
for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) {
content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue());
}
for (SalaryTemplateSalaryItemSetListDTO salaryTemplateSalaryItemSetListDTO : salaryBillSendParam.getSalaryItemSetList()) {
for (SalaryTemplateSalaryItemListDTO item : salaryTemplateSalaryItemSetListDTO.getItems()) {
if (content.contains("{" + item.getName() + "}")) {
content = content.replace("{" + item.getName() + "}", e.getOrDefault(item.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX, "").toString());
}
}
}
try {
log.info("发送短信内容, {}", content);
if (e.get("mobile") != null) {
MessageUtil.sendSMS(e.get("mobile").toString(), content);
} else {
log.error("发送短信失败,{}手机号为空", e.getOrDefault("username",""));
}
} catch (Exception ex) {
log.error("发送短信失败", ex);
}
}
// /**
@ -563,9 +581,7 @@ public class SalaryBillBO {
InputStream imageInputStream = ImageFileManager.getInputStreamById(imagefileid);
byte[] data = readInputStream(imageInputStream);
String imageBase64 = "data:image/jpeg;base64," + Base64Utils.encodeToString(data);
emailContent.append("<div style='width: 100%;margin-top: 16px;text-align: right;line-height: 1.5715;font-family: PingFangSC-Regular;font-size: 12px;color: #111111;'>\n" +
" <img style='width: 140px;height: 70px;' src='" + imageBase64 + "'>" +
" </div>");
emailContent.append("<div style='width: 100%;margin-top: 16px;text-align: right;line-height: 1.5715;font-family: PingFangSC-Regular;font-size: 12px;color: #111111;'>\n" + " <img style='width: 140px;height: 70px;' src='" + imageBase64 + "'>" + " </div>");
}
}
emailContent.append("</div>");

View File

@ -64,6 +64,9 @@ public class SalaryBillSendDTO {
//工资单模板-薪资项目设置
private List<SalaryTemplateSalaryItemSetListDTO> salaryItemSetList;
//短信模板
private SalaryTemplateSMSSetDTO smsSetting;
//工资单模板-员工基本信息
private SalaryTemplateSalaryItemSetListDTO employeeInformation;
@ -74,7 +77,7 @@ public class SalaryBillSendDTO {
private String remarkI18n;
//邮件是否可以发送邮件
private boolean isEnableEmail;
// private boolean isEnableEmail;
//工资单发放
private SalarySendPO salarySend;

View File

@ -0,0 +1,23 @@
package com.engine.salary.entity.salaryBill.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryTemplateSMSDTO {
//展示名称
private String itemName;
//薪资项目
private String itemKey;
//来源
private String source;
}

View File

@ -0,0 +1,26 @@
package com.engine.salary.entity.salaryBill.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 短信模板设置
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryTemplateSMSSetDTO {
/**
* 内容
*/
private String content;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryBill.param;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSMSSetDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
import com.engine.salary.enums.salarybill.SalaryTemplateTextContentPositionEnum;
import com.engine.salary.exception.SalaryRunTimeException;
@ -45,6 +46,9 @@ public class SalaryTemplateSaveParam {
// 消息中心开启状态falsetrue
private Boolean msgStatus;
// 短信开关 falsetrue
private Boolean smsStatus;
// 主题
private String theme;
@ -78,6 +82,9 @@ public class SalaryTemplateSaveParam {
// 薪资项目设置
private List<SalaryTemplateSalaryItemSetListDTO> salaryItemSetting;
//短信模板
private SalaryTemplateSMSSetDTO smsSetting;
// 补发工资单模板名称
private String replenishName;
@ -100,7 +107,6 @@ public class SalaryTemplateSaveParam {
/**
* 反馈流程地址
*
*/
private String feedbackUrl;
@ -153,11 +159,11 @@ public class SalaryTemplateSaveParam {
}
if (saveParam.getAutoSendStatus() == Boolean.TRUE) {
if(StringUtils.isBlank(saveParam.getAutoSendDayOfMonth()))
if (StringUtils.isBlank(saveParam.getAutoSendDayOfMonth()))
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放日期不能为空"));
if(Objects.isNull(saveParam.getAutoSendCycleType()))
if (Objects.isNull(saveParam.getAutoSendCycleType()))
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放周期不能为空"));
if(StringUtils.isBlank(saveParam.getAutoSendTimeOfDay()))
if (StringUtils.isBlank(saveParam.getAutoSendTimeOfDay()))
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(140509, "自动发放时间不能为空"));
}
}

View File

@ -68,6 +68,11 @@ public class SalaryTemplatePO {
*/
private Integer smsStatus;
/**
* 短信模板设置
*/
private String smsSetting;
/**
* 薪酬水印
*/

View File

@ -26,6 +26,7 @@
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="sms_setting" property="smsSetting"/>
</resultMap>
<!-- 表字段 -->
@ -62,6 +63,7 @@
, t.update_time
, t.creator
, t.delete_type
, t.sms_setting
</sql>
<select id="getById" resultType="com.engine.salary.entity.salaryBill.po.SalaryTemplatePO">
SELECT id,
@ -94,6 +96,7 @@
update_time,
creator,
delete_type,
sms_setting,
tenant_key
FROM hrsa_salary_template
WHERE delete_type = 0
@ -538,7 +541,10 @@
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator}
creator=#{creator},
</if>
<if test="smsSetting != null">
sms_setting=#{smsSetting}
</if>
</set>
WHERE id = #{id} AND delete_type = 0
@ -645,6 +651,9 @@
<if test="tenantKey != null">
tenant_key,
</if>
<if test="smsSetting != null">
sms_setting,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -740,6 +749,9 @@
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="smsSetting != null">
#{smsSetting},
</if>
</trim>
</insert>
@ -845,6 +857,9 @@
<if test="tenantKey != null">
tenant_key,
</if>
<if test="smsSetting != null">
sms_setting,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -940,6 +955,9 @@
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="smsSetting != null">
#{sms_setting},
</if>
</trim>
</insert>

View File

@ -12,10 +12,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.salaryBill.bo.SalaryBillBO;
import com.engine.salary.entity.salaryBill.bo.SalaryTemplateBO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillSendDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
import com.engine.salary.entity.salaryBill.dto.*;
import com.engine.salary.entity.salaryBill.param.SalaryExportPdfParam;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.param.SalarySendInfoQueryParam;
@ -37,6 +34,7 @@ import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.huawei.shade.com.alibaba.fastjson.JSON;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
@ -324,8 +322,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
if (StringUtils.isNotEmpty(salaryTemplate.getTextContent())) {
String yearI18n = SalaryI18nUtil.getI18nLabel(100325, "");
String monthI18n = SalaryI18nUtil.getI18nLabel(100326, "");
salaryTemplate
.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", salaryMonth.getYear() + yearI18n + salaryMonth.getMonth() + monthI18n));
salaryTemplate.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", salaryMonth.getYear() + yearI18n + salaryMonth.getMonth() + monthI18n));
}
// 工资单水印设置
@ -362,6 +359,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
.employeeInformation(employeeInformation)
// 工资单模板-对应人员字段
.employeeField(employeeField)
//短信模板
.smsSetting(JSON.parseObject(salaryTemplate.getSmsSetting(), SalaryTemplateSMSSetDTO.class))
// 工资单模板-发放说明标签国际化
.remarkI18n(remarkI18n)
// 邮件是否可以发送邮件
@ -447,7 +446,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
} else {
/** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail|| isEnableSMS || GEN_PDF) {
if (isEnableEmail || isEnableSMS || GEN_PDF) {
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId()));
}
@ -573,7 +572,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
if (sendChannels.contains(MessageChannelEnum.EMAIL) || sendChannels.contains(MessageChannelEnum.SMS) || GEN_PDF) {
// 构建发送消
// 构建人员信
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
//发送邮件
@ -582,8 +581,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
//发送短信
SalaryBillBO.sendSMS(e, salaryBillSendParam);
if (sendChannels.contains(MessageChannelEnum.SMS)) {
SalaryBillBO.sendSMS(e, salaryBillSendParam);
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobBiz;
@ -139,11 +140,13 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
// 保存
SalaryTemplatePO salaryTemplate = SalaryTemplateBO.convertToPO(saveParam, (long) user.getUID());
// salaryTemplate.setSendEmailId(saveParam.getSendEmail());
salaryTemplate.setEmailStatus(saveParam.getEmailStatus()?1:0);
salaryTemplate.setMsgStatus(saveParam.getMsgStatus()?1:0);
salaryTemplate.setEmailStatus(saveParam.getEmailStatus() ? 1 : 0);
salaryTemplate.setMsgStatus(saveParam.getMsgStatus() ? 1 : 0);
salaryTemplate.setSmsStatus(saveParam.getSmsStatus() != null && saveParam.getSmsStatus() ? 1 : 0);
salaryTemplate.setSmsSetting(JSON.toJSONString(saveParam.getSmsSetting()));
salaryTemplate.setTextContentPosition(saveParam.getTextContentPosition());
salaryTemplate.setSalaryItemNullStatus(saveParam.getSalaryItemNullStatus()?1:0);
salaryTemplate.setSalaryItemZeroStatus(saveParam.getSalaryItemZeroStatus()?1:0);
salaryTemplate.setSalaryItemNullStatus(saveParam.getSalaryItemNullStatus() ? 1 : 0);
salaryTemplate.setSalaryItemZeroStatus(saveParam.getSalaryItemZeroStatus() ? 1 : 0);
salaryTemplate.setAutoSendCycleType(saveParam.getAutoSendCycleType());
mapper.insert(salaryTemplate);
@ -202,14 +205,16 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
BeanUtils.copyProperties(saveParam, salaryTemplateNew);
salaryTemplateNew.setUpdateTime(new Date());
salaryTemplateNew.setSendEmailId(0L);
salaryTemplateNew.setEmailStatus(saveParam.getEmailStatus()?1:0);
salaryTemplateNew.setMsgStatus(saveParam.getMsgStatus()?1:0);
salaryTemplateNew.setEmailStatus(saveParam.getEmailStatus() ? 1 : 0);
salaryTemplateNew.setMsgStatus(saveParam.getMsgStatus() ? 1 : 0);
salaryTemplateNew.setSmsStatus(saveParam.getSmsStatus() != null && saveParam.getSmsStatus() ? 1 : 0);
salaryTemplateNew.setSmsSetting(JSON.toJSONString(saveParam.getSmsSetting()));
salaryTemplateNew.setTextContentPosition(saveParam.getTextContentPosition());
salaryTemplateNew.setSalaryItemNullStatus(saveParam.getSalaryItemNullStatus()?1:0);
salaryTemplateNew.setSalaryItemZeroStatus(saveParam.getSalaryItemZeroStatus()?1:0);
salaryTemplateNew.setAutoSendStatus(saveParam.getAutoSendStatus()?1:0);
salaryTemplateNew.setSalaryItemNullStatus(saveParam.getSalaryItemNullStatus() ? 1 : 0);
salaryTemplateNew.setSalaryItemZeroStatus(saveParam.getSalaryItemZeroStatus() ? 1 : 0);
salaryTemplateNew.setAutoSendStatus(saveParam.getAutoSendStatus() ? 1 : 0);
salaryTemplateNew.setAutoSendCycleType(saveParam.getAutoSendCycleType());
salaryTemplateNew.setAckFeedbackStatus(saveParam.getAckFeedbackStatus()?1:0);
salaryTemplateNew.setAckFeedbackStatus(saveParam.getAckFeedbackStatus() ? 1 : 0);
salaryTemplateNew.setAutoAckDays(saveParam.getAutoAckDays());
salaryTemplateNew.setFeedbackUrl(saveParam.getFeedbackUrl());
// todo 薪资项目设置检查校验
@ -271,7 +276,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
// 复制工资单自定义名称信息
List<SalaryBillItemNamePO> billItemNamePOList = getSalaryBillItemNameService(user).ListByTemplateAndType(SalaryBillItemNamePO.builder().salaryTemplateId(copyParam.getId()).build());
if(CollectionUtils.isNotEmpty(billItemNamePOList)){
if (CollectionUtils.isNotEmpty(billItemNamePOList)) {
Date now = new Date();
List<SalaryBillItemNamePO> needInsertList = billItemNamePOList.stream().map(po -> {
SalaryBillItemNamePO newSalaryBillItemNamePO = new SalaryBillItemNamePO();
@ -321,7 +326,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
public List<Map<String, Object>> selectSalarySobList() {
List<SalarySobPO> salarySobs = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
return salarySobs.stream().map(m->{
return salarySobs.stream().map(m -> {
Map<String, Object> map = new HashMap<>(2);
map.put("id", String.valueOf(m.getId()));
map.put("content", m.getName());
@ -339,17 +344,17 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
List<SalarySobItemGroupDTO> itemGroupDTOS = salarySobItemAggregate.getItemGroups().stream().filter(group -> !(hideGroupIDs.contains(group.getId()))).collect(Collectors.toList());
// 获取关闭显示的薪资项目
List<Long> hideItemIDs = getSalarySobItemHideService(user).listHideGroupBysalarySobId(SalarySobItemHidePO.builder().salarySobId(salarySobId).isGroup(0).build());
for(SalarySobItemGroupDTO DTO : itemGroupDTOS){
for (SalarySobItemGroupDTO DTO : itemGroupDTOS) {
List<SalarySobItemDTO> items = DTO.getItems();
DTO.setItems( items.stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList()) );
DTO.setItems(items.stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList()));
}
itemGroupDTOS = itemGroupDTOS.stream().filter(DTO -> CollectionUtils.isNotEmpty(DTO.getItems())).collect(Collectors.toList());
salarySobItemAggregate.setItemGroups(itemGroupDTOS);
if(hideGroupIDs.contains(0L)){
if (hideGroupIDs.contains(0L)) {
// 隐藏了未分类
salarySobItemAggregate.setItems(Collections.emptyList());
}else{
salarySobItemAggregate.setItems( salarySobItemAggregate.getItems().stream().filter( item -> !(hideItemIDs.contains(item.getSalaryItemId())) ).collect(Collectors.toList()) );
} else {
salarySobItemAggregate.setItems(salarySobItemAggregate.getItems().stream().filter(item -> !(hideItemIDs.contains(item.getSalaryItemId()))).collect(Collectors.toList()));
}
return SalaryTemplateBO.convertSalarySobItemAggregateToSalaryItemSet(salarySobItemAggregate, new Long(user.getUID()), isReplenish);
}
@ -370,10 +375,10 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
.forEach(data -> {
data.getItems().forEach(item -> {
Long salaryItemId = Long.valueOf(item.getSalaryItemId());
if(itemShowNameMap.containsKey(salaryItemId)){
if (itemShowNameMap.containsKey(salaryItemId)) {
item.setSalaryItemShowName(itemShowNameMap.get(salaryItemId));
item.setName(itemShowNameMap.get(salaryItemId) + "" + item.getOriginName() +"");
}else{
item.setName(itemShowNameMap.get(salaryItemId) + "" + item.getOriginName() + "");
} else {
item.setSalaryItemShowName(item.getOriginName());
item.setName(item.getOriginName());
}
@ -410,7 +415,7 @@ public class SalaryTemplateServiceImpl extends Service implements SalaryTemplate
} else {
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salaryTemplateDTOList, SalaryTemplateListDTO.class);
}
}else{
} else {
// 查询
salaryTemplateDTOList = mapper.listDTO(SalaryTemplatePO.builder().salarySobId(queryParam.getSalarySobId()).name(queryParam.getName()).build());
}

View File

@ -128,6 +128,20 @@ public class SalaryBillController {
return new ResponseResult<Long, List<SalaryTemplateSalaryItemSetListDTO>>(user).run(getSalaryTemplateWrapper(user)::getSalaryItemSet, salarySobId);
}
/**
* 获取短信薪资项目设置
*
* @param salarySobId
* @return
*/
@GET
@Path("/template/getSmsSalaryItemSet")
@Produces(MediaType.APPLICATION_JSON)
public String getSmsSalaryItemSet(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("salarySobId") Long salarySobId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, List<SalaryTemplateSalaryItemSetListDTO>>(user).run(getSalaryTemplateWrapper(user)::getSmsSalaryItemSet, salarySobId);
}
/**
* 获取可用的薪资项目
*/

View File

@ -178,14 +178,12 @@ public class SalaryTemplateWrapper extends Service {
// 查询所有启用的薪资账套
List<SalarySobPO> salarySobs = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO);
List<Map<String, Object>> salarySobOptions = salarySobs.stream()
.map(salarySobPO -> {
Map<String, Object> item = new HashMap<>();
item.put("id", salarySobPO.getId());
item.put("name", salarySobPO.getName());
return item;
})
.collect(Collectors.toList());
List<Map<String, Object>> salarySobOptions = salarySobs.stream().map(salarySobPO -> {
Map<String, Object> item = new HashMap<>();
item.put("id", salarySobPO.getId());
item.put("name", salarySobPO.getName());
return item;
}).collect(Collectors.toList());
// 邮箱下拉
// List<WeaFormOption> sendEmailOptions = Lists.newArrayList();
@ -195,10 +193,10 @@ public class SalaryTemplateWrapper extends Service {
// WeaForm salaryTemplateBase = SalaryFormatUtil.<SalaryTemplateBaseSetDTO>getInstance().buildForm(SalaryTemplateBaseSetDTO.class, SalaryTemplateBaseSetDTO.builder().salarySobOptions(salarySobOptions).sendEmailOptions(sendEmailOptions).build());
if(id == null){
if (id == null) {
// 新建获取默认的确认反馈信息
SalaryBillAckFeedbackDTO defaultAckFeedback = getSalaryBillBaseSetService(user).getDefaultAckFeedbackSetting();
salaryTemplateBaseSetDTO.setAckFeedbackStatus(StringUtils.equals(defaultAckFeedback.getAckStatus(),"1"));
salaryTemplateBaseSetDTO.setAckFeedbackStatus(StringUtils.equals(defaultAckFeedback.getAckStatus(), "1"));
salaryTemplateBaseSetDTO.setAutoAckDays(defaultAckFeedback.getAutoAckDays());
salaryTemplateBaseSetDTO.setFeedbackUrl(defaultAckFeedback.getFeedBackUrl());
}
@ -208,11 +206,7 @@ public class SalaryTemplateWrapper extends Service {
// 编辑时禁止修改薪资账套 前端实现
// 分组 前端实现
return SalaryTemplateBaseFormDTO.builder()
.id(id)
.salaryTemplateBaseSet(salaryTemplateBase)
.replenishRuleSetOption(replenishRuleSetOptionList)
.build();
return SalaryTemplateBaseFormDTO.builder().id(id).salaryTemplateBaseSet(salaryTemplateBase).replenishRuleSetOption(replenishRuleSetOptionList).build();
}
@ -261,7 +255,7 @@ public class SalaryTemplateWrapper extends Service {
// 获取工资单薪资项目展示名信息
Map<Long, String> itemShowNameMap;
Map<Long, SalaryBillItemNameDTO> salaryBillItemNameDTOMap = Collections.emptyMap();
if (id != null){
if (id != null) {
List<SalaryBillItemNamePO> billItemNameList = getSalaryBillItemNameService(user).ListByTemplateAndType(SalaryBillItemNamePO.builder().salaryTemplateId(id).salaryBillType(0).build());
itemShowNameMap = SalaryEntityUtil.convert2Map(billItemNameList, SalaryBillItemNamePO::getSalaryItemId, SalaryBillItemNamePO::getSalaryItemShowName);
// 获取薪资项目信息
@ -274,15 +268,14 @@ public class SalaryTemplateWrapper extends Service {
if (CollectionUtils.isNotEmpty(salaryTemplateShowSetData)) {
salaryTemplateShowSetData.stream()
//排除人员消息
.filter(data -> !StringUtils.equals(data.getGroupId(), "111111111111111111"))
.forEach(data -> {
.filter(data -> !StringUtils.equals(data.getGroupId(), "111111111111111111")).forEach(data -> {
data.getItems().forEach(item -> {
Long salaryItemId = Long.valueOf(item.getSalaryItemId());
item.setOriginName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
if(itemShowNameMap.containsKey(salaryItemId)){
if (itemShowNameMap.containsKey(salaryItemId)) {
item.setSalaryItemShowName(itemShowNameMap.get(salaryItemId));
item.setName(itemShowNameMap.get(salaryItemId) + "" + itemIdNameMap.getOrDefault(salaryItemId, item.getName()) +"");
}else{
item.setName(itemShowNameMap.get(salaryItemId) + "" + itemIdNameMap.getOrDefault(salaryItemId, item.getName()) + "");
} else {
item.setSalaryItemShowName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
item.setName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
}
@ -291,14 +284,7 @@ public class SalaryTemplateWrapper extends Service {
}
return SalaryTemplateShowFormDTO.builder()
.id(id)
.vars(Arrays.stream(SalaryTemplateVarEnum.values()).map(SalaryTemplateVarEnum::getValue).collect(Collectors.toList()))
.salaryTemplateShowSet(salaryTemplateShowSet)
.salaryTemplateSalaryItemSet(salaryTemplateShowSetData)
.replenishSalaryTemplateSalaryItemSet(replenishSalaryTemplateSalaryItemSet)
.salaryBillItemNameSet(salaryBillItemNameDTOMap)
.build();
return SalaryTemplateShowFormDTO.builder().id(id).vars(Arrays.stream(SalaryTemplateVarEnum.values()).map(SalaryTemplateVarEnum::getValue).collect(Collectors.toList())).salaryTemplateShowSet(salaryTemplateShowSet).salaryTemplateSalaryItemSet(salaryTemplateShowSetData).replenishSalaryTemplateSalaryItemSet(replenishSalaryTemplateSalaryItemSet).salaryBillItemNameSet(salaryBillItemNameDTOMap).build();
}
/**
@ -311,6 +297,18 @@ public class SalaryTemplateWrapper extends Service {
return getSalaryTemplateService(user).getSalaryItemSet(salarySobId, false);
}
/**
* @param salarySobId
* @return
*/
public List<SalaryTemplateSalaryItemSetListDTO> getSmsSalaryItemSet(Long salarySobId) {
List<SalaryTemplateSalaryItemSetListDTO> salaryItemSet = getSalaryTemplateService(user).getSalaryItemSet(salarySobId, false);
salaryItemSet.add(0, SalaryTemplateSalaryItemSetListDTO.builder().groupId("444444444444444444L").groupName("基本信息").items(Collections.singletonList(SalaryTemplateSalaryItemListDTO.builder().name("薪资所属月").build())).build());
return salaryItemSet;
}
public List<SalaryTemplateSalaryItemSetListDTO> getReplenishSalaryItemSet(Long salarySobId) {
return getSalaryTemplateService(user).getSalaryItemSet(salarySobId, true);
}
@ -447,20 +445,19 @@ public class SalaryTemplateWrapper extends Service {
if (CollectionUtils.isNotEmpty(replenishSalaryItemSetting)) {
replenishSalaryItemSetting.stream()
//排除人员消息
.filter(data -> !StringUtils.equals(data.getGroupId(), "111111111111111111"))
.forEach(data -> {
data.getItems().forEach(item -> {
Long salaryItemId = Long.valueOf(item.getSalaryItemId());
item.setOriginName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
if(itemShowNameMap.containsKey(salaryItemId)){
item.setSalaryItemShowName(itemShowNameMap.get(salaryItemId));
item.setName(itemShowNameMap.get(salaryItemId) + "(" + itemIdNameMap.getOrDefault(salaryItemId, item.getName()) + ")");
}else{
item.setSalaryItemShowName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
item.setName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
}
});
});
.filter(data -> !StringUtils.equals(data.getGroupId(), "111111111111111111")).forEach(data -> {
data.getItems().forEach(item -> {
Long salaryItemId = Long.valueOf(item.getSalaryItemId());
item.setOriginName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
if (itemShowNameMap.containsKey(salaryItemId)) {
item.setSalaryItemShowName(itemShowNameMap.get(salaryItemId));
item.setName(itemShowNameMap.get(salaryItemId) + "(" + itemIdNameMap.getOrDefault(salaryItemId, item.getName()) + ")");
} else {
item.setSalaryItemShowName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
item.setName(itemIdNameMap.getOrDefault(salaryItemId, item.getName()));
}
});
});
}
} else {
replenishSalaryItemSetting = getReplenishSalaryItemSet(replenishFormQueryParam.getSalarySobId());
@ -469,11 +466,7 @@ public class SalaryTemplateWrapper extends Service {
replenishSalaryItemSetting = getReplenishSalaryItemSet(replenishFormQueryParam.getSalarySobId());
}
return SalaryTemplateReplenishFormDTO.builder()
.id(id)
.replenishSalaryTemplateSalaryItemSet(replenishSalaryItemSetting)
.salaryBillItemNameSet(salaryBillItemNameDTOMap)
.build();
return SalaryTemplateReplenishFormDTO.builder().id(id).replenishSalaryTemplateSalaryItemSet(replenishSalaryItemSetting).salaryBillItemNameSet(salaryBillItemNameDTOMap).build();
}
/**
@ -483,20 +476,10 @@ public class SalaryTemplateWrapper extends Service {
* @return 单个分组下剩余的薪资项目
*/
public List<SalaryTemplateSalaryItemListDTO> getSalaryItemSetGrouped(SalaryBillSalaryItemQueryParam param) {
Boolean isReplenish = Optional.ofNullable(param.getIsReplenish())
.orElse(false);
List<SalaryTemplateSalaryItemSetListDTO> salaryItemSet
= getSalaryTemplateService(user).getSalaryItemSetContainHide(param.getSalarySobId(), param.getSalaryTemplateId(), isReplenish);
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());
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());
}
/**
@ -506,17 +489,12 @@ public class SalaryTemplateWrapper extends Service {
* @return 分组与下属
*/
public List<SalaryTemplateSalaryItemSetListDTO> getSalaryGroupSet(SalaryBillSalaryGroupQueryParam param) {
Boolean isReplenish = Optional.ofNullable(param.getIsReplenish())
.orElse(false);
return getSalaryTemplateService(user).getSalaryItemSetContainHide(param.getSalarySobId(), param.getSalaryTemplateId(), isReplenish)
.stream()
.filter(group -> !Optional.ofNullable(param.getExistSalaryGroupIds()).orElse(Collections.emptyList())
.contains(group.getGroupId())
)
.collect(Collectors.toList());
Boolean isReplenish = Optional.ofNullable(param.getIsReplenish()).orElse(false);
return getSalaryTemplateService(user).getSalaryItemSetContainHide(param.getSalarySobId(), param.getSalaryTemplateId(), isReplenish).stream().filter(group -> !Optional.ofNullable(param.getExistSalaryGroupIds()).orElse(Collections.emptyList()).contains(group.getGroupId())).collect(Collectors.toList());
}
public void saveItemShowName(List<SalaryBillItemNameSaveParam> saveList) {
getSalaryBillItemNameService(user).saveItemShowName(saveList);
}
}