浏览代码

增加分润财务订单

周箭河 5 年之前
父节点
当前提交
7f87116d0c

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java

@@ -113,6 +113,6 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
 	 * @param id
 	 * @return
 	 */
-	Boolean getOrderStatus(Long id);
+	Boolean getOrderStatus(Long id) throws Exception;
 
 }

+ 25 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -13,6 +13,7 @@ import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.adapay.Payment;
@@ -95,13 +96,14 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 
     @Override
     public void queryOrderStatus() throws Exception {
-        yqPayQuery();
-        adaPayQuery();
+        yqPayQuery(null);
+        adaPayQuery(null);
     }
 
-    private void yqPayQuery() throws Exception {
-        List<StudentPaymentOrder> payingOrders = findOrdersByStatus(DealStatusEnum.ING, "YQPAY");
-
+    private void yqPayQuery(List<StudentPaymentOrder> payingOrders) throws Exception {
+        if (payingOrders == null) {
+            payingOrders = findOrdersByStatus(DealStatusEnum.ING, "YQPAY");
+        }
         if (payingOrders.size() == 0) {
             return;
         }
@@ -144,8 +146,10 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         }
     }
 
-    private void adaPayQuery() throws Exception {
-        List<StudentPaymentOrder> payingOrders = findOrdersByStatus(DealStatusEnum.ING, "ADAPAY");
+    private void adaPayQuery(List<StudentPaymentOrder> payingOrders) throws Exception {
+        if (payingOrders == null) {
+            payingOrders = findOrdersByStatus(DealStatusEnum.ING, "ADAPAY");
+        }
         if (payingOrders.size() == 0) {
             return;
         }
@@ -329,8 +333,19 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public Boolean getOrderStatus(Long id) {
-        return null;
-        //StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(id);
+    public Boolean getOrderStatus(Long id) throws Exception {
+        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(id);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        if(studentPaymentOrderDao.update(studentPaymentOrder) <= 0){
+            throw new BizException("订单状态更新失败,请重试");
+        }
+        List<StudentPaymentOrder> orderList = new ArrayList<>();
+        orderList.add(studentPaymentOrder);
+        if (studentPaymentOrder.getPaymentChannel().equals("ADAPAY")) {
+            adaPayQuery(orderList);
+        } else if (studentPaymentOrder.getPaymentChannel().equals("YQPAY")) {
+            yqPayQuery(orderList);
+        }
+        return true;
     }
 }

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml

@@ -180,6 +180,6 @@
 
     <!-- 根据支付类型获取支付配置 -->
     <select id="getPaymentConfigs" resultMap="SysPaymentConfig">
-        SELECT * FROM sys_payment_config WHERE pay_type_ #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        SELECT * FROM sys_payment_config WHERE pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </select>
 </mapper>