shudonghui 1 year ago
parent
commit
df2841099e

+ 7 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/SopScheduleServiceImpl.java

@@ -126,17 +126,19 @@ public class SopScheduleServiceImpl extends ServiceImpl<SopScheduleMapper, TBSop
         });
         List<Map<String, Object>> temp2List = new ArrayList<>();
         List<Map<String, Object>> actualed = this.baseMapper.actualProgress(serviceId);
+        if (plan.isEmpty() && actualed.isEmpty())
+            return result;
         temp2List.addAll(plan);
         temp2List.addAll(actualed);
-        Object max = temp2List.stream().max(Comparator.comparing(o -> o.get("datetime").toString())).get().get("datetime");
-        Object min =temp2List.stream().min(Comparator.comparing(o -> o.get("datetime").toString())).get().get("datetime");
+        Object max = temp2List.stream().max(Comparator.comparing(o -> o.get("datetime").toString())).orElse(new HashMap<>()).get("datetime");
+        Object min = temp2List.stream().min(Comparator.comparing(o -> o.get("datetime").toString())).orElse(new HashMap<>()).get("datetime");
         List<String> daysBetween = DateDisposeUtils.getDaysBetween(parseDate(min).getTime(), parseDate(max).getTime(), SystemConstant.DEFAULT_DATE_YMD_PATTERN);
-        daysBetween.forEach(e->{
+        daysBetween.forEach(e -> {
             Map<String, Object> map = new HashMap<>();
             map.put("datetime", e);
             map.put("count", 0);
-            if(plan.stream().noneMatch(e1->e1.containsKey(e)))plan.add(map);
-            if(actualed.stream().noneMatch(e1->e1.containsKey(e)))actualed.add(map);
+            if (plan.stream().noneMatch(e1 -> e1.get("datetime").toString().equals(e))) plan.add(map);
+            if (actualed.stream().noneMatch(e1 -> e1.get("datetime").toString().equals(e))) actualed.add(map);
         });
 
         result.put("plan", plan.stream().sorted(Comparator.comparing(o -> o.get("datetime").toString())).collect(Collectors.toList()));

+ 3 - 2
sop-business/src/main/resources/mapper/CrmAnalyseMapper.xml

@@ -221,8 +221,9 @@
             <!--                and r.id = #{regionId}-->
             <!--            </if>-->
             <if test="province != null and province != ''">
-                and r.id is not null
-                and rd.province = #{province}
+<!--                and r.id is not null-->
+                and a.status!='FINISH'
+                and sc.province = #{province}
             </if>
             <if test="type != null and type != ''">
                 and sc.type = #{type}

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

@@ -38,7 +38,7 @@
         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 a.type != 'NO_PROBLEM' AND fa.STATUS = 'FINISH'
             <if test="serviceUnitId != null and serviceUnitId != ''">
                 and a.service_id = #{serviceUnitId}
             </if>
@@ -135,7 +135,7 @@
     <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>
@@ -193,7 +193,7 @@
         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>

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

@@ -9,14 +9,14 @@
         su.`name`,
         tbsi.sop_no,
         tffa.status,
-        tffa.setup,
-        CASE
+        tffa.setup
+<!--        CASE-->
 
-        WHEN tffa.STATUS = 'FINISH' THEN
-        '已完结'
-        WHEN tffa.STATUS = 'END' THEN
-        '已作废' ELSE '进行中'
-        END AS statusStr
+<!--        WHEN tffa.STATUS = 'FINISH' THEN-->
+<!--        '已完结'-->
+<!--        WHEN tffa.STATUS = 'END' THEN-->
+<!--        '已作废' ELSE '进行中'-->
+<!--        END AS statusStr-->
         FROM
         t_b_sop_info tbsi
         left join t_b_service_region r on r.service_id=tbsi.service_id
@@ -39,10 +39,11 @@
     </select>
 
     <select id="detail" resultType="java.util.Map">
-        select DISTINCT cast(tbsi.id as char) as id,
-        cast(tbs.id as char) as serviceId,
+        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.sop_no as sopNo,-->
         tbsi.crm_no as crmNo,
         tbc.begin_time as beginTime,
         cast(tbc.crm_user_id as char) as customManagerId,
@@ -54,45 +55,44 @@
         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 t_b_service_region r on tbsi.service_id=r.service_id
-        left join sys_custom sc on sc.id = tbsi.custom_id
+        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_crm tbc
+        left join t_b_sop_info tbsi on tbc.crm_no = tbsi.crm_no
+        left join t_b_service tbs on tbs.id = tbc.service_id
+        left join t_b_service_region r on tbc.service_id=r.service_id
+        left join sys_custom sc on sc.id = tbc.custom_id
         left join sys_user su1 on su1.id = tbc.crm_user_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 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 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 sd ON sd.sop_info_id = tbsi.id
         LEFT JOIN sys_user u ON u.id = tbc.region_coordinator_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}
+                and tbc.service_id = #{serviceId}
             </if>
             <if test="regionId != null and regionId != ''">
                 and r.id = #{regionId}