累计专项附加扣除一键累计,能根据义务人进行累计

This commit is contained in:
Harryxzy 2024-04-30 14:43:37 +08:00
parent 7d7d2dc309
commit 4b474f864f
6 changed files with 25 additions and 10 deletions

View File

@ -5,6 +5,9 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @description 数据采集-专项附加扣除一键累计参数
**/
@ -14,4 +17,8 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class AddDeductionAutoAddParam {
String yearMonth = "";
Date yearMonthDate;
List<Long> taxAgentIds;
}

View File

@ -155,5 +155,5 @@ public interface AddUpDeductionService {
* @return void
* @author lfc
*/
String autoAddAll(Date yearMonth, Boolean isAdmin);
String autoAddAll(Date yearMonth, Boolean isAdmin, List<Long> taxAgentIds);
}

View File

@ -733,7 +733,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
@Override
public String autoAddAll(Date yearMonth, Boolean isAdmin) {
public String autoAddAll(Date yearMonth, Boolean isAdmin, List<Long> taxAgentIds) {
String cacheKey = "addUpDeduction_autoAddAll_processing";
Object objVal = Util_DataCache.getObjVal(cacheKey);
if (objVal != null) {
@ -750,6 +750,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
} else {
taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
}
if (CollectionUtils.isNotEmpty(taxAgentIds)) {
taxAgents = taxAgents.stream().filter(taxAgent -> taxAgentIds.contains(taxAgent.getId())).collect(Collectors.toList());
}
LocalDateTime yearMonthTime = DateUtil.toLocalDateTime(yearMonth);
//设置时间到下一年1月1号
Instant instant = yearMonthTime.plusYears(1L)
@ -978,6 +982,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
return new PageInfo<>(AddUpDeductionDTO.class);
}
// 过滤义务人筛选框
if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) {
taxAgentIdsAsAdmin = taxAgentIdsAsAdmin.stream().filter(id -> queryParam.getTaxAgentIds().contains(id)).collect(Collectors.toList());
}
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
}

View File

@ -11,6 +11,7 @@ import weaver.hrm.User;
import weaver.interfaces.schedule.BaseCronJob;
import java.time.LocalDate;
import java.util.Collections;
import java.util.Date;
/**
@ -31,6 +32,6 @@ public class AutoAddAllSpecialAddDeductionJob extends BaseCronJob {
if(StringUtils.isNotBlank(salaryTaxMonth)){
localDate = localDate.plusMonths(Integer.valueOf(salaryTaxMonth.trim()));
}
getAddUpDeductionService(null).autoAddAll(DateUtil.beginOfMonth(SalaryDateUtil.localDateToDate(localDate)), Boolean.TRUE);
getAddUpDeductionService(null).autoAddAll(DateUtil.beginOfMonth(SalaryDateUtil.localDateToDate(localDate)), Boolean.TRUE, Collections.emptyList());
}
}

View File

@ -375,7 +375,8 @@ public class AddUpDeductionController {
} else {
date = DateUtil.beginOfMonth(new Date());
}
param.setYearMonthDate(date);
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Date, String>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date);
return new ResponseResult<AddDeductionAutoAddParam, String>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, param);
}
}

View File

@ -5,10 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.AddUpDeductionService;
import com.engine.salary.service.SalaryEmployeeService;
@ -169,13 +166,14 @@ public class AddUpDeductionWrapper extends Service {
return getAddUpDeductionService(user).getAddUpDeduction(param);
}
public String autoAddAll(Date yearMonth) {
public String autoAddAll(AddDeductionAutoAddParam param) {
Date yearMonth = param.getYearMonthDate();
if (isLog) {
log.info("一键累计, 操作人 「{}」", user.getUsername());
}
if (yearMonth == null) {
throw new SalaryRunTimeException("一键累计传入日期格式错误");
}
return getAddUpDeductionService(user).autoAddAll(yearMonth, null);
return getAddUpDeductionService(user).autoAddAll(yearMonth, null, param.getTaxAgentIds());
}
}