haungfuli 2 年之前
父節點
當前提交
ce7053a516
共有 13 個文件被更改,包括 125 次插入31 次删除
  1. 11 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/FreightInfoController.java
  2. 20 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/FreightInfo.java
  3. 1 20
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WarehouseNumView.java
  4. 1 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/exception/YExceptionEnum.java
  5. 9 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/FreightInfoMapper.java
  6. 14 6
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IFreightInfoService.java
  7. 4 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CarrierInfoServiceImpl.java
  8. 1 1
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonUserServiceImpl.java
  9. 13 2
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FreightInfoServiceImpl.java
  10. 4 0
      winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OrderInfoServiceImpl.java
  11. 43 0
      winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/FreightInfoMapper.xml
  12. 2 0
      winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/HyFreightSettlementInfoMapper.xml
  13. 2 2
      winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/OrderInfoMapper.xml

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

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.controller;
 
 
 import com.yh.saas.plugin.yiliangyiyun.entity.FreightInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 import com.yh.saas.plugin.yiliangyiyun.service.IFreightInfoService;
 import com.yh.saas.plugin.yiliangyiyun.util.Log;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +36,16 @@ public class FreightInfoController {
         return freightInfoService.selectProfit(freightInfo);
     }
 
+    /**
+     * 后台管理统计报表待结算费用
+     * @param freightInfo
+     * @return
+     */
+    @GetMapping("/selectSettledExpenses")
+    List<FreightInfo> selectSettledExpenses(FreightInfo freightInfo){
+        return freightInfoService.selectSettledExpenses(freightInfo);
+    }
+
     /**
      * 预付
      * @param freightInfo

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

@@ -212,6 +212,26 @@ public class FreightInfo extends BaseModel<FreightInfo> {
      */
     @TableField(exist = false)
     private String date;
+    /**
+     * 代付运费
+     */
+    @TableField(exist = false)
+    private Double freight;
+    /**
+     * 提现
+     */
+    @TableField(exist = false)
+    private Double withdrawal;
+    /**
+     * 代收款
+     */
+    @TableField(exist = false)
+    private Double collection;
+    /**
+     * 待开发票
+     */
+    @TableField(exist = false)
+    private Double invoice;
 
 
 

+ 1 - 20
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WarehouseNumView.java

@@ -1,27 +1,8 @@
 package com.yh.saas.plugin.yiliangyiyun.entity.view;
 
+
 import lombok.Data;
 
 @Data
 public class WarehouseNumView {
-    /**
-     * 品种
-     */
-    private String goodsName;
-    /**
-     * 品种
-     */
-    private String goodsNameKey;
-    /**
-     * 入库量
-     */
-    private String inNetWeight;
-    /**
-     * 出库量
-     */
-    private String outNetWeight;
-    /**
-     * 应余量
-     */
-    private String storage;
 }

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

@@ -45,6 +45,7 @@ public enum YExceptionEnum {
 	CORRECT_DRIVING_LICENSE("ERROR23", "行驶证车辆类型输入错误"),
 	CAR_NOT_EXIST("ERROR23", "车辆不存在,请重新选择"),
 	PAY_ADVANCE_PAYMENT("ERROR24", "请先支付预付款"),
+	TOTAL_BIG_PREPAID("ERROR25", "合计应付运费必须大于预付款"),
 	;
 	@Getter
 	private String value;

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

@@ -3,6 +3,7 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.FleetInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.FreightInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 
 import java.util.List;
 import java.util.Map;
@@ -32,4 +33,12 @@ public interface FreightInfoMapper extends BaseMapper<FreightInfo> {
      * @return
      */
     List<FreightInfo> getFormListByCondition(Map<String, Object> pageView);
+
+    /**
+     * 查询统计报表待结算费用
+     *
+     * @param pageView
+     * @return
+     */
+    List<FreightInfo> getCostListByCondition(Map<String, Object> pageView);
 }

+ 14 - 6
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IFreightInfoService.java

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.service;
 
 import com.yh.saas.plugin.yiliangyiyun.entity.FreightInfo;
 import com.baomidou.mybatisplus.service.IService;
+import com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView;
 
 import java.text.ParseException;
 import java.util.List;
@@ -17,24 +18,31 @@ import java.util.List;
 public interface IFreightInfoService extends IService<FreightInfo> {
 
     /**
-     * 预付
+     * 后台管理统计报表利润图表
      * @param freightInfo
      * @return
      */
-    String advance (FreightInfo freightInfo) throws ParseException;
+    FreightInfo selectProfit(FreightInfo freightInfo);
 
     /**
-     * 尾款
+     * 后台管理统计报表待结算费用
      * @param freightInfo
      * @return
      */
-    String balance (FreightInfo freightInfo) throws ParseException;
+    List<FreightInfo> selectSettledExpenses(FreightInfo freightInfo);
 
+    /**
+     * 预付
+     * @param freightInfo
+     * @return
+     */
+    String advance (FreightInfo freightInfo) throws ParseException;
 
     /**
-     * 后台管理统计报表利润图表
+     * 尾款
      * @param freightInfo
      * @return
      */
-    FreightInfo selectProfit(FreightInfo freightInfo);
+    String balance (FreightInfo freightInfo) throws ParseException;
+
 }

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

@@ -227,6 +227,10 @@ public class CarrierInfoServiceImpl extends ServiceImpl<CarrierInfoMapper, HyCar
                     //查询订单是否垫付
                     //非垫付订单
                     if("0".equals(orderInfo.getFreightAdvance())){
+                        if (freightInfo1.getPrepaidFreight() > hyCarrierInfo.getTotalFreight()){
+                            //预付运费大于实际运费
+                            throw new YException(YExceptionEnum.TOTAL_BIG_PREPAID);
+                        }
                         //查询费用信息
                         FreightInfo freightInfo = freightInfoService.selectOne(new EntityWrapper<FreightInfo>()
                         .eq("order_id",orderInfo.getId()).eq("delete_flag","0"));

+ 1 - 1
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CommonUserServiceImpl.java

@@ -162,7 +162,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
         user.setPhone(commonUser.getPhone());
         user.setIdentification(commonUser.getIdentification());
         user.setAvatarUrl(commonUser.getAvatarUrl());
-        //  查询pc 是否有账号
+        //查询pc 是否有账号
         CommonStaff commonStaff = commonStaffService.selectOne(new EntityWrapper<CommonStaff>()
                 .eq("staff_mobile_phone", commonUser.getPhone()).eq("enabled", "1"));
         if (commonStaff != null) {

+ 13 - 2
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/FreightInfoServiceImpl.java

@@ -10,9 +10,7 @@ import com.yh.saas.plugin.yiliangyiyun.mapper.FreightInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -61,6 +59,19 @@ public class FreightInfoServiceImpl extends ServiceImpl<FreightInfoMapper, Freig
     }
 
 
+    /**
+     * 后台管理统计报表待结算费用
+     * @param freightInfo
+     * @return
+     */
+    @Override
+    public List<FreightInfo> selectSettledExpenses(FreightInfo freightInfo){
+        Map<String, Object> pageView = new HashMap<>();
+        List<FreightInfo> dataList = baseMapper.getCostListByCondition(pageView);
+        return dataList;
+    }
+
+
 
     /**
      * 预付

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

@@ -537,6 +537,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
                 //查询订单是否垫付
                 //非垫付订单
                 if("0".equals(orderInfo1.getFreightAdvance())){
+                    if (freightInfo1.getPrepaidFreight() > hyCarrierInfo.getTotalFreight()){
+                        //预付运费大于实际运费
+                        throw new YException(YExceptionEnum.TOTAL_BIG_PREPAID);
+                    }
                     //查询费用信息
                     FreightInfo freightInfo = freightInfoService.selectOne(new EntityWrapper<FreightInfo>()
                             .eq("order_id",orderInfo1.getId()).eq("delete_flag","0"));

+ 43 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/FreightInfoMapper.xml

@@ -62,4 +62,47 @@
             </if>
         </if>
     </select>
+
+
+    <!-- 后台管理统计报表待结算费用 -->
+    <select id="getCostListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.FreightInfo">
+        SELECT
+				(SELECT
+				case when o.freight_advance = 1 then SUM(f.receivable_freight)/10000
+				else SUM(f.actual_freight + f.owner_service_charge)/10000 end
+				FROM hy_order_info o
+                LEFT JOIN hy_freight_info f on f.order_id = o.id and f.delete_flag = 0
+                WHERE o.delete_flag = '0'
+                AND o.cargo_owner_status_key = '31'
+				AND o.invoicing = '0'
+				) as invoice,/*待开发票*/
+				(SELECT
+				case when SUM(r.not_repaid)/10000 IS NULL then 0
+				else SUM(r.not_repaid)/10000 end
+				FROM hy_order_info o
+                LEFT JOIN hy_repayment_info r on r.order_id = o.id and r.delete_flag = 0 and (r.status_key = '1' or r.status_key = '3')
+                WHERE o.delete_flag = '0'
+                AND o.cargo_owner_status_key = '27'
+				) as collection,/*代收款*/
+				(SELECT
+				case when SUM(amount_money)/10000 IS NULL then 0
+				else SUM(amount_money)/10000 end
+				FROM hy_cargo_owner_capital_info
+                WHERE delete_flag = '0'
+				AND status_key = '1'
+				AND types = '提现'
+				) as withdrawal,/*提现*/
+				(SELECT
+				case when SUM(amount_money)/10000 IS NULL then 0
+				else SUM(amount_money)/10000 end
+				FROM hy_freight_settlement_info
+                WHERE delete_flag = '0'
+				AND status_key = '1'
+				) as freight/*代付运费*/
+				FROM
+                hy_order_info ho
+				GROUP BY
+                ho.delete_flag = '0';
+    </select>
 </mapper>

+ 2 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/resources/mapper/HyFreightSettlementInfoMapper.xml

@@ -131,8 +131,10 @@
             resultType="com.yh.saas.plugin.yiliangyiyun.entity.HyFreightSettlementInfo">
         SELECT
         f.id,
+        f.common_id as commonId,
         f.order_id as orderId,
         f.order_no as orderNo,
+        f.document_no as documentNo,
         f.freight_advance as freightAdvance,
         f.driver_name as driverName,
         c.phone as driverPhone,

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

@@ -385,11 +385,11 @@
         LEFT JOIN hy_freight_info f on f.order_id = o.id and f.delete_flag = 0
         LEFT JOIN hy_repayment_info r on r.order_id = o.id and r.delete_flag = 0
         WHERE o.delete_flag = '0'
-        <if test="startDate != null">
+        <if test="startDate != null and startDate != ''">
             AND (DATE_FORMAT(o.update_date,"%Y%m%d") &gt;=
             DATE_FORMAT(#{startDate},"%Y%m%d"))
         </if>
-        <if test="endDate != null">
+        <if test="endDate != null and endDate != ''">
             AND (DATE_FORMAT(o.update_date,"%Y%m%d") &lt;=
             DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>