feat: 专项附加扣除模块, 一键清空、分页bug等

This commit is contained in:
fcli 2022-11-04 15:16:27 +08:00
parent 92a6512dc8
commit 9b77bf7139
13 changed files with 199 additions and 107 deletions

View File

@ -9,10 +9,4 @@ import javax.ws.rs.Path;
@Path("/bs/hrmsalary/addUpDeduction")
public class AddUpDeductionController extends com.engine.salary.web.AddUpDeductionController{
public static void main(String[] args) {
SpecialAddDeductionParam specialAddDeductionParam = new SpecialAddDeductionParam();
String s = JSON.toJSONString(specialAddDeductionParam, SerializerFeature.WriteNullStringAsEmpty);
System.out.println(s);
}
}

View File

@ -6,6 +6,8 @@ import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
@ -16,6 +18,10 @@ import java.util.*;
import java.util.stream.Collectors;
public class SpecialAddDeductionBiz extends BaseBean {
private SpecialAddDeductionMapper mapper() {
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
}
/**
* 根据id获取
*
@ -31,19 +37,14 @@ public class SpecialAddDeductionBiz extends BaseBean {
}
public List<SpecialAddDeductionRecordDTO> listDTOByParam(SpecialAddDeductionQueryParam param) {
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
List<SpecialAddDeductionRecordDTO> specialAddDeductionRecordDTOS = mapper.listDtoByParam(param);
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS);
}
List<SpecialAddDeductionRecordDTO> specialAddDeductionRecordDTOS = mapper().listDtoByParam(param);
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionRecordDTOS);
}
public List<SpecialAddDeductionListDTO> listByParam(SpecialAddDeductionQueryParam param) {
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
List<SpecialAddDeductionListDTO> specialAddDeductionListDTOS = mapper.listByParam(param);
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS);
}
List<SpecialAddDeductionListDTO> specialAddDeductionListDTOS = mapper().listByParam(param);
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS);
}
public List<SpecialAddDeductionPO> listByTaxAgentIds(List<Long> taxAgentIds) {
@ -111,9 +112,9 @@ public class SpecialAddDeductionBiz extends BaseBean {
// 去重通过记录的唯一条件(申报月份人员id个税扣缴义务人id)拼接
List<SpecialAddDeductionPO> finalPos = pos.stream()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))),
ArrayList::new)
Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))),
ArrayList::new)
);
// 查询已有数据
List<SpecialAddDeductionPO> list = listByTaxAgentIds(null);
@ -156,4 +157,15 @@ public class SpecialAddDeductionBiz extends BaseBean {
sqlSession.commit();
}
}
public List<SpecialAddDeductionPO> getByEmployeeId(List<Long> employeeIds, Long taxAgentId) {
if (CollectionUtils.isEmpty(employeeIds)) {
return Collections.emptyList();
}
return mapper().getByEmployeeIds(employeeIds, taxAgentId)
.stream()
.filter(Objects::nonNull)
.filter(s -> s.getEmployeeId() != null)
.collect(Collectors.toList());
}
}

View File

@ -0,0 +1,25 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author lfc
* @description 专项附加扣-除删除参数
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SpecialAddDeductionRecordDeleteParam {
// 删除id
private List<Long> ids;
// 个税扣缴义务人
private String taxAgentId;
}

View File

@ -28,4 +28,6 @@ public interface SpecialAddDeductionMapper {
int deleteByIds(@Param("ids")List<Long> id);
List<SpecialAddDeductionPO> getByEmployeeIds(@Param("employeeIds") List<Long> employeeIds,
@Param("taxAgentId") Long taxAgentId);
}

View File

@ -66,6 +66,9 @@
#{id}
</foreach>
</if>
<if test="param.specialAddDeductionId != null">
AND t1.id = #{param.specialAddDeductionId}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
@ -119,6 +122,9 @@
#{id}
</foreach>
</if>
<if test="param.specialAddDeductionId != null">
AND t1.id = #{param.specialAddDeductionId}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
@ -171,6 +177,9 @@
#{id}
</foreach>
</if>
<if test="param.specialAddDeductionId != null">
AND t1.id = #{param.specialAddDeductionId}
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
@ -217,10 +226,6 @@
</if>
</sql>
<sql id="otherDeductionColumn">
</sql>
<select id="getById" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
@ -507,10 +512,7 @@
AND e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
<include refid="paramSql"/>
<!-- 排序 -->
<if test="param.orderRule != null">
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
ORDER BY t1.create_time desc
</select>
<select id="listByTaxAgentIds" resultMap="BaseResultMap">
@ -544,7 +546,9 @@
AND e.status not in (7)
and (e.accounttype is null or e.accounttype = 0)
<include refid="paramSql"/>
order by t1.create_time desc
<if test="param.orderRule != null ">
order by ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
</if>
</select>
<delete id="deleteByIds">
@ -556,4 +560,19 @@
</foreach>
) and delete_type = 0
</delete>
<select id="getByEmployeeIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from hrsa_special_add_deduction
where
<if test="employeeIds == null or employeeIds.size() == 0">
1 = 2
</if>
<foreach collection="employeeIds" item="employeeId" separator="," open="employee_id in (" close=") ">
#{employeeId}
</foreach>
and tax_agent_id = #{taxAgentId}
and delete_type = 0
</select>
</mapper>

View File

@ -147,4 +147,11 @@ public interface AddUpDeductionService {
* @date 2022/10/31 11:33
*/
AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam id);
/**
* 自动累计专项附加扣除
* @return void
* @author lfc
*/
void autoAddAll();
}

View File

@ -2,10 +2,7 @@ package com.engine.salary.service;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -102,10 +99,14 @@ public interface SpecialAddDeductionService {
/**
* 删除所选数据
*/
void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam);
void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam);
/**
* 一键清空数据
*/
void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam);
void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam);
List<SpecialAddDeductionPO> getSpecialAddDeductionPOByEmployee(List<Long> employeeId, Long taxAgentId);
SpecialAddDeductionRecordDTO getRecordById(Long id);
}

View File

@ -20,6 +20,7 @@ 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.po.SpecialAddDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
@ -59,6 +60,7 @@ import weaver.hrm.User;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
@ -102,6 +104,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private SpecialAddDeductionService getSpecialAddDeductionService(User user) {
return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user);
}
@Override
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<String, Object>();
@ -629,6 +635,29 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
return addUpDeductionRecordDTOS.get(0);
}
@Override
public void autoAddAll() {
int uid = user.getUID();
Collection<TaxAgentPO> taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) uid);
for (TaxAgentPO taxAgent : taxAgents) {
Collection<Long> employeeIds = getTaxAgentService(user)
.listEmployeeIdsInTaxAgent(taxAgent.getId());
List<SpecialAddDeductionPO> employeePOs = getSpecialAddDeductionService(user)
.getSpecialAddDeductionPOByEmployee(new ArrayList<>(employeeIds), taxAgent.getId());
Map<Long, List<AddUpDeduction>> lastEmpInfo = getLastEmpInfo(taxAgent, employeePOs);
}
}
private Map<Long, List<AddUpDeduction>> getLastEmpInfo(TaxAgentPO taxAgent, List<SpecialAddDeductionPO> employeePOs) {
LocalDateTime lastMonthDateTime = LocalDateTime.now().minusMonths(1);
YearMonth lastMonth = YearMonth.of(lastMonthDateTime.getYear(), lastMonthDateTime.getMonth());
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionList(lastMonth,
employeePOs.stream().map(SpecialAddDeductionPO::getEmployeeId).collect(Collectors.toList()),
taxAgent.getId());
return addUpDeductionList.stream().collect(Collectors.groupingBy(AddUpDeduction::getEmployeeId));
}
private void checkImportParam(AddUpDeductionImportParam importParam) {

View File

@ -9,17 +9,14 @@ import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.AddUpDeductionService;
import com.engine.salary.service.SalaryEmployeeService;
@ -31,6 +28,7 @@ import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelComment;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.engine.salary.util.excel.ExcelUtil;
@ -57,10 +55,14 @@ import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TEN
public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService {
private SpecialAddDeductionBiz getSpecialAddDeductionMapper() {
private SpecialAddDeductionBiz getSpecialAddDeductionBiz() {
return new SpecialAddDeductionBiz();
}
private SpecialAddDeductionMapper getSpecialAddDeductionMapper() {
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@ -83,7 +85,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
@Override
public SpecialAddDeductionPO getById(Long id) {
return getSpecialAddDeductionMapper().getById(id);
return getSpecialAddDeductionBiz().getById(id);
}
@ -101,6 +103,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(queryParam);
SpecialAddDeductionEncrypt.decrypt(list);
return new PageInfo<>(list, SpecialAddDeductionListDTO.class);
}
@ -113,7 +116,9 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
putQueryRange(queryParam, employeeId);
}
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDTOByParam(queryParam);
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDtoByParam(queryParam);
SpecialAddDeductionEncrypt.decrypt(list);
return new PageInfo<>(list, SpecialAddDeductionRecordDTO.class);
}
@ -197,7 +202,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
// 查询已有数据
List<SpecialAddDeductionPO> list = getSpecialAddDeductionMapper()
List<SpecialAddDeductionPO> list = getSpecialAddDeductionBiz()
.listByTaxAgentIds(null);
// 错误excel内容
@ -375,7 +380,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
param.setOrderRule(orderRule);
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(param);
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionBiz().listByParam(param);
// 开启分权并且不是薪酬模块总管理员
if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) {
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
@ -465,7 +470,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDTOByParam(param);
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionBiz().listDTOByParam(param);
SpecialAddDeductionEncrypt.decrypt(list);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
@ -548,7 +553,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
// 查询已有数据
List<SpecialAddDeductionPO> list = getSpecialAddDeductionMapper().listByTaxAgentIds(null);
List<SpecialAddDeductionPO> list = getSpecialAddDeductionBiz().listByTaxAgentIds(null);
//合规数据
List<SpecialAddDeductionPO> insertData = new ArrayList<>();
Date now = new Date();
@ -595,19 +600,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
}
@Override
public void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam) {
public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) {
long currentEmployeeId = user.getUID();
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList =
getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
String declareMonthStr = deleteParam.getDeclareMonth();
List<Long> deleteIds = deleteParam.getIds();
// 已经核算过的不可操作
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees =
getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
// 判断是否有核算过
List<Long> deleteList = new ArrayList<>();
for (Long id : deleteIds) {
SpecialAddDeductionPO byId = SpecialAddDeductionBiz.getById(id);
@ -621,37 +620,20 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
if (isNotInRegion) {
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
}
// 判断用户是否存在
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
Optional<SalaryAcctEmployeePO> optionalAcctEmp =
salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(byId.getEmployeeId()) && f.getTaxAgentId().equals(byId.getTaxAgentId())).findFirst();
if (optionalAcctEmp.isPresent()) {
throw new SalaryRunTimeException("所选数据在该年月中已经核算过并归档,不可进行删除!");
}
}
deleteList.add(byId.getId());
}
SpecialAddDeductionBiz.batchDeleteByIds(deleteList);
}
@Override
public void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam) {
String declareMonthStr = deleteParam.getDeclareMonth();
long currentEmployeeId = user.getUID();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) {
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList =
getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
getTaxAgentService(user).listTaxAgentAndEmployeeTree((long) user.getUID());
List<Long> taxAgentIds = taxAgentList.stream()
.map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId)
.collect(Collectors.toList());
SpecialAddDeductionBiz specialAddDeductionBiz = new SpecialAddDeductionBiz();
Date declareMonthDate = null;
try {
declareMonthDate = sdf.parse(declareMonthStr + "-01");
} catch (Exception e) {
throw new SalaryRunTimeException("日期异常");
}
if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) {
// 设置了个税扣缴义务人
@ -666,21 +648,22 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
}
// 获取所有想要删除的数据
List<SpecialAddDeductionPO> list = specialAddDeductionBiz.listByTaxAgentIds(taxAgentIds);
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user)
.getAccountedEmployeeData(declareMonthStr);
for (SpecialAddDeductionPO item : list) {
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
Optional<SalaryAcctEmployeePO> optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst();
if (optionalAcctEmp.isPresent()) {
throw new SalaryRunTimeException("有员工在该年月中已经完成核算并归档,不能进行一键清空!");
}
}
}
List<Long> deleteIds = list.stream().map(SpecialAddDeductionPO::getId).collect(Collectors.toList());
specialAddDeductionBiz.batchDeleteByIds(deleteIds);
}
@Override
public List<SpecialAddDeductionPO> getSpecialAddDeductionPOByEmployee(List<Long> employeeId, Long taxAgentId) {
return getSpecialAddDeductionBiz().getByEmployeeId(employeeId, taxAgentId);
}
@Override
public SpecialAddDeductionRecordDTO getRecordById(Long id) {
return getSpecialAddDeductionBiz()
.listDTOByParam(SpecialAddDeductionQueryParam.builder().specialAddDeductionId(id).build())
.stream().findFirst().orElse(null);
}
@Override
public XSSFWorkbook downloadTemplate(SpecialAddDeductionQueryParam param) {
// 1.工作簿名称

View File

@ -340,4 +340,15 @@ public class AddUpDeductionController {
}
/**
* 一键自动累计
* @return
*/
@POST
@Path("/autoAddAll")
@Produces(MediaType.APPLICATION_JSON)
public String autoAddAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<User, Void>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, user);
}
}

View File

@ -5,7 +5,6 @@ import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SpecialAddDeductionWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@ -74,10 +73,19 @@ public class SpecialAddDeductionController {
}
@POST
@Path("/getSpecialAddDeduction")
@Produces(MediaType.APPLICATION_JSON)
public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
Long id = param.getId();
return new ResponseResult<Long, SpecialAddDeductionRecordDTO>(user).run(getSpecialAddDeductionWrapper(user)::getRecordById, id);
}
@POST
@Path("/getDetailList")
@Produces(MediaType.APPLICATION_JSON)
public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) {
public String getSpecialAddDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SpecialAddDeductionQueryParam, PageInfo<SpecialAddDeductionRecordDTO>>(user).run(getSpecialAddDeductionWrapper(user)::getDetailList, queryParam);
}
@ -284,8 +292,7 @@ public class SpecialAddDeductionController {
/**
* @return String
* @description 新建专项附加扣除
* @author Harryxzy
* @date 2022/10/27 14:41
* @author lfc
*/
@POST
@Path("/createData")
@ -298,30 +305,26 @@ public class SpecialAddDeductionController {
/**
* @return String
* @description 删除所选专项附加扣除
* @author Harryxzy
* @date 2022/10/27 14:41
* @author lfc
*/
@POST
@Path("/deleteSelectData")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) {
public String deleteSelectOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deleteParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteSelectData, otherDeductionDeleteParam);
return new ResponseResult<SpecialAddDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteSelectData, deleteParam);
}
/**
* @return null
* @description 一键清空专项附加扣除
* @author Harryxzy
* @date 2022/10/27 15:15
* @author lfc
*/
@POST
@Path("/deleteAllData")
@Produces(MediaType.APPLICATION_JSON)
public String deleteAllOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam otherDeductionDeleteParam) {
public String deleteAllOtherDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SpecialAddDeductionRecordDeleteParam deductionRecordDeleteParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteAllData, otherDeductionDeleteParam);
return new ResponseResult<SpecialAddDeductionRecordDeleteParam, Map<String, Object>>(user).run(getSpecialAddDeductionWrapper(user)::deleteAllData, deductionRecordDeleteParam);
}
}

View File

@ -19,6 +19,7 @@ import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
@ -35,6 +36,7 @@ import java.util.stream.Collectors;
* @author qiantao
* @version 1.0
**/
@Slf4j
public class AddUpDeductionWrapper extends Service {
private AddUpDeductionService getAddUpDeductionService(User user) {
@ -162,4 +164,9 @@ public class AddUpDeductionWrapper extends Service {
public AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam param) {
return getAddUpDeductionService(user).getAddUpDeduction(param);
}
public void autoAddAll(User opt) {
log.info("一键累计, 操作人 「{}」", opt.getUsername());
getAddUpDeductionService(user).autoAddAll();
}
}

View File

@ -8,10 +8,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionImportParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.service.SalaryEmployeeService;
@ -22,13 +19,11 @@ import com.engine.salary.service.impl.SpecialAddDeductionServiceImpl;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 专项附加扣除
@ -189,14 +184,18 @@ public class SpecialAddDeductionWrapper extends Service {
/**
* 删除所选数据
*/
public void deleteSelectData(AddUpDeductionRecordDeleteParam deleteParam) {
public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) {
getSpecialAddDeductionService(user).deleteSelectData(deleteParam);
}
/**
* 一键清空所有数据
*/
public void deleteAllData(AddUpDeductionRecordDeleteParam deleteParam) {
public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) {
getSpecialAddDeductionService(user).deleteAllData(deleteParam);
}
public SpecialAddDeductionRecordDTO getRecordById(Long id) {
return getSpecialAddDeductionService(user).getRecordById(id);
}
}