获取员工短信内容

This commit is contained in:
钱涛 2023-06-06 14:21:35 +08:00
parent 0e5eb1b11e
commit a308ee8d1f
6 changed files with 171 additions and 37 deletions

View File

@ -0,0 +1,58 @@
package com.customization.salary;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalaryAcctRecordWrapper;
import com.engine.salary.wrapper.proxy.SalaryAcctRecordWrapperProxy;
import weaver.general.BaseBean;
import java.util.Collection;
import java.util.Map;
@ServiceDynamicProxy(target = SalaryAcctRecordWrapper.class, desc = "薪资核算")
public class CustomSalaryAcctRecordWrapper extends AbstractServiceProxy implements SalaryAcctRecordWrapperProxy {
@Override
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
return null;
}
@Override
public Map<String, Object> getForm(Long id) {
return null;
}
@Override
public Long save(SalaryAcctRecordSaveParam saveParam) {
return null;
}
@Override
public void delete(Collection<Long> ids) {
}
@Override
public void file(Long id) {
}
@Override
@ServiceMethodDynamicProxy(desc = "重新核算前,验证....")
public void reCalculate(Long id) {
BaseBean baseBean = new BaseBean();
baseBean.writeLog("拦截薪酬重新核算方法...");
//todo do some thing
executeMethod(id);
//todo do some thing
}
}

View File

@ -1,31 +0,0 @@
package com.customization.salary;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.param.SalarySendWithdrawParam;
import com.engine.salary.wrapper.SalarySendWrapper;
import com.engine.salary.wrapper.proxy.SalarySendWrapperProxy;
import weaver.general.BaseBean;
import java.util.Map;
@ServiceDynamicProxy(target = SalarySendWrapper.class, desc = "薪资核算")
public class CustomSalarySend extends AbstractServiceProxy implements SalarySendWrapperProxy {
@Override
public void grant(SalarySendGrantParam queryParam) {
BaseBean baseBean = new BaseBean();
baseBean.writeLog("拦截工资单发送方法...");
//todo do some thing
Object o = executeMethod(queryParam);
//todo do some thing
}
@Override
public Map<String, Object> withdraw(SalarySendWithdrawParam queryParam) {
return null;
}
}

View File

@ -0,0 +1,45 @@
package com.customization.salary;
import com.engine.common.util.ServiceUtil;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.param.SalarySendWithdrawParam;
import com.engine.salary.service.SalaryBillService;
import com.engine.salary.service.impl.SalaryBillServiceImpl;
import com.engine.salary.wrapper.SalarySendWrapper;
import com.engine.salary.wrapper.proxy.SalarySendWrapperProxy;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
@ServiceDynamicProxy(target = SalarySendWrapper.class, desc = "工资单发送")
public class CustomSalarySendWrapper extends AbstractServiceProxy implements SalarySendWrapperProxy {
private SalaryBillService getSalaryBillService(User user) {
return ServiceUtil.getService(SalaryBillServiceImpl.class, user);
}
@Override
@ServiceMethodDynamicProxy(desc = "拦截工资单发送方法")
public void grant(SalarySendGrantParam queryParam) {
Long salarySendId = queryParam.getSalarySendId();
List<Long> ids = queryParam.getIds();
List<Map<String, Object>> sendInfoList = getSalaryBillService(new User()).getSendInfoList(salarySendId, ids);
//解析sendInfoList拼接短信内容
System.out.println("发送短信");
//todo do some thing
executeMethod(queryParam);
//todo do some thing
}
@Override
public Map<String, Object> withdraw(SalarySendWithdrawParam queryParam) {
return null;
}
}

View File

@ -2,11 +2,17 @@ package com.engine.salary.service;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import java.util.List;
import java.util.Map;
/**
* @Description: 工资单
* @Author: wangxiangzhong
* @Date: 2021-12-11 11:28
*/
* 工资单
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface SalaryBillService {
/**
@ -16,6 +22,14 @@ public interface SalaryBillService {
*/
void grant(SalarySendGrantParam queryParam);
/**
* 获取内容
* @param sendId
* @param ids
* @return
*/
List<Map<String, Object>> getSendInfoList(Long sendId, List<Long> ids);
/**
* 工资单撤回
*

View File

@ -402,6 +402,54 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
.buildDetailList(list, salaryAcctEmployees, salaryAcctResultValues);
}
public List<Map<String, Object>> getSendInfoList(Long sendId, List<Long> ids) {
SalarySendPO salarySend = getSalarySendMapper().getById(sendId);
SalarySendInfoQueryParam queryParam = new SalarySendInfoQueryParam();
queryParam.setSalarySendId(salarySend.getId());
// // 空就是所有
// queryParam.setIds(ids);
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue()));
// 2.获取基本数据
List<SalarySendInfoListDTO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(ids)) {
list = getSalarySendInfoMapper().list(queryParam);
} else {
List<List<Long>> partition = Lists.partition(ids, 500);
for (List<Long> idsPart : partition) {
queryParam.setIds(idsPart);
list.addAll(getSalarySendInfoMapper().list(queryParam));
}
}
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = this.getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
List<Long> acctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
list = list.stream().filter(f -> acctEmployeeIds.contains(f.getEmployeeId())).collect(Collectors.toList());
List<Long> employeeIds = list.stream().map(SalarySendInfoListDTO::getEmployeeId).collect(Collectors.toList());
// 3.组装详情数据
// 获取薪资项目数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = Lists.newArrayList();
List<SalaryAcctResultPO> salaryAcctResultValues = Lists.newArrayList();
//是否需要发送邮件
if (CollectionUtils.isNotEmpty(ids)) {
int partSize = 100;// 分片大小,越小进度条跑得越短平快但是总体速度更慢
List<List<Long>> partition = Lists.partition(employeeIds, partSize);
for (List<Long> part : partition) {
// 更新进度
List<SalaryAcctEmployeePO> acctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(Collections.singletonList(salarySend.getSalaryAccountingId()), part);
salaryAcctEmployees.addAll(acctEmployees);
salaryAcctResultValues.addAll(getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(SalaryEntityUtil.properties(acctEmployees, SalaryAcctEmployeePO::getId, Collectors.toList())));
}
} else {
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId()));
}
return getSalarySendService(user)
.buildDetailList(list, salaryAcctEmployees, salaryAcctResultValues);
}
/**
* 发送消息
*

View File

@ -800,9 +800,9 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
return listMaps;
}
// 所有个税扣缴义务人
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(getTaxAgentService(user).listAll(), TaxAgentPO::getId, TaxAgentPO::getName);
// Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(getTaxAgentService(user).listAll(), TaxAgentPO::getId, TaxAgentPO::getName);
// 按人员分组核算数据
Map<Long, List<SalaryAcctEmployeePO>> relationSalaryAcctEmployeeMap = SalaryEntityUtil.group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getEmployeeId);
// Map<Long, List<SalaryAcctEmployeePO>> relationSalaryAcctEmployeeMap = SalaryEntityUtil.group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getEmployeeId);
Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, salaryAcctEmployee -> salaryAcctEmployee.getEmployeeId() + "-" + salaryAcctEmployee.getTaxAgentId());
Map<Long, List<SalaryAcctResultPO>> singleEmpAcctMap = SalaryEntityUtil.group2Map(salaryAcctResultValues, SalaryAcctResultPO::getSalaryAcctEmpId);
List<Long> employeeIds = list.stream().map(SalarySendInfoListDTO::getEmployeeId).distinct().collect(Collectors.toList());