Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

dongke 1 год назад
Родитель
Сommit
5a8b4c6ed2
41 измененных файлов с 551 добавлено и 129 удалено
  1. 26 2
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml
  2. 16 1
      src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml
  3. 5 0
      src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml
  4. 10 9
      src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml
  5. 59 26
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml
  6. 6 4
      src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml
  7. 3 2
      src/main/java/com/dk/mdm/mapper/mst/OrgMapper.xml
  8. 3 26
      src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml
  9. 5 0
      src/main/java/com/dk/mdm/mapper/sale/MultiOwnerMapper.java
  10. 32 0
      src/main/java/com/dk/mdm/mapper/sale/MultiOwnerMapper.xml
  11. 2 0
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  12. 1 1
      src/main/java/com/dk/mdm/model/pojo/mst/CusFollow.java
  13. 7 0
      src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java
  14. 1 1
      src/main/java/com/dk/mdm/model/query/mst/CusFollowQuery.java
  15. 8 0
      src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java
  16. 112 0
      src/main/java/com/dk/mdm/model/query/sale/MultiOwnerQuery.java
  17. 2 0
      src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java
  18. 8 0
      src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java
  19. 1 1
      src/main/java/com/dk/mdm/model/response/mst/CusFollowResponse.java
  20. 16 1
      src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java
  21. 6 0
      src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java
  22. 113 0
      src/main/java/com/dk/mdm/model/response/sale/MultiOwnerResponse.java
  23. 7 0
      src/main/java/com/dk/mdm/model/response/sale/OrderItemResponse.java
  24. 2 0
      src/main/java/com/dk/mdm/model/vo/mst/CusFollowVO.java
  25. 6 0
      src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java
  26. 4 2
      src/main/java/com/dk/mdm/service/ivt/inbound/InboundOtherService.java
  27. 4 2
      src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseReturnService.java
  28. 4 2
      src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java
  29. 4 2
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundOtherService.java
  30. 7 5
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  31. 4 2
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java
  32. 3 3
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  33. 1 1
      src/main/java/com/dk/mdm/service/mac/MacTransferService.java
  34. 4 4
      src/main/java/com/dk/mdm/service/mac/OtherPayableService.java
  35. 4 4
      src/main/java/com/dk/mdm/service/mac/OtherReceivableService.java
  36. 13 5
      src/main/java/com/dk/mdm/service/mac/PaymentService.java
  37. 12 11
      src/main/java/com/dk/mdm/service/mac/ReceiptService.java
  38. 8 8
      src/main/java/com/dk/mdm/service/mst/CusFollowService.java
  39. 1 4
      src/main/java/com/dk/mdm/service/mst/OrgService.java
  40. 2 0
      src/main/java/com/dk/mdm/service/mst/StaffService.java
  41. 19 0
      src/main/java/com/dk/mdm/service/sale/OrderService.java

+ 26 - 2
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -182,7 +182,17 @@
         <if test="orgName != null">
             AND org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
         </if>
-        order by display_no
+        <if test="ids != null and ids.size() > 0 ">
+            order by case org_id
+            <foreach collection="ids" index="index" item="item">
+                when #{item}::uuid then #{item}::uuid
+            </foreach>
+            end
+        </if>
+        <if test="ids == null">
+            order by display_no
+        </if>
+
     </select>
     <!-- 只获取二级部门 按照level_code 排序 -->
     <select id="getProcureOrg" resultType="java.util.Map">
@@ -268,7 +278,17 @@
         <if test="staffName != null and staffName != ''">
             And position (#{staffName} in staff.staff_name)>0
         </if>
-        order by staff.staff_code
+
+        <if test="ids != null and ids.size() > 0 ">
+            order by case staff.staff_id
+            <foreach collection="ids" index="index" item="item">
+                when #{item}::uuid then #{item}::uuid
+            </foreach>
+            end
+        </if>
+        <if test="ids == null ">
+            order by staff.staff_code
+        </if>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
         </if>
@@ -927,6 +947,9 @@
             <if test="cpId != null">
                 AND t.cp_id = #{cpId}
             </if>
+            <if test="flgValid != null">
+                AND t.flg_valid = #{flgValid}
+            </if>
             <!-- 部门上有仓库,只能选部门上的仓库;部门上没有仓库,可选所有仓库 -->
             <if test="orgId != null">
                 and (select count(1)
@@ -995,6 +1018,7 @@
                tpi.non_std_code       as "nonStdCode",
                tpi.inv_qty            as "invQty",
                tpi.outing_qty         as "outingQty",
+               tpi.freeze_qty         as "freezeQty",
                tpi.usable_qty         as "usableQty",
                tpi.wh_id              as "whId",
                tmw.wh_code            as "whCode",

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

@@ -68,6 +68,7 @@
         <result column="out_id" property="outId" typeHandler="UuidTypeHandler"/>
         <result column="out_type" property="outType"/>
         <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
+        <result column="fromNo" property="fromNo" />
         <result column="from_item_id" property="fromItemId" typeHandler="UuidTypeHandler"/>
         <result column="item_index" property="itemIndex"/>
         <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
@@ -90,6 +91,16 @@
         <result column="s_out_item_id" property="sOutItemId" typeHandler="UuidTypeHandler"/>
         <result column="s_order_id" property="sOrderId" typeHandler="UuidTypeHandler"/>
         <result column="s_order_item_id" property="sOrderItemId" typeHandler="UuidTypeHandler"/>
+        <result column="skuCode" property="skuCode"/>
+        <result column="skuModel" property="skuModel"/>
+        <result column="skuName" property="skuName"/>
+        <result column="brandName" property="brandName"/>
+        <result column="orderQty" property="orderQty"/>
+        <result column="canOutingQty" property="canOutingQty"/>
+        <result column="whId" property="whId"/>
+        <result column="invQty" property="invQty"/>
+        <result column="usableQty" property="usableQty"/>
+        <result column="whName" property="whName"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -327,6 +338,7 @@
                t.out_id,
                t.from_item_id,
                t.from_id,
+               tpo.order_no AS  "fromNo",
                t.item_index,
                t.sku_id,
                tmgs.sku_code                                                             as "skuCode",
@@ -334,6 +346,7 @@
                tmgs.sku_name                                                             as "skuName",
                tpoi.item_qty                                                             as "orderQty",
                tpoi.item_qty - tpoi.outing_qty - tpoi.out_qty + t.outing_qty + t.out_qty as "canOutingQty",
+               tmgb.brand_name AS "brandName",
                t.price_out,
                t.outing_qty + t.out_qty                                                  as outing_qty,
                t.outing_amt + t.out_amt                                                  as outing_amt,
@@ -348,9 +361,11 @@
                tmw.wh_name                                                               as "whName"
         FROM dkic_b.t_psi_outbound_item as t
                  left join dkic_b.t_psi_order_item as tpoi on tpoi.item_id = t.from_item_id
-                 left join dkic_b.t_mst_goods_sku tmgs on tpoi.sku_id = tmgs.sku_id
+                 left join dkic_b.t_psi_order as tpo on tpo.order_id = t.from_id
+                 left join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
                  left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = t.inv_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
+                 left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         where t.flg_valid
           and t.out_id = #{id}::uuid
         order by t.item_index

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

@@ -101,6 +101,9 @@
         <result column="cus_from_name" property="cusFromName"/>
         <result column="out_reason" property="outReason" typeHandler="UuidTypeHandler"/>
         <result column="out_reason_name" property="outReasonName" />
+        <result column="sumOutAmt" property="sumOutAmt" />
+        <result column="sumOutQty" property="sumOutQty" />
+
     </resultMap>
 
     <resultMap id="BaseResultMapDetailResponse" type="com.dk.mdm.model.response.ivt.OutboundResponse">
@@ -346,6 +349,8 @@
                sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS  "outTypeName",
                t.outing_qty,
                t.outing_amt,
+               (t.outing_amt + t.out_amt) AS "sumOutAmt",
+               (t.outing_qty + t.out_qty) AS "sumOutQty",
                t.out_qty,
                t.out_amt,
                t.return_qty,

+ 10 - 9
src/main/java/com/dk/mdm/mapper/mac/RecPayMapper.xml

@@ -179,15 +179,15 @@
             AND t.op_create_time &gt;= #{createtimeStart}::timestamp with time zone
             AND t.op_create_time &lt; #{createtimeEnd}::timestamp with time zone + interval '1 day'
         </if>
-        <if  test="searchText != null">
-            AND ( t.rp_no  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.cus_code  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR  tmc.cus_name  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.cus_phone  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR   tmc.address_full  like concat('%', my_ex.likequery(#{searchText}) , '%')
-            OR  t.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
-            )
-        </if>
+<!--        <if  test="searchText != null">-->
+<!--            AND ( t.rp_no  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.cus_code  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR  tmc.cus_name  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.cus_phone  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR   tmc.address_full  like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            OR  t.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')-->
+<!--            )-->
+<!--        </if>-->
         <if test="staffName != null and staffName != ''">
             AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
         </if>
@@ -252,6 +252,7 @@
 
         where t.rp_type in ('收付款类型-收款', '收付款类型-退收款')
         <include refid="Condition"/>
+
         <if test="searchText !=null and searchText != ''">
             AND (
             t.rp_no   LIKE concat('%',my_ex.likequery(#{searchText}),'%')

+ 59 - 26
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -102,7 +102,10 @@
 
         <result column="outboundQuantity" property="outboundQuantity"/>
         <result column="outboundAmount" property="outboundAmount"/>
-
+        <result column="outboundNotAmount" property="outboundNotAmount"/>
+        <result column="outboundNotQuantity" property="outboundNotQuantity"/>
+        <result column="outboundReturnQuantity" property="outboundReturnQuantity"/>
+        <result column="outboundReturnAmount" property="outboundReturnAmount"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -112,10 +115,10 @@
                 AND tmc.cus_code = #{cusCode}
             </if>
             <if test="cusName != null and cusName != ''">
-                AND tmc.cus_name = #{cusName}
+                AND tmc.cus_name like concat('%', my_ex.likequery(#{cusName}) , '%')
             </if>
             <if test="cusPhone != null and cusPhone != ''">
-                AND tmc.cus_phone = #{cusPhone}
+                AND tmc.cus_phone like concat('%', my_ex.likequery(#{cusPhone}) , '%')
             </if>
             <if test="addressArea != null and addressArea != ''">
                 AND tmc.address_area = #{addressArea}
@@ -133,10 +136,10 @@
                 AND tmc.address_full = #{addressFull}
             </if>
             <if test="contactName != null and contactName != ''">
-                AND tmc.contact_name = #{contactName}
+                AND tmc.contact_name like concat('%', my_ex.likequery(#{contactName}) , '%')
             </if>
             <if test="contactPhone != null and contactPhone != ''">
-                AND tmc.contact_phone = #{contactPhone}
+                AND tmc.contact_phone like concat('%', my_ex.likequery(#{contactPhone}) , '%')
             </if>
             <if test="cusFrom != null and cusFrom != ''">
                 AND tmc.cus_from = #{cusFrom}::uuid
@@ -257,31 +260,61 @@
     <select id="selectByIdRespone" resultMap="BaseResultMapResponse">
         SELECT
         <include refid="Base_Column_List_Response"/>,
-        tmd.data_value  AS  "cusFromName",
-        tmsc.channel_name  AS  "channelName",
-        tmo.org_name  AS  "orgName",
-        tms.staff_name  AS  "staffName",
-        tms2.staff_name  AS  "reportStaffName",
-        tdk.kind_name_i18n  ->>  #{i18n} AS "saleStatusName",
---         tccfs.follow_staff  as follow_staff,
---         tms1.staff_name  as follow_staff_name
-        (SELECT COUNT(1) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderQuantity",
-        (SELECT sum(tpo.sum_amount) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderAmount",
+        tmd.data_value AS "cusFromName",
+        tmsc.channel_name AS "channelName",
+        tmo.org_name AS "orgName",
+        tms.staff_name AS "staffName",
+        tms2.staff_name AS "reportStaffName",
+        tdk.kind_name_i18n ->> #{i18n} AS "saleStatusName",
+        -- tccfs.follow_staff as follow_staff,
+        -- tms1.staff_name as follow_staff_name
+        (SELECT COUNT(1) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id = tmc.cp_id AND
+        tpo.flg_valid) AS "orderQuantity",
+        (SELECT sum(tpo.sum_amount) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id = tmc.cp_id
+        AND tpo.flg_valid) AS "orderAmount",
 
 
-        (SELECT COUNT(1) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundQuantity",
-        (SELECT sum(tpob.out_amt) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundAmount"
-        FROM dkic_b.t_mst_customer tmc
-        LEFT JOIN  dkic_b.t_mst_dictionary_data tmd  on tmd.data_id =  tmc.cus_from
-        LEFT JOIN  dkic_b.t_mst_sale_channel tmsc  on tmsc.channel_id =  tmc.channel_id
-        LEFT JOIN  dkic_b.t_mst_org tmo  on tmo.org_id =  tmc.org_id
-        LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
-        LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
-        LEFT JOIN  sys.t_data_kind tdk  on tdk.kind_code =  tmc.sale_status
+        (SELECT COUNT(1) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id = tmc.cp_id AND
+        tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS
+        "outboundQuantity",
+        (SELECT sum(tpob.out_amt) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS
+        "outboundAmount",
 
 
---         LEFT JOIN  dkic_b.t_crm_cus_follow_staff  tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
---         LEFT JOIN  dkic_b.t_mst_staff tms1  on tms1.staff_id =  tccfs.follow_staff
+        (SELECT COUNT(1) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id =
+        tmc.cp_id AND tpo.flg_valid AND tpo.out_status = '出库状态-待出库' AND tpo.order_status = '订单状态-成交') AS
+        "outboundNotQuantity",
+
+        (SELECT sum(tpo.sum_amount) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id =
+        tmc.cp_id AND tpo.flg_valid AND tpo.out_status = '出库状态-待出库' AND tpo.order_status = '订单状态-成交') AS
+        "outboundNotAmount",
+
+
+        (SELECT  COUNT(1) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销退回库') AS
+        "outboundReturnQuantity",
+
+        (SELECT sum(tpob.out_amt) FROM dkic_b.t_psi_outbound tpob WHERE tpob.cus_id = tmc.cus_id AND tpob.cp_id =
+        tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销退回库') AS
+        "outboundReturnAmount",
+
+        tma.receivable_residue,
+        tma.receipt_residue
+
+
+
+        FROM dkic_b.t_mst_customer tmc
+        LEFT JOIN dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tmc.cus_from
+        LEFT JOIN dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
+        LEFT JOIN dkic_b.t_mst_org tmo on tmo.org_id = tmc.org_id
+        LEFT JOIN dkic_b.t_mst_staff tms on tms.staff_id = tmc.staff_id
+        LEFT JOIN dkic_b.t_mst_staff tms2 on tms2.staff_id = tmc.report_staff
+        LEFT JOIN sys.t_data_kind tdk on tdk.kind_code = tmc.sale_status
+        LEFT JOIN  dkic_b.t_mac_account tma  on tma.object_id =  tmc.cus_id
+
+        -- LEFT JOIN dkic_b.t_crm_cus_follow_staff tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
+        -- LEFT JOIN dkic_b.t_mst_staff tms1 on tms1.staff_id = tccfs.follow_staff
         WHERE tmc.cus_id = #{id}::uuid
     </select>
 

+ 6 - 4
src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml

@@ -6,7 +6,7 @@
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
         sku_id, sku_code, sku_name, sku_model, brand_id, category_id, unit_id, sub_unit_id, conversion_factor
-        , series_id, sku_spec, price_purchase, price_standard, price_wholesale, price_limited, sku_images
+        , series_id, sku_spec, price_purchase, price_standard, price_wholesale, price_limited, price_other,sku_images
         , remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id
         , op_app_code, op_timestamp, op_db_user
     </sql>
@@ -28,6 +28,7 @@
                 <result column="price_standard" property="priceStandard"/>
                 <result column="price_wholesale" property="priceWholesale"/>
                 <result column="price_limited" property="priceLimited"/>
+                <result column="price_other" property="priceOther"/>
                 <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
                 <result column="remarks" property="remarks"/>
                 <result column="flg_valid" property="flgValid"/>
@@ -44,7 +45,7 @@
     <sql id="Base_Column_List_JOIN">
         tmgs.price_other,tmgs.sku_id, tmgs.sku_code, tmgs.sku_name, tmgs.sku_model, tmgs.brand_id, tmgs.category_id, tmgs.unit_id, tmgs.sub_unit_id,
               tmgs.conversion_factor, tmgs.series_id, tmgs.sku_spec, tmgs.price_purchase, tmgs.price_standard,
-              tmgs.price_wholesale, tmgs.price_limited, tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.cp_id
+              tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.cp_id
     </sql>
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.GoodsSkuResponse">
         <id column="sku_id" property="skuId"/>
@@ -61,6 +62,7 @@
         <result column="price_purchase" property="pricePurchase"/>
         <result column="price_standard" property="priceStandard"/>
         <result column="price_wholesale" property="priceWholesale"/>
+        <result column="price_other" property="priceOther"/>
         <result column="price_limited" property="priceLimited"/>
         <result column="price_other" property="priceOther"/>
 
@@ -159,11 +161,11 @@
         SELECT
         <include refid="Base_Column_List_JOIN"/>
         ,tmgb.short_name AS "shortName"
-        ,tmgb.brand_name AS "brandName",tmgsr.series_name AS "seriesName",tpi.usable_qty AS "usableQty"
+        ,tmgb.brand_name AS "brandName",tmgsr.series_name AS "seriesName"
+        ,COALESCE((SELECT sum(tpi.usable_qty)  from dkic_b.t_psi_inventory tpi where tpi.sku_id = tmgs.sku_id and tpi.cp_id =  #{cpId} ),0) AS "usableQty"
         FROM dkic_b.t_mst_goods_sku  tmgs
         LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
         LEFT JOIN dkic_b.t_mst_goods_series tmgsr ON tmgsr.series_id = tmgs.series_id
-        LEFT JOIN dkic_b.t_psi_inventory tpi ON tpi.sku_id = tmgs.sku_id
         <include refid="Condition"/>
         order by  tmgs.op_create_time desc
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">

+ 3 - 2
src/main/java/com/dk/mdm/mapper/mst/OrgMapper.xml

@@ -275,16 +275,17 @@
         SELECT
         <include refid="Base_Column_List_view"/>
         ,tmg.org_name as parent_name
+        ,parent.org_code 
         FROM dkic_b.t_mst_org AS parent
         left join dkic_b.t_mst_org tmg on tmg.org_id=parent.parent_id
-        WHERE parent.org_id = #{orgId}::uuid
+        WHERE parent.org_id = #{id}::uuid
     </select>
 
     <!-- 根据主键锁定表t_mst_org的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
-        FROM t_mst_org
+        FROM dkic_b.t_mst_org
         WHERE org_id = #{orgId}
         for update
     </select>

+ 3 - 26
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -62,7 +62,6 @@
             AND tpi.wh_id = #{whId} ::uuid
         </if>
     </select>
-
     <!-- 采购明细报表明细条件列 -->
     <sql id="Condition_PurDetailReport">
         <where>
@@ -125,7 +124,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 采购明细报表主表条件列 -->
     <sql id="Condition_PurReport">
         <where>
@@ -169,7 +167,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 销售明细报表明细条件列 -->
     <sql id="Condition_OrdDetailReport">
         <where>
@@ -242,7 +239,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 销售明细报表主表条件列 -->
     <sql id="Condition_OrdReport">
         <where>
@@ -292,7 +288,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 出库明细报表明细条件列 -->
     <sql id="Condition_OutboundDetailReport">
         <where>
@@ -358,7 +353,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 出库明细报表主表条件列 -->
     <sql id="Condition_OutboundReport">
         <where>
@@ -402,7 +396,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 入库明细报表明细条件列 -->
     <sql id="Condition_IntoboundDetailReport">
         <where>
@@ -469,7 +462,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 入库明细报表主表条件列 -->
     <sql id="Condition_IntoboundReport">
         <where>
@@ -513,7 +505,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 客户收款明细表条件列 -->
     <sql id="Condition_RecPayDetailReport">
         <where>
@@ -549,7 +540,6 @@
             </if>
         </where>
     </sql>
-
     <!-- 采购明细报表主表 -->
     <select id="getPurReport" resultType="java.util.Map">
         select
@@ -571,6 +561,7 @@
         ,tpp.return_amt as "returnInAmtSum"
         ,tpp.amt_payable as "amtPayable"
         ,tpp.amt_residue as "amtResidue"
+        ,tpp.make_time as "makeTime"
         ,tpp.remarks
         FROM  dkic_b.t_psi_purchase tpp
         Left join dkic_b.t_mst_org tmo on tpp.org_id = tmo.org_id
@@ -586,7 +577,6 @@
             limit #{end} offset #{start}
         </if>
     </select>
-
     <!-- 采购明细报表主表Count-->
     <select id="getPurReportCount" resultType="java.lang.Long">
         SELECT count(1)
@@ -600,7 +590,6 @@
         left join sys.t_data_kind tdk1 on tdk1.kind_code = tpp.pur_type
         <include refid="Condition_PurReport"/>
     </select>
-
     <!-- 采购明细报表明细 -->
     <select id="getPurDetailReport" resultType="java.util.Map">
         select
@@ -686,7 +675,6 @@
         left join sys.t_data_kind tdk3 on tdk3.kind_code = tppi.into_status
         <include refid="Condition_PurDetailReport"/>
     </select>
-
     <!-- 销售明细报表主表 -->
     <select id="getOrderReport" resultType="java.util.Map">
         SELECT
@@ -742,7 +730,6 @@
         left join sys.t_data_kind as tdk2 on t.order_status = tdk2.kind_code
         <include refid="Condition_OrdReport"/>
     </select>
-
     <!-- 销售明细报表明细 -->
     <select id="getOrderDetailReport" resultType="java.util.Map">
         select
@@ -832,7 +819,6 @@
         left join dkic_b.t_psi_outbound as tpo on tpo.from_id=t.order_id
         <include refid="Condition_OrdDetailReport"/>
     </select>
-
     <!-- 出库明细报表主表 -->
     <select id="getOutboundReport" resultType="java.util.Map">
         SELECT
@@ -856,6 +842,7 @@
         t.return_qty as "returnOutQtySum",
         t.return_amt as "returnOutAmtSum",
         t.out_date as "outDate",
+        t.make_time as "makeTime",
         t.remarks,
         makestaff.staff_name as "makeStaffName"
         FROM dkic_b.t_psi_outbound as t
@@ -887,7 +874,6 @@
         LEFT JOIN sys.t_data_kind tdktype   ON tdktype.kind_code = t.out_type
         <include refid="Condition_OutboundReport"/>
     </select>
-
     <!-- 出库明细报表明细 -->
     <select id="getOutboundDetailReport" resultType="java.util.Map">
         select
@@ -969,7 +955,6 @@
         left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = tpi.wh_id
         <include refid="Condition_OutboundDetailReport"/>
     </select>
-
     <!-- 入库明细报表主表 -->
     <select id="getInboundlReport" resultType="java.util.Map">
         SELECT
@@ -994,6 +979,7 @@
         t.return_amt as "returnintoAmtSum",
         t.into_date as "intoDate",
         tmw.wh_name as "whName",
+        t.make_time as "makeTime",
         t.remarks,
         makestaff.staff_name as "makeStaffName"
         FROM dkic_b.t_psi_inbound as t
@@ -1027,7 +1013,6 @@
         left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
         <include refid="Condition_IntoboundReport"/>
     </select>
-
     <!-- 入库明细报表明细 -->
     <select id="getInboundDetailReport" resultType="java.util.Map">
         select
@@ -1106,7 +1091,6 @@
         left join dkic_b.t_psi_inventory as tpi on tpi.inv_id = tpoi.inv_id
         <include refid="Condition_IntoboundDetailReport"/>
     </select>
-
     <!-- 客户收款明细报表主表 -->
     <select id="getRecPayDetailReport" resultType="java.util.Map">
         SELECT
@@ -1149,7 +1133,6 @@
         left join dkic_b.t_mst_money_account tmma on tmma.mac_id = tmrpi.mac_id
         <include refid="Condition_RecPayDetailReport"/>
     </select>
-
     <sql id="ConditionPurTrackingReport">
         <where>
             <if test="cpId != null">
@@ -1157,7 +1140,6 @@
             </if>
         </where>
     </sql>
-
     <!--  销售跟踪表 列表查询 -->
     <select id="getSalesTrackingReport" resultType="java.util.Map">
         SELECT
@@ -1221,7 +1203,6 @@
             limit #{end} offset #{start}
         </if>
     </select>
-
     <sql id="ConditionSalesTrackingReport">
         <where>
             <if test="orderNo != null">
@@ -1248,8 +1229,6 @@
             </if>
         </where>
     </sql>
-
-
     <!--  销售明细查询 -->
     <select id="getSalesItemReport" resultType="java.util.Map">
         SELECT
@@ -1299,7 +1278,6 @@
         </if>
 
     </select>
-
     <sql id="ConditionSaleItem">
         <where>
             <if test="orderId != null and orderId != ''">
@@ -1618,7 +1596,6 @@
         </if>
     </select>
 
-
     <select id="getPurTrackingReportCount" resultType="java.lang.Long">
         SELECT count(1)
         FROM

+ 5 - 0
src/main/java/com/dk/mdm/mapper/sale/MultiOwnerMapper.java

@@ -2,9 +2,13 @@ package com.dk.mdm.mapper.sale;
 
 import com.dk.mdm.model.pojo.sale.MultiOwner;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.sale.MultiOwnerQuery;
+import com.dk.mdm.model.response.sale.MultiOwnerResponse;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  多业务归属 Mapper
 */
@@ -18,5 +22,6 @@ public interface MultiOwnerMapper extends BaseMapper<MultiOwner>{
      * @date : 2024-03-03 14:17
      */
     int deleteByOrderId(@Param("orderId") String orderId);
+    List<MultiOwnerResponse> selectByType(MultiOwnerQuery multiOwnerQuery);
 }
 

+ 32 - 0
src/main/java/com/dk/mdm/mapper/sale/MultiOwnerMapper.xml

@@ -18,7 +18,20 @@
             <result column="flg_valid" property="flgValid"/>
             <result column="cp_id" property="cpId"/>
     </resultMap>
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.sale.MultiOwnerResponse">
+        <id column="multi_id" property="multiId"/>
+        <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
+        <result column="owner_type" property="ownerType"/>
+        <result column="owner_id" property="ownerId" typeHandler="UuidTypeHandler"/>
+        <result column="allocation_ratio" property="allocationRatio"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="staff_id" property="staffId"/>
+        <result column="staff_name" property="staffName"/>
+        <result column="org_id" property="orgId"/>
+        <result column="org_name" property="orgName"/>
 
+    </resultMap>
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
@@ -126,4 +139,23 @@
     <delete id="deleteByOrderId">
         DELETE FROM dkic_b.t_psi_multi_owner WHERE order_id = #{orderId}::uuid
     </delete>
+
+    <!-- 查询表t_psi_multi_owner,(条件查询+分页)列表 -->
+    <select id="selectByType" resultMap="BaseResultMapResponse">
+        SELECT tpmo.multi_id,
+               tpmo.order_id,
+               tpmo.owner_type,
+               tpmo.owner_id,
+               tpmo.allocation_ratio,
+               tpmo.flg_valid,
+               tpmo.cp_id,
+               tms.staff_id,
+               tms.staff_name,
+               tmo.org_id,
+               tmo.org_name
+        FROM dkic_b.t_psi_multi_owner tpmo
+        left join dkic_b.t_mst_staff tms on tms.staff_id = tpmo.owner_id
+        left join dkic_b.t_mst_org tmo  on tmo.org_id = tpmo.owner_id
+        where tpmo.order_id = #{orderId}::uuid AND tpmo.owner_type = ANY ( #{ownerTypes, typeHandler=StringListTypeHandler} )
+    </select>
 </mapper>

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

@@ -67,6 +67,7 @@
                 <result column="wh_name" property="whName"/>
                 <result column="order_no" property="orderNo"/>
                 <result column="transferableQuantity" property="transferableQuantity"/>
+                <result column="skuImages" property="skuImages" typeHandler="JsonTypeHandler"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -291,6 +292,7 @@
                tmgs.sku_code                              as "skuCode",
                tmgs.sku_model                             as "skuModel",
                tmgs.sku_name                              as "skuName",
+               tmgs.sku_images AS "skuImages",
                t.item_qty                                 as "orderQty",
                t.item_qty - t.outing_qty - t.out_qty      as "canOutingQty",
                t.item_qty - t.outing_qty - t.out_qty      as outing_qty,

+ 1 - 1
src/main/java/com/dk/mdm/model/pojo/mst/CusFollow.java

@@ -82,7 +82,7 @@ public class CusFollow   implements Serializable {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String followStaff;
 
-
+    private String followType;
     /**
      * 跟进时间
      */

+ 7 - 0
src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java

@@ -169,6 +169,13 @@ public class GoodsSku extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
+
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 1 - 1
src/main/java/com/dk/mdm/model/query/mst/CusFollowQuery.java

@@ -49,7 +49,7 @@ public class CusFollowQuery extends PageInfo<CusFollowQuery> implements Serializ
     @TableField(typeHandler = UuidTypeHandler.class)
     private String followId;
 
-
+    private String followType;
     /**
      * 客户ID (陌生接待时为null)
      */

+ 8 - 0
src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java

@@ -173,6 +173,13 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
+
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)
@@ -278,6 +285,7 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
     @ApiModelProperty(value = "品牌")
     private String brandIds;
 
+
     /**
      * @desc   : 有效标识List
      * @author : 宋扬

+ 112 - 0
src/main/java/com/dk/mdm/model/query/sale/MultiOwnerQuery.java

@@ -0,0 +1,112 @@
+package com.dk.mdm.model.query.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ *  多业务归属
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("多业务归属")
+@TableName(value = "t_psi_multi_owner", schema =  "dkic_b", autoResultMap = true)
+@ApiModel(value="实体类:多业务归属", description="表名:t_psi_multi_owner")
+public class MultiOwnerQuery extends PageInfo<MultiOwnerQuery> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 多业务ID
+     */
+//    @TableId(value = "multi_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "多业务ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String multiId;
+
+
+    /**
+     * 订单Id
+     */
+    @Excel(name = "订单Id")
+    @ApiModelProperty(value = "订单Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orderId;
+
+
+    /**
+     * 归属类型 (【系统字典】)
+     */
+    @Excel(name = "归属类型 (【系统字典】)")
+    @ApiModelProperty(value = "归属类型 (【系统字典】)")
+    private String ownerType;
+
+
+    /**
+     * 归属ID
+     */
+    @Excel(name = "归属ID")
+    @ApiModelProperty(value = "归属ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String ownerId;
+
+
+    /**
+     * 分配比例
+     */
+    @Excel(name = "分配比例")
+    @ApiModelProperty(value = "分配比例")
+    private BigDecimal allocationRatio;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+    private List<String> ownerTypes;
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 2 - 0
src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java

@@ -300,6 +300,8 @@ public class OutboundItemResponse {
     @ApiModelProperty(value = "商品规格")
     private String skuSpec;
 
+    private String fromNo;
+
 
     @ApiModelProperty(value = "新建编辑标识true:新建,false:编辑")
     private Boolean addOrEditFlag;

+ 8 - 0
src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java

@@ -339,6 +339,14 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     private String salesChannel;
 
 
+
+    private BigDecimal sumOutAmt;
+
+
+    private BigDecimal sumOutQty;
+
+
+
     private static final long serialVersionUID = 1L;
 
 }

+ 1 - 1
src/main/java/com/dk/mdm/model/response/mst/CusFollowResponse.java

@@ -47,7 +47,7 @@ public class CusFollowResponse implements Serializable {
     @ApiModelProperty(value = "跟进ID")
     @TableField(typeHandler = UuidTypeHandler.class)
     private String followId;
-
+    private String followType;
 
     /**
      * 客户ID (陌生接待时为null)

+ 16 - 1
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -312,15 +312,30 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
     @ApiModelProperty(value = "总收款金额-总应收收款金额+总应收优惠金额(现金池)")
     private BigDecimal receiptResidue;
 
-
+    @ApiModelProperty(value = "订单数量")
     private BigDecimal orderQuantity;
 
+    @ApiModelProperty(value = "订单金额")
     private BigDecimal orderAmount;
 
+    @ApiModelProperty(value = "出库数量")
     private BigDecimal outboundQuantity;
 
+    @ApiModelProperty(value = "出库金额")
     private BigDecimal outboundAmount;
 
+    @ApiModelProperty(value = "未出库金额")
+    private BigDecimal outboundNotAmount;
+
+    @ApiModelProperty(value = "未出库数量")
+    private BigDecimal outboundNotQuantity;
+
+    @ApiModelProperty(value = "退货数量")
+    private BigDecimal outboundReturnQuantity;
+
+    @ApiModelProperty(value = "退货金额")
+    private BigDecimal outboundReturnAmount;
+
 
 
 

+ 6 - 0
src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java

@@ -174,6 +174,12 @@ public class GoodsSkuResponse implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 113 - 0
src/main/java/com/dk/mdm/model/response/sale/MultiOwnerResponse.java

@@ -0,0 +1,113 @@
+package com.dk.mdm.model.response.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ *  多业务归属
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@ExportTitle("多业务归属")
+@TableName(value = "t_psi_multi_owner", schema =  "dkic_b", autoResultMap = true)
+@ApiModel(value="实体类:多业务归属", description="表名:t_psi_multi_owner")
+public class MultiOwnerResponse extends PageInfo<MultiOwnerResponse> implements Serializable {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 多业务ID
+     */
+//    @TableId(value = "multi_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "多业务ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String multiId;
+
+
+    /**
+     * 订单Id
+     */
+    @Excel(name = "订单Id")
+    @ApiModelProperty(value = "订单Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String orderId;
+
+
+    /**
+     * 归属类型 (【系统字典】)
+     */
+    @Excel(name = "归属类型 (【系统字典】)")
+    @ApiModelProperty(value = "归属类型 (【系统字典】)")
+    private String ownerType;
+
+
+    /**
+     * 归属ID
+     */
+    @Excel(name = "归属ID")
+    @ApiModelProperty(value = "归属ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String ownerId;
+
+
+    /**
+     * 分配比例
+     */
+    @Excel(name = "分配比例")
+    @ApiModelProperty(value = "分配比例")
+    private BigDecimal allocationRatio;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /**
+     * 企业ID
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @Excel(name = "企业ID")
+    @ApiModelProperty(value = "企业ID")
+    private Integer cpId;
+
+
+
+
+    private String staffId;
+
+    private String staffName;
+
+    private String orgId;
+
+    private String orgName;
+
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 7 - 0
src/main/java/com/dk/mdm/model/response/sale/OrderItemResponse.java

@@ -1,11 +1,13 @@
 package com.dk.mdm.model.response.sale;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.JsonTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
@@ -292,6 +294,11 @@ public class OrderItemResponse extends PageInfo<OrderItemResponse> implements Se
     @TableField(typeHandler = UuidTypeHandler.class)
     private String whId;
 
+    @Excel(name = "商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @ApiModelProperty(value = "商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONArray skuImages;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 2 - 0
src/main/java/com/dk/mdm/model/vo/mst/CusFollowVO.java

@@ -317,6 +317,8 @@ public class CusFollowVO implements Serializable {
     @ApiModelProperty(value = "门牌号")
     private String addressNo;
 
+    private String followType;
+
 
     /**
      * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)

+ 6 - 0
src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java

@@ -171,6 +171,12 @@ public class GoodsSkuVO implements Serializable {
     @ApiModelProperty(value = "销售限价")
     private BigDecimal priceLimited;
 
+    /**
+     * 其他价
+     */
+    @Excel(name = "其他价")
+    @ApiModelProperty(value = "其他价")
+    private BigDecimal priceOther;
 
     /**
      * 商品图片 (index(显示顺序)、name(文件名)、path(路径)、type(类型)、time(上传时间)...)

+ 4 - 2
src/main/java/com/dk/mdm/service/ivt/inbound/InboundOtherService.java

@@ -589,8 +589,10 @@ public class InboundOtherService extends BaseService<Inbound> {
                 inboundItemVO.setInventoryType(Constant.InventoryType.INBOUND.getName());
                 inboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.OTHER_INBOUND.getValue());
                 //编辑之前的数
-                inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
-                inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                if (inboundItemResponse.getIntoQty().compareTo(BigDecimal.ZERO) > 0) {
+                    inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
+                    inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                }
                 inboundItemVO.setAddOrEditFlag(true);
                 //endregion
             }

+ 4 - 2
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseReturnService.java

@@ -652,8 +652,10 @@ public class InboundPurchaseReturnService extends BaseService<Inbound> {
                 inboundItemVO.setInventoryType(Constant.InventoryType.INBOUND.getName());
                 inboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.PURCHASE_RETURN.getValue());
                 //编辑之前的数
-                inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
-                inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                if(inboundItemResponse.getIntoQty().compareTo(BigDecimal.ZERO)>0){
+                    inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
+                    inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                }
                 inboundItemVO.setAddOrEditFlag(true);
                 //endregion
             }

+ 4 - 2
src/main/java/com/dk/mdm/service/ivt/inbound/InboundPurchaseService.java

@@ -944,8 +944,10 @@ public class InboundPurchaseService extends BaseService<Inbound> {
                 inboundItemVO.setInventoryType(Constant.InventoryType.INBOUND.getName());
                 inboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.PURCHASE_ORDER.getValue());
                 //编辑之前的数
-                inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
-                inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                if(inboundItemResponse.getIntoQty().compareTo(BigDecimal.ZERO)>0) {
+                    inboundItemVO.setQtyBeforeUpdate(inboundItemResponse.getIntoQty());
+                    inboundItemVO.setAmtBeforeUpdate(inboundItemResponse.getIntoAmt());
+                }
                 inboundItemVO.setAddOrEditFlag(true);
                 //endregion
             }

+ 4 - 2
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundOtherService.java

@@ -593,8 +593,10 @@ public class OutboundOtherService extends BaseService<Outbound> {
                 outboundItemVO.setInventoryType(Constant.InventoryType.OUTBOUND.getName());
                 outboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.OTHER_OUTBOUND.getValue());
                 //编辑之前的数
-                outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
-                outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                if(outboundItemResponse.getOutQty().compareTo(BigDecimal.ZERO)>0) {
+                    outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
+                    outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                }
                 outboundItemVO.setAddOrEditFlag(true);
                 //endregion
             }

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

@@ -940,8 +940,10 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                 outboundItemVO.setInventoryType(Constant.InventoryType.OUTBOUND.getName());
                 outboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.SALE_ORDER.getValue());
                 //编辑之前的数
-                outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
-                outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                if (outboundItemResponse.getOutQty().compareTo(BigDecimal.ZERO) > 0) {
+                    outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
+                    outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                }
                 outboundItemVO.setAddOrEditFlag(true);
                 //endregion
 
@@ -990,7 +992,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                 orderItem.setOutQty(outboundItemVO.getOutQty());
                 orderItem.setOutAmt(outboundItemVO.getOutAmt());
                 //出库状态
-                String orderOutStatus = this.setOutStatus(orderItemResponse.getOutingQty().add(orderItem.getOutingQty()),
+                String orderOutStatus = this.setOutStatus(orderItemResponse.getOutingQty().subtract(outboundItemVO.getOutQty()),
                         orderItemResponse.getOutQty().add(orderItem.getOutQty()), orderItemResponse.getItemQty());
                 orderItem.setOutStatus(orderOutStatus);
                 //修改
@@ -1043,7 +1045,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     orderItem.setOutQty(outboundItemVO.getOutQty().negate());
                     orderItem.setOutAmt(outboundItemVO.getOutAmt().negate());
                     //出库状态
-                    String outStatus = this.setOutStatus(orderItemResponse.getOutingQty().add(orderItem.getOutingQty()),
+                    String outStatus = this.setOutStatus(orderItemResponse.getOutingQty().subtract(orderItem.getOutingQty()),
                             orderItemResponse.getOutQty().add(orderItem.getOutQty()), orderItemResponse.getItemQty());
                     orderItem.setOutStatus(outStatus);
                     //修改
@@ -1089,7 +1091,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             order.setOutingQty((outboundResponse.getOutingQty().add(delOutingQty)).negate());
             order.setOutingAmt((outboundResponse.getOutingAmt().add(delOutingAmt)).negate());
             //出库状态
-            String orderOutStatus = this.setOutStatus(orderResponse.getOutingQty().add(order.getOutingQty()),
+            String orderOutStatus = this.setOutStatus(orderResponse.getOutingQty().subtract(sumOutQty).add(delOutQty),
                     orderResponse.getOutQty().add(order.getOutQty()), orderResponse.getSumQuantity());
             order.setOutStatus(orderOutStatus);
             //修改

+ 4 - 2
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java

@@ -901,8 +901,10 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
                 outboundItemVO.setInventoryType(Constant.InventoryType.OUTBOUND.getName());
                 outboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.SALE_RETURN.getValue());
                 //编辑之前的数
-                outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
-                outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                if (outboundItemResponse.getOutQty().compareTo(BigDecimal.ZERO) > 0) {
+                    outboundItemVO.setQtyBeforeUpdate(outboundItemResponse.getOutQty());
+                    outboundItemVO.setAmtBeforeUpdate(outboundItemResponse.getOutAmt());
+                }
                 outboundItemVO.setAddOrEditFlag(true);
                 //endregion
             }

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

@@ -257,7 +257,7 @@ public class AccountService extends BaseService<Account> {
         if (!moneyAccountForUpdate.getFlgNegative()) {
             // 如果余额小于0 ,则提示余额不足
             if (sumAmtInflow.compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
             }
         }
 
@@ -467,7 +467,7 @@ public class AccountService extends BaseService<Account> {
 
                             // 可用金额为负数,则不能保存
                             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
                             }
                             super.updateByUuid(accountUpdate);
                         }
@@ -570,7 +570,7 @@ public class AccountService extends BaseService<Account> {
                         // 更新前的最后校验
                         // 可用金额为负数,则不能保存
                         if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
                         }
                         super.updateByUuid(accountUpdate);
 

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

@@ -158,7 +158,7 @@ public class MacTransferService extends BaseService<MacTransfer> {
 				if(!moneyAccountForUpdate.getFlgNegative()){
 					// 如果账户余额比转出金额小,就不允许转出
 					if(moneyAccountForUpdate.getBalance().compareTo(macTransferItem.getAmtTrf()) == -1){
-						throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+						throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
 					}
 				}
 

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

@@ -271,7 +271,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
             /*******************************************  应付付款的处理 end ********************************************/
@@ -342,7 +342,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
 
@@ -500,7 +500,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
             /*******************************************  应付付款的处理 end ********************************************/
@@ -610,7 +610,7 @@ public class OtherPayableService extends BaseService<OtherPayable> {
             }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
 

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

@@ -270,7 +270,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
             /***********************************  应收收款的处理 end ************************************/
@@ -342,7 +342,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
 
@@ -501,7 +501,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
             /***********************************  应收收款的处理 end ************************************/
@@ -610,7 +610,7 @@ public class OtherReceivableService extends BaseService<OtherReceivable> {
             }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
 

+ 13 - 5
src/main/java/com/dk/mdm/service/mac/PaymentService.java

@@ -207,6 +207,14 @@ public class PaymentService extends BaseService<RecPay> {
                 MoneyAccount moneyAccountUpdate = new MoneyAccount();
                 moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtPay().negate()))
                         .setMacId(moneyAccountForUpdate.getMacId());
+
+                // 如果账户不允许为负数
+                if (!moneyAccountForUpdate.getFlgNegative()) {
+                    // 如果余额小于0 ,则提示余额不足
+                    if (moneyAccountUpdate.getBalance().compareTo(BigDecimal.ZERO) == -1) {
+                        throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                    }
+                }
                 moneyAccountService.updateByUuid(moneyAccountUpdate);
             }
         }
@@ -271,7 +279,7 @@ public class PaymentService extends BaseService<RecPay> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getPaymentResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
         }
@@ -343,12 +351,12 @@ public class PaymentService extends BaseService<RecPay> {
 
         // 更新前的最后校验
         // 剩余应付为负数,则不能保存
-        if (accountUpdate.getPayableResidue().compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-        }
+//        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());
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
         }
         accountService.updateByUuid(accountUpdate);
 

+ 12 - 11
src/main/java/com/dk/mdm/service/mac/ReceiptService.java

@@ -272,15 +272,16 @@ public class ReceiptService extends BaseService<RecPay> {
 
                 // 更新资金账户
                 MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
-
-//                // 如果转账之后账户余额小于0,则提示资金账户余额不足,不能退款
-//                if ((moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec())).compareTo(BigDecimal.ZERO) == -1) {
-//                    throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
-//                }
-
                 MoneyAccount moneyAccountUpdate = new MoneyAccount();
                 moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec()))
                         .setMacId(moneyAccountForUpdate.getMacId());
+                // 如果账户不允许为负数
+                if (!moneyAccountForUpdate.getFlgNegative()) {
+                    // 如果余额小于0 ,则提示余额不足
+                    if (moneyAccountUpdate.getBalance().compareTo(BigDecimal.ZERO) == -1) {
+                        throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                    }
+                }
                 moneyAccountService.updateByUuid(moneyAccountUpdate);
             }
         }
@@ -506,7 +507,7 @@ public class ReceiptService extends BaseService<RecPay> {
 //            }
             // 可用金额为负数,则不能保存
             if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
             }
             accountService.updateByUuid(accountUpdate);
         }
@@ -578,12 +579,12 @@ public class ReceiptService extends BaseService<RecPay> {
 
         // 更新前的最后校验
         // 剩余应收为负数,则不能保存
-        if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-        }
+//        if (accountUpdate.getReceivableResidue().compareTo(BigDecimal.ZERO) == -1) {
+//            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+//        }
         // 可用金额为负数,则不能保存
         if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.MAC_BALANCE_NO_LESS.getMessage());
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
         }
         accountService.updateByUuid(accountUpdate);
 

+ 8 - 8
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -215,10 +215,10 @@ public class CusFollowService extends BaseService<CusFollow> {
             List<CustomerResponse> cusList = customerMapper.selectByCond(
                     new CustomerQuery().setCpId(customer.getCpId()).setCusPhone(customer.getCusPhone()).setFlgValid(true)
             );
-            if (cusList != null && cusList.size() > 0 && cusList.stream().anyMatch(a -> !a.getCusId().equals(customer.getCusId()))) {
-                throw new BaseBusinessException(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
-                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
-            }
+//            if (cusList != null && cusList.size() > 0 && cusList.stream().anyMatch(a -> !a.getCusId().equals(customer.getCusId()))) {
+//                throw new BaseBusinessException(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
+//                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
+//            }
             customer.setLastFollowId(cusFollow.getFollowId());
             customer.setLastFollowTime(cusFollow.getFollowTime());
             customer.setLastFollowStaff(cusFollow.getFollowStaff());
@@ -255,10 +255,10 @@ public class CusFollowService extends BaseService<CusFollow> {
             Long count = customerMapper.countByCond(
                     new CustomerQuery().setCpId(customer.getCpId()).setCusPhone(customer.getCusPhone()).setFlgValid(true)
             );
-            if (count > 0) {
-                return ResponseResultUtil.error(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
-                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
-            }
+//            if (count > 0) {
+//                return ResponseResultUtil.error(ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getCode(),
+//                        ErrorCodeEnum.CUSTOMER_SAME_COMPANY_TELEPHONE.getMessage());
+//            }
 
             //放入公海客户,清除跟进人
             if (Constant.IntentionConstant.SEA.getValue().equals(cusFollowVO.getIntention())) {

+ 1 - 4
src/main/java/com/dk/mdm/service/mst/OrgService.java

@@ -133,17 +133,15 @@ public class OrgService extends BaseService<Org> {
     public ResponseResultVO<?> insert(OrgVO orgVO) {
         // 转化实体
         Org organization = orgConvert.convertToPo(orgVO);
-        // 获取显示顺序
-        Integer displayNo = commonService.getMaxDisplayNo(Constant.DisplayNoTable.ORG);
         Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.ORG.getName(), true);
         // 获取编码和主键UuId
-        organization.setDisplayNo(displayNo);
         organization.setOrgId(codeMap.get("outId").toString());
         organization.setOrgCode(codeMap.get("outNote").toString());
 
         //查询 本次要加的 部门的 父级下 最大的DisplayNo  然后加1  就是现在要加的DisplayNo
         Map<String, Object> param = new HashMap<>();
         param.put("otherCond", "parent_id = #{parentID} ::uuid");
+        param.put("parentId",organization.getParentId());
         organization.setDisplayNo(commonService.getMaxDisplayNo(Constant.DisplayNoTable.ORG ,param));
         if (organization.getParentId() != null) {
             Org org = orgMapper.selectById(organization.getParentId());
@@ -151,7 +149,6 @@ public class OrgService extends BaseService<Org> {
             organization.setTopId(org.getTopId());
         }
 
-
         // 插入组织部门数据
         super.insert(organization);
         //执行函数

+ 2 - 0
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -26,6 +26,7 @@ import com.dk.mdm.model.query.mst.StaffQuery;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.vo.mst.StaffVO;
 import com.dk.mdm.service.common.CommonService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +41,7 @@ import java.util.*;
  * @date : 2023/1/4 9:25
  */
 @Service
+@Slf4j
 public class StaffService extends BaseService<Staff> {
     @Resource
     private CompanyFeign companyFeign;

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

@@ -36,10 +36,12 @@ import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.sale.OrderItem;
 import com.dk.mdm.model.query.mac.RecPayItemQuery;
 import com.dk.mdm.model.query.mac.RecPayQuery;
+import com.dk.mdm.model.query.sale.MultiOwnerQuery;
 import com.dk.mdm.model.query.sale.OrderItemQuery;
 import com.dk.mdm.model.query.sale.OrderQuery;
 import com.dk.mdm.model.response.mac.RecPayItemResponse;
 import com.dk.mdm.model.response.mac.RecPayResponse;
+import com.dk.mdm.model.response.sale.MultiOwnerResponse;
 import com.dk.mdm.model.response.sale.OrderItemResponse;
 import com.dk.mdm.model.response.sale.OrderResponse;
 import com.dk.mdm.model.vo.mac.RecPayItemVO;
@@ -600,6 +602,23 @@ public class OrderService extends BaseService<Order> {
         List<OrderItemResponse> orderItemResponse = orderItemMapper.selectByCond(new OrderItemQuery().setOrderId(id));
         dataInfo.put("dataItem", orderItemResponse);
 
+        //查询主从业务员
+        List<String> staffList = new ArrayList<>();
+        staffList.add(Constant.OwnerType.Z_STAFF.getName());
+        staffList.add(Constant.OwnerType.C_STAFF.getName());
+        List<MultiOwnerResponse> multiOwnersStaff = multiOwnerMapper.selectByType(new MultiOwnerQuery().setOrderId(id).setOwnerTypes(staffList));
+        if(multiOwnersStaff != null && multiOwnersStaff.size() > 0){
+            dataInfo.put("staffList", multiOwnersStaff);
+        }
+        //查询主从业务部门
+        List<String> orgList = new ArrayList<>();
+        orgList.add(Constant.OwnerType.Z_ORG.getName());
+        orgList.add(Constant.OwnerType.C_ORG.getName());
+        List<MultiOwnerResponse> multiOwnersOrg = multiOwnerMapper.selectByType(new MultiOwnerQuery().setOrderId(id).setOwnerTypes(orgList));
+        if(multiOwnersOrg != null && multiOwnersOrg.size() > 0){
+            dataInfo.put("orgList", multiOwnersOrg);
+        }
+
         // 收款明细
         List<RecPayResponse> recPayList = recPayMapper.selectByCond(new RecPayQuery().setBiznisId(id).setFlgOrderHandle(false));
         if (recPayList != null && recPayList.size() > 0) {