Commit 1f64c0d2 authored by nie'hong's avatar nie'hong

完善工时统计

parent 3b1976c3
......@@ -95,6 +95,9 @@
<if test="deptId != null and managerId != null">
AND (p.dept_id = #{deptId} OR p.manager_id = #{managerId})
</if>
<if test="deptId != null and managerId == null">
AND p.dept_id = #{deptId}
</if>
<if test="centreId != null">
AND centre_id = #{centreId}
</if>
......
......@@ -321,9 +321,12 @@ public class StatisticsServiceImpl implements StatisticsService {
workTimeAndCostCollects.addAll(workTimeAndCostCollect);
} else if (rank.contains(LevelRankEnum.DEPARTMENT_LEVEL.getRank())) { // 如果用户的审批权限的级别最高为部门级别
// 如果用户同时为项目级别和部门级别
if (rank.contains(LevelRankEnum.PROJECT_LEVEL.getRank())) {
map.put("managerId", user.getId());
}
// 获取部门下的所有项目和商机的工时统计
map.put("deptId", user.getDeptId());
map.put("managerId", user.getId());
workTimeAndCostCollects = workProjectTimeCostMapper.selectList(map);
// 除项目和项目的类型
......@@ -337,10 +340,17 @@ public class StatisticsServiceImpl implements StatisticsService {
}
// 获取查询结果中的类型
if (!rank.contains(LevelRankEnum.PROJECT_LEVEL.getRank())) {
List<Integer> typeList = workTimeAndCostCollects.stream().map(WorkTimeAndCostCollect::getType).collect(Collectors.toList());
List<Integer> typeList = workTimeAndCostCollects.stream().map(WorkTimeAndCostCollect::getType).collect(Collectors.toList());
if (typeList.size() < workTypes.size()) {
int j;
// 用户仅为项目商机级别用户,仅展示项目和商机类型
if (rank.contains(LevelRankEnum.PROJECT_LEVEL.getRank()) && rank.size() == 1) {
j = 2;
} else { // 用户不仅或不为项目商机级别
j = workTypes.size();
}
// 如果查询结果不包含查询条件中的类型,造对象传前端
for (int i = 0; i < workTypes.size(); i++) {
for (int i = 0; i < j; i++) {
WorkType workType = workTypes.get(i);
if (!typeList.contains(workType.getId())) {
WorkTimeAndCostCollect workTimeAndCostCollect1 = new WorkTimeAndCostCollect();
......@@ -773,7 +783,7 @@ public class StatisticsServiceImpl implements StatisticsService {
row_1Cell1.setCellValue("序号");
// 单位\姓名
HSSFCell row_1Cell2 = row_1.createCell(1);
row_1Cell2.setCellValue(" 单位(小时)\n 姓名");
row_1Cell2.setCellValue(" 单位(小时)\n 姓名");
// 画斜线
HSSFPatriarch drawingPatriarch = sheet1.createDrawingPatriarch();
HSSFClientAnchor hssfClientAnchor = new HSSFClientAnchor(0, 0, 1023, 255, (short) 1, 1, (short) 1, 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment