艾志优化

This commit is contained in:
Harryxzy 2024-04-02 10:38:52 +08:00
parent d57d5f7e13
commit de1efcfd7f
5 changed files with 64 additions and 12 deletions

View File

@ -281,6 +281,11 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueService(user).listByTaxDeclarationId(declarationPO.getId());
Map<Long, TaxDeclarationValuePO> empDeclarationValueMap = SalaryEntityUtil.convert2Map(taxDeclarationValuePOS, TaxDeclarationValuePO::getEmployeeId);
List<Long> canManageTaxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
boolean isAdmin = canManageTaxAgentIds.contains(declarationPO.getTaxAgentId());
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
// 失败的数量
int errorCount = 0;
// 成功的数量
@ -381,6 +386,12 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
}
}
if (!isAdmin && !canManageEmpIds.contains(employeeId)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + "没有该部门个税操作权限,请联系管理员开通权限");
excelComments.add(errorMessageMap);
}
if (isError) {
errorCount++;
errorDatas.add(map);

View File

@ -205,6 +205,16 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
if (declareRecordPO == null) {
throw new SalaryRunTimeException("个税申报记录不存在!");
}
// 艾志个税分权
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");
if (!canManageEmpIds.contains(param.getEmployeeId())) {
throw new SalaryRunTimeException("没有该部门个税操作权限,请联系管理员开通权限");
}
}
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder().id(IdGenerator.generate()).taxDeclarationId(param.getTaxDeclarationId()).taxDeclareRecordId(taxDeclareRecordId).employeeId(param.getEmployeeId()).employeeType(param.getEmployeeType()).resultValue(param.getTaxReportColumnValues()).resultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues())).createTime(new Date()).updateTime(new Date()).source(SourceEnum.ADD.getValue()).creator((long) user.getUID()).deleteType(0).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).build();
TaxDeclarationValuePO po4log = new TaxDeclarationValuePO();
@ -391,6 +401,14 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
List<Long> extEmployeeIds = taxDeclarationValues.stream().filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())).map(TaxDeclarationValuePO::getEmployeeId).collect(Collectors.toList());
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 艾志分权
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");
if (!taxAgentIds.contains(taxDeclareRecordPO.getTaxAgentId())) {
taxDeclarationValues = taxDeclarationValues.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
// 列表数据
List<Map<String, Object>> localList = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
@ -475,7 +493,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
headerList.addAll((param.isOnlyShowDiffItem() ? finalOnlyShowColumns : columns).stream().collect(Collectors.toList()));
resultList.put("columns", headerList);
resultList.put("pageInfo", SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), oneResultList));
// 显示定制列
List<WeaTableColumn> weaColumns = new ArrayList<>();
weaColumns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(0, "工号"), "工号"));

View File

@ -5,6 +5,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclareEmployeeBO;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
@ -12,10 +13,7 @@ import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.ExtEmpService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxDeclareEmployeeService;
import com.engine.salary.service.*;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
@ -23,10 +21,7 @@ import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -56,9 +51,21 @@ public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclare
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NotDeclareByParam(queryParam);
// 艾志分权
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(queryParam.getTaxAgentId())) {
// 不是薪酬管理员
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
list = list.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@ -70,6 +77,14 @@ public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclare
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = getTaxDeclarationValueMapper().listPage4NoValueByParam(queryParam);
// 艾志分权
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(queryParam.getTaxAgentId())) {
// 不是薪酬管理员
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
list = list.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}

View File

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

View File

@ -170,7 +170,7 @@ public class TaxDeclareRecordWrapper extends Service {
* @param queryParam 列表查询条件
* @return
*/
public PageInfo listValuePage(TaxDeclarationValueListQueryParam queryParam) {
public Map<String, Object> listValuePage(TaxDeclarationValueListQueryParam queryParam) {
// 查询个税申报表
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId());
// 判断是否有权限查看
@ -197,7 +197,7 @@ public class TaxDeclareRecordWrapper extends Service {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("canOperate", canOperate);
resultMap.put("pageInfo", dtoPage);
return dtoPage;
return resultMap;
}
/**
@ -269,6 +269,14 @@ public class TaxDeclareRecordWrapper extends Service {
|| StringUtils.contains(e.getJobNum(), queryParam.getKeyword())
|| StringUtils.contains(e.getCardNum(), queryParam.getKeyword()))
.collect(Collectors.toList());
// 艾志分权
List<Long> taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
if (!taxAgentIds.contains(queryParam.getTaxAgentId())) {
// 不是薪酬管理员
Map<String, Object> authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID());
List<Long> canManageEmpIds = (List<Long>)authMap.get("canManageEmpIds");
dtos = dtos.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList());
}
PageInfo<AbnormalEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), dtos, AbnormalEmployeeListDTO.class);
return dtoPage;
}