Compare commits
8 Commits
1a4ab02bdc
...
6b90c8c45c
| Author | SHA1 | Date |
|---|---|---|
|
|
6b90c8c45c | |
|
|
552cee8a6f | |
|
|
0e93cbab04 | |
|
|
d01c9bf06f | |
|
|
da6364a511 | |
|
|
37445cdd58 | |
|
|
99a0c3facc | |
|
|
b0fb2b3866 |
|
|
@ -7,6 +7,8 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
|
||||||
import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper;
|
import com.engine.salary.mapper.salarybill.SalarySendRangeObjMapper;
|
||||||
import com.engine.salary.service.TaxAgentService;
|
import com.engine.salary.service.TaxAgentService;
|
||||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||||
|
import com.engine.salary.util.db.MapperProxyFactory;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
import weaver.conn.mybatis.MyBatisFactory;
|
import weaver.conn.mybatis.MyBatisFactory;
|
||||||
|
|
@ -23,6 +25,10 @@ public class SalarySendRangeObjBiz {
|
||||||
return ServiceUtil.getService(TaxAgentServiceImpl.class);
|
return ServiceUtil.getService(TaxAgentServiceImpl.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SalarySendRangeObjMapper getSalarySendRangeObjMapper() {
|
||||||
|
return MapperProxyFactory.getProxy(SalarySendRangeObjMapper.class);
|
||||||
|
}
|
||||||
|
|
||||||
public <R> R applyMapper(Function<SalarySendRangeObjMapper, R> mapper) {
|
public <R> R applyMapper(Function<SalarySendRangeObjMapper, R> mapper) {
|
||||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||||
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
|
final SalarySendRangeObjMapper salarySendRangeObjMapper = sqlSession.getMapper(SalarySendRangeObjMapper.class);
|
||||||
|
|
@ -41,7 +47,13 @@ public class SalarySendRangeObjBiz {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SalarySendUserInfoDTO> getSalarySendUserInfoDTOs(List<Long> employees) {
|
public List<SalarySendUserInfoDTO> getSalarySendUserInfoDTOs(List<Long> employees) {
|
||||||
List<SalarySendUserInfoDTO> userDTOs = applyMapper(mapper -> mapper.getUserInfoByEmployeeIds(employees));
|
List<SalarySendUserInfoDTO> userDTOs = new ArrayList<>();
|
||||||
|
List<List<Long>> partition = Lists.partition(employees, 500);
|
||||||
|
partition.forEach(l->{
|
||||||
|
List<SalarySendUserInfoDTO> userInfos = getSalarySendRangeObjMapper().getUserInfoByEmployeeIds(l);
|
||||||
|
userDTOs.addAll(userInfos);
|
||||||
|
});
|
||||||
|
|
||||||
Map<Long, SalarySendUserInfoDTO> userMap = userDTOs.stream()
|
Map<Long, SalarySendUserInfoDTO> userMap = userDTOs.stream()
|
||||||
.collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity()));
|
.collect(Collectors.toMap(SalarySendUserInfoDTO::getResourceId, Function.identity()));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.engine.salary.entity.salaryacct.bo;
|
package com.engine.salary.entity.salaryacct.bo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
|
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
|
||||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||||
|
|
@ -73,6 +74,9 @@ public class SalaryAcctConsolidatedTaxBO {
|
||||||
.filter(e -> Objects.equals(e.getSalaryItemId(), optional.get()))
|
.filter(e -> Objects.equals(e.getSalaryItemId(), optional.get()))
|
||||||
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
|
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
if (StrUtil.isBlank(resultValue)) {
|
||||||
|
resultValue = "0.00";
|
||||||
|
}
|
||||||
return new BigDecimal(resultValue).add(income).toPlainString();
|
return new BigDecimal(resultValue).add(income).toPlainString();
|
||||||
}
|
}
|
||||||
// 个税调差为0
|
// 个税调差为0
|
||||||
|
|
@ -98,6 +102,9 @@ public class SalaryAcctConsolidatedTaxBO {
|
||||||
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
|
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
|
||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isBlank(resultValue)) {
|
||||||
|
resultValue = "0.00";
|
||||||
|
}
|
||||||
return new BigDecimal(resultValue).add(refundedOrSupplementedTax).subtract(taxAdjustment).toPlainString();
|
return new BigDecimal(resultValue).add(refundedOrSupplementedTax).subtract(taxAdjustment).toPlainString();
|
||||||
}
|
}
|
||||||
return resultValue;
|
return resultValue;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import java.util.Collection;
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class SalaryAcctCalculateParam {
|
public class SalaryAcctCalculateParam {
|
||||||
|
|
||||||
//核算人员的id,不是employeeId而是salaryAcctEmpId
|
//核算人员的id,不是employeeId而是salaryAcctEmpId
|
||||||
private Collection<Long> ids;
|
private Collection<Long> ids;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 薪资核算列表查询参数
|
* 薪资核算列表查询参数
|
||||||
|
|
@ -31,6 +32,11 @@ public class SalaryAcctRecordQueryParam extends BaseQueryParam {
|
||||||
//账套名称")
|
//账套名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扣缴义务人id集合
|
||||||
|
*/
|
||||||
|
private List<Long> taxAgentIds;
|
||||||
|
|
||||||
private String startMonthStr;
|
private String startMonthStr;
|
||||||
private String endMonthStr;
|
private String endMonthStr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.engine.salary.service.impl;
|
package com.engine.salary.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import com.engine.common.util.ServiceUtil;
|
||||||
import com.engine.core.impl.Service;
|
import com.engine.core.impl.Service;
|
||||||
|
|
@ -197,6 +198,21 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
||||||
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
||||||
po.setSalarySobIds(salarySobIds);
|
po.setSalarySobIds(salarySobIds);
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(queryParam.getTaxAgentIds())) {
|
||||||
|
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByTaxAgentIds(queryParam.getTaxAgentIds());
|
||||||
|
if (CollectionUtils.isEmpty(salarySobPOS)) {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
||||||
|
|
||||||
|
Collection<Long> existIds = po.getSalarySobIds();
|
||||||
|
if (CollectionUtils.isNotEmpty(existIds)) {
|
||||||
|
existIds = SalaryEntityUtil.intersectionForList(existIds, salarySobIds);
|
||||||
|
po.setSalarySobIds(existIds);
|
||||||
|
} else {
|
||||||
|
po.setSalarySobIds(salarySobIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
LocalDateRange localDateRange = new LocalDateRange();
|
LocalDateRange localDateRange = new LocalDateRange();
|
||||||
if (Objects.nonNull(queryParam.getStartMonth())) {
|
if (Objects.nonNull(queryParam.getStartMonth())) {
|
||||||
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getStartMonth().atDay(1)));
|
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getStartMonth().atDay(1)));
|
||||||
|
|
@ -978,6 +994,6 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDate(Long id, Date updateTime) {
|
public void updateDate(Long id, Date updateTime) {
|
||||||
getSalaryAcctRecordMapper().updateDate(id,updateTime);
|
getSalaryAcctRecordMapper().updateDate(id, updateTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1424,7 +1424,12 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
|
||||||
if (CollectionUtils.isEmpty(employeeIds)) {
|
if (CollectionUtils.isEmpty(employeeIds)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
return getSalaryArchiveMapper().listPayEndDateIsNull(employeeIds);
|
List<List<Long>> partition = Lists.partition(employeeIds, 500);
|
||||||
|
List<SalaryArchivePO> resultList = new ArrayList<>();
|
||||||
|
partition.forEach(part -> {
|
||||||
|
resultList.addAll(getSalaryArchiveMapper().listPayEndDateIsNull(part));
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -169,16 +169,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
||||||
&& Optional.ofNullable(salaryBillProgress.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
|
&& Optional.ofNullable(salaryBillProgress.getProgress()).orElse(BigDecimal.ZERO).compareTo(BigDecimal.ONE) < 0) {
|
||||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(136104, "有其他人员正在发送中,请等待其他人员发送结束后再操作"));
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(136104, "有其他人员正在发送中,请等待其他人员发送结束后再操作"));
|
||||||
}
|
}
|
||||||
// 初始化进度
|
|
||||||
ProgressDTO initProgress = ProgressDTO.builder()
|
|
||||||
.title(SalaryI18nUtil.getI18nLabel(136097, "发送中"))
|
|
||||||
.totalQuantity(NumberUtils.INTEGER_ZERO)
|
|
||||||
.calculatedQuantity(NumberUtils.INTEGER_ZERO)
|
|
||||||
.progress(BigDecimal.ZERO)
|
|
||||||
.status(true)
|
|
||||||
.message("")
|
|
||||||
.build();
|
|
||||||
getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress);
|
|
||||||
|
|
||||||
List<Long> ids = param.getIds();
|
List<Long> ids = param.getIds();
|
||||||
|
|
||||||
|
|
@ -190,6 +180,17 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
||||||
throw new SalaryRunTimeException("工资发放范围内没有匹配员工");
|
throw new SalaryRunTimeException("工资发放范围内没有匹配员工");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 初始化进度
|
||||||
|
ProgressDTO initProgress = ProgressDTO.builder()
|
||||||
|
.title(SalaryI18nUtil.getI18nLabel(136097, "发送中"))
|
||||||
|
.totalQuantity(NumberUtils.INTEGER_ZERO)
|
||||||
|
.calculatedQuantity(NumberUtils.INTEGER_ZERO)
|
||||||
|
.progress(BigDecimal.ZERO)
|
||||||
|
.status(true)
|
||||||
|
.message("")
|
||||||
|
.build();
|
||||||
|
getProgressService(user).initProgress(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), initProgress);
|
||||||
|
|
||||||
// 异步执行
|
// 异步执行
|
||||||
List<Long> finalIds = ids;
|
List<Long> finalIds = ids;
|
||||||
LocalRunnable localRunnable = new LocalRunnable() {
|
LocalRunnable localRunnable = new LocalRunnable() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue