Browse Source

运费管理新增航线订舱代理逻辑

dongyongwei 4 years ago
parent
commit
3b0bc4e780

+ 47 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/quotation/domain/TSeaprice.java

@@ -84,6 +84,53 @@ public class TSeaprice extends BaseEntity
     /** 需要删除的固定费用表 */
     private List<String> validdateList;
 
+    //新增字段20210708 dongyongwei begin
+    /** 航线ID */
+    private String fLineid;
+
+    /** 订舱代理ID */
+    private String fBookagentid;
+
+    /** 航线名称 */
+    private String fLineName;
+
+    /** 订舱代理名称 */
+    private String fBookagentName;
+
+    public String getfLineName() {
+        return fLineName;
+    }
+
+    public void setfLineName(String fLineName) {
+        this.fLineName = fLineName;
+    }
+
+    public String getfBookagentName() {
+        return fBookagentName;
+    }
+
+    public void setfBookagentName(String fBookagentName) {
+        this.fBookagentName = fBookagentName;
+    }
+
+    public String getfLineid() {
+        return fLineid;
+    }
+
+    public void setfLineid(String fLineid) {
+        this.fLineid = fLineid;
+    }
+
+    public String getfBookagentid() {
+        return fBookagentid;
+    }
+
+    public void setfBookagentid(String fBookagentid) {
+        this.fBookagentid = fBookagentid;
+    }
+
+    //新增字段20210708 dongyongwei end
+
     public void setfId(Long fId) 
     {
         this.fId = fId;

+ 137 - 113
ruoyi-warehouse/src/main/resources/mapper/quotation/TSeapriceMapper.xml

@@ -1,48 +1,69 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.quotation.mapper.TSeapriceMapper">
-    
+
     <resultMap type="TSeaprice" id="TSeapriceResult">
-        <result property="fId"    column="f_id"    />
-        <result property="fBilltype"    column="f_billtype"    />
-        <result property="fCorpid"    column="f_corpid"    />
-        <result property="polId"    column="pol_id"    />
-        <result property="podId"    column="pod_id"    />
-        <result property="fValiddate"    column="f_validdate"    />
-        <result property="fDateChanged"    column="f_date_changed"    />
-        <result property="fBillstatus"    column="f_billstatus"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="remarks"    column="remarks"    />
+        <result property="fId" column="f_id"/>
+        <result property="fBilltype" column="f_billtype"/>
+        <result property="fCorpid" column="f_corpid"/>
+        <result property="polId" column="pol_id"/>
+        <result property="podId" column="pod_id"/>
+        <result property="fValiddate" column="f_validdate"/>
+        <result property="fDateChanged" column="f_date_changed"/>
+        <result property="fBillstatus" column="f_billstatus"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remarks" column="remarks"/>
+        <result property="fLineid" column="f_lineid"/>
+        <result property="fBookagentid" column="f_bookagentid"/>
     </resultMap>
 
     <sql id="selectTSeapriceVo">
-        select f_id, f_billtype, f_corpid, pol_id, pod_id, f_validdate, f_date_changed, f_billstatus, del_flag, create_by, create_time, update_by, update_time, remarks from t_seaprice
+        select f_id,
+               f_billtype,
+               f_corpid,
+               pol_id,
+               pod_id,
+               f_validdate,
+               f_date_changed,
+               f_billstatus,
+               del_flag,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remarks,
+               f_lineid,
+               f_bookagentid
+        from t_seaprice
     </sql>
 
     <select id="selectTSeapriceList" parameterType="TSeaprice" resultMap="TSeapriceResult">
         <include refid="selectTSeapriceVo"/>
-        <where>  
-            <if test="fBilltype != null "> and f_billtype = #{fBilltype}</if>
-            <if test="fCorpid != null "> and f_corpid = #{fCorpid}</if>
-            <if test="polId != null "> and pol_id = #{polId}</if>
-            <if test="podId != null "> and pod_id = #{podId}</if>
-            <if test="fBillstatus != null "> and f_billstatus = #{fBillstatus}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
+        <where>
+            <if test="fBilltype != null ">and f_billtype = #{fBilltype}</if>
+            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="polId != null ">and pol_id = #{polId}</if>
+            <if test="podId != null ">and pod_id = #{podId}</if>
+            <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
+            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
             <if test='validdateList != null and validdateList[0] != null and validdateList[0]!= ""'>
                 and f_validdate &gt;= #{validdateList[0]}
             </if>
             <if test='validdateList != null and validdateList[1] != null and validdateList[1]!= ""'>
                 and f_validdate &lt;= #{validdateList[1]}
             </if>
+            <if test="fLineid != null  and fLineid != ''">and f_lineid = #{fLineid}</if>
+            <if test="fBookagentid != null  and fBookagentid != ''">and f_bookagentid = #{fBookagentid}</if>
+
         </where>
     </select>
-    
+
     <select id="selectTSeapriceById" parameterType="Long" resultMap="TSeapriceResult">
         <include refid="selectTSeapriceVo"/>
         where f_id = #{fId}
@@ -50,106 +71,101 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectTSeapriceMapList" parameterType="TSeaprice" resultType="Map">
         SELECT
-            s.f_id fId,
-            t.dict_label fBilltype,
-            c.f_cname fCorpid,
+        s.f_id fId,
+        t.dict_label fBilltype,
+        c.f_cname fCorpid,
         CASE
-            WHEN s.f_billstatus = '0' THEN
-            '正常'
-            WHEN s.f_billstatus = '1' THEN
-            '停用'
-            END AS fBillstatus,
-            pol.dict_label polId,
-            pod.dict_label podId,
-            s.create_by createBy,
-            s.f_validdate fValiddate,
-            s.remarks
+        WHEN s.f_billstatus = '0' THEN
+        '正常'
+        WHEN s.f_billstatus = '1' THEN
+        '停用'
+        END AS fBillstatus,
+        pol.dict_label polId,
+        pod.dict_label podId,
+        s.create_by createBy,
+        s.f_validdate fValiddate,
+        s.remarks,
+        s.f_lineid fLineid,
+        s.f_bookagentid fBookagentid,
+        j.f_name fLineName,
+        q.f_name fBookagentName
         FROM
-            t_seaprice s
-            LEFT JOIN sys_dict_data t ON t.dict_value = s.f_billtype AND t.dict_type = 'data_billType'
-            LEFT JOIN sys_dict_data pol ON pol.dict_value = s.pol_id AND pol.dict_type = 'port_start'
-            LEFT JOIN sys_dict_data pod ON pod.dict_value = s.pod_id AND pod.dict_type = 'port_end'
-            LEFT JOIN t_corps c ON c.f_id = s.f_corpid
+        t_seaprice s
+        LEFT JOIN sys_dict_data t ON t.dict_value = s.f_billtype AND t.dict_type = 'data_billType'
+        LEFT JOIN sys_dict_data pol ON pol.dict_value = s.pol_id AND pol.dict_type = 'port_start'
+        LEFT JOIN sys_dict_data pod ON pod.dict_value = s.pod_id AND pod.dict_type = 'port_end'
+        LEFT JOIN t_corps c ON c.f_id = s.f_corpid
+        LEFT JOIN t_address j ON s.f_lineid = j.f_id
+        LEFT JOIN t_corps q ON s.f_bookagentid = q.f_id
         <where>
-            <if test="fBilltype != null "> and s.f_billtype = #{fBilltype}</if>
-            <if test="fCorpid != null "> and s.f_corpid = #{fCorpid}</if>
-            <if test="polId != null "> and s.pol_id = #{polId}</if>
-            <if test="podId != null "> and s.pod_id = #{podId}</if>
-            <if test="fValiddate != null "> and s.f_validdate = #{fValiddate}</if>
-            <if test="fBillstatus != null "> and s.f_billstatus = #{fBillstatus}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
+            <if test="fBilltype != null ">and s.f_billtype = #{fBilltype}</if>
+            <if test="fCorpid != null ">and s.f_corpid = #{fCorpid}</if>
+            <if test="polId != null ">and s.pol_id = #{polId}</if>
+            <if test="podId != null ">and s.pod_id = #{podId}</if>
+            <if test="fValiddate != null ">and s.f_validdate = #{fValiddate}</if>
+            <if test="fBillstatus != null ">and s.f_billstatus = #{fBillstatus}</if>
+            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
         </where>
         ORDER BY s.f_id DESC
     </select>
 
     <select id="checkSeapriceByValiddate" parameterType="TSeaprice" resultType="int">
-        SELECT
-            COUNT(f_id)
-        FROM
-            t_seaprice
-        WHERE
-            f_id != #{fId}
-            AND f_billtype = #{fBilltype}
-            AND f_corpid = #{fCorpid}
-            AND pol_id = #{polId}
-            AND pod_id = #{podId}
-            AND pod_id = #{podId}
-            AND f_validdate &gt;= #{fValiddate}
+        SELECT COUNT(f_id)
+        FROM t_seaprice
+        WHERE f_id != #{fId}
+          AND f_billtype = #{fBilltype}
+          AND f_corpid = #{fCorpid}
+          AND pol_id = #{polId}
+          AND pod_id = #{podId}
+          AND pod_id = #{podId}
+          AND f_validdate &gt;= #{fValiddate}
     </select>
 
     <select id="selectSeapriceItemAmt" parameterType="TSeaprice" resultType="BigDecimal">
-        SELECT
-            IFNULL( SUM( IF ( #{fType} = '0', s.${fSpecification}, s.f_unitprice ) ), 0 )
-        FROM
-            t_seaprice t
-            LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
-        WHERE
-            t.f_billtype = #{fBilltype}
-            AND t.f_corpid = #{fCorpid}
-            AND t.f_validdate &gt;= #{fValiddate}
-            AND t.f_billstatus = 0
-            AND t.del_flag = '0'
-            AND s.f_type = #{fType}
+        SELECT IFNULL(SUM(IF(#{fType} = '0', s.${fSpecification}, s.f_unitprice)), 0)
+        FROM t_seaprice t
+                 LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
+        WHERE t.f_billtype = #{fBilltype}
+          AND t.f_corpid = #{fCorpid}
+          AND t.f_validdate &gt;= #{fValiddate}
+          AND t.f_billstatus = 0
+          AND t.del_flag = '0'
+          AND s.f_type = #{fType}
     </select>
 
     <select id="selectSeapriceItem" parameterType="TSeaprice" resultType="Map">
-       SELECT
-            f.f_name fFeeid,
-        IF
-            ( s.f_type = '0', s.${fSpecification}, s.f_unitprice ) fUnitprice
-        FROM
-            t_seaprice t
-            LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
-            LEFT JOIN t_fees f ON f.f_id = s.f_feeid
-        WHERE
-            t.f_billtype = #{fBilltype}
-            AND t.f_corpid = #{fCorpid}
-            AND t.f_validdate &gt;= #{fValiddate}
-            AND t.f_billstatus = 0
-            AND t.del_flag = '0'
-            AND f.f_name != '海运费'
+        SELECT f.f_name                                                 fFeeid,
+               IF
+                   (s.f_type = '0', s.${fSpecification}, s.f_unitprice) fUnitprice
+        FROM t_seaprice t
+                 LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
+                 LEFT JOIN t_fees f ON f.f_id = s.f_feeid
+        WHERE t.f_billtype = #{fBilltype}
+          AND t.f_corpid = #{fCorpid}
+          AND t.f_validdate &gt;= #{fValiddate}
+          AND t.f_billstatus = 0
+          AND t.del_flag = '0'
+          AND f.f_name != '海运费'
         ORDER BY s.f_type, s.f_id asc
     </select>
 
     <select id="selectShippingFee" parameterType="TSeaprice" resultType="com.ruoyi.quotation.domain.TSeapriceitem">
-        SELECT
-            s.f_id fId,
-            s.f_feeid fFeeid,
-            IFNULL(s.${fSpecification}, 0) fUnitprice,
-            IFNULL(s.f_exrate, 0) fExrate,
-            IFNULL(IFNULL(s.${fSpecification}, 0) * IFNULL(s.f_exrate, 0), 0) rmb
-        FROM
-            t_seaprice t
-            LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
-            LEFT JOIN t_fees f ON f.f_id = s.f_feeid
-        WHERE
-            t.f_billtype = #{fBilltype}
-            AND t.f_corpid = #{fCorpid}
-            AND t.f_validdate &gt;= #{fValiddate}
-            AND t.f_billstatus = 0
-            AND t.del_flag = '0'
-            AND f.f_name = '海运费'
-            ORDER BY s.f_id asc LIMIT 0, 1
+        SELECT s.f_id                                                            fId,
+               s.f_feeid                                                         fFeeid,
+               IFNULL(s.${fSpecification}, 0)                                    fUnitprice,
+               IFNULL(s.f_exrate, 0)                                             fExrate,
+               IFNULL(IFNULL(s.${fSpecification}, 0) * IFNULL(s.f_exrate, 0), 0) rmb
+        FROM t_seaprice t
+                 LEFT JOIN t_seapriceitem s ON s.f_pid = t.f_id
+                 LEFT JOIN t_fees f ON f.f_id = s.f_feeid
+        WHERE t.f_billtype = #{fBilltype}
+          AND t.f_corpid = #{fCorpid}
+          AND t.f_validdate &gt;= #{fValiddate}
+          AND t.f_billstatus = 0
+          AND t.del_flag = '0'
+          AND f.f_name = '海运费'
+        ORDER BY s.f_id asc
+        LIMIT 0, 1
     </select>
 
     <insert id="insertTSeaprice" parameterType="TSeaprice" useGeneratedKeys="true" keyProperty="fId">
@@ -168,7 +184,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remarks != null">remarks,</if>
-         </trim>
+            <if test="fLineid != null">f_lineid,</if>
+            <if test="fBookagentid != null">f_bookagentid,</if>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fBilltype != null">#{fBilltype},</if>
             <if test="fCorpid != null">#{fCorpid},</if>
@@ -183,7 +201,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remarks != null">#{remarks},</if>
-         </trim>
+            <if test="fLineid != null">#{fLineid},</if>
+            <if test="fBookagentid != null">#{fBookagentid},</if>
+        </trim>
     </insert>
 
     <update id="updateTSeaprice" parameterType="TSeaprice">
@@ -202,19 +222,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remarks != null">remarks = #{remarks},</if>
+            <if test="fLineid != null">f_lineid = #{fLineid},</if>
+            <if test="fBookagentid != null">f_bookagentid = #{fBookagentid},</if>
         </trim>
         where f_id = #{fId}
     </update>
 
     <delete id="deleteTSeapriceById" parameterType="Long">
-        delete from t_seaprice where f_id = #{fId}
+        delete
+        from t_seaprice
+        where f_id = #{fId}
     </delete>
 
     <delete id="deleteTSeapriceByIds" parameterType="String">
-        delete from t_seaprice where f_id in 
+        delete from t_seaprice where f_id in
         <foreach item="fId" collection="array" open="(" separator="," close=")">
             #{fId}
         </foreach>
     </delete>
-    
+
 </mapper>