haungfuli 3 years ago
parent
commit
3a36c51dc8

+ 10 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/NewsInfoController.java

@@ -33,6 +33,16 @@ public class NewsInfoController {
         return newsInfoService.selectNewsInfo(newsInfo);
     }
 
+    /**
+     * 未读消息数
+     * @param newsInfo
+     * @return
+     */
+    @GetMapping("/unreadMessage")
+    public Long unreadMessage (NewsInfo newsInfo) {
+        return newsInfoService.unreadMessage(newsInfo);
+    }
+
     /**
      * 添加消息
      * @param newsInfo

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

@@ -304,6 +304,12 @@ public class OrderInfo extends BaseModel<OrderInfo> {
     @TableField(exist = false)
     private String loadingFlag;
 
+    /**
+     * 合计付款
+     */
+    @TableField(exist = false)
+    private Float totalRepayable;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -41,6 +41,10 @@ public enum YExceptionEnum {
 	COMPANY_NAME_ERROR("ERROR006", "企业名称重复,不可添加!"),
 	UNIFIED_SOCIAL_CREDIT_CODE_ERROR("ERROR007", "统一社会信用代码重复,不可添加!"),
 	REFRESH_TIMES_UPPER_LIMIT("ERROR008", "今日刷新次数已达上限!"),
+	DRIVER_IDENTITY_AUTHENTICATION("ERROR009", "请完成司机身份认证!"),
+	CERTIFICATE_EXPIRED("ERROR010", "相关证件已过期,请到“我的-司机认证”中更新证件。"),
+	TASK_CANCELLED("ERROR011", "任务已撤销!"),
+	ORDER_SNATCHED("ERROR012", "已抢单,请等待货主确认!"),
 	;
 	@Getter
 	private String value;

+ 8 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/NewsInfoMapper.java

@@ -34,4 +34,12 @@ public interface NewsInfoMapper extends BaseMapper<NewsInfo> {
      * @return
      */
     List<NewsInfo> getListByCondition(Map<String, Object> pageView);
+
+    /**
+     * 未读消息数
+     *
+     * @param pageView
+     * @return
+     */
+    Long getUnCountByCondition(Map<String, Object> pageView);
 }

+ 7 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/INewsInfoService.java

@@ -22,6 +22,13 @@ public interface INewsInfoService extends IService<NewsInfo> {
      */
     Page<NewsInfo> selectNewsInfo(NewsInfo newsInfo);
 
+    /**
+     * 未读消息数
+     * @param newsInfo
+     * @return
+     */
+    Long unreadMessage (NewsInfo newsInfo);
+
     /**
      * 添加消息
      * @param newsInfo

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

@@ -56,6 +56,21 @@ public class NewsInfoServiceImpl extends ServiceImpl<NewsInfoMapper, NewsInfo> i
     }
 
 
+    /**
+     * 未读消息数
+     * @param newsInfo
+     * @return
+     */
+    @Override
+    public Long unreadMessage (NewsInfo newsInfo){
+        Map<String, Object> pageView = new HashMap<>(3);
+        //用户id
+        pageView.put("reCommonId", newsInfo.getReCommonId());
+        // 查询总数
+        Long dataCount = baseMapper.getUnCountByCondition(pageView);
+        return dataCount;
+    }
+
 
     /**
      * 新增消息

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

@@ -844,7 +844,28 @@ public class PublishTaskInfoServiceImpl extends ServiceImpl<PublishTaskInfoMappe
         OrderInfo orderInfo = new OrderInfo();
         orderInfo.setId(IdGenerator.generateUUID());
         orderInfo.setCommonId(publishTaskInfo.getDriverCommonId());
+        //判断司机是否认证
+        DriverInfo driverInfo = driverInfoService.selectOne(new EntityWrapper<DriverInfo>().eq("common_id",publishTaskInfo.getDriverCommonId())
+            .eq("delete_flag","0"));
+        if(driverInfo == null){
+            throw new YException(YExceptionEnum.DRIVER_IDENTITY_AUTHENTICATION);
+        }
+        //司机证件过期
+        if(StringUtils.isEmpty(driverInfo.getOverdueFlag())){
+            throw new YException(YExceptionEnum.CERTIFICATE_EXPIRED);
+        }
         orderInfo.setCargoCommonId(publishTaskInfo.getCommonId());
+        //查询货主身份是否删除
+        CargoOwnerInfo cargoOwnerInfo = cargoOwnerInfoService.selectOne(new EntityWrapper<CargoOwnerInfo>().eq("delete_flag","0"));
+        if(cargoOwnerInfo == null){
+            throw new YException(YExceptionEnum.TASK_CANCELLED);
+        }
+        //查询货主身份授权是否到期
+        CargoOwnerCompInfo cargoOwnerCompInfo = cargoOwnerCompInfoService.selectOne(new EntityWrapper<CargoOwnerCompInfo>().eq("delete_flag","0"));
+        boolean cancelled = "11".equals(cargoOwnerCompInfo.getStatusKey()) || "17".equals(cargoOwnerCompInfo.getStatusKey());
+        if (cancelled) {
+            throw new YException(YExceptionEnum.TASK_CANCELLED);
+        }
         //获取当前年月日
         SimpleDateFormat f = new SimpleDateFormat("yyyyMMdd");//设置日期格式
         String date = f.format(new Date(System.currentTimeMillis()));
@@ -893,6 +914,13 @@ public class PublishTaskInfoServiceImpl extends ServiceImpl<PublishTaskInfoMappe
         orderInfo.setOrderStatus(StatusEnum.OWNER_CONFIRMED.getName());
         orderInfo.setCargoOwnerStatusKey(StatusEnum.OWNER_PENDING_STATEMENT.getFlag());
         orderInfo.setCargoOwnerStatus(StatusEnum.OWNER_PENDING_STATEMENT.getName());
+        //判断是否已抢过单
+        OrderInfo orderInfo1 = orderInfoService.selectOne(new EntityWrapper<OrderInfo>().eq("common_id",publishTaskInfo.getDriverCommonId())
+        .eq("cargo_common_id",publishTaskInfo.getCommonId()).eq("delete_flag","0"));
+        boolean order = "1".equals(orderInfo1.getCargoOwnerStatusKey());
+        if (order) {
+            throw new YException(YExceptionEnum.ORDER_SNATCHED);
+        }
         boolean one = orderInfoService.insert(orderInfo);
 
         // 向货主发送信息

+ 10 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/NewsInfoMapper.xml

@@ -8,7 +8,6 @@
         FROM news_info
         WHERE delete_flag = '0'
         AND re_common_id = #{commonId}
-
     </select>
 
 
@@ -35,4 +34,14 @@
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+
+    <!-- 获得未读消息总数 -->
+    <select id="getUnCountByCondition" parameterType="Map" resultType="java.lang.Long">
+        SELECT
+        COUNT(id)
+        FROM news_info
+        WHERE delete_flag = '0'
+        AND re_common_id = #{reCommonId}
+        AND news_flag = '0'
+    </select>
 </mapper>

+ 3 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/OrderInfoMapper.xml

@@ -68,9 +68,11 @@
         o.order_status_key as orderStatusKey,
         o.create_date as createDate,
         o.update_date as updateDate,
-        c.id as carrierId
+        c.id as carrierId,
+        f.total_repayable as totalRepayable
         FROM order_info o
         LEFT JOIN carrier_info c on c.order_id = o.id and c.delete_flag = 0
+        LEFT JOIN freight_info f on f.order_id = o.id and f.delete_flag = 0
         WHERE o.delete_flag = '0'
         AND o.common_id = #{commonId}
         <if test="searchKeyWord != null and searchKeyWord != ''">