Quellcode durchsuchen

质量分析监控

shudonghui vor 1 Jahr
Ursprung
Commit
7dc7f266f6

+ 144 - 0
sop-api/src/main/java/com/qmth/sop/server/api/QualityAnalyseController.java

@@ -0,0 +1,144 @@
+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.constant.ApiConstant;
+import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
+import com.qmth.sop.business.entity.TBService;
+import com.qmth.sop.business.service.QualityAnalyseService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityAnalyseGroupEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+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.List;
+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 + "/quality/analyse")
+public class QualityAnalyseController {
+
+
+    @Resource
+    QualityAnalyseService qualityAnalyseService;
+
+
+   
+    @ApiOperation(value = "服务单元列表接口")
+    @RequestMapping(value = "/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "服务单元列表", response = TBService.class)})
+    public Result list(@ApiParam(value = "年度", required = true) @RequestParam String year) {
+        List<TBService> list = qualityAnalyseService.list(year);
+        return ResultUtil.ok(list);
+    }
+
+
+    /**
+     * 4.质量问题总体盘点
+     * ①饼图:显示已完成审核,且确定为质量问题(审核结果非“不是问题”)的质量问题的数量统计,以及各影响度的质量问题事件的占比;
+     * ②【数据下钻】点击影响度行数据,可显示影响度下质量问题查询明细,筛选条件为:年度+服务单元+非“不是问题”+影响度;
+     * ③归因雷达图:按找质量问题归因维度展示雷达图,以及全部及各供应商的雷达图。不提供【数据下钻】;
+     */
+    //质量问题总体盘点饼图
+   
+    @ApiOperation(value = "质量问题总体盘点饼图")
+    @RequestMapping(value = "/pie", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "质量问题总体盘点饼图", response = Map.class)})
+    public Result pie(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
+                      @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId) {
+        Map<String, Object> map = qualityAnalyseService.pie(serviceUnitId, supplierId);
+        return ResultUtil.ok(map);
+    }
+
+    //质量问题总体盘点归因雷达图
+   
+    @ApiOperation(value = "质量问题总体盘点归因雷达图")
+    @RequestMapping(value = "/radar", method = RequestMethod.POST)
+    public Result radar(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
+                        @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId) {
+        Map<String, Object> map = qualityAnalyseService.radar(serviceUnitId, supplierId);
+        return ResultUtil.ok(map);
+    }
+
+
+    /**
+     * 5.质量问题审核进度=(已完成审核的质量问题总数÷总数)×100%;不提供【数据下钻】;
+     */
+   
+    @ApiOperation(value = "质量问题审核进度")
+    @RequestMapping(value = "/progress", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "质量问题审核进度", response = Double.class)})
+    public Result progress(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId) {
+        Double progress = qualityAnalyseService.progress(serviceUnitId);
+        return ResultUtil.ok(progress);
+    }
+
+    /**
+     * * 6.影响度/归因    供应商/大区分布及对比:
+     * * 可视化展示如图,供应商/大区的归属,仅针对审核完成且定责为供应商的人员,或大区管辖的项目;
+     * * 【数据下钻】点击行数据,可查看质量问题数据明细。
+     */
+   
+    @ApiOperation(value = "影响度/归因")
+    @RequestMapping(value = "/influence", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "影响度/归因", response = Map.class)})
+    public Result influence(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
+                            @ApiParam(value = "影响度分组", required = true) @RequestParam QualityAnalyseGroupEnum group) {
+        Map<String, Map<String, Object>> map = qualityAnalyseService.influence(serviceUnitId, group);
+        return ResultUtil.ok(map);
+    }
+
+    //* ②【数据下钻】点击影响度行数据,可显示影响度下质量问题查询明细,筛选条件为:年度+服务单元+非“不是问题”+影响度;
+    //质量问题查询明细
+   
+    @ApiOperation(value = "质量问题饼图明细")
+    @RequestMapping(value = "/supplier/detail", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "质量问题饼图明细", response = TBQualityProblemApplyResult.class)})
+    public Result detail(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
+                         @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<TBQualityProblemApplyResult> resultIPage = qualityAnalyseService.detail(new Page<>(pageNumber, pageSize), serviceUnitId, supplierId);
+
+        return ResultUtil.ok(resultIPage);
+    }
+
+    //* ②【数据下钻】点击影响度行数据,可显示影响度下质量问题查询明细,筛选条件为:年度+服务单元+非“不是问题”+影响度;
+    //质量问题查询明细
+   
+    @ApiOperation(value = "影响度/归因明细")
+    @RequestMapping(value = "/influence/detail", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "影响度/归因明细", response = TBQualityProblemApplyResult.class)})
+    public Result influence(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
+                            @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId,
+                            @ApiParam(value = "大区") @RequestParam(required = false) String province,
+                            @ApiParam(value = "影响度") @RequestParam(required = false) InfluenceDegreeEnum Influence_degree,
+                            @ApiParam(value = "问题原因类型") @RequestParam(required = false) QualityProblemReasonEnum reason,
+                            @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<TBQualityProblemApplyResult> resultIPage = qualityAnalyseService.influence(new Page<>(pageNumber, pageSize), serviceUnitId, supplierId,province,Influence_degree,reason);
+
+        return ResultUtil.ok(resultIPage);
+    }
+
+}

+ 39 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/QualityAnalyseMapper.java

@@ -0,0 +1,39 @@
+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.bean.result.TBQualityProblemApplyResult;
+import com.qmth.sop.business.entity.TBQualityProblemApply;
+import com.qmth.sop.business.entity.TBService;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author dhshu
+ *
+ */
+public interface QualityAnalyseMapper extends BaseMapper<TBQualityProblemApply> {
+
+
+    IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, @Param("serviceUnitId") Long serviceUnitId, @Param("supplierId") Long supplierId);
+
+    Map<String, Object> radar(@Param("serviceUnitId")Long serviceUnitId,@Param("supplierId") Long supplierId);
+
+    List<TBService> list( @Param("year")String year);
+
+    Double progress( @Param("serviceUnitId")Long serviceUnitId);
+
+    List<Map<String, Object>> influence( @Param("serviceUnitId")Long serviceUnitId);
+
+    Map<String, Object> pie(@Param("serviceUnitId")Long serviceUnitId,@Param("supplierId") Long supplierId);
+
+    IPage<TBQualityProblemApplyResult> influenceDetail(Page<Object> tPage,@Param("serviceUnitId") Long serviceUnitId,@Param("supplierId") Long supplierId,@Param("province") String province,@Param("influenceDegree") InfluenceDegreeEnum influenceDegree,@Param("reason") QualityProblemReasonEnum reason);
+}

+ 31 - 0
sop-business/src/main/java/com/qmth/sop/business/service/QualityAnalyseService.java

@@ -0,0 +1,31 @@
+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.bean.result.TBQualityProblemApplyResult;
+import com.qmth.sop.business.entity.TBQualityProblemApply;
+import com.qmth.sop.business.entity.TBService;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityAnalyseGroupEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+
+import java.util.List;
+import java.util.Map;
+
+public interface QualityAnalyseService extends IService<TBQualityProblemApply> {
+
+    List<TBService> list(String year);
+
+    Double progress(Long serviceUnitId);
+
+    Map<String,Map<String, Object>> influence(Long serviceUnitId, QualityAnalyseGroupEnum group);
+
+    Map<String, Object> pie(Long serviceUnitId, Long supplierId);
+
+    Map<String, Object> radar(Long serviceUnitId, Long supplierId);
+
+    IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, Long serviceUnitId, Long supplierId);
+
+    IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, String province, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason);
+}

+ 88 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/QualityAnalyseServiceImpl.java

@@ -0,0 +1,88 @@
+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.bean.result.TBQualityProblemApplyResult;
+import com.qmth.sop.business.entity.TBQualityProblemApply;
+import com.qmth.sop.business.entity.TBService;
+import com.qmth.sop.business.mapper.QualityAnalyseMapper;
+import com.qmth.sop.business.service.QualityAnalyseService;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityAnalyseGroupEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper, TBQualityProblemApply> implements QualityAnalyseService {
+
+
+    @Override
+    public List<TBService> list(String year) {
+        return this.baseMapper.list(year);
+    }
+
+
+    @Override
+    public Double progress(Long serviceUnitId) {
+        return this.baseMapper.progress(serviceUnitId);
+    }
+
+    @Override
+    public Map<String, Map<String, Object>> influence(Long serviceUnitId, QualityAnalyseGroupEnum group) {
+        List<Map<String, Object>> influence = this.baseMapper.influence(serviceUnitId);
+        Map<String, Map<String, Object>> result = new HashMap<>();
+        if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_REGION)) {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+                Map<String, Object> map = new HashMap<>();
+                v.stream().collect(Collectors.groupingBy(map1 -> map1.get("Influence_degree"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
+                result.put(k.toString(), map);
+            });
+        } else if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_SUPPLIER)) {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("Influence_degree"))).forEach((k, v) -> {
+                Map<String, Object> map = new HashMap<>();
+                v.stream().collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
+                result.put(k.toString(), map);
+            });
+        } else if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+                Map<String, Object> map = new HashMap<>();
+                v.stream().collect(Collectors.groupingBy(map1 -> map1.get("reason"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
+                result.put(k.toString(), map);
+            });
+        } else if (group.equals(QualityAnalyseGroupEnum.REASON_SUPPLIER)) {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("reason"))).forEach((k, v) -> {
+                Map<String, Object> map = new HashMap<>();
+                v.stream().collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
+                result.put(k.toString(), map);
+            });
+        }
+        return result;
+    }
+
+
+    @Override
+    public Map<String, Object> pie(Long serviceUnitId, Long supplierId) {
+        return this.baseMapper.pie(serviceUnitId, supplierId);
+    }
+
+    @Override
+    public Map<String, Object> radar(Long serviceUnitId, Long supplierId) {
+        return this.baseMapper.radar(serviceUnitId, supplierId);
+    }
+
+    @Override
+    public IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, Long serviceUnitId, Long supplierId) {
+        return this.baseMapper.detail(objectPage, serviceUnitId, supplierId);
+    }
+
+    @Override
+    public IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, String province, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason) {
+        return this.baseMapper.influenceDetail(tPage, serviceUnitId, supplierId,province, influenceDegree, reason);
+    }
+}

+ 1 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/SopScheduleServiceImpl.java

@@ -27,8 +27,7 @@ public class SopScheduleServiceImpl extends ServiceImpl<SopScheduleMapper, TBSop
         Map<String, Map<String, Object>> result = new HashMap<>();
         if (group.equals(SopAnalyseGroupEnum.POPULATION)) {
             result.put("POPULATION", processData(list));
-        }
-        if (group.equals(SopAnalyseGroupEnum.REGION)) {
+        } else 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)));

+ 180 - 0
sop-business/src/main/resources/mapper/QualityAnalyseMapper.xml

@@ -0,0 +1,180 @@
+<?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.QualityAnalyseMapper">
+    <select id="list" resultType="com.qmth.sop.business.entity.TBService">
+        select * from t_b_service s
+        <where>
+            and s.status in ('PUBLISH','FINISH')
+
+            <if test="year != null and year != ''">
+                and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}
+            </if>
+
+        </where>
+        order by s.start_time desc
+    </select>
+    <select id="pie" resultType="java.util.Map">
+        SELECT
+        a.Influence_degree,
+        count( a.id ) count
+        FROM
+        t_b_quality_problem_apply a
+        LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
+        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
+        LEFT JOIN sys_user u ON u.id = sc.manager_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 t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
+        LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
+        <where>
+            and a.type != 'NO_PROBLEM' AND fa.STATUS = 'FINISH'
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and us.supplier_id = #{supplierId}
+            </if>
+        </where>
+        GROUP BY
+        a.Influence_degree
+    </select>
+    <select id="radar" resultType="java.util.Map">
+        SELECT
+        a.reason,
+        count( a.id ) count
+        FROM
+        t_b_quality_problem_apply a
+        LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
+        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
+        LEFT JOIN sys_user u ON u.id = sc.manager_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 t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
+        LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
+        <where>
+            and a.type != 'NO_PROBLEM' AND fa.STATUS = 'FINISH'
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and us.supplier_id = #{supplierId}
+            </if>
+        </where>
+        GROUP BY
+        a.reason
+    </select>
+    <sql id="query">
+        SELECT
+        distinct a.*,
+        si.type sopType,
+        sc.NAME custom,
+        sc.type customType,
+        fa.STATUS,
+        fa.setup,
+        fa.create_time submissionTime,
+        fa.update_time updateDateTime,
+        cu.real_name submitter ,
+        fe.flow_id as flowId,
+        (select group_concat(art.NAME_) from ACT_RU_TASK art where art.PROC_INST_ID_ = fa.flow_id) as taskName,
+        (select group_concat(art.TASK_DEF_KEY_) from ACT_RU_TASK art where art.PROC_INST_ID_ = fa.flow_id) as taskDefKey,
+        (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = fa.flow_id) as taskId,
+        (select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
+        where find_in_set(us1.id, a.user_ids)) user_names,
+        (select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
+        where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = fe.flow_id order by tffl.create_time desc limit 1))) pend_approve_users
+        FROM
+        t_b_quality_problem_apply a
+        LEFT JOIN t_b_sop_info si on si.sop_no = a.sop_no
+        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
+        LEFT JOIN sys_user u ON u.id = sc.manager_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 t_f_custom_flow_entity fe ON 	fe.`code`= a.problem_no
+        LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
+        LEFT JOIN sys_user cu ON cu.id = fa.create_id
+        left join ACT_RU_TASK art on art.PROC_INST_ID_ = fa.flow_id
+        left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
+        left join t_b_crm tbc on tbc.crm_no = fe.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+
+    </sql>
+    <select id="detail" resultType="com.qmth.sop.business.bean.result.TBQualityProblemApplyResult">
+        <include refid="query" />
+        <where>
+                and a.type != 'NO_PROBLEM' AND fa.STATUS = 'FINISH'
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and us.supplier_id = #{supplierId}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+    </select>
+
+    <select id="influenceDetail" resultType="com.qmth.sop.business.bean.result.TBQualityProblemApplyResult">
+        <include refid="query" />
+        <where>
+            AND fa.STATUS = 'FINISH'
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                and us.supplier_id = #{supplierId}
+            </if>
+            <if test="province != null and province != ''">
+                and sc.province = #{supplierId}
+            </if>
+            <if test="influenceDegree != null and influenceDegree != ''">
+                and a.Influence_degree = #{influenceDegree}
+            </if>
+            <if test="reason != null and reason != ''">
+                and a.reason = #{reason}
+            </if>
+        </where>
+        ORDER BY a.create_time DESC
+    </select>
+
+
+    <select id="progress" resultType="java.lang.Double">
+        SELECT
+        sum(case when fa.`status`='FINISH' then 1 else 0 end )*100/count( a.id ) count
+        FROM
+        t_b_quality_problem_apply a
+        LEFT JOIN t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
+        LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
+        <where>
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+
+        </where>
+
+    </select>
+    <select id="influence" resultType="java.util.Map">
+        SELECT
+        a.id,
+        a.Influence_degree,
+        su.`name` supplier,
+        su.id supplierId,
+        sc.province,
+        a.reason
+        FROM
+        t_b_quality_problem_apply a
+        LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
+        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
+        LEFT JOIN t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
+        LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
+        LEFT JOIN sys_user u ON find_in_set( u.id, a.user_ids )
+        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
+        <where>
+            AND fa.STATUS = 'FINISH'
+            <if test="serviceUnitId != null and serviceUnitId != ''">
+                and a.service_id = #{serviceUnitId}
+            </if>
+        </where>
+
+    </select>
+</mapper>

+ 30 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/QualityAnalyseGroupEnum.java

@@ -0,0 +1,30 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description: sop分组enum
+ * @Param:
+ * @return:
+ * @Author: dhshu
+ */
+public enum QualityAnalyseGroupEnum {
+
+
+
+    REASON_REGION("归因大区"),
+
+    REASON_SUPPLIER("归因供应商"),
+
+    INFLUENCE_REGION("影响度大区"),
+
+    INFLUENCE_SUPPLIER("影响度供应商");
+
+    QualityAnalyseGroupEnum(String title) {
+        this.title = title;
+    }
+
+    private final String title;
+
+    public String getTitle() {
+        return title;
+    }
+}