2022-05-25 13:49:25 +08:00
|
|
|
package com.engine.salary.wrapper;
|
|
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
2022-05-25 13:49:25 +08:00
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
2022-05-25 16:51:43 +08:00
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
|
2022-05-27 14:46:01 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam;
|
2022-05-25 13:49:25 +08:00
|
|
|
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
2022-05-25 16:51:43 +08:00
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2022-05-25 13:49:25 +08:00
|
|
|
import com.engine.salary.service.AddUpDeductionService;
|
|
|
|
|
import com.engine.salary.service.SalaryEmployeeService;
|
2022-05-31 21:05:59 +08:00
|
|
|
import com.engine.salary.service.TaxAgentService;
|
2022-05-25 16:51:43 +08:00
|
|
|
import com.engine.salary.service.impl.AddUpDeductionServiceImpl;
|
|
|
|
|
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
2022-05-31 21:05:59 +08:00
|
|
|
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
2022-05-25 16:51:43 +08:00
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-05-25 13:49:25 +08:00
|
|
|
import com.engine.salary.util.page.PageInfo;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-05-25 16:51:43 +08:00
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import weaver.hrm.User;
|
2022-05-25 13:49:25 +08:00
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 累计专项附加扣除
|
|
|
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
*
|
|
|
|
|
* @author qiantao
|
|
|
|
|
* @version 1.0
|
|
|
|
|
**/
|
2022-05-25 16:51:43 +08:00
|
|
|
public class AddUpDeductionWrapper extends Service {
|
|
|
|
|
|
|
|
|
|
private AddUpDeductionService getAddUpDeductionService(User user) {
|
|
|
|
|
return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-31 21:05:59 +08:00
|
|
|
private TaxAgentService getTaxAgentService(User user) {
|
|
|
|
|
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
2022-05-25 16:51:43 +08:00
|
|
|
}
|
2022-05-25 13:49:25 +08:00
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
|
|
|
|
}
|
2022-05-25 13:49:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-累计专项附加扣除列表(分页)
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public PageInfo<AddUpDeductionDTO> list(AddUpDeductionQueryParam queryParam) {
|
2022-05-25 16:51:43 +08:00
|
|
|
PageInfo<AddUpDeductionDTO> pageInfo = getAddUpDeductionService(user).listPage(queryParam);
|
2022-05-25 13:49:25 +08:00
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
return pageInfo;
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据采集-累计专项附加扣除详情列表(分页)
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-05-25 16:51:43 +08:00
|
|
|
public PageInfo<AddUpDeductionRecordDTO> getDetailList(AddUpDeductionQueryParam queryParam) {
|
2022-05-25 13:49:25 +08:00
|
|
|
Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId();
|
2022-05-25 16:51:43 +08:00
|
|
|
AddUpDeduction po = getAddUpDeductionService(user).getById(id);
|
2022-05-25 13:49:25 +08:00
|
|
|
if (po == null) {
|
2022-05-25 16:51:43 +08:00
|
|
|
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100338, "累计专项附加扣除不存在") + "[id:%s]", id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//申报月份
|
|
|
|
|
List<String> declareMonth = queryParam.getDeclareMonth();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
|
|
|
|
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
queryParam.setEmployeeId(po.getEmployeeId());
|
2022-05-25 16:51:43 +08:00
|
|
|
|
|
|
|
|
PageInfo<AddUpDeductionRecordDTO> page = getAddUpDeductionService(user).recordListPage(queryParam);
|
|
|
|
|
|
|
|
|
|
return page;
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
|
2022-05-25 13:49:25 +08:00
|
|
|
/**
|
|
|
|
|
* 导出-累计专项附加扣除列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-05-25 16:51:43 +08:00
|
|
|
public XSSFWorkbook export(AddUpDeductionQueryParam queryParam) {
|
|
|
|
|
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
|
|
|
|
return getAddUpDeductionService(user).export(isChief, queryParam);
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出-累计专项附加扣除详情列表
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-05-25 16:51:43 +08:00
|
|
|
public XSSFWorkbook exportDetail(AddUpDeductionQueryParam queryParam) {
|
2022-05-25 13:49:25 +08:00
|
|
|
Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId();
|
2022-05-25 16:51:43 +08:00
|
|
|
AddUpDeduction po = getAddUpDeductionService(user).getById(id);
|
2022-05-25 13:49:25 +08:00
|
|
|
if (po == null) {
|
2022-05-25 16:51:43 +08:00
|
|
|
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100338, "累计专项附加扣除不存在") + "[id:%s]", id));
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
2022-05-25 16:51:43 +08:00
|
|
|
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
|
|
|
|
|
|
|
|
|
return getAddUpDeductionService(user).exportDetail(po.getEmployeeId(), isChief, queryParam);
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 下载导入模板
|
|
|
|
|
*
|
|
|
|
|
* @param queryParam
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
2022-05-25 16:51:43 +08:00
|
|
|
public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) {
|
2022-05-25 13:49:25 +08:00
|
|
|
// 构建异步导出参数
|
2022-05-25 16:51:43 +08:00
|
|
|
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
|
|
|
|
return getAddUpDeductionService(user).downloadTemplate(isChief, queryParam);
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|
|
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
|
2022-05-27 15:43:38 +08:00
|
|
|
public Map<String, Object> importAddUpDeduction(AddUpDeductionImportParam importParam) {
|
|
|
|
|
return getAddUpDeductionService(user).importAddUpDeduction(importParam);
|
2022-05-25 16:51:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-05-27 14:46:01 +08:00
|
|
|
public Map<String, Object> preview(AddUpDeductionImportParam importParam) {
|
|
|
|
|
return getAddUpDeductionService(user).preview(importParam);
|
2022-05-25 16:51:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
return getAddUpDeductionService(user).getSearchCondition(params);
|
|
|
|
|
}
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|