From 02ee149247ca123ff4df76d439fa93d7ae764f1f Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 21 Jun 2024 16:54:27 +0800
Subject: [PATCH] bug修复

---
 src/main/java/org/springblade/modules/eCallEventTwo/mapper/EcOrderMapper.xml |  138 +++++++++++++++++++++++++++++++++-------------
 1 files changed, 99 insertions(+), 39 deletions(-)

diff --git a/src/main/java/org/springblade/modules/eCallEventTwo/mapper/EcOrderMapper.xml b/src/main/java/org/springblade/modules/eCallEventTwo/mapper/EcOrderMapper.xml
index a6e011f..704432f 100644
--- a/src/main/java/org/springblade/modules/eCallEventTwo/mapper/EcOrderMapper.xml
+++ b/src/main/java/org/springblade/modules/eCallEventTwo/mapper/EcOrderMapper.xml
@@ -5,6 +5,7 @@
 <mapper namespace="org.springblade.modules.eCallEventTwo.mapper.EcOrderMapper">
 
     <resultMap type="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO" id="EcOrderDTOResult">
+        <result property="id"    column="id"    />
         <result property="orderId"    column="order_id"    />
         <result property="orderCode"    column="order_code"    />
         <result property="issueOrigin"    column="issue_origin"    />
@@ -59,7 +60,7 @@
     </resultMap>
 
     <sql id="selectEcOrder">
-    	select
+    	select id,
 	        order_id,
 	        order_code,
 	        issue_origin,
@@ -122,8 +123,12 @@
     </select>
 
     <select id="selectEcOrderList" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO" resultMap="EcOrderDTOResult">
-        <include refid="selectEcOrder"/>
+        SELECT
+        *
+        FROM ec_order
         <where>
+        <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
+        </if>
 		<if test="orderId != null "> and order_id = #{orderId}</if>
 		<if test="orderCode != null  and orderCode != ''"> and order_code = #{orderCode}</if>
 		<if test="issueOrigin != null  and issueOrigin != ''"> and issue_origin = #{issueOrigin}</if>
@@ -188,13 +193,12 @@
             resultType="java.lang.Integer">
         SELECT
         COUNT(DISTINCT(eo.order_id))
-        FROM
-        ec_order_cti eoc
-        LEFT JOIN ec_order eo on eo.order_id= eoc.order_id
+        FROM ec_order eo
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
             <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
             </if>
@@ -267,18 +271,19 @@
     <select id="selectEcDispatchCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcDispatchDTO"
             resultType="java.lang.Integer">
         SELECT
-        COUNT(
-        DISTINCT ( eo.order_id ))
+        COUNT(1)
         FROM
         ec_dispatch ed
         LEFT JOIN ec_order eo ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
             <if test="startTime != null and endTime != null">and ed.dispatch_time BETWEEN #{startTime} AND #{endTime}
             </if>
-
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
+            </if>
 
             <if test="dispatchId != null ">and dispatch_id = #{dispatchId}</if>
             <if test="orderId != null ">and order_id = #{orderId}</if>
@@ -325,20 +330,22 @@
     <select id="selectEcHandleCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcHandleDTO"
             resultType="java.lang.Integer">
         SELECT
-        COUNT(DISTINCT(eo.order_id))
+        COUNT(DISTINCT(ehd.uid))
         FROM
-        ec_handle eh
-        LEFT JOIN ec_order eo on eh.order_id = eo.order_id
+        ec_handle_doing ehd
+        LEFT JOIN ec_handle eh ON ehd.order_id = eh.order_id
+        LEFT JOIN ec_order eo ON eh.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
-
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
-            <if test="startTime != null and endTime != null">and eh.remote_hdl_time BETWEEN #{startTime} AND
+            <if test="startTime != null and endTime != null">and ehd.biz_time BETWEEN #{startTime} AND
                 #{endTime}
             </if>
-
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
+            </if>
 
             <if test="handleId != null ">and handle_id = #{handleId}</if>
             <if test="orderId != null ">and order_id = #{orderId}</if>
@@ -366,19 +373,21 @@
     <select id="selectEcOrderCheckCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderCheckDTO"
             resultType="java.lang.Integer">
         SELECT
-        COUNT(DISTINCT(eo.order_id))
+        COUNT(
+        DISTINCT ( eoct.uid ))
         FROM
-        ec_order_check eoc
-        LEFT JOIN ec_order eo on eoc.order_id = eo.order_id
+        ec_order_check_tel eoct
+        LEFT JOIN ec_order_check eoc ON eoct.order_id = eoc.order_id
+        LEFT JOIN ec_order eo ON eoc.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
-        LEFT JOIN ec_order_check_tel eoct on eoct.order_id = eo.order_id
+        LEFT JOIN ec_order_cti eoci on eoci.order_id = eo.order_id
         <where>
-
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
             <if test="startTime != null and endTime != null">and eoct.chk_time BETWEEN #{startTime} AND #{endTime}</if>
-
+            <if test="startTime != null and endTime != null">and eoci.callin_time BETWEEN #{startTime} AND #{endTime}
+            </if>
 
             <if test="orderId != null ">and order_id = #{orderId}</if>
             <if test="checkCode != null  and checkCode != ''">and check_code = #{checkCode}</if>
@@ -393,19 +402,23 @@
     <select id="selectEcOrderDoneCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderDoneDTO"
             resultType="java.lang.Integer">
         SELECT
-        COUNT(DISTINCT(eo.order_id))
+        COUNT(
+        DISTINCT ( eodl.uid ))
         FROM
-        ec_order_done eod
-        LEFT JOIN ec_order eo on eod.order_id = eo.order_id
+        ec_order_done_log eodl
+        LEFT JOIN ec_order_done eod ON eod.order_id = eodl.order_id
+        LEFT JOIN ec_order eo ON eod.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
-            <if test="startTime != null and endTime != null">and eod.first_done_apply_time BETWEEN #{startTime} AND
+            <if test="startTime != null and endTime != null">and eodl.in_audit_time BETWEEN #{startTime} AND
                 #{endTime}
             </if>
-
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
+            </if>
 
             <if test="orderId != null ">and order_id = #{orderId}</if>
             <if test="doneCode != null  and doneCode != ''">and done_code = #{doneCode}</if>
@@ -418,18 +431,23 @@
     <select id="selectEcOrderRespCount" parameterType="org.springblade.modules.eCallEventTwo.dto.EcOrderRespDTO"
             resultType="java.lang.Integer">
         SELECT
-        COUNT(DISTINCT(eo.order_id))
+        COUNT(
+        DISTINCT ( eorl.uid ))
         FROM
-        ec_order_resp eor
-        LEFT JOIN ec_order eo on eor.order_id = eo.order_id
+        ec_order_resp_log eorl
+        LEFT JOIN ec_order_resp eor ON eorl.order_id = eor.order_id
+        LEFT JOIN ec_order eo ON eor.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
-        LEFT JOIN ec_order_resp_log eorl on eorl.order_id = eor.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
 
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
-            <if test="startTime != null and endTime != null">and eorl.resp_time BETWEEN #{startTime} AND #{endTime}</if>
+            <if test="startTime != null and endTime != null">and eorl.audit_time BETWEEN #{startTime} AND #{endTime}
+            </if>
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
+            </if>
 
             <if test="orderId != null ">and order_id = #{orderId}</if>
             <if test="respCode != null  and respCode != ''">and resp_code = #{respCode}</if>
@@ -445,12 +463,15 @@
         ec_order_review eor
         LEFT JOIN ec_order eo on eor.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
 
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
             <if test="startTime != null and endTime != null">and eor.review_time BETWEEN #{startTime} AND #{endTime}
+            </if>
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
             </if>
 
 
@@ -500,13 +521,15 @@
         ec_order_supervise eos
         LEFT JOIN ec_order eo on eos.order_id = eo.order_id
         LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc on eoc.order_id = eo.order_id
         <where>
-
             <if test="tagMain != null and tagMain != ''">and ed.tag_main = #{tagMain}</if>
-            <if test="objectOrgCode != null and objectOrgCode != ''">and ed.object_org_code = #{objectOrgCode}</if>
+            <if test="subjectOrgCode != null and subjectOrgCode != ''">and ed.subject_org_code = #{subjectOrgCode}</if>
             <if test="sinkOrgCode != null and sinkOrgCode != ''">and ed.sink_org_code = #{sinkOrgCode}</if>
             <if test="startTime != null and endTime != null">and eos.supervise_time BETWEEN #{startTime} AND
                 #{endTime}
+            </if>
+            <if test="startTime != null and endTime != null">and eoc.callin_time BETWEEN #{startTime} AND #{endTime}
             </if>
 
 
@@ -537,4 +560,41 @@
         </where>
     </select>
 
+
+    <select id="getUnitAssessmentIndicators" resultType="java.util.Map">
+        select *
+        from `v_statistics_examine_2`
+
+    </select>
+
+
+    <select id="getOrgCode" resultType="org.springblade.modules.eCallEventTwo.dto.EcOrderDTO">
+        SELECT
+        ed.subject_org_code,ed.subject_org_name,ed.sink_org_code,ed.sink_org_name
+        FROM
+        ec_order eo
+        LEFT JOIN ec_dispatch ed ON eo.order_id = ed.order_id
+        LEFT JOIN ec_order_cti eoc ON eoc.order_id = eo.order_id
+        <where>
+            <if test="ecOrderParamDTO.tagMain != null and ecOrderParamDTO.tagMain != '' ">
+                and ed.tag_main = #{ecOrderParamDTO.tagMain}
+                <if test="ecOrderParamDTO.mainFlag != null and ecOrderParamDTO.mainFlag == 2">
+                    <if test="ecOrderParamDTO.subjectOrgName != null and ecOrderParamDTO.subjectOrgName != ''">
+                        and ed.subject_org_name like concat('%',#{ecOrderParamDTO.subjectOrgName},'%')
+                    </if>
+                    GROUP BY ed.subject_org_code
+                </if>
+                <if test="ecOrderParamDTO.mainFlag != null and ecOrderParamDTO.mainFlag == 1">
+                    <if test="ecOrderParamDTO.sinkOrgName != null and ecOrderParamDTO.sinkOrgName != ''">
+                        and ed.sink_org_name like concat('%',#{ecOrderParamDTO.sinkOrgName},'%')
+                    </if>
+                    GROUP BY ed.sink_org_code
+                </if>
+
+            </if>
+        </where>
+
+
+    </select>
+
 </mapper>

--
Gitblit v1.9.3