Ver código fonte

项目进度监控

shudonghui 1 ano atrás
pai
commit
8d1a6a7dff

+ 84 - 0
sop-api/src/main/java/com/qmth/sop/server/api/SopScheduleController.java

@@ -0,0 +1,84 @@
+package com.qmth.sop.server.api;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.annotation.Aac;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.service.SopScheduleService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.SopAnalyseGroupEnum;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.util.Map;
+
+/**
+ * 项目进度监控 控制器
+ *
+ * @author: shudonghui
+ * @date: 2023-08-14 15:55:18
+ * @version: 1.0
+ * @email: shudonghui@qmth.com.cn
+ * @Company: www.qmth.com.cn
+ */
+@Api(tags = "项目进度监控 Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/sop/schedule")
+public class SopScheduleController {
+
+
+    @Resource
+    SopScheduleService sopScheduleService;
+
+    /**
+     * 1.项目进度监控是对当前项目的执行阶段的分布和整体项目的完成情况进行不同维度的洞察;
+     * 2.动态查询条件:时间周期(年度等)、服务单元(已发布状态);
+     * 3.大区项目阶段分布及对比:
+     * ①准备:扫描前的准备阶段;
+     * ②扫描:扫描仪配置产出物提交,到扫描收尾产出物提交;
+     * ③评卷:阅卷参数提交、评卷收尾;
+     * ④收尾:项目总结提交前;
+     * ⑤已完结:SOP完结。
+     * ⑥全部大区进度展示;
+     * ⑦【数据下钻】点击大区行数据,可查看该服务单元下该大区下的SOP明细;
+     * 4.供应商项目阶段分布及对比
+     * 同上
+     * 5.项目进度阶段总体分布对比
+     * 服务单元下所有项目的进度阶段总体分布对比,各阶段统计解释同上。
+     */
+   
+    @ApiOperation(value = "项目阶段分布")
+    @RequestMapping(value = "/progress", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "项目阶段分布", response = Map.class)})
+    public Result progress(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceId,
+                           @ApiParam(value = "分组", required = true) @RequestParam SopAnalyseGroupEnum group) {
+        Map<String, Map<String, Object>> list = sopScheduleService.progress(serviceId, group);
+        return ResultUtil.ok(list);
+    }
+
+    /*
+    SOP明细
+     */
+   
+    @ApiOperation(value = "SOP明细")
+    @RequestMapping(value = "/detail", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "SOP明细", response = Map.class)})
+    public Result detail(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceId,
+                         @ApiParam(value = "大区") @RequestParam(required = false) String provence,
+                         @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId,
+                         @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                         @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        IPage<Map<String,Object>> resultIPage = sopScheduleService.detail(new Page<>(pageNumber, pageSize),serviceId, provence, supplierId);
+        return ResultUtil.ok(resultIPage);
+    }
+
+
+}

+ 25 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/SopScheduleMapper.java

@@ -0,0 +1,25 @@
+package com.qmth.sop.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.sop.business.entity.TBSopInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author dhshu
+ *
+ */
+public interface SopScheduleMapper extends BaseMapper<TBSopInfo> {
+
+
+    List<Map<String, Object>> progress(@Param("serviceId") Long serviceId);
+
+    <T> IPage<Map<String,Object>> detail(Page<T> tPage, @Param("serviceId")Long serviceId, @Param("provence") String provence, @Param("supplierId") Long supplierId);
+}

+ 17 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SopScheduleService.java

@@ -0,0 +1,17 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.entity.TBSopInfo;
+import com.qmth.sop.common.enums.SopAnalyseGroupEnum;
+
+import java.util.Map;
+
+public interface SopScheduleService extends IService<TBSopInfo> {
+
+
+    Map<String, Map<String, Object>> progress(Long serviceId, SopAnalyseGroupEnum group);
+
+    <T> IPage<Map<String,Object>> detail(Page<T> tPage, Long serviceId, String provence, Long supplierId);
+}

+ 54 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SopScheduleServiceImpl.java

@@ -0,0 +1,54 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.entity.TBSopInfo;
+import com.qmth.sop.business.mapper.SopScheduleMapper;
+import com.qmth.sop.business.service.SopScheduleService;
+import com.qmth.sop.common.enums.SopAnalyseGroupEnum;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class SopScheduleServiceImpl extends ServiceImpl<SopScheduleMapper, TBSopInfo> implements SopScheduleService {
+    /**
+     * * ①准备:扫描前的准备阶段;
+     * * ②扫描:扫描仪配置产出物提交,到扫描收尾产出物提交;
+     * * ③评卷:阅卷参数提交、评卷收尾;
+     * * ④收尾:项目总结提交前;
+     * * ⑤已完结:SOP完结。
+     */
+    @Override
+    public Map<String, Map<String, Object>> progress(Long serviceId, SopAnalyseGroupEnum group) {
+        List<Map<String, Object>> list = this.baseMapper.progress(serviceId);
+        Map<String, Map<String, Object>> result = new HashMap<>();
+        if (group.equals(SopAnalyseGroupEnum.POPULATION)) {
+            result.put("POPULATION", processData(list));
+        }
+        if (group.equals(SopAnalyseGroupEnum.REGION)) {
+            list.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> result.put(k.toString(), processData(v)));
+        } else if (group.equals(SopAnalyseGroupEnum.SUPPLIER)) {
+            list.stream().collect(Collectors.groupingBy(map -> map.get("name"))).forEach((k, v) -> result.put(k.toString(), processData(v)));
+        }
+        return result;
+    }
+
+    private Map<String, Object> processData(List<Map<String, Object>> list) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("prepare", list.stream().filter(map1 -> map1.get("setup") == null || (Integer.parseInt(map1.get("setup").toString()) > 0 && Integer.parseInt(map1.get("setup").toString()) < 5)).count());
+        map.put("scan", list.stream().filter(map1 -> map1.get("setup") != null && "5,6,7".indexOf(map1.get("setup").toString()) > 0).count());
+        map.put("evaluation", list.stream().filter(map1 -> map1.get("setup") != null && "8,9".indexOf(map1.get("setup").toString()) > 0).count());
+        map.put("summary", list.stream().filter(map1 -> map1.get("setup") != null && (Integer.parseInt(map1.get("setup").toString()) == 11 || Integer.parseInt(map1.get("setup").toString()) == 10)).count());
+        map.put("finish", list.stream().filter(map1 -> map1.get("setup") != null && Integer.parseInt(map1.get("setup").toString()) == 0).count());
+        return map;
+    }
+
+    @Override
+    public <T> IPage<Map<String, Object>> detail(Page<T> tPage, Long serviceId, String provence, Long supplierId) {
+        return this.baseMapper.detail(tPage, serviceId, provence, supplierId);
+    }
+
+}

+ 100 - 0
sop-business/src/main/resources/mapper/SopScheduleMapper.xml

@@ -0,0 +1,100 @@
+<?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.qmth.sop.business.mapper.SopScheduleMapper">
+    <select id="progress" resultType="java.util.Map">
+        SELECT DISTINCT
+        sc.province,
+        su.`name`,
+        tbsi.sop_no,
+        tffa.status,
+        tffa.setup,
+        CASE
+
+        WHEN tffa.STATUS = 'FINISH' THEN
+        '已完结'
+        WHEN tffa.STATUS = 'END' THEN
+        '已作废' ELSE '进行中'
+        END AS statusStr
+        FROM
+        t_b_sop_info tbsi
+        LEFT JOIN sys_custom sc ON sc.id = tbsi.custom_id
+        LEFT JOIN t_b_sop_info_detail id ON id.sop_info_id = tbsi.id
+        LEFT JOIN sys_user u ON u.id = id.lead_id
+        LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
+        LEFT JOIN sys_supplier su ON su.id = us.supplier_id
+        LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = tbsi.sop_no
+        LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
+        <where>
+
+            <if test="serviceId != null and serviceId != ''">
+                and  tbsi.service_id= #{serviceId}
+            </if>
+
+        </where>
+    </select>
+
+    <select id="detail" resultType="java.util.Map">
+        select distinct cast(tbsi.id as char) as id,
+        cast(tbs.id as char) as serviceId,
+        tbs.name as serviceName,
+        tbsi.sop_no as sopNo,
+        tbsi.crm_no as crmNo,
+        tbc.begin_time as beginTime,
+        cast(sc.manager_id as char) as customManagerId,
+        su1.real_name as customManagerName,
+        sc.type as customManagerType,
+        IF(sc.type = 'OFFICE','教务处','研究生') as customManagerTypeStr,
+        sc.name as customName,
+        tbc.name as crmName,
+        cast(tbp.id as char) as productId,
+        tbp.name as productName,
+        tbc.exam_start_time as examStartTime,
+        tbc.exam_end_time as examEndTime,
+        cast(tfcfe.flow_id as char) as flowId,
+        cast(tfcfe.create_id as char) as flowCreateId,
+        su2.real_name as flowCreateName,
+        tffa.create_time as flowCreateTime,
+        tffa.update_time as flowUpdateTime,
+        tffa.status,
+        CASE
+        WHEN tffa.status = 'FINISH' THEN '已完结'
+        WHEN tffa.status = 'END' THEN '已作废'
+        ELSE '进行中'
+        END as statusStr,
+        tfcf.type,
+        IF(tfcf.type = 'OFFICE_SOP_FLOW','教务处SOP','研究生SOP') as typeStr,
+        tfcf.version,
+        cast(tfcf.flow_deployment_id as char) as flowDeploymentId,
+        art.NAME_ as taskName,
+        art.TASK_DEF_KEY_ as taskDefKey
+        from t_b_sop_info tbsi
+        left join t_b_crm tbc on tbc.crm_no = tbsi.crm_no
+        left join t_b_service tbs on tbs.id = tbsi.service_id
+        left join sys_custom sc on sc.id = tbsi.custom_id
+        left join sys_user su1 on su1.id = sc.manager_id
+        left join t_b_product tbp on tbp.id = tbc.product_id
+        left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
+        left join sys_user su2 on su2.id = tfcfe.create_id
+        left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
+        left join ACT_RU_TASK art on art.PROC_INST_ID_ = tffa.flow_id
+        left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
+        left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
+        LEFT JOIN t_b_sop_info_detail id ON id.sop_info_id = tbsi.id
+        LEFT JOIN sys_user u ON u.id = id.lead_id
+        LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
+        <where>
+
+            <if test="serviceId != null and serviceId != ''">
+                and tbs.id = #{serviceId}
+            </if>
+            <if test="provence != null and provence != ''">
+                and sc.provence = #{provence}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and us.supplier_id = #{supplierId}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 4 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/SopAnalyseGroupEnum.java

@@ -7,11 +7,14 @@ package com.qmth.sop.common.enums;
  * @Author: dhshu
  */
 public enum SopAnalyseGroupEnum {
+
     CRM("项目"),
 
     REGION("大区"),
 
-    SUPPLIER("供应商");
+    SUPPLIER("供应商"),
+
+    POPULATION("总体");
 
     SopAnalyseGroupEnum(String title) {
         this.title = title;