diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java index e3a68a51f..e8ce74743 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java @@ -47,6 +47,8 @@ public class AddUpDeductionQueryParam extends BaseQueryParam { //个税扣缴义务人的主键id private Long taxAgentId; + private Collection taxAgentIds; + //部门id private List departmentIds; diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java index 604e4cf3f..da258773c 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java @@ -42,6 +42,7 @@ public class AddUpSituationQueryParam extends BaseQueryParam { //个税扣缴义务人的主键id private Long taxAgentId; + private List taxAgentIds; //部门id private List departmentIds; diff --git a/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java b/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java index c1c8c0337..b9561a2a1 100644 --- a/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java @@ -38,6 +38,7 @@ public class OtherDeductionQueryParam extends BaseQueryParam { //个税扣缴义务人的主键id private Long taxAgentId; + private Collection taxAgentIds; //部门id private List departmentIds; diff --git a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveQueryParam.java b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveQueryParam.java index 34a66caf9..375ab7049 100644 --- a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveQueryParam.java +++ b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveQueryParam.java @@ -48,4 +48,7 @@ public class SalaryArchiveQueryParam extends BaseQueryParam { private String importType; private Collection employeeIds; + + //导出模板时,是否包含数据 + private Boolean hasData; } diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java index aacf16441..4b605b77b 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobRangeBO.java @@ -3,6 +3,7 @@ package com.engine.salary.entity.salarysob.bo; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobRangePO; @@ -79,12 +80,14 @@ public class SalarySobRangeBO { public static List convert2ListDTO(List salarySobRanges, List employeeComInfos, List departmentComInfos, + List subCompanyInfos, List positionComInfos) { if (CollectionUtils.isEmpty(salarySobRanges)) { return Collections.emptyList(); } Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, DeptInfo::getId, DeptInfo::getName); + Map subCompanyComInfoMap = SalaryEntityUtil.convert2Map(subCompanyInfos, SubCompanyInfo::getId, SubCompanyInfo::getName); Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, PositionInfo::getId, PositionInfo::getName); return salarySobRanges.stream() .map(salarySobRangePO -> { @@ -98,7 +101,7 @@ public class SalarySobRangeBO { .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) .orElse(StringUtils.EMPTY)) .targetId(salarySobRangePO.getTargetId()) - .targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, positionComInfoMap)) + .targetName(buildTargetName(salarySobRangePO, employeeComInfoMap, departmentComInfoMap, subCompanyComInfoMap,positionComInfoMap)) .employeeStatus(Optional.ofNullable(salaryEmployeeStatusEnum) .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) .orElse(StringUtils.EMPTY)) @@ -119,6 +122,7 @@ public class SalarySobRangeBO { private static String buildTargetName(SalarySobRangePO salarySobRange, Map employeeComInfoMap, Map departmentComInfoMap, + Map subCompanyComInfoMap, Map positionComInfoMap) { TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(salarySobRange.getTargetType()); if (Objects.isNull(targetTypeEnum)) { @@ -129,6 +133,8 @@ public class SalarySobRangeBO { return employeeComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY); case DEPT: return departmentComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY); + case SUBCOMPANY: + return subCompanyComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY); case POSITION: return positionComInfoMap.getOrDefault(salarySobRange.getTargetId(), StringUtils.EMPTY); default: diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml index 7473f5605..741d69a11 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml @@ -134,6 +134,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -190,7 +196,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -246,7 +257,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml index 710f26c1c..60a387dff 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml @@ -153,6 +153,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -211,7 +217,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -269,7 +280,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN diff --git a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml index e3dff4518..1091f4b6a 100644 --- a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml @@ -365,6 +365,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -421,7 +427,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN @@ -477,7 +488,12 @@ AND t1.tax_agent_id = #{param.taxAgentId} - + + AND t1.tax_agent_id IN + + #{id} + + AND d.id IN diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml index 50ebe2ea8..8f0fc925a 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobRangeMapper.xml @@ -420,6 +420,12 @@ #{targetId} + + em.subcompanyid1 IN + + #{targetId} + + em.jobtitle IN diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml index 68d2bd744..4ae8b815d 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml @@ -284,7 +284,6 @@ #{item.employeeId}, #{item.taxAgentId}, #{item.employeeName}, - #{item.operator}, #{item.createTime}, #{item.updateTime}, #{item.creator}, diff --git a/src/com/engine/salary/service/TaxAgentManageRangeService.java b/src/com/engine/salary/service/TaxAgentManageRangeService.java index 88f6cf3b4..f3bd3ad21 100644 --- a/src/com/engine/salary/service/TaxAgentManageRangeService.java +++ b/src/com/engine/salary/service/TaxAgentManageRangeService.java @@ -5,7 +5,6 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.util.page.PageInfo; @@ -95,7 +94,7 @@ public interface TaxAgentManageRangeService { * * @param saveParam */ - void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam); +// void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam); /** * 根据主键id删除管理范围 diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index b2984b15e..5aa4e1209 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -61,10 +61,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return MapperProxyFactory.getProxy(AddUpDeductionMapper.class); } - private TaxAgentService getTaxAgentV2Service(User user) { + private TaxAgentService getTaxAgentService(User user) { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } - + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } @@ -89,17 +89,17 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List conditionItems = new ArrayList(); //文本输入框 - SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username"); + SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username"); username.setInputType("input"); username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - username.setFieldcol(16); //条件输入框所占宽度,默认值18 + username.setFieldcol(16); //条件输入框所占宽度,默认值18 username.setLabelcol(8); username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值 conditionItems.add(username); - SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"departmentIds","4"); + SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentIds", "4"); departmentName.setInputType("browser"); departmentName.setColSpan(2); departmentName.setFieldcol(16); @@ -110,7 +110,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction conditionItems.add(departmentName); - SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT,25034, "jobNum"); + SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT, 25034, "jobNum"); jobNum.setInputType("input"); jobNum.setColSpan(2); jobNum.setFieldcol(16); @@ -120,8 +120,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction conditionItems.add(jobNum); - - SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT,25034, "idNo"); + SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); idNo.setInputType("input"); idNo.setColSpan(2); idNo.setFieldcol(16); @@ -132,8 +131,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //日期范围选项 List dateOptions = new ArrayList(); - dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()),true));//指定日期范围(必须为6) - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate","hiredate"}); + dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) + SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); hiredate.setInputType("rangepicker"); hiredate.setFormat("yyyy-MM-dd"); hiredate.setFieldcol(16); @@ -144,7 +143,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction conditionItems.add(hiredate); - SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT,25034, "mobile"); + SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); mobile.setInputType("input"); mobile.setColSpan(2); mobile.setFieldcol(16); @@ -153,9 +152,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction mobile.setLabel("手机号"); conditionItems.add(mobile); - addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems)); + addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); - apidatas.put("condition",addGroups); + apidatas.put("condition", addGroups); return apidatas; } @@ -163,6 +162,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public Map importAddUpDeduction(AddUpDeductionImportParam importParam) { long currentEmployeeId = user.getUID(); + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); Map apidatas = new HashMap(); EmployBiz employBiz = new EmployBiz(); @@ -177,7 +177,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction String imageId = Util.null2String(importParam.getImageId()); Validate.notBlank(imageId, "imageId为空"); // 获取所有个税扣缴义务人 - Collection taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId); + Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); //个税扣缴义务人 String taxAgentId = Util.null2String(importParam.getTaxAgentId()); // 获取租户下所有的人员 @@ -289,13 +289,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 分权判断 - Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst(); - if (!optionalTaxAgentEmp.isPresent()) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); - errorData.add(errorMessageMap); - errorSum += 1; + if (openDevolution) { + Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId())).findFirst(); + if (!optionalTaxAgentEmp.isPresent()) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); + errorData.add(errorMessageMap); + errorSum += 1; + } } + // 判断是否有核算过 if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(addUpDeduction.getEmployeeId()) && f.getTaxAgentId().equals(addUpDeduction.getTaxAgentId())).findFirst(); @@ -373,7 +376,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override - public Map preview(AddUpDeductionImportParam importParam ) { + public Map preview(AddUpDeductionImportParam importParam) { Map apidatas = new HashMap(); //excel文件id String imageId = Util.null2String(importParam.getImageId()); @@ -404,51 +407,38 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); } - long employeeId = user.getUID(); + long employeeId = user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getAddUpDeductionMapper().list(queryParam); - return new PageInfo<>(list, AddUpDeductionDTO.class); - } else { - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List list = getAddUpDeductionMapper().list(queryParam); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - // 填充总数和当页数据 - // 分页参数 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionDTO.class); - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if (needAuth) { + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(AddUpDeductionDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpDeductionMapper().list(queryParam); + return new PageInfo<>(list, AddUpDeductionDTO.class); } @Override public PageInfo recordListPage(AddUpDeductionQueryParam queryParam) { long employeeId = (long) user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getAddUpDeductionMapper().recordList(queryParam); - return new PageInfo<>(list, AddUpDeductionRecordDTO.class); - } else { - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List list = getAddUpDeductionMapper().recordList(queryParam); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - // 分页参数 - // 填充总数和当页数据 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionRecordDTO.class); - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if(needAuth){ + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(AddUpDeductionRecordDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpDeductionMapper().recordList(queryParam); + return new PageInfo<>(list, AddUpDeductionRecordDTO.class); } @@ -533,9 +523,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 开启分权并且不是薪酬模块总管理员 - if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) { - List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (getTaxAgentService(user).isOpenDevolution() && !isChief) { + List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId, tenantKey); list = list.stream().filter(f -> // 作为管理员 @@ -665,9 +655,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List list = new AddUpDeductionBiz().list(param); // 开启分权并且不是薪酬模块总管理员 - if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) { - List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (getTaxAgentService(user).isOpenDevolution() && !isChief) { + List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId); list = list.stream().filter(f -> // 作为管理员 diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 954c75f6d..0017aaded 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -169,49 +169,38 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } long employeeId = user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentService(user).isOpenDevolution() || getTaxAgentService(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getAddUpSituationMapper().list(queryParam); - return new PageInfo<>(list, AddUpSituationDTO.class); - } else { + + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if(needAuth){ List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List list = getAddUpSituationMapper().list(queryParam); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - // 分页参数 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpSituationDTO.class); - // 填充总数和当页数据 - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(AddUpSituationDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpSituationMapper().list(queryParam); + return new PageInfo<>(list, AddUpSituationDTO.class); + } @Override public PageInfo recordListPage(AddUpSituationQueryParam queryParam) { long employeeId = user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentService(user).isOpenDevolution() || getTaxAgentService(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getAddUpSituationMapper().recordList(queryParam); - return new PageInfo<>(list, AddUpSituationRecordDTO.class); - } else { + + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if(needAuth){ List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List list = getAddUpSituationMapper().recordList(queryParam); - // 分页参数 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpSituationRecordDTO.class); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - // 填充总数和当页数据 - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(AddUpSituationRecordDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpSituationMapper().recordList(queryParam); + return new PageInfo<>(list, AddUpSituationRecordDTO.class); + } @Override @@ -541,6 +530,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public Map importAddUpSituation(AddUpSituationImportParam importParam) { + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + Map apidatas = new HashMap(); EmployBiz employBiz = new EmployBiz(); AddUpSituationBiz biz = new AddUpSituationBiz(); @@ -665,13 +656,16 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } // 分权判断 - Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); - if (!optionalTaxAgentEmp.isPresent()) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); - errorData.add(errorMessageMap); - errorSum += 1; + if(openDevolution){ + Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); + if (!optionalTaxAgentEmp.isPresent()) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); + errorData.add(errorMessageMap); + errorSum += 1; + } } + // 判断是否有核算过 if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst(); diff --git a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java index 98c28d7f0..d66cb2356 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java @@ -422,6 +422,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa log.error("获取考勤数据错误失败:{}", String.format("参数:%s,错误信息:%s", JSONObject.toJSONString(attend4Salary), e.getMessage())); return attendQuoteSyncData; } + log.info("同步的考勤数据:{}", JSONUtils.toJSONString(attendQuoteSyncData)); return attendQuoteSyncData; } diff --git a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java index 4139202c9..19ac2acad 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java @@ -60,20 +60,26 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic @Override public PageInfo listPage(AttendQuoteQueryParam queryParam) { + + List declareMonth = queryParam.getSalaryYearMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + + long currentEmployeeId = user.getUID(); - - Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); if (needAuth) { List salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO); Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); + if (CollectionUtils.isEmpty(salarySobIds)) { + return new PageInfo<>(AttendQuoteListDTO.class); + } queryParam.setSalarySobIds(salarySobIds); } SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAttendQuoteMapper().list(queryParam); - - return new PageInfo<>(list, AttendQuoteListDTO.class); } diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 8fe92a2c7..79fd0b6a0 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -11,7 +11,6 @@ import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; -import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; @@ -53,13 +52,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction private OtherDeductionMapper getOtherDeductionMapper() { return MapperProxyFactory.getProxy(OtherDeductionMapper.class); } - - private TaxAgentService getTaxAgentV2Service(User user) { + + private TaxAgentService getTaxAgentService(User user) { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private AddUpDeductionService getAddUpDeductionService(User user) { return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user); } + private SalaryEmployeeService getSalaryEmployeeService(User user) { return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } @@ -79,54 +80,35 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } long employeeId = user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getOtherDeductionMapper().list(queryParam); - return new PageInfo<>(list, OtherDeductionListDTO.class); - } else { - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List list = getOtherDeductionMapper().list(queryParam); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - - // 分页参数 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionListDTO.class); - // 填充总数和当页数据 - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if (needAuth) { + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(OtherDeductionListDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getOtherDeductionMapper().list(queryParam); + return new PageInfo<>(list, OtherDeductionListDTO.class); } @Override public PageInfo recordListPage(OtherDeductionQueryParam queryParam) { long employeeId = user.getUID(); - // 未开启分权或是薪酬模块总管理员 - if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = getOtherDeductionMapper().recordList(queryParam); - return new PageInfo<>(list, OtherDeductionRecordDTO.class); - } else { - List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); -// List lastList = getLastListByModifier(employeeId, tenantKey); - List list = getOtherDeductionMapper().recordList(queryParam); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - // 分页参数 - PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionRecordDTO.class); - // 填充总数和当页数据 - dtoPage.setTotal(list.size()); - dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); - return dtoPage; + Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); + if (needAuth) { + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { + return new PageInfo<>(OtherDeductionRecordDTO.class); + } + queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getOtherDeductionMapper().recordList(queryParam); + return new PageInfo<>(list, OtherDeductionRecordDTO.class); } @@ -151,6 +133,9 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction public Map importData(OtherDeductionImportParam importParam) { + + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + long currentEmployeeId = user.getUID(); Map apidatas = new HashMap(); EmployBiz employBiz = new EmployBiz(); @@ -180,7 +165,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction //人员信息 List employees = employBiz.listEmployee(); // 获取所有个税扣缴义务人 - Collection taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId); + Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); //税款所属期 Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01"); // 获取已经核算的数据 @@ -304,13 +289,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction // 分权判断 - OtherDeductionPO finalPoE = po; - Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst(); - if (!optionalTaxAgentEmp.isPresent()) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); - errorData.add(errorMessageMap); - errorSum += 1; + if (openDevolution) { + OtherDeductionPO finalPoE = po; + Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst(); + if (!optionalTaxAgentEmp.isPresent()) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); + errorData.add(errorMessageMap); + errorSum += 1; + } } // 判断是否有核算过 if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { @@ -378,7 +365,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction List> rowList = getExcelRowList(param); //获取excel - return ExcelUtil.genWorkbook(rowList,"其他免税扣除"); + return ExcelUtil.genWorkbook(rowList, "其他免税扣除"); } @@ -394,8 +381,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction List list = getOtherDeductionMapper().list(param); // 开启分权并且不是薪酬模块总管理员 - if (getTaxAgentV2Service(user).isOpenDevolution() && !getTaxAgentV2Service(user).isChief(employeeId)) { - List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) { + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); list = list.stream().filter(f -> // 作为管理员 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) @@ -429,7 +416,6 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } - /** * 导出详情列表 * @@ -469,7 +455,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction List> rowList = getExcelRowDetailList(param); //获取excel - return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细"); + return ExcelUtil.genWorkbook(rowList, "其他免税扣除明细"); } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 6adb432f0..a18266066 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -310,6 +310,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe @Override public XSSFWorkbook downloadTemplate(SalaryArchiveImportTypeEnum salaryArchiveImportTypeEnum, SalaryArchiveQueryParam queryParam) { + long employeeId = user.getUID(); boolean isInit = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.INIT.getValue()); boolean isTaxAgentAdjust = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.TAXAGENTADJUST.getValue()); boolean isSalaryItemAdjust = salaryArchiveImportTypeEnum.getValue().equals(SalaryArchiveImportTypeEnum.SALARYITEMADJUST.getValue()); @@ -347,34 +348,38 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe header.add(salaryItem.getName()); } } - - // 获取所有个税扣缴义务人 - Collection taxAgentList = getTaxAgentService(user).listAll(); - List salaryArchives = list(queryParam); - List> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); // 组装数据 List> rows = new ArrayList<>(); rows.add(header); - listMaps.forEach(e -> { - List row = new ArrayList<>(); - row.add(e.get("username").toString()); - row.add(e.get("taxAgentName").toString()); - if (isTaxAgentAdjust || isSalaryItemAdjust) { - row.add(isTaxAgentAdjust ? e.get("taxAgentEffectiveTime") : ""); - } - row.add(""); - row.add(e.get("departmentName").toString()); - row.add(e.get("mobile") == null ? "" : e.get("mobile").toString()); - row.add(e.get("employeeStatus").toString()); - // 调薪 - if (isInit || isSalaryItemAdjust) { - // 薪资项目数据 - for (SalaryItemPO salaryItem : salaryItems) { - row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : ""); + + //模板是否含数据 + if (queryParam.getHasData() != null && queryParam.getHasData()) { + // 获取所有个税扣缴义务人 + Collection taxAgentList = getTaxAgentService(user).listAll(); + List salaryArchives = list(queryParam); + List> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); + listMaps.forEach(e -> { + List row = new ArrayList<>(); + row.add(e.get("username").toString()); + row.add(e.get("taxAgentName").toString()); + if (isTaxAgentAdjust || isSalaryItemAdjust) { + row.add(isTaxAgentAdjust ? e.get("taxAgentEffectiveTime") : ""); } - } - rows.add(row); - }); + row.add(""); + row.add(e.get("departmentName").toString()); + row.add(e.get("mobile") == null ? "" : e.get("mobile").toString()); + row.add(e.get("employeeStatus").toString()); + // 调薪 + if (isInit || isSalaryItemAdjust) { + // 薪资项目数据 + for (SalaryItemPO salaryItem : salaryItems) { + row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : ""); + } + } + rows.add(row); + }); + } + // 3.表数据 // 4.注释 List excelComments = Lists.newArrayList(); @@ -958,7 +963,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe errorMessageMap.put("message", rowindex + "个税扣缴义务人不存在"); excelComments.add(errorMessageMap); isError = true; - }else if(!taxAgents.contains(taxAgentId)){ + } else if (!taxAgents.contains(taxAgentId)) { Map errorMessageMap = Maps.newHashMap(); errorMessageMap.put("message", rowindex + "没有该个税扣缴义务人的权限"); excelComments.add(errorMessageMap); diff --git a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java index 9257c5eb7..b6e27f2f4 100644 --- a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java @@ -8,6 +8,7 @@ import com.engine.salary.biz.SalarySobRangeBiz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO; import com.engine.salary.entity.salarysob.bo.SalarySobRangeSaveBO; import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO; @@ -89,6 +90,15 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange }) .collect(Collectors.toList()); + // 查询分部信息 + List subCompanyInfos = salarySobRangePOS.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())) + .map(SalarySobRangePO::getTargetId) + .map(id -> { + return SubCompanyInfo.builder().id(id).name(orgBiz.getSubcompanyShow(String.valueOf(id), "0", "-")).build(); + }) + .collect(Collectors.toList()); + // 查询岗位信息 List positionIds = salarySobRangePOS.stream() @@ -98,7 +108,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange List positionInfos = employBiz.listPositionInfo(positionIds); // 薪资账套的人员范围po转换成列表dto - List salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos, positionInfos); + List salarySobRangeListDTOS = SalarySobRangeBO.convert2ListDTO(salarySobRangePOS, empInfos, deptInfos,subCompanyInfos, positionInfos); // 根据对象名称过滤 if (StringUtils.isNotEmpty(queryParam.getTargetName())) { salarySobRangeListDTOS = salarySobRangeListDTOS.stream() diff --git a/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java index 03627d015..35d76fc5b 100644 --- a/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java @@ -5,6 +5,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO; import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; import com.engine.salary.mapper.taxagent.TaxAgentEmpChangeMapper; import com.engine.salary.service.TaxAgentEmpChangeService; +import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections4.CollectionUtils; import javax.annotation.Resource; @@ -22,16 +23,19 @@ import java.util.List; public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmpChangeService { @Resource - private TaxAgentEmpChangeMapper taxAgentEmpChangeMapper; + private TaxAgentEmpChangeMapper getTaxAgentEmpChangeMapper() { + return MapperProxyFactory.getProxy(TaxAgentEmpChangeMapper.class); + } + @Override public List listAll() { - return taxAgentEmpChangeMapper.listAll(); + return getTaxAgentEmpChangeMapper().listAll(); } @Override public List listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum) { - return taxAgentEmpChangeMapper.listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build()); + return getTaxAgentEmpChangeMapper().listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build()); } @Override @@ -39,12 +43,12 @@ public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmp if (CollectionUtils.isEmpty(ids)) { return Boolean.FALSE; } - taxAgentEmpChangeMapper.deleteByIds(ids); + getTaxAgentEmpChangeMapper().deleteByIds(ids); return Boolean.TRUE; } @Override public void batchInsert(List taxAgentEmpChangeList) { - taxAgentEmpChangeMapper.batchInsert(taxAgentEmpChangeList); + getTaxAgentEmpChangeMapper().batchInsert(taxAgentEmpChangeList); } } diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index afb073e51..c8b961978 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -14,7 +14,6 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.engine.salary.entity.taxagent.param.*; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; @@ -34,10 +33,11 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; -import org.springframework.transaction.annotation.Transactional; import weaver.hrm.User; import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.stream.Collectors; /** @@ -51,6 +51,9 @@ import java.util.stream.Collectors; @Slf4j public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentManageRangeService { + private static final ExecutorService taskExecutor = Executors.newFixedThreadPool(5); + + private TaxAgentManageRangeMapper getTaxAgentManageRangeMapper() { return MapperProxyFactory.getProxy(TaxAgentManageRangeMapper.class); } @@ -60,20 +63,13 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } private TaxAgentSubAdminService taxAgentSubAdminService; -// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) { -// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user); -// } private TaxAgentEmpService getTaxAgentEmpService(User user) { return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user); } private TaxAgentSubAdminEmpService taxAgentSubAdminEmployeeService; -// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) { -// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user); -// } -// private ComInfoCache comInfoCache; private EmployMapper getEmployMapper() { return MapperProxyFactory.getProxy(EmployMapper.class); @@ -387,14 +383,15 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges) { - new Thread() { - public void run() { - try { - syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); - } finally { - } - } - }.start(); + log.info("开始同步人员step1"); + taskExecutor.execute(() -> { + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); + }); +// new Thread() { +// public void run() { +// syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); +// } +// }.start(); } /** @@ -411,79 +408,78 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } - @Override - @Transactional(rollbackFor = Exception.class) - public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) { - // 查询薪资账套 - TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId()); - if (Objects.isNull(taxAgentSubAdmin)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除")); - } - // 查询已有的管理范围 - List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId()); - List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); - // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID()); - - // 当前库中所有分管理员的管理范围 - List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); - /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */ - // 当前分管理员的范围 - List allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges); - // 其他分管理员的范围 - List otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList()); - allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges()); - allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); - - // 当前分管理员的所有人员 - List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); - // 其他分管理员的所有人员 - List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); - for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) { - Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); - if (optionalSe.isPresent()) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员")); - } - } - /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */ - - /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */ - // 所属个税扣缴义务人的所有分管理员的管理范围 - List allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist); - allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges()); - allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges()); - // 去重 - allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( - Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) - ), ArrayList::new)); - // 所属个税扣缴义务人的所有人员 - List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); - // 所有分管理员的所有人员 - List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); - List allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); - allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); - if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围")); - } - /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */ - - // 保存 - if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { - result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range)); -// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); - } - if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { - result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range)); -// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); - } - /** 同步本地人员范围的关联人员=========================== */ - List finalAllSubAdminRanges = allSubAdminRanges; - - syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges); - // 记录日志 todo - } - +// @Override +// @Transactional(rollbackFor = Exception.class) +// public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) { +// // 查询薪资账套 +// TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId()); +// if (Objects.isNull(taxAgentSubAdmin)) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除")); +// } +// // 查询已有的管理范围 +// List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId()); +// List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); +// // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) +// TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID()); +// +// // 当前库中所有分管理员的管理范围 +// List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); +// /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */ +// // 当前分管理员的范围 +// List allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges); +// // 其他分管理员的范围 +// List otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList()); +// allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges()); +// allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); +// +// // 当前分管理员的所有人员 +// List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); +// // 其他分管理员的所有人员 +// List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); +// for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) { +// Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); +// if (optionalSe.isPresent()) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员")); +// } +// } +// /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */ +// +// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */ +// // 所属个税扣缴义务人的所有分管理员的管理范围 +// List allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist); +// allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges()); +// allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges()); +// // 去重 +// allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( +// Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) +// ), ArrayList::new)); +// // 所属个税扣缴义务人的所有人员 +// List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); +// List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); +// // 所有分管理员的所有人员 +// List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); +// List allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); +// allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); +// if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围")); +// } +// /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */ +// +// // 保存 +// if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { +// result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range)); +//// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); +// } +// if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { +// result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range)); +//// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); +// } +// /** 同步本地人员范围的关联人员=========================== */ +// List finalAllSubAdminRanges = allSubAdminRanges; +// +// syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges); +// // 记录日志 todo +// } /** @@ -649,12 +645,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @param employeeId */ private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges, Long employeeId) { - List taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); - // 同步个税扣缴义务人的人员 - getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); + log.info("同步个税扣缴人员范围"); + try { + List taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); + // 同步个税扣缴义务人的人员 + getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); // List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges); - // 同步分管理员的人员 + // 同步分管理员的人员 // taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); + } catch (Exception e) { + log.error("同步个税扣缴人员范围异常", e); + } } } diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index fb9ed8e9a..55b587f9b 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -168,7 +168,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { @Override public Boolean isDefaultOpen(Long currentEmployeeId) { - return true; + return getTaxAgentBaseService(user).isOpenDevolution(); // return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); } diff --git a/src/com/engine/salary/util/ResponseResult.java b/src/com/engine/salary/util/ResponseResult.java index 59ec1f6ef..28c61e412 100644 --- a/src/com/engine/salary/util/ResponseResult.java +++ b/src/com/engine/salary/util/ResponseResult.java @@ -14,7 +14,6 @@ import weaver.general.BaseBean; import weaver.hrm.User; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.function.Consumer; import java.util.function.Function; @@ -26,55 +25,17 @@ public class ResponseResult { private static final long serialVersionUID = 1L; private final User user; - private boolean permission = true; private final HrmCommonService hrmCommonService = new HrmCommonServiceImpl(); private final BaseBean baseBean = new BaseBean(); private final Boolean isLog = "ture".equals(baseBean.getPropValue("hrmSalary", "log")); - private final String salaryAdminRoleId = baseBean.getPropValue("hrmSalary", "salaryAdminRoleId"); - private final Boolean isPermission = "true".equals(baseBean.getPropValue("hrmSalary", "isPermission")); public ResponseResult(User user) { this.user = user; } - public ResponseResult(User user, boolean permission) { - this.user = user; - this.permission = permission; - } - - private void permission() { - if (isPermission && permission) { - if (user == null) { - throw new SalaryRunTimeException("获取登录人员信息失败"); - } - List roleInfo = hrmCommonService.getRoleInfo(user.getUID()); - roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && m.get("roleid").toString().equals(salaryAdminRoleId)).findFirst().orElseThrow(() -> new SalaryRunTimeException("无权限")); - } - } - - /** - * 成功返回 - */ - private static String Ok(Map map) { - Map apidatas = new HashMap<>(); - apidatas.put("status", true); - apidatas.put("data", map); - return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); - } - - /** - * 失败返回 - */ - private static String Error(String message) { - Map apidatas = new HashMap<>(); - apidatas.put("status", false); - apidatas.put("errormsg", message); - return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); - } - /** * 统一返回方法 @@ -84,7 +45,6 @@ public class ResponseResult { if (isLog) { log.info("run salary api , param {}", t); } - permission(); return Ok(f.apply(t)); } catch (SalaryRunTimeException e) { return Error(e.getMessage()); @@ -106,7 +66,6 @@ public class ResponseResult { if (isLog) { log.info("run salary api , param {}", t); } - permission(); f.accept(t); return Ok(); } catch (SalaryRunTimeException e) { @@ -130,7 +89,6 @@ public class ResponseResult { if (isLog) { log.info("run salary api"); } - permission(); return Ok(f.get()); } catch (SalaryRunTimeException e) { return Error(e.getMessage()); @@ -151,7 +109,11 @@ public class ResponseResult { Map apidatas = new HashMap<>(); apidatas.put("status", true); apidatas.put("data", r); - return getJsonString(apidatas); + String success = getJsonString(apidatas); + if (isLog) { + log.info("run salary api success return {}", success); + } + return success; } private static String getJsonString(Object apidatas) { @@ -174,4 +136,16 @@ public class ResponseResult { return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); } + + /** + * 失败返回 + */ + private static String Error(String message) { + Map apidatas = new HashMap<>(); + apidatas.put("status", false); + apidatas.put("errormsg", message); + return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); + } + + } diff --git a/src/com/engine/salary/web/SalaryBillController.java b/src/com/engine/salary/web/SalaryBillController.java index 60faa23fb..8c25ac5e0 100644 --- a/src/com/engine/salary/web/SalaryBillController.java +++ b/src/com/engine/salary/web/SalaryBillController.java @@ -433,7 +433,7 @@ public class SalaryBillController { // throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN); // } // queryParam.setEmployeeId((long) user.getUID()); - return new ResponseResult>(user, false).run(getSalarySendWrapper(user)::mySalaryBillList, queryParam); + return new ResponseResult>(user).run(getSalarySendWrapper(user)::mySalaryBillList, queryParam); } /** @@ -450,7 +450,7 @@ public class SalaryBillController { // throw new SalaryRunTimeException(SalrayCheckSecondAuthConstant.CHECK_SECOND_FAIL_NO_TOKEN); // } User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user, false).run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId); + return new ResponseResult>(user).run(getSalarySendWrapper(user)::mySalaryBill, salaryInfoId); } /******** 工资单发放 end ***********************************************************************************************/ diff --git a/src/com/engine/salary/wrapper/AttendQuoteWrapper.java b/src/com/engine/salary/wrapper/AttendQuoteWrapper.java index ac3f58e95..95da9ddc7 100644 --- a/src/com/engine/salary/wrapper/AttendQuoteWrapper.java +++ b/src/com/engine/salary/wrapper/AttendQuoteWrapper.java @@ -54,17 +54,14 @@ public class AttendQuoteWrapper extends Service { * @return */ public PageInfo list(AttendQuoteQueryParam queryParam) { - List declareMonth = queryParam.getSalaryYearMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - PageInfo page = getAttendQuoteService(user).listPage(queryParam); List list = page.getList(); - list.forEach(m -> m.setSourceType(AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getSourceType())))); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(m -> m.setSourceType(AttendQuoteSourceTypeEnum.getDefaultLabelByValue(Integer.valueOf(m.getSourceType())))); + page.setList(list); + } - page.setList(list); return page; } @@ -102,7 +99,6 @@ public class AttendQuoteWrapper extends Service { /** * 检查是否可以操作 * - * * @return */ public Boolean checkOperation(AttendQuoteCheckOperationParam checkOperationParam) { diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index c80abacc0..ee6e37f05 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -87,21 +87,27 @@ public class SalarySendWrapper extends Service { //分权,获取当前人员管理的账套 Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); - if(needAuth){ + List list = new ArrayList<>(); + if (needAuth) { List salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO); Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); - queryParam.setSalarySobIds(salarySobIds); + if (CollectionUtils.isNotEmpty(salarySobIds)) { + queryParam.setSalarySobIds(salarySobIds); + SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + list = salarySendMapper.list(queryParam); + } + } else { + SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + list = salarySendMapper.list(queryParam); } - - SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); - SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = salarySendMapper.list(queryParam); PageInfo pageInfo = new PageInfo<>(list, SalarySendListDTO.class); List pageList = pageInfo.getList(); List salarySobIds = pageList.stream().map(SalarySendListDTO::getSalarySobId).distinct().collect(Collectors.toList()); // 获取默认模板 - if(salarySobIds.size() > 0) { + if (salarySobIds.size() > 0) { List salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(salarySobIds); pageList.forEach(e -> { // 已发放 @@ -134,9 +140,9 @@ public class SalarySendWrapper extends Service { datas.put("pageInfo", pageInfo); datas.put("datas", pageList); datas.put("columns", columns); - datas.put("dataKey",result.getResultMap()); + datas.put("dataKey", result.getResultMap()); return datas; - }catch(Exception e) { + } catch (Exception e) { throw new SalaryRunTimeException(e.getMessage()); } finally { sqlSession.close(); @@ -145,17 +151,18 @@ public class SalarySendWrapper extends Service { /** * 创建表展示字段 + * * @return */ private List buildWeaTableColumns() { List list = new ArrayList<>(); WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id"); idColumn.setDisplay(WeaBoolAttr.FALSE); - list.add(new WeaTableColumn("10%","薪资所属月", "salaryYearMonth")); - list.add(new WeaTableColumn("35%","薪资账套", "salarySob")); - list.add(new WeaTableColumn("25%","工资单模板", "template")); - list.add(new WeaTableColumn("15%","已发放", "sendSituation")); - list.add(new WeaTableColumn("15%","最后发送时间", "lastSendTime")); + list.add(new WeaTableColumn("10%", "薪资所属月", "salaryYearMonth")); + list.add(new WeaTableColumn("35%", "薪资账套", "salarySob")); + list.add(new WeaTableColumn("25%", "工资单模板", "template")); + list.add(new WeaTableColumn("15%", "已发放", "sendSituation")); + list.add(new WeaTableColumn("15%", "最后发送时间", "lastSendTime")); return list; } @@ -183,9 +190,9 @@ public class SalarySendWrapper extends Service { List conditionItems = new ArrayList(); //文本输入框 - SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username"); + SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username"); username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - username.setFieldcol(16); //条件输入框所占宽度,默认值18 + username.setFieldcol(16); //条件输入框所占宽度,默认值18 username.setLabelcol(8); username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值 @@ -193,9 +200,9 @@ public class SalarySendWrapper extends Service { conditionItems.add(username); // 个税扣缴义务人 - SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent"); + SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); taxAgent.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 + taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 taxAgent.setLabelcol(8); List searchConditionOptions = new ArrayList<>(); Collection taxAgentLists = getTaxAgentService(user).findAll(); @@ -207,7 +214,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(taxAgent); // 部门 - SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"department","4"); + SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "department", "4"); departmentName.setColSpan(2); departmentName.setFieldcol(16); departmentName.setLabelcol(8); @@ -218,7 +225,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(departmentName); // 岗位 - SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER,502227,"position","24"); + SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "position", "24"); position.setColSpan(2); position.setFieldcol(16); position.setLabelcol(8); @@ -229,9 +236,9 @@ public class SalarySendWrapper extends Service { conditionItems.add(position); //状态 - SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent"); + SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); status.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - status.setFieldcol(16); //条件输入框所占宽度,默认值18 + status.setFieldcol(16); //条件输入框所占宽度,默认值18 status.setLabelcol(8); List userStatusOptions = new ArrayList<>(); UserStatusEnum.getList().forEach(e -> userStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content")))); @@ -244,11 +251,11 @@ public class SalarySendWrapper extends Service { //入职日期 SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 + hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 hiredate.setLabelcol(8); hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 Map otherParams1 = new HashMap(); - otherParams1.put("format","yyyy-MM-dd"); + otherParams1.put("format", "yyyy-MM-dd"); hiredate.setOtherParams(otherParams1); hiredate.setInputType("day"); hiredate.setMode("day"); @@ -258,7 +265,7 @@ public class SalarySendWrapper extends Service { //发送状态 SearchConditionItem sendStatus = conditionFactory.createCondition(ConditionType.SELECT, 25034, "sendStatus"); sendStatus.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - sendStatus.setFieldcol(16); //条件输入框所占宽度,默认值18 + sendStatus.setFieldcol(16); //条件输入框所占宽度,默认值18 sendStatus.setLabelcol(8); List sendStatusOptions = new ArrayList<>(); UserStatusEnum.getList().forEach(e -> sendStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content")))); @@ -268,9 +275,9 @@ public class SalarySendWrapper extends Service { sendStatus.setLabel("发送状态"); //设置文本值 这个将覆盖多语言标签的值 conditionItems.add(sendStatus); - addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems)); + addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); - apidatas.put("condition",addGroups); + apidatas.put("condition", addGroups); return apidatas; } @@ -316,28 +323,29 @@ public class SalarySendWrapper extends Service { result.success(); datas.put("pageInfo", pageInfo); - datas.put("datas",list); - datas.put("columns",columns); - datas.put("dataKey",result.getResultMap()); + datas.put("datas", list); + datas.put("columns", columns); + datas.put("dataKey", result.getResultMap()); return datas; } /** * 工资单信息列表 + * * @return */ private List buildInfoListWeaTableColumns() { List list = new ArrayList<>(); WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id"); idColumn.setDisplay(WeaBoolAttr.TRUE); - list.add(new WeaTableColumn("20%","姓名", "username")); - list.add(new WeaTableColumn("20%","个税扣缴义务人", "taxAgent")); - list.add(new WeaTableColumn("20%","部门", "department")); - list.add(new WeaTableColumn("20%","手机号", "mobile")); - list.add(new WeaTableColumn("20%","工号", "jobNum")); - list.add(new WeaTableColumn("20%","发送状态", "sendStatus")); - list.add(new WeaTableColumn("20%","操作", "operation")); + list.add(new WeaTableColumn("20%", "姓名", "username")); + list.add(new WeaTableColumn("20%", "个税扣缴义务人", "taxAgent")); + list.add(new WeaTableColumn("20%", "部门", "department")); + list.add(new WeaTableColumn("20%", "手机号", "mobile")); + list.add(new WeaTableColumn("20%", "工号", "jobNum")); + list.add(new WeaTableColumn("20%", "发送状态", "sendStatus")); + list.add(new WeaTableColumn("20%", "操作", "operation")); return list; } @@ -386,9 +394,9 @@ public class SalarySendWrapper extends Service { List conditionItems = new ArrayList(); //文本输入框 - SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username"); + SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username"); username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - username.setFieldcol(16); //条件输入框所占宽度,默认值18 + username.setFieldcol(16); //条件输入框所占宽度,默认值18 username.setLabelcol(8); username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值 @@ -396,9 +404,9 @@ public class SalarySendWrapper extends Service { conditionItems.add(username); // 个税扣缴义务人 - SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent"); + SearchConditionItem taxAgent = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); taxAgent.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 + taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 taxAgent.setLabelcol(8); List searchConditionOptions = new ArrayList<>(); Collection taxAgentLists = getTaxAgentService(user).findAll(); @@ -410,7 +418,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(taxAgent); // 部门 - SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"department","4"); + SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "department", "4"); departmentName.setColSpan(2); departmentName.setFieldcol(16); departmentName.setLabelcol(8); @@ -421,7 +429,7 @@ public class SalarySendWrapper extends Service { conditionItems.add(departmentName); // 岗位 - SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER,502227,"position","24"); + SearchConditionItem position = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "position", "24"); position.setColSpan(2); position.setFieldcol(16); position.setInputType(""); @@ -432,9 +440,9 @@ public class SalarySendWrapper extends Service { conditionItems.add(position); //状态 - SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT,25034, "taxAgent"); + SearchConditionItem status = conditionFactory.createCondition(ConditionType.SELECT, 25034, "taxAgent"); status.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - status.setFieldcol(16); //条件输入框所占宽度,默认值18 + status.setFieldcol(16); //条件输入框所占宽度,默认值18 status.setLabelcol(8); List userStatusOptions = new ArrayList<>(); UserStatusEnum.getList().forEach(e -> userStatusOptions.add(new SearchConditionOption(e.get("id"), e.get("content")))); @@ -447,11 +455,11 @@ public class SalarySendWrapper extends Service { //入职日期 SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 25034, "hiredate"); hiredate.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 + hiredate.setFieldcol(16); //条件输入框所占宽度,默认值18 hiredate.setLabelcol(8); hiredate.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 Map otherParams1 = new HashMap(); - otherParams1.put("format","yyyy-MM-dd"); + otherParams1.put("format", "yyyy-MM-dd"); hiredate.setOtherParams(otherParams1); hiredate.setInputType("day"); hiredate.setMode("day"); @@ -461,16 +469,16 @@ public class SalarySendWrapper extends Service { //合并计税 SearchConditionItem mergeCountTax = conditionFactory.createCondition(ConditionType.CHECKBOX, 25034, "mergeCountTax"); mergeCountTax.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - mergeCountTax.setFieldcol(16); //条件输入框所占宽度,默认值18 + mergeCountTax.setFieldcol(16); //条件输入框所占宽度,默认值18 mergeCountTax.setLabelcol(8); mergeCountTax.setInputType("switch"); mergeCountTax.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 mergeCountTax.setLabel("合并计税"); //设置文本值 这个将覆盖多语言标签的值 conditionItems.add(mergeCountTax); - addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems)); + addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); - apidatas.put("condition",addGroups); + apidatas.put("condition", addGroups); return apidatas; } @@ -534,8 +542,8 @@ public class SalarySendWrapper extends Service { datas.put("pageInfo", pageInfo); datas.put("datas", listMaps); - datas.put("columns",columns); - datas.put("dataKey",result.getResultMap()); + datas.put("columns", columns); + datas.put("dataKey", result.getResultMap()); return datas; } @@ -544,11 +552,11 @@ public class SalarySendWrapper extends Service { List list = new ArrayList<>(); WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id"); idColumn.setDisplay(WeaBoolAttr.TRUE); - list.add(new WeaTableColumn("100px","姓名", "username")); - list.add(new WeaTableColumn("100px","个税扣缴义务人", "taxAgent")); - list.add(new WeaTableColumn("100px","部门", "department")); - list.add(new WeaTableColumn("100px","手机号", "mobile")); - list.add(new WeaTableColumn("100px","工号", "jobNum")); + list.add(new WeaTableColumn("100px", "姓名", "username")); + list.add(new WeaTableColumn("100px", "个税扣缴义务人", "taxAgent")); + list.add(new WeaTableColumn("100px", "部门", "department")); + list.add(new WeaTableColumn("100px", "手机号", "mobile")); + list.add(new WeaTableColumn("100px", "工号", "jobNum")); return list; } @@ -578,7 +586,7 @@ public class SalarySendWrapper extends Service { */ public Map mySalaryBillList(SalaryBillQueryParam queryParam) { Map datas = new HashMap<>(); - queryParam.setEmployeeId((long)user.getUID()); + queryParam.setEmployeeId((long) user.getUID()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); queryParam.setSalaryMonth( queryParam.getSalaryYearMonth().stream().map(e -> { @@ -613,8 +621,8 @@ public class SalarySendWrapper extends Service { datas.put("pageInfo", pageInfo); datas.put("datas", records); - datas.put("columns",columns); - datas.put("dataKey",result.getResultMap()); + datas.put("columns", columns); + datas.put("dataKey", result.getResultMap()); return datas; } @@ -623,14 +631,13 @@ public class SalarySendWrapper extends Service { List list = new ArrayList<>(); WeaTableColumn idColumn = new WeaTableColumn("0px", "id", "id"); idColumn.setDisplay(WeaBoolAttr.TRUE); - list.add(new WeaTableColumn("20%","薪资所属月", "salaryYearMonth")); - list.add(new WeaTableColumn("40%","个税扣缴义务人", "taxAgent")); - list.add(new WeaTableColumn("40%","发放时间", "sendTime")); + list.add(new WeaTableColumn("20%", "薪资所属月", "salaryYearMonth")); + list.add(new WeaTableColumn("40%", "个税扣缴义务人", "taxAgent")); + list.add(new WeaTableColumn("40%", "发放时间", "sendTime")); return list; } - /** * 我的工资单 * diff --git a/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java index b057c06bb..b9025ead9 100644 --- a/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java @@ -153,10 +153,10 @@ public class TaxAgentSubAdminWrapper extends Service { * @param saveParam * @return */ - public String saveRange(TaxAgentSubAdminRangeSaveParam saveParam) { - taxAgentManageRangeService.save4SubAdmin(saveParam); - return StringUtils.EMPTY; - } +// public String saveRange(TaxAgentSubAdminRangeSaveParam saveParam) { +// taxAgentManageRangeService.save4SubAdmin(saveParam); +// return StringUtils.EMPTY; +// } /** * 删除管理范围 diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index 2b5ce7a31..0985c84eb 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -89,9 +89,11 @@ public class TaxAgentWrapper extends Service { Boolean isChief = isChief(currentEmployeeId); Boolean isDefaultOpen = getTaxAgentService(user).isDefaultOpen(currentEmployeeId); Boolean isAdminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId); + Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution(); resultMap.put("isChief", isChief); resultMap.put("isDefaultOpen", isDefaultOpen); resultMap.put("isAdminEnable", isAdminEnable); + resultMap.put("isOpenDevolution", isOpenDevolution); return resultMap; }