Sfoglia il codice sorgente

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

changhaoning 1 anno fa
parent
commit
2ef2363284
91 ha cambiato i file con 3329 aggiunte e 507 eliminazioni
  1. 1 15
      src/main/java/com/dk/mdm/controller/ivt/outBound/OutboundSaleOrderController.java
  2. 41 0
      src/main/java/com/dk/mdm/controller/report/ReportController.java
  3. 43 1
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml
  4. 5 1
      src/main/java/com/dk/mdm/mapper/ivt/InventoryMapper.xml
  5. 11 2
      src/main/java/com/dk/mdm/mapper/ivt/OutboundItemMapper.xml
  6. 7 1
      src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml
  7. 18 9
      src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml
  8. 6 2
      src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml
  9. 14 0
      src/main/java/com/dk/mdm/mapper/report/ReportMapper.java
  10. 149 65
      src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml
  11. 93 56
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  12. 167 125
      src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml
  13. 3 0
      src/main/java/com/dk/mdm/model/pojo/ivt/InboundItem.java
  14. 99 0
      src/main/java/com/dk/mdm/model/pojo/ivt/Outbound.java
  15. 28 1
      src/main/java/com/dk/mdm/model/pojo/ivt/OutboundItem.java
  16. 7 0
      src/main/java/com/dk/mdm/model/pojo/mst/GoodsSku.java
  17. 7 0
      src/main/java/com/dk/mdm/model/pojo/mst/Staff.java
  18. 26 0
      src/main/java/com/dk/mdm/model/pojo/sale/Order.java
  19. 35 0
      src/main/java/com/dk/mdm/model/pojo/sale/OrderItem.java
  20. 23 0
      src/main/java/com/dk/mdm/model/query/ivt/InboundItemQuery.java
  21. 2 0
      src/main/java/com/dk/mdm/model/query/ivt/InventoryQuery.java
  22. 4 0
      src/main/java/com/dk/mdm/model/query/ivt/OutboundItemQuery.java
  23. 59 0
      src/main/java/com/dk/mdm/model/query/ivt/OutboundQuery.java
  24. 7 0
      src/main/java/com/dk/mdm/model/query/mst/GoodsSkuQuery.java
  25. 7 0
      src/main/java/com/dk/mdm/model/query/mst/StaffQuery.java
  26. 2 2
      src/main/java/com/dk/mdm/model/query/wxapi/basic/WxCommonQuery.java
  27. 17 0
      src/main/java/com/dk/mdm/model/report/ExcelDataHandler.java
  28. 80 0
      src/main/java/com/dk/mdm/model/report/ExcelExportStyleImpl.java
  29. 14 0
      src/main/java/com/dk/mdm/model/report/ExcelIndex.java
  30. 15 0
      src/main/java/com/dk/mdm/model/report/Util.java
  31. 31 0
      src/main/java/com/dk/mdm/model/report/analysis/BudgetQuotation.java
  32. 31 0
      src/main/java/com/dk/mdm/model/report/analysis/BudgetQuotationStaff.java
  33. 31 0
      src/main/java/com/dk/mdm/model/report/analysis/PotentialCustomerAnalysis.java
  34. 31 0
      src/main/java/com/dk/mdm/model/report/analysis/PotentialCustomerAnalysisStaff.java
  35. 38 0
      src/main/java/com/dk/mdm/model/report/department/DepartmentCollectionRanking.java
  36. 39 0
      src/main/java/com/dk/mdm/model/report/department/DepartmentTransactionRanking.java
  37. 31 0
      src/main/java/com/dk/mdm/model/report/from/Offer.java
  38. 26 0
      src/main/java/com/dk/mdm/model/report/from/PotentialCustomerAnalysisFrom.java
  39. 33 0
      src/main/java/com/dk/mdm/model/report/from/Transaction.java
  40. 32 0
      src/main/java/com/dk/mdm/model/report/product/ProductDistribution.java
  41. 35 0
      src/main/java/com/dk/mdm/model/report/received/ArrearsInfo.java
  42. 35 0
      src/main/java/com/dk/mdm/model/report/received/ArrearsInfoStaff.java
  43. 37 0
      src/main/java/com/dk/mdm/model/report/received/ReceivedTask.java
  44. 37 0
      src/main/java/com/dk/mdm/model/report/received/ReceivedTaskStaff.java
  45. 32 0
      src/main/java/com/dk/mdm/model/report/sale/ActivityEffect1.java
  46. 32 0
      src/main/java/com/dk/mdm/model/report/sale/ActivityEffect2.java
  47. 37 0
      src/main/java/com/dk/mdm/model/report/sale/CustomerUnitPrice.java
  48. 37 0
      src/main/java/com/dk/mdm/model/report/sale/CustomerUnitPriceStaff.java
  49. 40 0
      src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdom1.java
  50. 40 0
      src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdom2.java
  51. 40 0
      src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdomStaff1.java
  52. 40 0
      src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdomStaff2.java
  53. 35 0
      src/main/java/com/dk/mdm/model/report/sale/OrgCategoryAmt.java
  54. 32 0
      src/main/java/com/dk/mdm/model/report/sale/OrgCategoryQty.java
  55. 34 0
      src/main/java/com/dk/mdm/model/report/sale/OrgSpuAmt.java
  56. 33 0
      src/main/java/com/dk/mdm/model/report/sale/OrgSpuQty.java
  57. 38 0
      src/main/java/com/dk/mdm/model/report/sale/ReturnSituation.java
  58. 38 0
      src/main/java/com/dk/mdm/model/report/sale/ReturnSituationStaff.java
  59. 37 0
      src/main/java/com/dk/mdm/model/report/sale/SaleTask.java
  60. 37 0
      src/main/java/com/dk/mdm/model/report/sale/SaleTaskStaff.java
  61. 33 0
      src/main/java/com/dk/mdm/model/report/sale/StaffCategoryAmt.java
  62. 33 0
      src/main/java/com/dk/mdm/model/report/sale/StaffCategoryQty.java
  63. 33 0
      src/main/java/com/dk/mdm/model/report/sale/StaffSpuAmt.java
  64. 33 0
      src/main/java/com/dk/mdm/model/report/sale/StaffSpuQty.java
  65. 40 0
      src/main/java/com/dk/mdm/model/report/sale/categoryRanking.java
  66. 39 0
      src/main/java/com/dk/mdm/model/report/sale/orgRanking.java
  67. 39 0
      src/main/java/com/dk/mdm/model/report/sale/staffRanking.java
  68. 37 0
      src/main/java/com/dk/mdm/model/report/staff/StaffCollectionRanking.java
  69. 39 0
      src/main/java/com/dk/mdm/model/report/staff/StaffTransactionRanking.java
  70. 21 0
      src/main/java/com/dk/mdm/model/response/ivt/InboundItemResponse.java
  71. 9 0
      src/main/java/com/dk/mdm/model/response/ivt/InventoryResponse.java
  72. 28 1
      src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java
  73. 20 0
      src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java
  74. 7 0
      src/main/java/com/dk/mdm/model/response/mst/GoodsSkuResponse.java
  75. 36 0
      src/main/java/com/dk/mdm/model/response/sale/OrderItemResponse.java
  76. 25 0
      src/main/java/com/dk/mdm/model/response/sale/OrderResponse.java
  77. 3 0
      src/main/java/com/dk/mdm/model/vo/ivt/InboundItemVO.java
  78. 31 0
      src/main/java/com/dk/mdm/model/vo/ivt/OutboundItemVO.java
  79. 21 0
      src/main/java/com/dk/mdm/model/vo/ivt/OutboundVO.java
  80. 8 0
      src/main/java/com/dk/mdm/model/vo/mst/GoodsSkuVO.java
  81. 34 0
      src/main/java/com/dk/mdm/model/vo/sale/OrderItemVO.java
  82. 12 1
      src/main/java/com/dk/mdm/model/vo/sale/OrderVO.java
  83. 10 0
      src/main/java/com/dk/mdm/service/common/CommonService.java
  84. 59 11
      src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java
  85. 119 46
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  86. 58 43
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java
  87. 1 1
      src/main/java/com/dk/mdm/service/mst/DictionaryDataService.java
  88. 1 0
      src/main/java/com/dk/mdm/service/mst/OrgService.java
  89. 54 35
      src/main/java/com/dk/mdm/service/mst/StaffService.java
  90. 404 88
      src/main/java/com/dk/mdm/service/report/ReportService.java
  91. 3 1
      src/main/java/com/dk/mdm/service/sale/OrderService.java

+ 1 - 15
src/main/java/com/dk/mdm/controller/ivt/outBound/OutboundSaleOrderController.java

@@ -44,21 +44,7 @@ public class OutboundSaleOrderController {
     )
     @PostMapping({"outbound_insert"})
     public ResponseResultVO<?> saleOrderOutboundInsert(@Valid @RequestBody OutboundVO outboundVO) {
-        return outboundSaleOrderService.saleOrderOutboundInsert(outboundVO);
-    }
-
-    /**
-     * @desc :  销售出库新建和收款
-     * @date : 2024/3/18 15:22
-     * @author : 王英杰
-     */
-    @ApiOperation(
-            value = "销售出库新建",
-            notes = "销售出库新建"
-    )
-    @PostMapping({"outbound_insert_collection"})
-    public ResponseResultVO<?> saleOrderOutboundInsertCollection(@Valid @RequestBody OutboundVO outboundVO) {
-        return outboundSaleOrderService.saleOrderOutboundInsertCollection(outboundVO);
+        return outboundSaleOrderService.saleOrderOutboundInsert(outboundVO,false);
     }
 
     /**

+ 41 - 0
src/main/java/com/dk/mdm/controller/report/ReportController.java

@@ -3,8 +3,10 @@ package com.dk.mdm.controller.report;
 import com.alibaba.fastjson.JSONObject;
 import com.dk.common.controller.BaseController;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.service.BaseService;
+import com.dk.common.util.RedisUtil;
 import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.report.ReportService;
 import com.google.gson.JsonObject;
@@ -13,8 +15,10 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * @desc   : 报表数据源
@@ -29,6 +33,9 @@ public class ReportController  {
     @Autowired
     private ReportService reportService;
 
+    @Autowired
+    private RedisUtil redisUtil;
+
     @ApiOperation(
             value = "获取库存",
             notes = "获取库存"
@@ -238,6 +245,30 @@ public class ReportController  {
     }
 
     /**
+<<<<<<< HEAD
+     * @desc   : 导出的uuid
+     * @author : 洪旭东
+     * @date   : 2024-05-08 11:50
+     */
+    @PostMapping("export_push_params")
+    public ResponseResultVO<String> exportPushParams(@RequestBody Map<String,Object> map){
+        String paramsUuid = UUID.randomUUID().toString();
+        redisUtil.set(paramsUuid,map);
+        redisUtil.expire(paramsUuid,120);
+        return ResponseResultUtil.success(paramsUuid);
+    }
+
+    /**
+     * @desc   : 导出
+     * @author : 洪旭东
+     * @date   : 2024-05-09 13:39
+     */
+    @GetMapping("export")
+    public void export(HttpServletResponse response, @RequestParam("uuid")String uuid) throws Exception {
+        reportService.export(response, uuid);
+    }
+
+    /**
      * @desc   : 客户往来账
      * @author : 宋扬
      * @date   : 2024/5/10 10:19
@@ -277,6 +308,16 @@ public class ReportController  {
         return reportService.getMacPayCurrentItemReport(param);
     }
 
+    /**
+     * @desc   : 客户收支表查询
+     * @author : 刘尧
+     * @date   : 2024/6/5 13:17
+     */
+    @PostMapping("get_cus_rec_pay_report_item")
+    public ResponseResultVO<List<Map<String, Object>>> getCusRecPayReportItem(@RequestBody Map<String, Object> params) {
+        return reportService.getCusRecPayReportItem(params);
+    }
+
 }
 
 

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

@@ -23,7 +23,7 @@
         sys.f_remove_zero(tpii.out_qty) as out_qty, sys.f_remove_zero(tpii.inv_qty) as inv_qty, tpii.flg_valid,
         tpii.cp_id,tpii.s_into_id,tpii.s_into_item_id,tpii.s_pur_id,tpii.s_pur_item_id,
         tpii.intoing_box,tpii.intoing_piece,tpii.into_box,tpii.into_piece,
-        tpii.unit_id,tpii.sub_unit_id,tpii.pack_box
+        tpii.unit_id,tpii.sub_unit_id,tpii.pack_box,tpii.flg_cost_check
     </sql>
 
 
@@ -113,7 +113,14 @@
         <result column="pack_box" property="packBox"/>
         <result column="subUnitName" property="subUnitName"/>
         <result column="unitName" property="unitName"/>
+        <result column="whName" property="whName"/>
+        <result column="intoDate" property="intoDate"  typeHandler="TimestampTypeHandler"/>
+        <result column="seriesName" property="seriesName"/>
+        <result column="intoStatusName" property="intoStatusName"/>
         <result column="flg_sub_unit" property="flgSubUnit"/>
+        <result column="intoTypeName" property="intoTypeName"/>
+        <result column="flg_cost_check" property="flgCostCheck"/>
+        <result column="flgCostCheckName" property="flgCostCheckName"/>
     </resultMap>
 <!--    退货用-->
     <resultMap id="BaseResultMapReturnResponse" type="com.dk.mdm.model.response.ivt.InboundItemResponse">
@@ -594,6 +601,14 @@
         ,sys.f_remove_zero(tppi.into_qty) as "purItemIntoQty"
         ,tmp.sup_code as "supCode"
         ,tmp.sup_name as "supName"
+        ,tmw.wh_name AS "whName"
+        ,tpid.into_date AS "intoDate"
+        ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS  "intoStatusName"
+        ,sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) AS  "intoTypeName"
+        ,tmgss.series_name AS "seriesName"
+        ,case when tpii.flg_cost_check is null then '未核对'
+        when tpii.flg_cost_check = true then '已核对'
+        else '未核对' end as "flgCostCheckName"
         ,sys.f_remove_zero(tpiv.inv_qty)  as inv_qty
         ,(select ul.decimal_places from  dkic_b.t_mst_unit ul where tpii.unit_id = ul.unit_id) as "decimalPlaces"
         FROM dkic_b.t_psi_inbound_item tpii
@@ -603,9 +618,14 @@
         left join dkic_b.t_psi_purchase tpp on tpp.pur_id = tpii.from_id
         left join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpii.sku_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
+        left join dkic_b.t_mst_goods_series tmgss on tmgss.series_id = tmgs.series_id
         left join dkic_b.t_psi_inventory tpi on tpi.inv_id = tpii.inv_id
         left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = tpii.wh_id
         Left join dkic_b.t_mst_supplier tmp on tpid.sup_id = tmp.sup_id
+        LEFT JOIN sys.t_data_kind tdk   ON tdk.kind_code = tpid.into_status
+        LEFT JOIN sys.t_data_kind tdk1   ON tdk1.kind_code = tpii.into_type
+        LEFT JOIN dkic_b.t_mst_staff tmss   ON tmss.staff_id = tpid.staff_id
+        LEFT JOIN dkic_b.t_mst_org tmo   ON tmo.org_id = tpid.org_id
         <where>
             tpii.flg_valid
             and tpii.into_qty &lt;&gt; 0
@@ -630,6 +650,28 @@
             <if test="cpId != null">
                 AND tpii.cp_id = #{cpId}
             </if>
+            <if test="intoTypeName != null">
+                AND sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) LIKE concat('%',my_ex.likequery(#{intoTypeName}),'%')
+            </if>
+            <if test="supName != null">
+                AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
+            </if>
+            <if test="viewNoCostDocuments !=null and viewNoCostDocuments == true">
+                AND tpii.flg_cost_check = false
+            </if>
+            <if test="staffName !=null">
+                AND tmss.staff_name  LIKE concat('%',my_ex.likequery(#{staffName}),'%')
+            </if>
+            <if test="orgName !=null">
+                AND tmo.org_name  LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+            </if>
+            <if test="intoStatusList != null and intoStatusList.size()>0">
+                AND tpii.into_status =
+                any(#{intoStatusList, typeHandler= StringListTypeHandler})
+            </if>
+            <if test="searchText !=null">
+                AND  (tpid.into_no LIKE concat('%',my_ex.likequery(#{searchText}), '%')    OR   tmgs.sku_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')   OR   tmgs.sku_code LIKE concat('%',my_ex.likequery(#{searchText}),'%'))
+            </if>
         </where>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}

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

@@ -57,7 +57,7 @@
                 <result column="cp_id" property="cpId"/>
                 <result column="sku_code" property="skuCode"/>
                 <result column="sku_name" property="skuName"/>
-                  <result column="sku_spec" property="skuSpec"/>
+                <result column="sku_spec" property="skuSpec"/>
                 <result column="sku_model" property="skuModel"/>
                 <result column="brand_name" property="brandName"/>
                 <result column="short_name" property="shortName"/>
@@ -75,6 +75,8 @@
         <result column="seriesName" property="seriesName"/>
         <result column="catName" property="catName"/>
         <result column="price_other" property="priceOther"/>
+        <result column="warning_upper_limit" property="warningUpperLimit"/>
+        <result column="warning_lower_limit" property="warningLowerLimit"/>
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
     </resultMap>
@@ -165,6 +167,8 @@
         ,tmgs.sku_images
         ,tmgs.unit_id
         ,tmgs.sub_unit_id
+        ,tmgs.warning_upper_limit
+        ,tmgs.warning_lower_limit
         ,tmgs.pack_box
         ,tmu.unit_name    AS "unitName"
         ,subtmu.unit_name AS "subUnitName"

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

@@ -135,6 +135,10 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         <result column="decimalPlaces" property="decimalPlaces"/>
         <result column="sup_id" property="supId"/>
         <result column="sup_name" property="supName"/>
+        <result column="fact_price" property="factPrice"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="discount" property="discount"/>
+        <result column="disc_amt" property="discAmt"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -221,6 +225,8 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
         tpoi.out_type,
         tpoi.from_id,
         tpoi.from_item_id,
+        tpoi.s_out_id,
+        tpoi.s_out_item_id,
         tpoi.item_index,
         tpoi.sku_id,
         tmgs.sku_code as "skuCode",
@@ -454,8 +460,11 @@ sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as
                        dkic_b.f_box_piece(tmgus.unit_name, tmgu.unit_name,
                                           floor(t.outing_qty / T.pack_box)::INT,
                                           floor(t.outing_qty % T.pack_box)::INT)
-                   end AS "unitInfo"
-
+                   end AS "unitInfo",
+               t.fact_price,
+               t.fact_amt,
+               t.discount,
+               t.disc_amt
         FROM dkic_b.t_psi_outbound_item as t
                  Left join dkic_b.t_mst_supplier tmp on t.sup_id = tmp.sup_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id

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

@@ -107,6 +107,9 @@
         <result column="sumOutAmt" property="sumOutAmt" />
         <result column="sumOutQty" property="sumOutQty" />
         <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="discount" property="discount"/>
+        <result column="disc_amt" property="discAmt"/>
     </resultMap>
 
     <resultMap id="BaseResultMapDetailResponse" type="com.dk.mdm.model.response.ivt.OutboundResponse">
@@ -487,7 +490,10 @@
                t.out_reason,
                t.flg_auto_handle,
                t.flg_handle_setting,
-               tmd.data_value                                    as out_reason_name
+               tmd.data_value                                    as out_reason_name,
+               t.fact_amt,
+               t.discount,
+               t.disc_amt
         FROM dkic_b.t_psi_outbound as t
                  left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
                  left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id

+ 18 - 9
src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml

@@ -8,7 +8,7 @@
         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, 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
+        , op_app_code, op_timestamp, op_db_user, warning_upper_limit, warning_lower_limit
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -30,18 +30,20 @@
                 <result column="price_limited" property="priceLimited"/>
                 <result column="price_other" property="priceOther"/>
                 <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
+                <result column="warning_lower_limit" property="warningLowerLimit"/>
+                <result column="warning_upper_limit" property="warningUpperLimit"/>
                 <result column="remarks" property="remarks"/>
-        <result column="flg_valid" property="flgValid"/>
-        <result column="flg_sub_unit" property="flgSubUnit"/>
-        <result column="flg_opening_inv" property="flgOpeningInv"/>
-        <result column="flg_price" property="flgPrice"/>
+                <result column="flg_valid" property="flgValid"/>
+                <result column="flg_sub_unit" property="flgSubUnit"/>
+                <result column="flg_opening_inv" property="flgOpeningInv"/>
+                <result column="flg_price" property="flgPrice"/>
                 <result column="cp_id" property="cpId"/>
-            <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
                 <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
-            <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+                <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
                 <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
                 <result column="op_app_code" property="opAppCode"/>
-            <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+                <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
                 <result column="op_db_user" property="opDbUser"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
     </resultMap>
@@ -49,7 +51,8 @@
     <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.pack_box,   tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.flg_sub_unit,  tmgs.flg_opening_inv,  tmgs.flg_price,  tmgs.cp_id
+           tmgs.pack_box,   tmgs.price_wholesale, tmgs.price_limited, tmgs.price_other,tmgs.sku_images, tmgs.remarks, tmgs.flg_valid, tmgs.flg_sub_unit,  tmgs.flg_opening_inv,  tmgs.flg_price,  tmgs.cp_id,
+        tmgs.warning_lower_limit, tmgs.warning_upper_limit
     </sql>
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.GoodsSkuResponse">
         <id column="sku_id" property="skuId"/>
@@ -87,6 +90,8 @@
         <result column="decimalPlaces" property="decimalPlaces"/>
         <result column="intoing_box" property="box" />
         <result column="intoing_piece" property="piece" />
+        <result column="warning_lower_limit" property="warningLowerLimit"/>
+        <result column="warning_upper_limit" property="warningUpperLimit"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -290,6 +295,8 @@
             remarks,
             cp_id,
             op_app_code,
+            warning_lower_limit,
+            warning_upper_limit
         </trim>
         )
         values
@@ -314,6 +321,8 @@
                 #{item.remarks},
                 #{item.cpId},
                 #{item.opAppCode},
+                #{item.warningLowerLimit},
+                #{item.warningUpperLimit}
             </trim>
             )
         </foreach>

+ 6 - 2
src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml

@@ -7,7 +7,7 @@
     <sql id="Base_Column_List">
         t.staff_id
         , t.staff_code, t.staff_name,t.staff_phone, t.org_id, t.role_ids,  t.wx_user_id, t.remarks,
-        t.flg_valid,t.flg_can_login,t.hr_status,t.login_type,
+        t.flg_valid,t.flg_can_login,t.hr_status,t.login_type,t.flg_init,
         t.cp_id, t.op_create_time, t.op_create_user_id, t.op_update_time, t.op_update_user_id
     </sql>
 
@@ -40,7 +40,8 @@
         <result column="hr_status" property="hrStatus"/>
         <result column="default_wh_id" property="defaultWhId" typeHandler="UuidTypeHandler" />
         <result column="default_wh_name" property="defaultWhName"/>
-        <result column="grade_code" property="gradeCode"></result>
+        <result column="flg_init" property="flgInit"/>
+        <result column="grade_code" property="gradeCode"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -80,6 +81,9 @@
             <if test="hrStatus != null">
                 AND t.hr_status = #{hrStatus}
             </if>
+            <if test="flgInit != null">
+                AND t.flg_init = #{flgInit}
+            </if>
             <if test="roleIds != null and roleIds.size()>0">
                 AND t.role_ids &amp;&amp;
                 #{roleIds, typeHandler=UuidListTypeHandler}

+ 14 - 0
src/main/java/com/dk/mdm/mapper/report/ReportMapper.java

@@ -258,4 +258,18 @@ public interface ReportMapper extends BaseMapper<JSONObject> {
      * @date   : 2024/5/10 10:37
      */
     List<Map<String, Object>> getMacPayCurrentItemReport(Map param);
+
+    /**
+     * @desc   : 根据用户信息和筛选信息查询账款明细
+     * @author : 刘尧
+     * @date   : 2024/6/5 17:25
+     * */
+    List<Map<String, Object>> getCusRecPayReportItemByUser(Map params);
+
+    /**
+     * @desc   : 查询用户欠款
+     * @author : 刘尧
+     * @date   : 2024/6/5 17:28
+     * */
+    List<Map<String, Object>> getUserArrears(Map params);
 }

+ 149 - 65
src/main/java/com/dk/mdm/mapper/report/ReportMapper.xml

@@ -463,6 +463,7 @@
                 tpi.into_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 tmc.address_full LIKE concat('%',my_ex.likequery(#{searchText}),'%')
                 )
             </if>
             <if test="whList != null  and whList.size()>0">
@@ -1644,8 +1645,7 @@
     </select>
 
     <select id="getSalesTrackingReportDetail"  resultType="java.util.Map">
-        SELECT T
-                   ."id",
+        SELECT T."id",
                T."no",
                T."itemId",
                T."type",
@@ -2592,323 +2592,323 @@
     <select id="getReportBatch" resultType="Map">
         <!-- 我的页面 助手部分 -->
         <if test="param.type == 'f_my_sale_info'">
-            select f_my_sale_info as report from "dkic_b"."f_my_sale_info"(#{param.cpId}, #{param.orgId}, #{param.userId},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'))
+            select f_my_sale_info as report from "dkic_b"."f_my_sale_info"(#{param.cpId}, #{param.orgId}, #{param.userId, typeHandler=UuidTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'))
         </if>
 
         <!-- 我的页面 销售业务进度 月 -->
         <if test="param.type == 'f_kpi_order_rate_month'">
-            select f_kpi_order_rate_month as report from "dkic_b"."f_kpi_order_rate_month"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId})
+            select f_kpi_order_rate_month as report from "dkic_b"."f_kpi_order_rate_month"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
         <!-- 我的页面 销售业务进度 年 -->
         <if test="param.type == 'f_kpi_order_rate_year'">
-            select f_kpi_order_rate_year as report from "dkic_b"."f_kpi_order_rate_year"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId})
+            select f_kpi_order_rate_year as report from "dkic_b"."f_kpi_order_rate_year"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
         <!-- 我的页面 收款任务进度 月 -->
         <if test="param.type == 'f_kpi_repay_rate_month'">
-            select f_kpi_repay_rate_month as report from "dkic_b"."f_kpi_repay_rate_month"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId})
+            select f_kpi_repay_rate_month as report from "dkic_b"."f_kpi_repay_rate_month"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
         <!-- 我的页面 收款任务进度 年 -->
         <if test="param.type == 'f_kpi_repay_rate_year'">
-            select f_kpi_repay_rate_year as report from "dkic_b"."f_kpi_repay_rate_year"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId})
+            select f_kpi_repay_rate_year as report from "dkic_b"."f_kpi_repay_rate_year"(to_date(#{param.rateDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgId},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 销售分析 -->
         <if test="param.type == 'f_report_order_analysis_home'">
-            select f_report_order_analysis_home as report from "dkic_b"."f_report_order_analysis_home"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_order_analysis_home as report from "dkic_b"."f_report_order_analysis_home"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
         <!-- 报表页面 收款分析 -->
         <if test="param.type == 'f_report_repay_analysis'">
-            select f_report_repay_analysis as report from "dkic_b"."f_report_repay_analysis"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_repay_analysis as report from "dkic_b"."f_report_repay_analysis"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
         <!-- 报表页面 客户分析 -->
         <if test="param.type == 'f_report_csm_analysis_home'">
-            select f_report_csm_analysis_home as report from "dkic_b"."f_report_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_analysis_home as report from "dkic_b"."f_report_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
 
         <!-- 图形部分 -->
         <!-- 报表页面 客户来源分布 -->
         <if test="param.type == 'f_report_csm_from_order'">
-            select f_report_csm_from_order as report from "dkic_b"."f_report_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_from_order as report from "dkic_b"."f_report_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 产品分布 -->
         <if test="param.type == 'f_report_spu_analysis'">
-            select f_report_spu_analysis as report from "dkic_b"."f_report_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_spu_analysis as report from "dkic_b"."f_report_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 部门成交 -->
         <if test="param.type == 'f_report_index_org_order'">
-            select f_report_index_org_order as report from "dkic_b"."f_report_index_org_order"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_index_org_order as report from "dkic_b"."f_report_index_org_order"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 部门收款 -->
         <if test="param.type == 'f_report_index_org_repay'">
-            select f_report_index_org_repay as report from "dkic_b"."f_report_index_org_repay"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_index_org_repay as report from "dkic_b"."f_report_index_org_repay"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 业务员成交 -->
         <if test="param.type == 'f_report_index_staff_order'">
-            select f_report_index_staff_order as report from "dkic_b"."f_report_index_staff_order"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_index_staff_order as report from "dkic_b"."f_report_index_staff_order"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 报表页面 业务员收款 -->
         <if test="param.type == 'f_report_index_staff_repay'">
-            select f_report_index_staff_repay as report from "dkic_b"."f_report_index_staff_repay"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_index_staff_repay as report from "dkic_b"."f_report_index_staff_repay"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 明细页面 收款分析-收款任务 f_report_index_org_repay 部分收款同一个函数-->
 
         <!-- 明细页面 收款分析-欠款情况 -->
         <if test="param.type == 'f_report_repay_debt'">
-            select f_report_repay_debt as report from "dkic_b"."f_report_repay_debt"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.userId})
+            select f_report_repay_debt as report from "dkic_b"."f_report_repay_debt"(to_date(#{param.monthDate},'yyyy-MM-dd'),#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 明细页面 客户分析-报价 -->
         <if test="param.type == 'f_report_csm_analysis_offer'">
-            select f_report_csm_analysis_offer as report from "dkic_b"."f_report_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_analysis_offer as report from "dkic_b"."f_report_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 明细页面 客户分析-成交 -->
         <if test="param.type == 'f_report_csm_analysis_order'">
-            select f_report_csm_analysis_order as report from "dkic_b"."f_report_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_analysis_order as report from "dkic_b"."f_report_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 明细页面 客户来源分布-报价 -->
         <if test="param.type == 'f_report_csm_from_offer'">
-            select f_report_csm_from_offer as report from "dkic_b"."f_report_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_from_offer as report from "dkic_b"."f_report_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <!-- 明细页面 客户来源分布-潜客 -->
         <if test="param.type == 'f_report_csm_from_filing'">
-            select f_report_csm_from_filing as report from "dkic_b"."f_report_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_csm_from_filing as report from "dkic_b"."f_report_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
 
         <!-- 明细页面 销售分析5个 第一个就是部门成交-->
 
         <if test="param.type == 'f_report_order_analysis_reject'">
-            select f_report_order_analysis_reject as report from "dkic_b"."f_report_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_order_analysis_reject as report from "dkic_b"."f_report_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <if test="param.type == 'f_report_order_analysis_csm'">
-            select f_report_order_analysis_csm as report from "dkic_b"."f_report_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_order_analysis_csm as report from "dkic_b"."f_report_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <if test="param.type == 'f_report_order_analysis_activity'">
-            select f_report_order_analysis_activity as report from "dkic_b"."f_report_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_order_analysis_activity as report from "dkic_b"."f_report_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
         <if test="param.type == 'f_report_order_analysis_specs'">
-            select f_report_order_analysis_specs as report from "dkic_b"."f_report_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId})
+            select f_report_order_analysis_specs as report from "dkic_b"."f_report_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler})
         </if>
 
 
         <!--订单参考利润-->
         <if test="param.type == 'f_report_s201_sale_reference_profit'">
-            select f_report_s201_sale_reference_profit as report from "dkic_b"."f_report_s201_sale_reference_profit"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s201_sale_reference_profit as report from "dkic_b"."f_report_s201_sale_reference_profit"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!--出库参考利润-->
         <if test="param.type == 'f_report_s201_out_reference_profit'">
-            select f_report_s201_out_reference_profit as report from "dkic_b"."f_report_s201_out_reference_profit"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s201_out_reference_profit as report from "dkic_b"."f_report_s201_out_reference_profit"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
 
         <!-- 报表页面 销售分析 -->
         <if test="param.type == 'f_report_s001_order_analysis_home'">
-            select f_report_s001_order_analysis_home as report from "dkic_b"."f_report_s001_order_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_order_analysis_home as report from "dkic_b"."f_report_s001_order_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
         <!-- 报表页面 收款分析 -->
         <if test="param.type == 'f_report_s001_repay_analysis'">
-            select f_report_s001_repay_analysis as report from "dkic_b"."f_report_s001_repay_analysis"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_repay_analysis as report from "dkic_b"."f_report_s001_repay_analysis"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
         <!-- 报表页面 客户分析 -->
         <if test="param.type == 'f_report_s001_csm_analysis_home'">
-            select f_report_s001_csm_analysis_home as report from "dkic_b"."f_report_s001_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_analysis_home as report from "dkic_b"."f_report_s001_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 图形部分 -->
         <!-- 报表页面 客户来源分布 -->
         <if test="param.type == 'f_report_s001_csm_from_order'">
-            select f_report_s001_csm_from_order as report from "dkic_b"."f_report_s001_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_from_order as report from "dkic_b"."f_report_s001_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 产品分布 -->
         <if test="param.type == 'f_report_s001_spu_analysis'">
-            select f_report_s001_spu_analysis as report from "dkic_b"."f_report_s001_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_spu_analysis as report from "dkic_b"."f_report_s001_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 部门成交 -->
         <if test="param.type == 'f_report_s001_index_org_order'">
-            select f_report_s001_index_org_order as report from "dkic_b"."f_report_s001_index_org_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_index_org_order as report from "dkic_b"."f_report_s001_index_org_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 部门收款 -->
         <if test="param.type == 'f_report_s001_index_org_repay'">
-            select f_report_s001_index_org_repay as report from "dkic_b"."f_report_s001_index_org_repay"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_index_org_repay as report from "dkic_b"."f_report_s001_index_org_repay"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 业务员成交 -->
         <if test="param.type == 'f_report_s001_index_staff_order'">
-            select f_report_s001_index_staff_order as report from "dkic_b"."f_report_s001_index_staff_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_index_staff_order as report from "dkic_b"."f_report_s001_index_staff_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 业务员收款 -->
         <if test="param.type == 'f_report_s001_index_staff_repay'">
-            select f_report_s001_index_staff_repay as report from "dkic_b"."f_report_s001_index_staff_repay"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_index_staff_repay as report from "dkic_b"."f_report_s001_index_staff_repay"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 收款分析-收款任务 f_report_s001_index_org_repay 部分收款同一个函数-->
 
         <!-- 明细页面 收款分析-欠款情况 -->
         <if test="param.type == 'f_report_s001_repay_debt'">
-            select f_report_s001_repay_debt as report from "dkic_b"."f_report_s001_repay_debt"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_repay_debt as report from "dkic_b"."f_report_s001_repay_debt"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户分析-报价 -->
         <if test="param.type == 'f_report_s001_csm_analysis_offer'">
-            select f_report_s001_csm_analysis_offer as report from "dkic_b"."f_report_s001_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_analysis_offer as report from "dkic_b"."f_report_s001_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户分析-成交 -->
         <if test="param.type == 'f_report_s001_csm_analysis_order'">
-            select f_report_s001_csm_analysis_order as report from "dkic_b"."f_report_s001_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_analysis_order as report from "dkic_b"."f_report_s001_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户来源分布-报价 -->
         <if test="param.type == 'f_report_s001_csm_from_offer'">
-            select f_report_s001_csm_from_offer as report from "dkic_b"."f_report_s001_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_from_offer as report from "dkic_b"."f_report_s001_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户来源分布-潜客 -->
         <if test="param.type == 'f_report_s001_csm_from_filing'">
-            select f_report_s001_csm_from_filing as report from "dkic_b"."f_report_s001_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_csm_from_filing as report from "dkic_b"."f_report_s001_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 明细页面 销售分析5个 第一个就是部门成交-->
 
         <if test="param.type == 'f_report_s001_order_analysis_reject'">
-            select f_report_s001_order_analysis_reject as report from "dkic_b"."f_report_s001_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_order_analysis_reject as report from "dkic_b"."f_report_s001_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s001_order_analysis_csm'">
-            select f_report_s001_order_analysis_csm as report from "dkic_b"."f_report_s001_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_order_analysis_csm as report from "dkic_b"."f_report_s001_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s001_order_analysis_activity'">
-            select f_report_s001_order_analysis_activity as report from "dkic_b"."f_report_s001_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_order_analysis_activity as report from "dkic_b"."f_report_s001_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s001_order_analysis_specs'">
-            select f_report_s001_order_analysis_specs as report from "dkic_b"."f_report_s001_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s001_order_analysis_specs as report from "dkic_b"."f_report_s001_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- s002部分 -->
         <!-- 报表页面 销售分析 -->
         <if test="param.type == 'f_report_s002_order_analysis_home'">
-            select f_report_s002_order_analysis_home as report from "dkic_b"."f_report_s002_order_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_order_analysis_home as report from "dkic_b"."f_report_s002_order_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
         <!-- 报表页面 收款分析 -->
         <if test="param.type == 'f_report_s002_repay_analysis'">
-            select f_report_s002_repay_analysis as report from "dkic_b"."f_report_s002_repay_analysis"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_repay_analysis as report from "dkic_b"."f_report_s002_repay_analysis"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
         <!-- 报表页面 客户分析 -->
         <if test="param.type == 'f_report_s002_csm_analysis_home'">
-            select f_report_s002_csm_analysis_home as report from "dkic_b"."f_report_s002_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_analysis_home as report from "dkic_b"."f_report_s002_csm_analysis_home"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 图形部分 -->
         <!-- 报表页面 客户来源分布 -->
         <if test="param.type == 'f_report_s002_csm_from_order'">
-            select f_report_s002_csm_from_order as report from "dkic_b"."f_report_s002_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_from_order as report from "dkic_b"."f_report_s002_csm_from_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 产品分布 -->
         <if test="param.type == 'f_report_s002_spu_analysis'">
-            select f_report_s002_spu_analysis as report from "dkic_b"."f_report_s002_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_spu_analysis as report from "dkic_b"."f_report_s002_spu_analysis"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 报表页面 业务员成交 -->
         <if test="param.type == 'f_report_s002_index_staff_order'">
-            select f_report_s002_index_staff_order as report from "dkic_b"."f_report_s002_index_staff_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_index_staff_order as report from "dkic_b"."f_report_s002_index_staff_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 报表页面 业务员收款 -->
         <if test="param.type == 'f_report_s002_index_staff_repay'">
-            select f_report_s002_index_staff_repay as report from "dkic_b"."f_report_s002_index_staff_repay"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_index_staff_repay as report from "dkic_b"."f_report_s002_index_staff_repay"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 明细页面 收款分析-欠款情况 -->
         <if test="param.type == 'f_report_s002_repay_debt'">
-            select f_report_s002_repay_debt as report from "dkic_b"."f_report_s002_repay_debt"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_repay_debt as report from "dkic_b"."f_report_s002_repay_debt"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户分析-报价 -->
         <if test="param.type == 'f_report_s002_csm_analysis_offer'">
-            select f_report_s002_csm_analysis_offer as report from "dkic_b"."f_report_s002_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_analysis_offer as report from "dkic_b"."f_report_s002_csm_analysis_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户分析-成交 -->
         <if test="param.type == 'f_report_s002_csm_analysis_order'">
-            select f_report_s002_csm_analysis_order as report from "dkic_b"."f_report_s002_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_analysis_order as report from "dkic_b"."f_report_s002_csm_analysis_order"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户来源分布-报价 -->
         <if test="param.type == 'f_report_s002_csm_from_offer'">
-            select f_report_s002_csm_from_offer as report from "dkic_b"."f_report_s002_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_from_offer as report from "dkic_b"."f_report_s002_csm_from_offer"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 明细页面 客户来源分布-潜客 -->
         <if test="param.type == 'f_report_s002_csm_from_filing'">
-            select f_report_s002_csm_from_filing as report from "dkic_b"."f_report_s002_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_csm_from_filing as report from "dkic_b"."f_report_s002_csm_from_filing"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
 
         <!-- 明细页面 销售分析5个 第一个就是部门成交-->
 
         <if test="param.type == 'f_report_s002_order_analysis_reject'">
-            select f_report_s002_order_analysis_reject as report from "dkic_b"."f_report_s002_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_order_analysis_reject as report from "dkic_b"."f_report_s002_order_analysis_reject"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s002_order_analysis_csm'">
-            select f_report_s002_order_analysis_csm as report from "dkic_b"."f_report_s002_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_order_analysis_csm as report from "dkic_b"."f_report_s002_order_analysis_csm"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s002_order_analysis_activity'">
-            select f_report_s002_order_analysis_activity as report from "dkic_b"."f_report_s002_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_order_analysis_activity as report from "dkic_b"."f_report_s002_order_analysis_activity"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <if test="param.type == 'f_report_s002_order_analysis_specs'">
-            select f_report_s002_order_analysis_specs as report from "dkic_b"."f_report_s002_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s002_order_analysis_specs as report from "dkic_b"."f_report_s002_order_analysis_specs"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 销售分析 -->
         <!-- 部门品类排行 -->
         <if test="param.type == 'f_report_s003_kpi_org_category'">
-            select f_report_s003_kpi_org_category as report from "dkic_b"."f_report_s003_kpi_org_category"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s003_kpi_org_category as report from "dkic_b"."f_report_s003_kpi_org_category"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 部门单品排行 -->
         <if test="param.type == 'f_report_s003_kpi_org_spu'">
-            select f_report_s003_kpi_org_spu as report from "dkic_b"."f_report_s003_kpi_org_spu"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s003_kpi_org_spu as report from "dkic_b"."f_report_s003_kpi_org_spu"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 业务员品类排行 -->
         <if test="param.type == 'f_report_s003_kpi_staff_category'">
-            select f_report_s003_kpi_staff_category as report from "dkic_b"."f_report_s003_kpi_staff_category"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s003_kpi_staff_category as report from "dkic_b"."f_report_s003_kpi_staff_category"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
 
         <!-- 业务员单品排行 -->
         <if test="param.type == 'f_report_s003_kpi_staff_spu'">
-            select f_report_s003_kpi_staff_spu as report from "dkic_b"."f_report_s003_kpi_staff_spu"(#{param.cpId},#{param.orgIds,typeHandler=IntListTypeHandler},#{param.staffIds,typeHandler=IntListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId},#{param.dateType})
+            select f_report_s003_kpi_staff_spu as report from "dkic_b"."f_report_s003_kpi_staff_spu"(#{param.cpId},#{param.orgIds,typeHandler=UuidListTypeHandler},#{param.staffIds,typeHandler=UuidListTypeHandler},to_date(#{param.beginDate},'yyyy-MM-dd'),to_date(#{param.endDate},'yyyy-MM-dd'),#{param.userId, typeHandler=UuidTypeHandler},#{param.dateType})
         </if>
     </select>
 
@@ -2933,5 +2933,89 @@
         select dkic_b.f_query_mac_pay_current_item(#{cpId},#{objectId} ::uuid,#{orgId} ::uuid,#{macType},#{accDateStart} ::date
                    ,#{accDateEnd} ::date,#{i18n} ,#{currentPage},#{pageSize})
     </select>
+    <select id="getCusRecPayReportItemByUser" resultType="java.util.Map">
+        SELECT a.object_id as "objectId"
+        , a.biznis_no as "biznisNo"
+        , COALESCE(SUM(tpo.out_amt), 0) as "outAmt"
+        , COALESCE(SUM(tpo.return_amt), 0) as "returnAmt"
+        , COALESCE(SUM(tmrp.sum_amt_rec), 0) as "sumAmtRec"
+        , a.acc_date as "accDate"
+        FROM
+            dkic_b.t_mac_account_item a
+                LEFT JOIN dkic_b.t_psi_outbound tpo ON tpo.out_id = a.biznis_id
+                LEFT JOIN dkic_b.t_mac_rec_pay tmrp ON tmrp.rp_id = a.biznis_id
+        WHERE a.flg_valid
+        <if test="objectId != null and objectId != ''">
+            AND a.object_id = #{objectId}::uuid
+        </if>
+        <if test="staffId != null and staffId != ''">
+            AND a.staff_id = #{staffId}::uuid
+        </if>
+        <if test="orgId != null and orgId != ''">
+            AND a.org_id = #{orgId}::uuid
+        </if>
+        <if test="makeTimeStart != null and makeTi8meStart != ''">
+            AND a.acc_date &gt;= #{makeTimeStart}::timestamp with time zone
+        </if>
+        <if test="makeTimeEnd != null and makeTimeEnd != ''">
+            AND a.acc_date &lt;= #{makeTimeStart}::timestamp with time zone
+        </if>
+        <if test="staffIds != null and staffIds.size() > 0">
+            AND a.staff_id IN
+            <foreach collection="staffIds" index="index" item="item" separator="," open="(" close=")">
+                #{item}::uuid
+            </foreach>
+        </if>
+        <if test="orgIds != null and orgIds.size() > 0">
+            AND a.org_id IN
+            <foreach collection="orgIds" index="index" item="item" separator="," open="(" close=")">
+                #{item}::uuid
+            </foreach>
+        </if>
+        <if test="recTypeIds != null and recTypeIds.size() > 0">
+            <foreach collection="recTypeIds" item="item">
+                <if test="item != null and item != '' and item == '收支类型-出库'">
+                    AND tpo.out_amt &gt; 0
+                </if>
+                <if test="item != null and item != '' and item == '收支类型-退货'">
+                    AND tpo.out_amt &lt; 0
+                </if>
+                <if test="item != null and item != '' and item == '收支类型-收款'">
+                    AND tmrp.sum_amt_rec &gt; 0
+                </if>
+                <if test="item != null and item != '' and item == '收支类型-退款'">
+                    AND tmrp.sum_amt_rec &lt; 0
+                </if>
+            </foreach>
+        </if>
+        group by a.object_id, a.biznis_no, a.acc_date, a.staff_id
+    </select>
+
+    <select id="getUserArrears" resultType="java.util.Map">
+        SELECT a.object_id as "objectId"
+        , tmc.cus_name as "cusName"
+        , tmc.cus_phone as "cusPhone"
+        , SUM(COALESCE(tpo.out_amt, 0) + COALESCE(tpo.return_amt, 0)) - SUM(COALESCE(tmrp.sum_amt_rec, 0)) as arrears
+        FROM
+        dkic_b.t_mac_account_item a
+        LEFT JOIN dkic_b.t_psi_outbound tpo ON tpo.out_id = a.biznis_id
+        LEFT JOIN dkic_b.t_mac_rec_pay tmrp ON tmrp.rp_id = a.biznis_id
+        LEFT JOIN dkic_b.t_mst_customer tmc ON tmc.cus_id = a.object_id
+        WHERE a.flg_valid
+        AND tmc.cus_name IS NOT NULL AND tmc.cus_name != ''
+        GROUP BY a.object_id, tmc.cus_name, tmc.cus_phone, tmc.address_full
+        HAVING SUM(COALESCE(tpo.out_amt, 0) + COALESCE(tpo.return_amt, 0)) - SUM(COALESCE(tmrp.sum_amt_rec, 0)) > 0
+        <if test="objectId != null">
+            AND a.object_id = #{objectId}::uuid
+        </if>
+        <if test="searchText != null and searchText != ''">
+            AND (tmc.cus_name LIKE concat('%',#{searchText},'%')
+            OR tmc.cus_phone LIKE concat('%',#{searchText},'%')
+            OR tmc.address_full LIKE concat('%',#{searchText},'%'))
+        </if>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            LIMIT #{pageSize} OFFSET #{currentPage}
+        </if>
+    </select>
 
 </mapper>

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

@@ -9,83 +9,95 @@
         , order_id, item_index, sku_id, sub_unit_id, unit_id,pack_box,box, piece,
         sys.f_remove_zero(item_qty) as item_qty, price_std, amt_std, price_sale, item_amt, price_discount, non_std_code, out_status,
         sys.f_remove_zero(outing_qty) as outing_qty, outing_amt, sys.f_remove_zero(out_qty) as out_qty, out_amt,
-        sys.f_remove_zero(return_qty) as return_qty, return_amt, remarks, flg_valid, cp_id, wh_id
+        sys.f_remove_zero(return_qty) as return_qty, return_amt, remarks, flg_valid, cp_id, wh_id,
+        fact_price,fact_amt,disc_amt,use_place,discount
     </sql>
 
     <sql id="Base_Column_List_Response">
         t.item_id, t.order_id, t.item_index, t.sku_id, sys.f_remove_zero(t.item_qty) as item_qty, t.price_std, t.amt_std, t.price_sale, t.item_amt, t.price_discount, t.non_std_code,
         t.out_status, sys.f_remove_zero(t.outing_qty) as outing_qty, t.outing_amt, sys.f_remove_zero(t.out_qty) as out_qty, t.out_amt,
         sys.f_remove_zero(t.return_qty) as return_qty, t.return_amt, t.remarks, t.flg_valid, t.cp_id, t.wh_id
-        ,t.box,t.piece,t.sub_unit_id,t.unit_id,t.pack_box
+        ,t.box,t.piece,t.sub_unit_id,t.unit_id,t.pack_box,
+        t.fact_price,t.fact_amt,t.disc_amt,t,use_place,t.discount
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.sale.OrderItem">
         <id column="item_id" property="itemId"/>
-                <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
-                <result column="item_index" property="itemIndex"/>
-                <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
-                <result column="unit_id" property="unitId" typeHandler="UuidTypeHandler"/>
-                <result column="sub_unit_id" property="subUnitId" typeHandler="UuidTypeHandler"/>
-                <result column="pack_box" property="packBox"/>
-                <result column="box" property="box"/>
-                <result column="piece" property="piece"/>
-                <result column="item_qty" property="itemQty"/>
-                <result column="price_std" property="priceStd"/>
-                <result column="amt_std" property="amtStd"/>
-                <result column="price_sale" property="priceSale"/>
-                <result column="item_amt" property="itemAmt"/>
-                <result column="price_discount" property="priceDiscount"/>
-                <result column="non_std_code" property="nonStdCode"/>
-                <result column="out_status" property="outStatus"/>
-                <result column="outing_qty" property="outingQty"/>
-                <result column="outing_amt" property="outingAmt"/>
-                <result column="out_qty" property="outQty"/>
-                <result column="out_amt" property="outAmt"/>
-                <result column="return_qty" property="returnQty"/>
-                <result column="return_amt" property="returnAmt"/>
-                <result column="remarks" property="remarks"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
-                <result column="wh_id" property="whId"/>
+        <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
+        <result column="item_index" property="itemIndex"/>
+        <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
+        <result column="unit_id" property="unitId" typeHandler="UuidTypeHandler"/>
+        <result column="sub_unit_id" property="subUnitId" typeHandler="UuidTypeHandler"/>
+        <result column="pack_box" property="packBox"/>
+        <result column="box" property="box"/>
+        <result column="piece" property="piece"/>
+        <result column="item_qty" property="itemQty"/>
+        <result column="price_std" property="priceStd"/>
+        <result column="amt_std" property="amtStd"/>
+        <result column="price_sale" property="priceSale"/>
+        <result column="item_amt" property="itemAmt"/>
+        <result column="price_discount" property="priceDiscount"/>
+        <result column="non_std_code" property="nonStdCode"/>
+        <result column="out_status" property="outStatus"/>
+        <result column="outing_qty" property="outingQty"/>
+        <result column="outing_amt" property="outingAmt"/>
+        <result column="out_qty" property="outQty"/>
+        <result column="out_amt" property="outAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="wh_id" property="whId"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
+        <result column="fact_price" property="factPrice"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="disc_amt" property="discAmt"/>
+        <result column="use_place" property="usePlace"/>
+        <result column="discount" property="discount"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.sale.OrderItemResponse">
         <id column="item_id" property="itemId"/>
-                <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
-                <result column="item_index" property="itemIndex"/>
-                <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
-                <result column="unit_id" property="unitId" typeHandler="UuidTypeHandler"/>
-                <result column="sub_unit_id" property="subUnitId" typeHandler="UuidTypeHandler"/>
-                <result column="pack_box" property="packBox"/>
-                <result column="item_qty" property="itemQty"/>
-                <result column="price_std" property="priceStd"/>
-                <result column="amt_std" property="amtStd"/>
-                <result column="price_sale" property="priceSale"/>
-                <result column="item_amt" property="itemAmt"/>
-                <result column="price_discount" property="priceDiscount"/>
-                <result column="non_std_code" property="nonStdCode"/>
-                <result column="out_status" property="outStatus"/>
-                <result column="outing_qty" property="outingQty"/>
-                <result column="outing_amt" property="outingAmt"/>
-                <result column="out_qty" property="outQty"/>
-                <result column="out_amt" property="outAmt"/>
-                <result column="return_qty" property="returnQty"/>
-                <result column="return_amt" property="returnAmt"/>
-                <result column="remarks" property="remarks"/>
-                <result column="flg_valid" property="flgValid"/>
-                <result column="cp_id" property="cpId"/>
-                <result column="wh_id" property="whId"/>
-                <result column="wh_name" property="whName"/>
-                <result column="order_no" property="orderNo"/>
+        <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
+        <result column="item_index" property="itemIndex"/>
+        <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
+        <result column="unit_id" property="unitId" typeHandler="UuidTypeHandler"/>
+        <result column="sub_unit_id" property="subUnitId" typeHandler="UuidTypeHandler"/>
+        <result column="pack_box" property="packBox"/>
+        <result column="item_qty" property="itemQty"/>
+        <result column="price_std" property="priceStd"/>
+        <result column="amt_std" property="amtStd"/>
+        <result column="price_sale" property="priceSale"/>
+        <result column="item_amt" property="itemAmt"/>
+        <result column="price_discount" property="priceDiscount"/>
+        <result column="non_std_code" property="nonStdCode"/>
+        <result column="out_status" property="outStatus"/>
+        <result column="outing_qty" property="outingQty"/>
+        <result column="outing_amt" property="outingAmt"/>
+        <result column="out_qty" property="outQty"/>
+        <result column="out_amt" property="outAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="wh_id" property="whId"/>
+        <result column="wh_name" property="whName"/>
+        <result column="order_no" property="orderNo"/>
         <result column="brand_name" property="brandName"/>
         <result column="short_name" property="shortName"/>
         <result column="sku_images" property="skuImages" typeHandler="JsonTypeHandler"/>
-                <result column="transferableQuantity" property="transferableQuantity"/>
-                <result column="skuImages" property="skuImages" typeHandler="JsonTypeHandler"/>
+        <result column="transferableQuantity" property="transferableQuantity"/>
+        <result column="skuImages" property="skuImages" typeHandler="JsonTypeHandler"/>
         <result column="decimalPlaces" property="decimalPlaces"/>
+        <result column="fact_price" property="factPrice"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="disc_amt" property="discAmt"/>
+        <result column="use_place" property="usePlace"/>
+        <result column="discount" property="discount"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -184,6 +196,11 @@
                t.price_sale,
                t.item_amt,
                t.price_discount,
+               t.fact_price,
+               t.fact_amt,
+               t.disc_amt,
+               t.use_place,
+               t.discount,
                t.non_std_code,
                t.out_status,
         sys.f_remove_zero(t.outing_qty) as outing_qty,
@@ -496,6 +513,21 @@
             <if test=" et!=null and et.cpId != null">
                 cp_id = #{et.cpId,jdbcType=INTEGER},
             </if>
+            <if test=" et!=null and et.cpId != null">
+                fact_price = #{et.factPrice,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.cpId != null">
+                fact_amt = #{et.factAmt,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.cpId != null">
+                disc_amt = #{et.discAmt,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.usePlace != null">
+                use_place = #{et.usePlace,jdbcType=VARCHAR},
+            </if>
+            <if test=" et!=null and et.discount != null">
+                discount = #{et.discount,jdbcType=VARCHAR},
+            </if>
         </set>
         where item_id = #{et.itemId,typeHandler=UuidTypeHandler}
         and item_qty >=(out_qty + outing_qty)
@@ -601,6 +633,11 @@
         t.price_sale,
         t.item_amt,
         t.price_discount,
+        t.fact_price,
+        t.fact_amt,
+        t.disc_amt,
+        t.use_place,
+        t.discount,
         t.non_std_code,
         t.out_status,
         sys.f_remove_zero(t.outing_qty) as outing_qty,

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

@@ -9,100 +9,111 @@
         address_full, contact_name, contact_phone, sales_channel, delivery_date, sys.f_remove_zero(sum_quantity) as sum_quantity,
         sum_standard, sum_amount, sale_discount, order_status, out_status, sys.f_remove_zero(outing_qty) as outing_qty, outing_amt,
         sys.f_remove_zero(out_qty) as out_qty, out_amt, sys.f_remove_zero(return_qty) as return_qty, return_amt, amt_receivable,
-        amt_handle, amt_residue, remarks, annex_paths, make_staff, make_time, flg_valid, cp_id
+        amt_handle, amt_residue, remarks, annex_paths, make_staff, make_time, flg_valid, cp_id,
+        fact_amt,disc_amt,discount,flg_auto_handle,flg_handle_setting
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.sale.Order">
         <id column="order_id" property="orderId"/>
-            <result column="order_no" property="orderNo"/>
-            <result column="order_type" property="orderType"/>
-            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
-            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
-            <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
-            <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
-            <result column="address_name" property="addressName"/>
-            <result column="address_no" property="addressNo"/>
-            <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
-            <result column="address_full" property="addressFull"/>
-            <result column="contact_name" property="contactName"/>
-            <result column="contact_phone" property="contactPhone"/>
-            <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
-            <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
-            <result column="sum_quantity" property="sumQuantity"/>
-            <result column="sum_standard" property="sumStandard"/>
-            <result column="sum_amount" property="sumAmount"/>
-            <result column="sale_discount" property="saleDiscount"/>
-            <result column="order_status" property="orderStatus"/>
-            <result column="out_status" property="outStatus"/>
-            <result column="outing_qty" property="outingQty"/>
-            <result column="outing_amt" property="outingAmt"/>
-            <result column="out_qty" property="outQty"/>
-            <result column="out_amt" property="outAmt"/>
-            <result column="return_qty" property="returnQty"/>
-            <result column="return_amt" property="returnAmt"/>
-            <result column="amt_receivable" property="amtReceivable"/>
-            <result column="amt_handle" property="amtHandle"/>
-            <result column="amt_residue" property="amtResidue"/>
-            <result column="remarks" property="remarks"/>
-            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
-            <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="order_no" property="orderNo"/>
+        <result column="order_type" property="orderType"/>
+        <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+        <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+        <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
+        <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
+        <result column="address_name" property="addressName"/>
+        <result column="address_no" property="addressNo"/>
+        <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
+        <result column="address_full" property="addressFull"/>
+        <result column="contact_name" property="contactName"/>
+        <result column="contact_phone" property="contactPhone"/>
+        <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
+        <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
+        <result column="sum_quantity" property="sumQuantity"/>
+        <result column="sum_standard" property="sumStandard"/>
+        <result column="sum_amount" property="sumAmount"/>
+        <result column="sale_discount" property="saleDiscount"/>
+        <result column="order_status" property="orderStatus"/>
+        <result column="out_status" property="outStatus"/>
+        <result column="outing_qty" property="outingQty"/>
+        <result column="outing_amt" property="outingAmt"/>
+        <result column="out_qty" property="outQty"/>
+        <result column="out_amt" property="outAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="amt_receivable" property="amtReceivable"/>
+        <result column="amt_handle" property="amtHandle"/>
+        <result column="amt_residue" property="amtResidue"/>
+        <result column="remarks" property="remarks"/>
+        <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+        <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="fact_amt" property="factAmt"/>
+        <result column="disc_amt" property="discAmt"/>
+        <result column="discount" property="discount"/>
+        <result column="flg_auto_handle" property="flgAutoHandle"/>
+        <result column="flg_handle_setting" property="flgHandleSetting"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.sale.OrderResponse">
         <id column="order_id" property="orderId"/>
-            <result column="order_no" property="orderNo"/>
-            <result column="order_type" property="orderType"/>
-            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
-            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
-            <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
-            <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
-            <result column="address_name" property="addressName"/>
-            <result column="orgName" property="orgName"/>
-            <result column="orderTypeName" property="orderTypeName"/>
-            <result column="staffName" property="staffName"/>
-            <result column="cusCode" property="cusCode"/>
-            <result column="cusName" property="cusName"/>
-            <result column="cusPhone" property="cusPhone"/>
-            <result column="cusFrom" property="cusFrom"/>
-            <result column="cusFromName" property="cusFromName"/>
-            <result column="channelName" property="channelName"/>
-            <result column="orderStatusName" property="orderStatusName"/>
-            <result column="outStatusName" property="outStatusName"/>
-            <result column="makeStaffName" property="makeStaffName"/>
-            <result column="address_no" property="addressNo"/>
-            <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
-            <result column="address_full" property="addressFull"/>
-            <result column="contact_name" property="contactName"/>
-            <result column="contact_phone" property="contactPhone"/>
-            <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
-            <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
-            <result column="sum_quantity" property="sumQuantity"/>
-            <result column="sum_standard" property="sumStandard"/>
-            <result column="sum_amount" property="sumAmount"/>
-            <result column="sale_discount" property="saleDiscount"/>
-            <result column="order_status" property="orderStatus"/>
-            <result column="out_status" property="outStatus"/>
-            <result column="outing_qty" property="outingQty"/>
-            <result column="outing_amt" property="outingAmt"/>
-            <result column="out_qty" property="outQty"/>
-            <result column="out_amt" property="outAmt"/>
-            <result column="return_qty" property="returnQty"/>
-            <result column="return_amt" property="returnAmt"/>
-            <result column="amt_receivable" property="amtReceivable"/>
-            <result column="amt_handle" property="amtHandle"/>
-            <result column="amt_residue" property="amtResidue"/>
-            <result column="remarks" property="remarks"/>
-            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
-            <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="orderItemResponseList" property="orderItemResponseList" typeHandler="JsonTypeHandler"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="order_type" property="orderType"/>
+        <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+        <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+        <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
+        <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
+        <result column="address_name" property="addressName"/>
+        <result column="orgName" property="orgName"/>
+        <result column="orderTypeName" property="orderTypeName"/>
+        <result column="staffName" property="staffName"/>
+        <result column="cusCode" property="cusCode"/>
+        <result column="cusName" property="cusName"/>
+        <result column="cusPhone" property="cusPhone"/>
+        <result column="cusFrom" property="cusFrom"/>
+        <result column="cusFromName" property="cusFromName"/>
+        <result column="channelName" property="channelName"/>
+        <result column="orderStatusName" property="orderStatusName"/>
+        <result column="outStatusName" property="outStatusName"/>
+        <result column="makeStaffName" property="makeStaffName"/>
+        <result column="address_no" property="addressNo"/>
+        <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
+        <result column="address_full" property="addressFull"/>
+        <result column="contact_name" property="contactName"/>
+        <result column="contact_phone" property="contactPhone"/>
+        <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
+        <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
+        <result column="sum_quantity" property="sumQuantity"/>
+        <result column="sum_standard" property="sumStandard"/>
+        <result column="sum_amount" property="sumAmount"/>
+        <result column="sale_discount" property="saleDiscount"/>
+        <result column="order_status" property="orderStatus"/>
+        <result column="out_status" property="outStatus"/>
+        <result column="outing_qty" property="outingQty"/>
+        <result column="outing_amt" property="outingAmt"/>
+        <result column="out_qty" property="outQty"/>
+        <result column="out_amt" property="outAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="amt_receivable" property="amtReceivable"/>
+        <result column="amt_handle" property="amtHandle"/>
+        <result column="amt_residue" property="amtResidue"/>
+        <result column="remarks" property="remarks"/>
+        <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+        <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="orderItemResponseList" property="orderItemResponseList" typeHandler="JsonTypeHandler"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="disc_amt" property="discAmt"/>
+        <result column="discount" property="discount"/>
+        <result column="flg_auto_handle" property="flgAutoHandle"/>
+        <result column="flg_handle_setting" property="flgHandleSetting"/>
 <!--            <collection property="orderItemResponseList" resultMap="orderItemListMap"  />-->
     </resultMap>
 
@@ -140,45 +151,44 @@
 
     <!--小程序用 查询销售订单带明细-->
     <resultMap id="BaseResultMapDetailResponse" type="com.dk.mdm.model.response.sale.OrderResponse">
-            <id column="order_id" property="orderId"/>
-            <result column="order_no" property="orderNo"/>
-            <result column="order_type" property="orderType"/>
-            <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
-            <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
-            <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
-            <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
-            <result column="address_name" property="addressName"/>
-            <result column="address_no" property="addressNo"/>
-            <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
-            <result column="address_full" property="addressFull"/>
-            <result column="contact_name" property="contactName"/>
-            <result column="contact_phone" property="contactPhone"/>
-            <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
-            <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
-            <result column="sum_quantity" property="sumQuantity"/>
-            <result column="sum_standard" property="sumStandard"/>
-            <result column="sum_amount" property="sumAmount"/>
-            <result column="sale_discount" property="saleDiscount"/>
-            <result column="order_status" property="orderStatus"/>
-            <result column="out_status" property="outStatus"/>
-            <result column="outing_qty" property="outingQty"/>
-            <result column="outing_amt" property="outingAmt"/>
-            <result column="out_qty" property="outQty"/>
-            <result column="out_amt" property="outAmt"/>
-            <result column="return_qty" property="returnQty"/>
-            <result column="return_amt" property="returnAmt"/>
-            <result column="amt_receivable" property="amtReceivable"/>
-            <result column="amt_handle" property="amtHandle"/>
-            <result column="amt_residue" property="amtResidue"/>
-            <result column="remarks" property="remarks"/>
-            <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
-            <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="org_name" property="orgName"/>
-            <result column="staff_name" property="staffName"/>
-
+        <id column="order_id" property="orderId"/>
+        <result column="order_no" property="orderNo"/>
+        <result column="order_type" property="orderType"/>
+        <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
+        <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
+        <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
+        <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
+        <result column="address_name" property="addressName"/>
+        <result column="address_no" property="addressNo"/>
+        <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
+        <result column="address_full" property="addressFull"/>
+        <result column="contact_name" property="contactName"/>
+        <result column="contact_phone" property="contactPhone"/>
+        <result column="sales_channel" property="salesChannel" typeHandler="UuidTypeHandler"/>
+        <result column="delivery_date" property="deliveryDate" typeHandler="TimestampTypeHandler"/>
+        <result column="sum_quantity" property="sumQuantity"/>
+        <result column="sum_standard" property="sumStandard"/>
+        <result column="sum_amount" property="sumAmount"/>
+        <result column="sale_discount" property="saleDiscount"/>
+        <result column="order_status" property="orderStatus"/>
+        <result column="out_status" property="outStatus"/>
+        <result column="outing_qty" property="outingQty"/>
+        <result column="outing_amt" property="outingAmt"/>
+        <result column="out_qty" property="outQty"/>
+        <result column="out_amt" property="outAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="amt_receivable" property="amtReceivable"/>
+        <result column="amt_handle" property="amtHandle"/>
+        <result column="amt_residue" property="amtResidue"/>
+        <result column="remarks" property="remarks"/>
+        <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
+        <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="org_name" property="orgName"/>
+        <result column="staff_name" property="staffName"/>
 
         <result column="cus_code" property="cusCode"/>
         <result column="cus_name" property="cusName"/>
@@ -192,8 +202,14 @@
         <result column="contact_phone" property="contactPhone"/>
         <result column="cus_from" property="cusFrom" typeHandler="UuidTypeHandler"/>
         <result column="channel_id" property="channelId" typeHandler="UuidTypeHandler"/>
+        <result column="fact_amt" property="factAmt"/>
+        <result column="disc_amt" property="discAmt"/>
+        <result column="discount" property="discount"/>
+        <result column="flg_auto_handle" property="flgAutoHandle"/>
+        <result column="flg_handle_setting" property="flgHandleSetting"/>
+        <result column="channelName" property="channelName"/>
+        <collection property="orderItemResponseList" resultMap="itemListMap" columnPrefix="list_"/>
 
-            <collection property="orderItemResponseList" resultMap="itemListMap" columnPrefix="list_"/>
     </resultMap>
     <!--小程序用 关联映射-->
     <resultMap id="itemListMap" type="java.util.Map">
@@ -824,6 +840,11 @@
             make_time,
             cp_id,
             op_app_code,
+            fact_amt,
+            disc_amt,
+            discount,
+            flg_auto_handle,
+            flg_handle_setting,
         </trim>
         )
         values
@@ -865,6 +886,11 @@
                 #{item.makeTime},
                 #{item.cpId},
                 #{item.opAppCode},
+                #{item.factAmt},
+                #{item.discAmt},
+                #{item.discount},
+                #{item.flgAutoHandle},
+                #{item.flgHandleSetting},
             </trim>
             )
         </foreach>
@@ -976,6 +1002,21 @@
             <if test=" et!=null and et.cpId != null">
                 cp_id =#{et.cpId,jdbcType=INTEGER},
             </if>
+            <if test=" et!=null and et.factAmt != null">
+                fact_amt =#{et.factAmt,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.discAmt != null">
+                disc_amt =#{et.discAmt,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.discount != null">
+                discount =#{et.discount,jdbcType=NUMERIC},
+            </if>
+            <if test=" et!=null and et.flgAutoHandle != null">
+                flg_auto_handle =#{et.flgAutoHandle,jdbcType=BOOLEAN},
+            </if>
+            <if test=" et!=null and et.flgHandleSetting != null">
+                flg_handle_setting =#{et.flgHandleSetting,jdbcType=BOOLEAN},
+            </if>
         </set>
         where order_id =#{et.orderId,typeHandler=UuidTypeHandler}
         and sum_quantity >= (out_qty + outing_qty)
@@ -988,7 +1029,7 @@
         <include refid="Base_Column_List_Detail_Join"/>,
         tmc.cus_code,tmc.cus_name, tmc.cus_phone, tmc.address_area, tmc.address_name, tmc.address_no,
         tmc.address_gcj02, tmc.address_full, tmc.contact_name, tmc.contact_phone, tmc.cus_from, tmc.channel_id,
-
+        tmsc.channel_name as "channelName",
 
         <include refid="Base_Column_List_Item_Response_Detail_Join"/>
         FROM dkic_b.t_psi_order as t
@@ -997,6 +1038,7 @@
         inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id  = toi.sku_id
         left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id  = tmgs.brand_id
         left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
+        left join dkic_b.t_mst_sale_channel tmsc on t.sales_channel = tmsc.channel_id
         left join dkic_b.t_mst_staff tms on t.staff_id = tms.staff_id
         left join(SELECT T.*
         FROM (select tpi.inv_id,

+ 3 - 0
src/main/java/com/dk/mdm/model/pojo/ivt/InboundItem.java

@@ -380,6 +380,9 @@ public class InboundItem extends PageInfo<InboundItem> implements Serializable {
     @TableField(exist = false)
     private Integer decimalPlaces;
 
+    @ApiModelProperty(value = "成本核对标识")
+    private Boolean flgCostCheck;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 99 - 0
src/main/java/com/dk/mdm/model/pojo/ivt/Outbound.java

@@ -49,6 +49,24 @@ public class Outbound extends PageInfo<Outbound> implements Serializable {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String outId;
 
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
 
     /**
      * 出库单号
@@ -325,6 +343,87 @@ public class Outbound extends PageInfo<Outbound> implements Serializable {
     @ApiModelProperty(value = "自动办理参数")
     private Boolean flgHandleSetting;
 
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 详细地址
+     */
+    @Excel(name = "详细地址")
+    @ApiModelProperty(value = "详细地址")
+    private String addressFull;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String salesChannel;
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    @ApiModelProperty(value = "客户名称")
+    private String cusName;
+
+
+    /**
+     * 客户电话
+     */
+    @Excel(name = "客户电话")
+    @ApiModelProperty(value = "客户电话")
+    private String cusPhone;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 28 - 1
src/main/java/com/dk/mdm/model/pojo/ivt/OutboundItem.java

@@ -51,7 +51,30 @@ public class OutboundItem extends PageInfo<OutboundItem> implements Serializable
     @ApiModelProperty(value = "使用位置")
     private String usePlace;
 
-
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+    /**
+     * 实际单价
+     */
+    @Excel(name = "实际单价")
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
     /**
      * 出库ID
      */
@@ -239,6 +262,10 @@ public class OutboundItem extends PageInfo<OutboundItem> implements Serializable
     @ApiModelProperty(value = "商品型号")
     private String skuModel;
 
+    @Excel(name = "赠品标识")
+    @ApiModelProperty(value = "赠品标识")
+    private Boolean flgGift;
+
 
     /**
      * 创建时间 (触发器自动处理)

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

@@ -337,6 +337,13 @@ public class GoodsSku extends PageInfo<GoodsSku> implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

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

@@ -207,6 +207,13 @@ public class Staff extends PageInfo<Staff> implements Serializable {
     @ApiModelProperty(value = "登录标识")
     private Integer hrStatus;
 
+    /**
+     * 初始标识
+     */
+    @Excel(name = "初始标识")
+    @ApiModelProperty(value = "初始标识")
+    private Boolean flgInit;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 26 - 0
src/main/java/com/dk/mdm/model/pojo/sale/Order.java

@@ -340,6 +340,32 @@ public class Order extends PageInfo<Order> implements Serializable {
     @TableField(fill = FieldFill.INSERT)
     private Integer cpId;
 
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+    @Excel(name = "折扣")
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
+    @Excel(name = "自动办理标识")
+    @ApiModelProperty(value = "自动办理标识")
+    private Boolean flgAutoHandle;
+
+    @Excel(name = "自动办理参数")
+    @ApiModelProperty(value = "自动办理参数")
+    private Boolean flgHandleSetting;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 35 - 0
src/main/java/com/dk/mdm/model/pojo/sale/OrderItem.java

@@ -247,6 +247,41 @@ public class OrderItem extends PageInfo<OrderItem> implements Serializable {
     @TableField(exist = false)
     private Integer decimalPlaces;
 
+    /**
+     * 实际单价
+     */
+    @Excel(name = "实际单价")
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
+
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+    /**
+     * 使用位置
+     */
+    @Excel(name = "使用位置")
+    @ApiModelProperty(value = "使用位置")
+    private String usePlace;
+
+    /**
+     * 折扣
+     */
+    @Excel(name = "折扣")
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 23 - 0
src/main/java/com/dk/mdm/model/query/ivt/InboundItemQuery.java

@@ -13,6 +13,7 @@ import lombok.experimental.Accessors;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  *  入库明细
@@ -303,6 +304,28 @@ public class InboundItemQuery extends PageInfo<InboundItemQuery>  {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String supId;
 
+    @ApiModelProperty(value = "查询")
+    private String searchText;
+
+
+    @ApiModelProperty(value = "入库类型")
+    private String intoTypeName;
+
+
+    @ApiModelProperty(value = "成本核对标识")
+    private Boolean flgCostCheck;
+
+    @ApiModelProperty(value = "仅查询未核对")
+    private Boolean viewNoCostDocuments;
+
+    @ApiModelProperty(value = "员工")
+    private String staffName;
+
+    @ApiModelProperty(value = "部门")
+    private String orgName;
+
+    @ApiModelProperty(value = "入库状态")
+    private List<String> intoStatusList;
 
     private static final long serialVersionUID = 1L;
 

+ 2 - 0
src/main/java/com/dk/mdm/model/query/ivt/InventoryQuery.java

@@ -152,6 +152,8 @@ public class InventoryQuery extends PageInfo<InventoryQuery>{
     private String desc;
 
     private Boolean invQtyFlag;
+
+    private Boolean winning;
     /*
      * 相关属性
      * @TableField(exist = false)

+ 4 - 0
src/main/java/com/dk/mdm/model/query/ivt/OutboundItemQuery.java

@@ -183,6 +183,10 @@ public class OutboundItemQuery extends PageInfo<OutboundItemQuery>{
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    @Excel(name = "赠品标识")
+    @ApiModelProperty(value = "赠品标识")
+    private Boolean flgGift;
+
 
     /**
      * 企业ID

+ 59 - 0
src/main/java/com/dk/mdm/model/query/ivt/OutboundQuery.java

@@ -285,6 +285,65 @@ public class OutboundQuery extends PageInfo<OutboundQuery> {
     @ApiModelProperty(value = "是否过滤退货")
     private Boolean flgFilterReturn;
 
+    /**
+     * 行政区划 (a1:省 a2:市 a3:区)
+     */
+    @Excel(name = "行政区划 (a1:省 a2:市 a3:区)")
+    @ApiModelProperty(value = "行政区划 (a1:省 a2:市 a3:区)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressArea;
+
+
+    /**
+     * 小区或POI
+     */
+    @Excel(name = "小区或POI")
+    @ApiModelProperty(value = "小区或POI")
+    private String addressName;
+
+
+    /**
+     * 门牌号
+     */
+    @Excel(name = "门牌号")
+    @ApiModelProperty(value = "门牌号")
+    private String addressNo;
+
+
+    /**
+     * 地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)
+     */
+    @Excel(name = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @ApiModelProperty(value = "地址坐标(gcj02) (LAT:纬度的值 LON:经度的值)")
+    @TableField(typeHandler = JsonTypeHandler.class)
+    private JSONObject addressGcj02;
+
+
+    /**
+     * 联系人
+     */
+    @Excel(name = "联系人")
+    @ApiModelProperty(value = "联系人")
+    private String contactName;
+
+
+    /**
+     * 联系电话
+     */
+    @Excel(name = "联系电话")
+    @ApiModelProperty(value = "联系电话")
+    private String contactPhone;
+
+
+    /**
+     * 销售渠道
+     */
+    @Excel(name = "销售渠道")
+    @ApiModelProperty(value = "销售渠道")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String salesChannel;
+
+
 
 
     /*

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

@@ -307,6 +307,13 @@ public class GoodsSkuQuery extends PageInfo<GoodsSku> implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

+ 7 - 0
src/main/java/com/dk/mdm/model/query/mst/StaffQuery.java

@@ -222,6 +222,13 @@ public class StaffQuery extends PageInfo<StaffQuery> implements Serializable {
     private Integer hrStatus;
 
     /**
+     * 初始标识
+     */
+    @Excel(name = "初始标识")
+    @ApiModelProperty(value = "初始标识")
+    private Boolean flgInit;
+
+    /**
      * 小程序的查询条件
      */
     @ApiModelProperty(value = "小程序的查询条件")

+ 2 - 2
src/main/java/com/dk/mdm/model/query/wxapi/basic/WxCommonQuery.java

@@ -30,9 +30,9 @@ public class WxCommonQuery extends PageInfo<WxCommonQuery> {
     @ApiModelProperty(value = "商户id")
     private long sysId;
     @ApiModelProperty(value = "部门id")
-    private long orgId;
+    private String orgId;
     @ApiModelProperty(value = "用户id")
-    private long userId;
+    private String userId;
 
 
 

+ 17 - 0
src/main/java/com/dk/mdm/model/report/ExcelDataHandler.java

@@ -0,0 +1,17 @@
+package com.dk.mdm.model.report;
+
+import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl;
+import org.apache.poi.common.usermodel.HyperlinkType;
+import org.apache.poi.ss.usermodel.CreationHelper;
+import org.apache.poi.ss.usermodel.Hyperlink;
+
+public class ExcelDataHandler extends ExcelDataHandlerDefaultImpl<ExcelIndex> {
+
+    @Override
+    public Hyperlink getHyperlink(CreationHelper creationHelper, ExcelIndex obj, String name, Object value) {
+        Hyperlink hyperlink = creationHelper.createHyperlink(HyperlinkType.DOCUMENT);
+        hyperlink.setLabel(name);
+        hyperlink.setAddress("'"+value+"'!A1");
+        return hyperlink;
+    }
+}

+ 80 - 0
src/main/java/com/dk/mdm/model/report/ExcelExportStyleImpl.java

@@ -0,0 +1,80 @@
+package com.dk.mdm.model.report;
+
+import cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl;
+import org.apache.poi.hssf.usermodel.HSSFPalette;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.*;
+
+public class ExcelExportStyleImpl extends ExcelExportStylerDefaultImpl {
+
+    private static final String DEFAULT_BACKGROUND_COLOR = "#C1C1C1";
+
+    /* 起个名叫title其实是header */
+    @Override
+    public CellStyle getTitleStyle(short color) {
+        CellStyle titleStyle = this.workbook.createCellStyle();
+        Font font = this.workbook.createFont();
+        font.setBold(true);
+        titleStyle.setAlignment(HorizontalAlignment.CENTER);
+        titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        titleStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
+        titleStyle.setFillBackgroundColor(IndexedColors.PALE_BLUE.getIndex());
+        titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        titleStyle.setWrapText(true);
+        titleStyle.setFont(font);
+        titleStyle.setBorderBottom(BorderStyle.NONE);
+        return titleStyle;
+    }
+
+    /* 起个名叫header其实是title */
+    @Override
+    public CellStyle getHeaderStyle(short color) {
+        CellStyle titleStyle = this.workbook.createCellStyle();
+        Font font = this.workbook.createFont();
+        font.setFontHeightInPoints((short)12);
+        titleStyle.setFont(font);
+        titleStyle.setAlignment(HorizontalAlignment.CENTER);
+        titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        return titleStyle;
+    }
+
+
+    @Override
+    public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) {
+
+
+        int r = Integer.parseInt((DEFAULT_BACKGROUND_COLOR.substring(1,3)),16);
+        int g = Integer.parseInt((DEFAULT_BACKGROUND_COLOR.substring(3,5)),16);
+        int b = Integer.parseInt((DEFAULT_BACKGROUND_COLOR.substring(5,7)),16);
+
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFPalette palette = wb.getCustomPalette();
+        HSSFColor hssfColor = palette.findSimilarColor(r, g, b);
+
+
+        CellStyle style = workbook.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        style.setDataFormat(STRING_FORMAT);
+        style.setFillForegroundColor(hssfColor.getIndex());
+        style.setFillBackgroundColor(hssfColor.getIndex());
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setLeftBorderColor(IndexedColors.WHITE.getIndex());
+        style.setRightBorderColor(IndexedColors.WHITE.getIndex());
+        if (isWarp) {
+            style.setWrapText(true);
+        }
+
+        return style;
+    }
+
+    public ExcelExportStyleImpl(Workbook workbook) {
+        super(workbook);
+    }
+
+
+
+}

+ 14 - 0
src/main/java/com/dk/mdm/model/report/ExcelIndex.java

@@ -0,0 +1,14 @@
+package com.dk.mdm.model.report;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class ExcelIndex {
+
+   @Excel(name="报表目录",isHyperlink = true,width = 250)
+   private String sheetName;
+
+}

+ 15 - 0
src/main/java/com/dk/mdm/model/report/Util.java

@@ -0,0 +1,15 @@
+package com.dk.mdm.model.report;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+public class Util {
+
+    public static BigDecimal calc10000(BigDecimal bigDecimal){
+        if(bigDecimal == null){
+            return null;
+        }
+        return bigDecimal.divide(BigDecimal.valueOf(10000),2, RoundingMode.HALF_UP);
+    }
+
+}

+ 31 - 0
src/main/java/com/dk/mdm/model/report/analysis/BudgetQuotation.java

@@ -0,0 +1,31 @@
+package com.dk.mdm.model.report.analysis;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class BudgetQuotation {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal offerAmount;
+
+    @Excel(name="报价客户",width = 15,orderNum = "3")
+    private Integer csmCount;
+
+    @Excel(name="报价率",width = 15,orderNum = "4")
+    private BigDecimal offerRate;
+
+    public void setOfferAmount(BigDecimal offerAmount) {
+        this.offerAmount = Util.calc10000(offerAmount);
+    }
+}

+ 31 - 0
src/main/java/com/dk/mdm/model/report/analysis/BudgetQuotationStaff.java

@@ -0,0 +1,31 @@
+package com.dk.mdm.model.report.analysis;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class BudgetQuotationStaff {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal offerAmount;
+
+    @Excel(name="报价客户",width = 15,orderNum = "3")
+    private Integer csmCount;
+
+    @Excel(name="报价率",width = 15,orderNum = "4")
+    private BigDecimal offerRate;
+
+    public void setOfferAmount(BigDecimal offerAmount) {
+        this.offerAmount = Util.calc10000(offerAmount);
+    }
+}

+ 31 - 0
src/main/java/com/dk/mdm/model/report/analysis/PotentialCustomerAnalysis.java

@@ -0,0 +1,31 @@
+package com.dk.mdm.model.report.analysis;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class PotentialCustomerAnalysis {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="潜在客户",width = 15,orderNum = "2")
+    private Integer csmCount;
+
+    @Excel(name="量尺",width = 15,orderNum = "3")
+    private Integer measureCsmCount;
+
+    @Excel(name="设计制图",width = 15,orderNum = "4")
+    private Integer designCsmCount;
+
+    @Excel(name="成交率",width = 15,orderNum = "5")
+    private BigDecimal orderRate;
+
+
+}

+ 31 - 0
src/main/java/com/dk/mdm/model/report/analysis/PotentialCustomerAnalysisStaff.java

@@ -0,0 +1,31 @@
+package com.dk.mdm.model.report.analysis;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class PotentialCustomerAnalysisStaff {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="潜在客户",width = 15,orderNum = "2")
+    private Integer csmCount;
+
+    @Excel(name="量尺",width = 15,orderNum = "3")
+    private Integer measureCsmCount;
+
+    @Excel(name="设计制图",width = 15,orderNum = "4")
+    private Integer designCsmCount;
+
+    @Excel(name="成交率",width = 15,orderNum = "5")
+    private BigDecimal orderRate;
+
+
+}

+ 38 - 0
src/main/java/com/dk/mdm/model/report/department/DepartmentCollectionRanking.java

@@ -0,0 +1,38 @@
+package com.dk.mdm.model.report.department;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class DepartmentCollectionRanking {
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal repayAmount;
+
+//    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//    private BigDecimal kpiRepayAmount;
+//
+//    @Excel(name="完成率",width = 15,orderNum = "4")
+//    private BigDecimal kpiOrderRate;
+
+
+    public void setRepayAmount(BigDecimal repayAmount) {
+        this.repayAmount = Util.calc10000(repayAmount);
+    }
+
+//    public void setKpiRepayAmount(BigDecimal kpiRepayAmount) {
+//        this.kpiRepayAmount = Util.calc10000(kpiRepayAmount);
+//    }
+}

+ 39 - 0
src/main/java/com/dk/mdm/model/report/department/DepartmentTransactionRanking.java

@@ -0,0 +1,39 @@
+package com.dk.mdm.model.report.department;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class DepartmentTransactionRanking {
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal orderAmount;
+
+
+//    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//    private BigDecimal kpiOrderAmount;
+
+
+//    @Excel(name="完成率",width = 15,orderNum = "4")
+//    private BigDecimal kpiOrderRate;
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+
+//    public void setKpiOrderAmount(BigDecimal kpiOrderAmount) {
+//        this.kpiOrderAmount =  Util.calc10000(kpiOrderAmount);;
+//    }
+}

+ 31 - 0
src/main/java/com/dk/mdm/model/report/from/Offer.java

@@ -0,0 +1,31 @@
+package com.dk.mdm.model.report.from;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class Offer {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="客户来源",width = 35,orderNum = "1")
+    private String fromName;
+
+    @Excel(name="报价金额(万)",width = 15,orderNum = "2")
+    private BigDecimal orderAmount;
+
+    @Excel(name="报价客户",width = 15,orderNum = "3")
+    private Integer customerQty;
+
+    @Excel(name="占比",width = 15,orderNum = "4")
+    private BigDecimal rate;
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+}

+ 26 - 0
src/main/java/com/dk/mdm/model/report/from/PotentialCustomerAnalysisFrom.java

@@ -0,0 +1,26 @@
+package com.dk.mdm.model.report.from;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+public class PotentialCustomerAnalysisFrom {
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="客户来源",width = 35,orderNum = "1")
+    private String fromName;
+
+    @Excel(name="潜在客户",width = 15,orderNum = "2")
+    private Integer csmCount;
+
+    @Excel(name="成交客户",width = 15,orderNum = "3")
+    private Integer orderCsmCount;
+
+    @Excel(name="设计制图",width = 15,orderNum = "4")
+    private Integer designCsmCount;
+
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/from/Transaction.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.from;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class Transaction
+
+{
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="客户来源",width = 35,orderNum = "1")
+    private String fromName;
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal orderAmount;
+
+    @Excel(name="成交客户",width = 15,orderNum = "3")
+    private Integer customerQty;
+
+    @Excel(name="占比",width = 15,orderNum = "4")
+    private BigDecimal rate;
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+}

+ 32 - 0
src/main/java/com/dk/mdm/model/report/product/ProductDistribution.java

@@ -0,0 +1,32 @@
+package com.dk.mdm.model.report.product;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+
+@Data
+@Accessors(chain = true)
+public class ProductDistribution {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="品类名称",width = 35,orderNum = "1")
+    private String specsName;
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="成交数量",width = 15,orderNum = "3")
+    private Integer sumCount;
+
+    @Excel(name="数量占比",width = 15,orderNum = "4")
+    private BigDecimal countRate;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+}

+ 35 - 0
src/main/java/com/dk/mdm/model/report/received/ArrearsInfo.java

@@ -0,0 +1,35 @@
+package com.dk.mdm.model.report.received;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class ArrearsInfo {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="欠款额(万)",width = 15,orderNum = "2")
+    private BigDecimal receivable;
+
+    @Excel(name="成交额(万)",width = 15,orderNum = "3")
+    private BigDecimal orderAmount;
+
+    @Excel(name="欠款户数",width = 15,orderNum = "4")
+    private Integer csmCount;
+
+    public void setReceivable(BigDecimal receivable) {
+        this.receivable = Util.calc10000(receivable);
+    }
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+}

+ 35 - 0
src/main/java/com/dk/mdm/model/report/received/ArrearsInfoStaff.java

@@ -0,0 +1,35 @@
+package com.dk.mdm.model.report.received;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class ArrearsInfoStaff {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="欠款额(万)",width = 15,orderNum = "2")
+    private BigDecimal receivable;
+
+    @Excel(name="成交额(万)",width = 15,orderNum = "3")
+    private BigDecimal orderAmount;
+
+    @Excel(name="欠款户数",width = 15,orderNum = "4")
+    private Integer csmCount;
+
+    public void setReceivable(BigDecimal receivable) {
+        this.receivable = Util.calc10000(receivable);
+    }
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/received/ReceivedTask.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.received;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class ReceivedTask {
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal repayAmount;
+
+//    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//    private BigDecimal kpiRepayAmount;
+//
+//    @Excel(name="完成率",width = 15,orderNum = "4")
+//    private BigDecimal kpiRepayRate;
+
+    public void setRepayAmount(BigDecimal repayAmount) {
+        this.repayAmount = Util.calc10000(repayAmount);
+    }
+
+//    public void setKpiRepayAmount(BigDecimal kpiRepayAmount) {
+//        this.kpiRepayAmount = Util.calc10000(kpiRepayAmount);
+//    }
+
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/received/ReceivedTaskStaff.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.received;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class ReceivedTaskStaff {
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal repayAmount;
+
+    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+    private BigDecimal kpiRepayAmount;
+
+    @Excel(name="完成率",width = 15,orderNum = "4")
+    private BigDecimal kpiRepayRate;
+
+    public void setRepayAmount(BigDecimal repayAmount) {
+        this.repayAmount = Util.calc10000(repayAmount);
+    }
+
+    public void setKpiRepayAmount(BigDecimal kpiRepayAmount) {
+        this.kpiRepayAmount = Util.calc10000(kpiRepayAmount);
+    }
+
+}

+ 32 - 0
src/main/java/com/dk/mdm/model/report/sale/ActivityEffect1.java

@@ -0,0 +1,32 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 活动效果上部 */
+@Data
+@Accessors(chain = true)
+public class ActivityEffect1 {
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="促销套餐(Top5)",width = 35,orderNum = "1")
+    private String kpiName;
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="成交数量",width = 15,orderNum = "3")
+    private Integer sumQty;
+
+    @Excel(name="成交户数",width = 10,orderNum = "4")
+    private Integer csmCount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+}

+ 32 - 0
src/main/java/com/dk/mdm/model/report/sale/ActivityEffect2.java

@@ -0,0 +1,32 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 活动效果下部 */
+@Data
+@Accessors(chain = true)
+public class ActivityEffect2 {
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="促销单品(Top5)",width = 35,orderNum = "1")
+    private String kpiName;
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="成交数量",width = 15,orderNum = "3")
+    private Integer sumQty;
+
+    @Excel(name="成交户数",width = 10,orderNum = "4")
+    private Integer csmCount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomerUnitPrice.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+/* 客单价 */
+public class CustomerUnitPrice {
+
+    @Excel(name = "客单价(万)",orderNum = "2",width = 15)
+    private BigDecimal csmRate;
+
+    @Excel(name = "序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name = "门店名称",orderNum = "1",width = 35)
+    private String orgName;
+
+    @Excel(name = "成交户数",width = 10,orderNum = "4")
+    private Integer csmCount;
+
+    @Excel(name = "成交金额(万)",width = 10,orderNum = "3")
+    private BigDecimal sumAmount;
+
+    public void setCsmRate(BigDecimal csmRate) {
+        this.csmRate = Util.calc10000(csmRate);
+    }
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);;
+    }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomerUnitPriceStaff.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+/* 客单价 */
+public class CustomerUnitPriceStaff {
+
+    @Excel(name = "客单价(万)",orderNum = "2",width = 15)
+    private BigDecimal csmRate;
+
+    @Excel(name = "序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name = "业务员名称",orderNum = "1",width = 35)
+    private String staffName;
+
+    @Excel(name = "成交户数",width = 10,orderNum = "4")
+    private Integer csmCount;
+
+    @Excel(name = "成交金额(万)",width = 10,orderNum = "3")
+    private BigDecimal sumAmount;
+
+    public void setCsmRate(BigDecimal csmRate) {
+        this.csmRate = Util.calc10000(csmRate);
+    }
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);;
+    }
+}

+ 40 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdom1.java

@@ -0,0 +1,40 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class CustomizedWisdom1 {
+
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="定+智品类(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="定制品(万)",width = 15,orderNum = "3")
+    private BigDecimal dzAmount;
+
+    @Excel(name="智能坐便(万)",width = 15,orderNum = "4")
+    private BigDecimal znAmount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setDzAmount(BigDecimal dzAmount) {
+        this.dzAmount = Util.calc10000(dzAmount);
+    }
+
+    public void setZnAmount(BigDecimal znAmount) {
+        this.znAmount = Util.calc10000(znAmount);
+    }
+}

+ 40 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdom2.java

@@ -0,0 +1,40 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class CustomizedWisdom2 {
+
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="定制品(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="定制柜(万)",width = 15,orderNum = "3")
+    private BigDecimal cabinetAmount;
+
+    @Excel(name="订制玻璃(万)",width = 15,orderNum = "4")
+    private BigDecimal glassAmount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setCabinetAmount(BigDecimal cabinetAmount) {
+        this.cabinetAmount = Util.calc10000(cabinetAmount);
+    }
+
+    public void setGlassAmount(BigDecimal glassAmount) {
+        this.glassAmount = Util.calc10000(glassAmount);
+    }
+}

+ 40 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdomStaff1.java

@@ -0,0 +1,40 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class CustomizedWisdomStaff1 {
+
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="定+智品类(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="定制品(万)",width = 15,orderNum = "3")
+    private BigDecimal dzAmount;
+
+    @Excel(name="智能坐便(万)",width = 15,orderNum = "4")
+    private BigDecimal znAmount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setDzAmount(BigDecimal dzAmount) {
+        this.dzAmount = Util.calc10000(dzAmount);
+    }
+
+    public void setZnAmount(BigDecimal znAmount) {
+        this.znAmount = Util.calc10000(znAmount);
+    }
+}

+ 40 - 0
src/main/java/com/dk/mdm/model/report/sale/CustomizedWisdomStaff2.java

@@ -0,0 +1,40 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class CustomizedWisdomStaff2 {
+
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="定制品(万)",width = 15,orderNum = "2")
+    private BigDecimal sumAmount;
+
+    @Excel(name="定制柜(万)",width = 15,orderNum = "3")
+    private BigDecimal cabinetAmount;
+
+    @Excel(name="订制玻璃(万)",width = 15,orderNum = "4")
+    private BigDecimal glassAmount;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setCabinetAmount(BigDecimal cabinetAmount) {
+        this.cabinetAmount = Util.calc10000(cabinetAmount);
+    }
+
+    public void setGlassAmount(BigDecimal glassAmount) {
+        this.glassAmount = Util.calc10000(glassAmount);
+    }
+}

+ 35 - 0
src/main/java/com/dk/mdm/model/report/sale/OrgCategoryAmt.java

@@ -0,0 +1,35 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-部门品类-金额 */
+@Data
+@Accessors(chain = true)
+public class OrgCategoryAmt {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+
+  @Excel(name="门店名称",width = 35,orderNum = "3")
+  private String orgName;
+
+  @Excel(name="产品分类",width = 35,orderNum = "4")
+  private String categoryName;
+
+  @Excel(name="成交金额(万)",width = 15,orderNum = "5")
+  private BigDecimal sumAmount;
+
+  @Excel(name="任务目标(万)",width = 15,orderNum = "6")
+  private BigDecimal kpiAmount;
+
+  @Excel(name="完成率",width = 10,orderNum = "7", suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 32 - 0
src/main/java/com/dk/mdm/model/report/sale/OrgCategoryQty.java

@@ -0,0 +1,32 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-部门品类-数量 */
+@Data
+@Accessors(chain = true)
+public class OrgCategoryQty {
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+  @Excel(name="门店名称",width = 35,orderNum = "3")
+  private String orgName;
+
+  @Excel(name="产品分类",width = 35,orderNum = "4")
+  private String categoryName;
+
+  @Excel(name="成交数量",width = 15,orderNum = "5",numFormat = "0")
+  private BigDecimal sumQty;
+
+  @Excel(name="任务目标",width = 15,orderNum = "6")
+  private BigDecimal kpiQty;
+
+  @Excel(name="完成率",width = 10,orderNum = "7",suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 34 - 0
src/main/java/com/dk/mdm/model/report/sale/OrgSpuAmt.java

@@ -0,0 +1,34 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-部门单品-金额 */
+@Data
+@Accessors(chain = true)
+public class OrgSpuAmt {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+
+  @Excel(name="门店名称",width = 35,orderNum = "3")
+  private String orgName;
+
+  @Excel(name="产品型号",width = 35,orderNum = "4")
+  private String spuCode;
+
+  @Excel(name="成交金额(万)",width = 15,orderNum = "5")
+  private BigDecimal sumAmount;
+
+  @Excel(name="任务目标(万)",width = 15,orderNum = "6")
+  private BigDecimal kpiAmount;
+
+  @Excel(name="完成率",width = 10,orderNum = "7" ,suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/sale/OrgSpuQty.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-部门单品-数量 */
+@Data
+@Accessors(chain = true)
+public class OrgSpuQty {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+  @Excel(name="门店名称",width = 35,orderNum = "3")
+  private String orgName;
+
+  @Excel(name="产品型号",width = 35,orderNum = "4")
+  private String spuCode;
+
+  @Excel(name="成交数量",width = 15,orderNum = "5",numFormat = "0")
+  private BigDecimal sumQty;
+
+  @Excel(name="任务目标",width = 15,orderNum = "6")
+  private BigDecimal kpiQty;
+
+  @Excel(name="完成率",width = 10,orderNum = "7",suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 38 - 0
src/main/java/com/dk/mdm/model/report/sale/ReturnSituation.java

@@ -0,0 +1,38 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+/* 销售分析 - 退货情况 */
+public class ReturnSituation {
+
+    @Excel(name="出库额(万)",width = 15,orderNum = "3")
+    private BigDecimal outAmount;
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="退货额(万)",width = 15,orderNum = "2")
+    private BigDecimal rejectAmount;
+
+    @Excel(name="门店名称",width = 35,orderNum = "1")
+    private String orgName;
+
+    @Excel(name="退货占率",width = 10,orderNum = "4")
+    private BigDecimal kpiRate;
+
+
+    public void setOutAmount(BigDecimal outAmount) {
+        this.outAmount = Util.calc10000(outAmount);
+    }
+
+    public void setRejectAmount(BigDecimal rejectAmount) {
+        this.rejectAmount = Util.calc10000(rejectAmount);;
+    }
+}

+ 38 - 0
src/main/java/com/dk/mdm/model/report/sale/ReturnSituationStaff.java

@@ -0,0 +1,38 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+/* 销售分析 - 退货情况 */
+public class ReturnSituationStaff {
+
+    @Excel(name="出库额(万)",width = 15,orderNum = "3")
+    private BigDecimal outAmount;
+
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="退货额(万)",width = 15,orderNum = "2")
+    private BigDecimal rejectAmount;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    @Excel(name="退货占率",width = 10,orderNum = "4")
+    private BigDecimal kpiRate;
+
+
+    public void setOutAmount(BigDecimal outAmount) {
+        this.outAmount = Util.calc10000(outAmount);
+    }
+
+    public void setRejectAmount(BigDecimal rejectAmount) {
+        this.rejectAmount = Util.calc10000(rejectAmount);;
+    }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/sale/SaleTask.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售简报 - 销售任务 */
+@Data
+@Accessors(chain = true)
+public class SaleTask {
+
+  @Excel(name="序号",width = 10)
+  private Integer  kpiIndex;
+
+//  @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//  private BigDecimal kpiOrderAmount;
+//
+//  @Excel(name="完成率",width = 10,orderNum = "4")
+//  private BigDecimal kpiOrderRate;
+
+  @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+  private BigDecimal orderAmount;
+
+  @Excel(name="门店名称",width = 35,orderNum = "1")
+  private String orgName;
+
+//  public void setKpiOrderAmount(BigDecimal kpiOrderAmount) {
+//    this.kpiOrderAmount = Util.calc10000(kpiOrderAmount);
+//  }
+
+  public void setOrderAmount(BigDecimal orderAmount) {
+    this.orderAmount = Util.calc10000(orderAmount);
+  }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/sale/SaleTaskStaff.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售简报 - 销售任务 */
+@Data
+@Accessors(chain = true)
+public class SaleTaskStaff {
+
+    @Excel(name="序号",width = 10)
+    private Integer  kpiIndex;
+
+    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+    private BigDecimal kpiOrderAmount;
+
+    @Excel(name="完成率",width = 10,orderNum = "4")
+    private BigDecimal kpiOrderRate;
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal orderAmount;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+    public void setKpiOrderAmount(BigDecimal kpiOrderAmount) {
+        this.kpiOrderAmount = Util.calc10000(kpiOrderAmount);
+    }
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/sale/StaffCategoryAmt.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-业务员品类-金额 */
+@Data
+@Accessors(chain = true)
+public class StaffCategoryAmt {
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+
+  @Excel(name="业务员名称",width = 35,orderNum = "3")
+  private String staffName;
+
+  @Excel(name="产品分类",width = 35,orderNum = "4")
+  private String categoryName;
+
+  @Excel(name="成交金额(万)",width = 15,orderNum = "5")
+  private BigDecimal sumAmount;
+
+  @Excel(name="任务目标(万)",width = 15,orderNum = "6")
+  private BigDecimal kpiAmount;
+
+  @Excel(name="完成率",width = 10,orderNum = "7"  ,suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/sale/StaffCategoryQty.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-业务员品类-数量 */
+@Data
+@Accessors(chain = true)
+public class StaffCategoryQty {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+  @Excel(name="业务员名称",width = 35,orderNum = "3")
+  private String staffName;
+
+  @Excel(name="产品分类",width = 35,orderNum = "4")
+  private String categoryName;
+
+  @Excel(name="成交数量",width = 15,orderNum = "5",numFormat = "0")
+  private BigDecimal sumQty;
+
+  @Excel(name="任务目标",width = 15,orderNum = "6")
+  private BigDecimal kpiQty;
+
+  @Excel(name="完成率",width = 10,orderNum = "7" ,suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/sale/StaffSpuAmt.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-业务员单品-金额 */
+@Data
+@Accessors(chain = true)
+public class StaffSpuAmt {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+  @Excel(name="业务员名称",width = 35,orderNum = "3")
+  private String staffName;
+
+  @Excel(name="产品型号",width = 35,orderNum = "4")
+  private String spuCode;
+
+  @Excel(name="成交金额(万)",width = 15,orderNum = "5")
+  private BigDecimal sumAmount;
+
+  @Excel(name="任务目标(万)",width = 15,orderNum = "6")
+  private BigDecimal kpiAmount;
+
+  @Excel(name="完成率",width = 10,orderNum = "7",suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 33 - 0
src/main/java/com/dk/mdm/model/report/sale/StaffSpuQty.java

@@ -0,0 +1,33 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 销售分析-业务员单品-数量 */
+@Data
+@Accessors(chain = true)
+public class StaffSpuQty {
+
+
+  @Excel(name="排行",width = 10,orderNum = "2")
+  private Integer  kpiIndex;
+
+  @Excel(name="业务员名称",width = 35,orderNum = "3")
+  private String staffName;
+
+  @Excel(name="产品型号",width = 35,orderNum = "4")
+  private String spuCode;
+
+  @Excel(name="成交数量",width = 15,orderNum = "5",numFormat = "0")
+  private BigDecimal sumQty;
+
+  @Excel(name="任务目标",width = 15,orderNum = "6")
+  private BigDecimal kpiQty;
+
+  @Excel(name="完成率",width = 10,orderNum = "7" ,suffix = "%")
+  private BigDecimal kpiRate;
+
+}

+ 40 - 0
src/main/java/com/dk/mdm/model/report/sale/categoryRanking.java

@@ -0,0 +1,40 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 订单参考利润/出库参考利润 - 品类排行 */
+@Data
+@Accessors(chain = true)
+public class categoryRanking {
+
+
+    @Excel(name="排行",width = 10,orderNum = "2")
+    private Integer  kpiIndex;
+
+
+    @Excel(name="商品品类",width = 35,orderNum = "3")
+    private String kpiName;
+
+    @Excel(name="销售金额(万)",width = 35,orderNum = "4")
+    private BigDecimal sumAmount;
+
+    @Excel(name="毛利(万)",width = 15,orderNum = "6")
+    private BigDecimal grossProfit;
+
+    @Excel(name="毛利率",width = 10,orderNum = "7"  ,suffix = "%")
+    private BigDecimal grossProfitMargin;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setGrossProfit(BigDecimal grossProfit) {
+        this.grossProfit = Util.calc10000(grossProfit);
+    }
+
+}

+ 39 - 0
src/main/java/com/dk/mdm/model/report/sale/orgRanking.java

@@ -0,0 +1,39 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 订单参考利润/出库参考利润 - 部门排行 */
+@Data
+@Accessors(chain = true)
+public class orgRanking {
+
+
+    @Excel(name="排行",width = 10,orderNum = "2")
+    private Integer  kpiIndex;
+
+
+    @Excel(name="部门名称",width = 35,orderNum = "3")
+    private String kpiName;
+
+    @Excel(name="销售金额(万)",width = 35,orderNum = "4")
+    private BigDecimal sumAmount;
+
+    @Excel(name="毛利(万)",width = 15,orderNum = "6")
+    private BigDecimal grossProfit;
+
+    @Excel(name="毛利率",width = 10,orderNum = "7"  ,suffix = "%")
+    private BigDecimal grossProfitMargin;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setGrossProfit(BigDecimal grossProfit) {
+        this.grossProfit = Util.calc10000(grossProfit);
+    }
+}

+ 39 - 0
src/main/java/com/dk/mdm/model/report/sale/staffRanking.java

@@ -0,0 +1,39 @@
+package com.dk.mdm.model.report.sale;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+/* 订单参考利润/出库参考利润 - 业务员排行 */
+@Data
+@Accessors(chain = true)
+public class staffRanking {
+
+
+    @Excel(name="排行",width = 10,orderNum = "2")
+    private Integer  kpiIndex;
+
+
+    @Excel(name="业务员",width = 35,orderNum = "3")
+    private String kpiName;
+
+    @Excel(name="销售金额(万)",width = 35,orderNum = "4")
+    private BigDecimal sumAmount;
+
+    @Excel(name="毛利(万)",width = 15,orderNum = "6")
+    private BigDecimal grossProfit;
+
+    @Excel(name="毛利率",width = 10,orderNum = "7"  ,suffix = "%")
+    private BigDecimal grossProfitMargin;
+
+    public void setSumAmount(BigDecimal sumAmount) {
+        this.sumAmount = Util.calc10000(sumAmount);
+    }
+
+    public void setGrossProfit(BigDecimal grossProfit) {
+        this.grossProfit = Util.calc10000(grossProfit);
+    }
+}

+ 37 - 0
src/main/java/com/dk/mdm/model/report/staff/StaffCollectionRanking.java

@@ -0,0 +1,37 @@
+package com.dk.mdm.model.report.staff;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class StaffCollectionRanking {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+
+    @Excel(name="收款金额(万)",width = 15,orderNum = "2")
+    private BigDecimal repayAmount;
+
+//    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//    private BigDecimal kpiRepayAmount;
+//
+//    @Excel(name="完成率",width = 15,orderNum = "4")
+//    private BigDecimal kpiOrderRate;
+
+
+    public void setRepayAmount(BigDecimal repayAmount) {
+        this.repayAmount = Util.calc10000(repayAmount);
+    }
+
+//    public void setKpiRepayAmount(BigDecimal kpiRepayAmount) {
+//        this.kpiRepayAmount = Util.calc10000(kpiRepayAmount);
+//    }
+}

+ 39 - 0
src/main/java/com/dk/mdm/model/report/staff/StaffTransactionRanking.java

@@ -0,0 +1,39 @@
+package com.dk.mdm.model.report.staff;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.dk.mdm.model.report.Util;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.math.BigDecimal;
+
+@Data
+@Accessors(chain = true)
+public class StaffTransactionRanking {
+    @Excel(name="序号",width = 10)
+    private Integer kpiIndex;
+
+    @Excel(name="业务员名称",width = 35,orderNum = "1")
+    private String staffName;
+
+
+    @Excel(name="成交金额(万)",width = 15,orderNum = "2")
+    private BigDecimal orderAmount;
+
+
+//    @Excel(name="任务目标(万)",width = 15,orderNum = "3")
+//    private BigDecimal kpiOrderAmount;
+//
+//
+//    @Excel(name="完成率",width = 15,orderNum = "4")
+//    private BigDecimal kpiOrderRate;
+
+    public void setOrderAmount(BigDecimal orderAmount) {
+        this.orderAmount = Util.calc10000(orderAmount);
+    }
+
+//    public void setKpiOrderAmount(BigDecimal kpiOrderAmount) {
+//        this.kpiOrderAmount =  Util.calc10000(kpiOrderAmount);;
+//    }
+
+}

+ 21 - 0
src/main/java/com/dk/mdm/model/response/ivt/InboundItemResponse.java

@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.annotation.TableField;
 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.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -13,6 +15,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 
 /**
  *  入库明细
@@ -498,6 +501,17 @@ public class InboundItemResponse  {
     @ApiModelProperty(value = "包装数量")
     private String ingBoxPiece;
 
+    @ApiModelProperty(value = "系列")
+    private String seriesName;
+
+    @ApiModelProperty(value = "已入库状态")
+    private String intoStatusName;
+
+    @ApiModelProperty(value = "入库日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDate intoDate;
+
     /**
      * 小数位数 ([0-6]能改大,不能改小)
      */
@@ -505,6 +519,13 @@ public class InboundItemResponse  {
     @TableField(exist = false)
     private Integer decimalPlaces;
 
+    @ApiModelProperty(value = "入库类型")
+    private String intoTypeName;
+
+    @ApiModelProperty(value = "成本核对标识")
+    private Boolean flgCostCheck;
+    private String flgCostCheckName;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 9 - 0
src/main/java/com/dk/mdm/model/response/ivt/InventoryResponse.java

@@ -285,6 +285,15 @@ public class InventoryResponse {
     @TableField(exist = false)
     private Integer decimalPlaces;
 
+    // 警戒上限
+    private Long warningUpperLimit;
+    // 警戒下限
+    private Long warningLowerLimit;
+
+    /**
+     * 库存预警消息
+     * */
+    private String warningMsg;
 
     private static final long serialVersionUID = 1L;
 

+ 28 - 1
src/main/java/com/dk/mdm/model/response/ivt/OutboundItemResponse.java

@@ -380,6 +380,10 @@ public class OutboundItemResponse {
 
     private Boolean flgSubUnit;
 
+    @Excel(name = "赠品标识")
+    @ApiModelProperty(value = "赠品标识")
+    private Boolean flgGift;
+
     /**
      * 小数位数 ([0-6]能改大,不能改小)
      */
@@ -395,7 +399,30 @@ public class OutboundItemResponse {
     @Excel(name = "外协供应商")
     @ApiModelProperty(value = "外协供应商")
     private String supName;
-
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+    /**
+     * 实际单价
+     */
+    @Excel(name = "实际单价")
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
     /**
      * 包装数量
      */

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

@@ -244,6 +244,24 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @TableField(typeHandler = TimestampTypeHandler.class)
     private LocalDateTime opUpdateTime;
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
 
     /**
      * 备注
@@ -401,6 +419,8 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
 
 
 
+
+
     private BigDecimal sumOutAmt;
 
 

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

@@ -387,6 +387,13 @@ public class GoodsSkuResponse implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
 
     private static final long serialVersionUID = 1L;
 

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

@@ -382,6 +382,42 @@ public class OrderItemResponse extends PageInfo<OrderItemResponse> implements Se
     @ApiModelProperty(value = "已出库箱数")
     private String outBoxPiece;
 
+
+    /**
+     * 实际单价
+     */
+    @Excel(name = "实际单价")
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
+
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+    /**
+     * 使用位置
+     */
+    @Excel(name = "使用位置")
+    @ApiModelProperty(value = "使用位置")
+    private String usePlace;
+
+    /**
+     * 折扣
+     */
+    @Excel(name = "折扣")
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 25 - 0
src/main/java/com/dk/mdm/model/response/sale/OrderResponse.java

@@ -348,6 +348,20 @@ public class OrderResponse extends PageInfo<OrderResponse> implements Serializab
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
 
     /**
      * 企业ID
@@ -400,6 +414,17 @@ public class OrderResponse extends PageInfo<OrderResponse> implements Serializab
 
     private String channelId;
 
+    @Excel(name = "折扣")
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
+    @ApiModelProperty(value = "自动办理标识")
+    private Boolean flgAutoHandle;
+
+    @ApiModelProperty(value = "自动办理参数")
+    private Boolean flgHandleSetting;
+
+
     private static final long serialVersionUID = 1L;
 
 }

+ 3 - 0
src/main/java/com/dk/mdm/model/vo/ivt/InboundItemVO.java

@@ -275,6 +275,9 @@ public class InboundItemVO  {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String outId;
 
+    @ApiModelProperty(value = "成本核对标识")
+    private Boolean flgCostCheck;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 31 - 0
src/main/java/com/dk/mdm/model/vo/ivt/OutboundItemVO.java

@@ -41,6 +41,30 @@ public class OutboundItemVO {
     @Excel(name = "使用位置")
     @ApiModelProperty(value = "使用位置")
     private String usePlace;
+    /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+    /**
+     * 实际单价
+     */
+    @Excel(name = "实际单价")
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
 
     /**
      * 入库金额
@@ -192,6 +216,10 @@ public class OutboundItemVO {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    @Excel(name = "赠品标识")
+    @ApiModelProperty(value = "赠品标识")
+    private Boolean flgGift;
+
 
     @ApiModelProperty(value = "箱(出库中)")
     private  Integer outingBox;
@@ -282,6 +310,9 @@ public class OutboundItemVO {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String whId;
 
+    @ApiModelProperty(value = "不够库存数量----新建出库中数量")
+    private BigDecimal notEnoughInventoryQty;
+
 
 
 

+ 21 - 0
src/main/java/com/dk/mdm/model/vo/ivt/OutboundVO.java

@@ -50,6 +50,26 @@ public class OutboundVO{
     private BigDecimal sumAmtRec;
 
     /**
+     * 实际金额
+     */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+    /**
+     * 整单折扣
+     */
+    @Excel(name = "整单折扣")
+    @ApiModelProperty(value = "整单折扣")
+    private BigDecimal discount;
+    /**
+     * 优惠金额
+     */
+    @Excel(name = "优惠金额")
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+
+    /**
      * 收付款类型 (【系统字典】收款、付款)
      */
     @Excel(name = "收付款类型 (【系统字典】收款、付款)")
@@ -338,6 +358,7 @@ public class OutboundVO{
 
 
 
+
     private static final long serialVersionUID = 1L;
 
 }

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

@@ -336,6 +336,14 @@ public class GoodsSkuVO implements Serializable {
      * @TableField(exist = false)
      */
 
+    @Excel(name = "警戒下限")
+    @ApiModelProperty(value = "警戒下限")
+    private Long warningLowerLimit;
+
+    @Excel(name = "警戒上限")
+    @ApiModelProperty(value = "警戒上限")
+    private Long warningUpperLimit;
+
 
     private static final long serialVersionUID = 1L;
 

+ 34 - 0
src/main/java/com/dk/mdm/model/vo/sale/OrderItemVO.java

@@ -253,6 +253,40 @@ public class OrderItemVO extends PageInfo<OrderItemVO> implements Serializable {
 
     private String invId;
 
+
+    /**
+     * 实际单价
+     */
+    @ApiModelProperty(value = "实际单价")
+    private BigDecimal factPrice;
+
+    /**
+     * 实际金额
+     */
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    /**
+     * 优惠金额
+     */
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+
+    /**
+     * 使用位置
+     */
+    @ApiModelProperty(value = "使用位置")
+    private String usePlace;
+
+    /**
+     * 折扣
+     */
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
+
+
     private static final long serialVersionUID = 1L;
 
 }

+ 12 - 1
src/main/java/com/dk/mdm/model/vo/sale/OrderVO.java

@@ -377,10 +377,21 @@ public class OrderVO extends PageInfo<OrderVO> implements Serializable {
     @ApiModelProperty(value = "开单并出库办理标识")
     private Boolean outboundProcessingFlag;
 
-    @Excel(name = "自动办理标识")
     @ApiModelProperty(value = "自动办理标识")
     private Boolean flgAutoHandle;
 
+    @ApiModelProperty(value = "自动办理参数")
+    private Boolean flgHandleSetting;
+
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal factAmt;
+
+    @ApiModelProperty(value = "优惠金额")
+    private BigDecimal discAmt;
+
+    @ApiModelProperty(value = "折扣")
+    private BigDecimal discount;
+
     private static final long serialVersionUID = 1L;
 
 }

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

@@ -795,6 +795,16 @@ public class CommonService extends BaseService<Map<String, Object>> {
             map.put("kindType","供应商类别");
             list = commonMapper.getDataKind(map);
         }
+        // 初始款项
+        if (dataSourceCode.equals("initialPayment")) {
+            map.put("kindType", "初始款项");
+            list = commonMapper.getDataKind(map);
+        }
+        // 收支类型
+        if (dataSourceCode.equals("recType")) {
+            map.put("kindType", "收支类型");
+            list = commonMapper.getDataKind(map);
+        }
 
         return ResponseResultUtil.success(list);
     }

+ 59 - 11
src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java

@@ -101,7 +101,34 @@ public class InventoryService extends BaseService<Inventory> {
      */
     @Pagination
     public ResponseResultVO<PageList<InventoryResponse>> selectByCond(InventoryQuery inboundQuery) {
-        return super.mergeListWithCount(inboundQuery, inventoryMapper.selectByCond(inboundQuery), inventoryMapper.countByCond(inboundQuery));
+
+        ResponseResultVO<PageList<InventoryResponse>> pageListResponseResultVO = super.mergeListWithCount(inboundQuery, inventoryMapper.selectByCond(inboundQuery), inventoryMapper.countByCond(inboundQuery));
+        if (inboundQuery.getWinning()!=null && inboundQuery.getWinning() == true){
+            PageList<InventoryResponse> data = pageListResponseResultVO.getData();
+            List<InventoryResponse> list = data.getList();
+            List<InventoryResponse> newList = list.stream().filter(item ->
+                    (
+                            item.getWarningLowerLimit()!= 0
+                            || item.getWarningUpperLimit() != 0)
+                            && (item.getInvQty().longValue()>item.getWarningLowerLimit()
+                            || item.getInvQty().longValue()>item.getWarningUpperLimit())
+                    ).collect(Collectors.toList());
+            newList.forEach(item -> {
+                int invQty = item.getInvQty().intValue();
+                Long warningLowerLimit = item.getWarningLowerLimit();
+                Long warningUpperLimit = item.getWarningUpperLimit();
+                if (invQty > warningLowerLimit){
+                    item.setWarningMsg("超出警戒上限");
+                }
+                if (invQty > warningUpperLimit){
+                    item.setWarningMsg("超出警戒下限");
+                }
+            });
+            data.setList(newList);
+            pageListResponseResultVO.setData(data);
+        }
+
+        return pageListResponseResultVO;
     }
 
 
@@ -154,13 +181,16 @@ public class InventoryService extends BaseService<Inventory> {
         //endregion
         //赋值
         for (InOutRecordVO inOutRecordVO : inOutRecordVOList) {
-            //负数标识1 可以
-            if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
-                inOutRecordVO.setCanNegativeFlag(true);
-            }
-            //不可以
-            else{
-                inOutRecordVO.setCanNegativeFlag(false);
+            //如果可以为负数标识为空或者false 那就赋值系统参数的
+            if(inOutRecordVO.getCanNegativeFlag() == null || !inOutRecordVO.getCanNegativeFlag()){
+                //负数标识1 可以
+                if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
+                    inOutRecordVO.setCanNegativeFlag(true);
+                }
+                //不可以
+                else{
+                    inOutRecordVO.setCanNegativeFlag(false);
+                }
             }
             //业务单据
             inOutRecordVO.setBiznisType(Constant.InventoryDocCode.OUTBOUND.getTableName());
@@ -835,7 +865,7 @@ public class InventoryService extends BaseService<Inventory> {
         //是负库存逻辑  这里要新建2次 一正一负
         if (inOutRecordVO.getCanNegativeFlag() && !Constant.InventoryType.INBOUND.getName().equals(inOutRecordVO.getInventoryType())) {
             //新建负数库存流水
-            inOutRecordVO.setIntoQty(inOutRecordVO.getIntoQty());
+            inOutRecordVO.setIntoQty(inOutRecordVO.getIntoQty().abs().negate());
             //实体转换
             InOutRecord inOutRecordNeg = inOutRecordConvert.convertToPo(inOutRecordVO);
             //新建
@@ -857,8 +887,11 @@ public class InventoryService extends BaseService<Inventory> {
         }
         //不是负库存逻辑
         else {
-            //销售退货出库  数量转换一下
-            if (Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
+            //region 销售退货出库和入库(不是采退入库)  数量正数
+            if (Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode()) ||
+                    ( !Constant.InventoryDocCode.PURCHASE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode()) &&
+                            Constant.InventoryType.INBOUND.getName().equals(inOutRecordVO.getInventoryType()))
+            ) {
                 //入库价
                 inOutRecordVO.setPriceInto(inOutRecordVO.getPriceInto().abs());
                 //入库数量
@@ -866,6 +899,21 @@ public class InventoryService extends BaseService<Inventory> {
                 //入库金额
                 inOutRecordVO.setIntoAmt(inOutRecordVO.getIntoAmt().abs());
             }
+            //endregion
+
+            //region 采退入库 和出库(不是销退出库) 数量负数
+            if (Constant.InventoryDocCode.PURCHASE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode()) ||
+                    ( !Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode()) &&
+                            Constant.InventoryType.OUTBOUND.getName().equals(inOutRecordVO.getInventoryType()))
+            ) {
+                //入库价
+                inOutRecordVO.setPriceInto(inOutRecordVO.getPriceInto().abs().negate());
+                //入库数量
+                inOutRecordVO.setIntoQty(inOutRecordVO.getIntoQty().abs().negate());
+                //入库金额
+                inOutRecordVO.setIntoAmt(inOutRecordVO.getIntoAmt().abs().negate());
+            }
+            //endregion
             //实体转换
             InOutRecord inOutRecord = inOutRecordConvert.convertToPo(inOutRecordVO);
             //新建

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

@@ -16,10 +16,7 @@ import com.dk.mdm.infrastructure.convert.ivt.InboundItemConvert;
 import com.dk.mdm.infrastructure.convert.ivt.OutboundConvert;
 import com.dk.mdm.infrastructure.convert.ivt.OutboundItemConvert;
 import com.dk.mdm.mapper.common.CommonMapper;
-import com.dk.mdm.mapper.ivt.InboundItemMapper;
-import com.dk.mdm.mapper.ivt.InboundMapper;
-import com.dk.mdm.mapper.ivt.OutboundItemMapper;
-import com.dk.mdm.mapper.ivt.OutboundMapper;
+import com.dk.mdm.mapper.ivt.*;
 import com.dk.mdm.mapper.mst.CustomerMapper;
 import com.dk.mdm.mapper.sale.MultiOwnerMapper;
 import com.dk.mdm.mapper.sale.OrderItemMapper;
@@ -34,20 +31,19 @@ import com.dk.mdm.model.pojo.pur.PurchaseItem;
 import com.dk.mdm.model.pojo.sale.MultiOwner;
 import com.dk.mdm.model.pojo.sale.Order;
 import com.dk.mdm.model.pojo.sale.OrderItem;
+import com.dk.mdm.model.query.ivt.InventoryQuery;
 import com.dk.mdm.model.query.ivt.OutboundItemQuery;
 import com.dk.mdm.model.query.ivt.OutboundQuery;
 import com.dk.mdm.model.query.sale.OrderQuery;
 import com.dk.mdm.model.response.ivt.InboundResponse;
+import com.dk.mdm.model.response.ivt.InventoryResponse;
 import com.dk.mdm.model.response.ivt.OutboundItemResponse;
 import com.dk.mdm.model.response.ivt.OutboundResponse;
 import com.dk.mdm.model.response.pur.PurchaseItemResponse;
 import com.dk.mdm.model.response.pur.PurchaseResponse;
 import com.dk.mdm.model.response.sale.OrderItemResponse;
 import com.dk.mdm.model.response.sale.OrderResponse;
-import com.dk.mdm.model.vo.ivt.InboundItemVO;
-import com.dk.mdm.model.vo.ivt.InboundVO;
-import com.dk.mdm.model.vo.ivt.OutboundItemVO;
-import com.dk.mdm.model.vo.ivt.OutboundVO;
+import com.dk.mdm.model.vo.ivt.*;
 import com.dk.mdm.model.vo.mac.RecPayVO;
 import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.ivt.inventory.InventoryService;
@@ -126,6 +122,99 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
 
     @Autowired
     private ReceiptService receiptService;
+
+    @Autowired
+    private InventoryMapper inventoryMapper;
+
+
+    /*****************************************先判断库存*****************************************/
+
+
+    /**
+     * @desc   : 校验库存是否存在
+     * @date   : 2024/6/11 10:55
+     * @author : 寇珊珊
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public InventoryResponse checkInventoryExist(OutboundItemVO outboundItemVO) {
+        //存在标识
+        //根据sku,仓库,非标号查询
+        InventoryResponse inventoryResponse = null;
+        if (outboundItemVO.getSkuId() != null) {
+            inventoryResponse = inventoryMapper.selectByOther(new InventoryQuery()
+                    .setSkuId(outboundItemVO.getSkuId())
+                    .setWhId(outboundItemVO.getWhId())
+                    .setNonStdCode(outboundItemVO.getNonStdCode()));
+        }
+        //库存不存在
+        if(inventoryResponse ==null){
+            //当前出库商品中在库存中不存在
+            throw new BaseBusinessException(ErrorCodeEnum.SKU_IS_NOT_IN_INVENTORY.getCode(),
+                    ErrorCodeEnum.SKU_IS_NOT_IN_INVENTORY.getMessage());
+        }
+        return inventoryResponse;
+    }
+    
+    /**
+     * @desc   : 先查库存后出库
+     * @date   : 2024/6/11 9:30
+     * @author : 寇珊珊
+     */
+    @Transactional(rollbackFor = {Exception.class})
+    public void inventoryOUtBond(OutboundVO outboundVO) {
+        //region 校验明细
+        if (outboundVO.getItemList().size() == 0) {
+            throw new BaseBusinessException(ErrorCodeEnum.OUTBOUND_ITEM_NOT_EXIST.getCode(),
+                    ErrorCodeEnum.OUTBOUND_ITEM_NOT_EXIST.getMessage());
+        }
+        //endregion
+        //可以负库存  不用交验库存直接走负库存逻辑
+        if (outboundVO.getFlgHandleSetting()) {
+            for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
+                //可以输入负数出库标识
+                outboundItemVO.setCanNegativeFlag(true);
+            }
+            //销售出库新建
+            this.saleOrderOutboundInsert(outboundVO,true);
+        }
+        //先查库存锁表看能出库的数量有多少   可出库数量建一张已出库的单子并扣减库存,剩下的数量建一张出库中的单子
+        else {
+            //过滤外协品
+            for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
+                //商品id不为空才校验库存    因为为空是外协品
+                if(outboundItemVO.getSkuId()!=null){
+                    //查询库存是否存在
+                    InventoryResponse inventoryResponse = this.checkInventoryExist(outboundItemVO);
+                    BigDecimal invQty = inventoryResponse.getInvQty().subtract(outboundItemVO.getOutingQty());
+                    // (库存量  大于等于  本次出库数量不用做任何处理)
+                    //库存量 小于  本次出库数量
+                    if (invQty.compareTo(BigDecimal.ZERO) < 0) {
+                        outboundItemVO.setOutingQty(inventoryResponse.getInvQty());
+                        //不够库存数量----新建出库中数量
+                        outboundItemVO.setNotEnoughInventoryQty(invQty.abs());
+                    }
+                }
+            }
+            //region  过滤出不够出库的每条明细数量  ------新建出库中数据
+            List<OutboundItemVO> outboundIngList = outboundVO.getItemList().stream().filter(it -> it.getNotEnoughInventoryQty()!=null && it.getNotEnoughInventoryQty().compareTo(BigDecimal.ZERO)>0).collect(Collectors.toList());
+            if(outboundIngList != null && outboundIngList.size()>0){
+                outboundVO.setFlgAutoHandle(false);
+                outboundVO.setItemList(outboundIngList);
+                //销售出库新建
+                this.saleOrderOutboundInsert(outboundVO,true);
+            }
+            //endregion
+
+            //region  库存够扣减的明细  -----------新建已出库数据并扣减库存
+            //销售出库新建
+            this.saleOrderOutboundInsert(outboundVO,true);
+            //endregion
+        }
+    }
+    /*****************************************先判断库存*****************************************/
+
     /**
      * @desc : 删除外协品生产外协入库单
      * @date : 2024/5/10 10:31
@@ -262,25 +351,28 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
 
     /**
      * @desc : 销售出库新建
+     * orderTransmitFlag :订单传递过来的
      * @date : 2024/3/7 14:13
      * @author : 寇珊珊
      */
     @Transactional(rollbackFor = {Exception.class})
-    public ResponseResultVO<?> saleOrderOutboundInsert(OutboundVO outboundVO) {
+    public ResponseResultVO<?> saleOrderOutboundInsert(OutboundVO outboundVO,Boolean orderTransmitFlag) {
         //region 如果没有客户id,要新建
-        outboundVO = outCommon.insertCustomer(outboundVO);
+//        outboundVO = outCommon.insertCustomer(outboundVO);
         //endregion
 
-        //region  查询当前公司的系统参数  自动办理信息  并赋值
-        Map<String, Object> map = new HashMap<>();
-        map.put("cpId", outboundVO.getCpId());
-        map.put("code", Constant.SystemConstant.IVT_001.getValue());
-        //自动办理标识
-        String flgHandleSetting = commonMapper.getSettingValue(map);
-        //自动办理标识为1 自动办理入库
-        if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
-            outboundVO.setFlgHandleSetting(Constant.FlgHandleSetting.TRUE.getValue());
-            outboundVO.setFlgAutoHandle(Constant.FlgAutoHandle.TRUE.getValue());
+        //region 查询当前公司的系统参数  自动办理信息  并赋值
+        if(!orderTransmitFlag){
+            Map<String, Object> map = new HashMap<>();
+            map.put("cpId", outboundVO.getCpId());
+            map.put("code", Constant.SystemConstant.IVT_001.getValue());
+            //自动办理标识
+            String flgHandleSetting = commonMapper.getSettingValue(map);
+            //自动办理标识为1 自动办理入库
+            if (Constant.FlgAutoHandleStringType.ONE.getValue().equals(flgHandleSetting)) {
+                outboundVO.setFlgHandleSetting(Constant.FlgHandleSetting.TRUE.getValue());
+                outboundVO.setFlgAutoHandle(Constant.FlgAutoHandle.TRUE.getValue());
+            }
         }
         //endregion
 
@@ -320,12 +412,12 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
         //endregion
 
         //region  新建多业务归属
-        outCommon.insertMultiOwner(outboundVO);
+//        outCommon.insertMultiOwner(outboundVO);
         //endregion
 
         //region 销售订单
         if (outboundVO.getFromId() != null) {
-            //赋值  (这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
+            //赋值  (这里重写了更新方法,数量在更新方法中有数据库原始数量+本次数量)
             Order order = new Order();
             order.setOrderId(outboundVO.getFromId());
             //根据id查询
@@ -447,6 +539,9 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             //region 外协品新建外协入库单
             //筛选出skuId为空的 走外协品逻辑
             List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
+           for(int i=0;i<outsideGoods.size();i++){
+              outsideGoods.get(i).setPriceOut( outsideGoods.get(i).getCostPrice()==null?BigDecimal.ZERO:outsideGoods.get(i).getCostPrice());
+           }
             //删除外协品生产外协入库单
             this.deleteOutsideGoodsInto(outboundVO, outsideGoods);
             //新建外协品生产外协入库单
@@ -470,30 +565,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     }
 
     /**
-     * @desc : 销售出库新建>>>收款
-     * @date : 2024/3/7 14:13
-     * @author : 寇珊珊
-     */
-    @Transactional(rollbackFor = {Exception.class})
-    public ResponseResultVO<?> saleOrderOutboundInsertCollection(OutboundVO outboundVO) {
-        //新建销售出库
-        saleOrderOutboundInsert(outboundVO);
-        //新建收款退款
-        RecPayVO recPayVO = new RecPayVO();
-        recPayVO.setObjectId(outboundVO.getObjectId());
-        recPayVO.setCusPhone(outboundVO.getCusPhone());
-        recPayVO.setOrgId(outboundVO.getOrgId());
-        recPayVO.setStaffId(outboundVO.getStaffId());
-        recPayVO.setAccDate(outboundVO.getAccDate());
-        recPayVO.setMakeStaff(outboundVO.getMakeStaff());
-        recPayVO.setRpType(outboundVO.getRpType());
-        recPayVO.setSumAmtRec(outboundVO.getSumAmtRec());
-        recPayVO.setItemList(outboundVO.getItemListRecPayItemVO());
-        receiptService.insertReceipt(recPayVO);
-        return ResponseResultUtil.success();
-    }
-
-    /**
      * @desc : 销售出库编辑
      * @date : 2024/3/25 16:25
      * @author : 寇珊珊
@@ -523,6 +594,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             }
         }
         //endregion
+
         //region 大编辑
         else {
             // region 更新客户信息
@@ -887,6 +959,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             //endregion
         }
         //endregion
+
         return ResponseResultUtil.success(outboundVO);
     }
 

+ 58 - 43
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java

@@ -16,6 +16,7 @@ import com.dk.mdm.infrastructure.convert.ivt.OutboundItemConvert;
 import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.mapper.ivt.OutboundItemMapper;
 import com.dk.mdm.mapper.ivt.OutboundMapper;
+import com.dk.mdm.mapper.mac.AccountMapper;
 import com.dk.mdm.mapper.sale.OrderItemMapper;
 import com.dk.mdm.mapper.sale.OrderMapper;
 import com.dk.mdm.model.pojo.ivt.InboundItem;
@@ -27,6 +28,7 @@ import com.dk.mdm.model.query.ivt.OutboundItemQuery;
 import com.dk.mdm.model.query.ivt.OutboundQuery;
 import com.dk.mdm.model.response.ivt.OutboundItemResponse;
 import com.dk.mdm.model.response.ivt.OutboundResponse;
+import com.dk.mdm.model.response.mac.AccountResponse;
 import com.dk.mdm.model.response.sale.OrderItemResponse;
 import com.dk.mdm.model.response.sale.OrderResponse;
 import com.dk.mdm.model.vo.ivt.InboundItemVO;
@@ -58,6 +60,8 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
     public BaseMapper<Outbound> getRepository() {
         return outboundMapper;
     }
+    @Autowired
+    private AccountMapper accountMapper;
 
     @Autowired
     private CommonService commonService;
@@ -237,50 +241,54 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
     @Transactional(rollbackFor = {Exception.class})
     public void rollBackTotalAndDetail(List<OutboundItemVO> deleteItemList) {
         if (deleteItemList.size() > 0 &&  deleteItemList.get(0).getFromItemId() != null) {
-            //出库单
-            Map<String, List<OutboundItemVO>> collect = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getSOutId));
-            for (String outId : collect.keySet()) {
-                List<OutboundItemVO> outboundItemVOList = collect.get(outId);
-                BigDecimal delOutQty = outboundItemVOList.stream().map(OutboundItemVO::getOutQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutingQty = outboundItemVOList.stream().map(OutboundItemVO::getOutingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutingAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
-                //总单
-                Outbound outboundPri = new Outbound();
-                outboundPri.setOutId(outId);
-                outboundPri.setReturnQty((delOutQty.add(delOutingQty)).negate());
-                outboundPri.setReturnAmt(delOutAmt.add(delOutingAmt).negate());
-                outboundMapper.updateReturnMessage(outboundPri);
-                //明细
-                for (OutboundItemVO outboundItemVO : outboundItemVOList) {
-                    OutboundItem outboundItemPri = new OutboundItem();
-                    outboundItemPri.setItemId(outboundItemVO.getItemId());
-                    outboundItemPri.setReturnQty(outboundItemVO.getOutingQty());
-                    outboundItemPri.setReturnAmt(outboundItemVO.getOutingAmt());
-                    outboundItemMapper.updateReturnMessage(outboundItemPri);
+            if(deleteItemList.get(0).getSOutId() != null ) {
+                //出库单
+                Map<String, List<OutboundItemVO>> collect = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getSOutId));
+                for (String outId : collect.keySet()) {
+                    List<OutboundItemVO> outboundItemVOList = collect.get(outId);
+                    BigDecimal delOutQty = outboundItemVOList.stream().map(OutboundItemVO::getOutQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutingQty = outboundItemVOList.stream().map(OutboundItemVO::getOutingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutingAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    //总单
+                    Outbound outboundPri = new Outbound();
+                    outboundPri.setOutId(outId);
+                    outboundPri.setReturnQty((delOutQty.add(delOutingQty)).negate());
+                    outboundPri.setReturnAmt(delOutAmt.add(delOutingAmt).negate());
+                    outboundMapper.updateReturnMessage(outboundPri);
+                    //明细
+                    for (OutboundItemVO outboundItemVO : outboundItemVOList) {
+                        OutboundItem outboundItemPri = new OutboundItem();
+                        outboundItemPri.setItemId(outboundItemVO.getItemId());
+                        outboundItemPri.setReturnQty(outboundItemVO.getOutingQty());
+                        outboundItemPri.setReturnAmt(outboundItemVO.getOutingAmt());
+                        outboundItemMapper.updateReturnMessage(outboundItemPri);
+                    }
                 }
             }
-            //订单
-            Map<String, List<OutboundItemVO>> orderCollect = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getSOrderId));
-            for (String orderId : orderCollect.keySet()) {
-                List<OutboundItemVO> outboundItemVOList = orderCollect.get(orderId);
-                BigDecimal delOutQty = outboundItemVOList.stream().map(OutboundItemVO::getOutQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutingQty = outboundItemVOList.stream().map(OutboundItemVO::getOutingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
-                BigDecimal delOutingAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
-                //总单
-                Order orderPri = new Order();
-                orderPri.setOrderId(orderId);
-                orderPri.setReturnQty((delOutQty.add(delOutingQty)).negate());
-                orderPri.setReturnAmt(delOutAmt.add(delOutingAmt).negate());
-                orderMapper.updateReturnMessage(orderPri);
-                //明细
-                for (OutboundItemVO outboundItemVO : outboundItemVOList) {
-                    OrderItem orderItemPri = new OrderItem();
-                    orderItemPri.setItemId(outboundItemVO.getItemId());
-                    orderItemPri.setReturnQty(outboundItemVO.getOutingQty());
-                    orderItemPri.setReturnAmt(outboundItemVO.getOutingAmt());
-                    orderItemMapper.updateReturnMessage(orderItemPri);
+            if(deleteItemList.get(0).getSOrderId() != null ) {
+                //订单
+                Map<String, List<OutboundItemVO>> orderCollect = deleteItemList.stream().collect(Collectors.groupingBy(OutboundItemVO::getSOrderId));
+                for (String orderId : orderCollect.keySet()) {
+                    List<OutboundItemVO> outboundItemVOList = orderCollect.get(orderId);
+                    BigDecimal delOutQty = outboundItemVOList.stream().map(OutboundItemVO::getOutQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutingQty = outboundItemVOList.stream().map(OutboundItemVO::getOutingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
+                    BigDecimal delOutingAmt = outboundItemVOList.stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    //总单
+                    Order orderPri = new Order();
+                    orderPri.setOrderId(orderId);
+                    orderPri.setReturnQty((delOutQty.add(delOutingQty)).negate());
+                    orderPri.setReturnAmt(delOutAmt.add(delOutingAmt).negate());
+                    orderMapper.updateReturnMessage(orderPri);
+                    //明细
+                    for (OutboundItemVO outboundItemVO : outboundItemVOList) {
+                        OrderItem orderItemPri = new OrderItem();
+                        orderItemPri.setItemId(outboundItemVO.getItemId());
+                        orderItemPri.setReturnQty(outboundItemVO.getOutingQty());
+                        orderItemPri.setReturnAmt(outboundItemVO.getOutingAmt());
+                        orderItemMapper.updateReturnMessage(orderItemPri);
+                    }
                 }
             }
         }
@@ -292,7 +300,14 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
      */
     @Transactional(rollbackFor = {Exception.class})
     public ResponseResultVO<?> saleReturnOutboundInsertRefund(OutboundVO outboundVO) {
-      //新建退货出库
+        //根据id查询
+        AccountResponse accountResponse = accountMapper.selectById(outboundVO.getCusId());
+        //退款的时候 判断资金账户金额是否充足
+        BigDecimal result = accountResponse.getReceipt().add(outboundVO.getSumAmtRec());//getSumAmtRec 退款是负值 所以相加
+        if (result.compareTo(BigDecimal.ZERO) < 0) {
+            return ResponseResultUtil.error(ResponseCodeEnum.NOT_LESS_THAN_ZERO);
+        }
+        //新建退货出库
         saleReturnOutboundInsert(outboundVO);
       //新建退款
         RecPayVO recPayVO = new RecPayVO();

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

@@ -144,7 +144,7 @@ public class DictionaryDataService extends BaseService<DictionaryData> {
 
         if (dictionaryDataVO.getDictCode().equals("基础资料-账户") && dictionaryDataVO.getGradeCode() != null && dictionaryDataVO.getGradeCode().equals("STD")) {
             //编辑资金账户
-            ResponseResultVO<PageList<MoneyAccountResponse>> pageListResponseResultVO = moneyAccountService.selectByCond(new MoneyAccountQuery().setMacType(dictionaryDataVO.getDataValue()).setCpId(authUtils.getStaff().getCpId()));
+            ResponseResultVO<PageList<MoneyAccountResponse>> pageListResponseResultVO = moneyAccountService.selectByCond(new MoneyAccountQuery().setMacType(dictionaryDataVO.getDataId()).setCpId(authUtils.getStaff().getCpId()));
             if(pageListResponseResultVO.getData().getList() != null && pageListResponseResultVO.getData().getList().size() > 0){
                 MoneyAccountResponse moneyAccountResponse = pageListResponseResultVO.getData().getList().get(0);
                 moneyAccountService.update(new MoneyAccountVO().setAccDate(LocalDate.now())

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

@@ -231,6 +231,7 @@ public class OrgService extends BaseService<Org> {
         organizationNew.setOrgName("运营中心");
         organizationNew.setParentId(organization.getOrgId());
         organizationNew.setTopId(organization.getOrgId());
+        organizationNew.setFlgBusiness(true);
         organizationNew.setDisplayNo(1);
         codeMap = commonService.getUniqueNoteCode(
                 Constant.docNameConstant.ORG.getName(),orgVO.getCpId(), true);

+ 54 - 35
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -23,7 +23,9 @@ import com.dk.mdm.mapper.mst.*;
 import com.dk.mdm.model.pojo.mst.*;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.ivt.InboundItemQuery;
 import com.dk.mdm.model.query.mst.ComMenuQuery;
+import com.dk.mdm.model.query.mst.GoodsCategoryQuery;
 import com.dk.mdm.model.query.mst.StaffQuery;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.vo.mst.StaffVO;
@@ -40,6 +42,7 @@ import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * @author : 姜永辉
@@ -130,11 +133,11 @@ public class StaffService extends BaseService<Staff> {
             Integer cpId = authUtils.getStaff().getCpId();
             staffQuery.setCpId(cpId);
         }
-//        Map<String,Object> map = new HashMap<>();
-//        map.put("grade_code","STD");
-//        map.put("end_date","2099-09-01");
-//        map.put("web_max_num",1);
-//        map.put("wx_max_num",1);
+//        Map<String, Object> map = new HashMap<>();
+//        map.put("grade_code", "STD");
+//        map.put("end_date", "2099-09-01");
+//        map.put("user_end_date", "2025-04-01");
+//        map.put("wx_max_num", 3);
 //        String s1 = JSON.toJSONString(map);
 //        // 加密
 //        String s = AESUtil.aesEncrypt(s1);
@@ -174,7 +177,7 @@ public class StaffService extends BaseService<Staff> {
             return ResponseResultUtil.error(ResponseCodeEnum.ERROR_STAFF_CODE_EXIST);
         }
         //可以绑定微信的员工人数  人数上限
-        if (staffVO.getFlgCanLogin()!=null && staffVO.getFlgCanLogin()) {
+        if (staffVO.getFlgCanLogin() != null && staffVO.getFlgCanLogin()) {
             ResponseResultVO<?> resultMaxnum = companyFeign.getCompanyMaxStaffNum(cpId);
             if (resultMaxnum.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
                 // 无用户
@@ -188,16 +191,16 @@ public class StaffService extends BaseService<Staff> {
                 staffQuery.setFlgCanLogin(true);
                 staffQuery.setCpId(cpId);
                 List<StaffResponse> staffResponsesFlgCanLogin = staffMapper.selectByCond(staffQuery);
-                if (staffResponsesFlgCanLogin != null && staffResponsesFlgCanLogin.size() > 0 ) {
-                    List<StaffResponse> collectPc = staffResponsesFlgCanLogin.stream().filter(it -> (it.getLoginType()!=null && it.getLoginType() == 1) || (it.getLoginType()!=null && it.getLoginType() == 3)).collect(Collectors.toList());
-                    List<StaffResponse> collectWx = staffResponsesFlgCanLogin.stream().filter(it -> (it.getLoginType()!=null && it.getLoginType() == 2) || (it.getLoginType()!=null && it.getLoginType() == 3)).collect(Collectors.toList());
-                    if ((staffVO.getLoginType() == 1 || staffVO.getLoginType() == 3 ) &&
-                        collectPc != null && collectPc.size() > 0 && intWebMaxnum < collectPc.size() + 1) {
+                if (staffResponsesFlgCanLogin != null && staffResponsesFlgCanLogin.size() > 0) {
+                    List<StaffResponse> collectPc = staffResponsesFlgCanLogin.stream().filter(it -> (it.getLoginType() != null && it.getLoginType() == 1) || (it.getLoginType() != null && it.getLoginType() == 3)).collect(Collectors.toList());
+                    List<StaffResponse> collectWx = staffResponsesFlgCanLogin.stream().filter(it -> (it.getLoginType() != null && it.getLoginType() == 2) || (it.getLoginType() != null && it.getLoginType() == 3)).collect(Collectors.toList());
+                    if ((staffVO.getLoginType() == 1 || staffVO.getLoginType() == 3) &&
+                            collectPc != null && collectPc.size() > 0 && intWebMaxnum < collectPc.size() + 1) {
                         // 无用户
                         throw new BaseBusinessException(ErrorCodeEnum.USER_MAX_PC_STAFF_ERROR.getCode(),
                                 ErrorCodeEnum.USER_MAX_PC_STAFF_ERROR.getMessage());
                     }
-                    if ((staffVO.getLoginType() == 2 || staffVO.getLoginType() == 3 ) &&
+                    if ((staffVO.getLoginType() == 2 || staffVO.getLoginType() == 3) &&
                             collectWx != null && collectWx.size() > 0 && intWxMaxnum < collectWx.size() + 1) {
                         // 无用户
                         throw new BaseBusinessException(ErrorCodeEnum.USER_MAX_WX_STAFF_ERROR.getCode(),
@@ -259,11 +262,13 @@ public class StaffService extends BaseService<Staff> {
         staff.setStaffCode(codeMap.get("outNote").toString());
         staff.setFlgCanLogin(true);
         // 标准版
-        if(Constant.GradeCode.STD.getName().equals(staffVO.getGradeCode())){
+        if (Constant.GradeCode.STD.getName().equals(staffVO.getGradeCode())) {
             staff.setLoginType(2);
-        }else{
+        } else {
             staff.setLoginType(3);
         }
+//        初始标识
+        staff.setFlgInit(true);
         super.insert(staff);
         return ResponseResultUtil.success(staff);
     }
@@ -290,12 +295,17 @@ public class StaffService extends BaseService<Staff> {
         // 插入常用功能 标准版 插入 销售出库 库存查询 商品档案
         if (Constant.STD.equals(gradeCode)) {
             List<String> objectCodeList = new ArrayList<>();
+            // 商品属性
+            objectCodeList.add("goods-attr");
+            // 商品档案
+            objectCodeList.add("goods");
+            // 销售订单
+            objectCodeList.add("order");
             // 销售出库
             objectCodeList.add("order-out");
             // 库存查询
             objectCodeList.add("ivt-detail-report");
-            // 商品档案
-            objectCodeList.add("goods");
+
             ComMenuVO comMenuVO = new ComMenuVO();
             comMenuVO.setCpId(cpId).setStaffId(staffId).setAppCode(Constant.AppCode.WEIXIN.getCode())
                     .setObjectCodeList(objectCodeList);
@@ -404,9 +414,9 @@ public class StaffService extends BaseService<Staff> {
                 moneyAccount.setMacCode(m.get("macCode").toString());
                 moneyAccount.setMacName(m.get("macName").toString());
                 moneyAccount.setMacType(m.get("macType").toString());
-                moneyAccount.setAccDate(LocalDate.parse(m.get("accDate").toString()) );
+                moneyAccount.setAccDate(LocalDate.parse(m.get("accDate").toString()));
 //                moneyAccount.setBalance((BigDecimal) m.get("balance"));
-                moneyAccount.setBalance(new BigDecimal(m.get("balance").toString()) );
+                moneyAccount.setBalance(new BigDecimal(m.get("balance").toString()));
                 moneyAccount.setFlgDefault((Boolean) m.get("flgDefault"));
                 moneyAccount.setFlgNegative((Boolean) m.get("flgNegative"));
                 moneyAccount.setDisplayNo((Integer) m.get("displayNo"));
@@ -436,9 +446,12 @@ public class StaffService extends BaseService<Staff> {
         // 种类
         List<Map<String, Object>> listGoodsCategorys = map.get("goodsCategorys");
         List<GoodsCategory> listG = new ArrayList<>();
-        if (listGoodsCategorys != null && listGoodsCategorys.size() > 0) {
-            for (int i = 0; i < listGoodsCategorys.size(); i++) {
-                Map<String, Object> m = listGoodsCategorys.get(i);
+        List<Map<String, Object>> parentList = listGoodsCategorys.stream().filter(it -> it.get("parentId") == null).collect(Collectors.toList());
+        if (parentList != null && parentList.size() > 0) {
+            for (int i = 0; i < parentList.size(); i++) {
+                Map<String, Object> m = parentList.get(i);
+                // 获取子级
+                List<Map<String, Object>> childList = listGoodsCategorys.stream().filter(it -> m.get("catId").equals(it.get("parentId"))).collect(Collectors.toList());
                 GoodsCategory goodsCategory = new GoodsCategory();
                 goodsCategory.setCatCode(m.get("catCode") + "");
                 goodsCategory.setCatName(m.get("catName") + "");
@@ -448,22 +461,28 @@ public class StaffService extends BaseService<Staff> {
                 if (m.get("topId") != null) {
                     goodsCategory.setTopId(m.get("topId") + "");
                 }
-                if (m.get("levelUpper") != null) {
-                    goodsCategory.setLevelUpper(m.get("levelUpper") + "");
-                }
-                if (m.get("levelLower") != null) {
-                    goodsCategory.setLevelLower(m.get("levelLower") + "");
-                }
-                goodsCategory.setLevelLeaf((Boolean) m.get("levelLeaf"));
-                goodsCategory.setLevelNo((Integer) m.get("levelNo"));
-                goodsCategory.setLevelCode(m.get("levelCode") + "");
-                goodsCategory.setLevelName(m.get("levelName") + "");
+                goodsCategory.setCatId(UUID.randomUUID().toString());
                 goodsCategory.setDisplayNo((Integer) m.get("displayNo"));
                 goodsCategory.setCpId(cpId);
                 goodsCategory.setOpCreateUserId(staffId);
-                listG.add(goodsCategory);
+                goodsCategoryMapper.insert(goodsCategory);
+                listG = new ArrayList<>();
+                // 插入子级
+                for(Map<String, Object> c : childList){
+                    GoodsCategory gc = new GoodsCategory();
+                    gc.setCatCode(c.get("catCode") + "");
+                    gc.setCatName(c.get("catName") + "");
+                    gc.setParentId(goodsCategory.getCatId());
+                    gc.setTopId(goodsCategory.getTopId());
+                    gc.setDisplayNo((Integer) c.get("displayNo"));
+                    gc.setCpId(cpId);
+                    gc.setOpCreateUserId(staffId);
+                    listG.add(gc);
+                };
+                goodsCategoryMapper.insertBatch(listG);
             }
-            goodsCategoryMapper.insertBatch(listG);
+            //执行函数
+            goodsCategoryMapper.resetLevelGoodsCategory(new GoodsCategoryQuery());
         }
 
         // 打印票据
@@ -556,7 +575,7 @@ public class StaffService extends BaseService<Staff> {
         super.updateByUuid(staff);
 
         //可以绑定微信的员工人数  人数上限
-        if (staffVO.getFlgCanLogin()!=null && staffVO.getFlgCanLogin()) {
+        if (staffVO.getFlgCanLogin() != null && staffVO.getFlgCanLogin()) {
             ResponseResultVO<?> resultMaxnum = companyFeign.getCompanyMaxStaffNum(cpId);
             if (resultMaxnum.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
                 // 无用户
@@ -571,7 +590,7 @@ public class StaffService extends BaseService<Staff> {
                     staffQueryf.setFlgCanLogin(true);
                     staffQueryf.setCpId(cpId);
                     List<StaffResponse> staffResponsesFlgCanLogin = staffMapper.selectByCond(staffQueryf);
-                    if (staffResponsesFlgCanLogin != null && staffResponsesFlgCanLogin.size() > 0 ) {
+                    if (staffResponsesFlgCanLogin != null && staffResponsesFlgCanLogin.size() > 0) {
                         List<StaffResponse> collectPc = staffResponsesFlgCanLogin.stream().filter(it -> it.getLoginType() == 1 || it.getLoginType() == 3).collect(Collectors.toList());
                         List<StaffResponse> collectWx = staffResponsesFlgCanLogin.stream().filter(it -> it.getLoginType() == 2 || it.getLoginType() == 3).collect(Collectors.toList());
                         if (collectPc != null && collectPc.size() > 0 && intWebMaxnum < collectPc.size()) {

+ 404 - 88
src/main/java/com/dk/mdm/service/report/ReportService.java

@@ -1,34 +1,53 @@
 package com.dk.mdm.service.report;
 
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-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.util.AuthUtils;
-import com.dk.mdm.mapper.common.CommonMapper;
+import com.dk.common.util.ExcelUtils;
+import com.dk.common.util.ExportMoreView;
+import com.dk.common.util.ExportView;
+import com.dk.common.util.RedisUtil;
 import com.dk.mdm.mapper.ivt.InboundItemMapper;
 import com.dk.mdm.mapper.ivt.OutboundItemMapper;
-import com.dk.mdm.mapper.mst.StaffMapper;
 import com.dk.mdm.mapper.report.ReportMapper;
+import com.dk.mdm.model.report.ExcelDataHandler;
+import com.dk.mdm.model.report.ExcelExportStyleImpl;
+import com.dk.mdm.model.report.ExcelIndex;
+import com.dk.mdm.model.report.analysis.*;
+import com.dk.mdm.model.report.department.*;
+import com.dk.mdm.model.report.from.*;
+import com.dk.mdm.model.report.product.ProductDistribution;
+import com.dk.mdm.model.report.received.*;
+import com.dk.mdm.model.report.sale.*;
+import com.dk.mdm.model.report.staff.*;
+import com.google.common.collect.ImmutableMap;
 import lombok.extern.slf4j.Slf4j;
-import org.postgresql.util.PGobject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
- * @desc   : 报表数据源
  * @author : 常皓宁
- * @date   : 2024/4/11 8:49
+ * @desc : 报表数据源
+ * @date : 2024/4/11 8:49
  */
 @Service
 @Slf4j
@@ -42,20 +61,25 @@ public class ReportService {
 
     @Autowired
     private OutboundItemMapper outboundItemMapper;
+
+    @Autowired
+    private RedisUtil redisUtil;
+
     /**
-     * @desc   : 查询库存
+     * @desc : 查询库存
      * @author : 常皓宁
-     * @date   : 2024/4/11 8:52
+     * @date : 2024/4/11 8:52
      */
     public ResponseResultVO<List<Map<String, Object>>> getIvtDetailReport(Map<String, Object> param) {
         // 获取系统基础数据
         List<Map<String, Object>> list = reportMapper.getIvtDetailReport(param);
         return ResponseResultUtil.success(list);
     }
+
     /**
-     * @desc   : 采购明细报表(明细)
+     * @desc : 采购明细报表(明细)
      * @author : 宋扬
-     * @date   : 2024/4/10 16:39
+     * @date : 2024/4/10 16:39
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getPurDetailReport(Map<String, Object> param) {
         // 校验分页参数
@@ -63,17 +87,17 @@ public class ReportService {
             return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
         }
         // 获取系统基础数据
-        List<Map<String, Object>> list=new ArrayList<>();
+        List<Map<String, Object>> list = new ArrayList<>();
         PageList data = new PageList<>();
         param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
         param.put("end", Integer.parseInt(param.get("pageSize").toString()));
         List<Map<String, Object>> dataList = new ArrayList<>();
-        if(param.get("flgViewItem")==null){
+        if (param.get("flgViewItem") == null) {
             // 查询主表
-            dataList= reportMapper.getPurReport(param);
-        }else {
+            dataList = reportMapper.getPurReport(param);
+        } else {
             // 查询明细
-            dataList= reportMapper.getPurDetailReport(param);
+            dataList = reportMapper.getPurDetailReport(param);
         }
         data.setList(dataList);
         data.setTotal(reportMapper.getSalesTrackingReportCount(param));
@@ -83,9 +107,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 销售明细报表
+     * @desc : 销售明细报表
      * @author : 宋扬
-     * @date   : 2024/4/11 13:22
+     * @date : 2024/4/11 13:22
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getOrderDetailReport(Map<String, Object> param) {
         // 校验分页参数
@@ -93,17 +117,17 @@ public class ReportService {
             return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
         }
         // 获取系统基础数据
-        List<Map<String, Object>> list=new ArrayList<>();
+        List<Map<String, Object>> list = new ArrayList<>();
         PageList data = new PageList<>();
         param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
         param.put("end", Integer.parseInt(param.get("pageSize").toString()));
         List<Map<String, Object>> dataList = new ArrayList<>();
-        if(param.get("flgViewItem")==null){
+        if (param.get("flgViewItem") == null) {
             // 查询主表
-            dataList= reportMapper.getOrderReport(param);
-        }else {
+            dataList = reportMapper.getOrderReport(param);
+        } else {
             // 查询明细
-            dataList= reportMapper.getOrderDetailReport(param);
+            dataList = reportMapper.getOrderDetailReport(param);
         }
         data.setList(dataList);
         data.setTotal(reportMapper.getSalesTrackingReportCount(param));
@@ -113,9 +137,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 出库明细报表
+     * @desc : 出库明细报表
      * @author : 宋扬
-     * @date   : 2024/4/11 16:54
+     * @date : 2024/4/11 16:54
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getOutboundDetailReport(Map<String, Object> param) {
         // 校验分页参数
@@ -127,12 +151,12 @@ public class ReportService {
         param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
         param.put("end", Integer.parseInt(param.get("pageSize").toString()));
         List<Map<String, Object>> dataList = new ArrayList<>();
-        if(param.get("flgViewItem")==null){
+        if (param.get("flgViewItem") == null) {
             // 查询主表
-            dataList= reportMapper.getOutboundReport(param);
-        }else {
+            dataList = reportMapper.getOutboundReport(param);
+        } else {
             // 查询明细
-            dataList= reportMapper.getOutboundDetailReport(param);
+            dataList = reportMapper.getOutboundDetailReport(param);
         }
         data.setList(dataList);
         data.setTotal(reportMapper.getOutboundDetailReportCount(param));
@@ -142,9 +166,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 入库明细报表
+     * @desc : 入库明细报表
      * @author : 宋扬
-     * @date   : 2024/4/11 16:54
+     * @date : 2024/4/11 16:54
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getInboundDetailReport(Map<String, Object> param) {
         // 校验分页参数
@@ -156,12 +180,12 @@ public class ReportService {
         param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
         param.put("end", Integer.parseInt(param.get("pageSize").toString()));
         List<Map<String, Object>> dataList = new ArrayList<>();
-        if(param.get("flgViewItem")==null){
+        if (param.get("flgViewItem") == null) {
             // 查询主表
-            dataList= reportMapper.getInboundlReport(param);
-        }else {
+            dataList = reportMapper.getInboundlReport(param);
+        } else {
             // 查询明细
-            dataList= reportMapper.getInboundDetailReport(param);
+            dataList = reportMapper.getInboundDetailReport(param);
         }
         data.setList(dataList);
         data.setTotal(reportMapper.getSalesTrackingReportCount(param));
@@ -171,9 +195,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 客户收款明细表
+     * @desc : 客户收款明细表
      * @author : 宋扬
-     * @date   : 2024/4/16 11:29
+     * @date : 2024/4/16 11:29
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getRecPayDetailReport(Map<String, Object> param) {
         // 校验分页参数
@@ -195,9 +219,9 @@ public class ReportService {
 
 
     /**
-     * @desc   : 销售跟踪表 列表查询
+     * @desc : 销售跟踪表 列表查询
      * @author : 于继渤
-     * @date   : 2024/4/16 11:27
+     * @date : 2024/4/16 11:27
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getSalesTrackingReport(Map<String, Object> param) {
 
@@ -220,9 +244,9 @@ public class ReportService {
 
 
     /**
-     * @desc   : 销售明细
+     * @desc : 销售明细
      * @author : 于继渤
-     * @date   : 2024/4/16 11:27
+     * @date : 2024/4/16 11:27
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getSalesItemReport(Map<String, Object> param) {
 
@@ -245,9 +269,9 @@ public class ReportService {
 
 
     /**
-     * @desc   : 采购跟踪表 列表查询
+     * @desc : 采购跟踪表 列表查询
      * @author : 王英杰
-     * @date   : 2024/4/16 11:27
+     * @date : 2024/4/16 11:27
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getPurTrackingReport(Map<String, Object> param) {
 
@@ -270,28 +294,28 @@ public class ReportService {
 
 
     /**
-     * @desc   : 采购跟踪表 明细查询
+     * @desc : 采购跟踪表 明细查询
      * @author : 王英杰
-     * @date   : 2024/4/16 11:27
+     * @date : 2024/4/16 11:27
      */
     public ResponseResultVO getPurTrackingReportDetail(String purId) {
 
-        return ResponseResultUtil.success(reportMapper.getPurTrackingReportDetail(purId) );
+        return ResponseResultUtil.success(reportMapper.getPurTrackingReportDetail(purId));
     }
 
     /**
-     * @desc   : 销售跟踪表 明细查询
+     * @desc : 销售跟踪表 明细查询
      * @author : 于继渤
-     * @date   : 2024/4/16 11:27
+     * @date : 2024/4/16 11:27
      */
     public ResponseResultVO getSalesTrackingReportDetail(String id) {
-        return ResponseResultUtil.success(reportMapper.getSalesTrackingReportDetail(id) );
+        return ResponseResultUtil.success(reportMapper.getSalesTrackingReportDetail(id));
     }
 
 
     /**
-     * @desc   : 日结对账表
-     * @date   : 2024/4/24 15:11
+     * @desc : 日结对账表
+     * @date : 2024/4/24 15:11
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReport(Map<String, Object> param) {
@@ -312,8 +336,8 @@ public class ReportService {
     }
 
     /**
-     * @desc   :  日结对账表-查销售订单
-     * @date   : 2024/4/24 15:11
+     * @desc :  日结对账表-查销售订单
+     * @date : 2024/4/24 15:11
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReportByOrder(Map<String, Object> param) {
@@ -335,8 +359,8 @@ public class ReportService {
 
 
     /**
-     * @desc   :  日结对账表-查销售出库
-     * @date   : 2024/4/24 15:11
+     * @desc :  日结对账表-查销售出库
+     * @date : 2024/4/24 15:11
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReportByOut(Map<String, Object> param) {
@@ -358,8 +382,8 @@ public class ReportService {
 
 
     /**
-     * @desc   :  日结对账表-查收款单
-     * @date   : 2024/4/24 15:11
+     * @desc :  日结对账表-查收款单
+     * @date : 2024/4/24 15:11
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getDailyReconciliationReportByPay(Map<String, Object> param) {
@@ -380,14 +404,14 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 收发存汇总报表
+     * @desc : 收发存汇总报表
      * @author : 宋扬
-     * @date   : 2024/4/20 13:30
+     * @date : 2024/4/20 13:30
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getIvtSumReport(Map<String, Object> param) {
         if (param.get("querys") != null) {
             JSONObject querys = JSONObject.parseObject(param.get("querys").toString());
-            param.put("querys",querys);
+            param.put("querys", querys);
         }
 
         List<Map<String, Object>> list = reportMapper.getIvtSumReport(param);
@@ -409,9 +433,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 收发存汇总报表-明细
+     * @desc : 收发存汇总报表-明细
      * @author : 宋扬
-     * @date   : 2024/4/23 14:10
+     * @date : 2024/4/23 14:10
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getIvtItemReport(Map<String, Object> param) {
         // 校验分页参数
@@ -438,9 +462,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 供应商往来余额表
+     * @desc : 供应商往来余额表
      * @author : 常皓宁
-     * @date   : 2024/4/25 13:27
+     * @date : 2024/4/25 13:27
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getSupAccount(Map<String, Object> param) {
         param.put("start", (Integer.parseInt(param.get("currentPage").toString()) - 1) * Integer.parseInt(param.get("pageSize").toString()));
@@ -453,9 +477,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 供应商往来余额表明细
+     * @desc : 供应商往来余额表明细
      * @author : 常皓宁
-     * @date   : 2024/4/25 13:27
+     * @date : 2024/4/25 13:27
      */
     public ResponseResultVO<List<Map<String, Object>>> getSupAccountItem(Map<String, Object> param) {
         // 获取系统基础数据
@@ -464,9 +488,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 资金日记账
+     * @desc : 资金日记账
      * @author : 常皓宁
-     * @date   : 2024/4/26 16:43
+     * @date : 2024/4/26 16:43
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getFundReport(Map<String, Object> param) {
         // 校验分页参数
@@ -494,28 +518,103 @@ public class ReportService {
 
 
     /**
-     * @desc   : 销售简报
-     * @date   : 2024/5/6 8:43
+     * @desc : 销售简报
+     * @date : 2024/5/6 8:43
      * @author : 寇珊珊
      */
-    public ResponseResultVO<Map<String,Object>> getReportBatch(Map<String,Map<String,Object>> param){
-        Map<String,Object> result = new HashMap<>();
-        for(String key : param.keySet()){
-            JSONObject valueObj =  JSONObject.parseObject(reportMapper.getReportBatch(param.get(key)).get("report").getValue());
-            result.put(key,valueObj);
+    public ResponseResultVO<Map<String, Object>> getReportBatch(Map<String, Map<String, Object>> param) {
+        Map<String, Object> result = new HashMap<>();
+        for (String key : param.keySet()) {
+            JSONObject valueObj = JSONObject.parseObject(reportMapper.getReportBatch(param.get(key)).get("report").getValue());
+            result.put(key, valueObj);
         }
         return ResponseResultUtil.success(result);
     }
 
+
+    //    @Autowired
+//    private LogReportExportFeign logReportExportFeign;
+    @Transactional(rollbackFor = {Exception.class})
+    public void export(HttpServletResponse response, String uuid) throws Exception {
+
+        ExportMoreView exportMoreView = new ExportMoreView();
+
+        List<ExportView> exportViews = new ArrayList<>();
+
+        Map<String, Object> redisData = ((Map<String, Object>) redisUtil.get(uuid));
+
+        Map<String, Map<String, Object>> params = (Map<String, Map<String, Object>>) redisData.get("params");
+        /* 查询条件 */
+        String searchCondition = redisData.get("searchCond").toString();
+        /* 数据库查询出来的数据 */
+        Map<String, Object> reportData = getReportBatch(params).getData();
+
+        String fileName = redisData.get("fileName").toString();
+//        String filePath = redisData.get("filePath").toString();
+
+        exportViews.add(new ExportView());
+        exportViews.get(0).setCls(ExcelIndex.class);
+        ExportParams indexExportParams = new ExportParams(searchCondition, "报表目录");
+        indexExportParams.setDataHandler(new ExcelDataHandler());
+        exportViews.get(0).setExportParams(indexExportParams);
+        exportViews.get(0).setTitleHeight(60);
+        List<ExcelIndex> sheetList = new ArrayList<>();
+//        String currentUserId = null;
+//        Long cpId = null;
+        for (String key : params.keySet()) {
+            sheetList.add(new ExcelIndex().setSheetName(TITLE_MAP.get(key)));
+            Map<String, Object> currentMap = params.get(key);
+            /* 手动处理一下 userId */
+//            if(currentUserId == null){
+//                currentUserId = currentMap.get("userId").toString();
+//            }
+            /* 手动处理cpId */
+//            if(cpId == null){
+//                cpId = Long.valueOf(currentMap.get("cpId").toString());
+//            }
+            Class<?> clazz = CLASS_MAP.get(key);
+            List<?> list = JSONArray.parseArray(JSONArray.toJSONString(((Map<String, Object>) reportData.get(key)).get(currentMap.get("items").toString())), clazz);
+            ExportParams exportParams = new ExportParams(
+                    TITLE_MAP.get(key),
+                    getTotal(currentMap.get("secondTitle").toString(), (Map<String, Object>) reportData.get(key), (List<String>) currentMap.get("calc10000")),
+                    TITLE_MAP.get(key));
+
+            exportParams.setStyle(ExcelExportStyleImpl.class);
+
+            ExportView exportView = new ExportView(exportParams, list, clazz);
+            exportViews.add(exportView);
+        }
+        exportViews.get(0).setDataList(sheetList);
+        exportMoreView.setMoreViewList(exportViews);
+
+        DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分ss秒");
+        String currentTime = LocalDateTime.now().format(outputFormatter);
+
+        /* 导出成功之前 插入日志表 */
+//        LogReportExportVo logReportExportVo = new LogReportExportVo()
+//                .setReportName(fileName + "-" +currentTime +".xls")
+//                .setReportPath(filePath)
+//                .setCpId(cpId)
+//                .setQueryItems(JSONObject.parseObject(JSONObject.toJSONString(params)))
+//                .setExportData(new JSONObject(reportData))
+//                .setOpCreateUserId(currentUserId);
+//        ResponseResultVO<?> insertRes = logReportExportFeign.insert(logReportExportVo);
+//        if(insertRes.getCode() == 200){
+        ExcelUtils.defaultExportMoreSheet(fileName + "-" + currentTime + ".xls", response, exportMoreView);
+//        }else{
+//            throw new BaseBusinessException(insertRes.getCode(),insertRes.getMessage());
+//        }
+    }
+
     /**
-     * @desc   : 客户往来账
+     * @desc : 客户往来账
      * @author : 宋扬
-     * @date   : 2024/5/10 10:32
+     * @date : 2024/5/10 10:32
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getMacRecCurrentReport(Map<String, Object> param) {
         if (param.get("querys") != null) {
             JSONObject querys = JSONObject.parseObject(param.get("querys").toString());
-            param.put("querys",querys);
+            param.put("querys", querys);
         }
 
         List<Map<String, Object>> list = reportMapper.getMacRecCurrentReport(param);
@@ -537,9 +636,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 客户往来账明细
+     * @desc : 客户往来账明细
      * @author : 宋扬
-     * @date   : 2024/5/10 10:32
+     * @date : 2024/5/10 10:32
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getMacRecCurrentItemReport(Map<String, Object> param) {
         // 校验分页参数
@@ -566,14 +665,14 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 供应商往来账
+     * @desc : 供应商往来账
      * @author : 宋扬
-     * @date   : 2024/5/10 10:32
+     * @date : 2024/5/10 10:32
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getMacPayCurrentReport(Map<String, Object> param) {
         if (param.get("querys") != null) {
             JSONObject querys = JSONObject.parseObject(param.get("querys").toString());
-            param.put("querys",querys);
+            param.put("querys", querys);
         }
 
         List<Map<String, Object>> list = reportMapper.getMacPayCurrentReport(param);
@@ -595,9 +694,9 @@ public class ReportService {
     }
 
     /**
-     * @desc   : 供应商往来账明细
+     * @desc : 供应商往来账明细
      * @author : 宋扬
-     * @date   : 2024/5/10 10:32
+     * @date : 2024/5/10 10:32
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getMacPayCurrentItemReport(Map<String, Object> param) {
         // 校验分页参数
@@ -623,5 +722,222 @@ public class ReportService {
         }
     }
 
+    /**
+     * @desc : 客户收支表查询
+     * @author : 刘尧
+     * @date : 2024/6/6 14:27
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getCusRecPayReportItem(Map<String, Object> params) {
+        List<Map<String, Object>> items = reportMapper.getCusRecPayReportItemByUser(params);
+        List<Map<String, Object>> arrears = reportMapper.getUserArrears(params);
+        // 判断类型
+        for (Map<String, Object> item : items) {
+            if (Double.valueOf(String.valueOf(item.get("outAmt")).equals("null") ? "0" : String.valueOf(item.get("outAmt"))) > 0) {
+                item.put("type", "销售出库");
+            } else if (Double.valueOf(String.valueOf(item.get("outAmt")).equals("null") ? "0" : String.valueOf(item.get("outAmt"))) < 0) {
+                item.put("type", "销售退货");
+            } else if (Double.valueOf(String.valueOf(item.get("sumAmtRec")).equals("null") ? "0" : String.valueOf(item.get("sumAmtRec"))) > 0) {
+                item.put("type", "客户收款");
+            } else if (Double.valueOf(String.valueOf(item.get("sumAmtRec")).equals("null") ? "0" : String.valueOf(item.get("sumAmtRec"))) < 0) {
+                item.put("type", "客户退款");
+            }
+        }
+        for (Map<String, Object> map : arrears) {
+            // 筛选出符合条件的明细
+            List<Map<String, Object>> userArrearsItem = items.stream()
+                    .filter(item -> item.get("objectId").equals(map.get("objectId")))
+                    .filter(item -> (Double.valueOf(String.valueOf(item.get("outAmt")).equals("null") ? "0" : String.valueOf(item.get("outAmt"))) != 0
+                            || Double.valueOf(String.valueOf(item.get("sumAmtRec")).equals("null") ? "0" : String.valueOf(item.get("sumAmtRec"))) != 0))
+                    .collect(Collectors.toList());
+            AtomicReference<Double> total = new AtomicReference<>(0.00);
+            // 计算单用户的总计
+            userArrearsItem.forEach(item -> {
+                total.updateAndGet(v -> v + Double.valueOf(String.valueOf(item.get("outAmt")).equals("null") ? "0" : String.valueOf(item.get("outAmt")))
+                        + Double.valueOf(String.valueOf(item.get("sumAmtRec")).equals("null") ? "0" : String.valueOf(item.get("sumAmtRec"))));
+            });
+            map.put("item", userArrearsItem);
+            map.put("totalMoney", total);
+        }
+
+        return ResponseResultUtil.success(arrears);
+    }
 
+    private static final Map<String, Class<?>> CLASS_MAP = ImmutableMap.<String, Class<?>>builder()
+            /* 销售分析 */
+            .put("saleTask", SaleTask.class)
+            .put("returnSituation", ReturnSituation.class)
+            .put("customerUnitPrice", CustomerUnitPrice.class)
+//            .put("activityEffect1", ActivityEffect1.class)
+//            .put("activityEffect2", ActivityEffect2.class)
+//            .put("customizedWisdom1",CustomizedWisdom1.class)
+//            .put("customizedWisdom2",CustomizedWisdom2.class)
+            /* 收款分析 */
+            .put("receivedTask", ReceivedTask.class)
+            .put("arrearsInfo", ArrearsInfo.class)
+            /* 客户分析 */
+//            .put("budgetQuotation", BudgetQuotation.class)
+            .put("potentialCustomerAnalysis", PotentialCustomerAnalysis.class)
+
+            /* 客户来源 */
+            .put("transaction", Transaction.class)
+//            .put("offer", Offer.class)
+            .put("potentialCustomerAnalysisFrom", PotentialCustomerAnalysisFrom.class)
+            /* 产品分布 */
+            .put("productDistribution", ProductDistribution.class)
+            /* 部门成交 */
+            .put("departmentTransactionRanking", DepartmentTransactionRanking.class)
+            /* 部门收款 */
+            .put("departmentCollectionRanking", DepartmentCollectionRanking.class)
+            /* 业务员成交 */
+            .put("staffTransactionRanking", StaffTransactionRanking.class)
+            /* 业务员收款 */
+            .put("staffCollectionRanking", StaffCollectionRanking.class)
+
+            /* 店长简报部分 */
+            /* 销售分析 */
+            .put("saleTaskStaff", SaleTaskStaff.class)
+            .put("returnSituationStaff", ReturnSituationStaff.class)
+            .put("customerUnitPriceStaff", CustomerUnitPriceStaff.class)
+            .put("customizedWisdomStaff1", CustomizedWisdomStaff1.class)
+            .put("customizedWisdomStaff2", CustomizedWisdomStaff2.class)
+
+            /* 收款分析 */
+            .put("receivedTaskStaff", ReceivedTaskStaff.class)
+            .put("arrearsInfoStaff", ArrearsInfoStaff.class)
+
+            /* 收款分析 */
+            .put("budgetQuotationStaff", BudgetQuotationStaff.class)
+            .put("potentialCustomerAnalysisStaff", PotentialCustomerAnalysisStaff.class)
+
+            /* 销售分析-部门品类 */
+            .put("orgCategoryAmt", OrgCategoryAmt.class)
+            .put("orgCategoryQty", OrgCategoryQty.class)
+
+            /* 销售分析-部门单品 */
+            .put("orgSpuAmt", OrgSpuAmt.class)
+            .put("orgSpuQty", OrgSpuQty.class)
+
+            /* 销售分析-业务员品类 */
+            .put("staffCategoryAmt", StaffCategoryAmt.class)
+            .put("staffCategoryQty", StaffCategoryQty.class)
+
+
+            /* 销售分析-业务员单类 */
+            .put("staffSpuAmt", StaffSpuAmt.class)
+            .put("staffSpuQty", StaffSpuQty.class)
+
+            /* 订单参考利润 - 品类排行 */
+            .put("saleReferenceProfit1", categoryRanking.class)
+            /* 订单参考利润 - 部门排行 */
+            .put("saleReferenceProfit2", orgRanking.class)
+            /* 订单参考利润 - 业务员排行 */
+            .put("saleReferenceProfit3", staffRanking.class)
+
+            /* 出库参考利润 - 品类排行 */
+            .put("outReferenceProfit1", categoryRanking.class)
+            /* 出库参考利润 - 部门排行 */
+            .put("outReferenceProfit2", orgRanking.class)
+            /* 出库参考利润 - 业务员排行 */
+            .put("outReferenceProfit3", staffRanking.class)
+
+            .build();
+
+    private static final Map<String, String> TITLE_MAP = ImmutableMap.<String, String>builder()
+            /* 销售分析 */
+            .put("saleTask", "销售分析-销售任务")
+            .put("returnSituation", "销售分析-退货情况")
+            .put("customerUnitPrice", "销售分析-客单价")
+//            .put("activityEffect1","销售分析-促销套餐活动效果")
+//            .put("activityEffect2","销售分析-促销单品活动效果")
+//            .put("customizedWisdom1","销售分析-定+智品类")
+//            .put("customizedWisdom2","销售分析-定+定制类")
+            /* 收款分析 */
+            .put("receivedTask", "收款分析-收款任务")
+            .put("arrearsInfo", "收款分析-欠款情况")
+            /* 客户分析 */
+//            .put("budgetQuotation", "客户分析-预算报价")
+            .put("potentialCustomerAnalysis", "客户分析-潜客分析")
+            /* 客户来源 */
+            .put("transaction", "客户来源-成交情况")
+//            .put("offer", "客户来源-报价情况")
+            .put("potentialCustomerAnalysisFrom", "客户来源-潜客分析")
+            /* 产品分布 */
+            .put("productDistribution", "产品分布")
+            /* 部门成交 */
+            .put("departmentTransactionRanking", "部门成交排行")
+            /* 部门收款 */
+            .put("departmentCollectionRanking", "部门收款排行")
+            /* 业务员成交 */
+            .put("staffTransactionRanking", "业务员成交排行")
+            /* 业务员收款 */
+            .put("staffCollectionRanking", "业务员收款排行")
+
+            /* 店长简报部分 */
+            /* 销售分析 */
+            .put("saleTaskStaff", "销售分析-销售任务")
+            .put("returnSituationStaff", "销售分析-退货情况")
+            .put("customerUnitPriceStaff", "销售分析-客单价")
+            .put("customizedWisdomStaff1", "销售分析-定+智品类")
+            .put("customizedWisdomStaff2", "销售分析-定+定制类")
+
+            /* 收款分析 */
+            .put("receivedTaskStaff", "收款分析-收款任务")
+            .put("arrearsInfoStaff", "收款分析-欠款情况")
+
+            /* 收款分析 */
+            .put("budgetQuotationStaff", "客户分析-预算报价")
+            .put("potentialCustomerAnalysisStaff", "客户分析-潜客分析")
+
+            /*部门品类 */
+            .put("orgCategoryAmt", "销售分析-部门品类金额")
+            .put("orgCategoryQty", "销售分析-部门品类数量")
+
+            /*部门单品 */
+            .put("orgSpuAmt", "销售分析-部门单品金额")
+            .put("orgSpuQty", "销售分析-部门单品数量")
+
+            /*业务员品类 */
+            .put("staffCategoryAmt", "销售分析-部门单品金额")
+            .put("staffCategoryQty", "销售分析-部门单品数量")
+
+            /*业务员单品 */
+            .put("staffSpuAmt", "销售分析-业务员单品金额")
+            .put("staffSpuQty", "销售分析-业务员单品数量")
+
+            /* 订单参考利润 - 品类排行 */
+            .put("saleReferenceProfit1", "订单参考利润-品类排行")
+            /* 订单参考利润 - 部门排行 */
+            .put("saleReferenceProfit2", "订单参考利润-部门排行")
+            /* 订单参考利润 - 业务员排行 */
+            .put("saleReferenceProfit3", "订单参考利润-业务员排行")
+
+            /* 出库参考利润 - 品类排行 */
+            .put("outReferenceProfit1", "出库参考利润-品类排行")
+            /* 出库参考利润 - 部门排行 */
+            .put("outReferenceProfit2", "出库参考利润-部门排行")
+            /* 出库参考利润 - 业务员排行 */
+            .put("outReferenceProfit3", "出库参考利润-业务员排行")
+
+
+            .build();
+
+    private static String getTotal(String str, Map<String, Object> data, List<String> calcStr) {
+        String returnStr = str;
+        Pattern dynamic = Pattern.compile(".*\\$\\{([A-Za-z0-9]+)\\}.*");
+        Pattern dynamicLimitCount = Pattern.compile("\\$\\{([A-Za-z0-9]+)\\}");
+        List<String> params = new ArrayList<>();
+        Matcher m = dynamicLimitCount.matcher(str);
+        while (m.find()) {
+            params.add(m.group(1));
+        }
+        for (String it : params) {
+            String value = data.get(it).toString();
+            if (value != null && calcStr.contains(it)) {
+                BigDecimal b = new BigDecimal(value);
+                value = b.divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP).toString();
+            }
+            returnStr = returnStr.replaceAll("\\$\\{" + it + "\\}", value);
+        }
+        return returnStr;
+    }
 }

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

@@ -375,7 +375,9 @@ public class OrderService extends BaseService<Order> {
             outboundVO.setOutDate(LocalDate.now());
             outboundVO.setOutingQty(orderVO.getSumQuantity());
             outboundVO.setOutingAmt(orderVO.getSumAmount());
-            outboundSaleOrderService.saleOrderOutboundInsert(outboundVO);
+            outboundVO.setFlgAutoHandle(orderVO.getFlgAutoHandle());
+            outboundVO.setFlgHandleSetting(orderVO.getFlgHandleSetting());
+            outboundSaleOrderService.inventoryOUtBond(outboundVO);
         }
 
         return ResponseResultUtil.success();