hujg преди 2 години
родител
ревизия
da33b0e2f4

+ 0 - 11
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -966,17 +966,6 @@ public class UniversalController extends BaseRESTfulController {
         return success(list);
     }
 
-    @ApiModelProperty(value = "关闭过期运输订单")
-    @PostMapping("/closePassedOrder")
-    @Scheduled(cron = "0 0 8 * * ?")
-    public RESTfulResult closePassedOrder() {
-        List<Map<String,Object>> passedOrderList = universalMapper.findPassedOrder();
-        System.out.println("关闭的未出厂过期订单如下:<" + passedOrderList + ">");
-        int result = universalMapper.closePassedOrder();
-        System.out.println("订单关闭数为:" + result);
-        return success(result);
-    }
-
     @ApiOperation(value = "内转计重承运合同物资")
     @PostMapping("/getInwardWeightMaterial")
     public RESTfulResult getInwardWeightMaterial(@RequestBody(required = false) Map<String,Object> mapValue,

+ 21 - 1
src/main/java/com/steerinfo/dil/service/impl/UniversalServiceImpl.java

@@ -6,8 +6,14 @@ import com.steerinfo.dil.mapper.UniversalMapper;
 import com.steerinfo.dil.service.UniversalService;
 import com.steerinfo.dil.util.ESUtil;
 import com.steerinfo.dil.util.HTTPRequestUtils;
+import com.steerinfo.framework.controller.RESTfulResult;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -22,7 +28,8 @@ import java.util.*;
  * @ author    :TXF
  * @ time      :2021/10/19 18:05
  */
-
+@EnableScheduling
+@EnableAsync
 @Service
 public class UniversalServiceImpl implements UniversalService {
 
@@ -227,4 +234,17 @@ public class UniversalServiceImpl implements UniversalService {
             return 0;
         }
     }
+
+    /**
+     * 关闭过期运输订单
+     * @return
+     */
+    @Async
+    @Scheduled(cron = "0 0 8 * * ?")
+    public void closePassedOrder() {
+        List<Map<String,Object>> passedOrderList = universalMapper.findPassedOrder();
+        System.out.println("关闭的未出厂过期订单如下:<" + passedOrderList + ">");
+        int result = universalMapper.closePassedOrder();
+        System.out.println("订单关闭数为:" + result);
+    }
 }

+ 4 - 5
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -263,11 +263,10 @@
         RM.MATERIAL_CODE "materialCode",
         RM.MATERIAL_ID AS "materialId"
         from RMS_MATERIAL RM
-        <where>
-            <if test="index != null">
-               instr(RM.MATERIAL_NAME, #{index}) > 0
-            </if>
-        </where>
+        WHERE RM.DELETED = 0
+        <if test="index != null">
+            AND instr(RM.MATERIAL_NAME, #{index}) > 0
+        </if>
         )
         <where>
         <if test="materialName != null">