he2802 1 سال پیش
والد
کامیت
ee55faddfc

+ 10 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -5,6 +5,7 @@ import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.framework.web.service.AsyncService;
 import com.zhongzheng.framework.web.service.WxLoginService;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
+import com.zhongzheng.modules.order.service.IOrderHandleService;
 import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
 import com.zhongzheng.modules.schedule.service.IScheduleService;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
@@ -43,6 +44,8 @@ public class ScheduleController extends BaseController {
 
     private final WxLoginService wxLoginService;
 
+    private final IOrderHandleService iOrderHandleService;
+
     /**
      * 商品购买发送消息
      * @return
@@ -458,4 +461,11 @@ public class ScheduleController extends BaseController {
         iScheduleService.usbUserDownload();
         return AjaxResult.success();
     }
+
+    @ApiOperation("经办订单超时关闭")
+    @GetMapping("/order/closeOverHandle")
+    public AjaxResult closeOverHandle(){
+        iOrderHandleService.overTimeCloseOrder();
+        return AjaxResult.success();
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderHandleService.java

@@ -52,6 +52,8 @@ public interface IOrderHandleService extends IService<OrderHandle> {
 
 	Boolean closeOrder(OrderHandleAddBo bo);
 
+	Boolean overTimeCloseOrder();
+
 	/**
 	 * 根据编辑业务对象修改经办录单
 	 * @param bo 经办录单编辑业务对象

+ 10 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderHandleServiceImpl.java

@@ -368,9 +368,6 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
         if (Validator.isEmpty(orderHandle)) {
             throw new CustomException("录单单号不存在");
         }
-        if (orderHandle.getCreateUserId() != bo.getCreateUserId()) {
-            throw new CustomException("非法操作");
-        }
         if (orderHandle.getPayStatus() != 0) {
             throw new CustomException("非待支付状态");
         }
@@ -388,7 +385,17 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
             editBo.setOrderStatus(-1);
             iOrderService.updateByEditBo(editBo);
         }
+        return true;
+    }
 
+    @Override
+    public Boolean overTimeCloseOrder() {
+        List<OrderHandle> list = list(new LambdaQueryWrapper<OrderHandle>().eq(OrderHandle::getPayStatus, 0).gt(OrderHandle::getOverTime,DateUtils.getNowTime()));
+        for(OrderHandle orderHandle : list){
+            OrderHandleAddBo addBo = new OrderHandleAddBo();
+            addBo.setHandleOrderSn(orderHandle.getHandleOrderSn());
+            closeOrder(addBo);
+        }
         return true;
     }
 

+ 16 - 1
zhongzheng-system/src/main/resources/mapper/modules/order/OrderHandleMapper.xml

@@ -20,6 +20,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="goodsType" column="goods_type"/>
     </resultMap>
 
+
+    <resultMap type="com.zhongzheng.modules.order.vo.OrderHandleGoodsVo" id="OrderHandleGoodsVoResult">
+        <result property="realname" column="realname"/>
+        <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
+        <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="year" column="year"/>
+        <result property="goodsRealPrice" column="goods_real_price"/>
+        <result property="orderGoodsId" column="order_goods_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="gradeId" column="grade_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="subjectNames" column="subject_names"/>
+    </resultMap>
+
     <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderHandleQueryBo" resultType="com.zhongzheng.modules.order.vo.OrderHandleVo">
         SELECT  u.*,
         (select count( DISTINCT o.user_id ) from `order` o  where  u.handle_order_sn = o.handle_order_sn) user_num,
@@ -91,7 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY u.create_time DESC
     </select>
 
-    <select id="selectOrderGoodsList" parameterType="com.zhongzheng.modules.order.bo.OrderHandleQueryBo" resultType="com.zhongzheng.modules.order.vo.OrderHandleGoodsVo">
+    <select id="selectOrderGoodsList" parameterType="com.zhongzheng.modules.order.bo.OrderHandleQueryBo" resultMap="OrderHandleGoodsVoResult">
         SELECT
             u.realname,
             u.id_card,