Переглянути джерело

工作台接口

tags/24080901
PoffyZhang 1 рік тому
джерело
коміт
f15e2e7e29
8 змінених файлів з 67 додано та 9 видалено
  1. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java
  2. +11
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  3. +10
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.java
  5. +17
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.xml
  6. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IDeclaredStatisticsService.java
  7. +13
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java
  8. +7
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/UserInfoHelper.java Переглянути файл

@@ -24,4 +24,9 @@ public interface UserInfoHelper {

String getUserName(Long userId);

/**
* 判断该用户是否是区管或者超管
* @return
*/
boolean isAdmin(Long userId);
}

+ 11
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java Переглянути файл

@@ -37,4 +37,15 @@ public class UserInfoHelperImpl implements UserInfoHelper {
String realName = userFullInfo.getRealName();
return realName;
}

/**
* 判断此人是否是超管或者区管
* @param userId
* @return
*/
@Override
public boolean isAdmin(Long userId) {
//测试 先返回true
return Boolean.TRUE;
}
}

+ 10
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java Переглянути файл

@@ -234,9 +234,17 @@ public class DefaultDeclaredProjectManage {
}
}

public DeclaredProjectStatisticsPO declaredProjectStatistics(Integer year){
//根据提交者的单位
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year){
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);
}
}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.java Переглянути файл

@@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Param;
*/
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);
}

+ 17
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/mapper/DeclaredStatisticsMapper.xml Переглянути файл

@@ -2,7 +2,7 @@
<!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">

<select id="getStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO">
<select id="getOrgStatistics" resultType="com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO">
SELECT
count(0) totalNum,
count(CASE WHEN p.project_type = 1 THEN 1 end) buildNum,
@@ -19,4 +19,20 @@
WHERE build_org_code = #{orgCode} and project_year = #{year}
</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>

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/IDeclaredStatisticsService.java Переглянути файл

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO
*/
public interface IDeclaredStatisticsService {

DeclaredProjectStatisticsPO getStatistics(String orgCode,Integer year);
DeclaredProjectStatisticsPO getOrgStatistics(String organizationCode, Integer year);

DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year);
}

+ 13
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/service/impl/DeclaredStatisticsServiceImpl.java Переглянути файл

@@ -21,12 +21,22 @@ public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService
private final DeclaredStatisticsMapper declaredStatisticsMapper;

/**
* 根据userId 去查询 申报项目统计
* 根据userId 去查询 申报项目统计 根据单位
* @param orgCode
* @return
*/
@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);
}
}

+ 7
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java Переглянути файл

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.workbench.manage;

import cn.hutool.core.bean.BeanUtil;
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.DefaultDeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO;
@@ -43,6 +44,8 @@ public class WorkbenchManage {

private final NoticeManage noticeManage;

private final UserInfoHelper userInfoHelper;

public WorkbenchVO getWorkbenchData(Integer year){
UserInfoDetails userInfo = LoginUserUtil.loginUserDetail();
WorkbenchVO res = new WorkbenchVO();
@@ -57,7 +60,10 @@ public class WorkbenchManage {
res.setTodoCerter(statisticsVO);

//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.setPageNumber(1);
projectListReq.setPageSize(5);


Завантаження…
Відмінити
Зберегти