薪资核算导出模板优化

This commit is contained in:
Harryxzy 2024-03-29 16:23:08 +08:00
parent 19732b39b8
commit d57d5f7e13
12 changed files with 261 additions and 33 deletions

View File

@ -0,0 +1,34 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Harryxzy
* @ClassName AzGssbDTO
* @date 2024/03/27 15:03
* @description 艾志个税申报权限
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AzGssbDTO {
/**
* 个税管理人员
*/
private int gsglry;
/**
* 权限
*/
private int qx;
/**
* 部门
*/
private int bm;
}

View File

@ -6,11 +6,13 @@ import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareRateDTO;
import com.engine.salary.entity.employeedeclare.param.*;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 人员报送人员
@ -186,4 +188,8 @@ public interface EmployeeDeclareService{
void batchInsert(List<EmployeeDeclarePO> insertList);
List<EmployeeDeclarePO> listByEmpIdsAndTaxCycle(List<Long> empIds, Date date);
List<AzGssbDTO> getAzGssbAuth(int uid);
Map<String, Object> empIdsByAzGssbAuth(int uid);
}

View File

@ -30,7 +30,7 @@ public interface TaxDeclarationValueService {
* @param taxDeclarationIds
* @return
*/
PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds, String keyWord);
PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds, String keyWord, TaxDeclarationPO taxDeclaration);
/**
* 查询个税申报表明细

View File

@ -222,6 +222,11 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
if (CollectionUtils.isEmpty(data)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "导入数据不能为空"));
}
List<Long> canManageTaxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
// 错误提示信息
List<ExcelComment> excelComments = Lists.newArrayList();
List<Map> errorData = new ArrayList<>();
@ -439,20 +444,38 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该工号"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
// 艾志二开-校验是否有导入权限
if (!canManageTaxAgentIds.contains(taxAgentId) &&
((extEmployee != null && !canManageEmpIds.contains(extEmployee.getEmployeeId()))
|| (simpleEmployee != null && !canManageEmpIds.contains(simpleEmployee.getEmployeeId()))) ) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
}
}
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
// 艾志二开-校验是否有导入权限
if (!canManageTaxAgentIds.contains(taxAgentId) && !canManageEmpIds.contains(employeeDeclare.getEmployeeId())){
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限"));
errorData.add(errorMessageMap);
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
}
}
}
} else {
@ -466,21 +489,39 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该证件号码"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
// 艾志二开-校验是否有导入权限
if (!canManageTaxAgentIds.contains(taxAgentId) &&
((extEmployee != null && !canManageEmpIds.contains(extEmployee.getEmployeeId()))
|| (simpleEmployee != null && !canManageEmpIds.contains(simpleEmployee.getEmployeeId()))) ) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
}
}
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
// 艾志二开-校验是否有导入权限
if (!canManageTaxAgentIds.contains(taxAgentId) && !canManageEmpIds.contains(employeeDeclare.getEmployeeId())){
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限"));
errorData.add(errorMessageMap);
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
}
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
}
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
}
}
}
@ -578,6 +619,10 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) {
// 查询需要报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByParam(queryParam);
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
employeeDeclares = employeeDeclares.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
// 转换成dto
List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
// 需要导出的数据

View File

@ -28,6 +28,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO;
import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.SalaryCycleTypeEnum;
@ -58,8 +59,10 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import java.time.LocalDate;
import java.util.*;
@ -108,6 +111,10 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
@Override
public EmployeeDeclarePO getById(Long id) {
return getEmployeeDeclareMapper().getById(id);
@ -161,6 +168,10 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
@Override
public PageInfo<EmployeeDeclarePO> listPage4UpdateByParam(EmployeeDeclareListQueryParam queryParam) {
List<EmployeeDeclarePO> list = getEmployeeDeclareMapper().list4UpdateByParam(queryParam);
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
list = list.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, EmployeeDeclarePO.class);
}
@ -190,6 +201,15 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
@Override
public void save(EmployeeDeclareSaveParam saveParam) {
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(saveParam.getTaxAgentId())) {
// 不是薪酬管理员
Map<String, Object> authMap = empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
if (!canManageEmpIds.contains(saveParam.getEmployeeId())) {
throw new SalaryRunTimeException("没有该部门个税操作权限,请联系管理员开通权限");
}
}
Date now = new Date();
EmployeeDeclarePO employeeDeclare = new EmployeeDeclarePO();
employeeDeclare.setTaxAgentId(saveParam.getTaxAgentId());
@ -551,6 +571,13 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
public EmployeeDeclareInfoDTO getDeclareInfo(EmployeeDeclareParam employeeDeclareParam) {
// 查询本月已有的需要报送的人员
List<EmployeeDeclarePO> employeeDeclares = listByTaxCycleAndTaxAgentId(employeeDeclareParam.getTaxCycle(), employeeDeclareParam.getTaxAgentId());
// 240329艾志分权
// 获取能够管理的义务人id
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
employeeDeclares = employeeDeclares.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
// 本月是否有修改过人员信息
boolean updateEmployeeInfo = employeeDeclares.stream().anyMatch(e -> Objects.equals(e.getNewEmployeeInfo(), 1) && Objects.equals(e.getDeclareStatus(), DeclareStatusEnum.NOT_DECLARE.getValue()));
// 本月报送失败的人数
@ -766,4 +793,44 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
}
return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().employeeIds(empIds).taxCycle(date).build());
}
@Override
public List<AzGssbDTO> getAzGssbAuth(int uid) {
RecordSet rs = new RecordSet();
rs.execute("select qx,bm from uf_gssbqx where gsglry="+uid);
List<AzGssbDTO> azGssbAuthList = new ArrayList<>();
while (rs.next()) {
azGssbAuthList.add(AzGssbDTO.builder()
.gsglry(uid)
.bm(rs.getInt("bm"))
.qx(rs.getInt("qx")).build());
}
azGssbAuthList = azGssbAuthList.stream().filter(auth -> auth.getQx() == 0 || auth.getQx() == 1).collect(Collectors.toList());
return azGssbAuthList;
}
public Map<String, Object> empIdsByAzGssbAuth(int uid) {
//艾志二开登录人拥有查看编辑部门权限下的人员
List<AzGssbDTO> azGssbAuth = getAzGssbAuth(uid);
List<Long> empListByDep = new ArrayList<>();
if (azGssbAuth.size() > 0) {
List<Long> depWithChildList = new ArrayList<>();
for (AzGssbDTO dto : azGssbAuth) {
try {
String depStr = DepartmentComInfo.getAllChildDepartId(String.valueOf(dto.getBm()), String.valueOf(dto.getBm()));
depWithChildList.addAll(Arrays.stream(depStr.split(",")).map(Long::parseLong).collect(Collectors.toList()));
} catch (Exception e) {
e.printStackTrace();
}
}
//查询有权限部门包含的员工id
empListByDep = getSalaryEmployeeService(user).listEmpIdByDepId(depWithChildList);
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("canManageEmpIds", empListByDep);
// 客户会规定一个用户在建模表中要么全是查看权限要么全是编辑权限
Optional<AzGssbDTO> canOperate = azGssbAuth.stream().filter(dto -> dto.getQx() == 1).findFirst();
resultMap.put("canOperate", canOperate.isPresent());
return resultMap;
}
}

View File

@ -7,7 +7,6 @@ import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
@ -90,6 +89,10 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private SalarySysConfMapper getSalarySysConfMapper() {
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
@ -104,6 +107,15 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId());
// 查询个税申报表明细
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueService(user).listByTaxDeclarationIds(Collections.singleton(queryParam.getTaxDeclarationId()));
// 艾志个税分权
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(taxDeclarationPO.getTaxAgentId())) {
// 不是薪酬管理员
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
taxDeclarationValues = taxDeclarationValues.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 转成个税申报表明细
TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclarationPO, taxDeclarationValues);
// excel导出的数据

View File

@ -103,7 +103,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
}
@Override
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds, String keyword) {
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds, String keyword, TaxDeclarationPO taxDeclaration) {
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
// 根据关键词查人员信息
if (StringUtils.isNotBlank(keyword)) {
@ -111,6 +111,13 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
List<Long> empIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList());
taxDeclarationValuePOS = taxDeclarationValuePOS.stream().filter(po -> empIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 艾志分权
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(taxDeclaration.getTaxAgentId())) {
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
taxDeclarationValuePOS = taxDeclarationValuePOS.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
taxDeclarationValuePOS = decryptBatch(taxDeclarationValuePOS);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationValuePOS, TaxDeclarationValuePO.class);
}

View File

@ -26,6 +26,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO;
import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO;
import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
import com.engine.salary.entity.taxdeclaration.bo.*;
import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.DeclareTaxResultFeedbackQueryParam;
@ -225,6 +226,11 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
Collection<TaxAgentPO> taxAgents = Lists.newArrayList();
if (openDevolution && !isChief) {
taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
// 艾志二开-查询是否具有个税申报权限
List<AzGssbDTO> azGssbAuth = getEmployeeDeclareService(user).getAzGssbAuth(user.getUID());
if (CollectionUtils.isNotEmpty(azGssbAuth)) {
taxAgents = getTaxAgentService(user).listAll();
}
if (CollectionUtils.isEmpty(taxAgents)) {
return pageInfo;
}

View File

@ -73,7 +73,7 @@ public class TaxDeclarationController {
@Produces(MediaType.APPLICATION_JSON)
public String listTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclarationListQueryParam, PageInfo>(user).run(getTaxDeclareRecordWrapper(user)::listPage, queryParam);
return new ResponseResult<TaxDeclarationListQueryParam, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::listPage, queryParam);
}
/**

View File

@ -12,6 +12,7 @@ import com.engine.salary.entity.employeedeclare.dto.*;
import com.engine.salary.entity.employeedeclare.param.*;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO;
import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.enums.employeedeclare.*;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
@ -34,6 +35,7 @@ import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
@ -95,6 +97,11 @@ public class EmployeeDeclareWrapper extends Service {
taxAgents = getTaxAgentService(user).listAll();
} else {
taxAgents = new ArrayList<>(getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())));
// 艾志二开-查询是否具有个税申报权限
List<AzGssbDTO> azGssbAuth = getEmployeeDeclareService(user).getAzGssbAuth(user.getUID());
if (CollectionUtils.isNotEmpty(azGssbAuth)) {
taxAgents = getTaxAgentService(user).listAll();
}
}
if (StringUtils.isNotEmpty(queryParam.getTaxAgentName())) {
taxAgents = taxAgents.stream().filter(e -> StringUtils.contains(e.getName(), queryParam.getTaxAgentName())).collect(Collectors.toList());
@ -110,6 +117,9 @@ public class EmployeeDeclareWrapper extends Service {
}
/**
* 人员报送-全部人员列表
*
@ -120,6 +130,12 @@ public class EmployeeDeclareWrapper extends Service {
ValidUtil.doValidator(queryParam);
PageInfo<EmployeeDeclareListDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), EmployeeDeclareListDTO.class);
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareService(user).listByParam(queryParam);
// 获取能够管理的义务人id
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
boolean canOperate = (Boolean) authMap.get("canOperate");
employeeDeclarePOS = employeeDeclarePOS.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
pageInfo.setTotal(employeeDeclarePOS.size());
employeeDeclarePOS = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), employeeDeclarePOS);
List<EmployeeDeclareListDTO> convert = getEmployeeDeclareService(user).convert(employeeDeclarePOS);
@ -141,9 +157,11 @@ public class EmployeeDeclareWrapper extends Service {
Map<String, Object> datas = new HashMap<>();
datas.put("pageInfo", pageInfo);
datas.put("dataKey", result.getResultMap());
datas.put("canOperate", canOperate);
return datas;
}
/**
* 人员报送-本月新增人员列表
*
@ -152,6 +170,12 @@ public class EmployeeDeclareWrapper extends Service {
*/
public Map<String, Object> list4Add(EmployeeDeclareAddListQueryParam queryParam) {
List<EmployeeDeclarePO> addPOList = getEmployeeDeclareService(user).list4AddByParam(queryParam);
// 获取能够管理的义务人id
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
addPOList = addPOList.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
PageInfo<EmployeeDeclarePO> addPoPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), addPOList, EmployeeDeclarePO.class);
List<EmployeeDeclareListDTO> addDTOList = getEmployeeDeclareService(user).convert(addPoPageInfo.getList());
// 分页

View File

@ -66,6 +66,10 @@ public class TaxAgentWrapper extends Service {
return ServiceUtil.getService(TaxAgentExcelServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
// private PaymentAgencyService paymentAgencyService;
//
@ -106,6 +110,7 @@ public class TaxAgentWrapper extends Service {
}
resultMap.put("isChief", isChief);
resultMap.put("isDefaultOpen", isDefaultOpen);
// 是否是薪酬管理员
resultMap.put("isAdminEnable", isAdminEnable);
resultMap.put("isOpenDevolution", isOpenDevolution);
resultMap.put("isDepAuth", isDepAuth);

View File

@ -2,9 +2,9 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
@ -27,12 +27,12 @@ import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
import com.engine.salary.util.db.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
@ -109,7 +109,15 @@ public class TaxDeclareRecordWrapper extends Service {
* @param queryParam
* @return
*/
public PageInfo<TaxDeclareRecordListDTO> listPage(TaxDeclarationListQueryParam queryParam) {
public Map<String, Object> listPage(TaxDeclarationListQueryParam queryParam) {
// 获取是否具有艾志个税操作权限
Map<String, Object> azGssbAuth = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
boolean canOperate = (Boolean) azGssbAuth.get("canOperate");
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(Long.valueOf(user.getUID()));
if (adminEnable) {
// 薪酬管理员也有操作权限
canOperate = true;
}
PageInfo<TaxDeclareRecordPO> page = getTaxDeclareRecordService(user).listPageByParam(queryParam);
List<TaxDeclareRecordPO> list = page.getList();
@ -149,7 +157,11 @@ public class TaxDeclareRecordWrapper extends Service {
}
dtoPage.setList(dtoList);
}
return dtoPage;
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("pageInfo", dtoPage);
resultMap.put("canOperate", canOperate);
return resultMap;
}
/**
@ -167,7 +179,7 @@ public class TaxDeclareRecordWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看"));
}
// 查询个税申报表详情
PageInfo<TaxDeclarationValuePO> page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam, Collections.singleton(queryParam.getTaxDeclarationId()), queryParam.getKeyword());
PageInfo<TaxDeclarationValuePO> page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam, Collections.singleton(queryParam.getTaxDeclarationId()), queryParam.getKeyword(), taxDeclaration);
TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclaration, page.getList());
PageInfo<Map<String, Object>> dtoPage = new PageInfo<>(
page.getPageNum(),
@ -175,6 +187,16 @@ public class TaxDeclareRecordWrapper extends Service {
page.getTotal(),
SalaryPageUtil.convertList(taxDeclarationValueListDTO.getColumns()),
taxDeclarationValueListDTO.getData());
Map<String, Object> azGssbAuth = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
boolean canOperate = (Boolean) azGssbAuth.get("canOperate");
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(Long.valueOf(user.getUID()));
if (adminEnable) {
// 薪酬管理员也有操作权限
canOperate = true;
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("canOperate", canOperate);
resultMap.put("pageInfo", dtoPage);
return dtoPage;
}