wangliang 9 сар өмнө
parent
commit
34264271e3

+ 34 - 0
sop-api/src/main/java/com/qmth/sop/server/api/QualityAnalyseReportController.java

@@ -1,10 +1,13 @@
 package com.qmth.sop.server.api;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.ImmutableMap;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.sop.business.bean.report.QualityAnalyseReportBean;
+import com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean;
 import com.qmth.sop.business.service.QualityAnalyseReportService;
 import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
 import com.qmth.sop.common.enums.QualityProblemReasonEnum;
 import com.qmth.sop.common.util.Result;
 import com.qmth.sop.common.util.ResultUtil;
@@ -16,6 +19,8 @@ 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.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -101,6 +106,35 @@ public class QualityAnalyseReportController {
                         .put(ResourceSecurityReportController.RECORDS, qualityAnalyseReportBeanList).build());
     }
 
+    @ApiOperation(value = "报表详情")
+    @RequestMapping(value = "/report/view", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表详情", response = QualityAnalyseReportViewBean.class) })
+    public Result reportView(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId,
+            @ApiParam(value = "大区经理id") @RequestParam(required = false) Long areaManagerId,
+            @ApiParam(value = "供应商id") @RequestParam(required = false) Long supplierId,
+            @ApiParam(value = "问题原因") @RequestParam(required = false) QualityProblemReasonEnum reason,
+            @ApiParam(value = "客户名称") @RequestParam(required = false) String customName,
+            @ApiParam(value = "影响度") @RequestParam(required = false) InfluenceDegreeEnum influenceDegree,
+            @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) {
+        return ResultUtil.ok(
+                qualityAnalyseReportService.viewList(new Page<>(pageNumber, pageSize), serviceId, areaManagerId,
+                        supplierId, reason, customName, influenceDegree));
+    }
+
+    @ApiOperation(value = "报表详情导出")
+    @RequestMapping(value = "/report/view/export", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "质量监控分析报表详情", response = QualityAnalyseReportViewBean.class) })
+    public void reportViewExport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId,
+            @ApiParam(value = "大区经理id") @RequestParam(required = false) Long areaManagerId,
+            @ApiParam(value = "机构id") @RequestParam(required = false) Long supplierId,
+            @ApiParam(value = "问题原因") @RequestParam(required = false) QualityProblemReasonEnum reason,
+            @ApiParam(value = "客户名称") @RequestParam(required = false) String customName,
+            @ApiParam(value = "影响度") @RequestParam(required = false) InfluenceDegreeEnum influenceDegree) {
+        qualityAnalyseReportService.viewListExport(serviceId, areaManagerId, supplierId, reason, customName,
+                influenceDegree);
+    }
+
     /**
      * 计算比率
      *

+ 26 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/report/QualityAnalyseReportBean.java

@@ -1,6 +1,8 @@
 package com.qmth.sop.business.bean.report;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.enums.QualityProblemReasonEnum;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -18,6 +20,14 @@ import java.util.Objects;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class QualityAnalyseReportBean implements Serializable {
 
+    @ApiModelProperty(value = "大区经理id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long areaManagerId;
+
+    @ApiModelProperty(value = "机构id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long supplierId;
+
     @ApiModelProperty(value = "名称")
     String name;
 
@@ -88,6 +98,22 @@ public class QualityAnalyseReportBean implements Serializable {
         this.setInfluenceDegreeDTitle(null);
     }
 
+    public Long getSupplierId() {
+        return supplierId;
+    }
+
+    public void setSupplierId(Long supplierId) {
+        this.supplierId = supplierId;
+    }
+
+    public Long getAreaManagerId() {
+        return areaManagerId;
+    }
+
+    public void setAreaManagerId(Long areaManagerId) {
+        this.areaManagerId = areaManagerId;
+    }
+
     public String getInfluenceDegreeATitle() {
         return influenceDegreeATitle;
     }

+ 189 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/report/QualityAnalyseReportViewBean.java

@@ -0,0 +1,189 @@
+package com.qmth.sop.business.bean.report;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * @Description: 质量监控分析报表详情bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class QualityAnalyseReportViewBean implements Serializable {
+
+    @ApiModelProperty(value = "客户名称")
+    String customName;
+
+    @ApiModelProperty(value = "项目名称")
+    String projectName;
+
+    @ApiModelProperty(value = "科目名称")
+    String courseName;
+
+    @ApiModelProperty(value = "影响度:A,B,C,D")
+    String influenceDegree;
+
+    @ApiModelProperty(value = "大区经理")
+    String areaManagerName;
+
+    @ApiModelProperty(value = "责任人")
+    String dutyName;
+
+    @ApiModelProperty(value = "问题简要")
+    String summary;
+
+    @ApiModelProperty(value = "问题原因")
+    QualityProblemReasonEnum reason;
+
+    @ApiModelProperty(value = "问题原因str")
+    String reasonStr;
+
+    @ApiModelProperty(value = "质量问题主键id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long id;
+
+    @ApiModelProperty(value = "质量问题单号")
+    String problemNo;
+
+    @ApiModelProperty(value = "sop单号")
+    String sopNo;
+
+    @ApiModelProperty(value = "质量问题流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long problemNoFlowId;
+
+    @ApiModelProperty(value = "sop流程id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    Long sopFlowId;
+
+    @ApiModelProperty(value = "人力供应商名称")
+    String humanSupplierName;
+
+    public String getHumanSupplierName() {
+        return humanSupplierName;
+    }
+
+    public void setHumanSupplierName(String humanSupplierName) {
+        this.humanSupplierName = humanSupplierName;
+    }
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getInfluenceDegree() {
+        return influenceDegree;
+    }
+
+    public void setInfluenceDegree(String influenceDegree) {
+        this.influenceDegree = influenceDegree;
+    }
+
+    public String getAreaManagerName() {
+        return areaManagerName;
+    }
+
+    public void setAreaManagerName(String areaManagerName) {
+        this.areaManagerName = areaManagerName;
+    }
+
+    public String getDutyName() {
+        return dutyName;
+    }
+
+    public void setDutyName(String dutyName) {
+        this.dutyName = dutyName;
+    }
+
+    public String getSummary() {
+        return summary;
+    }
+
+    public void setSummary(String summary) {
+        this.summary = summary;
+    }
+
+    public QualityProblemReasonEnum getReason() {
+        return reason;
+    }
+
+    public void setReason(QualityProblemReasonEnum reason) {
+        this.reason = reason;
+    }
+
+    public String getReasonStr() {
+        return Objects.nonNull(reason) ? reason.getTitle() : reasonStr;
+    }
+
+    public void setReasonStr(String reasonStr) {
+        this.reasonStr = reasonStr;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getProblemNo() {
+        return problemNo;
+    }
+
+    public void setProblemNo(String problemNo) {
+        this.problemNo = problemNo;
+    }
+
+    public String getSopNo() {
+        return sopNo;
+    }
+
+    public void setSopNo(String sopNo) {
+        this.sopNo = sopNo;
+    }
+
+    public Long getProblemNoFlowId() {
+        return problemNoFlowId;
+    }
+
+    public void setProblemNoFlowId(Long problemNoFlowId) {
+        this.problemNoFlowId = problemNoFlowId;
+    }
+
+    public Long getSopFlowId() {
+        return sopFlowId;
+    }
+
+    public void setSopFlowId(Long sopFlowId) {
+        this.sopFlowId = sopFlowId;
+    }
+}

+ 114 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/report/QualityAnalyseReportViewExportBean.java

@@ -0,0 +1,114 @@
+package com.qmth.sop.business.bean.report;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 质量监控分析报表详情bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class QualityAnalyseReportViewExportBean implements Serializable {
+
+    @ApiModelProperty(value = "客户名称")
+    @ExcelProperty(value = "客户名称", order = 1)
+    String customName;
+
+    @ApiModelProperty(value = "项目名称")
+    @ExcelProperty(value = "项目名称", order = 2)
+    String projectName;
+
+    @ApiModelProperty(value = "科目名称")
+    @ExcelProperty(value = "科目名称", order = 3)
+    String courseName;
+
+    @ApiModelProperty(value = "影响度:A,B,C,D")
+    @ExcelProperty(value = "影响度", order = 4)
+    String influenceDegree;
+
+    @ApiModelProperty(value = "大区经理")
+    @ExcelProperty(value = "大区经理", order = 5)
+    String areaManagerName;
+
+    @ApiModelProperty(value = "责任人")
+    @ExcelProperty(value = "责任人", order = 6)
+    String dutyName;
+
+    @ApiModelProperty(value = "问题简要")
+    @ExcelProperty(value = "问题简要", order = 7)
+    String summary;
+
+    @ApiModelProperty(value = "问题原因str")
+    @ExcelProperty(value = "问题原因", order = 8)
+    String reasonStr;
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getInfluenceDegree() {
+        return influenceDegree;
+    }
+
+    public void setInfluenceDegree(String influenceDegree) {
+        this.influenceDegree = influenceDegree;
+    }
+
+    public String getAreaManagerName() {
+        return areaManagerName;
+    }
+
+    public void setAreaManagerName(String areaManagerName) {
+        this.areaManagerName = areaManagerName;
+    }
+
+    public String getDutyName() {
+        return dutyName;
+    }
+
+    public void setDutyName(String dutyName) {
+        this.dutyName = dutyName;
+    }
+
+    public String getSummary() {
+        return summary;
+    }
+
+    public void setSummary(String summary) {
+        this.summary = summary;
+    }
+
+    public String getReasonStr() {
+        return reasonStr;
+    }
+
+    public void setReasonStr(String reasonStr) {
+        this.reasonStr = reasonStr;
+    }
+}

+ 36 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/QualityAnalyseReportMapper.java

@@ -1,11 +1,14 @@
 package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.sop.business.bean.report.QualityAnalyseReportBean;
+import com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean;
 import com.qmth.sop.business.entity.TBService;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 质量监控分析报表mapper
@@ -39,4 +42,37 @@ public interface QualityAnalyseReportMapper extends BaseMapper<TBService> {
      * @return
      */
     List<QualityAnalyseReportBean> reasonQualityReport(@Param("serviceId") Long serviceId);
+
+    /**
+     * 报表详情列表
+     *
+     * @param iPage
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     * @return
+     */
+    IPage<QualityAnalyseReportViewBean> viewList(IPage<Map> iPage, @Param("serviceId") Long serviceId,
+            @Param("areaManagerId") Long areaManagerId, @Param("supplierId") Long supplierId,
+            @Param("reason") String reason, @Param("customName") String customName,
+            @Param("influenceDegree") String influenceDegree);
+
+    /**
+     * 报表详情列表导出
+     *
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     * @return
+     */
+    List<QualityAnalyseReportViewBean> viewListExport(@Param("serviceId") Long serviceId,
+            @Param("areaManagerId") Long areaManagerId, @Param("supplierId") Long supplierId,
+            @Param("reason") String reason, @Param("customName") String customName,
+            @Param("influenceDegree") String influenceDegree);
 }

+ 33 - 0
sop-business/src/main/java/com/qmth/sop/business/service/QualityAnalyseReportService.java

@@ -1,10 +1,15 @@
 package com.qmth.sop.business.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.bean.report.QualityAnalyseReportBean;
+import com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean;
 import com.qmth.sop.business.entity.TBService;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 质量监控分析报表service
@@ -38,4 +43,32 @@ public interface QualityAnalyseReportService extends IService<TBService> {
      * @return
      */
     List<QualityAnalyseReportBean> reasonQualityReport(Long serviceId);
+
+    /**
+     * 报表详情列表
+     *
+     * @param iPage
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     * @return
+     */
+    IPage<QualityAnalyseReportViewBean> viewList(IPage<Map> iPage, Long serviceId, Long areaManagerId, Long supplierId,
+            QualityProblemReasonEnum reason, String customName, InfluenceDegreeEnum influenceDegree);
+
+    /**
+     * 报表详情导出
+     *
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     */
+    void viewListExport(Long serviceId, Long areaManagerId, Long supplierId, QualityProblemReasonEnum reason,
+            String customName, InfluenceDegreeEnum influenceDegree);
 }

+ 75 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/QualityAnalyseReportServiceImpl.java

@@ -1,13 +1,31 @@
 package com.qmth.sop.business.service.impl;
 
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.reflect.TypeToken;
 import com.qmth.sop.business.bean.report.QualityAnalyseReportBean;
+import com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean;
+import com.qmth.sop.business.bean.report.QualityAnalyseReportViewExportBean;
 import com.qmth.sop.business.entity.TBService;
 import com.qmth.sop.business.mapper.QualityAnalyseReportMapper;
 import com.qmth.sop.business.service.QualityAnalyseReportService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.InfluenceDegreeEnum;
+import com.qmth.sop.common.enums.QualityProblemReasonEnum;
+import com.qmth.sop.common.util.FileUtil;
+import com.qmth.sop.common.util.GsonUtil;
+import com.qmth.sop.common.util.JacksonUtil;
+import com.qmth.sop.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * @Description: 质量监控分析报表service impl
@@ -52,4 +70,61 @@ public class QualityAnalyseReportServiceImpl extends ServiceImpl<QualityAnalyseR
     public List<QualityAnalyseReportBean> reasonQualityReport(Long serviceId) {
         return this.baseMapper.reasonQualityReport(serviceId);
     }
+
+    /**
+     * 报表详情列表
+     *
+     * @param iPage
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     * @return
+     */
+    @Override
+    public IPage<QualityAnalyseReportViewBean> viewList(IPage<Map> iPage, Long serviceId, Long areaManagerId,
+            Long supplierId, QualityProblemReasonEnum reason, String customName, InfluenceDegreeEnum influenceDegree) {
+        return this.baseMapper.viewList(iPage, serviceId, areaManagerId, supplierId,
+                Objects.nonNull(reason) ? reason.name() : null, customName,
+                Objects.nonNull(influenceDegree) ? influenceDegree.name() : null);
+    }
+
+    /**
+     * 报表详情导出
+     *
+     * @param serviceId
+     * @param areaManagerId
+     * @param supplierId
+     * @param reason
+     * @param customName
+     * @param influenceDegree
+     */
+    @Override
+    public void viewListExport(Long serviceId, Long areaManagerId, Long supplierId, QualityProblemReasonEnum reason,
+            String customName, InfluenceDegreeEnum influenceDegree) {
+        File fileTemp = null;
+        try {
+            fileTemp = SystemConstant.getFileTempVar(SystemConstant.XLSX_PREFIX);
+            List<QualityAnalyseReportViewBean> qualityAnalyseReportViewBeanList = this.baseMapper.viewListExport(
+                    serviceId, areaManagerId, supplierId, Objects.nonNull(reason) ? reason.name() : null, customName,
+                    Objects.nonNull(influenceDegree) ? influenceDegree.name() : null);
+            List<QualityAnalyseReportViewExportBean> qualityAnalyseReportViewExportBeanList = GsonUtil.fromJson(
+                    JacksonUtil.parseJson(qualityAnalyseReportViewBeanList),
+                    new TypeToken<List<QualityAnalyseReportViewExportBean>>() {
+
+                    }.getType());
+            EasyExcel.write(fileTemp, QualityAnalyseReportViewExportBean.class).sheet("质量监控分析")
+                    .doWrite(qualityAnalyseReportViewExportBeanList);
+            HttpServletResponse response = ServletUtil.getResponse();
+            FileUtil.outputFile(response, fileTemp, "质量监控分析.xlsx");
+        } catch (IOException e) {
+            throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+        } finally {
+            if (Objects.nonNull(fileTemp)) {
+                fileTemp.delete();
+            }
+        }
+    }
 }

+ 8 - 2
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -468,7 +468,7 @@ WHERE id=1093;
 
 -- 2024-09-24
 UPDATE sys_privilege
-SET name='质量监控分析', url='qualityAnalyse', `type`='MENU', parent_id=1100, `sequence`=6, property=NULL, related='1113,1114,1115', enable=1, default_auth=0, front_display=1
+SET name='质量监控分析', url='qualityAnalyse', `type`='MENU', parent_id=1100, `sequence`=6, property=NULL, related='1113,1114,1115,1116,1117', enable=1, default_auth=0, front_display=1
 WHERE id=1106;
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
@@ -478,4 +478,10 @@ INSERT INTO sys_privilege
 VALUES(1114, '人力商质量问题统计', '/api/admin/quality/analyse/human_supplier/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(1115, '质量问题原因分类', '/api/admin/quality/analyse/type/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(1115, '质量问题原因分类', '/api/admin/quality/analyse/type/report', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(1116, '报表详情', '/api/admin/quality/analyse/report/view', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(1117, '报表详情导出', '/api/admin/quality/analyse/report/view/export', 'URL', 1106, 1, 'AUTH', NULL, 1, 1, 1);

+ 69 - 4
sop-business/src/main/resources/mapper/QualityAnalyseReportMapper.xml

@@ -8,7 +8,7 @@
         ROUND(t.influenceDegreeB / sum,2) * 100 as influenceDegreeBRate,
         ROUND(t.influenceDegreeC / sum,2) * 100 as influenceDegreeCRate,
         ROUND(t.influenceDegreeD / sum,2) * 100 as influenceDegreeDRate
-        from(select distinct su.real_name as name,
+        from(select distinct su.real_name as name,tbc.lead_id as areaManagerId,
         count(distinct tbqpa.id) as sum,
         SUM(CASE WHEN tbqpa.Influence_degree = 'A' THEN 1 ELSE 0 END) as influenceDegreeA,
         SUM(CASE WHEN tbqpa.Influence_degree = 'B' THEN 1 ELSE 0 END) as influenceDegreeB,
@@ -25,7 +25,7 @@
         and tbs.status <![CDATA[ <> ]]> 'CANCEL'
         and tffa.status <![CDATA[ <> ]]> 'END'
         and tbqpa.Influence_degree is not null
-        group by su.real_name) t
+        group by su.real_name,tbc.lead_id) t
         order by t.sum desc
     </select>
 
@@ -35,7 +35,7 @@
            ROUND(temp.influenceDegreeB / sum,2) * 100 as influenceDegreeBRate,
            ROUND(temp.influenceDegreeC / sum,2) * 100 as influenceDegreeCRate,
            ROUND(temp.influenceDegreeD / sum,2) * 100 as influenceDegreeDRate
-        from(select distinct IFNULL(ss.name, '启明') as name,
+        from(select distinct IFNULL(ss.name, '启明') as name,IFNULL(ss.id, -1)as supplierId,
         sum(t.sum) as sum,
         sum(t.influenceDegreeA) as influenceDegreeA,
         sum(t.influenceDegreeB) as influenceDegreeB,
@@ -60,7 +60,7 @@
         left join t_b_user_archives tbua on tbua.mobile_number = t.mobileNumber
         left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
         left join sys_supplier ss on ss.id = tbuas.supplier_id
-        group by ss.name) temp
+        group by ss.name,ss.id) temp
         order by temp.sum desc
     </select>
 
@@ -77,4 +77,69 @@
         and tbqpa.reason is not null
         group by tbqpa.reason) t order by t.reasonSum desc
     </select>
+
+    <sql id="viewListCommon">
+        select distinct sc.name as customName,
+        tbc.name as projectName,
+        tbcd.course_name as courseName,
+        tbqpa.Influence_degree as InfluenceDegree,
+        su.real_name as areaManagerName,
+        (select group_concat(su.real_name) from sys_user su where FIND_IN_SET(su.id, tbqpa.user_ids)) as dutyName,
+        tbqpa.summary,
+        tbqpa.reason,
+        tbqpa.id,
+        tbqpa.problem_no as problemNo,
+        tbqpa.sop_no as sopNo,
+        tfcfe.flow_id as problemNoFlowId,
+        tfcfe1.flow_id as sopFlowId,
+        IFNULL(ss.name, '启明') as humanSupplierName
+        from t_b_quality_problem_apply tbqpa
+        left join t_b_service tbs on tbs.id = tbqpa.service_id
+        left join t_b_crm tbc on tbc.crm_no = tbqpa.crm_no
+        left join sys_custom sc on sc.id = tbc.custom_id
+        left join t_b_crm_detail tbcd on tbcd.sop_no = tbqpa.sop_no
+        left join sys_user su on su.id = tbc.lead_id
+        left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbqpa.problem_no
+        left join t_f_custom_flow_entity tfcfe1 on tfcfe1.code = tbqpa.sop_no
+        left join sys_user su1 on FIND_IN_SET(su1.id, tbqpa.user_ids)
+        left join t_b_user_archives tbua on tbua.mobile_number = su1.mobile_number
+        left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
+        left join sys_supplier ss on ss.id = tbuas.supplier_id
+        <where>
+            <if test="serviceId != null and serviceId != ''">
+                and tbqpa.service_id = #{serviceId}
+            </if>
+            <if test="areaManagerId != null and areaManagerId != ''">
+                and tbc.lead_id = #{areaManagerId}
+            </if>
+            <if test="supplierId != null and supplierId != ''">
+                <choose>
+                    <when test="supplierId != -1">
+                        and ss.id = #{supplierId}
+                    </when>
+                    <otherwise>
+                        and ss.id is null
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="reason != null and reason != ''">
+                and tbqpa.reason = #{reason}
+            </if>
+            <if test="customName != null and customName != ''">
+                and sc.name LIKE CONCAT('%',#{customName},'%')
+            </if>
+            <if test="influenceDegree != null and influenceDegree != ''">
+                and tbqpa.Influence_degree = #{influenceDegree}
+            </if>
+        </where>
+        order by sc.name,tbqpa.Influence_degree
+    </sql>
+
+    <select id="viewList" resultType="com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean">
+        <include refid="viewListCommon" />
+    </select>
+
+    <select id="viewListExport" resultType="com.qmth.sop.business.bean.report.QualityAnalyseReportViewBean">
+        <include refid="viewListCommon" />
+    </select>
 </mapper>