短信模板设置接口
This commit is contained in:
parent
3de1e62f6b
commit
e1a4e275ff
|
|
@ -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;
|
||||
|
||||
//工号
|
||||
|
|
|
|||
|
|
@ -126,20 +126,18 @@ 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())
|
||||
|
|
@ -151,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);
|
||||
|
|
@ -202,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));
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
@ -370,6 +366,8 @@ public class SalaryBillBO {
|
|||
return;
|
||||
}
|
||||
|
||||
content = content.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate()));
|
||||
|
||||
for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) {
|
||||
content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue());
|
||||
}
|
||||
|
|
@ -383,9 +381,11 @@ public class SalaryBillBO {
|
|||
}
|
||||
|
||||
try {
|
||||
log.info("发送短信内容 {}", content);
|
||||
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);
|
||||
|
|
@ -581,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>");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用的薪资项目
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue