Parcourir la source

财务审核逻辑修改开发

anderx il y a 1 an
Parent
commit
b868b26b31

+ 108 - 248
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -994,60 +994,82 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
       left join admin mg on a.salesman_id=mg.id
     </if>
   	where a.delete_sign in(0,2)
+   <include refid="selectOrderNewSql"/>
+  	order by
+  	<if test="specially == 3">
+  	a.approval,
+  	</if>
+  	<if test="specially == 4">
+  	a.process_status,
+  	</if>
+  	<if test="specially != 4">
+  	a.order_status,
+  	</if>
+  	a.create_time
+  	<if test="specially != 4">
+  	desc
+  	</if>
+  	<if test="page_sql!=null">
+	${page_sql}
+	</if>
+  </select>
+
+  <sql id="selectOrderNewSql">
+
     <if test="specially ==7">
-      and a.process_status > 4
+      and a.process_status > 5
       and a.salesman_id = #{aid,jdbcType=VARCHAR}
     </if>
     <if test="specially ==8">
-      and a.process_status > 4
-  	    <if test="uid !=null">
+      and a.process_status > 5
+      <if test="uid !=null">
         and a.buyer_id = #{uid}
-        </if>
+      </if>
     </if>
     <if test="specially ==9">
-      and a.process_status > 4 and bp.type=5
+      and a.process_status > 5 and bp.type=5
       <if test="aid !=null">
         and a.salesman_id = #{aid,jdbcType=VARCHAR}
       </if>
     </if>
-  	<if test="outsource != null">
-  	and a.outsource= #{outsource,jdbcType=INTEGER}
-  	</if>
-  	<if test="specially == 0">
-  	  <if test="approval ==null">
-  	  and a.approval in(0,1,2,4,5,7,8)
+    <if test="outsource != null">
+      and a.outsource= #{outsource,jdbcType=INTEGER}
+    </if>
+    <if test="specially == 0">
+      <if test="approval ==null">
+        and a.approval in(0,1,2,4,5,7,8)
       </if>
-  	and a.order_status  in(0,1,2,4)
-  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
-  	</if>
+      and a.order_status  in(0,1,2,4)
+      and a.salesman_id = #{aid,jdbcType=VARCHAR}
+    </if>
     <if test="specially == 10">
       and a.process_status = 1  and a.order_status in (0,1,2)
-  	  and mg.manager_id= #{aid}
+      and mg.manager_id= #{aid}
     </if>
     <if test="specially == 1">
       and a.process_status = 2  and a.order_status in (0,1,2)
     </if>
-  	<if test="specially == 2">
-  	and a.order_status in(3,5)
-  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
-  	</if>
+    <if test="specially == 2">
+      and a.order_status in(3,5)
+      and a.salesman_id = #{aid,jdbcType=VARCHAR}
+    </if>
     <if test="specially == 3">
       and  a.order_status=2
-  	<if test="manageType ==0">
-      and dep.approval_aid= #{aid,jdbcType=VARCHAR}
-    </if>
+      <if test="manageType ==0">
+        and dep.approval_aid= #{aid,jdbcType=VARCHAR}
+      </if>
       <if test="approval ==0">
-        and a.process_status in(4)
+        and a.process_status in(5)
         and a.approval = 0
       </if>
       <if test="approval ==1">
-        and a.process_status in(4)
+        and a.process_status in(5)
         and a.approval in
-            <if test="manageType ==0">
-            (1)
-            </if>
+        <if test="manageType ==0">
+          (1)
+        </if>
         <if test="manageType ==1">
-          (4)
+          (5)
         </if>
       </if>
       <if test="approval ==2">
@@ -1056,29 +1078,29 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
           (2,3)
         </if>
         <if test="manageType ==1">
-          (5,6)
+          (6,7)
         </if>
 
       </if>
     </if>
-  	  <if test="specially !=3 ">
-        <if test="approval ==0">
-          and a.approval = 0
-        </if>
-        <if test="approval ==1">
-          and a.approval in (1,4,7)
-        </if>
-        <if test="approval ==2">
-          and a.approval in (2,5,8)
-        </if>
-        <if test="approval ==4">
-          and a.approval in (1,2,4,5,7,8)
-        </if>
+    <if test="specially !=3 ">
+      <if test="approval ==0">
+        and a.approval = 0
       </if>
-  	<if test="specially == 4">
-      and a.process_status in (3,5,6,7,99)
-  	and a.order_status  in(1,2,3,4,6)
-  	</if>
+      <if test="approval ==1">
+        and a.approval in (1,4,7)
+      </if>
+      <if test="approval ==2">
+        and a.approval in (2,5,8)
+      </if>
+      <if test="approval ==4">
+        and a.approval in (1,2,4,5,7,8)
+      </if>
+    </if>
+    <if test="specially == 4">
+      and a.process_status in (3,6,7,8,99)
+      and a.order_status  in(1,2,3,4,6)
+    </if>
     <if test="deps!=null">
       and a.order_dep in
       <foreach close=")" collection="deps" item="dep" open="(" separator=",">
@@ -1088,76 +1110,58 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     <if test="distribution == 0">
       and a.process_status = 3
     </if>
-  	<if test="distribution == 1">
-  	and a.process_status = 5
-  	</if>
-  	<if test="distribution == 2">
-  	and a.process_status = 6
-  	</if>
-  	<if test="distribution == 3">
-  	and a.process_status = 7
-  	</if>
-  	<if test="name != null">
-  	and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
-  	</if>
+    <if test="distribution == 1">
+      and a.process_status = 6
+    </if>
+    <if test="distribution == 2">
+      and a.process_status = 7
+    </if>
+    <if test="distribution == 3">
+      and a.process_status = 8
+    </if>
+    <if test="name != null">
+      and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
     <if test="projectType != null">
       and c.project_type = #{projectType}
     </if>
     <if test="processStatus != null">
       and a.process_status = #{processStatus}
     </if>
-  	<if test="orderNo != null">
-  	and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="contractNo != null">
-  	and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="liquidationStatus != null">
-  	and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
-  	</if>
+    <if test="orderNo != null">
+      and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="contractNo != null">
+      and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="liquidationStatus != null">
+      and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
+    </if>
     <if test="tag != null">
-    and a.tag= #{tag}
+      and a.tag= #{tag}
     </if>
-  	<if test="amountStatus == 0">
-  	and a.total_amount &lt; 10
-  	</if>
-  	<if test="amountStatus == 1">
-  	and a.total_amount between 10 and 20
-  	</if>
-  	<if test="amountStatus == 2">
-  	and a.total_amount between 20 and 30
-  	</if>
-  	<if test="amountStatus == 3">
-  	and a.total_amount between 30 and 40
-  	</if>
-  	<if test="amountStatus == 4">
-  	and a.total_amount  &gt; 40
-  	</if>
-  	<if test="starTime !=null and endTime !=null">
+    <if test="amountStatus == 0">
+      and a.total_amount &lt; 10
+    </if>
+    <if test="amountStatus == 1">
+      and a.total_amount between 10 and 20
+    </if>
+    <if test="amountStatus == 2">
+      and a.total_amount between 20 and 30
+    </if>
+    <if test="amountStatus == 3">
+      and a.total_amount between 30 and 40
+    </if>
+    <if test="amountStatus == 4">
+      and a.total_amount  &gt; 40
+    </if>
+    <if test="starTime !=null and endTime !=null">
       and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     <if test="contractStart !=null and contractEnd !=null">
       and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
     </if>
-  	order by
-  	<if test="specially == 3">
-  	a.approval,
-  	</if>
-  	<if test="specially == 4">
-  	a.process_status,
-  	</if>
-  	<if test="specially != 4">
-  	a.order_status,
-  	</if>
-  	a.create_time
-  	<if test="specially != 4">
-  	desc
-  	</if>
-  	<if test="page_sql!=null">
-	${page_sql}
-	</if>
-  </select>
-
+  </sql>
    <select id="selectOrderNewListCount" resultType="java.lang.Integer">
   	select count(*)
   	from t_order_new a  left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
@@ -1170,151 +1174,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
        left join admin mg on a.salesman_id=mg.id
      </if>
   	where a.delete_sign in(0,2)
-     <if test="specially ==7">
-       and a.process_status > 4
-       and a.salesman_id = #{aid,jdbcType=VARCHAR}
-     </if>
-     <if test="specially ==8">
-       and a.process_status > 4
-       <if test="uid !=null">
-         and a.buyer_id = #{uid}
-       </if>
-     </if>
-     <if test="specially ==9">
-       and a.process_status > 4 and bp.type=5
-       <if test="aid !=null">
-         and a.salesman_id = #{aid,jdbcType=VARCHAR}
-       </if>
-     </if>
-     <if test="outsource != null">
-       and a.outsource= #{outsource,jdbcType=INTEGER}
-     </if>
-     <if test="specially == 0">
-       <if test="approval ==null">
-         and a.approval in(0,1,2,4,5,7,8)
-       </if>
-       and a.order_status  in(0,1,2,4)
-       and a.salesman_id = #{aid,jdbcType=VARCHAR}
-     </if>
-     <if test="specially == 10">
-       and a.process_status = 1  and a.order_status in (0,1,2)
-       and mg.manager_id= #{aid}
-     </if>
-  	<if test="specially == 1">
-  	and a.process_status = 2  and a.order_status in (0,1,2)
-  	</if>
-  	<if test="specially == 2">
-  	and a.order_status in(3,5)
-  	and a.salesman_id = #{aid,jdbcType=VARCHAR}
-  	</if>
-     <if test="specially == 3">
-       <if test="manageType ==0">
-         and dep.approval_aid= #{aid,jdbcType=VARCHAR}
-       </if>
-       and  a.order_status=2
-       <if test="approval ==0">
-         and a.process_status in(4)
-         and a.approval = 0
-       </if>
-       <if test="approval ==1">
-         and a.process_status in(4)
-         and a.approval in
-         <if test="manageType ==0">
-           (1)
-         </if>
-         <if test="manageType ==1">
-           (4)
-         </if>
-       </if>
-       <if test="approval ==2">
-         and a.approval in
-         <if test="manageType ==0">
-           (2,3)
-         </if>
-         <if test="manageType ==1">
-           (5,6)
-         </if>
-
-       </if>
-     </if>
-     <if test="specially !=3 ">
-       <if test="approval ==0">
-         and a.approval = 0
-       </if>
-       <if test="approval ==1">
-         and a.approval in (1,4,7)
-       </if>
-       <if test="approval ==2">
-         and a.approval in (2,5,8)
-       </if>
-       <if test="approval ==4">
-         and a.approval in (1,2,4,5,7,8)
-       </if>
-     </if>
-     <if test="specially == 4">
-       and a.process_status in (3,5,6,7,99)
-       and a.order_status  in(1,2,3,4,6)
-     </if>
-     <if test="deps!=null">
-       and a.order_dep in
-       <foreach close=")" collection="deps" item="dep" open="(" separator=",">
-         #{dep}
-       </foreach>
-     </if>
-     <if test="distribution == 0">
-       and a.process_status = 3
-     </if>
-     <if test="distribution == 1">
-       and a.process_status = 5
-     </if>
-     <if test="distribution == 2">
-       and a.process_status = 6
-     </if>
-     <if test="distribution == 3">
-       and a.process_status = 7
-     </if>
-     <if test="name != null">
-       and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
-     </if>
-     <if test="projectType != null">
-       and c.project_type = #{projectType}
-     </if>
-     <if test="processStatus != null">
-       and a.process_status = #{processStatus}
-     </if>
-     <if test="orderNo != null">
-       and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
-     </if>
-     <if test="contractNo != null">
-       and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
-     </if>
-     <if test="liquidationStatus != null">
-       and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
-     </if>
-     <if test="tag != null">
-       and a.tag= #{tag}
-     </if>
-     <if test="amountStatus == 0">
-       and a.total_amount &lt; 10
-     </if>
-     <if test="amountStatus == 1">
-       and a.total_amount between 10 and 20
-     </if>
-     <if test="amountStatus == 2">
-       and a.total_amount between 20 and 30
-     </if>
-     <if test="amountStatus == 3">
-       and a.total_amount between 30 and 40
-     </if>
-     <if test="amountStatus == 4">
-       and a.total_amount  &gt; 40
-     </if>
-     <if test="starTime !=null and endTime !=null">
-       and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
-     </if>
-     <if test="contractStart !=null and contractEnd !=null">
-       and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
-     </if>
+     <include refid="selectOrderNewSql"/>
 
   </select>
 

+ 2 - 2
src/main/java/com/goafanti/order/controller/FundManagerOrderApiController.java

@@ -150,12 +150,12 @@ public class FundManagerOrderApiController extends CertifyApiController {
 	 * 财务审核通过
 	 */
 	@RequestMapping(value="/financeApproval", method = RequestMethod.POST)
-	public Result financeApproval(String orderNo,String remarks) {
+	public Result financeApproval(String orderNo,String remarks,String aid) {
 		Result res=new Result();
 		if (StringUtils.isBlank(orderNo)) {
 			res.getError().add(buildError("","订单必须指定。"));
 		}
-		res.data(fundManageOrderServiceImpl.updateFinanceApproval(orderNo,remarks));
+		res.data(fundManageOrderServiceImpl.updateFinanceApproval(orderNo,remarks,aid));
 		return res;
 	}
 

+ 5 - 5
src/main/java/com/goafanti/order/enums/ProcessStatus.java

@@ -20,15 +20,15 @@ public enum ProcessStatus {
 	/**
 	 * 指定审核
 	 */
-//	ZDSH(4,"财务指定审核人"),
+	CWZDSH(4,"财务指定审核人"),
 	/** 已派特批审核 **/
-	YPTPSH(4,"已派特批审核"),
+	YPTPSH(5,"已派特批审核"),
 	/** 已派咨询师管理员 **/
-	YPZXSGLY(5,"已派咨询师管理员"),
+	YPZXSGLY(6,"已派咨询师管理员"),
 	/** 已部分派咨询师经理 **/
-	YBFPZXSGLY(6,"已部分分派咨询师经理"),
+	YBFPZXSGLY(7,"已部分分派咨询师经理"),
 	/** 已全部分派咨询师经理 **/
-	YQBFPZXSGLY(7,"已全部分派咨询师经理"),
+	YQBFPZXSGLY(8,"已全部分派咨询师经理"),
 
 
 	/** 无效 **/

+ 4 - 7
src/main/java/com/goafanti/order/service/FundManageOrderService.java

@@ -1,8 +1,5 @@
 package com.goafanti.order.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.goafanti.common.model.TOrderBack;
 import com.goafanti.common.model.TOrderBillNew;
 import com.goafanti.common.model.TOrderNew;
@@ -10,6 +7,9 @@ import com.goafanti.common.model.TOrderRefund;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.OrderListBo;
 
+import java.util.List;
+import java.util.Map;
+
 public interface FundManageOrderService {
 	
 	/**
@@ -95,10 +95,7 @@ public interface FundManageOrderService {
 	int updateContractNo(TOrderNew orderNew);
 	/**
 	 * 财务特批审核
-	 * @param orderNo
-	 * @param remarks 
-	 * @return
 	 */
-	int updateFinanceApproval(String orderNo, String remarks);
+	int updateFinanceApproval(String orderNo, String remarks ,String aid);
 	
 }

+ 25 - 27
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -1,32 +1,15 @@
 package com.goafanti.order.service.impl;
 
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-
-import com.goafanti.admin.service.DepartmentService;
-import com.goafanti.common.dao.*;
-import com.goafanti.common.model.*;
-import com.goafanti.common.utils.DateUtils;
-import com.goafanti.order.bo.TOrderTaskBo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.*;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
@@ -35,14 +18,18 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.OrderListBo;
 import com.goafanti.order.bo.TOrderNewBo;
-import com.goafanti.order.enums.ApprovalNewState;
-import com.goafanti.order.enums.BonusSubject;
-import com.goafanti.order.enums.OrderNewState;
-import com.goafanti.order.enums.ProcessStatus;
-import com.goafanti.order.enums.refundState;
+import com.goafanti.order.bo.TOrderTaskBo;
+import com.goafanti.order.enums.*;
 import com.goafanti.order.service.FundManageOrderService;
 import com.goafanti.order.service.OrderNewService;
 import com.goafanti.organization.bo.OrganizationListOut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
 
 @Service
 public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper> implements FundManageOrderService {
@@ -491,7 +478,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 	}
 
 	@Override
-	public int updateFinanceApproval(String orderNo,String remarks) {
+	public int updateFinanceApproval(String orderNo,String remarks,String aid) {
 		TOrderNew t=new TOrderNew();
 		TOrderNew use =checkDeleteSign(orderNo);
 		if (use.getProcessStatus()!=3) {
@@ -524,7 +511,18 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		orderNewService.pushExamineName(t);
 		//如果全部派单完成才需要通知和走下个流程
 		if (flag){
-			pushNoticeAndEmail(t, use);
+			//如果设置了特定审核需要步入特定审核
+			if (aid!=null){
+				t.setProcessStatus(ProcessStatus.CWZDSH.getCode());
+				List<String> aids = new ArrayList<>();
+				aids.add(aid);
+				TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
+				order.setProcessStatus(ProcessStatus.CWZDSH.getCode());
+				pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_YES.getCode(),order, TokenManager.getAdminId(), use.getApproval());
+			}else {
+				pushNoticeAndEmail(t, use);
+
+			}
 		}else {
 			List<TOrderExamine> tOrderExamines = tOrderExamineMapper.selectByOrderNo(orderNo,0);
 			StringBuffer str=new StringBuffer();