@@ -24,4 +24,9 @@ public interface UserInfoHelper { | |||||
String getUserName(Long userId); | String getUserName(Long userId); | ||||
/** | |||||
* 判断该用户是否是区管或者超管 | |||||
* @return | |||||
*/ | |||||
boolean isAdmin(Long userId); | |||||
} | } |
@@ -37,4 +37,15 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||||
String realName = userFullInfo.getRealName(); | String realName = userFullInfo.getRealName(); | ||||
return realName; | return realName; | ||||
} | } | ||||
/** | |||||
* 判断此人是否是超管或者区管 | |||||
* @param userId | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public boolean isAdmin(Long userId) { | |||||
//测试 先返回true | |||||
return Boolean.TRUE; | |||||
} | |||||
} | } |
@@ -234,9 +234,17 @@ public class DefaultDeclaredProjectManage { | |||||
} | } | ||||
} | } | ||||
public DeclaredProjectStatisticsPO declaredProjectStatistics(Integer year){ | |||||
//根据提交者的单位 | |||||
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year){ | |||||
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | ||||
//查此人建设单位的项目 | //查此人建设单位的项目 | ||||
return statisticsService.getStatistics(userInfo.getOrganizationCode(),year); | |||||
return statisticsService.getOrgStatistics(userInfo.getOrganizationCode(),year); | |||||
} | |||||
//根据提交者的区域 他是区管或者超管 | |||||
public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year){ | |||||
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | |||||
//查此人建设单位的项目 | |||||
return statisticsService.getRegionStatistics(userInfo.getRegionCode(),year); | |||||
} | } | ||||
} | } |
@@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Param; | |||||
*/ | */ | ||||
public interface DeclaredStatisticsMapper extends BaseMapper { | public interface DeclaredStatisticsMapper extends BaseMapper { | ||||
DeclaredProjectStatisticsPO getStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); | |||||
DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); | |||||
DeclaredProjectStatisticsPO getRegionStatistics(@Param("regionCode") String regionCode,@Param("year") Integer year); | |||||
} | } |
@@ -2,7 +2,7 @@ | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||
<mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.DeclaredStatisticsMapper"> | <mapper namespace="com.ningdatech.pmapi.projectdeclared.mapper.DeclaredStatisticsMapper"> | ||||
<select id="getStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | |||||
<select id="getOrgStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | |||||
SELECT | SELECT | ||||
count(0) totalNum, | count(0) totalNum, | ||||
count(CASE WHEN p.project_type = 1 THEN 1 end) buildNum, | count(CASE WHEN p.project_type = 1 THEN 1 end) buildNum, | ||||
@@ -19,4 +19,20 @@ | |||||
WHERE build_org_code = #{orgCode} and project_year = #{year} | WHERE build_org_code = #{orgCode} and project_year = #{year} | ||||
</select> | </select> | ||||
<select id="getRegionStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | |||||
SELECT | |||||
count(0) totalNum, | |||||
count(CASE WHEN p.project_type = 1 THEN 1 end) buildNum, | |||||
count(CASE WHEN p.project_type = 2 THEN 1 end) operationNum, | |||||
count(CASE WHEN p.stage = 10000 THEN 1 end) notApprovedNum, | |||||
count(CASE WHEN p.stage = 20000 THEN 1 end) approvedNum, | |||||
count(CASE WHEN p.stage = 20000 AND p.status = 20002 THEN 1 end) constructionNum, | |||||
count(CASE WHEN p.stage = 20000 AND p.status = 20003 THEN 1 end) tobeInspectedNum, | |||||
count(CASE WHEN p.stage = 30000 THEN 1 end) archivedNum, | |||||
sum(p.declare_amount) declaredAmount, | |||||
sum(p.approval_amount) approvalAmount | |||||
FROM | |||||
nd_project p | |||||
WHERE area_code = #{regionCode} and project_year = #{year} | |||||
</select> | |||||
</mapper> | </mapper> |
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO | |||||
*/ | */ | ||||
public interface IDeclaredStatisticsService { | public interface IDeclaredStatisticsService { | ||||
DeclaredProjectStatisticsPO getStatistics(String orgCode,Integer year); | |||||
DeclaredProjectStatisticsPO getOrgStatistics(String organizationCode, Integer year); | |||||
DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year); | |||||
} | } |
@@ -21,12 +21,22 @@ public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService | |||||
private final DeclaredStatisticsMapper declaredStatisticsMapper; | private final DeclaredStatisticsMapper declaredStatisticsMapper; | ||||
/** | /** | ||||
* 根据userId 去查询 申报项目统计 | |||||
* 根据userId 去查询 申报项目统计 根据单位 | |||||
* @param orgCode | * @param orgCode | ||||
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public DeclaredProjectStatisticsPO getStatistics(String orgCode,Integer year) { | |||||
return declaredStatisticsMapper.getStatistics(orgCode,year); | |||||
public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode,Integer year) { | |||||
return declaredStatisticsMapper.getOrgStatistics(orgCode,year); | |||||
} | |||||
/** | |||||
* 根据userId 去查询 申报项目统计 根据区域 | |||||
* @param regionCode | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year) { | |||||
return declaredStatisticsMapper.getRegionStatistics(regionCode,year); | |||||
} | } | ||||
} | } |
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.workbench.manage; | |||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||||
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | ||||
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | ||||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | ||||
@@ -43,6 +44,8 @@ public class WorkbenchManage { | |||||
private final NoticeManage noticeManage; | private final NoticeManage noticeManage; | ||||
private final UserInfoHelper userInfoHelper; | |||||
public WorkbenchVO getWorkbenchData(Integer year){ | public WorkbenchVO getWorkbenchData(Integer year){ | ||||
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | UserInfoDetails userInfo = LoginUserUtil.loginUserDetail(); | ||||
WorkbenchVO res = new WorkbenchVO(); | WorkbenchVO res = new WorkbenchVO(); | ||||
@@ -57,7 +60,10 @@ public class WorkbenchManage { | |||||
res.setTodoCerter(statisticsVO); | res.setTodoCerter(statisticsVO); | ||||
//2.项目统计数据 | //2.项目统计数据 | ||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectStatistics(year))); | |||||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year))); | |||||
if(userInfoHelper.isAdmin(userInfo.getUserId())){ | |||||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year))); | |||||
} | |||||
ProjectListReq projectListReq = new ProjectListReq(); | ProjectListReq projectListReq = new ProjectListReq(); | ||||
projectListReq.setPageNumber(1); | projectListReq.setPageNumber(1); | ||||
projectListReq.setPageSize(5); | projectListReq.setPageSize(5); | ||||