薪资明细数据分权、薪资明细模板分权
This commit is contained in:
parent
d30fcf3929
commit
dd398775e6
|
|
@ -39,6 +39,7 @@ import com.wbi.util.Util;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -312,9 +313,10 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
|
|||
if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) {
|
||||
taxAgentIds = taxAgentIds.stream().filter(queryParam.getTaxAgentIds()::contains).collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
return new PageInfo<>();
|
||||
}
|
||||
|
||||
// if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
// return new PageInfo<>();
|
||||
// }
|
||||
|
||||
// 2.年月参数处理,注意:薪资所属月居然是用字符串存储的,无法通过sql between处理
|
||||
List<Date> dataParam = new ArrayList<>();
|
||||
|
|
@ -330,8 +332,22 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
|
|||
.collect(Collectors.toSet());
|
||||
|
||||
// 查询薪资核算人员
|
||||
SalaryAcctEmployeeQueryParam salaryAcctEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder().salaryMonths(salaryMonths).taxAgentIds(taxAgentIds).build();
|
||||
SalaryAcctEmployeeQueryParam salaryAcctEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder().salaryMonths(salaryMonths).build();
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = getSalaryAcctEmployeeService(user).listByParam(salaryAcctEmployeeQueryParam);
|
||||
// 艾志分权,义务人管理员能看到对应义务人下数据,建模配置权限 合集
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("select bm from uf_xzmxryqx where ry = " + user.getUID());
|
||||
List<Long> bmIdList = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Long bmId = SalaryEntityUtil.string2Long(rs.getString("bm"));
|
||||
if (bmId != null) {
|
||||
bmIdList.add(bmId);
|
||||
}
|
||||
}
|
||||
// List<Long> empIdList= getSalaryEmployeeService(user).listEmpIdByDepId(bmIdList);
|
||||
List<Long> finalTaxAgentIds = taxAgentIds;
|
||||
salaryAcctEmployeeList = salaryAcctEmployeeList.stream().filter(acctEmployee -> finalTaxAgentIds.contains(acctEmployee.getTaxAgentId()) || bmIdList.contains(acctEmployee.getDepartmentId())).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(queryParam.getSubCompanyIds()) || CollectionUtils.isNotEmpty(queryParam.getDepartmentIds()) || StringUtils.isNotBlank(queryParam.getKeyword())) {
|
||||
// 根据分部、部门筛选
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listBySubCompanyOrDepartment(queryParam.getSubCompanyIds(), queryParam.getDepartmentIds());
|
||||
|
|
|
|||
|
|
@ -228,6 +228,8 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
return resultMap;
|
||||
}
|
||||
queryParam.setExport(true);
|
||||
// 获取模板
|
||||
List<PageListTemplatePO> pageListTemplates = getSettingService(user).getPageListTemplates(PageListTemplateQueryParam.builder().page(SALARY_DETAILS_REPORT.getValue()).build());
|
||||
// 获取发薪人员
|
||||
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
|
||||
List<SalaryAcctEmployeePO> employeePOS = salaryAcctEmployeePageInfo.getList();
|
||||
|
|
|
|||
|
|
@ -652,7 +652,15 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
|
|||
|
||||
@Override
|
||||
public List<Long> listEmpIdByDepId(List<Long> departmentIds) {
|
||||
return employBiz.listEmpIdByDepId(departmentIds);
|
||||
if (CollectionUtils.isEmpty(departmentIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<List<Long>> partition = Lists.partition(departmentIds, 500);
|
||||
List<Long> empIds = new ArrayList<>();
|
||||
partition.forEach(part -> {
|
||||
empIds.addAll(employBiz.listEmpIdByDepId(part));
|
||||
});
|
||||
return empIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ import com.engine.salary.util.excel.ExcelUtilPlus;
|
|||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.mzlion.core.lang.CollectionUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -273,20 +275,69 @@ public class SettingServiceImpl extends Service implements SettingService {
|
|||
pos.add(systemTemplate);
|
||||
}
|
||||
|
||||
// 艾志二开, 薪酬总管理员可以看到所有模板
|
||||
if (!getTaxAgentService().isChief(Long.valueOf(user.getUID()))) {
|
||||
// 其余员工根据建模分权,获取建模数据
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("select xzmb from uf_xzmxmb where ry = "+ user.getUID());
|
||||
List<Long> canManageTemplateIds = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
Long xzmbId = SalaryEntityUtil.string2Long(rs.getString("xzmb"));
|
||||
if (xzmbId != null) {
|
||||
canManageTemplateIds.add(SalaryEntityUtil.string2Long(rs.getString("xzmb")));
|
||||
}
|
||||
}
|
||||
pos = pos.stream().filter(template -> canManageTemplateIds.contains(template.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(pos)) {
|
||||
throw new SalaryRunTimeException("无可用薪酬模板");
|
||||
}
|
||||
//获取当前选择的模板
|
||||
PageLinkPO link = getPageLinkMapper().listSome(PageLinkPO.builder().employeeId((long) user.getUID()).page(SALARY_DETAILS_REPORT.getValue()).build()).stream().findFirst().orElse(null);
|
||||
if (link == null) {
|
||||
link = PageLinkPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId((long) user.getUID())
|
||||
.page(param.getPage())
|
||||
.templateId(systemTemplate.getId())
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator((long) user.getUID())
|
||||
.deleteType(0).build();
|
||||
// 查看能够管理的是否包含系统模板,不包含的话,取第一个
|
||||
Optional<PageListTemplatePO> systemTemplateOptional = pos.stream().filter(po -> po.getSystemType() != null && po.getSystemType() == 1).findFirst();
|
||||
if (systemTemplateOptional.isPresent()) {
|
||||
link = PageLinkPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId((long) user.getUID())
|
||||
.page(param.getPage())
|
||||
.templateId(systemTemplate.getId())
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator((long) user.getUID())
|
||||
.deleteType(0).build();
|
||||
} else {
|
||||
link = PageLinkPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId((long) user.getUID())
|
||||
.page(param.getPage())
|
||||
.templateId(pos.get(0).getId())
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator((long) user.getUID())
|
||||
.deleteType(0).build();
|
||||
}
|
||||
getPageLinkMapper().insertIgnoreNull(link);
|
||||
} else {
|
||||
// 判断是否有该模板权限
|
||||
PageLinkPO finalLink = link;
|
||||
Optional<PageListTemplatePO> first = pos.stream().filter(po -> po.getId().equals(finalLink.getTemplateId())).findFirst();
|
||||
if (!first.isPresent()) {
|
||||
link = PageLinkPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.employeeId((long) user.getUID())
|
||||
.page(param.getPage())
|
||||
.templateId(pos.get(0).getId())
|
||||
.tenantKey(DEFAULT_TENANT_KEY)
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.creator((long) user.getUID())
|
||||
.deleteType(0).build();
|
||||
}
|
||||
}
|
||||
Long templateId = link.getTemplateId();
|
||||
|
||||
|
|
@ -294,23 +345,25 @@ public class SettingServiceImpl extends Service implements SettingService {
|
|||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService().listAllTaxAgents((long) user.getUID());
|
||||
List<Long> taxIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList());
|
||||
Boolean chief = getTaxAgentService().isChief((long) user.getUID());
|
||||
pos = pos.stream().filter(po -> {
|
||||
SharedTypeEnum sharedTypeEnum = SharedTypeEnum.parseByValue(po.getSharedType());
|
||||
//系统模板直接可见
|
||||
if (chief || po.getSystemType() == 1) {
|
||||
return true;
|
||||
}
|
||||
//私有,只能自己看到
|
||||
if (sharedTypeEnum == SharedTypeEnum.PRIVATE) {
|
||||
return Objects.equals((long) user.getUID(), po.getCreator());
|
||||
}
|
||||
//共享
|
||||
if (sharedTypeEnum == SharedTypeEnum.PUBLIC) {
|
||||
List<Long> limitIds = po.getLimitIds();
|
||||
return CollectionUtil.isEmpty(limitIds) || CollectionUtil.intersection(limitIds, taxIds).size() != 0;
|
||||
}
|
||||
return true;
|
||||
}).peek(po -> {
|
||||
pos = pos.stream()
|
||||
// .filter(po -> {
|
||||
// SharedTypeEnum sharedTypeEnum = SharedTypeEnum.parseByValue(po.getSharedType());
|
||||
// //系统模板直接可见
|
||||
// if (chief || po.getSystemType() == 1) {
|
||||
// return true;
|
||||
// }
|
||||
// //私有,只能自己看到
|
||||
// if (sharedTypeEnum == SharedTypeEnum.PRIVATE) {
|
||||
// return Objects.equals((long) user.getUID(), po.getCreator());
|
||||
// }
|
||||
// //共享
|
||||
// if (sharedTypeEnum == SharedTypeEnum.PUBLIC) {
|
||||
// List<Long> limitIds = po.getLimitIds();
|
||||
// return CollectionUtil.isEmpty(limitIds) || CollectionUtil.intersection(limitIds, taxIds).size() != 0;
|
||||
// }
|
||||
// return true;
|
||||
// })
|
||||
.peek(po -> {
|
||||
po.setChecked(po.getId().equals(templateId));
|
||||
}).collect(Collectors.toList());
|
||||
return pos;
|
||||
|
|
|
|||
Loading…
Reference in New Issue