全所统计

This commit is contained in:
zhangqinlin
2021-09-18 16:03:08 +08:00
parent 22d4c94cda
commit 4a826ea8eb
3 changed files with 26 additions and 21 deletions
@@ -17,7 +17,7 @@ public interface constant {
/** /**
* 用户角色(科长) * 用户角色(科长)
*/ */
public static final String KZ="kz"; public static final String BMFZR="bmfzr";
/** /**
* 用户角色(所领导) * 用户角色(所领导)
@@ -25,9 +25,14 @@ public interface constant {
public static final String SLD="sld"; public static final String SLD="sld";
/** /**
* 用户角色(职员) * 超级管理员
*/ */
public static final String ZY="zy"; public static final String ADMIN="admin";
/**
* 用户角色(企业人员)
*/
public static final String QYRY="qyry";
} }
@@ -76,21 +76,23 @@ public class PayWorkingGroupStatisticsController {
String year = String.valueOf(calendar.get(Calendar.YEAR)); String year = String.valueOf(calendar.get(Calendar.YEAR));
payWorkingGroupSearch.setYear(year); payWorkingGroupSearch.setYear(year);
} }
String jointo=null; //根据不同角色加载不同列表的参数
//判断登录角色,显示特定工作组内容 String joint=null;
//判断登录角色,显示特定工作组内容,判断依据为登录用户的角色和机构编码
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
String roleCode = sysUser.getRoleCode(); String roleCode = sysUser.getRoleCode();
if(constant.KZ.equals(roleCode)) { //部门负责人
String orgCode = sysUser.getOrgCode(); if(constant.BMFZR.equals(roleCode)) {
List<SysUser> userList = userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", orgCode)); joint=sysUser.getId();
List<String> list = userList.stream().map(SysUser::getId).collect(Collectors.toList()); //所领导或者超级管理员
jointo = String.join(",", list); } else if (constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
} else if (constant.SLD.equals(roleCode)) { joint = null;
jointo = null; //企业职员
}else if( constant.ZY.equals(roleCode)){ }else if( constant.QYRY.equals(roleCode)){
jointo= sysUser.getId(); return Result.OK("无权限");
//超级管理员
} }
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch,jointo); IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch,joint);
List<PayWorkingGroupStatistics> records = pageList.getRecords(); List<PayWorkingGroupStatistics> records = pageList.getRecords();
//去除项目下来款金额为零的工作组 //去除项目下来款金额为零的工作组
ArrayList<PayWorkingGroupStatistics> list = new ArrayList<>(); ArrayList<PayWorkingGroupStatistics> list = new ArrayList<>();
@@ -110,16 +110,14 @@
CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate CONCAT(CAST(ROUND((pwgs.comeAllMoney/pwgs.allMoney)*100,2) AS CHAR),'%') AS moneyRate
FROM pay_working_group pwg left join (select id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney FROM pay_working_group pwg left join (select id,working_group_id,SUM(receivable_amount) AS allMoney,SUM(paid_amount) AS comeAllMoney
from pay_working_group_subitem from pay_working_group_subitem
<where>
<if test="joint != null and joint != ''">
working_group_id in (joint)
</if>
</where>
GROUP BY working_group_id) pwgs on(pwg.id=pwgs.working_group_id) GROUP BY working_group_id) pwgs on(pwg.id=pwgs.working_group_id)
left join pay_payment_record ppr on(pwgs.id=ppr.project_id) left join pay_payment_record ppr on(pwgs.id=ppr.project_id)
<where> <where>
<if test="joint != null and joint != ''">
pwg.principal_id_a =#{joint}
</if>
<if test="payWorkingGroupSearch.workGroup != null and payWorkingGroupSearch.workGroup != ''"> <if test="payWorkingGroupSearch.workGroup != null and payWorkingGroupSearch.workGroup != ''">
AND pwg.working_group_project LIKE concat('%',concat(#{payWorkingGroupSearch.workGroup},'%')) pwg.working_group_project LIKE concat('%',concat(#{payWorkingGroupSearch.workGroup},'%'))
</if> </if>
<if test="payWorkingGroupSearch.year != null and payWorkingGroupSearch.year != ''"> <if test="payWorkingGroupSearch.year != null and payWorkingGroupSearch.year != ''">
AND date_format(ppr.payment_date,'%Y-%m-%d') LIKE concat('%',concat(#{payWorkingGroupSearch.year},'%')) AND date_format(ppr.payment_date,'%Y-%m-%d') LIKE concat('%',concat(#{payWorkingGroupSearch.year},'%'))