Browse Source

首页带变更订单逻辑调整,
咨询师与经理未审核、已审核页面逻辑修改

anderx 2 years ago
parent
commit
db2067dacd

+ 7 - 1
src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java

@@ -120,7 +120,13 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
     public Object consultantInfo(String startTime, String endTime) {
         String aid=TokenManager.getAdminId();
         endTime=endTime+" 23:59:59";
-        ConsultantStatisticsBo res = adminMapper.consultantStatisticsInfo(aid);
+        Integer shiroType=2;
+        if(TokenManager.hasRole(AFTConstants.TECH)){
+            shiroType=0;
+        }else if(TokenManager.hasRole(AFTConstants.TECH_MANAGER)){
+            shiroType=1;
+        }
+        ConsultantStatisticsBo res = adminMapper.consultantStatisticsInfo(aid,shiroType);
         if (res.getCountPublicRelease()==null)res.setCountPublicRelease(0);
         if (res.getOrderPayment()==null)res.setOrderPayment(0);
         ConsultantStatisticsBo asb = adminMapper.consultantStatisticsInfoByTime(aid, startTime, endTime);

+ 1 - 1
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -191,7 +191,7 @@ public interface AdminMapper {
 
     BigDecimal addAdminContactsRangeReceivables(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
-    ConsultantStatisticsBo consultantStatisticsInfo(String aid);
+    ConsultantStatisticsBo consultantStatisticsInfo(@Param("aid") String aid,@Param("type") Integer type);
 
     ConsultantStatisticsBo consultantStatisticsInfoByTime(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
 

+ 11 - 2
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1329,8 +1329,17 @@
     left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
         from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
     left join (SELECT b.aid,count(DISTINCT a.order_no) countChange from new_order_change a
-        left join order_examine b on a.order_no =b.order_no where a.process_state in (3,4)  and b.aid=#{aid}
-        and b.status =0  group by b.aid)z on x.aid=z.aid
+        left join order_examine b on a.order_no =b.order_no where 1=1
+    <if test="type==2">
+      and a.process_state in (3,4)
+    </if>
+    <if test="type==0">
+      and a.process_state in (3)
+    </if>
+    <if test="type==1">
+      and a.process_state in (4)
+    </if>
+    and b.aid=#{aid} and b.status =0  group by b.aid)z on x.aid=z.aid
     LEFT join (select b.task_receiver aid, count(*) orderPayment from t_order_payment a
         left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
         where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid

+ 42 - 14
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -501,11 +501,25 @@ select
   a.process_state processState,a.back_status backStatus from new_order_change  noc left join  new_order_change a on noc.id=a.id
   left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join admin d on b.salesman_id=d.id
   left join department e on b.order_dep=e.id
- 	<if test="processState==3">
- 	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
+    <if test="processState==3">
+      left join (select order_no, aid from order_examine where`type`=0
+      <if test="complete ==1">
+     and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+ 	group by order_no,aid)x on a.order_no = x.order_no
 	</if>
-	<if test="processState==4">
-	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
+    <if test="processState==4">
+      left join (select order_no, aid from order_examine where`type`=1
+      <if test="complete ==1">
+     and status=0
+     </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+	group by order_no,aid)x on a.order_no = x.order_no
 	</if>
 	where 1=1
 	<if test="processState==0">
@@ -580,7 +594,7 @@ select
 	<if test="complete ==1 and processState == 9">
 	 and (a.process_state = #{processState}  and a.status =1)
 	</if>
-	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
+	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
 	 and a.process_state &gt; #{processState}
 	</if>
 	<if test="complete ==2 and processState == 6">
@@ -614,12 +628,26 @@ select
   select count(*) from new_order_change noc left join  new_order_change a on noc.id=a.id
   left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id
   left join admin d on b.salesman_id=d.id left join department e on b.order_dep=e.id
-		<if test="processState==3">
- 	left join (select order_no, aid from order_examine where`type`=0 group by order_no,aid)x on a.order_no = x.order_no
-	</if>
-	<if test="processState==4">
-	left join (select order_no, aid from order_examine where`type`=1 group by order_no,aid)x on a.order_no = x.order_no
-	</if>
+    <if test="processState==3">
+      left join (select order_no, aid from order_examine where`type`=0
+      <if test="complete ==1">
+        and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+      group by order_no,aid)x on a.order_no = x.order_no
+    </if>
+    <if test="processState==4">
+      left join (select order_no, aid from order_examine where`type`=1
+      <if test="complete ==1">
+        and status=0
+      </if>
+      <if test="complete ==2">
+        and status=1
+      </if>
+      group by order_no,aid)x on a.order_no = x.order_no
+    </if>
 	where 1=1
     <if test="processState==0">
       and b.salesman_id= #{aid}
@@ -693,9 +721,9 @@ select
     <if test="complete ==1 and processState == 9">
       and (a.process_state = #{processState} and   a.status =1)
     </if>
-	<if test="complete ==2 and processState != 6 and processState != 8 and processState != 9">
-	 and a.process_state &gt; #{processState}
-	</if>
+    <if test="complete ==2 and processState != 6 and processState != 8 and processState != 9 and processState !=3 and processState !=4">
+      and a.process_state &gt; #{processState}
+    </if>
 	<if test="complete ==2 and processState == 6">
 	 and a.process_state &gt; 6 and a.process_state &lt; 10
 	</if>