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;
|
2023-09-04 14:20:42 +08:00
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestFailListDTO;
|
|
|
|
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRequestResultDTO;
|
|
|
|
|
import com.engine.salary.entity.datacollection.param.*;
|
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-06-24 18:05:08 +08:00
|
|
|
import com.engine.salary.util.SalaryDateUtil;
|
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;
|
2022-11-04 15:16:27 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2022-05-25 13:49:25 +08:00
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-05-25 16:51:43 +08:00
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2022-11-07 16:20:21 +08:00
|
|
|
import weaver.general.BaseBean;
|
2022-05-25 16:51:43 +08:00
|
|
|
import weaver.hrm.User;
|
2022-05-25 13:49:25 +08:00
|
|
|
|
2022-11-07 16:20:21 +08:00
|
|
|
import java.util.Date;
|
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-11-04 15:16:27 +08:00
|
|
|
@Slf4j
|
2022-05-25 16:51:43 +08:00
|
|
|
public class AddUpDeductionWrapper extends Service {
|
|
|
|
|
|
2022-11-07 16:20:21 +08:00
|
|
|
private final BaseBean baseBean = new BaseBean();
|
|
|
|
|
private final Boolean isLog = "true".equals(baseBean.getPropValue("hrmSalary", "log"));
|
|
|
|
|
|
2022-05-25 16:51:43 +08:00
|
|
|
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-06-24 18:05:08 +08:00
|
|
|
queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).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-10-26 18:35:23 +08:00
|
|
|
|
|
|
|
|
public void editAddUpDeduction(AddUpDeductionRecordParam addUpDeduction) {
|
|
|
|
|
getAddUpDeductionService(user).editAddUpDeduction(addUpDeduction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void createAddUpDeduction(AddUpDeductionRecordParam addUpDeductionRecordParam) {
|
2022-11-07 16:20:21 +08:00
|
|
|
getAddUpDeductionService(user).createAddUpDeduction(addUpDeductionRecordParam);
|
2022-10-26 18:35:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteSelectAddUpDeduction(AddUpDeductionRecordDeleteParam deleteParam) {
|
|
|
|
|
getAddUpDeductionService(user).deleteSelectAddUpDeduction(deleteParam);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-27 13:59:11 +08:00
|
|
|
public void deleteAllAddUpDeduction(AddUpDeductionRecordDeleteParam deleteParam) {
|
|
|
|
|
getAddUpDeductionService(user).deleteAllAddUpDeduction(deleteParam);
|
2022-10-26 18:35:23 +08:00
|
|
|
}
|
2022-10-31 14:50:54 +08:00
|
|
|
|
|
|
|
|
public AddUpDeductionRecordDTO getAddUpDeduction(AddUpDeductionQueryParam param) {
|
|
|
|
|
return getAddUpDeductionService(user).getAddUpDeduction(param);
|
|
|
|
|
}
|
2022-11-04 15:16:27 +08:00
|
|
|
|
2022-11-09 18:57:28 +08:00
|
|
|
public String autoAddAll(Date yearMonth) {
|
2022-11-07 16:20:21 +08:00
|
|
|
if (isLog) {
|
2022-11-09 15:39:00 +08:00
|
|
|
log.info("一键累计, 操作人 「{}」", user.getUsername());
|
2022-11-07 16:20:21 +08:00
|
|
|
}
|
2022-11-09 15:39:00 +08:00
|
|
|
if (yearMonth == null) {
|
|
|
|
|
throw new SalaryRunTimeException("一键累计传入日期格式错误");
|
|
|
|
|
}
|
2022-11-16 16:06:27 +08:00
|
|
|
return getAddUpDeductionService(user).autoAddAll(yearMonth, null);
|
2022-11-04 15:16:27 +08:00
|
|
|
}
|
2023-09-01 09:23:43 +08:00
|
|
|
|
2023-09-04 14:20:42 +08:00
|
|
|
public Map<String, Object> onlineRequest(AddUpDeductionMonthTaxAgentParam param) {
|
|
|
|
|
return getAddUpDeductionService(user).onlineRequest(param);
|
2023-09-01 09:23:43 +08:00
|
|
|
}
|
|
|
|
|
|
2023-09-04 14:20:42 +08:00
|
|
|
public AddUpDeductionRequestResultDTO onlineFeedback() {
|
|
|
|
|
return getAddUpDeductionService(user).onlineFeedback();
|
2023-09-01 09:23:43 +08:00
|
|
|
}
|
|
|
|
|
|
2023-09-04 14:20:42 +08:00
|
|
|
public PageInfo<AddUpDeductionRequestFailListDTO> onlineFeedbackFail( AddUpDeductionRequestFailQueryParam queryParam) {
|
2023-09-01 09:23:43 +08:00
|
|
|
if (queryParam.getRequestId() == null) {
|
2023-09-04 14:20:42 +08:00
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(153345, "在线获取的请求ID不可为空"));
|
2023-09-01 09:23:43 +08:00
|
|
|
}
|
2023-09-04 14:20:42 +08:00
|
|
|
PageInfo<AddUpDeductionRequestFailListDTO> page = getAddUpDeductionService(user).onlineFeedbackFail( queryParam);
|
|
|
|
|
return page;
|
2023-09-01 09:23:43 +08:00
|
|
|
}
|
|
|
|
|
|
2023-09-04 14:20:42 +08:00
|
|
|
// public Map<String, Object> exportOnlineFeedbackFail( Long requestId) {
|
|
|
|
|
// List<AddUpDeductionRequestFailPO> poList = getAddUpDeductionService(user).getAddUpDeductionRequestFailPOList(requestId);
|
|
|
|
|
// if (CollectionUtils.isEmpty(poList)) {
|
|
|
|
|
// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 95795, "数据不存在") + "[id:%s]", requestId));
|
|
|
|
|
// }
|
|
|
|
|
// // 构建异步导出参数
|
|
|
|
|
// Map<String, Object> map = salaryBatchService.buildeExportParam("exportOnlineFeedbackFail");
|
|
|
|
|
// map.put("sheetName", SalaryI18nUtil.getI18nLabel( 183778, "在线获取专项附加扣除失败数据"));
|
|
|
|
|
// LocalRunnable localRunnable = new LocalRunnable() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void execute() {
|
|
|
|
|
// try {
|
|
|
|
|
// DSTenantKeyThreadVar.tenantKey.set(tenantKey);
|
|
|
|
|
// getAddUpDeductionService(user).exportOnlineFeedbackFail(map, requestId);
|
|
|
|
|
// } finally {
|
|
|
|
|
// DSTenantKeyThreadVar.tenantKey.remove();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// ThreadPoolUtil.execute(localRunnable);
|
|
|
|
|
// return map;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// public WeaForm getRequestForm() {
|
|
|
|
|
// WeaForm weaForm = SalaryFormatUtil.<AddUpDeductionRequestFormDTO>getInstance().buildForm(AddUpDeductionRequestFormDTO.class, new AddUpDeductionRequestFormDTO());
|
|
|
|
|
// WeaFormSalaryItem item = new WeaFormSalaryItem(WeaFormItemType.DATEPICKER, "month", "YYYY-MM", "YYYY-MM");
|
|
|
|
|
// item.setRequired(true);
|
|
|
|
|
// weaForm.getItems().put("declareMonth", item);
|
|
|
|
|
// return weaForm;
|
|
|
|
|
// }
|
2022-05-25 13:49:25 +08:00
|
|
|
}
|