haungfuli 2 tahun lalu
induk
melakukan
6ca0a45eff

+ 5 - 3
winsea-haixin-platform-backend/src/main/java/com/yh/saas/platform/controller/LoginController.java

@@ -41,9 +41,11 @@ public class LoginController {
         String keyStr = getIpRequest(request);
         if(redisTemplate.hasKey(keyStr)) {
             // 登录时候先判断是否有登录错误的计数
-            int errorNum = Integer.valueOf((String) redisTemplate.opsForValue().get(keyStr));
-            if(errorNum==5){
-                throw new YException(YExceptionEnum.CONG_TERM_OF_VADMIN);
+            if (redisTemplate.opsForValue().get(keyStr) != null){
+                int errorNum = Integer.valueOf((String) redisTemplate.opsForValue().get(keyStr));
+                if(errorNum==5){
+                    throw new YException(YExceptionEnum.CONG_TERM_OF_VADMIN);
+                }
             }
         }
         Account u = this.getTargetUser(user);

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

@@ -110,5 +110,17 @@ public class HyCargoOwnerCapitalInfoController {
     public Page<HyCargoOwnerCapitalInfo> selectBankFlow(HyCargoOwnerCapitalInfo hyCargoOwnerCapitalInfo) {
         return hyCargoOwnerCapitalInfoService.selectBankFlow(hyCargoOwnerCapitalInfo);
     }
+
+    /**
+     * 查看北斗轨迹扣费
+     *
+     * @param hyCargoOwnerCapitalInfo
+     * @return
+     */
+    @Log(title = "查看北斗轨迹扣费")
+    @PostMapping("/api/lookBeiDou")
+    public String lookBeiDou(@RequestBody HyCargoOwnerCapitalInfo hyCargoOwnerCapitalInfo) {
+        return hyCargoOwnerCapitalInfoService.lookBeiDou(hyCargoOwnerCapitalInfo);
+    }
 }
 

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

@@ -46,7 +46,7 @@ public class HyCargoOwnerCapitalInfo extends BaseModel<HyCargoOwnerCapitalInfo>
      */
     private String companyId;
     /**
-     * 类型(充值、提现、支付预付款、支付尾款)
+     * 类型(充值、提现、支付预付款、支付尾款、查看北斗轨迹
      */
     private String types;
     /**
@@ -126,7 +126,7 @@ public class HyCargoOwnerCapitalInfo extends BaseModel<HyCargoOwnerCapitalInfo>
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private String endDate;
     /**
-     * 提现(充值)标识(1个人2企业)
+     * 提现(充值),查看北斗轨迹 标识(1个人2企业)
      */
     @TableField(exist = false)
     private String flag;

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

@@ -328,6 +328,12 @@ public class OrderInfo extends BaseModel<OrderInfo> {
      * 备注
      */
     private String remark;
+    /**
+     * 货主查看北斗轨迹时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date lookBeiDouDate;
 
 
     @TableField(exist = false)

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

@@ -80,8 +80,8 @@ public class ExceptionDefinition {
     public static  ServiceExceptionDefinition IDENTITY_IS_BEING_AUDITED =
             new ServiceExceptionDefinition(11017, "粮商身份正在审核中");
 
-    public static  ServiceExceptionDefinition DRIVER_IS_BEING_AUDITED =
-            new ServiceExceptionDefinition(11020, "司机身份正在审核中");
+    public static  ServiceExceptionDefinition USER_PHONE_NOT_REGISTERED =
+            new ServiceExceptionDefinition(11020, "手机号未注册");
 
     public static  ServiceExceptionDefinition PHONE_NUMBER_ALREADY_EXISTS=
             new ServiceExceptionDefinition(11018, "手机号已存在,是否覆盖");

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

@@ -65,4 +65,11 @@ public interface IHyCargoOwnerCapitalInfoService extends IService<HyCargoOwnerCa
      * @return
      */
     Page<HyCargoOwnerCapitalInfo> selectBankFlow(HyCargoOwnerCapitalInfo hyCargoOwnerCapitalInfo);
+
+    /**
+     * 查看北斗轨迹扣费
+     * @param hyCargoOwnerCapitalInfo
+     * @return
+     */
+    String lookBeiDou(HyCargoOwnerCapitalInfo hyCargoOwnerCapitalInfo);
 }

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

@@ -1,5 +1,6 @@
 package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.google.common.collect.Lists;
 import com.yh.saas.common.support.util.IdGenerator;
@@ -7,6 +8,7 @@ import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyCargoOwnerCapitalInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyCargoOwnerInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.HyCompanyInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.OrderInfo;
 import com.yh.saas.plugin.yiliangyiyun.exception.YException;
 import com.yh.saas.plugin.yiliangyiyun.exception.YExceptionEnum;
 import com.yh.saas.plugin.yiliangyiyun.mapper.HyCargoOwnerCapitalInfoMapper;
@@ -14,6 +16,7 @@ import com.yh.saas.plugin.yiliangyiyun.service.ICargoOwnerInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.ICompanyInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.IHyCargoOwnerCapitalInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.yh.saas.plugin.yiliangyiyun.service.IOrderInfoService;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -39,6 +42,8 @@ public class HyCargoOwnerCapitalInfoServiceImpl extends ServiceImpl<HyCargoOwner
     private ICargoOwnerInfoService cargoOwnerInfoService;
     @Autowired
     private ICompanyInfoService companyInfoService;
+    @Autowired
+    private IOrderInfoService orderInfoService;
 
 
     /**
@@ -249,4 +254,55 @@ public class HyCargoOwnerCapitalInfoServiceImpl extends ServiceImpl<HyCargoOwner
         page.setSize(hyCargoOwnerCapitalInfo.getPageSize());
         return page;
     }
+
+    /**
+     * 查看北斗轨迹扣费
+     * @param hyCargoOwnerCapitalInfo
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String lookBeiDou(HyCargoOwnerCapitalInfo hyCargoOwnerCapitalInfo){
+        //新增账单信息
+        hyCargoOwnerCapitalInfo.setId(IdGenerator.generateUUID());
+        hyCargoOwnerCapitalInfo.setTypes("查看北斗轨迹");
+        boolean one = this.insert(hyCargoOwnerCapitalInfo);
+        //更新货主查看北斗轨迹时间
+        OrderInfo orderInfo = orderInfoService.selectById(hyCargoOwnerCapitalInfo.getOrderId());
+        orderInfo.setLookBeiDouDate(new Date());
+        orderInfoService.updateById(orderInfo);
+
+        if ("1".equals(hyCargoOwnerCapitalInfo.getFlag())){
+            //查询个人货主信息
+            HyCargoOwnerInfo hyCargoOwnerInfo = cargoOwnerInfoService.selectOne(new EntityWrapper<HyCargoOwnerInfo>()
+                    .eq("common_id",hyCargoOwnerCapitalInfo.getCommonId()));
+            //账户余额不足
+            if (hyCargoOwnerCapitalInfo.getAmountMoney() > hyCargoOwnerInfo.getAccountBalance()){
+                throw new YException(YExceptionEnum.INSUFFICIENT_ACCOUNT_BALANCE);
+            }
+            Double d = hyCargoOwnerInfo.getAccountBalance();
+            hyCargoOwnerInfo.setAccountBalance(d - hyCargoOwnerCapitalInfo.getAmountMoney());
+            boolean two = cargoOwnerInfoService.updateById(hyCargoOwnerInfo);
+            if (one && two){
+                return "ok";
+            }else {
+                return "ng";
+            }
+        }else {
+            //查询企业信息
+            HyCompanyInfo hyCompanyInfo = companyInfoService.selectById(hyCargoOwnerCapitalInfo.getCompanyId());
+            //账户余额不足
+            if (hyCargoOwnerCapitalInfo.getAmountMoney() > hyCompanyInfo.getAccountBalance()){
+                throw new YException(YExceptionEnum.INSUFFICIENT_ACCOUNT_BALANCE);
+            }
+            Double d = hyCompanyInfo.getAccountBalance();
+            hyCompanyInfo.setAccountBalance(d - hyCargoOwnerCapitalInfo.getAmountMoney());
+            boolean two = companyInfoService.updateById(hyCompanyInfo);
+            if (one && two){
+                return "ok";
+            }else {
+                return "ng";
+            }
+        }
+    }
 }

+ 1 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/HyPublicConsultationMapper.xml

@@ -55,6 +55,7 @@
             AND (DATE_FORMAT(update_date,"%Y%m%d") &lt;=
             DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
+        ORDER BY issuing_date DESC
     </select>
 
 

+ 7 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/OrderInfoMapper.xml

@@ -213,6 +213,7 @@
         o.cargo_owner_phone as cargoOwnerPhone,
         o.cargo_common_id as cargoCommonId,
         o.common_id as commonId,
+        o.comp_id as compId,
         o.goods_name as goodsName,
         o.send_private as sendPrivate,
         o.send_city as sendCity,
@@ -231,10 +232,16 @@
         o.cargo_owner_status_key as cargoOwnerStatusKey,
         o.create_date as createDate,
         o.update_date as updateDate,
+        o.look_bei_dou_date as lookBeiDouDate,
+        o.tran_start_date as tranStartDate,
+        o.tran_end_date as tranEndDate,
+        c.loading_date as loadingDate,
+        c.unloading_date as unloadingDate,
         d.driver_call as driverCall,
         d.id as driverId
         FROM hy_order_info o
         LEFT JOIN hy_driver_info d on d.common_id = o.common_id and d.delete_flag = 0
+        LEFT JOIN hy_carrier_info c on c.order_id = o.id and c.delete_flag = 0
         WHERE o.delete_flag = '0'
         AND o.cargo_common_id = #{cargoCommonId}
         <if test="searchKeyWord != null and searchKeyWord != ''">