Commit c4c6534a by wangqi

首页统计

parent 0b1bdf69
......@@ -19,6 +19,9 @@ public interface SysDeptMapper
*/
public List<SysDept> selectDeptList(SysDept dept);
public List<SysDept> selectDeptList_ejdw(SysDept dept);
public List<SysDept> selectDeptList_sjdw(SysDept dept);
/**
* 根据角色ID查询部门树信息
*
......
......@@ -19,6 +19,9 @@ public interface ISysDeptService
*/
public List<SysDept> selectDeptList(SysDept dept);
public List<SysDept> selectDeptList_ejdw(SysDept dept);
public List<SysDept> selectDeptList_sjdw(SysDept dept);
/**
* 查询部门管理数据
*
......
......@@ -49,6 +49,17 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectDeptList(dept);
}
public List<SysDept> selectDeptList_ejdw(SysDept dept)
{
return deptMapper.selectDeptList_ejdw(dept);
}
public List<SysDept> selectDeptList_sjdw(SysDept dept)
{
return deptMapper.selectDeptList_sjdw(dept);
}
/**
* 查询部门树结构信息
*
......
......@@ -178,4 +178,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<select id="selectDeptList_ejdw" parameterType="SysDept" resultMap="SysDeptResult">
select * from sys_dept d
where d.del_flag = '0'
and d.dept_id !='972'
and dwjb = '3'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptList_sjdw" parameterType="SysDept" resultMap="SysDeptResult">
select * from sys_dept d
where d.del_flag = '0'
and d.parent_id !='972'
and dwjb = '4'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
order by d.parent_id, d.order_num
</select>
</mapper>
package com.qianhe.controller;
import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.core.domain.entity.SysRole;
import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.domain.*;
import com.qianhe.domain.Vo.SjLhscVo;
import com.qianhe.service.*;
import com.qianhe.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;
/**
* 首页
*
* @author qianhe
* @date 2025-08-04
*/
@RestController
@RequestMapping("/system/amain")
public class AmainController extends BaseController
{
@Autowired
private IAmainService amainServiceImpl;
@Autowired
private ISysDeptService deptService;
@Autowired
private ISjLhscService sjLhscService;
@Autowired
private ISjFybpZbService sjFybpZbService;
@Autowired
private ISjGfjsZsdwkhpjZbService sjGfjsZsdwkhpjZbService;
@Autowired
private ISjGfjsYdjcjlService sjGfjsYdjcjlService;
@Autowired
private ISjBzxxService sjBzxxService;
/**
* 查询班组信息
*/
@GetMapping("/bzxx")
public AjaxResult bzxx(Amain vo)
{
SjBzxx sjBzxx = new SjBzxx();
return AjaxResult.success(sjBzxxService.selectBzxxTj(sjBzxx));
}
/**
* 查询例会查询情况, 看二级例会情况,看三级例会情况
*/
@GetMapping("/lhQk")
public AjaxResult lhQk(Amain vo)
{
String nd = vo.getNd();
String startJd=nd+"-01";
String endJd=nd+"-12";
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
// A看所有 B直属单位以下 C基层单位自己 D空白
String sylx = getHighestLevel(rolelist);
Long deptId = SecurityUtils.getDeptId();
List<SysDept> depts = null; // 单位信息
List<SjLhsc> lhList = null; // 例会信息
String title = "单位例会提交情况";
if("A".equals(sylx)){
title = "直属单位例会提交情况";
// 单位信息
SysDept dept = new SysDept();
depts = deptService.selectDeptList_ejdw(dept);
// 例会信息
SjLhsc sjLhsc = new SjLhsc();
sjLhsc.setStartJd(startJd);
sjLhsc.setEndJd(endJd);
sjLhsc.setZt("已提交");
sjLhsc.setDwjb("3");
lhList = sjLhscService.selectSjLhscList_main(sjLhsc);
}else if("B".equals(sylx)){
title = "基层单位例会提交情况";
// 单位信息
SysDept dept = new SysDept();
dept.setParentId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
// 例会信息
SjLhsc sjLhsc = new SjLhsc();
sjLhsc.setStartJd(startJd);
sjLhsc.setEndJd(endJd);
sjLhsc.setZt("已提交");
sjLhsc.setDwjb("4");
sjLhsc.setParentId(deptId+"");
lhList = sjLhscService.selectSjLhscList_main(sjLhsc);
}else if("C".equals(sylx)){
title = "单位例会提交情况";
SysDept dept = new SysDept();
dept.setDeptId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
// 例会信息
SjLhsc sjLhsc = new SjLhsc();
sjLhsc.setStartJd(startJd);
sjLhsc.setEndJd(endJd);
sjLhsc.setZt("已提交");
sjLhsc.setDwjb("4");
sjLhsc.setDeptId(deptId+"");
lhList = sjLhscService.selectSjLhscList_main(sjLhsc);
}
Map<String, Map<String, Integer>> lhQkMap = amainServiceImpl.statisticsMeetings(depts, lhList);
Map map = new HashMap();
map.put("title", title);
map.put("meetingStats", lhQkMap);
return AjaxResult.success(map);
}
/**
* 查询费用提交情况
*/
@GetMapping("/fybbQk")
public AjaxResult fybbQk(Amain vo)
{
String nd = vo.getNd();
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
// A看所有 B直属单位以下 C基层单位自己 D空白
String sylx = getHighestLevel(rolelist);
Long deptId = SecurityUtils.getDeptId();
List<SysDept> depts = null; // 单位信息
List<SjFybpZb> fyList = null; // 费用信息
String title = "费用报批提交情况";
if("A".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
depts = deptService.selectDeptList_ejdw(dept);
SjFybpZb sjFybpZb = new SjFybpZb();
sjFybpZb.setFyrq(nd);
sjFybpZb.setSpcx("1");
fyList = sjFybpZbService.selectSjFybpZbList_main(sjFybpZb);
}else if("B".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setParentId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjFybpZb sjFybpZb = new SjFybpZb();
sjFybpZb.setFyrq(nd);
sjFybpZb.setSpcx("1");
sjFybpZb.setDeptId(deptId+"");
fyList = sjFybpZbService.selectSjFybpZbList_main(sjFybpZb);
}
Map<String, Map<String, Integer>> fyQkMap = amainServiceImpl.countDepartmentExpenses(depts, fyList);
Map map = new HashMap();
map.put("title", title);
map.put("expenseStats", fyQkMap);
return AjaxResult.success(map);
}
/**
* 查询直属单位对基层单位的分档评价情况
*/
@GetMapping("/zsdwDdpjQk")
public AjaxResult zsdwDdpjQk(Amain vo)
{
String nd = vo.getNd();
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
// A看所有 B直属单位以下 C基层单位自己 D空白
String sylx = getHighestLevel(rolelist);
Long deptId = SecurityUtils.getDeptId();
List<SysDept> depts = null; // 单位信息
List<SjGfjsZsdwkhpjZb> fdpjList = null; // 分档评价信息
String title = "直属单位对基层单位的分档评价统计";
if("A".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("直属单位");
fdpjList = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}else if("B".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setParentId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("直属单位");
sjGfjsZsdwkhpjZb.setDeptId(deptId);
fdpjList = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}
Map<String, Map<String, Integer>> fyQkMap = amainServiceImpl.statisticsGradingEvaluation(depts, fdpjList);
Map map = new HashMap();
map.put("title", title);
map.put("expenseStats", fyQkMap);
return AjaxResult.success(map);
}
/**
* 查询基层单位月度问题清单提交情况
*/
@GetMapping("/jcdwYdwtQk")
public AjaxResult jcdwYdwtQk(Amain vo)
{
String nd = vo.getNd();
String startJd=nd+"-01";
String endJd=nd+"-12";
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
// A看所有 B直属单位以下 C基层单位自己 D空白
String sylx = getHighestLevel(rolelist);
Long deptId = SecurityUtils.getDeptId();
List<SysDept> depts = null; // 单位信息
List<SjGfjsYdjcjl> ydwtList = null; // 月度问题
String title = "基层单位月度问题清单提交情况";
if("A".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsYdjcjl sjGfjsYdjcjl = new SjGfjsYdjcjl();
sjGfjsYdjcjl.setJcjb("基层单位自查");
sjGfjsYdjcjl.setStartRq(startJd);
sjGfjsYdjcjl.setEndRq(endJd);
sjGfjsYdjcjl.setZt("1");
ydwtList = sjGfjsYdjcjlService.selectSjGfjsYdjcjlList_main(sjGfjsYdjcjl);
}else if("B".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setParentId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsYdjcjl sjGfjsYdjcjl = new SjGfjsYdjcjl();
sjGfjsYdjcjl.setDeptId(deptId);
sjGfjsYdjcjl.setJcjb("基层单位自查");
sjGfjsYdjcjl.setStartRq(startJd);
sjGfjsYdjcjl.setEndRq(endJd);
sjGfjsYdjcjl.setZt("1");
ydwtList = sjGfjsYdjcjlService.selectSjGfjsYdjcjlList_main(sjGfjsYdjcjl);
}else if("C".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setDeptId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsYdjcjl sjGfjsYdjcjl = new SjGfjsYdjcjl();
sjGfjsYdjcjl.setDeptId(deptId);
sjGfjsYdjcjl.setJcjb("基层单位自查");
sjGfjsYdjcjl.setStartRq(startJd);
sjGfjsYdjcjl.setEndRq(endJd);
sjGfjsYdjcjl.setZt("1");
ydwtList = sjGfjsYdjcjlService.selectSjGfjsYdjcjlList_main(sjGfjsYdjcjl);
}
Map<String, Map<String, Integer>> fyQkMap = amainServiceImpl.statisticsMonthlyIssues(depts, ydwtList);
Map map = new HashMap();
map.put("title", title);
map.put("expenseStats", fyQkMap);
return AjaxResult.success(map);
}
/**
* 查询基层单位季度自测提交情况
*/
@GetMapping("/jcdwJdzcQk")
public AjaxResult jcdwJdzcQk(Amain vo)
{
String nd = vo.getNd();
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
// A看所有 B直属单位以下 C基层单位自己 D空白
String sylx = getHighestLevel(rolelist);
Long deptId = SecurityUtils.getDeptId();
List<SysDept> depts = null; // 单位信息
List<SjGfjsZsdwkhpjZb> fdpjList = null; // 季度自测
String title = "基层单位季度自测提交情况";
if("A".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("基层单位");
fdpjList = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}else if("B".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setParentId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("基层单位");
sjGfjsZsdwkhpjZb.setDeptId(deptId);
fdpjList = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}else if("C".equals(sylx)){
// 单位信息
SysDept dept = new SysDept();
dept.setDeptId(deptId);
depts = deptService.selectDeptList_sjdw(dept);
SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb = new SjGfjsZsdwkhpjZb();
sjGfjsZsdwkhpjZb.setNd(nd);
sjGfjsZsdwkhpjZb.setZt("1");
sjGfjsZsdwkhpjZb.setJb("基层单位");
sjGfjsZsdwkhpjZb.setDeptId(deptId);
fdpjList = sjGfjsZsdwkhpjZbService.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}
Map<String, Map<String, Integer>> fyQkMap = amainServiceImpl.statisticsQuarterlyTests(depts, fdpjList);
Map map = new HashMap();
map.put("title", title);
map.put("expenseStats", fyQkMap);
return AjaxResult.success(map);
}
/* 超级管理员 admin A 首页看所有
三基管理员 sjgly A 首页看所有
直属单位三基管理员 ejsjgly B 直属单位以下
基层单位三基管理员 sjsjgly C 基层单位
帮扶组 D bfz 空
机关部门检查 D jgbmjc 空
普通角色 common D 空
练兵指导帮扶 lbzdbf
*/
public String getHighestLevel(List<SysRole> roleList) {
// 校验输入
if (roleList == null || roleList.isEmpty()) {
return null;
}
// 检查是否有A级角色
boolean hasLevelA = roleList.stream()
.anyMatch(role -> "admin".equals(role.getRoleKey()));
if (hasLevelA) {
return "A";
}
hasLevelA = roleList.stream()
.anyMatch(role -> "sjgly".equals(role.getRoleKey()));
if (hasLevelA) {
return "A";
}
// 检查是否有B级角色
boolean hasLevelB = roleList.stream()
.anyMatch(role -> "ejsjgly".equals(role.getRoleKey()));
if (hasLevelB) {
return "B";
}
// 检查是否有C级角色
boolean hasLevelC = roleList.stream()
.anyMatch(role -> "sjsjgly".equals(role.getRoleKey()));
if (hasLevelC) {
return "C";
}
// 没有任何级别的角色
return "D";
}
}
package com.qianhe.domain;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 公共附件对象 gg_fjb
*
* @author qianhe
* @date 2025-08-04
*/
@Data
public class Amain extends BaseEntity
{
private static final long serialVersionUID = 1L;
private String nd;
}
......@@ -39,6 +39,8 @@ public class SjLhsc extends BaseEntity
@Excel(name = "单位")
private String deptId;
private String parentId;
/** 会议地点 */
@Excel(name = "会议地点")
private String hydd;
......
......@@ -28,6 +28,8 @@ public interface SjFybpZbMapper
*/
public List<SjFybpZb> selectSjFybpZbList(SjFybpZb sjFybpZb);
public List<SjFybpZb> selectSjFybpZbList_main(SjFybpZb sjFybpZb);
/**
* 新增三基-费用报批主
*
......
......@@ -27,6 +27,8 @@ public interface SjGfjsYdjcjlMapper
*/
public List<SjGfjsYdjcjl> selectSjGfjsYdjcjlList(SjGfjsYdjcjl sjGfjsYdjcjl);
public List<SjGfjsYdjcjl> selectSjGfjsYdjcjlList_main(SjGfjsYdjcjl sjGfjsYdjcjl);
/**
* 新增规范建设 月度检查记录
*
......
......@@ -30,6 +30,8 @@ public interface SjGfjsZsdwkhpjZbMapper
public List<SjGfjsZsdwkhpjZb> selectSjGfjsZsdwkhpjZbList_Bfz(SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb);
public List<SjGfjsZsdwkhpjZb> selectSjGfjsZsdwkhpjZbList_main(SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb);
/**
* 新增规范建设-直属单位考核评价主
*
......
......@@ -30,6 +30,8 @@ public interface SjLhscMapper
*/
public List<SjLhsc> selectSjLhscList(SjLhsc sjLhsc);
public List<SjLhsc> selectSjLhscList_main(SjLhsc sjLhsc);
/**
* 新增三基-例会上传
*
......
package com.qianhe.service;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.domain.*;
import com.qianhe.domain.Vo.SjfybpVo;
import java.util.*;
import java.util.stream.Collectors;
/**
* 首页Service接口
*
* @author qianhe
* @date 2024-07-05
*/
public interface IAmainService
{
public Map<String, Map<String, Integer>> statisticsMeetings(List<SysDept> depts, List<SjLhsc> lhList);
public Map countDepartmentExpenses(List<SysDept> depts, List<SjFybpZb> fyList);
public Map<String, Map<String, Integer>> statisticsGradingEvaluation(List<SysDept> depts, List<SjGfjsZsdwkhpjZb> fdpjList);
public Map<String, Map<String, Integer>> statisticsMonthlyIssues(List<SysDept> depts, List<SjGfjsYdjcjl> ydwtList);
public Map<String, Map<String, Integer>> statisticsQuarterlyTests(List<SysDept> depts, List<SjGfjsZsdwkhpjZb> fdpjList);
}
......@@ -27,6 +27,8 @@ public interface ISjFybpZbService
*/
public List<SjFybpZb> selectSjFybpZbList(SjFybpZb sjFybpZb);
public List<SjFybpZb> selectSjFybpZbList_main(SjFybpZb sjFybpZb);
/**
* 新增三基-费用报批主
*
......
......@@ -28,6 +28,8 @@ public interface ISjGfjsYdjcjlService
*/
public List<SjGfjsYdjcjl> selectSjGfjsYdjcjlList(SjGfjsYdjcjl sjGfjsYdjcjl);
public List<SjGfjsYdjcjl> selectSjGfjsYdjcjlList_main(SjGfjsYdjcjl sjGfjsYdjcjl);
/**
* 新增指导帮扶-基层单位问题采集
*
......
......@@ -30,6 +30,8 @@ public interface ISjGfjsZsdwkhpjZbService
public List<SjGfjsZsdwkhpjZb> selectSjGfjsZsdwkhpjZbList_Bfz(SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb);
public List<SjGfjsZsdwkhpjZb> selectSjGfjsZsdwkhpjZbList_main(SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb);
/**
* 新增指导帮扶-直属单位考核评价主
*
......
......@@ -28,6 +28,8 @@ public interface ISjLhscService
*/
public List<SjLhsc> selectSjLhscList(SjLhsc sjLhsc);
public List<SjLhsc> selectSjLhscList_main(SjLhsc sjLhsc);
/**
* 新增三基-例会上传
*
......
package com.qianhe.service.impl;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.domain.*;
import com.qianhe.domain.Vo.SjfybpVo;
import com.qianhe.mapper.SjFybpMapper;
import com.qianhe.mapper.SjFybpWhMapper;
import com.qianhe.mapper.WdWdxxMapper;
import com.qianhe.service.IAmainService;
import com.qianhe.service.ISjFybpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 三基-费用报批Service业务层处理
*
* @author qianhe
* @date 2024-07-05
*/
@Service
public class AmainServiceImpl implements IAmainService
{
public Map<String, Map<String, Integer>> statisticsMeetings(
List<SysDept> depts, List<SjLhsc> lhList) {
// 初始化结果Map,确保结构完整
Map<String, Map<String, Integer>> result = new LinkedHashMap<>();
result.put("Q1", new HashMap() {{ put("completed", 0); put("pending", 0); }});
result.put("Q2", new HashMap() {{ put("completed", 0); put("pending", 0); }});
result.put("Q3", new HashMap() {{ put("completed", 0); put("pending", 0); }});
result.put("Q4", new HashMap() {{ put("completed", 0); put("pending", 0); }});
// 处理单位列表为null的情况,转为空列表
List<SysDept> safeDepts = (depts == null) ? Collections.emptyList() : depts;
// 获取所有单位ID,如果没有单位则返回全0的结果
Set<String> allDeptIds = safeDepts.stream()
.map(dept -> dept.getDeptId().toString())
.collect(Collectors.toSet());
if (allDeptIds.isEmpty()) {
return result; // 没有单位时,所有季度的完成和未完成数都是0
}
// 处理例会列表为null的情况,转为空列表
List<SjLhsc> safeLhList = (lhList == null) ? Collections.emptyList() : lhList;
// 按季度分组统计已开例会的单位
Map<String, Set<String>> quarterlyCompletedDepts = new HashMap<>();
quarterlyCompletedDepts.put("Q1", new HashSet<>());
quarterlyCompletedDepts.put("Q2", new HashSet<>());
quarterlyCompletedDepts.put("Q3", new HashSet<>());
quarterlyCompletedDepts.put("Q4", new HashSet<>());
// 处理例会数据
Calendar calendar = Calendar.getInstance();
for (SjLhsc meeting : safeLhList) {
// 跳过null的例会记录(如果列表中存在)
if (meeting == null) continue;
// 确定季度
Date meetingDate = meeting.getHyrq();
calendar.setTime(meetingDate);
int month = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,+1转为1-12
String quarter = getQuarter(month);
// 处理部门ID为null的情况
String deptId = meeting.getDeptId();
if (deptId != null && allDeptIds.contains(deptId)) {
quarterlyCompletedDepts.get(quarter).add(deptId);
}
}
// 计算每个季度的完成和未完成数量
for (String quarter : result.keySet()) {
Set<String> completedDepts = quarterlyCompletedDepts.get(quarter);
int completed = completedDepts.size();
int pending = allDeptIds.size() - completed;
result.get(quarter).put("completed", completed);
result.get(quarter).put("pending", pending);
}
return result;
}
/**
* 根据月份获取季度
*/
private static String getQuarter(int month) {
if (month >= 1 && month <= 3) {
return "Q1";
} else if (month >= 4 && month <= 6) {
return "Q2";
} else if (month >= 7 && month <= 9) {
return "Q3";
} else {
return "Q4";
}
}
public Map countDepartmentExpenses(List<SysDept> depts, List<SjFybpZb> fyList) {
List<SysDept> safeDepts = (depts == null) ? Collections.emptyList() : depts;
List<SjFybpZb> safeFyList = (fyList == null) ? Collections.emptyList() : fyList;
// 获取所有单位ID
Set<String> allDeptIds = safeDepts.stream()
.map(dept -> dept.getDeptId().toString())
.collect(Collectors.toSet());
// 总单位数
int totalDepts = allDeptIds.size();
// 获取有费用信息的单位ID(去重且有效)
Set<String> deptsWithExpense = safeFyList.stream()
.filter(fy -> fy != null && fy.getDeptId() != null) // 过滤无效记录
.map(SjFybpZb::getDeptId)
.filter(allDeptIds::contains) // 只保留存在于单位列表中的ID
.collect(Collectors.toSet());
// 计算数量
int completed = deptsWithExpense.size();
int pending = totalDepts - completed;
// 整理结果
Map<String, Integer> result = new HashMap<>();
result.put("completed", completed);
result.put("pending", pending);
return result;
}
public Map<String, Map<String, Integer>> statisticsGradingEvaluation(
List<SysDept> depts, List<SjGfjsZsdwkhpjZb> fdpjList) {
// 处理null情况,转为空列表
List<SysDept> safeDepts = (depts == null) ? Collections.emptyList() : depts;
List<SjGfjsZsdwkhpjZb> safeFdpjList = (fdpjList == null) ? Collections.emptyList() : fdpjList;
// 获取所有单位ID(Long类型)
Set<Long> allDeptIds = safeDepts.stream()
.map(SysDept::getDeptId)
.collect(Collectors.toSet());
// 总单位数
int totalDepts = allDeptIds.size();
// 初始化各周期已提交单位的集合
Set<Long> firstHalfSubmitted = new HashSet<>();
Set<Long> secondHalfSubmitted = new HashSet<>();
// 处理分档评价数据
for (SjGfjsZsdwkhpjZb evaluation : safeFdpjList) {
// 跳过null的评价记录
if (evaluation == null) continue;
Long deptId = evaluation.getDeptId();
String period = evaluation.getZqfw();
// 过滤无效数据(部门ID为null、周期为空、不在单位列表中)
if (deptId == null || period == null || !allDeptIds.contains(deptId)) {
continue;
}
// 按周期分类
if ("上半年".equals(period)) {
firstHalfSubmitted.add(deptId);
} else if ("全年".equals(period)) {
secondHalfSubmitted.add(deptId);
}
}
// 计算各周期的统计结果
Map<String, Integer> firstHalfStats = new HashMap<>();
firstHalfStats.put("completed", firstHalfSubmitted.size());
firstHalfStats.put("pending", totalDepts - firstHalfSubmitted.size());
Map<String, Integer> secondHalfStats = new HashMap<>();
secondHalfStats.put("completed", secondHalfSubmitted.size());
secondHalfStats.put("pending", totalDepts - secondHalfSubmitted.size());
// 整理最终结果
Map<String, Map<String, Integer>> result = new HashMap<>();
result.put("Q12", firstHalfStats);
result.put("Q1234", secondHalfStats);
return result;
}
/**
* 统计每个月的月度问题记录填写情况(使用数字月份01-12)
* @param depts 单位信息列表(可能为null)
* @param ydwtList 月度问题记录列表(可能为null)
* @return 包含各月份统计结果的Map
*/
public Map<String, Map<String, Integer>> statisticsMonthlyIssues(
List<SysDept> depts, List<SjGfjsYdjcjl> ydwtList) {
// 处理null情况,转为空列表
List<SysDept> safeDepts = (depts == null) ? Collections.emptyList() : depts;
List<SjGfjsYdjcjl> safeYdwtList = (ydwtList == null) ? Collections.emptyList() : ydwtList;
// 获取所有单位ID
Set<Long> allDeptIds = safeDepts.stream()
.map(SysDept::getDeptId)
.collect(Collectors.toSet());
// 获取单位总数
int totalDepts = allDeptIds.size();
// 初始化各月份(01-12)已提交单位的集合
Map<String, Set<Long>> monthlySubmitted = new LinkedHashMap<>();
// 按顺序添加12个月份
for (int i = 1; i <= 12; i++) {
String month = String.format("%02d", i); // 格式化为两位数字(01-12)
monthlySubmitted.put(month, new HashSet<>());
}
// 处理月度问题记录数据
for (SjGfjsYdjcjl record : safeYdwtList) {
// 跳过null的记录
if (record == null) continue;
Long deptId = record.getDeptId();
String dateStr = record.getRq();
// 过滤无效数据
if (deptId == null || dateStr == null || !allDeptIds.contains(deptId)) {
continue;
}
// 解析月份(格式为"yyyy-MM")
String[] dateParts = dateStr.split("-");
if (dateParts.length != 2) {
continue; // 日期格式不正确,跳过
}
String month = dateParts[1]; // 获取月份部分(如"07")
// 如果是有效月份(01-12),添加到对应集合
if (monthlySubmitted.containsKey(month)) {
monthlySubmitted.get(month).add(deptId);
}
}
// 计算各月份的统计结果
Map<String, Map<String, Integer>> result = new LinkedHashMap<>();
for (String month : monthlySubmitted.keySet()) {
Set<Long> submittedDepts = monthlySubmitted.get(month);
Map<String, Integer> monthStats = new HashMap<>();
monthStats.put("completed", submittedDepts.size());
monthStats.put("pending", totalDepts - submittedDepts.size());
result.put(month, monthStats);
}
return result;
}
public Map<String, Map<String, Integer>> statisticsQuarterlyTests(
List<SysDept> depts, List<SjGfjsZsdwkhpjZb> fdpjList) {
// 处理null情况,转为空列表
List<SysDept> safeDepts = (depts == null) ? Collections.emptyList() : depts;
List<SjGfjsZsdwkhpjZb> safeFdpjList = (fdpjList == null) ? Collections.emptyList() : fdpjList;
// 获取所有单位ID
Set<Long> allDeptIds = safeDepts.stream()
.map(SysDept::getDeptId)
.collect(Collectors.toSet());
int totalDepts = allDeptIds.size();
// 季度名称映射(中文到Q1-Q4)
Map<String, String> quarterMap = new HashMap<>();
quarterMap.put("第一季度", "Q1");
quarterMap.put("第二季度", "Q2");
quarterMap.put("第三季度", "Q3");
quarterMap.put("第四季度", "Q4");
// 初始化各季度已完成单位的集合
Map<String, Set<Long>> quarterlyCompleted = new LinkedHashMap<>();
quarterlyCompleted.put("Q1", new HashSet<>());
quarterlyCompleted.put("Q2", new HashSet<>());
quarterlyCompleted.put("Q3", new HashSet<>());
quarterlyCompleted.put("Q4", new HashSet<>());
// 处理季度自测数据
for (SjGfjsZsdwkhpjZb record : safeFdpjList) {
// 跳过null的记录
if (record == null) continue;
Long deptId = record.getDeptId();
String period = record.getZqfw();
// 过滤无效数据
if (deptId == null || period == null || !allDeptIds.contains(deptId)) {
continue;
}
// 转换为Q1-Q4格式
String quarter = quarterMap.get(period);
if (quarter != null) {
quarterlyCompleted.get(quarter).add(deptId);
}
}
// 计算各季度的统计结果
Map<String, Map<String, Integer>> result = new LinkedHashMap<>();
for (String quarter : quarterlyCompleted.keySet()) {
Set<Long> completedDepts = quarterlyCompleted.get(quarter);
Map<String, Integer> quarterStats = new HashMap<>();
quarterStats.put("completed", completedDepts.size());
quarterStats.put("pending", totalDepts - completedDepts.size());
result.put(quarter, quarterStats);
}
return result;
}
}
\ No newline at end of file
......@@ -105,6 +105,7 @@ public class SjBzxxServiceImpl implements ISjBzxxService
@Override
@DataScope(deptAlias = "d")
public SjBzxx selectBzxxTj(SjBzxx sjBzxx)
{
return sjBzxxMapper.selectBzxxTj(sjBzxx);
......
......@@ -75,6 +75,12 @@ public class SjFybpZbServiceImpl implements ISjFybpZbService
return sjFybpZbMapper.selectSjFybpZbList(sjFybpZb);
}
@Override
public List<SjFybpZb> selectSjFybpZbList_main(SjFybpZb sjFybpZb)
{
return sjFybpZbMapper.selectSjFybpZbList_main(sjFybpZb);
}
/**
* 新增三基-费用报批主
*
......
......@@ -50,6 +50,12 @@ public class SjGfjsYdjcjlServiceImpl implements ISjGfjsYdjcjlService
return sjGfjsYdjcjlMapper.selectSjGfjsYdjcjlList(sjGfjsYdjcjl);
}
@Override
public List<SjGfjsYdjcjl> selectSjGfjsYdjcjlList_main(SjGfjsYdjcjl sjGfjsYdjcjl)
{
return sjGfjsYdjcjlMapper.selectSjGfjsYdjcjlList_main(sjGfjsYdjcjl);
}
/**
* 新增规范建设 月度检查记录
*
......
......@@ -54,6 +54,11 @@ public class SjGfjsZsdwkhpjZbServiceImpl implements ISjGfjsZsdwkhpjZbService
return sjGfjsZsdwkhpjZbMapper.selectSjGfjsZsdwkhpjZbList_Bfz(sjGfjsZsdwkhpjZb);
}
public List<SjGfjsZsdwkhpjZb> selectSjGfjsZsdwkhpjZbList_main(SjGfjsZsdwkhpjZb sjGfjsZsdwkhpjZb)
{
return sjGfjsZsdwkhpjZbMapper.selectSjGfjsZsdwkhpjZbList_main(sjGfjsZsdwkhpjZb);
}
/**
* 新增指导帮扶-直属单位考核评价主
*
......
......@@ -70,6 +70,12 @@ public class SjLhscServiceImpl implements ISjLhscService
return sjLhscMapper.selectSjLhscList(sjLhsc);
}
@Override
public List<SjLhsc> selectSjLhscList_main(SjLhsc sjLhsc)
{
return sjLhscMapper.selectSjLhscList_main(sjLhsc);
}
/**
* 新增三基-例会上传
*
......
......@@ -103,14 +103,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!--查询统计-->
<select id="selectBzxxTj" parameterType="SjBzxx" resultMap="SjBzxxResult">
select a.dept_id, a.bzlx, count(a.id) bzzs, sum(a.rs) zrs,
d.dept_name
select count(a.id) bzzs, sum(a.rs) zrs
from sj_bzxx a
left join sys_dept d on a.dept_id=d.dept_id
where 1=1
<if test="deptId != null "> and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="bzlx != null and bzlx != ''"> and bzlx = #{bzlx}</if>
<if test="bzmc != null and bzmc != ''"> and bzmc = #{bzmc}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
limit 1
</select>
<update id="plxg" parameterType="SjBzxx">
......
......@@ -230,4 +230,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.id}, #{item.fymc}, #{item.fyrq}, #{item.deptId}, #{item.fylx}, #{item.fyms}, #{item.fyje}, #{item.zbId})
</foreach>
</insert>
<select id="selectSjFybpZbList_main" parameterType="SjFybpZb" resultMap="SjFybpZbResult">
select id,fyrq, a.dept_id, fyje, zt, tjr, tjrq, sprq, spr, ysyje, spyj, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, yl1, yl2, yl3, yl4, yl5, d.dept_name, u.user_name spr_name
from sj_fybp_zb a
left join sys_dept d on a.dept_id=d.dept_id
left join sys_user u on a.spr=u.user_name
<where>
<if test="fyrq != null and fyrq != ''"> and fyrq = #{fyrq}</if>
<if test="deptId != null and deptId != ''"> and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="fyje != null "> and fyje = #{fyje}</if>
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
<if test="tjr != null and tjr != ''"> and tjr = #{tjr}</if>
<if test="tjrq != null and tjrq != ''"> and tjrq = #{tjrq}</if>
<if test="sprq != null and sprq != ''"> and sprq = #{sprq}</if>
<if test="spr != null and spr != ''"> and spr = #{spr}</if>
<if test="ysyje != null "> and ysyje = #{ysyje}</if>
<if test="spyj != null and spyj != ''"> and spyj = #{spyj}</if>
<if test="yl1 != null and yl1 != ''"> and yl1 = #{yl1}</if>
<if test="yl2 != null and yl2 != ''"> and yl2 = #{yl2}</if>
<if test="yl3 != null and yl3 != ''"> and yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and yl5 = #{yl5}</if>
<if test="spcx != null and spcx != '' and spcx=='1'.toString()"> and zt in ('待审批','已批复')</if>
</where>
order by a.create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -305,5 +305,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by a.rq desc
</select>
<select id="selectSjGfjsYdjcjlList_main" parameterType="SjGfjsYdjcjl" resultMap="SjGfjsYdjcjlResult">
<include refid="selectSjGfjsYdjcjlVo"/>
<where>
<if test="deptId != null ">and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="rq != null and rq != ''"> and rq = #{rq}</if>
<if test="jcjb != null and jcjb != ''"> and jcjb = #{jcjb}</if>
<if test="yl1 != null and yl1 != ''"> and yl1 = #{yl1}</if>
<if test="yl2 != null "> and yl2 = #{yl2}</if>
<if test="yl3 != null "> and yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and yl5 = #{yl5}</if>
<if test="sfczwt != null and sfczwt != ''"> and sfczwt = #{sfczwt}</if>
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
<if test="startRq != null and startRq != ''"> and rq >= #{startRq}</if>
<if test="endRq != null and endRq != ''"> and rq &lt;= #{endRq}</if>
</where>
order by a.rq desc
</select>
</mapper>
......@@ -364,4 +364,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectSjGfjsZsdwkhpjZbList_main" parameterType="SjGfjsZsdwkhpjZb" resultMap="SjGfjsZsdwkhpjZbResult">
<include refid="selectSjGfjsZsdwkhpjZbVo"/>
<where>
<if test="deptId != null ">and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="parentDeptId != null "> and a.parent_dept_id = #{parentDeptId}</if>
<if test="nd != null and nd != ''"> and a.nd = #{nd}</if>
<if test="zqfw != null and zqfw != ''"> and a.zqfw = #{zqfw}</if>
<if test="zqlx != null and zqlx != ''"> and a.zqlx = #{zqlx}</if>
<if test="jb != null and jb != ''"> and a.jb = #{jb}</if>
<if test="deptDfl != null and deptDfl != ''"> and a.dept_dfl = #{deptDfl}</if>
<if test="deptLx != null and deptLx != ''"> and a.dept_lx = #{deptLx}</if>
<if test="deptYwfl != null and deptYwfl != ''"> and a.dept_ywfl = #{deptYwfl}</if>
<if test="djyjzfs != null "> and djyjzfs = #{djyjzfs}</if>
<if test="djyjkfs != null "> and djyjkfs = #{djyjkfs}</if>
<if test="djyjkfbl != null "> and djyjkfbl = #{djyjkfbl}</if>
<if test="djyjdf != null "> and djyjdf = #{djyjdf}</if>
<if test="sztszfs != null "> and sztszfs = #{sztszfs}</if>
<if test="sztskfs != null "> and sztskfs = #{sztskfs}</if>
<if test="sztsfbl != null "> and sztsfbl = #{sztsfbl}</if>
<if test="sztsdf != null "> and sztsdf = #{sztsdf}</if>
<if test="glgfzfs != null "> and glgfzfs = #{glgfzfs}</if>
<if test="glgfkfs != null "> and glgfkfs = #{glgfkfs}</if>
<if test="glgfbl != null "> and glgfbl = #{glgfbl}</if>
<if test="glgfdf != null "> and glgfdf = #{glgfdf}</if>
<if test="ywcxzfs != null "> and ywcxzfs = #{ywcxzfs}</if>
<if test="ywcxkfs != null "> and ywcxkfs = #{ywcxkfs}</if>
<if test="ywcxbl != null "> and ywcxbl = #{ywcxbl}</if>
<if test="ywcxdf != null "> and ywcxdf = #{ywcxdf}</if>
<if test="sffjxs != null "> and sffjxs = #{sffjxs}</if>
<if test="zkf != null "> and zkf = #{zkf}</if>
<if test="zkfbl != null "> and zkfbl = #{zkfbl}</if>
<if test="zdf != null "> and zdf = #{zdf}</if>
<if test="zhdf != null "> and zhdf = #{zhdf}</if>
<if test="yl1 != null and yl1 != ''"> and yl1 = #{yl1}</if>
<if test="yl2 != null and yl2 != ''"> and yl2 = #{yl2}</if>
<if test="yl3 != null and yl3 != ''"> and yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and yl5 = #{yl5}</if>
<if test="pm != null and pm != ''"> and pm = #{pm}</if>
<if test="zt != null and zt != ''"> and a.zt = #{zt}</if>
<if test="fdjb != null and fdjb != ''"> and fdjb = #{fdjb}</if>
<if test="df != null "> and zdf &lt;= #{df}</if>
<if test="kfbl != null "> and zkfbl >= #{kfbl}</if>
<if test="fjx != null and fjx.toString()=='1'.toString() "> and sffjxs >= #{fjx}</if>
<if test="fjx != null and fjx.toString()=='0'.toString() "> and sffjxs = #{fjx}</if>
</where>
order by p.order_num, a.pm,a.zhdf desc
</select>
</mapper>
\ No newline at end of file
......@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="yl4" column="yl4" />
<result property="yl5" column="yl5" />
<result property="deptName" column="dept_name" />
<result property="parentId" column="parent_id" />
</resultMap>
<resultMap id="SjLhscSjLhscWtResult" type="SjLhsc" extends="SjLhscResult">
......@@ -283,4 +284,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.id}, #{item.lhscId}, #{item.wt}, #{item.remark}, #{item.yl1}, #{item.yl2}, #{item.yl3}, #{item.yl4}, #{item.yl5})
</foreach>
</insert>
<select id="selectSjLhscList_main" parameterType="SjLhsc" resultMap="SjLhscResult">
select id, hymc, hyrq,
a.dept_id, hydd, chry,
yxqk, jjwt, czwt, tgjy,
ldyq, zt, a.dwjb, tjr, tjrq,
a.create_by, a.create_time, a.update_by,
a.update_time, remark, yl1, yl2, yl3, yl4, yl5,d.dept_name from sj_lhsc a
left join sys_dept d on a.dept_id=d.dept_id
<where>
<if test="hymc != null and hymc != ''"> and hymc like concat('%', #{hymc}, '%')</if>
<if test="hyrq != null and hyrq != ''"> and hyrq = #{hyrq}</if>
<if test="deptId != null and deptId != ''"> and a.dept_id = #{deptId}</if>
<if test="parentId != null and parentId != ''"> AND d.parent_id = #{parentId} </if>
<if test="hydd != null and hydd != ''"> and hydd = #{hydd}</if>
<if test="chry != null and chry != ''"> and chry = #{chry}</if>
<if test="yxqk != null and yxqk != ''"> and yxqk = #{yxqk}</if>
<if test="jjwt != null and jjwt != ''"> and jjwt = #{jjwt}</if>
<if test="czwt != null and czwt != ''"> and czwt = #{czwt}</if>
<if test="tgjy != null and tgjy != ''"> and tgjy = #{tgjy}</if>
<if test="ldyq != null and ldyq != ''"> and ldyq = #{ldyq}</if>
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
<if test="dwjb != null and dwjb != ''"> and a.dwjb = #{dwjb}</if>
<if test="tjr != null and tjr != ''"> and tjr = #{tjr}</if>
<if test="tjrq != null and tjrq != ''"> and tjrq = #{tjrq}</if>
<if test="yl1 != null and yl1 != ''"> and yl1 = #{yl1}</if>
<if test="yl2 != null and yl2 != ''"> and yl2 = #{yl2}</if>
<if test="yl3 != null and yl3 != ''"> and yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and yl5 = #{yl5}</if>
<if test="startJd !=null and startJd !=''"> and DATE_FORMAT(hyrq,'%Y-%m')>=#{startJd} </if>
<if test="endJd !=null and endJd !=''"> and DATE_FORMAT(hyrq,'%Y-%m')&lt;=#{endJd} </if>
</where>
order by hyrq desc
</select>
</mapper>
\ No newline at end of file
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