haungfuli 2 vuotta sitten
vanhempi
commit
fa71347a10

+ 2 - 2
winsea-haixin-platform-backend/src/main/resources/application-test.yml

@@ -1,5 +1,5 @@
 server:
 server:
-  port: 8988
+  port: 8099
 
 
 spring:
 spring:
   application:
   application:
@@ -7,7 +7,7 @@ spring:
   datasource:
   datasource:
     driver-class-name: com.mysql.jdbc.Driver
     driver-class-name: com.mysql.jdbc.Driver
     password: Ccj841968545
     password: Ccj841968545
-    url: jdbc:mysql://47.100.3.209:3306/wlhy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
+    url: jdbc:mysql://106.14.75.12:3306/wlhy_test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&serverTimezone=Asia/Shanghai
     username: root
     username: root
   redis:
   redis:
     database: 1
     database: 1

+ 6 - 1
winsea-haixin-platform-backend/src/main/resources/application.yml

@@ -14,7 +14,7 @@ spring:
     serialization:
     serialization:
       write_dates_as_timestamps: false
       write_dates_as_timestamps: false
   profiles:
   profiles:
-    active: local
+    active: test
   resources:
   resources:
     static-locations: file:///winsea/static/
     static-locations: file:///winsea/static/
   thymeleaf:
   thymeleaf:
@@ -24,6 +24,11 @@ spring:
     prefix: classpath:/templates/
     prefix: classpath:/templates/
     suffix: .html
     suffix: .html
 
 
+#运行环境 1.开发环境 2.测试环境 3.生产环境
+com:
+  changyuntong:
+    env: 1
+
 auth:
 auth:
   anon-methods:
   anon-methods:
     - GET
     - GET

+ 4 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/HyCarrierInfo.java

@@ -55,6 +55,10 @@ public class HyCarrierInfo extends BaseModel<HyCarrierInfo> {
      * 车牌号
      * 车牌号
      */
      */
     private String carNo;
     private String carNo;
+    /**
+     * 运输时长(小时)
+     */
+    private Double transportationDuration;
     /**
     /**
      * 预计运费(元)
      * 预计运费(元)
      */
      */

+ 2 - 2
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/NewsInfo.java

@@ -54,11 +54,11 @@ public class NewsInfo extends BaseModel<NewsInfo> {
      */
      */
     private String number;
     private String number;
     /**
     /**
-     * 消息类型key(1系统消息2承运通知3举报结果4投诉结果)
+     * 消息类型key(1系统消息2承运通知3举报结果4投诉结果5超时通知
      */
      */
     private String newsTypeKey;
     private String newsTypeKey;
     /**
     /**
-     * 消息类型(1系统消息2承运通知3举报结果4投诉结果)
+     * 消息类型(1系统消息2承运通知3举报结果4投诉结果5超时通知
      */
      */
     private String newsType;
     private String newsType;
     /**
     /**

+ 57 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OrderInfoServiceImpl.java

@@ -47,6 +47,7 @@ import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
@@ -120,6 +121,62 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
     @Value("${com.changyuntong.env}")
     @Value("${com.changyuntong.env}")
     private String ENV;
     private String ENV;
 
 
+    /**
+     * 查询订单是否超时(每分钟执行一次)
+     */
+    @Transactional
+    @Scheduled(cron = "0 */1 * * * ?")
+    public void queryOrderTimeout(){
+        //查询所有运输中的订单
+        List<OrderInfo> orderInfoList = this.selectList(new EntityWrapper<OrderInfo>().eq("order_status_key", 13)
+                .eq("delete_flag", "0"));
+        if (CollectionUtils.isNotEmpty(orderInfoList)) {
+            orderInfoList.forEach(orderInfo -> {
+                //获取当前日期
+                Date now = new Date();
+                //查询承运表信息
+                HyCarrierInfo hyCarrierInfo = carrierInfoService.selectOne(new EntityWrapper<HyCarrierInfo>().eq("order_id", orderInfo.getId())
+                        .eq("delete_flag", "0"));
+                //获取装车时间和运输时长,计算预计送达时间
+                int min = (int)(hyCarrierInfo.getTransportationDuration() * 60);
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(hyCarrierInfo.getLoadingDate());
+                calendar.add(Calendar.MINUTE, min);
+                Date date = calendar.getTime();
+                //当前时间与预计送达时间比较
+                int result = date.compareTo(now);
+                if (result < 0) {
+                    //给司机发送消息
+                    NewsInfo newsInfo = new NewsInfo();
+                    newsInfo.setReCommonId(orderInfo.getCommonId());
+                    newsInfo.setBussId(orderInfo.getId());
+                    newsInfo.setNewsTitle("超时通知!");
+                    newsInfo.setNewsContent("订单编号" + orderInfo.getOrderNo() + "未按时到达,请联系货主说明原因。");
+                    newsInfo.setNewsTypeKey("5");
+                    newsInfo.setNewsType("超时通知");
+                    newsInfoService.addNewsInfo(newsInfo);
+                    //给平台发送消息
+                    NewsInfo newsInfo1 = new NewsInfo();
+                    newsInfo1.setReCommonId("84f62127b7384dcdbaeaddfe460329fc");
+                    newsInfo1.setBussId(orderInfo.getId());
+                    newsInfo1.setNewsTitle("超时通知!");
+                    newsInfo1.setNewsContent("订单编号" + orderInfo.getOrderNo() + "未按时送达。");
+                    newsInfo1.setNewsTypeKey("5");
+                    newsInfo1.setNewsType("超时通知");
+                    newsInfoService.addNewsInfo(newsInfo1);
+                    //给货主发送消息
+                    NewsInfo newsInfo2 = new NewsInfo();
+                    newsInfo2.setReCommonId(orderInfo.getCargoCommonId());
+                    newsInfo2.setBussId(orderInfo.getId());
+                    newsInfo2.setNewsTitle("超时通知!");
+                    newsInfo2.setNewsContent("订单编号" + orderInfo.getOrderNo() + "未按时到达,请联系司机了解原因,或联系客服介入。");
+                    newsInfo2.setNewsTypeKey("5");
+                    newsInfo2.setNewsType("超时通知");
+                    newsInfoService.addNewsInfo(newsInfo2);
+                }
+            });
+        }
+    }
 
 
     /**
     /**
      * 司机订单列表
      * 司机订单列表