Browse Source

财务转交

anderx 6 years ago
parent
commit
cabd75adcd

+ 2 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -107,4 +107,6 @@ public interface TOrderNewMapper {
 
     OrderRefundDetailBo orderRefundDetail(String id);
 
+	int updateFinance(@Param("aid")String aid, @Param("orderNo")String orderNo, @Param("newFinance")String newFinance);
+
 }

+ 36 - 8
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -825,15 +825,21 @@
   	select * from (
   	select o.order_no as orderNo, o.order_type orderType, o.create_time as createTime, o.process_status as processStatus,
   	o.sign_time as signTime, u.nickname as buyerName,o.total_amount signTotalAmount, o.approval , a.name sellerName
-  	,liquidation_status
+  	,liquidation_status,contract_no as contractNo
   	from t_order_new o 
   	left join `user` u on o.buyer_id = u.id
   	left join admin a on o.salesman_id = a.id
   	where delete_sign = 0
   	and order_status = 2
-  	<if test="o.processStatus != null">
+  	<if test="o.processStatus == 2">
   	and process_status = #{o.processStatus,jdbcType=INTEGER}
   	</if>
+  	<if test="o.processStatus == 3">
+  	and process_status >= #{o.processStatus,jdbcType=INTEGER}
+  	</if>
+  	<if test="o.processStatus == null or o.processStatus ==''">
+  	and process_status >= 2
+  	</if>
   	<if test='o.orderNo != null and o.orderNo != ""'>
   	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
   	</if>
@@ -852,7 +858,7 @@
   	union 
 	select o.order_no as orderNo, o.order_type orderType, o.create_time as createTime, o.process_status as processStatus, 
 	o.sign_time as signTime, u.nickname as buyerName,o.total_amount signTotalAmount, o.approval , a.name sellerName
-	,liquidation_status 
+	,liquidation_status ,contract_no as contractNo
 	from t_order_new o 
 	left join `user` u on o.buyer_id = u.id 
 	left join admin a on o.salesman_id = a.id 
@@ -893,9 +899,15 @@
   	left join admin a on o.salesman_id = a.id
   	where delete_sign = 0
   	and order_status = 2
-  	<if test="o.processStatus != null">
+  	<if test="o.processStatus == 2">
   	and process_status = #{o.processStatus,jdbcType=INTEGER}
   	</if>
+  	<if test="o.processStatus == 3">
+  	and process_status >= #{o.processStatus,jdbcType=INTEGER}
+  	</if>
+  	<if test="o.processStatus == null or o.processStatus ==''">
+  	and process_status >= 2
+  	</if>
   	<if test='o.orderNo != null and o.orderNo != ""'>
   	and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
   	</if>
@@ -1009,9 +1021,9 @@
   </select>
   <!-- 财务专员查看需要待收款的数据 -->
   <select id="financeList" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
-  select  o.order_no as orderNo, o.sign_time as signTime, u.nickname as buyerName, o.order_status as orderStatus, 
+  select  o.order_no as orderNo, o.sign_time as signTime, u.nickname as buyerName, o.order_status as orderStatus,
+   o.process_status as processStatus,ifnull(b.amount,0) as actuallyTotalAmount, o.contract_no as contractNo,o.approval,
   a.name as sellerName, o.salesman_id as sellerId, o.buyer_id as buyerId, o.liquidation_status as liquidationStatus , 
-  ifnull(b.amount,0) as actuallyTotalAmount, o.contract_no as contractNo,
   o.first_amount as signFirstPayment, o.total_amount as signTotalAmount,o.create_time as createTime,
   0 as companyId, "湖南科德信息咨询有限公司" as companyName
   	 from t_order_new o 
@@ -1020,7 +1032,13 @@
   	 left join (select sum(transaction_amount) as amount ,order_no from t_order_bill_new
   				group by order_no ) b on b.order_no = o.order_no
   	 where delete_sign = 0
-  		and process_status >= 3
+  	 	<if test='o.processStatus == 3'>
+	  	and process_status = #{o.processStatus,jdbcType=INTEGER}
+	  	</if>
+	  	<if test='o.processStatus == 4'>
+	  	and process_status >= #{o.processStatus,jdbcType=INTEGER}
+	  	</if>
+  		and process_status
   		and (approval = 0 or approval = 2)
 	  	and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
   		<if test='o.orderStatus != null and o.orderStatus != ""'>
@@ -1060,7 +1078,12 @@
   	 left join (select sum(transaction_amount) as amount ,order_no from t_order_bill_new
   				group by order_no ) b on b.order_no = o.order_no
   	 where delete_sign = 0
-  		and process_status >= 3
+  		<if test='o.processStatus == 3'>
+	  	and process_status = #{o.processStatus,jdbcType=INTEGER}
+	  	</if>
+	  	<if test='o.processStatus == 4'>
+	  	and process_status >= #{o.processStatus,jdbcType=INTEGER}
+	  	</if>
   		and (approval = 0 or approval = 2)
 	  	and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
 	  	<if test='o.orderStatus != null and o.orderStatus != ""'>
@@ -1391,4 +1414,9 @@
      left join t_order_new b  on a.order_no=b.order_no
      where a.id= #{id,jdbcType=INTEGER}
   </select>
+  <update id="updateFinance" parameterType="string">
+  update t_order_new set finance_id= #{newFinance,jdbcType=VARCHAR}
+	where order_no= #{orderNo,jdbcType=VARCHAR}
+	and finance_id= #{aid,jdbcType=VARCHAR}
+  </update>
 </mapper>

+ 9 - 0
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -426,6 +426,15 @@ public class AdminNewOrderApiController extends CertifyApiController {
 		}
 		return res;
 	}
+	/**
+	 * 财务订单转交
+	 */
+	@RequestMapping(value = "/updateFinance", method= RequestMethod.GET)
+	public Result updateFinance(String orderNo,String newFinance) {
+		Result res = new Result();
+		orderNewService.updateFinance( orderNo, newFinance);
+		return res;
+	}
 	
 	/** 退单文件上传 **/
 	@RequestMapping(value = "/uploadRefundOrderFile", method = RequestMethod.POST)

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

@@ -53,7 +53,7 @@ public class FundManagerOrderApiController extends CertifyApiController {
 		Result res = new Result();
 		//判断当前登录的角色是不是财务管理员
 		
-		order.setProcessStatus(2);//订单状态为2
+		//order.setProcessStatus(2);//订单状态为2   改为前端传
 		res.setData(fundManageOrderServiceImpl.allUnassignedOrder(order, pageNo, pageSize,1));
 		return res;
 	}
@@ -92,7 +92,7 @@ public class FundManagerOrderApiController extends CertifyApiController {
 		Result res = new Result();
 		//财务专员自己的id
 		order.setFinanceId(TokenManager.getAdminId());
-		order.setProcessStatus(3);//分配给自己
+		//order.setProcessStatus(3);//分配给自己 改为前端 传3未分配  4已分配
 		order.setOrderStatus(2);//营销管理员审核通过
 		res.setData(fundManageOrderServiceImpl.financeList(order, pageNo, pageSize));
 		return res;

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -165,5 +165,7 @@ public interface OrderNewService {
 	void addNoticAndSendEmail(String orderNo, OrderDunTaskBo t, Integer code)throws UnsupportedEncodingException, MessagingException;
 	boolean checkORderDun(String orderNo);
 	
+	int updateFinance(String orderNo, String newFinance);
+	
 	
 }

+ 11 - 0
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -75,6 +75,7 @@ import com.goafanti.order.enums.TaskState;
 import com.goafanti.order.enums.refundState;
 import com.goafanti.order.service.OrderNewService;
 import com.goafanti.order.service.OrderService;
+import com.mysql.fabric.xmlrpc.base.Data;
 
 @Service
 public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> implements OrderNewService {
@@ -216,6 +217,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (t2.getApproval()==ApprovalNewState.BH.getCode()||
 				t2.getOrderStatus()==OrderNewState.QDSHJJ.getCode()||
 					t2.getOrderStatus()==OrderNewState.YBH.getCode()) {
+			t.setCreateTime(new Date());
 			tOrderBackMapper.updateByOrderNoAndBackStatus(t.getOrderNo());
 		}
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
@@ -662,5 +664,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		 sendEmail(type==NoticeStatus.ORDER_DUN.getCode()?t.getOrderNo():orderNo, t==null?null:t.getId(), a, b);
 		 addNotic(type==NoticeStatus.ORDER_DUN.getCode()?t.getOrderNo():orderNo,type,a, b);
 	}
+
+
+
+	@Override
+	public int updateFinance(String orderNo, String newFinance) {
+		String aid=TokenManager.getAdminId();
+		return tOrderNewMapper.updateFinance(aid,orderNo,newFinance);
+		
+	}
 	
 }

+ 6 - 6
src/main/resources/props/config_local.properties

@@ -1,13 +1,13 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #本地
-#jdbc.url=jdbc\:mysql\://localhost\:3306/aft?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
-#jdbc.username=dev
-#jdbc.password=123456
+jdbc.url=jdbc\:mysql\://localhost\:3306/aft?useUnicode\=true&characterEncoding\=UTF-8&autoReconnect\=true&useSSL\=false
+jdbc.username=dev
+jdbc.password=123456
 #测试
-jdbc.url=jdbc:mysql://101.37.32.31:3306/aft20181217?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
-jdbc.username=root
-jdbc.password=aftdev
+#jdbc.url=jdbc:mysql://101.37.32.31:3306/aft20181217?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+#jdbc.username=root
+#jdbc.password=aftdev
 #\u68c0\u6d4b\u6570\u636e\u5e93\u94fe\u63a5\u662f\u5426\u6709\u6548\uff0c\u5fc5\u987b\u914d\u7f6e
 jdbc.validationQuery=SELECT 'x'
 #\u521d\u59cb\u8fde\u63a5\u6570