Ver Fonte

客户收款

fubin há 2 anos atrás
pai
commit
5d1508278d

+ 120 - 85
src/main/java/com/dk/mdm/mapper/mac/AccountMapper.xml

@@ -2,142 +2,160 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dk.mdm.mapper.mac.AccountMapper">
 
-    <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        ac.object_id, ac.object_type, ac.receipt, ac.receipt_lock, ac.contract_assets, ac.receivable,
-        ac.receivable_handle, ac.receivable_waive, ac.receivable_residue, ac.receipt_residue, ac.payment,
-        ac.pur_estimate, ac.payable, ac.payable_handle, ac.payable_waive, ac.payable_residue,
-        ac.payment_residue, ac.remarks, ac.flg_valid, ac.cp_id
+        t.object_id, t.object_type, t.receipt, t.receipt_lock, t.contract_assets, t.receivable,
+        t.receivable_handle, t.receivable_waive, t.receivable_residue, t.receipt_residue, t.payment,
+        t.pur_estimate, t.payable, t.payable_handle, t.payable_waive, t.payable_residue,
+        t.payment_residue, t.remarks, t.flg_valid, t.cp_id
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.Account">
         <id column="object_id" property="objectId"/>
-                <result column="object_type" property="objectType"/>
-                <result column="receipt" property="receipt"/>
-                <result column="receipt_lock" property="receiptLock"/>
-                <result column="contract_assets" property="contractAssets"/>
-                <result column="receivable" property="receivable"/>
-                <result column="receivable_handle" property="receivableHandle"/>
-                <result column="receivable_waive" property="receivableWaive"/>
-                <result column="receivable_residue" property="receivableResidue"/>
-                <result column="receipt_residue" property="receiptResidue"/>
-                <result column="payment" property="payment"/>
-                <result column="pur_estimate" property="purEstimate"/>
-                <result column="payable" property="payable"/>
-                <result column="payable_handle" property="payableHandle"/>
-                <result column="payable_waive" property="payableWaive"/>
-                <result column="payable_residue" property="payableResidue"/>
-                <result column="payment_residue" property="paymentResidue"/>
-                <result column="remarks" property="remarks"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
+            <result column="object_type" property="objectType"/>
+            <result column="receipt" property="receipt"/>
+            <result column="receipt_lock" property="receiptLock"/>
+            <result column="contract_assets" property="contractAssets"/>
+            <result column="receivable" property="receivable"/>
+            <result column="receivable_handle" property="receivableHandle"/>
+            <result column="receivable_waive" property="receivableWaive"/>
+            <result column="receivable_residue" property="receivableResidue"/>
+            <result column="receipt_residue" property="receiptResidue"/>
+            <result column="payment" property="payment"/>
+            <result column="pur_estimate" property="purEstimate"/>
+            <result column="payable" property="payable"/>
+            <result column="payable_handle" property="payableHandle"/>
+            <result column="payable_waive" property="payableWaive"/>
+            <result column="payable_residue" property="payableResidue"/>
+            <result column="payment_residue" property="paymentResidue"/>
+            <result column="remarks" property="remarks"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.AccountResponse">
         <id column="object_id" property="objectId"/>
-        <result column="object_type" property="objectType"/>
-        <result column="receipt" property="receipt"/>
-        <result column="receipt_lock" property="receiptLock"/>
-        <result column="contract_assets" property="contractAssets"/>
-        <result column="receivable" property="receivable"/>
-        <result column="receivable_handle" property="receivableHandle"/>
-        <result column="receivable_waive" property="receivableWaive"/>
-        <result column="receivable_residue" property="receivableResidue"/>
-        <result column="receipt_residue" property="receiptResidue"/>
-        <result column="payment" property="payment"/>
-        <result column="pur_estimate" property="purEstimate"/>
-        <result column="payable" property="payable"/>
-        <result column="payable_handle" property="payableHandle"/>
-        <result column="payable_waive" property="payableWaive"/>
-        <result column="payable_residue" property="payableResidue"/>
-        <result column="payment_residue" property="paymentResidue"/>
-        <result column="remarks" property="remarks"/>
-        <result column="flg_valid" property="flgValid"/>
-        <result column="cp_id" property="cpId"/>
+            <result column="object_type" property="objectType"/>
+            <result column="receipt" property="receipt"/>
+            <result column="receipt_lock" property="receiptLock"/>
+            <result column="contract_assets" property="contractAssets"/>
+            <result column="receivable" property="receivable"/>
+            <result column="receivable_handle" property="receivableHandle"/>
+            <result column="receivable_waive" property="receivableWaive"/>
+            <result column="receivable_residue" property="receivableResidue"/>
+            <result column="receipt_residue" property="receiptResidue"/>
+            <result column="payment" property="payment"/>
+            <result column="pur_estimate" property="purEstimate"/>
+            <result column="payable" property="payable"/>
+            <result column="payable_handle" property="payableHandle"/>
+            <result column="payable_waive" property="payableWaive"/>
+            <result column="payable_residue" property="payableResidue"/>
+            <result column="payment_residue" property="paymentResidue"/>
+            <result column="remarks" property="remarks"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
     </resultMap>
 
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
             <if test="objectId != null and objectId != ''">
-                AND object_id = #{objectId}::uuid
+                AND t.object_id = #{objectId}::uuid
             </if>
             <if test="objectType != null and objectType != ''">
-                AND object_type = #{objectType}
+                AND t.object_type = #{objectType}
             </if>
             <if test="receipt != null">
-                AND receipt = #{receipt}
+                AND t.receipt = #{receipt}
             </if>
             <if test="receiptLock != null">
-                AND receipt_lock = #{receiptLock}
+                AND t.receipt_lock = #{receiptLock}
             </if>
             <if test="contractAssets != null">
-                AND contract_assets = #{contractAssets}
+                AND t.contract_assets = #{contractAssets}
             </if>
             <if test="receivable != null">
-                AND receivable = #{receivable}
+                AND t.receivable = #{receivable}
             </if>
             <if test="receivableHandle != null">
-                AND receivable_handle = #{receivableHandle}
+                AND t.receivable_handle = #{receivableHandle}
             </if>
             <if test="receivableWaive != null">
-                AND receivable_waive = #{receivableWaive}
+                AND t.receivable_waive = #{receivableWaive}
             </if>
             <if test="receivableResidue != null">
-                AND receivable_residue = #{receivableResidue}
+                AND t.receivable_residue = #{receivableResidue}
             </if>
             <if test="receiptResidue != null">
-                AND receipt_residue = #{receiptResidue}
+                AND t.receipt_residue = #{receiptResidue}
             </if>
             <if test="payment != null">
-                AND payment = #{payment}
+                AND t.payment = #{payment}
             </if>
             <if test="purEstimate != null">
-                AND pur_estimate = #{purEstimate}
+                AND t.pur_estimate = #{purEstimate}
             </if>
             <if test="payable != null">
-                AND payable = #{payable}
+                AND t.payable = #{payable}
             </if>
             <if test="payableHandle != null">
-                AND payable_handle = #{payableHandle}
+                AND t.payable_handle = #{payableHandle}
             </if>
             <if test="payableWaive != null">
-                AND payable_waive = #{payableWaive}
+                AND t.payable_waive = #{payableWaive}
             </if>
             <if test="payableResidue != null">
-                AND payable_residue = #{payableResidue}
+                AND t.payable_residue = #{payableResidue}
             </if>
             <if test="paymentResidue != null">
-                AND payment_residue = #{paymentResidue}
+                AND t.payment_residue = #{paymentResidue}
             </if>
             <if test="remarks != null and remarks != ''">
-                AND remarks = #{remarks}
+                AND t.remarks = #{remarks}
             </if>
             <if test="flgValid != null">
-                AND flg_valid = #{flgValid}
+                AND t.flg_valid = #{flgValid}
             </if>
             <if test="cpId != null">
-                AND cp_id = #{cpId}
+                AND t.cp_id = #{cpId}
             </if>
         </where>
     </sql>
 
     <sql id="idsForeach">
         <!-- 根据主键objectId批量操作 -->
-        WHERE  ac.object_id in
+        WHERE  t.object_id in
         <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
             #{item}
         </foreach>
     </sql>
 
     <!-- 查询表t_mac_account,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mac_account  ac
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
+        SELECT t.object_id,
+               t.object_type,
+               t.receipt,
+               t.receipt_lock,
+               t.contract_assets,
+               t.receivable,
+               t.receivable_handle,
+               t.receivable_residue,
+               t.receivable_waive,
+               t.receipt_residue,
+               t.payment,
+               t.pur_estimate,
+               t.payable,
+               t.payable_handle,
+               t.payable_residue,
+               t.payable_waive,
+               t.payment_residue,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id,
+               t.receipt - t.receivable as "receivableBalance"
+        FROM dkic_b.t_mac_account as t
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -146,33 +164,50 @@
 
     <!-- 查询表t_mac_account,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
-        FROM dkic_b.t_mac_account ac
+        SELECT count(1)
+        FROM dkic_b.t_mac_account t
         <include refid="Condition"/>
     </select>
 
     <!-- 根据主键查询表t_mac_account的一行数据 -->
     <select id="selectById" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List"/>
-        ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS  "objectTypeName"
-        ,tmp.sup_name                              AS "supplierName"
-        ,tmc.cus_name                                      as "cusName"
-        ,tmc.cus_phone                                     as "cusPhone"
-        FROM dkic_b.t_mac_account ac
-        LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = ac.object_type
-        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = ac.object_id
-        left join dkic_b.t_mst_customer tmc on ac.object_id = tmc.cus_id
-        WHERE ac.object_id = #{objectId}::uuid
+        SELECT t.object_id,
+               t.object_type,
+               t.receipt,
+               t.receipt_lock,
+               t.contract_assets,
+               t.receivable,
+               t.receivable_handle,
+               t.receivable_waive,
+               t.receivable_residue,
+               t.receipt_residue,
+               t.payment,
+               t.pur_estimate,
+               t.payable,
+               t.payable_handle,
+               t.payable_waive,
+               t.payable_residue,
+               t.payment_residue,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id,
+               sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "objectTypeName",
+               tmp.sup_name  AS "supName",
+               tmc.cus_name  as "cusName",
+               tmc.cus_phone as "cusPhone"
+        FROM dkic_b.t_mac_account t
+                 LEFT JOIN sys.t_data_kind tdk ON tdk.kind_code = t.object_type
+                 Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
+                 left join dkic_b.t_mst_customer tmc on t.object_id = tmc.cus_id
+        WHERE t.object_id = #{objectId}::uuid
     </select>
 
     <!-- 根据主键锁定表t_mac_account的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mac_account  ac
-        WHERE  ac.object_id = #{id}::uuid
+        FROM dkic_b.t_mac_account as t
+        WHERE  t.object_id = #{id}::uuid
         for update
     </select>
 
@@ -180,7 +215,7 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mac_account  ac
+        FROM dkic_b.t_mac_account as t
         <include refid="idsForeach"/>
         for update
     </select>

+ 13 - 8
src/main/java/com/dk/mdm/model/response/mac/AccountResponse.java

@@ -197,19 +197,24 @@ public class AccountResponse extends PageInfo<AccountResponse> implements Serial
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
+
     @ApiModelProperty(value = "明细")
     private List<AccountItemResponse> list;
 
-    /*
-     * 相关属性
-     * @TableField(exist = false)
-     */
+    @ApiModelProperty(value = "客户欠款")
+    private BigDecimal receivableBalance;
 
-    /*
-     * 关联属性 + 查询条件
-     * @TableField(exist = false)
-     */
+    @ApiModelProperty(value = "对象类型")
+    private String objectTypeName;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
 
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
 
     private static final long serialVersionUID = 1L;
 

+ 0 - 1
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -556,7 +556,6 @@ public class OrderService extends BaseService<Order> {
             recPayUpdate.setFlgValid(false).setRpId(id);
             receiptService.updateByUuid(recPayUpdate);
         }
-
         return ResponseResultUtil.success();
     }