全所统计

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 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));
payWorkingGroupSearch.setYear(year);
}
String jointo=null;
//判断登录角色,显示特定工作组内容
//根据不同角色加载不同列表的参数
String joint=null;
//判断登录角色,显示特定工作组内容,判断依据为登录用户的角色和机构编码
LoginUser sysUser =(LoginUser) SecurityUtils.getSubject().getPrincipal();
String roleCode = sysUser.getRoleCode();
if(constant.KZ.equals(roleCode)) {
String orgCode = sysUser.getOrgCode();
List<SysUser> userList = userMapper.selectList(new QueryWrapper<SysUser>().eq("status", 1).eq("del_flag", 0).eq("org_code", orgCode));
List<String> list = userList.stream().map(SysUser::getId).collect(Collectors.toList());
jointo = String.join(",", list);
} else if (constant.SLD.equals(roleCode)) {
jointo = null;
}else if( constant.ZY.equals(roleCode)){
jointo= sysUser.getId();
//部门负责人
if(constant.BMFZR.equals(roleCode)) {
joint=sysUser.getId();
//所领导或者超级管理员
} else if (constant.SLD.equals(roleCode)||constant.ADMIN.equals(roleCode)) {
joint = null;
//企业职员
}else if( constant.QYRY.equals(roleCode)){
return Result.OK("无权限");
//超级管理员
}
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch,jointo);
IPage<PayWorkingGroupStatistics> pageList = payWorkingGroupService.queryPageListForStatistics(page, payWorkingGroupSearch,joint);
List<PayWorkingGroupStatistics> records = pageList.getRecords();
//去除项目下来款金额为零的工作组
ArrayList<PayWorkingGroupStatistics> list = new ArrayList<>();
@@ -110,16 +110,14 @@
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_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)
left join pay_payment_record ppr on(pwgs.id=ppr.project_id)
<where>
<if test="joint != null and joint != ''">
pwg.principal_id_a =#{joint}
</if>
<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 test="payWorkingGroupSearch.year != null and payWorkingGroupSearch.year != ''">
AND date_format(ppr.payment_date,'%Y-%m-%d') LIKE concat('%',concat(#{payWorkingGroupSearch.year},'%'))