领悦 报表分权
This commit is contained in:
parent
4b9c8348c8
commit
ceb0ebb1f7
|
|
@ -3,6 +3,7 @@ package com.engine.salary.service;
|
|||
import com.engine.salary.entity.ly.param.LySalaryReportQueryParam;
|
||||
import com.engine.salary.entity.ly.po.LySalaryReportPO;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -91,4 +92,8 @@ public interface LySalaryReportService {
|
|||
* @return
|
||||
*/
|
||||
XSSFWorkbook exportSalaryReport(LySalaryReportQueryParam param);
|
||||
|
||||
Boolean lyReportPermission(User user);
|
||||
|
||||
List<String> getCanManageFrztByUid(User user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
|
|
@ -454,6 +455,14 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
|
|||
|
||||
// 获取本月是否已有报表数据
|
||||
List<LySalaryReportPO> lySalaryReportPOS = listBySalaryMonth(salaryMonthDate);
|
||||
|
||||
// 分权
|
||||
// 是否是薪酬总管理员
|
||||
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (!isChief) {
|
||||
List<String> canManageFrztByUid = getCanManageFrztByUid(user);
|
||||
lySalaryReportPOS = lySalaryReportPOS.stream().filter(po -> canManageFrztByUid.contains(po.getFfgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isNotBlank(param.getFfgsqc())) {
|
||||
lySalaryReportPOS = lySalaryReportPOS.stream().filter(lySalaryReportPO -> lySalaryReportPO.getFfgsqc().contains(param.getFfgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -542,6 +551,14 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
|
|||
// 获取本月是否已有报表数据
|
||||
List<LySalaryReportPO> lySalaryReportPOS = listBySalaryMonth(salaryMonthDate);
|
||||
|
||||
// 分权
|
||||
// 是否是薪酬总管理员
|
||||
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (!isChief) {
|
||||
List<String> canManageFrztByUid = getCanManageFrztByUid(user);
|
||||
lySalaryReportPOS = lySalaryReportPOS.stream().filter(po -> canManageFrztByUid.contains(po.getFfgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return buildSumData(lySalaryReportPOS);
|
||||
}
|
||||
|
||||
|
|
@ -651,4 +668,42 @@ public class LySalaryReportServiceImpl extends Service implements LySalaryReport
|
|||
//获取excel
|
||||
return ExcelUtilPlus.genWorkbookWithChildTitleColumn(rows, "薪酬统计报表", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean lyReportPermission(User user) {
|
||||
List<String> canManageFrztByUid = getCanManageFrztByUid(user);
|
||||
if (CollectionUtils.isNotEmpty(canManageFrztByUid)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getCanManageFrztByUid(User user) {
|
||||
if (user == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute("select frzt,ncbbqxry from uf_frzt ");
|
||||
HashMap<String, List<Long>> frztInfoMap = new HashMap<>();
|
||||
while (rs.next()) {
|
||||
String frzt = rs.getString("frzt");
|
||||
String ncbbqxry = rs.getString("ncbbqxry");
|
||||
if (StringUtils.isNotBlank(frzt) && StringUtils.isNotBlank(ncbbqxry)) {
|
||||
List<Long> ryList = Arrays.stream(ncbbqxry.split(",")).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(ryList)) {
|
||||
frztInfoMap.put(frzt, ryList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取当前用户能够管理哪些法人主体下的数据
|
||||
List<String> resultList = new ArrayList<>();
|
||||
for(Map.Entry<String, List<Long>> entry : frztInfoMap.entrySet()) {
|
||||
List<Long> ryList = entry.getValue();
|
||||
if (ryList.contains(Long.valueOf(user.getUID()))) {
|
||||
resultList.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
|
|||
return MapperProxyFactory.getProxy(LySocialReportMapper.class);
|
||||
}
|
||||
|
||||
private LySalaryReportService getLySalaryReportService(User user) {
|
||||
return ServiceUtil.getService(LySalaryReportServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryAcctRecordService getSalaryAcctRecordService(User user) {
|
||||
return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -441,6 +445,13 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
|
|||
if (StringUtils.isNotBlank(param.getFfgsqc())) {
|
||||
lySocialReportPOS = lySocialReportPOS.stream().filter(lySalaryReportPO -> lySalaryReportPO.getGmgsqc().contains(param.getFfgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
// 分权
|
||||
// 是否是薪酬总管理员
|
||||
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (!isChief) {
|
||||
List<String> canManageFrztByUid = getLySalaryReportService(user).getCanManageFrztByUid(user);
|
||||
lySocialReportPOS = lySocialReportPOS.stream().filter(po -> canManageFrztByUid.contains(po.getGmgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
PageInfo<LySocialReportPO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize());
|
||||
if (param.isExport()) {
|
||||
// 是导出
|
||||
|
|
@ -538,6 +549,14 @@ public class LySocialReportServiceImpl extends Service implements LySocialReport
|
|||
|
||||
// 获取本月是否已有报表数据
|
||||
List<LySocialReportPO> lySocialReportPOS = listBySalaryMonth(salaryMonthDate);
|
||||
|
||||
// 分权
|
||||
// 是否是薪酬总管理员
|
||||
boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (!isChief) {
|
||||
List<String> canManageFrztByUid = getLySalaryReportService(user).getCanManageFrztByUid(user);
|
||||
lySocialReportPOS = lySocialReportPOS.stream().filter(po -> canManageFrztByUid.contains(po.getGmgsqc())).collect(Collectors.toList());
|
||||
}
|
||||
return buildSumData(lySocialReportPOS);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,24 @@ public class LySalaryController {
|
|||
return ServiceUtil.getService(LySalaryWrapper.class, user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 领悦报表权限
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/salaryReport/lyPermission")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String lyReportPermission(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody LySalaryReportQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<User, Boolean>(user).run(getLySalaryWrapper(user)::lyReportPermission, user);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------薪酬汇总报表start------------------------------------------
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -123,4 +123,17 @@ public class LySalaryWrapper extends Service {
|
|||
public void genPZ(LyPZGenParam queryParam) {
|
||||
getLyPZService(user).genPZ(queryParam);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 领悦报表权限
|
||||
* @param user
|
||||
*/
|
||||
public Boolean lyReportPermission(User user) {
|
||||
return getLySalaryReportService(user).lyReportPermission(user);
|
||||
}
|
||||
|
||||
public List<String> getCanManageFrztByUid(User user) {
|
||||
return getLySalaryReportService(user).getCanManageFrztByUid(user);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue