瀏覽代碼

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

changhaoning 2 年之前
父節點
當前提交
6c06b3287f
共有 25 個文件被更改,包括 797 次插入231 次删除
  1. 82 0
      src/main/java/com/dk/mdm/controller/mac/PaymentController.java
  2. 14 14
      src/main/java/com/dk/mdm/controller/mac/ReceiptController.java
  3. 27 0
      src/main/java/com/dk/mdm/feign/UserFeign.java
  4. 0 1
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml
  5. 1 1
      src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.java
  6. 3 4
      src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.xml
  7. 14 0
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java
  8. 223 175
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml
  9. 17 0
      src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml
  10. 2 1
      src/main/java/com/dk/mdm/model/pojo/mac/OtherPayable.java
  11. 2 1
      src/main/java/com/dk/mdm/model/pojo/mac/OtherReceivable.java
  12. 2 2
      src/main/java/com/dk/mdm/model/query/mac/OtherPayableQuery.java
  13. 2 2
      src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java
  14. 3 15
      src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java
  15. 8 0
      src/main/java/com/dk/mdm/model/response/mac/AccountItemResponse.java
  16. 2 2
      src/main/java/com/dk/mdm/model/response/mac/OtherPayableResponse.java
  17. 2 2
      src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java
  18. 6 3
      src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java
  19. 2 2
      src/main/java/com/dk/mdm/model/vo/mac/OtherPayableVO.java
  20. 2 2
      src/main/java/com/dk/mdm/model/vo/mac/OtherReceivableVO.java
  21. 3 0
      src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java
  22. 25 2
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  23. 342 0
      src/main/java/com/dk/mdm/service/mac/PaymentService.java
  24. 1 1
      src/main/java/com/dk/mdm/service/mac/ReceiptService.java
  25. 12 1
      src/main/java/com/dk/mdm/service/mst/StaffService.java

+ 82 - 0
src/main/java/com/dk/mdm/controller/mac/PaymentController.java

@@ -0,0 +1,82 @@
+package com.dk.mdm.controller.mac;
+
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.model.pojo.mac.RecPay;
+import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.vo.mac.RecPayVO;
+import com.dk.mdm.service.mac.PaymentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+@Api(tags = "收付款单API接口")
+@RestController
+@RequestMapping("/mac/payment")
+public class PaymentController {
+
+    public BaseService<RecPay> getService() {
+        return paymentService;
+    }
+
+    @Autowired
+    private PaymentService paymentService;
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<RecPayResponse>> selectPaymentByCond(@RequestBody RecPayQuery recPayQuery) {
+        return paymentService.selectPaymentByCond(recPayQuery);
+    }
+
+    /**
+     * @desc :查询付款明细(货物、付款、附件)
+     * @author : 付斌
+     * @date : 2024-02-28 13:24
+     */
+    @PostMapping({"select_rp_info_by_id/{id}"})
+    public ResponseResultVO<Map<String, Object>> selectRpInfoById(@PathVariable String id) {
+        return paymentService.selectRpInfoById(id);
+    }
+
+    /**
+     * @desc : 通过ID查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:41
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO selectById(@PathVariable String id) {
+        return paymentService.selectById(id);
+    }
+
+    /**
+     * @desc : 新建应付付款(付款+冲应付)
+     * @author : 付斌
+     * @date : 2023/1/9 10:48
+     */
+    @ApiOperation(value = "新建应付付款", notes = "新建应付付款")
+    @PostMapping({"insert_payable_payment"})
+    public ResponseResultVO<?> insertPayablePayment(@RequestBody RecPayVO recPayVO) {
+        return paymentService.insertPayablePayment(recPayVO);
+    }
+
+    /**
+     * @desc : 作废
+     * @author : 付斌
+     * @date : 2024-03-08 16:36
+     */
+    @ApiOperation(value = "作废", notes = "作废")
+    @PostMapping({"invalid/{id}"})
+    public ResponseResultVO<?> invalid(@PathVariable String id) {
+        return paymentService.invalid(id);
+    }
+
+}

+ 14 - 14
src/main/java/com/dk/mdm/controller/mac/RecPayController.java → src/main/java/com/dk/mdm/controller/mac/ReceiptController.java

@@ -11,21 +11,21 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
-import com.dk.mdm.service.mac.RecPayService;
+import com.dk.mdm.service.mac.ReceiptService;
 
 
 import java.util.Map;
 import java.util.Map;
 
 
 @Api(tags = "收付款单API接口")
 @Api(tags = "收付款单API接口")
 @RestController
 @RestController
-@RequestMapping("/mac/recPay")
-public class RecPayController{
+@RequestMapping("/mac/receipt")
+public class ReceiptController {
 
 
     public BaseService<RecPay> getService() {
     public BaseService<RecPay> getService() {
-        return recPayService;
+        return receiptService;
     }
     }
 
 
     @Autowired
     @Autowired
-    private RecPayService recPayService;
+    private ReceiptService receiptService;
     /**
     /**
      * @desc : 条件查询
      * @desc : 条件查询
      * @author : 付斌
      * @author : 付斌
@@ -34,7 +34,7 @@ public class RecPayController{
     @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
     @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
     @PostMapping({"list_by"})
     @PostMapping({"list_by"})
     public ResponseResultVO<PageList<RecPayResponse>> selectByCond(@RequestBody RecPayQuery recPayQuery) {
     public ResponseResultVO<PageList<RecPayResponse>> selectByCond(@RequestBody RecPayQuery recPayQuery) {
-        return recPayService.selectByCond(recPayQuery);
+        return receiptService.selectByCond(recPayQuery);
     }
     }
 
 
     /**
     /**
@@ -44,7 +44,7 @@ public class RecPayController{
      */
      */
     @PostMapping({"select_rp_info_by_id/{id}"})
     @PostMapping({"select_rp_info_by_id/{id}"})
     public ResponseResultVO<Map<String, Object>> selectRpInfoById(@PathVariable String id) {
     public ResponseResultVO<Map<String, Object>> selectRpInfoById(@PathVariable String id) {
-        return recPayService.selectRpInfoById(id);
+        return receiptService.selectRpInfoById(id);
     }
     }
 
 
     /**
     /**
@@ -54,7 +54,7 @@ public class RecPayController{
      */
      */
     @PostMapping({"/{id}"})
     @PostMapping({"/{id}"})
     public ResponseResultVO selectById(@PathVariable String id) {
     public ResponseResultVO selectById(@PathVariable String id) {
-        return recPayService.selectById(id);
+        return receiptService.selectById(id);
     }
     }
 
 
     /**
     /**
@@ -65,7 +65,7 @@ public class RecPayController{
     @ApiOperation(value = "新建客户收款", notes = "新建客户收款")
     @ApiOperation(value = "新建客户收款", notes = "新建客户收款")
     @PostMapping({"insert_receipt"})
     @PostMapping({"insert_receipt"})
     public ResponseResultVO<?> insertReceipt(@RequestBody RecPayVO recPayVO) {
     public ResponseResultVO<?> insertReceipt(@RequestBody RecPayVO recPayVO) {
-        return recPayService.insertReceipt(recPayVO);
+        return receiptService.insertReceipt(recPayVO);
     }
     }
 
 
     /**
     /**
@@ -76,7 +76,7 @@ public class RecPayController{
     @ApiOperation(value = "新建客户退款", notes = "新建客户退款")
     @ApiOperation(value = "新建客户退款", notes = "新建客户退款")
     @PostMapping({"insert_refund"})
     @PostMapping({"insert_refund"})
     public ResponseResultVO<?> insertRefund(@RequestBody RecPayVO recPayVO) {
     public ResponseResultVO<?> insertRefund(@RequestBody RecPayVO recPayVO) {
-        return recPayService.insertRefund(recPayVO);
+        return receiptService.insertRefund(recPayVO);
     }
     }
 
 
     /**
     /**
@@ -87,7 +87,7 @@ public class RecPayController{
     @ApiOperation(value = "编辑客户收款/退款", notes = "编辑客户收款/退款")
     @ApiOperation(value = "编辑客户收款/退款", notes = "编辑客户收款/退款")
     @PostMapping({"update"})
     @PostMapping({"update"})
     public ResponseResultVO<?> update(@RequestBody RecPayVO recPayVO) {
     public ResponseResultVO<?> update(@RequestBody RecPayVO recPayVO) {
-        return recPayService.update(recPayVO);
+        return receiptService.update(recPayVO);
     }
     }
 
 
     /**
     /**
@@ -98,7 +98,7 @@ public class RecPayController{
     @ApiOperation(value = "查询收款明细(编辑用)", notes = "查询收款明细(编辑用)")
     @ApiOperation(value = "查询收款明细(编辑用)", notes = "查询收款明细(编辑用)")
     @PostMapping({"get_rp_for_update/{id}"})
     @PostMapping({"get_rp_for_update/{id}"})
     public ResponseResultVO<?> getRpForUpdate(@PathVariable String id) {
     public ResponseResultVO<?> getRpForUpdate(@PathVariable String id) {
-        return recPayService.getRpForUpdate(id);
+        return receiptService.getRpForUpdate(id);
     }
     }
 
 
     /**
     /**
@@ -109,7 +109,7 @@ public class RecPayController{
     @ApiOperation(value = "新建应收收款", notes = "新建应收收款")
     @ApiOperation(value = "新建应收收款", notes = "新建应收收款")
     @PostMapping({"insert_receivable_receipt"})
     @PostMapping({"insert_receivable_receipt"})
     public ResponseResultVO<?> insertReceivableReceipt(@RequestBody RecPayVO recPayVO) {
     public ResponseResultVO<?> insertReceivableReceipt(@RequestBody RecPayVO recPayVO) {
-        return recPayService.insertReceivableReceipt(recPayVO);
+        return receiptService.insertReceivableReceipt(recPayVO);
     }
     }
 
 
     /**
     /**
@@ -120,7 +120,7 @@ public class RecPayController{
     @ApiOperation(value = "作废", notes = "作废")
     @ApiOperation(value = "作废", notes = "作废")
     @PostMapping({"invalid/{id}"})
     @PostMapping({"invalid/{id}"})
     public ResponseResultVO<?> invalid(@PathVariable String id) {
     public ResponseResultVO<?> invalid(@PathVariable String id) {
-        return recPayService.invalid(id);
+        return receiptService.invalid(id);
     }
     }
 
 
 }
 }

+ 27 - 0
src/main/java/com/dk/mdm/feign/UserFeign.java

@@ -0,0 +1,27 @@
+package com.dk.mdm.feign;
+
+
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.response.ResponseResultVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
+/**
+ * @author : 姜永辉
+ * @desc : OauthServerFeign
+ * @date : 2024-038-10 10:56
+ */
+@FeignClient(name = Constant.OAUTH_PREFIX + Constant.SERVER+ "-jyh", path = "/oauth/wx", contextId = "user")
+public interface UserFeign {
+    /**
+     * @desc   : 注册-创建员工的时候保存微信用户信息
+     * @author : 姜永辉
+     * @date   : 2023-11-02 16:27
+     */
+    @PostMapping({"/register_feign"})
+    ResponseResultVO<Boolean> registerFeign(@RequestBody Map<String, Object> collectQuery) ;
+
+}

+ 0 - 1
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -200,7 +200,6 @@
         ,tmgs.sku_spec  as "skuSpec"
         ,tmgs.sku_spec  as "skuSpec"
         ,tmgb.brand_name  as "brandName"
         ,tmgb.brand_name  as "brandName"
         ,tmgb.short_name  as "shortName"
         ,tmgb.short_name  as "shortName"
-i
         ,tpp.pur_id as "purId"
         ,tpp.pur_id as "purId"
         ,tpp.pur_no as "purNo"
         ,tpp.pur_no as "purNo"
         ,tppi.item_qty as "purItemQty"
         ,tppi.item_qty as "purItemQty"

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.java

@@ -39,6 +39,6 @@ public interface AccountItemMapper extends BaseMapper<AccountItem>{
      * @author : 付斌
      * @author : 付斌
      * @date   : 2024-03-09 11:36
      * @date   : 2024-03-09 11:36
      */
      */
-    Map<String, Object> getSumAmtRec(String id);
+    Map<String, Object> getSumAmtRecPay(String id);
 }
 }
 
 

+ 3 - 4
src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.xml

@@ -220,8 +220,6 @@
                t.object_id,
                t.object_id,
                supplier.sup_code       as "supCode",
                supplier.sup_code       as "supCode",
                supplier.sup_name       as "supName",
                supplier.sup_name       as "supName",
-               supplier.contact_phone  as "contactPhone",
-               supplier.return_address as "returnAddress",
                t.org_id,
                t.org_id,
                tmo.org_name            as "orgName",
                tmo.org_name            as "orgName",
                t.staff_id,
                t.staff_id,
@@ -346,8 +344,9 @@
     </insert>
     </insert>
 
 
     <!-- 查询收款总额 -->
     <!-- 查询收款总额 -->
-    <select id="getSumAmtRec" resultType="java.util.Map">
-        SELECT COALESCE(sum(tmai.amt_rec), 0) as "sumAmtRec"
+    <select id="getSumAmtRecPay" resultType="java.util.Map">
+        SELECT COALESCE(sum(tmai.amt_rec), 0) as "sumAmtRec",
+               COALESCE(sum(tmai.amt_pay), 0) as "sumAmtPay"
         FROM dkic_b.t_mac_account_item as tmai
         FROM dkic_b.t_mac_account_item as tmai
         where tmai.flg_valid
         where tmai.flg_valid
           and tmai.object_id = #{id}::uuid
           and tmai.object_id = #{id}::uuid

+ 14 - 0
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java

@@ -33,5 +33,19 @@ public interface RecPayMapper extends BaseMapper<RecPay>{
      * @date   : 2024-03-03 9:25
      * @date   : 2024-03-03 9:25
      */
      */
     RecPayResponse selectById(String id);
     RecPayResponse selectById(String id);
+
+    /**
+     * @desc   : 根据条件进行查询
+     * @author : 付斌
+     * @date   : 2024-02-28 10:18
+     */
+    List<RecPayResponse> selectPaymentByCond(RecPayQuery recPayQuery);
+
+    /**
+     * @desc   : 根据条件进行查询(数量)
+     * @author : 付斌
+     * @date   : 2024-02-28 10:19
+     */
+    Long countPaymentByCond(RecPayQuery recPayQuery);
 }
 }
 
 

+ 223 - 175
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml

@@ -5,152 +5,155 @@
     <!-- 通用设置 -->
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
     <sql id="Base_Column_List">
-        rp_id, rp_no, rp_type, object_id, org_id, staff_id, sum_amt_rec, sum_amt_pay, sum_amt_receivable_handle, sum_amt_payable_handle, sum_waive_amt, acc_date, remarks, biznis_type, biznis_id, biznis_no, flg_lock, make_staff, make_time, flg_valid, cp_id
+        rp_id, rp_no, rp_type, object_id, org_id, staff_id, sum_amt_rec, sum_amt_pay, sum_amt_receivable_handle, sum_amt_payable_handle, sum_waive_amt, acc_date, annex_paths, remarks, biznis_type, biznis_id, biznis_no, flg_lock, make_staff, make_time, flg_valid, cp_id
     </sql>
     </sql>
 
 
     <!-- 通用查询映射结果 -->
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPay">
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPay">
         <id column="rp_id" property="rpId"/>
         <id column="rp_id" property="rpId"/>
-                <result column="rp_no" property="rpNo"/>
-                <result column="rp_type" property="rpType"/>
-                <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
-                <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
-                <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
-                <result column="sum_amt_rec" property="sumAmtRec"/>
-                <result column="sum_amt_pay" property="sumAmtPay"/>
-                <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
-                <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
-                <result column="sum_waive_amt" property="sumWaiveAmt"/>
-                <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
-                <result column="remarks" property="remarks"/>
-                <result column="biznis_type" property="biznisType"/>
-                <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
-                <result column="biznis_no" property="biznisNo"/>
-                <result column="flg_lock" property="flgLock"/>
-                <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
-                <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
+            <result column="rp_no" property="rpNo"/>
+            <result column="rp_type" property="rpType"/>
+            <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
+            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+            <result column="sum_amt_rec" property="sumAmtRec"/>
+            <result column="sum_amt_pay" property="sumAmtPay"/>
+            <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
+            <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
+            <result column="sum_waive_amt" property="sumWaiveAmt"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+            <result column="remarks" property="remarks"/>
+            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+            <result column="biznis_type" property="biznisType"/>
+            <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
+            <result column="biznis_no" property="biznisNo"/>
+            <result column="flg_lock" property="flgLock"/>
+            <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
+            <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
     </resultMap>
     </resultMap>
 
 
     <!-- Response查询映射结果 -->
     <!-- Response查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayResponse">
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayResponse">
         <id column="rp_id" property="rpId"/>
         <id column="rp_id" property="rpId"/>
-                <result column="rp_no" property="rpNo"/>
-                <result column="rp_type" property="rpType"/>
-                <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
-                <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
-                <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
-                <result column="sum_amt_rec" property="sumAmtRec"/>
-                <result column="sum_amt_pay" property="sumAmtPay"/>
-                <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
-                <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
-                <result column="sum_waive_amt" property="sumWaiveAmt"/>
-                <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
-                <result column="remarks" property="remarks"/>
-                <result column="biznis_type" property="biznisType"/>
-                <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
-                <result column="biznis_no" property="biznisNo"/>
-                <result column="flg_lock" property="flgLock"/>
-                <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
-                <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
+            <result column="rp_no" property="rpNo"/>
+            <result column="rp_type" property="rpType"/>
+            <result column="object_id" property="objectId" typeHandler="UuidTypeHandler"/>
+            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+            <result column="sum_amt_rec" property="sumAmtRec"/>
+            <result column="sum_amt_pay" property="sumAmtPay"/>
+            <result column="sum_amt_receivable_handle" property="sumAmtReceivableHandle"/>
+            <result column="sum_amt_payable_handle" property="sumAmtPayableHandle"/>
+            <result column="sum_waive_amt" property="sumWaiveAmt"/>
+            <result column="acc_date" property="accDate" typeHandler="TimestampTypeHandler"/>
+            <result column="remarks" property="remarks"/>
+            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+            <result column="biznis_type" property="biznisType"/>
+            <result column="biznis_id" property="biznisId" typeHandler="UuidTypeHandler"/>
+            <result column="biznis_no" property="biznisNo"/>
+            <result column="flg_lock" property="flgLock"/>
+            <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
+            <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
+            <result column="flg_valid" property="flgValid"/>
+            <result column="cp_id" property="cpId"/>
     </resultMap>
     </resultMap>
 
 
     <!-- 通用条件列 -->
     <!-- 通用条件列 -->
     <sql id="Condition">
     <sql id="Condition">
-        <where>
-            <if test="rpNo != null and rpNo != ''">
-                AND t.rp_no LIKE concat('%',my_ex.likequery(#{rpNo}),'%')
-            </if>
-            <if test="searchText !=null and searchText != ''">
-                AND (
-                t.rp_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
-                )
-            </if>
-            <if test="rpType != null and rpType != ''">
-                AND t.rp_type = #{rpType}
-            </if>
-            <if test="objectId != null and objectId != ''">
-                AND t.object_id = #{objectId}
-            </if>
-            <if test="orgId != null and orgId != ''">
-                AND t.org_id = #{orgId}
-            </if>
-            <if test="staffId != null and staffId != ''">
-                AND t.staff_id = #{staffId}
-            </if>
-            <if test="sumAmtRec != null">
-                AND t.sum_amt_rec = #{sumAmtRec}
-            </if>
-            <if test="sumAmtPay != null">
-                AND t.sum_amt_pay = #{sumAmtPay}
-            </if>
-            <if test="sumAmtReceivableHandle != null">
-                AND t.sum_amt_receivable_handle = #{sumAmtReceivableHandle}
-            </if>
-            <if test="sumAmtPayableHandle != null">
-                AND t.sum_amt_payable_handle = #{sumAmtPayableHandle}
-            </if>
-            <if test="sumWaiveAmt != null">
-                AND t.sum_waive_amt = #{sumWaiveAmt}
-            </if>
-            <if test="accDate != null">
-                AND t.acc_date = #{accDate}
-            </if>
-            <if test="remarks != null and remarks != ''">
-                AND t.remarks = #{remarks}
-            </if>
-            <if test="annexPaths != null and annexPaths != ''">
-                AND t.annex_paths = #{annexPaths}
-            </if>
-            <if test="biznisType != null and biznisType != ''">
-                AND t.biznis_type = #{biznisType}
-            </if>
-            <if test="biznisId != null and biznisId != ''">
-                AND t.biznis_id = #{biznisId}
-            </if>
-            <if test="biznisNo != null and biznisNo != ''">
-                AND t.biznis_no = #{biznisNo}
-            </if>
-            <if test="flgLock != null">
-                AND t.flg_lock = #{flgLock}
-            </if>
-            <if test="makeStaff != null and makeStaff != ''">
-                AND t.make_staff = #{makeStaff}
-            </if>
-            <if test="makeTime != null">
-                AND t.make_time = #{makeTime}
-            </if>
-            <if test="cpId != null">
-                AND t.cp_id = #{cpId}
-            </if>
-            <if test="cusPhone != null and cusPhone != ''">
-                AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
-            </if>
-            <if test="cusName != null and cusName != ''">
-                AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
-            </if>
-            <if test="orgIds != null and orgIds.size() > 0">
-                AND t.org_id  =any(#{orgIds, typeHandler=UuidListTypeHandler})
-            </if>
-            <if test="staffIds != null and staffIds.size() > 0">
-                AND t.staff_id  =any(#{staffIds, typeHandler=UuidListTypeHandler})
-            </if>
-            <if test="makeTimeStart != null and makeTimeEnd != null">
-                AND t.make_time &gt;= #{makeTimeStart}::timestamp with time zone
-                AND t.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
-            </if>
-            <if test="flgValidList != null and flgValidList.size()>0">
-                AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
-            </if>
-        </where>
+        <if test="rpNo != null and rpNo != ''">
+            AND t.rp_no LIKE concat('%',my_ex.likequery(#{rpNo}),'%')
+        </if>
+        <if test="searchText !=null and searchText != ''">
+            AND (
+            t.rp_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
+            )
+        </if>
+        <if test="rpType != null and rpType != ''">
+            AND t.rp_type = #{rpType}
+        </if>
+        <if test="objectId != null and objectId != ''">
+            AND t.object_id = #{objectId}
+        </if>
+        <if test="orgId != null and orgId != ''">
+            AND t.org_id = #{orgId}
+        </if>
+        <if test="staffId != null and staffId != ''">
+            AND t.staff_id = #{staffId}
+        </if>
+        <if test="sumAmtRec != null">
+            AND t.sum_amt_rec = #{sumAmtRec}
+        </if>
+        <if test="sumAmtPay != null">
+            AND t.sum_amt_pay = #{sumAmtPay}
+        </if>
+        <if test="sumAmtReceivableHandle != null">
+            AND t.sum_amt_receivable_handle = #{sumAmtReceivableHandle}
+        </if>
+        <if test="sumAmtPayableHandle != null">
+            AND t.sum_amt_payable_handle = #{sumAmtPayableHandle}
+        </if>
+        <if test="sumWaiveAmt != null">
+            AND t.sum_waive_amt = #{sumWaiveAmt}
+        </if>
+        <if test="accDate != null">
+            AND t.acc_date = #{accDate}
+        </if>
+        <if test="remarks != null and remarks != ''">
+            AND t.remarks = #{remarks}
+        </if>
+        <if test="annexPaths != null and annexPaths != ''">
+            AND t.annex_paths = #{annexPaths}
+        </if>
+        <if test="biznisType != null and biznisType != ''">
+            AND t.biznis_type = #{biznisType}
+        </if>
+        <if test="biznisId != null and biznisId != ''">
+            AND t.biznis_id = #{biznisId}
+        </if>
+        <if test="biznisNo != null and biznisNo != ''">
+            AND t.biznis_no = #{biznisNo}
+        </if>
+        <if test="flgLock != null">
+            AND t.flg_lock = #{flgLock}
+        </if>
+        <if test="makeStaff != null and makeStaff != ''">
+            AND t.make_staff = #{makeStaff}
+        </if>
+        <if test="makeTime != null">
+            AND t.make_time = #{makeTime}
+        </if>
+        <if test="cpId != null">
+            AND t.cp_id = #{cpId}
+        </if>
+        <if test="cusPhone != null and cusPhone != ''">
+            AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
+        </if>
+        <if test="cusName != null and cusName != ''">
+            AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
+        </if>
+        <if test="orgIdList != null and orgIdList.size() > 0">
+            AND t.org_id  =any(#{orgIdList, typeHandler=UuidListTypeHandler})
+        </if>
+        <if test="staffIdList != null and staffIdList.size() > 0">
+            AND t.staff_id  =any(#{staffIdList, typeHandler=UuidListTypeHandler})
+        </if>
+        <if test="makeTimeStart != null and makeTimeEnd != null">
+            AND t.make_time &gt;= #{makeTimeStart}::timestamp with time zone
+            AND t.make_time &lt; #{makeTimeEnd}::timestamp with time zone + interval '1 day'
+        </if>
+        <if test="flgValidList != null and flgValidList.size()>0">
+            AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
+        </if>
+        <if test="supName != null and supName != ''">
+            AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
+        </if>
     </sql>
     </sql>
 
 
     <sql id="idsForeach">
     <sql id="idsForeach">
@@ -168,15 +171,14 @@
                t.rp_type,
                t.rp_type,
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                t.object_id,
                t.object_id,
-                tmp.sup_name                                     AS "supplierName",
-               tmc.cus_code                                      as "cusCode",
-               tmc.cus_name                                      as "cusName",
-               tmc.cus_phone                                     as "cusPhone",
-               tmc.address_full                                  as "addressFull",
+               tmc.cus_code         as "cusCode",
+               tmc.cus_name         as "cusName",
+               tmc.cus_phone        as "cusPhone",
+               tmc.address_full     as "addressFull",
                t.org_id,
                t.org_id,
-               tmo.org_name                                      as "orgName",
+               tmo.org_name         as "orgName",
                t.staff_id,
                t.staff_id,
-               tms.staff_name                                    as "staffName",
+               tms.staff_name       as "staffName",
                t.sum_amt_rec,
                t.sum_amt_rec,
                t.sum_amt_pay,
                t.sum_amt_pay,
                t.sum_amt_receivable_handle,
                t.sum_amt_receivable_handle,
@@ -184,23 +186,23 @@
                t.sum_waive_amt,
                t.sum_waive_amt,
                t.acc_date,
                t.acc_date,
                t.remarks,
                t.remarks,
+               t.annex_paths,
                t.biznis_type,
                t.biznis_type,
                t.biznis_id,
                t.biznis_id,
                t.biznis_no,
                t.biznis_no,
                t.flg_lock,
                t.flg_lock,
                t.make_staff,
                t.make_staff,
-               makestaff.staff_name                              as "makeStaffName",
+               makestaff.staff_name as "makeStaffName",
                t.make_time,
                t.make_time,
                t.flg_valid,
                t.flg_valid,
                t.cp_id
                t.cp_id
         from dkic_b.t_mac_rec_pay as t
         from dkic_b.t_mac_rec_pay as t
-                 left join dkic_b.t_mst_customer tmc
-                           on tmc.cus_id = t.object_id and t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
-                 Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
+                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+        where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
         <include refid="Condition"/>
         <include refid="Condition"/>
         order by t.op_create_time desc
         order by t.op_create_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
@@ -210,16 +212,14 @@
 
 
     <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
     <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
-        FROM dkic_b.t_mac_rec_pay as t
-         LEFT JOIN dkic_b.t_mst_customer tmc
-                   ON tmc.cus_id = t.object_id
-        Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
-        left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
-        left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
-        left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
-        left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+        SELECT count(1)
+        from dkic_b.t_mac_rec_pay as t
+                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
+                 left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+                 left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+        where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
         <include refid="Condition"/>
         <include refid="Condition"/>
     </select>
     </select>
 
 
@@ -230,15 +230,14 @@
                t.rp_type,
                t.rp_type,
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                t.object_id,
                t.object_id,
-               tmp.sup_name          AS "supplierName",
-               tmc.cus_code           as "cusCode",
-               tmc.cus_name           as "cusName",
-               tmc.cus_phone          as "cusPhone",
-               tmc.address_full       as "addressFull",
+               tmc.cus_code         as "cusCode",
+               tmc.cus_name         as "cusName",
+               tmc.cus_phone        as "cusPhone",
+               tmc.address_full     as "addressFull",
                t.org_id,
                t.org_id,
-               tmo.org_name           as "orgName",
+               tmo.org_name         as "orgName",
                t.staff_id,
                t.staff_id,
-               tms.staff_name         as "staffName",
+               tms.staff_name       as "staffName",
                t.sum_amt_rec,
                t.sum_amt_rec,
                t.sum_amt_pay,
                t.sum_amt_pay,
                t.sum_amt_receivable_handle,
                t.sum_amt_receivable_handle,
@@ -246,33 +245,24 @@
                t.sum_waive_amt,
                t.sum_waive_amt,
                t.acc_date,
                t.acc_date,
                t.remarks,
                t.remarks,
+               t.annex_paths,
                t.biznis_type,
                t.biznis_type,
                t.biznis_id,
                t.biznis_id,
                t.biznis_no,
                t.biznis_no,
                t.flg_lock,
                t.flg_lock,
                t.make_staff,
                t.make_staff,
-               makestaff.staff_name   as "makeStaffName",
+               makestaff.staff_name as "makeStaffName",
                t.make_time,
                t.make_time,
                t.flg_valid,
                t.flg_valid,
-               t.cp_id,
-               tma.receipt,
-               tma.receipt_lock       as "receiptLock",
-               tma.contract_assets    as "contractAssets",
-               tma.receivable,
-               tma.receivable_handle  as "receivableHandle",
-               tma.receivable_waive   as "receivableWaive",
-               tma.receivable_residue as "receivableResidue",
-               tma.receipt_residue    as "receiptResidue"
+               t.cp_id
         from dkic_b.t_mac_rec_pay as t
         from dkic_b.t_mac_rec_pay as t
-                 left join dkic_b.t_mst_customer tmc
-                           on tmc.cus_id = t.object_id and t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
-                 Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
+                 left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.object_id
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
                  left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
                  left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
-                 left join dkic_b.t_mac_account as tma on tma.object_id = t.object_id and tma.object_type = '对象类型-客户'
-        WHERE t.rp_id = #{id}::uuid
+        where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
+          and t.rp_id = #{id}::uuid
     </select>
     </select>
 
 
     <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
     <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
@@ -349,4 +339,62 @@
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
+
+
+    <!-- 查询表t_mac_rec_pay,(条件查询+分页)列表 -->
+    <select id="selectPaymentByCond" resultMap="BaseResultMapResponse">
+        select t.rp_id,
+               t.rp_no,
+               t.rp_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
+               t.object_id,
+               tmp.sup_code         as "supCode",
+               tmp.sup_name         as "supName",
+               t.org_id,
+               tmo.org_name         as "orgName",
+               t.staff_id,
+               tms.staff_name       as "staffName",
+               t.sum_amt_rec,
+               t.sum_amt_pay,
+               t.sum_amt_receivable_handle,
+               t.sum_amt_payable_handle,
+               t.sum_waive_amt,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.biznis_type,
+               t.biznis_id,
+               t.biznis_no,
+               t.flg_lock,
+               t.make_staff,
+               makestaff.staff_name as "makeStaffName",
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
+        from dkic_b.t_mac_rec_pay as t
+                 Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
+                 left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+                 left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+        where t.rp_type in ('收付款类型-付款', '收付款类型-退付款')
+        <include refid="Condition"/>
+        order by t.op_create_time desc
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+
+    <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
+    <select id="countPaymentByCond" resultType="Long">
+        SELECT count(1)
+        from dkic_b.t_mac_rec_pay as t
+                 Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.object_id
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.rp_type
+                 left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
+                 left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
+                 left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
+        where t.rp_type in ('收付款类型-付款', '收付款类型-退付款')
+        <include refid="Condition"/>
+    </select>
 </mapper>
 </mapper>

+ 17 - 0
src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml

@@ -35,6 +35,8 @@
         <result column="op_db_user" property="opDbUser"/>
         <result column="op_db_user" property="opDbUser"/>
         <result column="flg_can_login" property="flgCanLogin"/>
         <result column="flg_can_login" property="flgCanLogin"/>
         <result column="hr_status" property="hrStatus"/>
         <result column="hr_status" property="hrStatus"/>
+        <result column="default_wh_id" property="defaultWhId"/>
+        <result column="default_wh_name" property="defaultWhName"/>
     </resultMap>
     </resultMap>
 
 
     <!-- 通用条件列 -->
     <!-- 通用条件列 -->
@@ -129,12 +131,27 @@
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
         , org.org_name,
         , org.org_name,
+        CASE
+        WHEN tmow.wh_id IS NULL THEN
+        (SELECT wh_id FROM dkic_b.t_mst_warehouse where cp_id = T.cp_id and flg_default)
+        ELSE  tmow.wh_id
+        END AS default_wh_id,
+        CASE
+        WHEN tmw.wh_name IS NULL THEN
+        (SELECT wh_name FROM dkic_b.t_mst_warehouse where cp_id = T.cp_id and flg_default)
+        ELSE tmw.wh_name
+        END AS default_wh_name,
         case when t.hr_status = 1 then '在职' else '离职' end as  hr_status_name,
         case when t.hr_status = 1 then '在职' else '离职' end as  hr_status_name,
+
         (SELECT  COALESCE(array_to_string(array_agg(role_name), ','),'')
         (SELECT  COALESCE(array_to_string(array_agg(role_name), ','),'')
         FROM dkic_b.t_mst_role
         FROM dkic_b.t_mst_role
         WHERE role_id = ANY (t.role_ids)) AS role_names
         WHERE role_id = ANY (t.role_ids)) AS role_names
         FROM dkic_b.t_mst_staff t
         FROM dkic_b.t_mst_staff t
         LEFT JOIN dkic_b.t_mst_org org ON t.org_Id = org.org_Id
         LEFT JOIN dkic_b.t_mst_org org ON t.org_Id = org.org_Id
+        LEFT JOIN dkic_b.t_mst_org_wh tmow ON tmow.cp_id = T.cp_id
+        AND tmow.org_id = T.org_id
+        AND tmow.flg_default
+        LEFT JOIN dkic_b.t_mst_warehouse tmw ON tmw.wh_id = tmow.wh_id
         WHERE t.wx_user_id = #{userId}::uuid
         WHERE t.wx_user_id = #{userId}::uuid
     </select>
     </select>
 
 

+ 2 - 1
src/main/java/com/dk/mdm/model/pojo/mac/OtherPayable.java

@@ -1,6 +1,7 @@
 package com.dk.mdm.model.pojo.mac;
 package com.dk.mdm.model.pojo.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.annotation.*;
 import java.io.Serializable;
 import java.io.Serializable;
 
 
@@ -132,7 +133,7 @@ public class OtherPayable extends PageInfo<OtherPayable> implements Serializable
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 2 - 1
src/main/java/com/dk/mdm/model/pojo/mac/OtherReceivable.java

@@ -1,6 +1,7 @@
 package com.dk.mdm.model.pojo.mac;
 package com.dk.mdm.model.pojo.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.annotation.*;
 import java.io.Serializable;
 import java.io.Serializable;
 
 
@@ -131,7 +132,7 @@ public class OtherReceivable extends PageInfo<OtherReceivable> implements Serial
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 2 - 2
src/main/java/com/dk/mdm/model/query/mac/OtherPayableQuery.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.query.mac;
 package com.dk.mdm.model.query.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -135,7 +135,7 @@ public class OtherPayableQuery extends PageInfo<OtherPayableQuery> implements Se
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 2 - 2
src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.query.mac;
 package com.dk.mdm.model.query.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -135,7 +135,7 @@ public class OtherReceivableQuery extends PageInfo<OtherReceivableQuery> impleme
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 3 - 15
src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java

@@ -93,21 +93,6 @@ public class RecPayQuery extends PageInfo<RecPayQuery> implements Serializable {
     private String staffId;
     private String staffId;
 
 
     /**
     /**
-     * 员工ID
-     */
-    @ApiModelProperty(value = "员工ID")
-    @TableField(typeHandler = UuidListTypeHandler.class)
-    private List<String> staffIds;
-
-    /**
-     * @desc   : 组织部门list
-     */
-    @ApiModelProperty(value = "组织部门list")
-    @TableField(typeHandler = UuidListTypeHandler.class)
-    private List<String> orgIds;
-
-
-    /**
      * 收款金额
      * 收款金额
      */
      */
     @Excel(name = "收款金额")
     @Excel(name = "收款金额")
@@ -261,6 +246,9 @@ public class RecPayQuery extends PageInfo<RecPayQuery> implements Serializable {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private List<Boolean> flgValidList;
     private List<Boolean> flgValidList;
 
 
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 8 - 0
src/main/java/com/dk/mdm/model/response/mac/AccountItemResponse.java

@@ -249,6 +249,14 @@ public class AccountItemResponse extends PageInfo<AccountItemResponse> implement
     @ApiModelProperty(value = "未核销金额")
     @ApiModelProperty(value = "未核销金额")
     private BigDecimal amtNotHandle;
     private BigDecimal amtNotHandle;
 
 
+    @ApiModelProperty(value = "供应商编码")
+    private String supCode;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
+    @ApiModelProperty(value = "本次核销金额")
+    private BigDecimal amtPayableHandle;
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 

+ 2 - 2
src/main/java/com/dk/mdm/model/response/mac/OtherPayableResponse.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.response.mac;
 package com.dk.mdm.model.response.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -134,7 +134,7 @@ public class OtherPayableResponse extends PageInfo<OtherPayableResponse> impleme
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 2 - 2
src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.response.mac;
 package com.dk.mdm.model.response.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -134,7 +134,7 @@ public class OtherReceivableResponse extends PageInfo<OtherReceivableResponse> i
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 6 - 3
src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java

@@ -227,9 +227,6 @@ public class RecPayResponse extends PageInfo<RecPayResponse> implements Serializ
     @ApiModelProperty(value = "组织名称")
     @ApiModelProperty(value = "组织名称")
     private String orgName;
     private String orgName;
 
 
-    @ApiModelProperty(value = "供应商")
-    private String supplierName;
-
     @ApiModelProperty(value = "员工姓名")
     @ApiModelProperty(value = "员工姓名")
     private String staffName;
     private String staffName;
 
 
@@ -272,6 +269,12 @@ public class RecPayResponse extends PageInfo<RecPayResponse> implements Serializ
     @ApiModelProperty(value = "总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))")
     @ApiModelProperty(value = "总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))")
     private BigDecimal receiptResidue;
     private BigDecimal receiptResidue;
 
 
+    @ApiModelProperty(value = "供应商编码")
+    private String supCode;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 2 - 2
src/main/java/com/dk/mdm/model/vo/mac/OtherPayableVO.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.vo.mac;
 package com.dk.mdm.model.vo.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -135,7 +135,7 @@ public class OtherPayableVO extends PageInfo<OtherPayableVO> implements Serializ
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 2 - 2
src/main/java/com/dk/mdm/model/vo/mac/OtherReceivableVO.java

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.vo.mac;
 package com.dk.mdm.model.vo.mac;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -135,7 +135,7 @@ public class OtherReceivableVO extends PageInfo<OtherReceivableVO> implements Se
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
 
 
     /**
     /**

+ 3 - 0
src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java

@@ -230,6 +230,9 @@ public class RecPayVO extends PageInfo<RecPayVO> implements Serializable {
     @ApiModelProperty(value = "应收冲抵明细")
     @ApiModelProperty(value = "应收冲抵明细")
     private List<RecPayHandleItemVO> receivableList;
     private List<RecPayHandleItemVO> receivableList;
 
 
+    @ApiModelProperty(value = "应付冲抵明细")
+    private List<RecPayHandleItemVO> payableList;
+
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
 }
 }

+ 25 - 2
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -159,8 +159,8 @@ public class AccountService extends BaseService<Account> {
      */
      */
     public void updateReceipt(String objectId) {
     public void updateReceipt(String objectId) {
         Account accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
         Account accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
-        Map<String, Object> mapSumAmtRec = accountItemMapper.getSumAmtRec(objectId);
-        BigDecimal sumAmtRec = new BigDecimal(mapSumAmtRec.get("sumAmtRec").toString());
+        Map<String, Object> mapSumAmtRecPay = accountItemMapper.getSumAmtRecPay(objectId);
+        BigDecimal sumAmtRec = new BigDecimal(mapSumAmtRecPay.get("sumAmtRec").toString());
         // 可退金额 = 总收款额-应收应款额+优惠金额
         // 可退金额 = 总收款额-应收应款额+优惠金额
         BigDecimal sumReceiptResidue = sumAmtRec.subtract(accountForUpdate.getReceivableHandle()).add(accountForUpdate.getReceivableWaive());
         BigDecimal sumReceiptResidue = sumAmtRec.subtract(accountForUpdate.getReceivableHandle()).add(accountForUpdate.getReceivableWaive());
 
 
@@ -176,6 +176,29 @@ public class AccountService extends BaseService<Account> {
     }
     }
 
 
     /**
     /**
+     * @desc : 更新总帐上付款类字段
+     * @author : 付斌
+     * @date : 2024-03-22 11:08
+     */
+    public void updatePayment(String objectId) {
+        Account accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
+        Map<String, Object> mapSumAmtRecPay = accountItemMapper.getSumAmtRecPay(objectId);
+        BigDecimal sumAmtPay = new BigDecimal(mapSumAmtRecPay.get("sumAmtPay").toString());
+        // 可退金额 = 总收款额-应收应款额+优惠金额
+        BigDecimal sumPaymentResidue = sumAmtPay.subtract(accountForUpdate.getPayableHandle()).add(accountForUpdate.getPayableWaive());
+
+        // 如果可退金额小于0 ,则提示余额不足
+        if (sumPaymentResidue.compareTo(BigDecimal.ZERO) == -1) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+        }
+
+        // 更新账款总表上的收款总额和可用金额
+        Account accountUpdate = new Account();
+        accountUpdate.setPayment(sumAmtPay).setPaymentResidue(sumPaymentResidue).setObjectId(objectId);
+        super.updateByUuid(accountUpdate);
+    }
+
+    /**
      * @desc : 更新资金账户余额
      * @desc : 更新资金账户余额
      * @author : 付斌
      * @author : 付斌
      * @date : 2024-03-22 11:08
      * @date : 2024-03-22 11:08

+ 342 - 0
src/main/java/com/dk/mdm/service/mac/PaymentService.java

@@ -0,0 +1,342 @@
+package com.dk.mdm.service.mac;
+
+import com.dk.common.exception.BaseBusinessException;
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
+import com.dk.common.mapper.BaseMapper;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.common.service.BaseService;
+import com.dk.mdm.infrastructure.convert.mac.RecPayConvert;
+import com.dk.mdm.infrastructure.convert.mac.RecPayHandleItemConvert;
+import com.dk.mdm.infrastructure.convert.mac.RecPayItemConvert;
+import com.dk.mdm.mapper.mac.*;
+import com.dk.mdm.mapper.mst.MoneyAccountItemMapper;
+import com.dk.mdm.mapper.mst.MoneyAccountMapper;
+import com.dk.mdm.model.pojo.mac.*;
+import com.dk.mdm.model.pojo.mst.MoneyAccount;
+import com.dk.mdm.model.pojo.mst.MoneyAccountItem;
+import com.dk.mdm.model.query.mac.RecPayHandleItemQuery;
+import com.dk.mdm.model.query.mac.RecPayItemQuery;
+import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.response.mac.RecPayHandleItemResponse;
+import com.dk.mdm.model.response.mac.RecPayItemResponse;
+import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.vo.mac.RecPayHandleItemVO;
+import com.dk.mdm.model.vo.mac.RecPayItemVO;
+import com.dk.mdm.model.vo.mac.RecPayVO;
+import com.dk.mdm.service.common.CommonService;
+import com.dk.mdm.service.mst.MoneyAccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Transactional
+public class PaymentService extends BaseService<RecPay> {
+
+    @Override
+    public String getPrimaryKey() {
+        return "rp_id";
+    }
+
+    @Override
+    public BaseMapper<RecPay> getRepository() {
+        return recPayMapper;
+    }
+
+    @Autowired
+    private RecPayMapper recPayMapper;
+
+    @Autowired
+    private RecPayItemService recPayItemService;
+
+    @Autowired
+    private RecPayItemMapper recPayItemMapper;
+
+    @Autowired
+    private AccountService accountService;
+
+    @Autowired
+    private AccountMapper accountMapper;
+
+    @Autowired
+    private AccountItemService accountItemService;
+
+    @Autowired
+    private MoneyAccountMapper moneyAccountMapper;
+
+    @Autowired
+    private AccountItemMapper accountItemMapper;
+
+    @Autowired
+    private MoneyAccountService moneyAccountService;
+
+    @Autowired
+    private MoneyAccountItemMapper moneyAccountItemMapper;
+
+    @Autowired
+    private RecPayHandleItemService recPayHandleItemService;
+
+    @Autowired
+    private RecPayHandleItemMapper recPayHandleItemMapper;
+
+    @Autowired
+    private CommonService commonService;
+
+    @Autowired
+    private RecPayConvert recPayConvert;
+
+    @Autowired
+    private RecPayItemConvert recPayItemConvert;
+
+    @Autowired
+    private RecPayHandleItemConvert recPayHandleItemConvert;
+
+    /**
+     * @desc : 条件查询
+     * @author : 付斌
+     * @date : 2023/1/9 10:40
+     */
+    @Pagination
+    public ResponseResultVO<PageList<RecPayResponse>> selectPaymentByCond(RecPayQuery recPayQuery) {
+        return super.mergeListWithCount(recPayQuery, recPayMapper.selectPaymentByCond(recPayQuery),
+                recPayMapper.countPaymentByCond(recPayQuery));
+    }
+
+    /**
+     * @desc : 查询付款明细
+     * @author : 付斌
+     * @date : 2024-02-28 13:25
+     */
+    @Pagination
+    public ResponseResultVO<Map<String, Object>> selectRpInfoById(String id) {
+        Map<String, Object> result = new HashMap<>();
+        // 付款明细
+        List<RecPayItemResponse> recPayItem = recPayItemMapper.selectByCond(new RecPayItemQuery().setRpId(id));
+        result.put("recPayItem", recPayItem);
+
+        // 应付核销明细
+        List<RecPayHandleItemResponse> recPayHandleItem = recPayHandleItemMapper.selectByCond(new RecPayHandleItemQuery().setRpId(id));
+        result.put("recPayHandleItem", recPayHandleItem);
+
+        // 附件
+        return ResponseResultUtil.success(result);
+    }
+    
+    /**
+     * @desc : 新建应付核销(付款+核销应付)
+     * @author : 付斌
+     * @date : 2023/1/9 10:49
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insertPayablePayment(RecPayVO recPayVO) {
+
+        /*********************  付款的处理 begin **********************/
+        // 获取单号
+        Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+        recPayVO.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString());
+        // 转化实体
+        RecPay recPay = recPayConvert.convertToPo(recPayVO);
+        // 总单保存
+        super.insert(recPay);
+
+        // 明细保存
+        if (recPayVO.getItemList() != null && recPayVO.getItemList().size() > 0) {
+            for (RecPayItemVO recPayItemVO : recPayVO.getItemList()) {
+                RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                recPayItemMapper.insert(recPayItem);
+
+                // 插入账款明细
+                AccountItem accountItem = new AccountItem();
+                accountItem.setAccItemType(Constant.accItemType.FU_KUAN.getName())
+                        .setObjectId(recPayVO.getObjectId()).setOrgId(recPayVO.getOrgId()).setStaffId(recPayVO.getStaffId())
+                        .setAccDate(recPayVO.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtPay(recPayItem.getAmtPay())
+                        .setBiznisType("t_mac_rec_pay_item").setBiznisId(recPayItem.getItemId()).setBiznisNo(recPayVO.getRpNo())
+                        .setMakeStaff(recPayVO.getMakeStaff()).setCpId(recPayVO.getCpId());
+                accountItemMapper.insert(accountItem);
+
+                // 更新付款单上的账款明细Id
+                RecPayItem recPayItemUpdate = new RecPayItem();
+                recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
+                recPayItemService.updateByUuid(recPayItemUpdate);
+
+                // 插入资金流水
+                MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                        .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtPay().negate()).setAccDate(recPayVO.getAccDate())
+                        .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                moneyAccountItemMapper.insert(moneyAccountItem);
+
+                // 更新资金账户
+                MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
+                MoneyAccount moneyAccountUpdate = new MoneyAccount();
+                moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtPay().negate()))
+                        .setMacId(moneyAccountForUpdate.getMacId());
+                moneyAccountService.updateByUuid(moneyAccountUpdate);
+            }
+        }
+
+        // 插入账款总表
+        Account accountForUpdate = accountService.getCusAccountForUpdate(recPayVO.getObjectId());
+        // 更新账款总表上付款的相关字段
+        Account accountUpdate = new Account();
+        accountUpdate.setPayment(accountForUpdate.getPayment().add(recPayVO.getSumAmtPay()))// 总付款金额
+                .setPaymentResidue(accountForUpdate.getPaymentResidue().add(recPayVO.getSumAmtPay()))//  可退金额
+                .setObjectId(accountForUpdate.getObjectId());
+        accountService.updateByUuid(accountUpdate);
+        /*********************  付款的处理 end **********************/
+
+
+        /*********************  应付付款的处理 begin **********************/
+        // 应付付款的处理
+        if (recPayVO.getPayableList() != null && recPayVO.getPayableList().size() > 0) {
+            for (RecPayHandleItemVO recPayHandleItemVO : recPayVO.getPayableList()) {
+                RecPayHandleItem recPayHandleItem = recPayHandleItemConvert.convertToPo(recPayHandleItemVO);
+                recPayHandleItem.setItemId(null).setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setAccDate(recPay.getAccDate());
+                recPayHandleItemMapper.insert(recPayHandleItem);
+
+                // 账款明细的核销金额和优惠金额
+                AccountItem accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItem.getAccItemId());
+                AccountItem accountItemUpdate = new AccountItem();
+                // 核销金额,超出剩余应付金额
+                if (accountItemForUpdate.getAmtResidue().compareTo(recPayHandleItem.getAmtPayableHandle()) == -1) {
+                    throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+                }
+                accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().add(recPayHandleItem.getAmtPayableHandle()))
+                        .setAmtWaive(accountItemForUpdate.getAmtWaive().add(recPayHandleItem.getAmtWaive()))
+                        .setItemId(recPayHandleItem.getAccItemId());
+                // 剩余金额 = 应付金额-应付付款金额
+                accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
+                accountItemService.updateByUuid(accountItemUpdate);
+            }
+
+            // 计算明细的核销金额,优惠金额合计
+            RecPayHandleItemVO recPayHandleItemVO = recPayVO.getPayableList().stream().reduce((x, y) -> {
+                RecPayHandleItemVO item = new RecPayHandleItemVO();
+                item.setAmtPayableHandle(x.getAmtPayableHandle().add(y.getAmtPayableHandle()));
+                item.setAmtWaive(x.getAmtWaive().add(y.getAmtWaive()));
+                return item;
+            }).get();
+
+            // 更新总账上
+            accountForUpdate = accountMapper.selectByIdForUpdate(recPayVO.getObjectId());
+            accountUpdate = new Account();
+            accountUpdate.setPayableHandle(accountForUpdate.getPayableHandle().add(recPayHandleItemVO.getAmtPayableHandle()))// 总应付付款金额
+                    .setPayableWaive(accountForUpdate.getPayableWaive().add(recPayHandleItemVO.getAmtWaive()))//  总应付优惠金额
+                    .setObjectId(accountForUpdate.getObjectId());
+            // 剩余应付 = 总应付账款-总应付付款金额
+            accountUpdate.setPayableResidue(accountForUpdate.getPayable().subtract(accountUpdate.getPayableHandle()));
+            // 可退金额 = 总付款金额-总应付付款金额+总应付优惠金额
+            accountUpdate.setPaymentResidue(accountForUpdate.getPayment().subtract(accountUpdate.getPayableHandle()).add(accountUpdate.getPayableWaive()));
+
+            // 更新前的最后校验
+            // 剩余应付为负数,则不能保存
+            if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+            }
+            // 可用金额为负数,则不能保存
+            if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+            }
+            accountService.updateByUuid(accountUpdate);
+        }
+        /*********************  应付付款的处理 end **********************/
+        return ResponseResultUtil.success();
+    }
+
+    /**
+     * @desc : 作废
+     * @author : 付斌
+     * @date : 2024-03-08 16:38
+     */
+    public ResponseResultVO<?> invalid(String id) {
+        RecPay recPayForUpdate = recPayMapper.selectByIdForUpdate(id);
+        // 并发校验
+        if (!recPayForUpdate.getFlgValid()) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISFLGVALID_FALSE.getMessage());
+        }
+        // 如果所在月份已结账,则不能作废 todo
+
+        // 查出并锁定所有应付核销明细
+        AccountItem accountItemForUpdate;
+        List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(id);
+        for (RecPayHandleItem recPayHandleItemForUpdate : recPayHandleItemForUpdateList) {
+            // 更新账款明细应付付款
+            accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItemForUpdate.getAccItemId());
+            AccountItem accountItemUpdate = new AccountItem();
+            accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().subtract(recPayHandleItemForUpdate.getAmtPayableHandle()))
+                    .setAmtWaive(accountItemForUpdate.getAmtWaive().subtract(recPayHandleItemForUpdate.getAmtWaive()))
+                    .setItemId(recPayHandleItemForUpdate.getAccItemId());
+            accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()).subtract(accountItemUpdate.getAmtWaive()));
+            accountItemService.updateByUuid(accountItemUpdate);
+
+            // 将核销明细有效标识置为false
+            RecPayHandleItem recPayHandleItemUpdate = new RecPayHandleItem();
+            recPayHandleItemUpdate.setFlgValid(false).setItemId(recPayHandleItemForUpdate.getItemId());
+            recPayHandleItemService.updateByUuid(recPayHandleItemUpdate);
+        }
+
+        // 把总帐上的钱加回来
+        Account accountForUpdate = accountMapper.selectByIdForUpdate(recPayForUpdate.getObjectId());
+        Account accountUpdate = new Account();
+        accountUpdate.setPayableHandle(accountForUpdate.getPayableHandle().subtract(recPayForUpdate.getSumAmtPayableHandle()))// 总应付付款金额
+                .setPayableWaive(accountForUpdate.getPayableWaive().subtract(recPayForUpdate.getSumWaiveAmt()))//  总应付优惠金额
+                .setObjectId(accountForUpdate.getObjectId());
+        // 剩余应付 = 总应付账款-总应付付款金额
+        accountUpdate.setPayableResidue(accountForUpdate.getPayable().subtract(accountUpdate.getPayableHandle()));
+        // 可退金额 = 总付款金额-总应付付款金额+总应付优惠金额
+        accountUpdate.setPaymentResidue(accountForUpdate.getPayment().subtract(accountUpdate.getPayableHandle()).add(accountUpdate.getPayableWaive()));
+
+        // 更新前的最后校验
+        // 剩余应付为负数,则不能保存
+        if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+        }
+        // 可用金额为负数,则不能保存
+        if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+        }
+        accountService.updateByUuid(accountUpdate);
+
+        // 将之前的明细全部删除
+        List<RecPayItem> recPayItemOriginalList = recPayItemMapper.selectByZIdForUpdate(id);
+        // 需要重新计算的资金账户
+        List<String> macList = new ArrayList<>();
+        for (RecPayItem recPayItem : recPayItemOriginalList) {
+            // 删除收付款明细
+            recPayItemMapper.deleteById(recPayItem.getItemId());
+            // 删除账款明细
+            accountItemMapper.deleteById(recPayItem.getAccItemId());
+            // 删除账户流水
+            moneyAccountItemMapper.deleteByInvoiceId(recPayItem.getItemId());
+
+            if (!macList.contains(recPayItem.getMacId())) {
+                macList.add(recPayItem.getMacId());
+            }
+        }
+        // 更新总账表的总付款额和可用额
+        accountService.updatePayment(recPayForUpdate.getObjectId());
+        // 更新账户余额
+        for (String macId : macList) {
+            accountService.updateMac(macId);
+        }
+        // 作废
+        RecPay recPayUpdate = new RecPay();
+        recPayUpdate.setFlgValid(false).setRpId(id);
+        super.updateByUuid(recPayUpdate);
+        return ResponseResultUtil.success();
+    }
+}

+ 1 - 1
src/main/java/com/dk/mdm/service/mac/RecPayService.java → src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -39,7 +39,7 @@ import java.util.*;
 
 
 @Service
 @Service
 @Transactional
 @Transactional
-public class RecPayService extends BaseService<RecPay> {
+public class ReceiptService extends BaseService<RecPay> {
 
 
     @Override
     @Override
     public String getPrimaryKey() {
     public String getPrimaryKey() {

+ 12 - 1
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -11,6 +11,7 @@ import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.feign.CompanyFeign;
 import com.dk.mdm.feign.CompanyFeign;
+import com.dk.mdm.feign.UserFeign;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.mapper.common.CommonMapper;
@@ -41,7 +42,8 @@ import java.util.*;
 public class StaffService extends BaseService<Staff> {
 public class StaffService extends BaseService<Staff> {
     @Resource
     @Resource
     private CompanyFeign companyFeign;
     private CompanyFeign companyFeign;
-
+    @Resource
+    private UserFeign userFeign;
 
 
     @Override
     @Override
     public BaseMapper<Staff> getRepository() {
     public BaseMapper<Staff> getRepository() {
@@ -117,6 +119,15 @@ public class StaffService extends BaseService<Staff> {
         staff.setStaffId(codeMap.get("outId").toString());
         staff.setStaffId(codeMap.get("outId").toString());
         staff.setStaffCode(codeMap.get("outNote").toString());
         staff.setStaffCode(codeMap.get("outNote").toString());
         super.insert(staff);
         super.insert(staff);
+        // 讲电话和名称插入微信用户表里
+
+        // 更新 被邀请人员的微信用户的cpid 加入公司
+        Map<String, Object> collectQuery = new HashMap<>();
+        collectQuery.put("currentCp", staff.getCpId());
+        collectQuery.put("userName", staff.getStaffName());
+        collectQuery.put("userPhone", staff.getStaffPhone());
+        userFeign.registerFeign(collectQuery);
+
         return ResponseResultUtil.success(staff);
         return ResponseResultUtil.success(staff);
     }
     }