This commit is contained in:
parent
b0a25f6cf0
commit
faeafbe5ad
|
|
@ -2,6 +2,7 @@ package com.engine.salary.entity.salaryacct.param;
|
|||
|
||||
import com.engine.salary.common.BaseQueryParam;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.enums.common.FilterEnum;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -63,4 +64,17 @@ public class SalaryAcctResultQueryParam extends BaseQueryParam {
|
|||
|
||||
//薪资项目id
|
||||
private Collection<Long> salaryItemIds;
|
||||
|
||||
//其他条件
|
||||
private Collection<OtherCondition> otherConditions;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OtherCondition{
|
||||
private Long itemIds;
|
||||
private FilterEnum filter;
|
||||
private String params;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
package com.engine.salary.enums.common;
|
||||
|
||||
import com.engine.salary.enums.BaseEnum;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public enum FilterEnum implements BaseEnum<String> {
|
||||
|
||||
BT("BT", "包含", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> a.contentEquals(params[0]);
|
||||
}
|
||||
},
|
||||
EQ("EQ", "等于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> a.equals(params[0]);
|
||||
}
|
||||
},
|
||||
NE("NE", "不等于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> !a.equals(params[0]);
|
||||
}
|
||||
},
|
||||
GT("GT", "大于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> {
|
||||
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params[0])) {
|
||||
return new BigDecimal(a).compareTo(new BigDecimal(params[0])) > 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
LT("LT", "小于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> {
|
||||
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params[0])) {
|
||||
return new BigDecimal(a).compareTo(new BigDecimal(params[0])) < 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
GE("GE", "大于等于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> {
|
||||
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params[0])) {
|
||||
return new BigDecimal(a).compareTo(new BigDecimal(params[0])) >= 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
LE("LE", "小于等于", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return a -> {
|
||||
if (NumberUtils.isCreatable(a) && NumberUtils.isCreatable(params[0])) {
|
||||
return new BigDecimal(a).compareTo(new BigDecimal(params[0])) <= 0;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
ISEMPTY("ISEMPTY", "为空", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return StringUtils::isEmpty;
|
||||
}
|
||||
},
|
||||
ISNOTEMPTY("ISNOTEMPTY", "包含", 1) {
|
||||
@Override
|
||||
public Predicate<String> filter(String... params) {
|
||||
return StringUtils::isNotEmpty;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FilterEnum(String value, String defaultLabel, int labelId) {
|
||||
this.value = value;
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.labelId = labelId;
|
||||
}
|
||||
|
||||
private String value;
|
||||
|
||||
private String defaultLabel;
|
||||
|
||||
private int labelId;
|
||||
|
||||
public abstract Predicate<String> filter(String... params);
|
||||
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLabelId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLabel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import com.engine.salary.entity.salarysob.po.*;
|
|||
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.SalaryValueTypeEnum;
|
||||
import com.engine.salary.enums.common.FilterEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum;
|
||||
|
|
@ -301,17 +302,23 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public PageInfo<Map<String, Object>> listPageByParam(SalaryAcctResultQueryParam queryParam) {
|
||||
// 查询薪资核算人员(分页)
|
||||
PageInfo<SalaryAcctEmployeePO> page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
|
||||
// 查询薪资核算结果
|
||||
List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam);
|
||||
// 薪资核算结果的分页结果
|
||||
PageInfo<Map<String, Object>> resultPage = new PageInfo<>();
|
||||
resultPage.setList(data);
|
||||
resultPage.setTotal(page.getTotal());
|
||||
resultPage.setPageNum(page.getPageNum());
|
||||
resultPage.setPageSize(page.getPageSize());
|
||||
return resultPage;
|
||||
// // 查询薪资核算人员(分页)
|
||||
// PageInfo<SalaryAcctEmployeePO> page = getSalaryAcctEmployeeService(user).listPageByResultQueryParam(queryParam);
|
||||
// // 查询薪资核算结果
|
||||
// List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam);
|
||||
// // 薪资核算结果的分页结果
|
||||
// PageInfo<Map<String, Object>> resultPage = new PageInfo<>();
|
||||
// resultPage.setList(data);
|
||||
// resultPage.setTotal(page.getTotal());
|
||||
// resultPage.setPageNum(page.getPageNum());
|
||||
// resultPage.setPageSize(page.getPageSize());
|
||||
|
||||
Collection<SalaryAcctResultQueryParam.OtherCondition> otherConditions = queryParam.getOtherConditions();
|
||||
|
||||
List<SalaryAcctResultPO> list = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singletonList(queryParam.getSalaryAcctRecordId()), Collections.singletonList(1695204436145L));
|
||||
list = list.stream().filter(a -> FilterEnum.LT.filter("5000").test(a.getResultValue())).collect(Collectors.toList());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -331,7 +338,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
Set<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId);
|
||||
if(Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)){
|
||||
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)) {
|
||||
// 是回算,获取回算项
|
||||
List<SalarySobBackItemPO> salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId());
|
||||
salaryItemIds.addAll(salarySobBackItemPOS.stream().map(SalarySobBackItemPO::getSalaryItemId).collect(Collectors.toList()));
|
||||
|
|
@ -339,7 +346,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||
|
||||
// 查询薪资核算结果
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
|
@ -396,7 +403,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||
// 查询薪资核算结果
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
// 查询人员信息
|
||||
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
|
||||
|
|
@ -477,7 +484,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, salaryAcctEmployeePO.getEmployeeId(), salaryAcctEmployeePO.getTaxAgentId());
|
||||
}
|
||||
// 查询薪资核算人员的薪资核算结果
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList());
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
// 查询薪资核算人员所有合并计税的薪资核算记录所用的账套
|
||||
Set<Long> salarySobIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getSalarySobId);
|
||||
|
|
@ -555,13 +562,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
// 保存参数转换成薪资核算结果po
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2PO(salaryAcctResultPOSOld, saveParam, salaryAcctEmployeePO, (long) user.getUID());
|
||||
SalarySysConfPO autoLock = getSalarySysConfService(user).getOneByCode(SalarySysConstant.EDIT_IMPORT_AUTO_LOCK);
|
||||
if(autoLock != null && StringUtils.equals(autoLock.getConfValue(),"1")){
|
||||
if (autoLock != null && StringUtils.equals(autoLock.getConfValue(), "1")) {
|
||||
// 对比核算结果提取修改了哪些薪资项目
|
||||
Set<Long> needLockItems = new HashSet<>();
|
||||
Map<Long, SalaryAcctResultPO> oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId);
|
||||
salaryAcctResultPOS.stream().forEach(PO -> {
|
||||
String oldValue = Optional.ofNullable(oldResutMap.get(PO.getSalaryItemId())).map(SalaryAcctResultPO::getResultValue).orElse("");
|
||||
if(!StringUtils.equals(oldValue,PO.getResultValue())){
|
||||
if (!StringUtils.equals(oldValue, PO.getResultValue())) {
|
||||
needLockItems.add(PO.getSalaryItemId());
|
||||
}
|
||||
});
|
||||
|
|
@ -601,7 +608,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
// 存储薪资核算结果数据来源日志
|
||||
salaryAcctResultPOS = getSalaryAcctRecordService(user).listBySalaryAcctEmpId(saveParam.getSalaryAcctEmpId());
|
||||
saveSalaryAcctResultLog(salaryAcctResultPOSOld,salaryAcctResultPOS);
|
||||
saveSalaryAcctResultLog(salaryAcctResultPOSOld, salaryAcctResultPOS);
|
||||
|
||||
// 查询操作日志的targetName
|
||||
// String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctEmployeePO.getSalaryAcctRecordId());
|
||||
|
|
@ -623,6 +630,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
/**
|
||||
* 存储薪资核算结果数据来源日志
|
||||
*
|
||||
* @param salaryAcctResultPOSOld
|
||||
* @param salaryAcctResultPOS
|
||||
*/
|
||||
|
|
@ -631,11 +639,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
List<SalaryAcctResultPO> editItems = new ArrayList<>();
|
||||
Map<Long, SalaryAcctResultPO> oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId);
|
||||
salaryAcctResultPOS.stream().forEach(PO -> {
|
||||
if(oldResutMap.get(PO.getSalaryItemId()) == null){
|
||||
if (oldResutMap.get(PO.getSalaryItemId()) == null) {
|
||||
editItems.add(PO);
|
||||
}else{
|
||||
} else {
|
||||
String oldValue = oldResutMap.get(PO.getSalaryItemId()).getResultValue();
|
||||
if(!StringUtils.equals(oldValue,PO.getResultValue())){
|
||||
if (!StringUtils.equals(oldValue, PO.getResultValue())) {
|
||||
editItems.add(PO);
|
||||
}
|
||||
}
|
||||
|
|
@ -819,8 +827,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
|
||||
exceptItemIds.addAll(lockSalaryItemIds);
|
||||
exceptItemIds.addAll(salaryItemPOS.stream().filter(PO -> Objects.equals(PO.getValueType(), NumberUtils.INTEGER_ONE) &&
|
||||
Objects.equals(PO.getUseInEmployeeSalary(),0))
|
||||
.map(SalaryItemPO::getId).collect(Collectors.toList()) );
|
||||
Objects.equals(PO.getUseInEmployeeSalary(), 0))
|
||||
.map(SalaryItemPO::getId).collect(Collectors.toList()));
|
||||
getSalaryAcctResultLogService(user).deleteBySalaryAcctEmpIdExceptItemIds(salaryAcctEmployeeIds, exceptItemIds);
|
||||
}
|
||||
}.start();
|
||||
|
|
@ -940,9 +948,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
// }
|
||||
|
||||
Set<Long> salaryItemIds;
|
||||
if(CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())){
|
||||
if (CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())) {
|
||||
salaryItemIds = updateParam.getSalaryItemIds();
|
||||
}else{
|
||||
} else {
|
||||
salaryItemIds = Collections.singleton(updateParam.getSalaryItemId());
|
||||
}
|
||||
if (updateParam.getLockStatus() == LockStatusEnum.LOCK) {
|
||||
|
|
@ -981,10 +989,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public List<SalaryAcctResultPO> listByAcctEmployeeIdsAndSalaryItemIds(List<Long> salaryAcctEmployeeIds, Collection<Long> salaryItemIds) {
|
||||
if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<List<Long>> partition = Lists.partition((List<Long>)salaryAcctEmployeeIds, 200);
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 200);
|
||||
List<SalaryAcctResultPO> result = new ArrayList<>();
|
||||
partition.forEach(empIds -> {
|
||||
SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).salaryItemIds(salaryItemIds).build();
|
||||
|
|
@ -1007,10 +1015,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public List<Long> listAcctEmpIdByAcctEmpId(List<Long> salaryAcctEmployeeIds) {
|
||||
if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<List<Long>> partition = Lists.partition((List<Long>)salaryAcctEmployeeIds, 1000);
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) salaryAcctEmployeeIds, 1000);
|
||||
List<Long> result = new ArrayList<>();
|
||||
partition.forEach(empIds -> {
|
||||
result.addAll(getSalaryAcctResultMapper().getAcctEmpIsExist(empIds));
|
||||
|
|
@ -1047,15 +1055,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
public Boolean checkAuth(Long salaryAcctRecordId) {
|
||||
// 获取该核算记录的个税扣缴义务
|
||||
SalaryAcctRecordPO recordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId);
|
||||
if(Objects.isNull(recordPO)) {
|
||||
if (Objects.isNull(recordPO)) {
|
||||
return false;
|
||||
}
|
||||
SalarySobPO salarySobPO = getSalarySobService(user).getById(recordPO.getSalarySobId());
|
||||
Long taxAgentId = salarySobPO.getTaxAgentId();
|
||||
List<TaxAgentAdminPO> adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId(Long.valueOf(user.getUID()));
|
||||
Optional<TaxAgentAdminPO> canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst();
|
||||
if(!canOperate.isPresent()){
|
||||
return false;
|
||||
if (!canOperate.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue