anderx лет назад: 3
Родитель
Сommit
50f12323e9

+ 48 - 92
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1747,91 +1747,44 @@
 
 
   <select id="selectProvincialStatisticsListByPage" resultType="com.goafanti.order.bo.OutProvincialStatistics">
-    select dg.name provinceName,de.name thchDepName ,bc.cname projectStatus,
-    dg.id province, de.id thchDepId,bc.id bpId,
-    ifnull(x.kcs,0) stockCount, ifnull(x.pds,0) distributeCount,
-    <if test="status==1">
-      ifnull(x.wcs,0) completeCount, ifnull(x.lxs,0) setUpCount,ifnull(x.ccs,0) spotCheckCount,ifnull(x.wtg,0) failedCount,
-    </if>
-    <if test="status==2 or status==3">
-      ifnull(x.sls,0) acceptCount,ifnull(x.wjs,0) completeCount,ifnull(x.sqs,0) authorizeCount,ifnull(x.bhs,0) rejectCount,
-    </if>
-    <if test="status==4">
-      ifnull(x.xzs,0) certificatesCount,
-    </if>
-    <if test="status==5">
-      ifnull(x.sqs,0)applyCount ,ifnull(x.bhs,0)rejectCount ,ifnull(x.xzs,0) certificatesCount,
-    </if>
-    <if test="status==0">
-      ifnull(x.wcs,0) completeCount, ifnull(x.gss,0) publicityCount,
-    </if>
-    x.amountCount,x.costAmount,x.profit
-    from (select dep.province, ad.department_id,bp.cid ,sum(kcs.kcs) kcs,sum(kcs.pds)pds,
-    <if test="status==1">
-      sum(wcs.wcs)wcs, sum(wcs.lxs)lxs,sum(wcs.ccs)ccs,sum(wcs.wtg)wtg,
-    </if>
-    <if test="status==2 or status==3">
-      sum(tj.sls) sls,sum(tj.wjs)wjs,sum(tj.sqs)sqs, sum(tj.bhs)bhs,
-    </if>
-    <if test="status==4">
-      sum(tj.xzs) xzs,
-    </if>
-    <if test="status==5">
-      sum(tj.sqs) sqs,sum(tj.bhs) bhs,sum(tj.xzs) xzs,
-    </if>
-    <if test="status==0">
-      sum(wcs.wcs)wcs, sum(wcs.gss)gss,
-    </if>
-    sum(a.commodity_price)amountCount,sum(ttm.cost_amount)costAmount, (sum(a.commodity_price)-sum(ttm.cost_amount))profit
-    from t_order_task a left join t_order_new b on a.order_no =b.order_no and b.delete_sign in(0,2) left join t_task_mid ttm on a.id=ttm.tid
-    left join department dep on b.order_dep =dep.id  inner join admin ad on a.task_receiver =ad.id
-    left join business_project bp on a.commodity_id =bp.id
-    left join (select id,if(project_status BETWEEN  1 and 3,commodity_quantity,0) kcs,
-    if(task_status in (1,2,3),commodity_quantity,0) pds from t_order_task)kcs on a.id=kcs.id
-
-    <if test="status==1">
-      left join (select id,if(project_status > 3,commodity_quantity,0) wcs, if( set_up_status=1,commodity_quantity,0) lxs,
-      if(spot_check_status in (1,2),commodity_quantity,0) ccs, if( spot_check_status =1,commodity_quantity,0) wtg
-      from t_order_task )wcs on a.id=wcs.id
-    </if>
-    <if test="status==2 or status==3">
-      left join (select tid ,accept_count sls,end_count wjs,authorize_count sqs,reject_count bhs from t_task_mid
-      where authorize_count &gt; 0)tj on a.id=tj.tid
-    </if>
-    <if test="status==4">
-      left join (select tid ,certificates_count xzs from t_task_mid where certificates_count &gt; 0)tj on a.id=tj.tid
-    </if>
-    <if test="status==5">
-      left join (select tid ,apply_count sqs,reject_count bhs,certificates_count xzs from t_task_mid
-      where apply_count &gt; 0)tj on a.id=tj.tid
-    </if>
-    <if test="status==0">
-      left join (select id,if(project_status > 3,commodity_quantity,0) wcs,
-      if( if_publicity=1,commodity_quantity,0) gss
-      from t_order_task )wcs on a.id=wcs.id
-
-    </if>
-    where a.split_status in(0,2)
-    <if test="startDate != null and endDate != null">
-      and a.task_distribution_time between #{startDate} and #{endDate}
+    select z.cid bpId, bc.cname projectStatus,z.dispatch_province province,dg.name provinceName,
+    z.duty_dep thchDepId,d.name  thchDepName,z.distributeCount,z.stockCount,z.completeCount,z.publicityCount,
+    z.setUpCount,z.spotCheckCount,z.failCount,z.certificatesCount,z.acceptCount,z.endCount,z.authorizeCount,
+    z.rejectCount,z.applyCount,z.amountCount,z.costAmount,z.profit
+    from ( select  y.dispatch_province, y.cid, y.duty_dep, sum(y.dispatch_count)distributeCount,
+      sum(y.stock_count)stockCount, sum(y.complete_count)completeCount,sum(y.promulgate_count)publicityCount,
+      sum(y.set_up_count)setUpCount,sum(y.spot_check_count)spotCheckCount,sum(y.fail_count)failCount,
+      sum(y.certificates_count)certificatesCount,sum(y.accept_count)acceptCount,sum(y.end_count)endCount,
+      sum(y.authorize_count)authorizeCount,sum(y.reject_count)rejectCount, sum(y.apply_count)applyCount,
+      sum(y.commodity_price)amountCount,sum(y.cost_amount)costAmount, sum(y.commodity_price-y.cost_amount)profit
+      from(select b.dispatch_province, bp.cid, b.duty_dep,
+        b.stock_count,b.dispatch_count,b.promulgate_count, b.complete_count,b.set_up_count ,b.spot_check_count ,
+        b.fail_count ,b.certificates_count,     b.accept_count,b.end_count,b.authorize_count,b.reject_count,b.apply_count,
+        a.commodity_price ,b.cost_amount, a.task_distribution_time     from t_order_task a
+        left join t_task_mid b on a.id=b.tid     left join business_project bp on a.commodity_id =bp.id
+        where a.task_status in(1,2,3)
+    <if test="projectId !=null">
+    and a.commodity_id = #{projectId}
     </if>
     <if test="province !=null">
-      and dep.province = #{province}
+    and b.dispatch_province = #{province}
     </if>
     <if test="thchDepId !=null">
-      and ad.department_id = #{thchDepId}
-    </if>
-    <if test="projectStatus !=null">
-      and bp.cid =  #{projectStatus}
+    and b.duty_dep = #{thchDepId}
     </if>
     <if test="projectType !=null">
-      and bp.`type` = #{projectType}
+    and bp.`type` = #{projectType}
     </if>
-    <if test="projectId !=null">
-      and a.commodity_id = #{projectId}
+    <if test="projectStatus !=null">
+    and bp.cid= #{projectStatus}
+    </if>
+    <if test="startDate != null and endDate != null">
+    and a.task_distribution_time  between #{startDate} and #{endDate}
     </if>
-    group by  dep.province,ad.department_id,bp.cid )x inner join district_glossory dg on x.province=dg.id
-    inner join department de on x.department_id=de.id left join business_category bc on x.cid=bc.id
+    )y
+    group by   y.dispatch_province, y.cid, y.duty_dep  )z
+    left join business_category bc on z.cid=bc.id left join district_glossory dg on z.dispatch_province=dg.id
+    left join department d on z.duty_dep=d.id
     <if test="page_sql!=null">
       ${page_sql}
     </if>
@@ -1839,31 +1792,34 @@
 
   <select id="selectProvincialStatisticsCount" resultType="java.lang.Integer">
     select count(*)
-    from (select dep.province, ad.department_id,bp.cid
-    from t_order_task a left join t_order_new b on a.order_no =b.order_no  and b.delete_sign in(0,2) left join t_task_mid ttm on a.id=ttm.tid
-    left join department dep on b.order_dep =dep.id  inner join admin ad on a.task_receiver =ad.id
+    from(select y.dispatch_province  from (select bp.cid,
+    b.dispatch_province,b.duty_dep,a.cname,b.stock_count,b.dispatch_count,b.promulgate_count,
+    b.complete_count,b.set_up_count ,b.spot_check_count ,b.fail_count ,b.certificates_count,
+    b.accept_count,b.end_count,b.authorize_count,b.reject_count,b.apply_count,
+    a.commodity_price ,b.cost_amount, a.task_distribution_time
+    from t_order_task a
+    left join t_task_mid b on a.id=b.tid
     left join business_project bp on a.commodity_id =bp.id
-    where   a.split_status in(0,2)
-    <if test="startDate != null and endDate != null">
-      and a.task_distribution_time between #{startDate} and #{endDate}
+    where a.task_status in(1,2,3)
+    <if test="projectId !=null">
+      and a.commodity_id = #{projectId}
     </if>
     <if test="province !=null">
-      and dep.province = #{province}
+      and b.dispatch_province = #{province}
     </if>
     <if test="thchDepId !=null">
-      and ad.department_id = #{thchDepId}
-    </if>
-    <if test="projectStatus !=null">
-      and bp.cid =  #{projectStatus}
+      and b.duty_dep = #{thchDepId}
     </if>
     <if test="projectType !=null">
       and bp.`type` = #{projectType}
     </if>
-    <if test="projectId !=null">
-      and a.commodity_id = #{projectId}
+    <if test="projectStatus !=null">
+      and bp.cid= #{projectStatus}
+    </if>
+    <if test="startDate != null and endDate != null">
+      and a.task_distribution_time  between #{startDate} and #{endDate}
     </if>
-    group by  dep.province,ad.department_id,bp.cid )x inner join district_glossory dg on x.province=dg.id
-    inner join department de on x.department_id=de.id left join business_category bc on x.cid=bc.id
+    )y group by y.dispatch_province, y.cid, y.duty_dep )x
   </select>
 
   <select id="managerSelectByPage" resultType="com.goafanti.order.bo.managerListBo">

+ 44 - 42
src/main/java/com/goafanti/order/bo/OutProvincialStatistics.java

@@ -3,42 +3,16 @@ package com.goafanti.order.bo;
 import java.math.BigDecimal;
 
 public class OutProvincialStatistics {
-	
+
 	private String provinceName;
-	
+
 	private String thchDepName;
-	
+
 	private String projectStatus;
-	
+
 	private Integer province;
 	private String thchDepId;
 	private String bpId;
-	
-	
-	
-	public Integer getProvince() {
-		return province;
-	}
-
-	public void setProvince(Integer province) {
-		this.province = province;
-	}
-
-	public String getThchDepId() {
-		return thchDepId;
-	}
-
-	public void setThchDepId(String thchDepId) {
-		this.thchDepId = thchDepId;
-	}
-
-	public String getBpId() {
-		return bpId;
-	}
-
-	public void setBpId(String bpId) {
-		this.bpId = bpId;
-	}
 
 	/** 库存数 */
 	private Integer stockCount;
@@ -64,18 +38,46 @@ public class OutProvincialStatistics {
 	private Integer	applyCount;
 	/** 公示数 */
 	private Integer	publicityCount;
-	
+
 	private BigDecimal amountCount;
-	
+
 	private BigDecimal costAmount;
-	
+
 	private BigDecimal profit;
-	
-	
-	
 
-	
-	
+
+
+	public Integer getProvince() {
+		return province;
+	}
+
+	public void setProvince(Integer province) {
+		this.province = province;
+	}
+
+	public String getThchDepId() {
+		return thchDepId;
+	}
+
+	public void setThchDepId(String thchDepId) {
+		this.thchDepId = thchDepId;
+	}
+
+	public String getBpId() {
+		return bpId;
+	}
+
+	public void setBpId(String bpId) {
+		this.bpId = bpId;
+	}
+
+
+
+
+
+
+
+
 
 	public Integer getAcceptCount() {
 		return acceptCount;
@@ -173,7 +175,7 @@ public class OutProvincialStatistics {
 		this.projectStatus = projectStatus;
 	}
 
-	
+
 
 	public BigDecimal getAmountCount() {
 		return amountCount;
@@ -222,8 +224,8 @@ public class OutProvincialStatistics {
 	public void setPublicityCount(Integer publicityCount) {
 		this.publicityCount = publicityCount;
 	}
-	
-	
-	
+
+
+
 
 }