ソースを参照

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

koushanshan 2 年 前
コミット
81fe849ff6
58 ファイル変更1161 行追加324 行削除
  1. 9 0
      src/main/java/com/dk/mdm/controller/common/CommonController.java
  2. 82 0
      src/main/java/com/dk/mdm/controller/mac/PaymentController.java
  3. 14 14
      src/main/java/com/dk/mdm/controller/mac/ReceiptController.java
  4. 9 0
      src/main/java/com/dk/mdm/controller/mst/CustomerController.java
  5. 11 4
      src/main/java/com/dk/mdm/controller/mst/StaffPurviewController.java
  6. 27 0
      src/main/java/com/dk/mdm/feign/UserFeign.java
  7. 7 0
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.java
  8. 11 0
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml
  9. 0 3
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml
  10. 1 1
      src/main/java/com/dk/mdm/mapper/ivt/InboundMapper.xml
  11. 3 3
      src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml
  12. 4 4
      src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml
  13. 1 1
      src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.java
  14. 3 4
      src/main/java/com/dk/mdm/mapper/mac/AccountItemMapper.xml
  15. 25 18
      src/main/java/com/dk/mdm/mapper/mac/OtherPayableItemMapper.xml
  16. 81 16
      src/main/java/com/dk/mdm/mapper/mac/OtherPayableMapper.xml
  17. 2 3
      src/main/java/com/dk/mdm/mapper/mac/OtherReceivableItemMapper.xml
  18. 0 6
      src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml
  19. 14 0
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.java
  20. 223 175
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml
  21. 17 0
      src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml
  22. 8 0
      src/main/java/com/dk/mdm/mapper/mst/StaffPurviewMapper.java
  23. 3 0
      src/main/java/com/dk/mdm/mapper/mst/StaffPurviewMapper.xml
  24. 7 2
      src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.xml
  25. 8 0
      src/main/java/com/dk/mdm/mapper/pur/PurchaseMapper.xml
  26. 2 2
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  27. 2 2
      src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml
  28. 3 0
      src/main/java/com/dk/mdm/mapper/wxapi/basic/WxCommonMapper.java
  29. 2 1
      src/main/java/com/dk/mdm/model/pojo/mac/OtherPayable.java
  30. 2 2
      src/main/java/com/dk/mdm/model/pojo/mac/OtherPayableItem.java
  31. 2 1
      src/main/java/com/dk/mdm/model/pojo/mac/OtherReceivable.java
  32. 2 2
      src/main/java/com/dk/mdm/model/query/mac/OtherPayableItemQuery.java
  33. 22 2
      src/main/java/com/dk/mdm/model/query/mac/OtherPayableQuery.java
  34. 2 2
      src/main/java/com/dk/mdm/model/query/mac/OtherReceivableQuery.java
  35. 3 15
      src/main/java/com/dk/mdm/model/query/mac/RecPayQuery.java
  36. 5 1
      src/main/java/com/dk/mdm/model/query/pur/PurchaseQuery.java
  37. 8 0
      src/main/java/com/dk/mdm/model/response/mac/AccountItemResponse.java
  38. 4 2
      src/main/java/com/dk/mdm/model/response/mac/OtherPayableItemResponse.java
  39. 19 2
      src/main/java/com/dk/mdm/model/response/mac/OtherPayableResponse.java
  40. 2 2
      src/main/java/com/dk/mdm/model/response/mac/OtherReceivableResponse.java
  41. 6 3
      src/main/java/com/dk/mdm/model/response/mac/RecPayResponse.java
  42. 8 0
      src/main/java/com/dk/mdm/model/response/pur/PurchaseItemResponse.java
  43. 2 2
      src/main/java/com/dk/mdm/model/vo/mac/OtherPayableItemVO.java
  44. 2 2
      src/main/java/com/dk/mdm/model/vo/mac/OtherPayableVO.java
  45. 2 2
      src/main/java/com/dk/mdm/model/vo/mac/OtherReceivableVO.java
  46. 3 0
      src/main/java/com/dk/mdm/model/vo/mac/RecPayVO.java
  47. 12 0
      src/main/java/com/dk/mdm/service/common/CommonService.java
  48. 1 1
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  49. 86 13
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  50. 6 6
      src/main/java/com/dk/mdm/service/mac/OtherPayableService.java
  51. 1 1
      src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java
  52. 342 0
      src/main/java/com/dk/mdm/service/mac/PaymentService.java
  53. 1 1
      src/main/java/com/dk/mdm/service/mac/ReceiptService.java
  54. 4 0
      src/main/java/com/dk/mdm/service/mst/CustomerService.java
  55. 9 0
      src/main/java/com/dk/mdm/service/mst/StaffPurviewService.java
  56. 12 1
      src/main/java/com/dk/mdm/service/mst/StaffService.java
  57. 13 1
      src/main/java/com/dk/mdm/service/pur/PurchaseService.java
  58. 1 1
      src/main/java/com/dk/mdm/service/wxapi/basic/WxCommonService.java

+ 9 - 0
src/main/java/com/dk/mdm/controller/common/CommonController.java

@@ -696,6 +696,15 @@ public class CommonController extends BaseController<Map<String, Object>> {
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForPurchaseReturnByPage(@RequestBody Map<String, Object> param) {
         return commonService.getGoodsForPurchaseReturnByPage(param);
     }
+
+    @ApiOperation(
+            value = "获取员工的范围权限类型",
+            notes = "获取员工的范围权限类型"
+    )
+    @PostMapping("get_purview_type")
+    public ResponseResultVO<?> getPurviewType(@RequestBody Map<String, Object> param) {
+        return commonService.getPurviewType(param);
+    }
 }
 
 

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

+ 9 - 0
src/main/java/com/dk/mdm/controller/mst/CustomerController.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.CustomerService;
 
+import java.util.List;
+
 @Api(tags = "客户资料API接口")
 @RestController
 @RequestMapping("/mst/customer")
@@ -69,4 +71,11 @@ public class CustomerController{
     public ResponseResultVO<?> selectByIdRespone(@PathVariable String id) {
         return customerService.selectByIdRespone(id);
     }
+
+
+    @ApiOperation(value = "不分页", notes = "分页、关联、条件查询")
+    @PostMapping({"select_by_cond_no_page"})
+    public ResponseResultVO<List<CustomerResponse>> selectByCondNoPage(@RequestBody CustomerQuery customerQuery) {
+        return customerService.selectByCondNoPage(customerQuery);
+    }
 }

+ 11 - 4
src/main/java/com/dk/mdm/controller/mst/StaffPurviewController.java

@@ -6,11 +6,8 @@ import com.dk.common.service.BaseService;
 import com.dk.common.model.vo.mst.StaffVO;
 import com.dk.mdm.service.mst.StaffService;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.StaffPurviewService;
 
@@ -38,6 +35,16 @@ public class StaffPurviewController{
 
 
     /**
+     * @desc   : 查询范围权限
+     * @author : 常皓宁
+     * @date   : 2024/4/2 14:46
+     */
+    @PostMapping("get_purview/{staffId}")
+    public ResponseResultVO getPurview(@PathVariable String staffId) {
+        return staffPurviewService.getPurview(staffId);
+    }
+
+    /**
      * @desc : 员工数据范围
      * @author : 姜永辉
      * @date : 2024/2/26 10:36

+ 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) ;
+
+}

+ 7 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.java

@@ -486,4 +486,11 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
      * @date   : 2024/3/9 10:08
      */
     Long getGoodsForPurchaseReturnByPage(Map param);
+
+    /**
+     * @desc   : 获取员工的范围权限类型
+     * @author : 常皓宁
+     * @date   : 2024/4/2 10:15
+     */
+    List<Map<String, Object>> getPurviewType(Map param);
 }

+ 11 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -1518,5 +1518,16 @@
         </if>
     </select>
 
+    <!--范围权限类型-->
+    <select id="getPurviewType" resultType="java.util.Map">
+        select tpt.purview_name_i18n as purviewName,
+               tpt.purview_code as "code",
+               "row_number"() OVER (ORDER BY tpt.display_no) as "id",
+               sys.f_get_name_i18n(tpt.purview_name_i18n,'zh_CN') AS name
+        from sys.t_purview_type tpt
+        where tpt.flg_valid
+        order by tpt.display_no
+    </select>
+
 
 </mapper>

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

@@ -197,9 +197,6 @@
         ,tmgs.sku_spec  as "skuSpec"
         ,tmgb.brand_name  as "brandName"
         ,tmgb.short_name  as "shortName"
-        ,tmw.wh_id as "whId"
-        ,tmw.wh_code as "whCode"
-        ,tmw.wh_name as "whName"
         ,tpp.pur_id as "purId"
         ,tpp.pur_no as "purNo"
         ,tppi.item_qty as "purItemQty"

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

@@ -550,7 +550,7 @@
         <include refid="Base_Column_List_Item_Response"/>,
         <include refid="Base_Column_List_Item_Response_Join"/>
         FROM dkic_b.t_psi_inbound  tpi
-        left  join dkic_b.t_psi_inbound_item tpii  on tpi.into_id = tpii.into_id
+        left  join dkic_b.t_psi_inbound_item tpii  on tpi.into_id = tpii.into_id and  ( tpii.into_qty - tpii.return_qty) > 0
         left  join  dkic_b.t_mst_warehouse tmw on  tmw.wh_id =   tpii.wh_id
         inner join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tpii.sku_id
         left join(SELECT T.*

+ 3 - 3
src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml

@@ -409,14 +409,14 @@
         update dkic_b.t_psi_outbound_item
         <set>
             <if test=" returnQty != null">
-                return_qty = return_qty + #{et.returnQty,jdbcType=NUMERIC},
+                return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
             </if>
             <if test=" returnAmt != null">
-                return_amt = return_amt + #{et.returnAmt,jdbcType=NUMERIC},
+                return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
             </if>
         </set>
         where item_id = #{itemId,typeHandler=UuidTypeHandler}
-        and  item_qty >= return_qty
+        and  out_qty >= return_qty
     </update>
 
 </mapper>

+ 4 - 4
src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml

@@ -562,11 +562,11 @@
     <update id="updateReturnMessage" parameterType="com.dk.mdm.model.pojo.sale.OrderItem">
         update dkic_b.t_psi_outbound
         <set>
-            <if test=" returnQty != null">
-                return_qty = return_qty + #{et.returnQty,jdbcType=NUMERIC},
+            <if test="returnQty != null">
+                return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
             </if>
-            <if test=" returnAmt != null">
-                return_amt = return_amt + #{et.returnAmt,jdbcType=NUMERIC},
+            <if test="returnAmt != null">
+                return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
             </if>
         </set>
         where out_id = #{outId,typeHandler=UuidTypeHandler}

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

@@ -39,6 +39,6 @@ public interface AccountItemMapper extends BaseMapper<AccountItem>{
      * @author : 付斌
      * @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,
                supplier.sup_code       as "supCode",
                supplier.sup_name       as "supName",
-               supplier.contact_phone  as "contactPhone",
-               supplier.return_address as "returnAddress",
                t.org_id,
                tmo.org_name            as "orgName",
                t.staff_id,
@@ -346,8 +344,9 @@
     </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
         where tmai.flg_valid
           and tmai.object_id = #{id}::uuid

+ 25 - 18
src/main/java/com/dk/mdm/mapper/mac/OtherPayableItemMapper.xml

@@ -5,7 +5,7 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        item_id, payable_id, payable_type, qty_outlay, amt_outlay, remarks, flg_valid, cp_id
+        item_id, payable_id, payable_type, qty_payable, amt_payable, remarks, flg_valid, cp_id
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -13,8 +13,8 @@
         <id column="item_id" property="itemId"/>
             <result column="payable_id" property="payableId" typeHandler="UuidTypeHandler"/>
             <result column="payable_type" property="payableType" typeHandler="UuidTypeHandler"/>
-            <result column="qty_outlay" property="qtyOutlay"/>
-            <result column="amt_outlay" property="amtOutlay"/>
+            <result column="qty_payable" property="qtyPayable"/>
+            <result column="amt_payable" property="amtPayable"/>
             <result column="remarks" property="remarks"/>
             <result column="flg_valid" property="flgValid"/>
             <result column="cp_id" property="cpId"/>
@@ -25,8 +25,8 @@
         <id column="item_id" property="itemId"/>
             <result column="payable_id" property="payableId" typeHandler="UuidTypeHandler"/>
             <result column="payable_type" property="payableType" typeHandler="UuidTypeHandler"/>
-            <result column="qty_outlay" property="qtyOutlay"/>
-            <result column="amt_outlay" property="amtOutlay"/>
+            <result column="qty_payable" property="qtyPayable"/>
+            <result column="amt_payable" property="amtPayable"/>
             <result column="remarks" property="remarks"/>
             <result column="flg_valid" property="flgValid"/>
             <result column="cp_id" property="cpId"/>
@@ -36,16 +36,16 @@
     <sql id="Condition">
         <where>
             <if test="payableId != null and payableId != ''">
-                AND t.payable_id = #{payableId}
+                AND t.payable_id = #{payableId}::uuid
             </if>
             <if test="payableType != null and payableType != ''">
                 AND t.payable_type = #{payableType}
             </if>
-            <if test="qtyOutlay != null">
-                AND t.qty_outlay = #{qtyOutlay}
+            <if test="qtyPayable != null">
+                AND t.qty_payable = #{qtyPayable}
             </if>
-            <if test="amtOutlay != null">
-                AND t.amt_outlay = #{amtOutlay}
+            <if test="amtPayable != null">
+                AND t.amt_payable = #{amtPayable}
             </if>
             <if test="remarks != null and remarks != ''">
                 AND t.remarks = #{remarks}
@@ -69,9 +69,17 @@
 
     <!-- 查询表t_mac_other_payable_item,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List"/>
+        SELECT t.item_id,
+               t.payable_id,
+               t.payable_type,
+               tmda.data_value as "payableTypeName",
+               t.qty_payable,
+               t.amt_payable,
+               t.remarks,
+               t.flg_valid,
+               t.cp_id
         FROM dkic_b.t_mac_other_payable_item as t
+                 LEFT JOIN dkic_b.t_mst_dictionary_data as tmda ON tmda.data_id = t.payable_type
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -80,8 +88,7 @@
 
     <!-- 查询表t_mac_other_payable_item,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
+        SELECT count(1)
         FROM dkic_b.t_mac_other_payable_item as t
         <include refid="Condition"/>
     </select>
@@ -127,8 +134,8 @@
         <trim suffixOverrides=",">
             payable_id,
             payable_type,
-            qty_outlay,
-            amt_outlay,
+            qty_payable,
+            amt_payable,
             remarks,
             cp_id,
             op_app_code,
@@ -140,8 +147,8 @@
             <trim suffixOverrides=",">
                 #{item.payableId}::uuid,
                 #{item.payableType}::uuid,
-                #{item.qtyOutlay},
-                #{item.amtOutlay},
+                #{item.qtyPayable},
+                #{item.amtPayable},
                 #{item.remarks},
                 #{item.cpId},
                 #{item.opAppCode},

+ 81 - 16
src/main/java/com/dk/mdm/mapper/mac/OtherPayableMapper.xml

@@ -51,7 +51,7 @@
     <sql id="Condition">
         <where>
             <if test="payableNo != null and payableNo != ''">
-                AND t.payable_no = #{payableNo}
+                AND t.payable_no LIKE concat('%',my_ex.likequery(#{payableNo}),'%')
             </if>
             <if test="objectType != null and objectType != ''">
                 AND t.object_type = #{objectType}
@@ -83,15 +83,25 @@
             <if test="makeStaff != null and makeStaff != ''">
                 AND t.make_staff = #{makeStaff}
             </if>
-            <if test="makeTime != null">
-                AND t.make_time = #{makeTime}
-            </if>
-            <if test="flgValid != null">
-                AND t.flg_valid = #{flgValid}
-            </if>
             <if test="cpId != null">
                 AND t.cp_id = #{cpId}
             </if>
+            <if test="supName != null and supName != ''">
+                AND supplier.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
+            </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>
     </sql>
 
@@ -105,9 +115,34 @@
 
     <!-- 查询表t_mac_other_payable,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
-        SELECT
-        <include refid="Base_Column_List"/>
+        SELECT t.payable_id,
+               t.payable_no,
+               t.object_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "objectTypeName",
+               t.object_id,
+               supplier.sup_code    as "supCode",
+               supplier.sup_name    as "supName",
+               t.org_id,
+               tmo.org_name         as "orgName",
+               t.staff_id,
+               tms.staff_name       as "staffName",
+               t.sum_amt_payable,
+               t.acc_item_id,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.make_staff,
+               makestaff.staff_name as "makeStaffName",
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
         FROM dkic_b.t_mac_other_payable as t
+                 left join dkic_b.t_mst_supplier as supplier
+                           on supplier.sup_id = t.object_id and t.object_type in ('对象类型-供应商')
+                 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
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -116,18 +151,48 @@
 
     <!-- 查询表t_mac_other_payable,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
+        SELECT count(1)
         FROM dkic_b.t_mac_other_payable as t
+                 left join dkic_b.t_mst_supplier as supplier
+                           on supplier.sup_id = t.object_id and t.object_type in ('对象类型-供应商')
+                 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
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
         <include refid="Condition"/>
     </select>
 
     <!-- 根据主键查询表t_mac_other_payable的一行数据 -->
-    <select id="selectById" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mac_other_payable
-        WHERE payable_id = #{payableId}::uuid
+    <select id="selectById" resultMap="BaseResultMapResponse">
+        SELECT t.payable_id,
+               t.payable_no,
+               t.object_type,
+               sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "objectTypeName",
+               t.object_id,
+               supplier.sup_code    as "supCode",
+               supplier.sup_name    as "supName",
+               t.org_id,
+               tmo.org_name         as "orgName",
+               t.staff_id,
+               tms.staff_name       as "staffName",
+               t.sum_amt_payable,
+               t.acc_item_id,
+               t.acc_date,
+               t.remarks,
+               t.annex_paths,
+               t.make_staff,
+               makestaff.staff_name as "makeStaffName",
+               t.make_time,
+               t.flg_valid,
+               t.cp_id
+        FROM dkic_b.t_mac_other_payable as t
+                 left join dkic_b.t_mst_supplier as supplier
+                           on supplier.sup_id = t.object_id and t.object_type in ('对象类型-供应商')
+                 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
+                 left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.object_type
+        WHERE payable_id = #{id}::uuid
     </select>
 
     <!-- 根据主键锁定表t_mac_other_payable的一行数据 -->

+ 2 - 3
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableItemMapper.xml

@@ -88,9 +88,8 @@
 
     <!-- 查询表t_mac_other_receivable_item,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
-        SELECT
-        count(1)
-        FROM dkic_b.t_mac_other_receivable_item
+        SELECT count(1)
+        FROM dkic_b.t_mac_other_receivable_item as t
         <include refid="Condition"/>
     </select>
 

+ 0 - 6
src/main/java/com/dk/mdm/mapper/mac/OtherReceivableMapper.xml

@@ -83,12 +83,6 @@
             <if test="makeStaff != null and makeStaff != ''">
                 AND t.make_staff = #{makeStaff}
             </if>
-            <if test="makeTime != null">
-                AND t.make_time = #{makeTime}
-            </if>
-            <if test="flgValid != null">
-                AND t.flg_valid = #{flgValid}
-            </if>
             <if test="cpId != null">
                 AND t.cp_id = #{cpId}
             </if>

+ 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
      */
     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">
-        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>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mac.RecPay">
         <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>
 
     <!-- Response查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mac.RecPayResponse">
         <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>
 
     <!-- 通用条件列 -->
     <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 id="idsForeach">
@@ -168,15 +171,14 @@
                t.rp_type,
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                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,
-               tmo.org_name                                      as "orgName",
+               tmo.org_name         as "orgName",
                t.staff_id,
-               tms.staff_name                                    as "staffName",
+               tms.staff_name       as "staffName",
                t.sum_amt_rec,
                t.sum_amt_pay,
                t.sum_amt_receivable_handle,
@@ -184,23 +186,23 @@
                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",
+               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_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 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">
@@ -210,16 +212,14 @@
 
     <!-- 查询表t_mac_rec_pay,(条件查询)个数 -->
     <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"/>
     </select>
 
@@ -230,15 +230,14 @@
                t.rp_type,
                sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "rpTypeName",
                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,
-               tmo.org_name           as "orgName",
+               tmo.org_name         as "orgName",
                t.staff_id,
-               tms.staff_name         as "staffName",
+               tms.staff_name       as "staffName",
                t.sum_amt_rec,
                t.sum_amt_pay,
                t.sum_amt_receivable_handle,
@@ -246,33 +245,24 @@
                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",
+               makestaff.staff_name as "makeStaffName",
                t.make_time,
                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
-                 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 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
-                 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>
 
     <!-- 根据主键锁定表t_mac_rec_pay的一行数据 -->
@@ -349,4 +339,62 @@
             )
         </foreach>
     </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>

+ 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="flg_can_login" property="flgCanLogin"/>
         <result column="hr_status" property="hrStatus"/>
+        <result column="default_wh_id" property="defaultWhId"/>
+        <result column="default_wh_name" property="defaultWhName"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -129,12 +131,27 @@
         SELECT
         <include refid="Base_Column_List"/>
         , 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,
+
         (SELECT  COALESCE(array_to_string(array_agg(role_name), ','),'')
         FROM dkic_b.t_mst_role
         WHERE role_id = ANY (t.role_ids)) AS role_names
         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_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
     </select>
 

+ 8 - 0
src/main/java/com/dk/mdm/mapper/mst/StaffPurviewMapper.java

@@ -13,6 +13,14 @@ import java.util.Map;
 */
 @Repository
 public interface StaffPurviewMapper extends BaseMapper<StaffPurview>{
+
+    /**
+     * @desc   : 查询范围权限
+     * @author : 常皓宁
+     * @date   : 2024/4/2 14:46
+     */
+    List<StaffPurview> selectByCond(StaffPurview staffPurview);
+
     /**
      * @desc   : 获取获取范围权限
      * @author : 姜永辉

+ 3 - 0
src/main/java/com/dk/mdm/mapper/mst/StaffPurviewMapper.xml

@@ -28,6 +28,9 @@
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="staffId != null and staffId != ''">
+                AND staff_id = #{staffId}::uuid
+            </if>
             <if test="purviewCode != null and purviewCode != ''">
                 AND purview_code = #{purviewCode}
             </if>

+ 7 - 2
src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.xml

@@ -314,6 +314,7 @@
         i.inv_id,
         i.inv_qty,
         i.usable_qty
+        ,tpp.pur_no as "purNo"
         FROM dkic_b.t_psi_purchase_item tppi
         left join(SELECT T.*
         FROM (select tpi.inv_id,
@@ -333,7 +334,7 @@
         left join dkic_b.t_mst_goods_sku tmgs on tppi.sku_id = tmgs.sku_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         left join sys.t_data_kind tdk1 on tdk1.kind_code = tppi.into_status
-
+        left join dkic_b.t_psi_purchase tpp  on tpp.pur_id = tppi.pur_id
 
 
         <include refid="Condition_1"/>
@@ -357,9 +358,13 @@
         ,tppi.from_id  as "fromId"
         ,tppi.from_item_id  as "fromItemId"
         ,tpo.order_no  as "orderNo"
+        ,tpp.pur_no as "purNo"
         FROM dkic_b.t_psi_purchase_item tppi
         left join dkic_b.t_psi_order tpo on tpo.order_id = tppi.from_id
-        WHERE tppi.item_id = #{itemId}::uuid
+        left join dkic_b.t_psi_purchase tpp  on tpp.pur_id = tppi.pur_id
+        left join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tppi.sku_id
+        left join  dkic_b.t_mst_goods_brand  tmgb on tmgb.brand_id = tmgs.brand_id
+
     </select>
 
     <!-- 根据主键锁定表dkic_b.t_psi_purchase_item的一行数据 -->

+ 8 - 0
src/main/java/com/dk/mdm/mapper/pur/PurchaseMapper.xml

@@ -441,6 +441,9 @@
             <if test="pickupDateEnd != null">
                 AND tpp.pickup_date &lt; #{pickupDateEnd}::timestamp with time zone + interval '1 day'
             </if>
+            <if test="searchText !=null and searchText!='' " >
+                AND   tpp.pur_no LIKE concat('%',my_ex.likequery(#{searchText}), '%')
+            </if>
         </where>
     </sql>
 
@@ -534,6 +537,8 @@
         ,tms1.staff_name as "makeStaffName"
         ,tmp.sup_name as "supplierName"
         ,tmw.wh_name as "whName"
+        ,tmw.wh_name as "whName"
+        ,tmw.wh_name as "whName"
         FROM dkic_b.t_psi_purchase tpp
         left join dkic_b.t_psi_purchase_item tppi  on tppi.pur_id = tpp.pur_id
         left join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tppi.sku_id
@@ -544,7 +549,10 @@
         Left join dkic_b.t_mst_staff tms on tpp.staff_id = tms.staff_id
         Left join dkic_b.t_mst_staff tms1 on tpp.make_staff = tms1.staff_id
         Left join dkic_b.t_mst_warehouse tmw on tpp.wh_id = tmw.wh_id
+
+
         <include refid="Condition_1"/>
+        ORDER BY  tpp.make_time
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>

+ 2 - 2
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -417,10 +417,10 @@
         update dkic_b.t_psi_order_item
         <set>
             <if test=" returnQty != null">
-                return_qty = return_qty + #{et.returnQty,jdbcType=NUMERIC},
+                return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
             </if>
             <if test=" returnAmt != null">
-                return_amt = return_amt + #{et.returnAmt,jdbcType=NUMERIC},
+                return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
             </if>
         </set>
         where item_id = #{itemId,typeHandler=UuidTypeHandler}

+ 2 - 2
src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml

@@ -922,10 +922,10 @@
         update dkic_b.t_psi_order
         <set>
             <if test=" returnQty != null">
-                return_qty = return_qty + #{et.returnQty,jdbcType=NUMERIC},
+                return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
             </if>
             <if test=" returnAmt != null">
-                return_amt = return_amt + #{et.returnAmt,jdbcType=NUMERIC},
+                return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
             </if>
         </set>
         where order_id = #{orderId,typeHandler=UuidTypeHandler}

+ 3 - 0
src/main/java/com/dk/mdm/mapper/wxapi/basic/WxCommonMapper.java

@@ -62,6 +62,9 @@ public interface WxCommonMapper extends BaseMapper<WxCommonResponse> {
     //获取用户/员工 2024年2月29日
     List<WxCommonResponse> getStaff(WxCommonQuery wxCommonQuery);
 
+    //获取员工的范围权限类型
+    List<WxCommonResponse> getPurviewType(WxCommonQuery wxCommonQuery);
+
     //获取销售渠道
     List<WxCommonResponse> getChannel(WxCommonQuery wxCommonQuery);
 

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

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

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

@@ -70,7 +70,7 @@ public class OtherPayableItem extends PageInfo<OtherPayableItem> implements Seri
      */
     @Excel(name = "支出数量")
     @ApiModelProperty(value = "支出数量")
-    private BigDecimal qtyOutlay;
+    private BigDecimal qtyPayable;
 
 
     /**
@@ -78,7 +78,7 @@ public class OtherPayableItem extends PageInfo<OtherPayableItem> implements Seri
      */
     @Excel(name = "支出金额")
     @ApiModelProperty(value = "支出金额")
-    private BigDecimal amtOutlay;
+    private BigDecimal amtPayable;
 
 
     /**

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

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

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

@@ -65,7 +65,7 @@ public class OtherPayableItemQuery extends PageInfo<OtherPayableItemQuery> imple
      */
     @Excel(name = "支出数量")
     @ApiModelProperty(value = "支出数量")
-    private BigDecimal qtyOutlay;
+    private BigDecimal qtyPayable;
 
 
     /**
@@ -73,7 +73,7 @@ public class OtherPayableItemQuery extends PageInfo<OtherPayableItemQuery> imple
      */
     @Excel(name = "支出金额")
     @ApiModelProperty(value = "支出金额")
-    private BigDecimal amtOutlay;
+    private BigDecimal amtPayable;
 
 
     /**

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

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.query.mac;
 
 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.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -23,6 +23,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  其他支出单
@@ -134,7 +135,7 @@ public class OtherPayableQuery extends PageInfo<OtherPayableQuery> implements Se
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
     /**
@@ -172,6 +173,25 @@ public class OtherPayableQuery extends PageInfo<OtherPayableQuery> implements Se
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
+    @ApiModelProperty(value = "部门List")
+    private List<String> orgIdList;
+
+    @ApiModelProperty(value = "业务员List")
+    private List<String> staffIdList;
+
+    @ApiModelProperty(value = "制单时间开始")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate makeTimeStart;
+
+    @ApiModelProperty(value = "制单时间结束")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate makeTimeEnd;
+
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private List<Boolean> flgValidList;
 
     private static final long serialVersionUID = 1L;
 }

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

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.query.mac;
 
 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.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -135,7 +135,7 @@ public class OtherReceivableQuery extends PageInfo<OtherReceivableQuery> impleme
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @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;
 
     /**
-     * 员工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 = "收款金额")
@@ -261,6 +246,9 @@ public class RecPayQuery extends PageInfo<RecPayQuery> implements Serializable {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private List<Boolean> flgValidList;
 
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 5 - 1
src/main/java/com/dk/mdm/model/query/pur/PurchaseQuery.java

@@ -52,7 +52,11 @@ public class PurchaseQuery extends PageInfo<PurchaseQuery> implements Serializab
     @TableField(typeHandler = UuidTypeHandler.class)
     private String purId;
 
-
+    /**
+     * 小程序的查询条件
+     */
+    @ApiModelProperty(value = "小程序的查询条件")
+    private String searchText;
     /**
      * 采购订单号
      */

+ 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 = "未核销金额")
     private BigDecimal amtNotHandle;
 
+    @ApiModelProperty(value = "供应商编码")
+    private String supCode;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
+    @ApiModelProperty(value = "本次核销金额")
+    private BigDecimal amtPayableHandle;
 
     private static final long serialVersionUID = 1L;
 

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

@@ -65,7 +65,7 @@ public class OtherPayableItemResponse extends PageInfo<OtherPayableItemResponse>
      */
     @Excel(name = "支出数量")
     @ApiModelProperty(value = "支出数量")
-    private BigDecimal qtyOutlay;
+    private BigDecimal qtyPayable;
 
 
     /**
@@ -73,7 +73,7 @@ public class OtherPayableItemResponse extends PageInfo<OtherPayableItemResponse>
      */
     @Excel(name = "支出金额")
     @ApiModelProperty(value = "支出金额")
-    private BigDecimal amtOutlay;
+    private BigDecimal amtPayable;
 
 
     /**
@@ -100,6 +100,8 @@ public class OtherPayableItemResponse extends PageInfo<OtherPayableItemResponse>
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
+    @ApiModelProperty(value = "支出类别")
+    private String payableTypeName;
 
     private static final long serialVersionUID = 1L;
 }

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

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.response.mac;
 
 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.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -134,7 +134,7 @@ public class OtherPayableResponse extends PageInfo<OtherPayableResponse> impleme
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @TableField(typeHandler = JsonTypeHandler.class)
-    private JSONObject annexPaths;
+    private JSONArray annexPaths;
 
 
     /**
@@ -172,6 +172,23 @@ public class OtherPayableResponse extends PageInfo<OtherPayableResponse> impleme
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
 
+    @ApiModelProperty(value = "对象类型")
+    private String objectTypeName;
 
+    @ApiModelProperty(value = "组织名称")
+    private String orgName;
+
+    @ApiModelProperty(value = "员工姓名")
+    private String staffName;
+
+    @ApiModelProperty(value = "供应商编码")
+    private String supCode;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
+    @ApiModelProperty(value = "制单员")
+    private String makeStaffName;
+    
     private static final long serialVersionUID = 1L;
 }

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

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.response.mac;
 
 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.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -134,7 +134,7 @@ public class OtherReceivableResponse extends PageInfo<OtherReceivableResponse> i
     @Excel(name = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @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 = "组织名称")
     private String orgName;
 
-    @ApiModelProperty(value = "供应商")
-    private String supplierName;
-
     @ApiModelProperty(value = "员工姓名")
     private String staffName;
 
@@ -272,6 +269,12 @@ public class RecPayResponse extends PageInfo<RecPayResponse> implements Serializ
     @ApiModelProperty(value = "总收款可退金额 (总收款金额-总应收收款金额+总应收优惠金额(现金池))")
     private BigDecimal receiptResidue;
 
+    @ApiModelProperty(value = "供应商编码")
+    private String supCode;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String supName;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 8 - 0
src/main/java/com/dk/mdm/model/response/pur/PurchaseItemResponse.java

@@ -109,6 +109,7 @@ public class PurchaseItemResponse extends PageInfo<PurchaseItemResponse> impleme
     private Integer itemIndex;
 
 
+
     /**
      * 商品ID
      */
@@ -372,6 +373,13 @@ public class PurchaseItemResponse extends PageInfo<PurchaseItemResponse> impleme
 
     private BigDecimal usableQty;
 
+    /**
+     * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
+     */
+    @Excel(name = "商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject skuImages;
 
 
 

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

@@ -65,7 +65,7 @@ public class OtherPayableItemVO extends PageInfo<OtherPayableItemVO> implements
      */
     @Excel(name = "支出数量")
     @ApiModelProperty(value = "支出数量")
-    private BigDecimal qtyOutlay;
+    private BigDecimal qtyPayable;
 
 
     /**
@@ -73,7 +73,7 @@ public class OtherPayableItemVO extends PageInfo<OtherPayableItemVO> implements
      */
     @Excel(name = "支出金额")
     @ApiModelProperty(value = "支出金额")
-    private BigDecimal amtOutlay;
+    private BigDecimal amtPayable;
 
 
     /**

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

@@ -1,7 +1,7 @@
 package com.dk.mdm.model.vo.mac;
 
 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.TableField;
 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(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @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;
 
 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.TableField;
 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(上传时间)...)")
     @ApiModelProperty(value = "附件 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
     @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 = "应收冲抵明细")
     private List<RecPayHandleItemVO> receivableList;
 
+    @ApiModelProperty(value = "应付冲抵明细")
+    private List<RecPayHandleItemVO> payableList;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 12 - 0
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -915,4 +915,16 @@ public class CommonService extends BaseService<Map<String, Object>> {
         return super.mergeListWithCount(param, commonMapper.getGoodsForPurchaseReturn(param),
                 commonMapper.getGoodsForPurchaseReturnByPage(param));
     }
+
+    /**
+     * @desc   : 获取员工的范围权限类型
+     * @author : 常皓宁
+     * @date   : 2024/4/2 10:06
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getPurviewType(Map<String, Object> param) {
+        // 获取供应商和客户
+        List<Map<String, Object>> list = commonMapper.getPurviewType(param);
+        return ResponseResultUtil.success(list);
+
+    }
 }

+ 1 - 1
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -270,7 +270,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
 
         //region  已出库  账款
         if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
-            accountService.accPayable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
+            accountService.accReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
         }
         //endregion
 

+ 86 - 13
src/main/java/com/dk/mdm/service/mac/AccountService.java

@@ -11,6 +11,7 @@ import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.mapper.ivt.InboundMapper;
 import com.dk.mdm.mapper.ivt.OutboundMapper;
 import com.dk.mdm.mapper.mac.AccountItemMapper;
+import com.dk.mdm.mapper.mac.OtherPayableMapper;
 import com.dk.mdm.mapper.mac.OtherReceivableMapper;
 import com.dk.mdm.mapper.mst.MoneyAccountItemMapper;
 import com.dk.mdm.model.pojo.ivt.Inbound;
@@ -20,6 +21,7 @@ import com.dk.mdm.mapper.mac.AccountMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.mac.AccountItem;
+import com.dk.mdm.model.pojo.mac.OtherPayable;
 import com.dk.mdm.model.pojo.mac.OtherReceivable;
 import com.dk.mdm.model.pojo.mst.MoneyAccount;
 import com.dk.mdm.model.query.mac.AccountItemQuery;
@@ -70,6 +72,9 @@ public class AccountService extends BaseService<Account> {
     @Autowired
     private OtherReceivableMapper otherReceivableMapper;
 
+    @Autowired
+    private OtherPayableMapper otherPayableMapper;
+
     /**
      * @desc : 查看来源单据,总单加明细
      * @author : 姜永辉
@@ -154,8 +159,8 @@ public class AccountService extends BaseService<Account> {
      */
     public void updateReceipt(String 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());
 
@@ -171,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 : 更新资金账户余额
      * @author : 付斌
      * @date : 2024-03-22 11:08
@@ -223,12 +251,12 @@ public class AccountService extends BaseService<Account> {
                     .setMakeStaff(outbound.getMakeStaff()).setCpId(outbound.getCpId());
             accountItemMapper.insert(accountItemInsert);
 
-            // 更新出库单上的账款明细Id
+            // 更新单上的账款明细Id
             LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Outbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Outbound::getOutId, UUID.fromString(invoiceId));
             outboundMapper.update(null, updateWrapper);
         }
-        // 其收入单
+        // 其收入单
         else if ("t_mac_other_receivable".equals(biznisType)) {
             OtherReceivable otherReceivable = otherReceivableMapper.selectByIdForUpdate(invoiceId);
             objectId = otherReceivable.getObjectId();
@@ -251,7 +279,7 @@ public class AccountService extends BaseService<Account> {
                     .setMakeStaff(otherReceivable.getMakeStaff()).setCpId(otherReceivable.getCpId());
             accountItemMapper.insert(accountItemInsert);
 
-            // 更新出库单上的账款明细Id
+            // 更新单上的账款明细Id
             LambdaUpdateWrapper<OtherReceivable> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(OtherReceivable::getAccItemId, UUID.fromString(accountItemInsert.getItemId())).eq(OtherReceivable::getReceivableId, UUID.fromString(invoiceId));
             otherReceivableMapper.update(null, updateWrapper);
@@ -292,12 +320,12 @@ public class AccountService extends BaseService<Account> {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISHANDLE.getMessage());
             }
 
-            // 将出库单上的账款明细Id更为null
+            // 将单上的账款明细Id更为null
             LambdaUpdateWrapper<Outbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Outbound::getReceivableId, null).eq(Outbound::getOutId, UUID.fromString(invoiceId));
             outboundMapper.update(null, updateWrapper);
         }
-        // 其收入单
+        // 其收入单
         else if ("t_mac_other_receivable".equals(biznisType)) {
             OtherReceivable otherReceivable = otherReceivableMapper.selectByIdForUpdate(invoiceId);
             objectId = otherReceivable.getObjectId();
@@ -313,7 +341,7 @@ public class AccountService extends BaseService<Account> {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISHANDLE.getMessage());
             }
 
-            // 更新出库单上的账款明细Id
+            // 更新单上的账款明细Id
             LambdaUpdateWrapper<OtherReceivable> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(OtherReceivable::getAccItemId, null).eq(OtherReceivable::getReceivableId, UUID.fromString(invoiceId));
             otherReceivableMapper.update(null, updateWrapper);
@@ -363,12 +391,38 @@ public class AccountService extends BaseService<Account> {
                     .setMakeStaff(inbound.getMakeStaff()).setCpId(inbound.getCpId());
             accountItemMapper.insert(accountItemInsert);
 
-            // 更新出库单上的账款明细Id
+            // 更新单上的账款明细Id
             LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Inbound::getReceivableId, UUID.fromString(accountItemInsert.getItemId())).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
             inboundMapper.update(null, updateWrapper);
-        } else if ("t_mac_outlay".equals(biznisType)) {
-            // 其它支出单 todo
+        }
+        // 其他支出单
+        else if ("t_mac_other_payable".equals(biznisType)) {
+            OtherPayable otherPayable = otherPayableMapper.selectByIdForUpdate(invoiceId);
+            objectId = otherPayable.getObjectId();
+
+            // 当前单据已经记账
+            if (otherPayable.getAccItemId() != null) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISACC.getMessage());
+            }
+            // 账务日期不能为空
+            if (otherPayable.getAccDate() == null) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ACC_DATE_ISNULL.getMessage());
+            }
+
+            // 插入账款明细
+            accountItemInsert.setAccItemType(Constant.accItemType.YING_SHOU.getName())
+                    .setObjectId(objectId).setOrgId(otherPayable.getOrgId()).setStaffId(otherPayable.getStaffId())
+                    .setAccDate(otherPayable.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName())
+                    .setAmtShould(otherPayable.getSumAmtPayable()).setAmtResidue(otherPayable.getSumAmtPayable())
+                    .setBiznisType(biznisType).setBiznisId(otherPayable.getPayableId()).setBiznisNo(otherPayable.getPayableNo())
+                    .setMakeStaff(otherPayable.getMakeStaff()).setCpId(otherPayable.getCpId());
+            accountItemMapper.insert(accountItemInsert);
+
+            // 更新源单上的账款明细Id
+            LambdaUpdateWrapper<OtherPayable> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.set(OtherPayable::getAccItemId, UUID.fromString(accountItemInsert.getItemId())).eq(OtherPayable::getPayableId, UUID.fromString(invoiceId));
+            otherPayableMapper.update(null, updateWrapper);
         }
 
         // 更新账款总表上的总应收账款和总剩余应收
@@ -410,8 +464,27 @@ public class AccountService extends BaseService<Account> {
             LambdaUpdateWrapper<Inbound> updateWrapper = new LambdaUpdateWrapper<>();
             updateWrapper.set(Inbound::getReceivableId, null).eq(Inbound::getIntoId, UUID.fromString(invoiceId));
             inboundMapper.update(null, updateWrapper);
-        } else if ("t_mac_outlay".equals(biznisType)) {
-            // 其它支出单 todo
+        } 
+        // 其他支出单
+        else if ("t_mac_other_payable".equals(biznisType)) {
+            OtherPayable otherPayable = otherPayableMapper.selectByIdForUpdate(invoiceId);
+            objectId = otherPayable.getObjectId();
+
+            // 当前单据已经记账
+            if (otherPayable.getAccItemId() == null) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISREVERSE.getMessage());
+            }
+
+            accountItemForUpdate = accountItemMapper.selectByIdForUpdate(otherPayable.getAccItemId());
+            // 如果核销金额不为0,说明当前单据已核销
+            if (accountItemForUpdate.getAmtHandle().compareTo(BigDecimal.ZERO) != 0) {
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISHANDLE.getMessage());
+            }
+
+            // 更新源单上的账款明细Id
+            LambdaUpdateWrapper<OtherPayable> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.set(OtherPayable::getAccItemId, null).eq(OtherPayable::getPayableId, UUID.fromString(invoiceId));
+            otherPayableMapper.update(null, updateWrapper);
         }
 
         // 删除账款明细

+ 6 - 6
src/main/java/com/dk/mdm/service/mac/OtherPayableService.java

@@ -104,9 +104,9 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 	public ResponseResultVO<?> insert(OtherPayableVO otherPayableVO) {
 
 		// 获取单号
-		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORDER.getName(), false);
+		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OTHERPAYABLE.getName(), false);
 		otherPayableVO.setPayableId(codeMap.get("outId").toString()).setPayableNo(codeMap.get("outNote").toString())
-				.setObjectType(Constant.ObjectType.CUS.getName());
+				.setObjectType(Constant.ObjectType.SUP.getName());
 		// 转化实体
 		OtherPayable otherPayable = otherPayableConvert.convertToPo(otherPayableVO);
 		// 总单保存
@@ -121,7 +121,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 			}
 		}
 
-		// 应记账
+		// 应记账
 		accountService.accPayable(otherPayable.getPayableId(),"t_mac_other_payable");
 		return ResponseResultUtil.success();
 	}
@@ -141,7 +141,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 		super.update(otherPayable, new UpdateWrapper<OtherPayable>().lambda().eq(OtherPayable::getPayableId,
 				UUID.fromString(otherPayable.getPayableId())));
 
-		// 应反记账
+		// 应反记账
 		accountService.reversePayable(otherPayableVO.getPayableId(),"t_mac_other_payable");
 
 		// 将之前的明细全部删除
@@ -159,7 +159,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 			}
 		}
 
-		// 应记账
+		// 应记账
 		accountService.accPayable(otherPayableVO.getPayableId(),"t_mac_other_payable");
 		return ResponseResultUtil.success();
 	}
@@ -193,7 +193,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 		}
 		// 如果所在月份已结账,则不能作废 todo
 
-		// 应反记账
+		// 应反记账
 		accountService.reversePayable(id,"t_mac_other_payable");
 
 		// 作废

+ 1 - 1
src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java

@@ -99,7 +99,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 	public ResponseResultVO<?> insert(OtherReceivableVO otherReceivableVO) {
 
 		// 获取单号
-		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORDER.getName(), false);
+		Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OTHERRECEIVABLE.getName(), false);
 		otherReceivableVO.setReceivableId(codeMap.get("outId").toString()).setReceivableNo(codeMap.get("outNote").toString())
 				.setObjectType(Constant.ObjectType.CUS.getName());
 		// 转化实体

+ 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
 @Transactional
-public class RecPayService extends BaseService<RecPay> {
+public class ReceiptService extends BaseService<RecPay> {
 
     @Override
     public String getPrimaryKey() {

+ 4 - 0
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -145,4 +145,8 @@ public class CustomerService extends BaseService<Customer> {
         return ResponseResultUtil.success(customerResponse);
     }
 
+    public ResponseResultVO<List<CustomerResponse>> selectByCondNoPage(CustomerQuery customerQuery) {
+        List<CustomerResponse> customerResponses = customerMapper.selectByCond(customerQuery);
+        return ResponseResultUtil.success(customerResponses);
+    }
 }

+ 9 - 0
src/main/java/com/dk/mdm/service/mst/StaffPurviewService.java

@@ -27,6 +27,15 @@ public class StaffPurviewService extends BaseService<StaffPurview> {
 	private StaffPurviewMapper staffPurviewMapper;
 
 	/**
+	 * @desc   : 查询范围权限
+	 * @author : 常皓宁
+	 * @date   : 2024/4/2 14:46
+	 */
+	public ResponseResultVO<List<StaffPurview>> getPurview(String staffId) {
+		return ResponseResultUtil.success(staffPurviewMapper.selectByCond(new StaffPurview().setStaffId(staffId)));
+	}
+
+	/**
 	 * @desc : 获取员工权限
 	 * @author : 姜永辉
 	 * @date : 2024/2/26 10:36

+ 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.ResponseResultVO;
 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.util.AuthUtils;
 import com.dk.mdm.mapper.common.CommonMapper;
@@ -41,7 +42,8 @@ import java.util.*;
 public class StaffService extends BaseService<Staff> {
     @Resource
     private CompanyFeign companyFeign;
-
+    @Resource
+    private UserFeign userFeign;
 
     @Override
     public BaseMapper<Staff> getRepository() {
@@ -117,6 +119,15 @@ public class StaffService extends BaseService<Staff> {
         staff.setStaffId(codeMap.get("outId").toString());
         staff.setStaffCode(codeMap.get("outNote").toString());
         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);
     }
 

+ 13 - 1
src/main/java/com/dk/mdm/service/pur/PurchaseService.java

@@ -95,7 +95,19 @@ public class PurchaseService extends BaseService<Purchase> {
      */
     @Pagination
     public ResponseResultVO<PageList<PurchaseResponse>> selectByCondItem(PurchaseQuery purchaseQuery) {
-        return super.mergeListWithCount(purchaseQuery, purchaseMapper.selectByCondItem(purchaseQuery), purchaseMapper.countByCond(purchaseQuery));
+         List<PurchaseResponse> purchaseOrders = purchaseMapper.selectByCond(purchaseQuery); // 总单数据
+        for (PurchaseResponse order : purchaseOrders) {
+            PurchaseItemQuery purchaseItemQuery = new PurchaseItemQuery ();
+            purchaseItemQuery.setPageSize(1000);
+            purchaseItemQuery.setCurrentPage(1);
+            purchaseItemQuery.setPurId(order.getPurId());
+            purchaseItemQuery.setCpId(order.getCpId());
+            List<PurchaseItemResponse> items =  purchaseItemMapper.selectByCond(purchaseItemQuery);// 明细数据
+
+            order.setPurchaseItemResponseList(items);
+        }
+
+        return super.mergeListWithCount(purchaseQuery, purchaseOrders, purchaseMapper.countByCond(purchaseQuery));
     }
     /**
      * @desc : 采购订单 待入库查询

+ 1 - 1
src/main/java/com/dk/mdm/service/wxapi/basic/WxCommonService.java

@@ -114,7 +114,7 @@ public class WxCommonService extends BaseService<WxCommonResponse> {
         }
         //范围权限类型
         else if (dataSourceCode.equals("purviewType")) {
-           // list = wxCommonMapper.getPurviewType(wxCommonQuery);
+            list = wxCommonMapper.getPurviewType(wxCommonQuery);
         }
         //渠道
         else if (dataSourceCode.equals("salesChannel")) {