完成账套和扣缴义务人接口

This commit is contained in:
钱涛 2024-09-09 11:13:10 +08:00
parent 17afe87356
commit 09fb9898e7
16 changed files with 123 additions and 65 deletions

View File

@ -33,7 +33,6 @@ public class AuthRoleSaveParam {
/**
* 扣缴义务人资源
*/
@DataCheck(require = true, message = "扣缴义务人不允许为空")
private List<TaxAgentPO> taxAgentIds;

View File

@ -5,12 +5,13 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @description: 薪资账套列表查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/18/22 3:04 PM
* @version:v1.0
*/
* 账套查询
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@EqualsAndHashCode(callSuper = true)
public class SalarySobListQueryParam extends BaseQueryParam {

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salarysob.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -9,9 +10,18 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class SalarySobQueryParam extends BaseQueryParam {
//薪资账套名称")
/**
* 名称
*/
private String name;
// 薪资账套id
/**
* 扣缴义务人id
*/
private Long taxAgentId;
/**
* 数据过滤级别
*/
private AuthFilterTypeEnum filterType;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.taxagent.param;
import com.engine.salary.common.BaseQueryParam;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -26,4 +27,9 @@ public class TaxAgentQueryParam extends BaseQueryParam {
//个税扣缴义务人名称
private String name;
/**
* 数据过滤级别
*/
private AuthFilterTypeEnum filterType;
}

View File

@ -16,7 +16,8 @@ import java.util.Objects;
public enum AuthFilterTypeEnum implements BaseEnum<String> {
DATA_OPT("DATA_OPT", "数据&功能权限", 87626),
ONLY_DATA("ONLY_DATA", "仅数据权限", 87627);
QUERY_DATA("QUERY_DATA", "获取可查询数据", 87627),
ADMIN_DATA("ADMIN_DATA", "获取可管理数据", 87627);
// ONLY_OPT("ONLY_OPT", "仅功能权限", 87626) ;

View File

@ -64,7 +64,7 @@ public interface SalarySobService {
List<SalarySobPO> listAll();
List<SalarySobPO> listAllByAuth();
List<SalarySobPO> listAuth(SalarySobQueryParam param);
/**
* 获取拥有管理权限的账套

View File

@ -107,6 +107,8 @@ public interface TaxAgentService {
*/
List<TaxAgentPO> listAll();
List<TaxAgentPO> listAuth(TaxAgentQueryParam taxAgentQueryParam);
/**
* 根据id获取单个个税扣缴义务人
*
@ -128,7 +130,7 @@ public interface TaxAgentService {
* @param currentEmployeeId 当前登录人id
* @return
*/
Collection<TaxAgentPO> listAllTaxAgents(Long currentEmployeeId);
List<TaxAgentPO> listAllTaxAgents(Long currentEmployeeId);
/**
* 获取作为管理员的所有个税扣缴义务人列表

View File

@ -63,15 +63,15 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
List<AuthRoleEmpDTO> authRoleEmpDTOS = getAuthMemberService(user).listRoleEmp(roleId);
List<AuthOptPO> authOptPOS = getAuthOptService(user).listOpts(roleId);
List<AuthRoleDataDTO> authRoleDataDTOS = getAuthDataService(user).listRoleData(roleId);
List<AuthResourcePO> authResources = getAuthResourceMapper().listSome(AuthResourcePO.builder().roleId(roleId).build());
return AuthRoleDTO.builder().id(roleId)
.name(po.getName())
.members(authRoleEmpDTOS.size())
.opts(authOptPOS.size())
.datas(authRoleDataDTOS.size())
.resources(0)
.resources(authResources.size())
.build();
}).collect(Collectors.toList());
PageInfo<AuthRoleDTO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), collect, AuthRoleDTO.class);
pageInfo.setTotal(total);

View File

@ -176,8 +176,8 @@ public class AuthServiceImpl extends Service implements AuthService {
List<EmpOpt> orDefault = authMap.getOrDefault(taxAgentId, new ArrayList<>());
Map<Long, Set<String>> optsMap = SalaryEntityUtil.convert2Map(orDefault, EmpOpt::getEmployeeId, EmpOpt::getOpts);
if (optsMap.containsKey(employeeId)) {
Set<String> optSets = optsMap.getOrDefault(employeeId, new HashSet<>());
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
Set<String> optSets = optsMap.getOrDefault(employeeId, new HashSet<>());
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
@ -187,8 +187,16 @@ public class AuthServiceImpl extends Service implements AuthService {
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.QUERY_DATA) {
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.ADMIN_DATA) {
if (optSets.contains("admin")) {
resultList.add(t);
}
}
resultList.add(t);
}
}
}
@ -201,8 +209,8 @@ public class AuthServiceImpl extends Service implements AuthService {
Long sobId = (Long) sobIdFieldGetterMethod.invoke(t);
if (sobOpts.containsKey(sobId)) {
Set<String> optSets = sobOpts.getOrDefault(sobId, new HashSet<>());
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
Set<String> optSets = sobOpts.getOrDefault(sobId, new HashSet<>());
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
@ -212,8 +220,16 @@ public class AuthServiceImpl extends Service implements AuthService {
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.QUERY_DATA) {
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.ADMIN_DATA) {
if (optSets.contains("admin")) {
resultList.add(t);
}
}
resultList.add(t);
}
}
} else if (checkType == AuthCheckTypeEnum.TAX) {
@ -226,8 +242,8 @@ public class AuthServiceImpl extends Service implements AuthService {
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
if (taxOpts.containsKey(taxAgentId)) {
Set<String> optSets = taxOpts.getOrDefault(taxAgentId, new HashSet<>());
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
Set<String> optSets = taxOpts.getOrDefault(taxAgentId, new HashSet<>());
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
@ -237,9 +253,16 @@ public class AuthServiceImpl extends Service implements AuthService {
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.QUERY_DATA) {
resultList.add(t);
}
if (filterType == AuthFilterTypeEnum.ADMIN_DATA) {
if (optSets.contains("admin")) {
resultList.add(t);
}
}
resultList.add(t);
}
}
}

View File

@ -1070,7 +1070,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
List<SalaryArchivePO> list = getSalaryArchiveMapper().listAll();
list = getAuthService(user).auth(list,AuthFilterTypeEnum.ONLY_DATA,SalaryArchivePO.class);
list = getAuthService(user).auth(list,AuthFilterTypeEnum.QUERY_DATA,SalaryArchivePO.class);
long pendingTotal = 0L;
long fixedTotal = 0L;

View File

@ -20,7 +20,6 @@ import com.engine.salary.entity.salarysob.param.*;
import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
@ -216,23 +215,27 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
}
@Override
public List<SalarySobPO> listAllByAuth() {
long uid = user.getUID();
boolean isChief = getTaxAgentService(user).isChief(uid);
if (isChief) {
// 薪酬总管理员能看到所有数据
return listAll();
public List<SalarySobPO> listAuth(SalarySobQueryParam param) {
// 开启分权后需要过滤薪资账套
String name = param.getName();
// 查询所有的薪资账套
SalarySobPO build = SalarySobPO.builder().build();
if (StringUtils.isNotBlank(name)) {
build.setName(name);
}
Collection<TaxAgentPO> canManageTaxAgentList = getTaxAgentService(user).listAllTaxAgentsAsAdmin(uid);
List<Long> taxAgentIds = canManageTaxAgentList.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<SalarySobPO> salarySobPOS = listByTaxAgentIds(taxAgentIds);
return salarySobPOS;
if (param.getTaxAgentId() != null) {
List<SobTaxLinkPO> sobTaxLinkPOS = getSobTaxLinkMapper().listSome(SobTaxLinkPO.builder().taxAgentId(param.getTaxAgentId()).build());
build.setIds(sobTaxLinkPOS.stream().map(SobTaxLinkPO::getTaxAgentId).collect(Collectors.toList()));
}
List<SalarySobPO> list = getSalarySobMapper().listSome(build);
return getAuthService(user).auth(list, param.getFilterType(), SalarySobPO.class);
}
@Override
public List<SalarySobPO> listByAdmin() {
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().build());
return getAuthService(user).auth(salarySobPOS, AuthFilterTypeEnum.ONLY_DATA, SalarySobPO.class);
return getAuthService(user).auth(salarySobPOS, AuthFilterTypeEnum.QUERY_DATA, SalarySobPO.class);
}
@Override

View File

@ -29,6 +29,7 @@ import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam;
import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam;
import com.engine.salary.entity.taxagent.po.*;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
@ -279,6 +280,13 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
return getTaxAgentMapper().listAll();
}
@Override
public List<TaxAgentPO> listAuth(TaxAgentQueryParam queryParam) {
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listBySome(queryParam);
AuthFilterTypeEnum filterType = queryParam.getFilterType();
return handleForDevolution(taxAgents, (long) user.getUID(), filterType == AuthFilterTypeEnum.QUERY_DATA);
}
@Override
public TaxAgentPO getById(Long id) {
return getTaxAgentMapper().getById(id);
@ -291,7 +299,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
}
@Override
public Collection<TaxAgentPO> listAllTaxAgents(Long employeeId) {
public List<TaxAgentPO> listAllTaxAgents(Long employeeId) {
List<TaxAgentPO> taxAgents = getTaxAgentMapper().listAll();
return handleForDevolution(taxAgents, employeeId, true);
}

View File

@ -88,7 +88,7 @@ public class SalarySobController {
}
/**
* 薪资账套列表
* 根据扣缴义务人查询
*/
@POST
@Path("/listByTaxAgent")
@ -114,11 +114,11 @@ public class SalarySobController {
* 薪资账套列表分权
*/
@POST
@Path("/listAllByAuth")
@Path("/listAuth")
@Produces(MediaType.APPLICATION_JSON)
public String listAllByAuth(@Context HttpServletRequest request, @Context HttpServletResponse response) {
public String listAllByAuth(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobListQueryParam, List<SalarySobPO>>(user).run(getSalarySobWrapper(user)::listAllByAuth);
return new ResponseResult<SalarySobQueryParam, List<SalarySobPO>>(user).run(getSalarySobWrapper(user)::listAuth,queryParam);
}
@ -282,13 +282,13 @@ public class SalarySobController {
public Response downloadSobRangeTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salarySobId") Long salarySobId) {
User user = HrmUserVarify.getUser(request, response);
SalarySobPO salarySobPO = Objects.isNull(salarySobId) ? null : getSalarySobWrapper(user).getSalarySobService(user).getById(salarySobId);
if(Objects.isNull(salarySobPO)){
if (Objects.isNull(salarySobPO)) {
throw new SalaryRunTimeException("薪资账套不存在或已被删除");
}
try {
XSSFWorkbook workbook = getSalarySobRangeWrapper(user).exportImportTemplate();
String time = LocalDate.now().toString();
String fileName = salarySobPO.getName() + "人员范围导入模板" + time ;
String fileName = salarySobPO.getName() + "人员范围导入模板" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
@ -299,18 +299,16 @@ public class SalarySobController {
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).
header("Content-disposition", "attachment;filename=" + fileName).
header("Cache-Control", "no-cache").build();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("人员范围导入失败",e);
log.error("人员范围导入失败", e);
throw e;
}
}
/**
* @description 薪资账套人员范围导入预览
* @return String
* @description 薪资账套人员范围导入预览
* @author Harryxzy
* @date 2023/1/9 13:32
*/
@ -323,8 +321,8 @@ public class SalarySobController {
}
/**
* @description 薪资账套人员范围导入
* @return String
* @description 薪资账套人员范围导入
* @author Harryxzy
* @date 2023/1/9 13:32
*/
@ -348,7 +346,7 @@ public class SalarySobController {
@Produces(MediaType.APPLICATION_JSON)
public String listSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemSobListDTO> >(user).run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
return new ResponseResult<SalaryItemSearchParam, PageInfo<SalaryItemSobListDTO>>(user).run(getSalarySobItemWrapper(user)::listPage4SalaryItem, queryParam);
}
@ -418,30 +416,28 @@ public class SalarySobController {
}
/**********************************薪资账套的薪资项目 end*********************************/
/**********************************薪资账套的回算项目 start*********************************/
/**
* @description 薪资账套回算项目列表
* @return String
* @description 薪资账套回算项目列表
* @author Harryxzy
* @date 2022/11/16 14:01
*/
@GET
@Path("/backitem/getAggregate")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBackItemAggregate(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "salarySobId") Long salarySobId) {
public String getSalarySobBackItemAggregate(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salarySobId") Long salarySobId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long,SalarySobBackItemAggregateDTO>(user).run(getSalarySobBackItemWrapper(user)::getAggregate, salarySobId);
return new ResponseResult<Long, SalarySobBackItemAggregateDTO>(user).run(getSalarySobBackItemWrapper(user)::getAggregate, salarySobId);
}
/**
* @description 薪资账套回算项目详情(编辑前获取)
* @return null
* @description 薪资账套回算项目详情(编辑前获取)
* @author Harryxzy
* @date 2022/11/16 14:02
*/
@ -449,29 +445,28 @@ public class SalarySobController {
@Path("/backitem/getForm")
@ApiOperation("薪资账套回算项目详情")
@Produces(MediaType.APPLICATION_JSON)
public String getSalarySobBackItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value ="id") Long id) {
public String getSalarySobBackItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long,SalarySobBackItemFormDTO>(user).run(getSalarySobBackItemWrapper(user)::getForm, id);
return new ResponseResult<Long, SalarySobBackItemFormDTO>(user).run(getSalarySobBackItemWrapper(user)::getForm, id);
}
/**
* @description 保存薪资账套回算项目
* @return String
* @description 保存薪资账套回算项目
* @author Harryxzy
* @date 2022/11/16 15:05
*/
@POST
@Path("/backitem/save")
@Produces(MediaType.APPLICATION_JSON)
public String saveSalarySobBackItem(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody SalarySobBackItemSaveParam saveParam) {
public String saveSalarySobBackItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobBackItemSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobBackItemSaveParam,List<SalarySobBackItemDTO>>(user).run(getSalarySobBackItemWrapper(user)::save, saveParam);
return new ResponseResult<SalarySobBackItemSaveParam, List<SalarySobBackItemDTO>>(user).run(getSalarySobBackItemWrapper(user)::save, saveParam);
}
/**********************************薪资账套的回算项目 end*********************************/
/**********************************调薪计薪规则 start*********************************/

View File

@ -118,6 +118,14 @@ public class TaxAgentController {
return new ResponseResult<TaxAgentQueryParam, PageInfo<Map<String, Object>>>(user).run(getTaxAgentWrapper(user)::list, queryParam);
}
@POST
@Path("/listAuth")
@Produces(MediaType.APPLICATION_JSON)
public String selectList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxAgentQueryParam, List<TaxAgentPO>>(user).run(getTaxAgentWrapper(user)::listAuth, queryParam);
}
//查询个税扣缴义务人下面的代缴机构")
@GET
@Path("/paymentAgency/list")

View File

@ -132,8 +132,8 @@ public class SalarySobWrapper extends Service {
*
* @return
*/
public List<SalarySobPO> listAllByAuth() {
return getSalarySobService(user).listAllByAuth();
public List<SalarySobPO> listAuth(SalarySobQueryParam param) {
return getSalarySobService(user).listAuth(param);
}
private void handleSalarySobBackItemHistory(SalarySobListQueryParam queryParam) {

View File

@ -5,7 +5,6 @@ import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.entity.auth.po.AuthRolePO;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.HrmStatus;
import com.engine.salary.entity.taxagent.bo.TaxAgentBO;
@ -21,7 +20,6 @@ import com.engine.salary.service.*;
import com.engine.salary.service.auth.AuthRoleService;
import com.engine.salary.service.auth.AuthRoleServiceImpl;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
@ -170,6 +168,10 @@ public class TaxAgentWrapper extends Service {
}
public List<TaxAgentPO> listAuth(TaxAgentQueryParam taxAgentQueryParam) {
return getTaxAgentService(user).listAuth(taxAgentQueryParam);
}
public List<Map<String, Object>> paymentAgencyList(TaxAgentQueryParam queryParam) {
// List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(queryParam.getIds());
// List<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);