anderx лет назад: 5
Родитель
Сommit
210ac06322

+ 329 - 0
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1806,4 +1806,333 @@ ifnull(ttm.party_amount,0) partyAmount,a.commodity_price commodityPrice,a.outsou
    b on a.business_project_id =b.commodity_id 
    where a.`type` =1 and a.aid = #{aid} and a.uid = #{uid}
   </select>
+  
+  
+  
+  <select id="selectProjectStatisticsListByPage" resultType="com.goafanti.order.bo.OutProjectStatistics">
+	select  date_format( a.task_distribution_time, '%Y-%m-%d %H:%i:%S' ) distributionTime ,d.name province  ,c.name depName,e.salesman_name salesmanName,
+	b.contract_no contractNo ,b.order_no orderNo ,e.buyer_name userName,bc.cname ,a.commodity_name pname,ta.name techName,td.name techDepName,
+	a.status projectStatus,a.id,
+	<if test="status==1">
+	a.set_up_status setUpStatus , date_format( a.set_up_time , '%Y-%m-%d' ) setUpTime ,a.spot_check_status spotCheckStatus ,b.contact_mobile contactMobile ,
+	 b.legal_person_tel legalPersonTel , a.certificate_number certificateNumber,a.declaration_batch declarationBatch,
+	</if>
+	<if test="status==2">
+	date_format(a.licence_time, '%Y-%m-%d' ) licenceTime,
+	</if>
+	<if test="status==3">
+	a.commodity_quantity commodityQuantity ,ttm.certificates_count certificatesCount,ttm.urgent_day urgentDay ,ttm.if_material ifMaterial,
+	date_format(tp.licence_time, '%Y-%m-%d' )  licenceTime,
+	a.certificate_number certificateNumber,ttm.cost_amount costAmount ,
+	(a.commodity_price-ttm.cost_amount)profit,
+	</if>
+	<if test="status==4">
+	ttm.certificates_count certificatesCount,a.high_tech_status highTechStatus,
+	tp.patent_name patentName ,tp.patent_no patentNo ,date_format(tp.accept_time, '%Y-%m-%d ' ) acceptTime ,
+	date_format(tp.licence_time, '%Y-%m-%d' ) licenceTime ,date_format(tp.authorize_time, '%Y-%m-%d ' )  authorizeTime,
+	ttm.reject_count	rejectCount ,ttm.cost_amount costAmount ,(a.commodity_price-ttm.cost_amount)profit,
+	</if>
+	
+	a.commodity_quantity commodityQuantity , a.commodity_price commodityPrice ,a.special_comment specialComment
+	from t_order_task a left join t_order_new b on a.order_no =b.order_no left join department c on b.order_dep =c.id left join district_glossory d on c.province=d.id
+	<if test="status==3 or status==4">
+	left join task_progress tp  on a.id=tp.task_id 
+	</if> 
+	left join t_order_mid e on b.order_no =e.order_no left join business_project bp on a.commodity_id =bp.id left join business_category bc on bp.cid =bc.id 
+	left join t_task_mid ttm on a.id=ttm.tid left join admin ta on a.task_receiver =ta.id left join department td on ta.department_id =td.id
+	<if test="screen ==6">
+	right join (select tid ,accept_count sls from t_task_mid where accept_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==7">
+	right join (select tid ,end_count wjs from t_task_mid where end_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==8">
+	right join (select tid ,authorize_count sqs from t_task_mid where authorize_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==9">
+	right join (select tid ,reject_count bhs from t_task_mid where reject_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==10">
+	right join (select tid ,certificates_count xzs from t_task_mid where certificates_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==11">
+	right 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>
+	where a.split_status in (0,2) and a.task_status in (1,2,3)
+	<!--  筛选项 0库存 1派单 2完成 3立项 4抽查 5未通过 6受理 7完结 8授权 9驳回 10下证 11申请 -->
+	<if test="screen ==0">
+	and a.status in(0,1,2,3,5)
+	</if>
+	<if test="screen ==2">
+	and a.status in(4,6)
+	</if>	
+	<if test="screen ==3">
+	and a.set_up_status =1
+	</if>
+	<if test="screen ==4">
+	and a.spot_check_status in (1,2)
+	</if>	
+	<if test="screen ==5">
+	and a.spot_check_status =1
+	</if>	
+	<if test="screen ==12">
+	and a.publicity_time is not null
+	</if>
+    <if test="startDate != null and endDate != null">
+  	and a.task_distribution_time between #{startDate} and #{endDate}
+  	</if>
+  	<if test="province !=null">
+	and c.province =  #{province}
+  	</if>
+  	<if test="projectId !=null">
+	and a.commodity_id = #{projectId}
+  	</if>
+  	<if test="depId !=null">
+	and b.order_dep = #{depId}
+  	</if>
+  	<if test="thchDepId !=null">
+	and td.id= #{thchDepId}
+  	</if>
+  	<if test="projectStatus !=null">
+	and bp.cid= #{projectStatus}
+  	</if>
+  	<if test="projectType !=null">
+	and bp.type= #{projectType}
+  	</if>
+  	<if test="orderNo !=null">
+	and b.order_no = #{orderNo}
+	</if>
+	<if test="contractNo !=null">
+	and b.contract_no = #{contractNo}
+	</if>
+	<if test="userName !=null">
+	and e.buyer_name like concat( #{userName},'%')
+	</if> 
+	<if test="declarationBatch !=null">
+	and a.declaration_batch = #{declarationBatch}
+	</if>
+	<if test="projectSituation !=null">
+	and a.status = #{projectSituation}
+	</if>
+	<if test=" projectAmount !=null and projectAmount != 9">
+	and a.commodity_price &gt;=  #{amountStart} and  a.commodity_price &lt;  #{amountEnd}
+	</if>
+	<if test=" projectAmount == 9">
+	and a.commodity_price &gt;=  #{amountStart} 
+	</if>
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <select id="selectProjectStatisticsCount" resultType="java.lang.Integer">
+ 	select  count(*)
+	from t_order_task a left join t_order_new b on a.order_no =b.order_no left join department c on b.order_dep =c.id left join district_glossory d on c.province=d.id
+	left join t_order_mid e on b.order_no =e.order_no left join business_project bp on a.commodity_id =bp.id left join business_category bc on bp.cid =bc.id 
+	left join t_task_mid ttm on a.id=ttm.tid left join admin ta on a.task_receiver =ta.id left join department td on ta.department_id =td.id
+	<if test="status==3 or status==4">
+	left join task_progress tp  on a.id=tp.task_id 
+	</if> 
+	<if test="screen ==6">
+	right join (select tid ,accept_count sls from t_task_mid where accept_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==7">
+	right join (select tid ,end_count wjs from t_task_mid where end_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==8">
+	right join (select tid ,authorize_count sqs from t_task_mid where authorize_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==9">
+	right join (select tid ,reject_count bhs from t_task_mid where reject_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==10">
+	right join (select tid ,certificates_count xzs from t_task_mid where certificates_count &gt; 0)tj on a.id=tj.tid
+	</if>
+	<if test="screen ==11">
+	right 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>
+	where a.split_status in (0,2) and a.task_status in (1,2,3)
+	<!--  筛选项 0库存 1派单 2完成 3立项 4抽查 5未通过 6受理 7完结 8授权 9驳回 10下证 11申请 -->
+	<if test="screen ==0">
+	and a.status in(0,1,2,3,5)
+	</if>
+	<if test="screen ==2">
+	and a.status in(4,6)
+	</if>	
+	<if test="screen ==3">
+	and a.set_up_status =1
+	</if>
+	<if test="screen ==4">
+	and a.spot_check_status in (1,2)
+	</if>	
+	<if test="screen ==5">
+	and a.spot_check_status =1
+	</if>	
+	<if test="screen ==12">
+	and a.publicity_time is not null
+	</if>
+    <if test="startDate != null and endDate != null">
+  	and a.task_distribution_time between #{startDate} and #{endDate}
+  	</if>
+  	<if test="province !=null">
+	and c.province =  #{province}
+  	</if>
+  	<if test="projectId !=null">
+	and a.commodity_id = #{projectId}
+  	</if>
+  	<if test="depId !=null">
+	and b.order_dep = #{depId}
+  	</if>
+  	<if test="thchDepId !=null">
+	and td.id= #{thchDepId}
+  	</if>
+  	<if test="projectStatus !=null">
+	and bp.cid= #{projectStatus}
+  	</if>
+  	<if test="projectType !=null">
+	and bp.type= #{projectType}
+  	</if>
+  	<if test="orderNo !=null">
+	and b.order_no = #{orderNo}
+	</if>
+	<if test="contractNo !=null">
+	and b.contract_no = #{contractNo}
+	</if>
+	<if test="userName !=null">
+	and e.buyer_name like concat( #{userName},'%')
+	</if> 
+	<if test="declarationBatch !=null">
+	and a.declaration_batch = #{declarationBatch}
+	</if>
+	<if test="projectSituation !=null">
+	and a.status = #{projectSituation}
+	</if>
+	<if test=" projectAmount !=null and projectAmount != 9">
+	and a.commodity_price &gt;=  #{amountStart} and  a.commodity_price &lt;  #{amountEnd}
+	</if>
+	<if test=" projectAmount == 9">
+	and a.commodity_price &gt;=  #{amountStart} 
+	</if>
+  </select>
+  
+  
+   <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.cq) kcs,sum(pds.cq)pds,
+	<if test="status==1">
+	sum(wcs.cq)wcs, sum(lxs.cq)lxs,sum(ccs.cq)ccs,sum(wtg.cq)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.cq)wcs, sum(gss.cq)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 left join t_task_mid ttm on a.id=ttm.tid 
+	left join department dep on b.order_dep =dep.id  left join admin ad on a.task_receiver =ad.id
+	left join business_project bp on a.commodity_id =bp.id 
+	left join (select id,commodity_quantity cq from t_order_task where status in(0,1,2,3,5))kcs on a.id=kcs.id
+	left join (select id,commodity_quantity cq from t_order_task where task_status in (1,2,3))pds on a.id=pds.id
+	<if test="status==1">
+	left join (select id,commodity_quantity cq from t_order_task where status in(4,6))wcs on a.id=wcs.id
+	left join (select id,commodity_quantity cq from t_order_task where  set_up_status =1)lxs on a.id=lxs.id
+	left join (select id,commodity_quantity cq from t_order_task where spot_check_status in (1,2))ccs on a.id=ccs.id
+	left join (select id,commodity_quantity cq from t_order_task where spot_check_status =1)wtg on a.id=wtg.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,commodity_quantity cq from t_order_task where status in(4,6))wcs on a.id=wcs.id
+	left join (select id,commodity_quantity cq from t_order_task where  publicity_time is not null)gss on a.id=gss.id
+	</if>
+	where  b.order_dep is not null and a.split_status in(0,2) and a.task_status in (1,2,3)
+	<if test="startDate != null and endDate != null">
+  	and a.task_distribution_time between #{startDate} and #{endDate}
+  	</if>
+  	<if test="province !=null">
+	and dep.province = #{province} 
+  	</if>
+	<if test="thchDepId !=null">
+	and ad.department_id = #{thchDepId}
+  	</if>  	
+	<if test="projectStatus !=null">
+	and bp.cid =  #{projectStatus}
+  	</if>  	
+	<if test="projectType !=null">
+	and bp.`type` = #{projectType}
+  	</if>  	
+	<if test="projectId !=null">
+	 and a.commodity_id = #{projectId}
+  	</if>  	
+	group by  dep.province,ad.department_id,bp.cid )x left join district_glossory dg on x.province=dg.id
+left join department de on x.department_id=de.id left join business_category bc on x.cid=bc.id
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+  <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 left join t_task_mid ttm on a.id=ttm.tid 
+	left join department dep on b.order_dep =dep.id  left join admin ad on a.task_receiver =ad.id
+	left join business_project bp on a.commodity_id =bp.id 
+	where  b.order_dep is not null  and a.split_status in(0,2) and a.task_status in (1,2,3)
+	<if test="startDate != null and endDate != null">
+  	and a.task_distribution_time between #{startDate} and #{endDate}
+  	</if>
+  	<if test="province !=null">
+	and dep.province = #{province} 
+  	</if>
+	<if test="thchDepId !=null">
+	and ad.department_id = #{thchDepId}
+  	</if>  	
+	<if test="projectStatus !=null">
+	and bp.cid =  #{projectStatus}
+  	</if>  	
+	<if test="projectType !=null">
+	and bp.`type` = #{projectType}
+  	</if>  	
+	<if test="projectId !=null">
+	 and a.commodity_id = #{projectId}
+  	</if>  	
+	group by  dep.province,ad.department_id,bp.cid )x 
+  </select>
+  
 </mapper>

+ 0 - 4
src/main/java/com/goafanti/techproject/controller/AdminTechProjectApiController.java

@@ -1,6 +1,5 @@
 package com.goafanti.techproject.controller;
 
-import java.text.ParseException;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -12,9 +11,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
-import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.BindingResult;
@@ -34,7 +31,6 @@ import com.goafanti.common.enums.TechProjectStatus;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.ContractTask;
 import com.goafanti.common.model.TechProject;
-import com.goafanti.common.model.TechProjectLog;
 import com.goafanti.common.model.TechWebsite;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.AesUtils;