17 changed files with 964 additions and 0 deletions
@ -0,0 +1,17 @@ |
|||||
|
package com.epmet.project.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目 |
||||
|
**/ |
||||
|
public interface ProjectConstant { |
||||
|
|
||||
|
String DATE = "date"; |
||||
|
String MONTH = "month"; |
||||
|
|
||||
|
/** |
||||
|
* 根据Token获取组织信息失败 |
||||
|
*/ |
||||
|
String GET_AGENCYID = "根据Token获取组织信息失败"; |
||||
|
|
||||
|
} |
@ -0,0 +1,182 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.project.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据,每日定时执行,先删后增 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-06-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class FactAgencyProjectDailyDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id 【dim_customer.id】 |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 机关Id 【dim_agency.id】 |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 上级组织Id【dim_agency.pid】 |
||||
|
*/ |
||||
|
private String parentId; |
||||
|
|
||||
|
/** |
||||
|
* 日维度Id 【dim_date.id】 |
||||
|
*/ |
||||
|
private String dateId; |
||||
|
|
||||
|
/** |
||||
|
* 周维度Id 【dim_week.id】 |
||||
|
*/ |
||||
|
private String weekId; |
||||
|
|
||||
|
/** |
||||
|
* 月维度Id 【dim_month.id】 |
||||
|
*/ |
||||
|
private String monthId; |
||||
|
|
||||
|
/** |
||||
|
* 季ID |
||||
|
*/ |
||||
|
private String quarterId; |
||||
|
|
||||
|
/** |
||||
|
* 年维度Id 【dim_year.id】 |
||||
|
*/ |
||||
|
private String yearId; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日项目总数 【当前组织及下级项目总数】 |
||||
|
*/ |
||||
|
private Integer projectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日处理中项目数 【当前组织及下级所有未结案项目总数】 |
||||
|
*/ |
||||
|
private Integer pendingTotal; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日处理中项目占比 【当前组织及下级未结案项目百分比(存百分比数,小数点后两位)】 |
||||
|
*/ |
||||
|
private BigDecimal pendingRatio; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案项目数 【当前组织及下级已结案项目总数】 |
||||
|
*/ |
||||
|
private Integer closedTotal; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案项目占比 【当前组织及下级已结案项目百分比(存百分比数,小数点后两位)】 |
||||
|
*/ |
||||
|
private BigDecimal closedRatio; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案中已解决项目数 【当前组织及下级已结案项目中已解决总数】 |
||||
|
*/ |
||||
|
private Integer resolvedTotal; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案中已解决项目占比 【当前组织及下级已结案项目中已解决占比】 |
||||
|
*/ |
||||
|
private BigDecimal resolvedRatio; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案中未解决项目数 【当前组织及下级已结案项目中未解决总数】 |
||||
|
*/ |
||||
|
private Integer unresolvedTotal; |
||||
|
|
||||
|
/** |
||||
|
* 截止当日已结案中未解决项目占比 【当前组织及下级已结案项目中未解决占比】 |
||||
|
*/ |
||||
|
private BigDecimal unresolvedRatio; |
||||
|
|
||||
|
/** |
||||
|
* 当日项目总数 【当前组织及下级项目总数】 |
||||
|
*/ |
||||
|
private Integer projectIncr; |
||||
|
|
||||
|
/** |
||||
|
* 当日处理中项目数 【当前组织及下级前一日新增处理中项目数】 |
||||
|
*/ |
||||
|
private Integer pendingIncr; |
||||
|
|
||||
|
/** |
||||
|
* 当日已结案项目数 【当前组织及下级前一日新增结案项目数】 |
||||
|
*/ |
||||
|
private Integer closedIncr; |
||||
|
|
||||
|
/** |
||||
|
* 当日已结案项目中已解决数 【当前组织及下级前一日新增结案中已解决项目数】 |
||||
|
*/ |
||||
|
private Integer resolvedIncr; |
||||
|
|
||||
|
/** |
||||
|
* 当日已结案项目组未解决数 【当前组织及下级前一日新增结案中未解决项目数】 |
||||
|
*/ |
||||
|
private Integer unresolvedIncr; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 【0.未删除 1.已删除】 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.epmet.project.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-日/月数据查询-接口入参 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ProjectIncrTrendFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = -4929038359220814068L; |
||||
|
|
||||
|
public interface ProjectIncr { |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 类型 month:代表月 date:代表日 |
||||
|
*/ |
||||
|
@NotBlank(message = "month / date 类型不能为空", groups = {ProjectIncr.class}) |
||||
|
private String type; |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据-接口返参 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class ProjectIncrTrendResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8529179932504931368L; |
||||
|
|
||||
|
/** |
||||
|
* 日期(2020/1/1;2020/1/2...) |
||||
|
*/ |
||||
|
private String date; |
||||
|
|
||||
|
/** |
||||
|
* 类型对应数量 |
||||
|
*/ |
||||
|
private Integer value; |
||||
|
|
||||
|
/** |
||||
|
* 类型名称(处理中;已结案) |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据-接口返参 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class ProjectSubAgencyResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8529179932504931368L; |
||||
|
|
||||
|
/** |
||||
|
* 机关Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 机关名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 不同类型对应数据 |
||||
|
*/ |
||||
|
private Integer value; |
||||
|
|
||||
|
/** |
||||
|
* 类型名称(处理中;已结案) |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据-接口返参 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class ProjectSubGridResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8529179932504931368L; |
||||
|
|
||||
|
/** |
||||
|
* 机关Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 机关名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 不同类型对应数据 |
||||
|
*/ |
||||
|
private Integer value; |
||||
|
|
||||
|
/** |
||||
|
* 类型名称(处理中;已结案) |
||||
|
*/ |
||||
|
private String type; |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据-接口返参 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class ProjectSummaryInfoResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8529179932504931368L; |
||||
|
|
||||
|
/** |
||||
|
* 类型名称(处理中;已结案) |
||||
|
*/ |
||||
|
private String name; |
||||
|
|
||||
|
/** |
||||
|
* 类型对应数量 |
||||
|
*/ |
||||
|
private Integer value; |
||||
|
|
||||
|
/** |
||||
|
* 类型对应百分比(10% 10.1% 10.01%小数点后两位) |
||||
|
*/ |
||||
|
private String ratio; |
||||
|
|
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.epmet.project.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-汇总数据-接口返参 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class ProjectSummaryResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 8529179932504931368L; |
||||
|
|
||||
|
/** |
||||
|
* 机关Id |
||||
|
*/ |
||||
|
private String agencyId; |
||||
|
|
||||
|
/** |
||||
|
* 项目总数 |
||||
|
*/ |
||||
|
private Integer projectTotal; |
||||
|
|
||||
|
/** |
||||
|
* 更新日期 |
||||
|
*/ |
||||
|
private String dateName; |
||||
|
|
||||
|
/** |
||||
|
* 处理中总数 |
||||
|
*/ |
||||
|
private Integer pendingTotal; |
||||
|
|
||||
|
/** |
||||
|
* 处理中占比 |
||||
|
*/ |
||||
|
private String pendingRatio; |
||||
|
|
||||
|
/** |
||||
|
* 已结案总数 |
||||
|
*/ |
||||
|
private Integer closedTotal; |
||||
|
|
||||
|
/** |
||||
|
* 已结案占比 |
||||
|
*/ |
||||
|
private String closedRatio; |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.epmet.module.project.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.module.project.service.ProjectService; |
||||
|
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; |
||||
|
import com.epmet.project.dto.result.*; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目 |
||||
|
**/ |
||||
|
@RestController |
||||
|
@RequestMapping("project") |
||||
|
public class ProjectController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectService projectService; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取汇总数据 |
||||
|
**/ |
||||
|
@PostMapping("projectsummary") |
||||
|
public Result<ProjectSummaryResultDTO> projectSummary(@LoginUser TokenDto tokenDto) { |
||||
|
return new Result<ProjectSummaryResultDTO>().ok(projectService.getProjectSummary(tokenDto)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据 |
||||
|
**/ |
||||
|
@PostMapping("summaryinfo") |
||||
|
public Result<List<ProjectSummaryInfoResultDTO>> summaryInfo(@LoginUser TokenDto tokenDto) { |
||||
|
return new Result<List<ProjectSummaryInfoResultDTO>>().ok(projectService.getSummaryInfo(tokenDto)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取下级组织柱状图数据 |
||||
|
**/ |
||||
|
@PostMapping("subagency") |
||||
|
public Result<List<ProjectSubAgencyResultDTO>> subAgency(@LoginUser TokenDto tokenDto) { |
||||
|
return new Result<List<ProjectSubAgencyResultDTO>>().ok(projectService.getSubAgency(tokenDto)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取机关直属网格项目数据 |
||||
|
**/ |
||||
|
@PostMapping("subgrid") |
||||
|
public Result<List<ProjectSubGridResultDTO>> subGrid(@LoginUser TokenDto tokenDto) { |
||||
|
return new Result<List<ProjectSubGridResultDTO>>().ok(projectService.getSubGrid(tokenDto)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-日/月数据查询 |
||||
|
**/ |
||||
|
@PostMapping("incrtrend") |
||||
|
public Result<List<ProjectIncrTrendResultDTO>> incrTrend(@LoginUser TokenDto tokenDto, @RequestBody ProjectIncrTrendFormDTO formDTO) { |
||||
|
ValidatorUtils.validateEntity(formDTO, ProjectIncrTrendFormDTO.ProjectIncr.class); |
||||
|
return new Result<List<ProjectIncrTrendResultDTO>>().ok(projectService.getProjectIncrTrend(tokenDto,formDTO)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.epmet.module.project.dao; |
||||
|
|
||||
|
import com.epmet.project.dto.FactAgencyProjectDailyDTO; |
||||
|
import com.epmet.project.dto.result.*; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目 |
||||
|
**/ |
||||
|
@Mapper |
||||
|
public interface ProjectDao { |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取汇总数据 |
||||
|
**/ |
||||
|
ProjectSummaryResultDTO selectProjectSummary(@Param("agencyId") String agencyId); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取汇总数据 |
||||
|
**/ |
||||
|
List<ProjectSummaryInfoResultDTO> selectSummaryInfo(@Param("agencyId") String agencyId); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 查询组织最近日期的日统计数据 |
||||
|
**/ |
||||
|
FactAgencyProjectDailyDTO selectAgencyProjectDaily(@Param("agencyId") String agencyId); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取最近日期下级组织柱状图数据(按项目总量降序) |
||||
|
**/ |
||||
|
List<ProjectSubAgencyResultDTO> selectSubAgency(FactAgencyProjectDailyDTO agencyProjectDailyDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 查询机关下直属网格最近一天的日统计数据,按项目总数降序 |
||||
|
**/ |
||||
|
List<ProjectSubGridResultDTO> selectSubGrid(FactAgencyProjectDailyDTO agencyProjectDailyDTO); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 查询机关日统计近九十天数据 |
||||
|
**/ |
||||
|
List<ProjectIncrTrendResultDTO> selectIncrTrendDaily(@Param("agencyId") String agencyId); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 查询机关月统计近十二个月数据 |
||||
|
**/ |
||||
|
List<ProjectIncrTrendResultDTO> selectIncrTrendMonthly(@Param("agencyId") String agencyId); |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.epmet.module.project.service; |
||||
|
|
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; |
||||
|
import com.epmet.project.dto.result.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目 |
||||
|
**/ |
||||
|
public interface ProjectService { |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取汇总数据 |
||||
|
**/ |
||||
|
ProjectSummaryResultDTO getProjectSummary(TokenDto tokenDto); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据 |
||||
|
**/ |
||||
|
List<ProjectSummaryInfoResultDTO> getSummaryInfo(TokenDto tokenDto); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取下级组织柱状图数据 |
||||
|
**/ |
||||
|
List<ProjectSubAgencyResultDTO> getSubAgency(TokenDto tokenDto); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取机关直属网格项目数据 |
||||
|
**/ |
||||
|
List<ProjectSubGridResultDTO> getSubGrid(TokenDto tokenDto); |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-日/月数据查询 |
||||
|
**/ |
||||
|
List<ProjectIncrTrendResultDTO> getProjectIncrTrend(TokenDto tokenDto, ProjectIncrTrendFormDTO formDTO); |
||||
|
} |
@ -0,0 +1,150 @@ |
|||||
|
package com.epmet.module.project.service.impl; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.NumConstant; |
||||
|
import com.epmet.commons.tools.exception.RenException; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.dto.form.LoginUserDetailsFormDTO; |
||||
|
import com.epmet.dto.result.LoginUserDetailsResultDTO; |
||||
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
||||
|
import com.epmet.module.project.dao.ProjectDao; |
||||
|
import com.epmet.module.project.service.ProjectService; |
||||
|
import com.epmet.project.constant.ProjectConstant; |
||||
|
import com.epmet.project.dto.FactAgencyProjectDailyDTO; |
||||
|
import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; |
||||
|
import com.epmet.project.dto.result.*; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class ProjectServiceImpl implements ProjectService { |
||||
|
|
||||
|
@Autowired |
||||
|
private ProjectDao projectDao; |
||||
|
@Autowired |
||||
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取汇总数据 |
||||
|
**/ |
||||
|
@Override |
||||
|
public ProjectSummaryResultDTO getProjectSummary(TokenDto tokenDto) { |
||||
|
//1:根据token获取agencyId
|
||||
|
String agencyId = getLoginUserDetails(tokenDto); |
||||
|
|
||||
|
//2:根据agencyId查询项目统计数据
|
||||
|
ProjectSummaryResultDTO resultDTO = projectDao.selectProjectSummary(agencyId); |
||||
|
if (null != resultDTO) { |
||||
|
resultDTO.setPendingRatio(resultDTO.getPendingRatio() + "%"); |
||||
|
resultDTO.setClosedRatio(resultDTO.getClosedRatio() + "%"); |
||||
|
} |
||||
|
return resultDTO; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取组织下饼图数据 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<ProjectSummaryInfoResultDTO> getSummaryInfo(TokenDto tokenDto) { |
||||
|
List<ProjectSummaryInfoResultDTO> resultList = new ArrayList<>(); |
||||
|
//1:根据token获取agencyId
|
||||
|
String agencyId = getLoginUserDetails(tokenDto); |
||||
|
|
||||
|
//2:根据agencyId查询各状态统计数据
|
||||
|
resultList = projectDao.selectSummaryInfo(agencyId); |
||||
|
if (null != resultList && resultList.size() > NumConstant.ZERO) { |
||||
|
resultList.forEach(sum -> { |
||||
|
sum.setRatio(sum.getRatio() + "%"); |
||||
|
}); |
||||
|
} |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取下级组织柱状图数据 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<ProjectSubAgencyResultDTO> getSubAgency(TokenDto tokenDto) { |
||||
|
List<ProjectSubAgencyResultDTO> resultList = new ArrayList<>(); |
||||
|
//1:根据token获取agencyId
|
||||
|
String agencyId = getLoginUserDetails(tokenDto); |
||||
|
|
||||
|
//2:根据机关Id查询最近日期的日统计数据
|
||||
|
FactAgencyProjectDailyDTO agencyProjectDailyDTO = projectDao.selectAgencyProjectDaily(agencyId); |
||||
|
if (null == agencyProjectDailyDTO) { |
||||
|
return resultList; |
||||
|
} |
||||
|
//2:获取当前组织最近日期的直属下级组织项目统计数据,按项目总量降序
|
||||
|
resultList = projectDao.selectSubAgency(agencyProjectDailyDTO); |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-获取机关直属网格项目数据 |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<ProjectSubGridResultDTO> getSubGrid(TokenDto tokenDto) { |
||||
|
List<ProjectSubGridResultDTO> resultList = new ArrayList<>(); |
||||
|
//1:根据token获取agencyId
|
||||
|
String agencyId = getLoginUserDetails(tokenDto); |
||||
|
|
||||
|
//2:根据机关Id查询最近日期的日统计数据
|
||||
|
FactAgencyProjectDailyDTO agencyProjectDailyDTO = projectDao.selectAgencyProjectDaily(agencyId); |
||||
|
if (null == agencyProjectDailyDTO) { |
||||
|
return resultList; |
||||
|
} |
||||
|
//2:获取当前组织最近日期的直属下级组织项目统计数据,按项目总量降序
|
||||
|
resultList = projectDao.selectSubGrid(agencyProjectDailyDTO); |
||||
|
return resultList; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Author sun |
||||
|
* @Description 数据-项目-日/月数据查询(日查询进九十天数据,月查询进十二个月数据) |
||||
|
**/ |
||||
|
@Override |
||||
|
public List<ProjectIncrTrendResultDTO> getProjectIncrTrend(TokenDto tokenDto, ProjectIncrTrendFormDTO formDTO) { |
||||
|
List<ProjectIncrTrendResultDTO> resultList = new ArrayList<>(); |
||||
|
//1:根据token获取agencyId
|
||||
|
String agencyId = getLoginUserDetails(tokenDto); |
||||
|
|
||||
|
//2:查询机关过去九十天日统计数据(sql降序取前九十条)
|
||||
|
if (ProjectConstant.DATE.equals(formDTO.getType())){ |
||||
|
resultList = projectDao.selectIncrTrendDaily(agencyId); |
||||
|
} |
||||
|
|
||||
|
//3:查询机关过去十二个月月统计数据
|
||||
|
if (ProjectConstant.MONTH.equals(formDTO.getType())) { |
||||
|
resultList = projectDao.selectIncrTrendMonthly(agencyId); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @author sun |
||||
|
* @Description 获取机关ID |
||||
|
*/ |
||||
|
private String getLoginUserDetails(TokenDto tokenDto) { |
||||
|
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); |
||||
|
BeanUtils.copyProperties(tokenDto, dto); |
||||
|
LoginUserDetailsResultDTO data = epmetUserOpenFeignClient.getLoginUserDetails(dto).getData(); |
||||
|
String agencyId = data.getAgencyId(); |
||||
|
if (null == agencyId || "".equals(agencyId)) { |
||||
|
throw new RenException(ProjectConstant.GET_AGENCYID); |
||||
|
} |
||||
|
return agencyId; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,228 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.module.project.dao.ProjectDao"> |
||||
|
|
||||
|
|
||||
|
<select id="selectProjectSummary" resultType="com.epmet.project.dto.result.ProjectSummaryResultDTO"> |
||||
|
SELECT |
||||
|
agency_id AS "agencyId", |
||||
|
project_total AS "projectTotal", |
||||
|
DATE_FORMAT(date_id, '%Y.%m.%d') AS "dateName", |
||||
|
pending_total AS "pendingTotal", |
||||
|
CAST(pending_ratio AS DECIMAL (9, 2)) AS "pendingRatio", |
||||
|
closed_total AS "closedTotal", |
||||
|
CAST(closed_ratio AS DECIMAL(9, 2)) AS "closedRatio" |
||||
|
FROM |
||||
|
fact_agency_project_daily |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY date_id DESC |
||||
|
LIMIT 1 |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSummaryInfo" resultType="com.epmet.project.dto.result.ProjectSummaryInfoResultDTO"> |
||||
|
( |
||||
|
SELECT |
||||
|
"处理中" AS "name", |
||||
|
pending_total AS "value", |
||||
|
CAST(PENDING_RATIO AS DECIMAL (9, 2)) AS "ratio" |
||||
|
FROM |
||||
|
fact_agency_project_daily |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
date_id DESC |
||||
|
LIMIT 1 |
||||
|
) |
||||
|
UNION ALL |
||||
|
( |
||||
|
SELECT |
||||
|
"已结案" AS "name", |
||||
|
closed_total AS "value", |
||||
|
CAST(closed_ratio AS DECIMAL(9, 2)) AS "ratio" |
||||
|
FROM |
||||
|
fact_agency_project_daily |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
date_id DESC |
||||
|
LIMIT 1 |
||||
|
) |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectAgencyProjectDaily" resultType="com.epmet.project.dto.FactAgencyProjectDailyDTO"> |
||||
|
SELECT |
||||
|
id, |
||||
|
customer_id, |
||||
|
agency_id, |
||||
|
parent_id, |
||||
|
date_id, |
||||
|
week_id, |
||||
|
month_id, |
||||
|
quarter_id, |
||||
|
year_id |
||||
|
FROM |
||||
|
fact_agency_project_daily fapd |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
date_id DESC |
||||
|
LIMIT 1 |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSubAgency" resultType="com.epmet.project.dto.result.ProjectSubAgencyResultDTO"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM ( |
||||
|
( |
||||
|
SELECT |
||||
|
da.id AS "agencyId", |
||||
|
da.agency_name AS "name", |
||||
|
fapd.pending_total AS "value", |
||||
|
"处理中" AS "type", |
||||
|
fapd.project_total |
||||
|
FROM |
||||
|
fact_agency_project_daily fapd |
||||
|
LEFT JOIN dim_agency da ON fapd.agency_id = da.id |
||||
|
WHERE |
||||
|
fapd.del_flag = '0' |
||||
|
AND fapd.parent_id = #{agencyId} |
||||
|
AND fapd.date_id = #{dateId} |
||||
|
) |
||||
|
UNION ALL |
||||
|
( |
||||
|
SELECT |
||||
|
da.id AS "agencyId", |
||||
|
da.agency_name AS "name", |
||||
|
fapd.closed_total AS "value", |
||||
|
"已结案" AS "type", |
||||
|
fapd.project_total |
||||
|
FROM |
||||
|
fact_agency_project_daily fapd |
||||
|
LEFT JOIN dim_agency da ON fapd.agency_id = da.id |
||||
|
WHERE |
||||
|
fapd.del_flag = '0' |
||||
|
AND fapd.parent_id = #{agencyId} |
||||
|
AND fapd.date_id = #{dateId} |
||||
|
) |
||||
|
) a |
||||
|
ORDER BY |
||||
|
a.project_total DESC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSubGrid" resultType="com.epmet.project.dto.result.ProjectSubGridResultDTO"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM ( |
||||
|
( |
||||
|
SELECT |
||||
|
da.id AS "agencyId", |
||||
|
da.agency_name AS "name", |
||||
|
fgpd.pending_total AS "value", |
||||
|
"处理中" AS "type", |
||||
|
fgpd.project_total |
||||
|
FROM |
||||
|
fact_grid_project_daily fgpd |
||||
|
LEFT JOIN dim_agency da ON fgpd.agency_id = da.id |
||||
|
WHERE |
||||
|
fgpd.del_flag = '0' |
||||
|
AND fgpd.agency_id = #{agencyId} |
||||
|
AND fgpd.date_id = #{dateId} |
||||
|
) |
||||
|
UNION ALL |
||||
|
( |
||||
|
SELECT |
||||
|
da.id AS "agencyId", |
||||
|
da.agency_name AS "name", |
||||
|
fgpd.closed_total AS "value", |
||||
|
"已结案" AS "type", |
||||
|
fgpd.project_total |
||||
|
FROM |
||||
|
fact_grid_project_daily fgpd |
||||
|
LEFT JOIN dim_agency da ON fgpd.agency_id = da.id |
||||
|
WHERE |
||||
|
fgpd.del_flag = '0' |
||||
|
AND fgpd.agency_id = #{agencyId} |
||||
|
AND fgpd.date_id = #{dateId} |
||||
|
) |
||||
|
) a |
||||
|
ORDER BY |
||||
|
a.project_total DESC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectIncrTrendDaily" resultType="com.epmet.project.dto.result.ProjectIncrTrendResultDTO"> |
||||
|
SELECT * FROM( |
||||
|
( |
||||
|
SELECT |
||||
|
DATE_FORMAT(DATE_ID, "%Y/%m/%d") AS "date", |
||||
|
PENDING_INCR AS "value", |
||||
|
"处理中" AS "type" |
||||
|
FROM |
||||
|
fact_agency_project_daily |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
date_id DESC |
||||
|
LIMIT 90 |
||||
|
) |
||||
|
UNION ALL |
||||
|
( |
||||
|
SELECT |
||||
|
DATE_FORMAT(DATE_ID, "%Y/%m/%d") AS "date", |
||||
|
CLOSED_INCR AS "value", |
||||
|
"已结案" AS "type" |
||||
|
FROM |
||||
|
fact_agency_project_daily |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
date_id DESC |
||||
|
LIMIT 90 |
||||
|
) |
||||
|
) a ORDER BY a.DATE_ID DESC, a.type ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectIncrTrendMonthly" resultType="com.epmet.project.dto.result.ProjectIncrTrendResultDTO"> |
||||
|
SELECT * FROM( |
||||
|
( |
||||
|
SELECT |
||||
|
DATE_FORMAT(CONCAT(month_id,"00"), "%Y/%m") AS "date", |
||||
|
pending_incr AS "value", |
||||
|
"处理中" AS "type", |
||||
|
month_id |
||||
|
FROM |
||||
|
fact_agency_project_monthly |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
month_id DESC |
||||
|
LIMIT 12 |
||||
|
) |
||||
|
UNION ALL |
||||
|
( |
||||
|
SELECT |
||||
|
DATE_FORMAT(CONCAT(month_id,"00"), "%Y/%m") AS "date", |
||||
|
closed_incr AS "value", |
||||
|
"已结案" AS "type", |
||||
|
month_id |
||||
|
FROM |
||||
|
fact_agency_project_monthly |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND agency_id = #{agencyId} |
||||
|
ORDER BY |
||||
|
month_id DESC |
||||
|
LIMIT 12 |
||||
|
) |
||||
|
)a ORDER BY a.month_id DESC,a.type ASC |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue