weaver-hrm-salary/src/com/engine/salary/web/SalaryAcctController.java

432 lines
22 KiB
Java
Raw Normal View History

2022-04-06 20:01:00 +08:00
package com.engine.salary.web;
2022-04-07 11:39:22 +08:00
import com.engine.common.util.ServiceUtil;
2022-04-07 18:41:40 +08:00
import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO;
2022-04-07 11:39:22 +08:00
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordFormDTO;
2022-04-07 18:41:40 +08:00
import com.engine.salary.entity.salaryacct.param.*;
2022-04-07 16:54:10 +08:00
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
2022-04-07 11:39:22 +08:00
import com.engine.salary.util.ResponseResult;
2022-04-08 16:30:10 +08:00
import com.engine.salary.util.SalaryDateUtil;
2022-04-07 11:39:22 +08:00
import com.engine.salary.util.page.PageInfo;
2022-04-07 16:54:10 +08:00
import com.engine.salary.wrapper.SalaryAcctEmployeeWrapper;
2022-04-07 11:39:22 +08:00
import com.engine.salary.wrapper.SalaryAcctRecordWrapper;
2022-04-08 19:08:59 +08:00
import com.engine.salary.wrapper.SalaryAcctResultWrapper;
2022-04-07 11:39:22 +08:00
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
2022-04-07 16:54:10 +08:00
import java.util.Collection;
2022-04-07 11:39:22 +08:00
2022-04-06 20:01:00 +08:00
/**
* 薪资核算
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalaryAcctController {
2022-04-07 11:39:22 +08:00
private SalaryAcctRecordWrapper salaryAcctRecordWrapper;
private SalaryAcctRecordWrapper getSalaryAcctRecordWrapper(User user) {
return (SalaryAcctRecordWrapper) ServiceUtil.getService(SalaryAcctRecordWrapper.class, user);
}
2022-04-07 16:54:10 +08:00
private SalaryAcctEmployeeWrapper getSalaryAcctEmployeeWrapper(User user) {
return (SalaryAcctEmployeeWrapper) ServiceUtil.getService(SalaryAcctEmployeeWrapper.class, user);
}
2022-04-08 19:08:59 +08:00
private SalaryAcctResultWrapper salaryAcctResultWrapper;
2022-04-06 20:01:00 +08:00
// private SalaryAcctCheckResultWrapper salaryAcctCheckResultWrapper;
// private SalaryComparisonResultWrapper salaryComparisonResultWrapper;
// private SalaryAcctExcelWrapper salaryAcctExcelWrapper;
// private SalaryAcctExcelService salaryAcctExcelService;
// private SalaryBatchService salaryBatchService;
//
// /**********************************薪资核算记录相关 start*********************************/
2022-04-07 11:39:22 +08:00
//薪资核算列表
@POST
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctRecordQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
2022-04-08 16:30:10 +08:00
queryParam.setStartMonth(SalaryDateUtil.String2YearMonth(queryParam.getStartMonthStr()));
queryParam.setEndMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndMonthStr()));
2022-04-07 11:39:22 +08:00
return new ResponseResult<SalaryAcctRecordQueryParam, PageInfo>().run(getSalaryAcctRecordWrapper(user)::listPage, queryParam);
}
//薪资核算详情
@GET
@Path("/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, SalaryAcctRecordFormDTO>().run(getSalaryAcctRecordWrapper(user)::getForm, id);
}
2022-04-07 16:54:10 +08:00
//获取薪资核算的薪资周期、考勤周期等
@GET
@Path("/getSalarySobCycle")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobCycle(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, SalarySobCycleDTO>().run(getSalaryAcctRecordWrapper(user)::getSalarySobCycleById, salaryAcctRecordId);
}
//保存薪资核算的基本信息
@POST
@Path("/basic/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctRecordSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
2022-04-08 16:30:10 +08:00
param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
2022-04-07 16:54:10 +08:00
return new ResponseResult<SalaryAcctRecordSaveParam, Long>().run(getSalaryAcctRecordWrapper(user)::save, param);
}
//删除薪资核算记录
@POST
@Path("/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalaryAcctRecord(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, Long>().run(getSalaryAcctRecordWrapper(user)::delete, ids);
}
//归档薪资核算记录
@GET
@Path("/file")
@Produces(MediaType.APPLICATION_JSON)
public String fileSalaryAcctRecord(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Long>().run(getSalaryAcctRecordWrapper(user)::file, id);
}
//重新核算
@POST
@Path("/reAccounting")
@Produces(MediaType.APPLICATION_JSON)
public String reAccounting(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctRecordReAccountParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Long>().run(getSalaryAcctRecordWrapper(user)::reCalculate, param.getSalaryAcctRecordId());
}
//判断是否存在合并计税
@GET
@Path("/hasConsolidatedTax")
@Produces(MediaType.APPLICATION_JSON)
public String hasConsolidatedTax(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, Integer>().run(getSalaryAcctRecordWrapper(user)::hasConsolidatedTax, id);
}
2022-04-07 18:41:40 +08:00
/**********************************薪资核算记录相关 end*********************************/
/**********************************薪资核算人员相关 start*********************************/
//薪资核算人员确认列表
@POST
@Path("/acctemployee/list")
@Produces(MediaType.APPLICATION_JSON)
public String listSalaryAccountingEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeQueryParam, PageInfo<SalaryAccEmployeeListDTO>>().run(getSalaryAcctEmployeeWrapper(user)::listPage, param);
}
//薪资核算环比上期减少人员列表
@POST
@Path("/reducedemployee/list")
@Produces(MediaType.APPLICATION_JSON)
public String listReducedEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeQueryParam,PageInfo<SalaryAccEmployeeListDTO>>().run(getSalaryAcctEmployeeWrapper(user)::listPage4Reduce, param);
}
//添加薪资核算人员
@POST
@Path("/acctemployee/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveSalaryAcctEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeSaveParam,String>().run(getSalaryAcctEmployeeWrapper(user)::save, param);
}
//删除薪资核算人员
@POST
@Path("/acctemployee/delete")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSalaryAcctEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeDeleteParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeDeleteParam,String>().run(getSalaryAcctEmployeeWrapper(user)::delete, param);
}
//检查薪资核算人员的个税扣缴义务人
@POST
@Path("/acctemployee/checkTaxAgent")
@Produces(MediaType.APPLICATION_JSON)
public String checkTaxAgent(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmpCheckTaxAgentParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long,String>().run(getSalaryAcctEmployeeWrapper(user)::checkTaxAgent, param.getSalaryAcctRecordId());
}
//刷新薪资核算人员的个税扣缴义务人
@POST
@Path("/acctemployee/refreshTaxAgent")
@Produces(MediaType.APPLICATION_JSON)
public String refreshTaxAgent(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmpRefreshTaxAgentParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long,String>().run(getSalaryAcctEmployeeWrapper(user)::refreshTaxAgent, param.getSalaryAcctRecordId());
}
//从环比上月减少添加薪资核算人员
@POST
@Path("/acctemployee/addFromReduce")
@Produces(MediaType.APPLICATION_JSON)
public String addFromReduce(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeAddParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeAddParam,String>().run(getSalaryAcctEmployeeWrapper(user)::addFromReduce, param);
}
2022-04-06 20:01:00 +08:00
// @PostMapping("/acctemployee/export")
// @ApiOperation("导出人员范围")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportSalaryAcctEmployee(@RequestBody @Validated SalaryAcctEmployeeQueryParam queryParam) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportSalaryAcctEmployee(queryParam, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
2022-04-07 18:41:40 +08:00
2022-04-06 20:01:00 +08:00
// @PostMapping("/reducedemployee/export")
// @ApiOperation("导出环比减少人员")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportReducedEmployee(@RequestBody @Validated SalaryAcctEmployeeQueryParam queryParam) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportReducedEmployee(queryParam, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
2022-04-07 18:41:40 +08:00
2022-04-06 20:01:00 +08:00
// /**********************************薪资核算人员相关 end*********************************/
//
// /**********************************薪资核算结果 start*********************************/
//
// @PostMapping("/acctresult/list")
// @ApiOperation(("薪资核算结果列表"))
// @WeaPermission
// public WeaResult<WeaTable<Map<String, Object>>> listSalaryAcctResult(@RequestBody @Validated SalaryAcctResultQueryParam queryParam) {
// WeaTable<Map<String, Object>> weaTable = salaryAcctResultWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/acctresult/getSearchCondition")
// @ApiOperation(("获取薪资核算结果高级搜索"))
// @WeaPermission
// public WeaResult<WeaSearchCondition> getSalaryAcctResultSearchCondition() {
// WeaSearchCondition searchCondition = salaryAcctResultWrapper.getSearchCondition(TenantContext.getCurrentTenantKey());
// return WeaResult.success(searchCondition);
// }
//
// @GetMapping("/acctresult/detail")
// @ApiOperation(("薪资核算结果详情"))
// @WeaPermission
// public WeaResult<SalaryAcctResultDetailDTO> getSalaryAcctResultDetail(@RequestParam(value = "id") Long id) {
// SalaryAcctResultDetailDTO dto = salaryAcctResultWrapper.getForm(id, TenantContext.getCurrentTenantKey());
// return WeaResult.success(dto);
// }
//
// @GetMapping("/acctresult/getConsolidatedTaxDetail")
// @ApiOperation(("薪资核算合并计税详情"))
// @WeaPermission
// public WeaResult<ConsolidatedTaxDetailDTO> getConsolidatedTaxDetail(@RequestParam(value = "salaryAcctEmpId") Long salaryAcctEmpId) {
// ConsolidatedTaxDetailDTO dto = salaryAcctResultWrapper.getConsolidatedTaxDetail(salaryAcctEmpId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(dto);
// }
//
// @PostMapping("/acctresult/save")
// @ApiOperation(("编辑薪资核算结果"))
// @WeaPermission
// public WeaResult<Object> saveSalaryAcctResult(@RequestBody @Validated SalaryAcctResultSaveParam saveParam) {
// salaryAcctResultWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/acctresult/accounting")
// @ApiOperation("薪资核算")
// @WeaPermission
// public WeaResult<String> accounting(@RequestBody @Validated SalaryAcctCalculateParam acctParam) {
// salaryAcctResultWrapper.calculate(acctParam, UserContext.getCurrentUser(), TenantContext.getCurrentTenantKey());
// return WeaResult.success("");
// }
//
// @PostMapping("/acctresult/export")
// @ApiOperation("导出核算结果")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportSalaryAcctResult(@RequestBody @Validated SalaryAcctResultQueryParam queryParam) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportSalaryAcctResult(queryParam, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @GetMapping("/acctresult/importField")
// @ApiOperation("导入核算结果前生成导入模板时可选的薪资项目")
// @WeaPermission
// public WeaResult<SalaryAcctImportFieldDTO> getImportField(@RequestParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
// SalaryAcctImportFieldDTO importField = salaryAcctExcelService.getImportField(salaryAcctRecordId, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(importField);
// }
//
// @PostMapping("/acctresult/importtemplate/export")
// @ApiOperation("导出导入模板")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportImportTemplate(@RequestBody @Validated SalaryAcctImportTemplateParam param) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportImportTemplate(param, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @GetMapping("/acctresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
// public WeaResult<ExcelImportParam> getAcctResultImportParams() {
// return WeaResult.success(salaryBatchService.buildImportParam("importSalaryAcctResult",
// "importSalaryAcctResult",
// "薪资核算结果",
// null,
// null));
// }
//
// /**********************************薪资核算结果 end*********************************/
//
// /**********************************检验异常 start*********************************/
//
// @GetMapping("/checkresult/getCount")
// @ApiOperation(("获取校验结果(异常)总数"))
// @WeaPermission
// public WeaResult<Integer> getCheckResultCount(@RequestParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
// Integer salaryCheckResultCount = salaryAcctCheckResultWrapper.countBySalaryAcctRecordId(salaryAcctRecordId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(salaryCheckResultCount);
// }
//
// @PostMapping("/checkresult/list")
// @ApiOperation("校验结果列表")
// @WeaPermission
// public WeaResult<WeaTable<SalaryCheckResultListDTO>> listCheckResult(@RequestBody @Validated SalaryCheckResultQueryParam queryParam) {
// WeaTable<SalaryCheckResultListDTO> weaTable = salaryAcctCheckResultWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @PostMapping("/checkresultdetail/list")
// @ApiOperation("校验结果明细列表")
// @WeaPermission
// public WeaResult<WeaTable<SalaryCheckResultRecordListDTO>> listCheckResultRecord(@RequestBody @Validated SalaryCheckResultRecordQueryParam queryParam) {
// WeaTable<SalaryCheckResultRecordListDTO> weaTable = salaryAcctCheckResultWrapper.listPage4CheckResultRecord(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @PostMapping("/checkresult/ignore")
// @ApiOperation("校验结果列表")
// @WeaPermission
// public WeaResult<Object> ignoreCheckResult(@RequestParam(value = "id") Long id) {
// salaryAcctCheckResultWrapper.ignoreById(id, TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/checkresult/ignoreAll")
// @ApiOperation("校验结果列表")
// @WeaPermission
// public WeaResult<Object> ignoreAllCheckResult(@RequestParam(value = "salaryAcctRecordId") Long salaryAcctRecordId) {
// salaryAcctCheckResultWrapper.ignoreBySalaryAcctRecordId(salaryAcctRecordId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/acctresult/check")
// @ApiOperation(("薪资核算结果校验"))
// @WeaPermission
// public WeaResult<Object> check(@RequestBody @Validated SalaryAcctCheckParam checkParam) {
// salaryAcctResultWrapper.check(checkParam, UserContext.getCurrentUser(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/checkresult/export")
// @ApiOperation("校验异常导出")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportCheckResult(@RequestBody @Validated SalaryCheckResultExportParam exportParam) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportCheckResult(exportParam, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @PostMapping("/checkresultRecord/export")
// @ApiOperation("校验异常明细导出")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportCheckResultDetail(@RequestParam(value = "checkResultId") Long checkResultId) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportCheckResultDetail(checkResultId, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// /**********************************检验异常 end*********************************/
//
// /**********************************线下对比 start*********************************/
//
// @PostMapping("/comparisonresult/list")
// @ApiOperation("线上线下对比结果列表")
// @WeaPermission
// public WeaResult<WeaTable<Map<String, Object>>> listComparisonResult(@RequestBody @Validated SalaryComparisonResultQueryParam queryParam) {
// WeaTable<Map<String, Object>> weaTable = salaryComparisonResultWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/comparisonresult/importParams")
// @ApiOperation("获取导入核算结果的导入参数")
// @WeaPermission
// public WeaResult<ExcelImportParam> getComparisonResultImportParams() {
// return WeaResult.success(salaryBatchService.buildImportParam("importExcelAcctResult",
// "importExcelAcctResult",
// "线下核算结果",
// null,
// null));
// }
//
// @PostMapping("/comparisonresult/export")
// @ApiOperation("导出线上线下对比结果")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportComparisonResult(@RequestBody @Validated SalaryComparisonResultQueryParam queryParam) {
// SimpleEmployee simpleEmployee = UserContext.getCurrentUser();
// String tenantKey = TenantContext.getCurrentTenantKey();
// String eteamsId = TenantRpcContext.getEteamsId();
// Map<String, Object> map = salaryAcctExcelWrapper.exportComparisonResult(queryParam, simpleEmployee, tenantKey, eteamsId);
// return WeaResult.success(map);
// }
//
// @PostMapping("/comparisonresult/importtemplate/export")
// @ApiOperation("线下对比结果导入模板导出")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportComparisonResultTemplate(@RequestBody @Validated SalaryComparisonResultExportParam exportParam) {
// String tenantKey = TenantContext.getCurrentTenantKey();
// Map<String, Object> map = salaryAcctExcelWrapper.exportComparisonResultTemplate(exportParam, tenantKey);
// return WeaResult.success(map);
// }
/**********************************线下对比 end*********************************/
}