Browse Source

订单催款自动转法务开发

anderx 4 years ago
parent
commit
1e76f016c0

+ 3 - 0
src/main/java/com/goafanti/common/dao/TOrderMidMapper.java

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 public interface TOrderMidMapper {
     int deleteByPrimaryKey(Integer id);
@@ -38,4 +39,6 @@ public interface TOrderMidMapper {
     void updateAddCostAmount(@Param("tid")Integer tid, @Param("cost")BigDecimal cost);
 
     int updateByOrderNo(TOrderMid tm);
+
+    void updateByList(List<String> addList2);
 }

+ 10 - 0
src/main/java/com/goafanti/common/mapper/TOrderMidMapper.xml

@@ -361,6 +361,7 @@
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
+
   <select id="legalAffairsOrderList" resultType="com.goafanti.order.bo.OutOrderLegalAffairsListBo">
     select a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
     a.total_amount totalAmount ,a.settlement_amount  settlementAmount ,b.order_receivables orderReceivables,b.legal_affairs legalAffairs,
@@ -407,4 +408,13 @@
       and a.order_dep = #{depId}
     </if>
   </select>
+  <update id="updateByList">
+    update t_order_mid
+    set legal_affairs=1
+    where order_no in(
+    <foreach collection="list" index="index" item="item" separator=",">
+    #{item}
+    </foreach>
+        )
+  </update>
 </mapper>

+ 34 - 11
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -3,13 +3,12 @@ package com.goafanti.common.task;
 
 import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
 
 import javax.mail.MessagingException;
 
+import com.goafanti.order.bo.*;
+import com.goafanti.order.service.LegalAffairsService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,10 +36,6 @@ import com.goafanti.common.model.TOrderMid;
 import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.order.bo.InputNewOrderDunBo;
-import com.goafanti.order.bo.OrderDunTaskBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.bo.TOrderNewBo;
 import com.goafanti.order.enums.OrderDunProjectType;
 import com.goafanti.order.service.NewOrderDunService;
 import com.goafanti.order.service.OrderNewService;
@@ -64,6 +59,9 @@ public class OrderDunTask {
 	private PaymentNodeMapper	paymentNodeMapper;
 	@Autowired
 	private OrderProjectService	orderProjectService;
+	@Autowired
+	private LegalAffairsService legalAffairsService;
+
 	@Value(value = "${dev.name}")
 	private String devName=null;
 	@Autowired
@@ -81,11 +79,36 @@ public class OrderDunTask {
 	public void startTask() throws InterruptedException {
 		updateNewOrderDun();
 		Thread.sleep(2000);
-//		updateorderDun();
-		Thread.sleep(2000);
 		updatePaymentNode();
+		Thread.sleep(2000);
+		pushLegalAffairs();
 	}
-	
+
+	/**
+	 * 法务订单催款处理
+	 */
+	@RequestMapping(value = "/open/pushLegalAffairs", method = RequestMethod.GET)
+	public void pushLegalAffairs() {
+		List<OutOrderLegalAffairsListBo>  list=legalAffairsService.getLegalAffairsOrder();
+		ArrayList<String> addList = new ArrayList<>();
+		Date now=new Date();
+		for (OutOrderLegalAffairsListBo out : list) {
+			Long l=out.getDunStartTime().getTime()+AFTConstants.DUN_START_LIMIT_MS;
+			if (now.getTime()<l){
+				addList.add(out.getOrderNo());
+			}
+		}
+		List<String> addList2=new ArrayList<>();
+		if (!addList.isEmpty())
+		for (int i=0;i<addList.size();i++){
+			addList2.add(addList.get(i));
+			if (50 == addList2.size() || i == addList.size() - 1){
+				tOrderMidMapper.updateByList(addList2);
+			}
+
+		}
+	}
+
 	/**
 	 * 询处理需要新催款的信息
 	 */

+ 5 - 0
src/main/java/com/goafanti/order/service/LegalAffairsService.java

@@ -1,6 +1,9 @@
 package com.goafanti.order.service;
 
 import com.goafanti.order.bo.InputOrderListBo;
+import com.goafanti.order.bo.OutOrderLegalAffairsListBo;
+
+import java.util.List;
 
 public interface LegalAffairsService {
 
@@ -8,4 +11,6 @@ public interface LegalAffairsService {
     int pushTransferLagalAffairs(String orderNo);
 
     Object orderList(InputOrderListBo in);
+
+    List<OutOrderLegalAffairsListBo> getLegalAffairsOrder();
 }

+ 5 - 0
src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java

@@ -52,4 +52,9 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         }
         return p;
     }
+
+    @Override
+    public List<OutOrderLegalAffairsListBo> getLegalAffairsOrder() {
+        return (List<OutOrderLegalAffairsListBo>) findList("legalAffairsOrderList",new HashMap<>(),1,999999);
+    }
 }