Explorar o código

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

hongxudong hai 1 ano
pai
achega
75656a21a7
Modificáronse 32 ficheiros con 1020 adicións e 518 borrados
  1. 42 32
      src/main/java/com/dk/mdm/controller/common/CommonController.java
  2. 9 0
      src/main/java/com/dk/mdm/controller/mst/GoodsSkuController.java
  3. 7 8
      src/main/java/com/dk/mdm/generator/Generator.java
  4. 94 56
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.java
  5. 66 1
      src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml
  6. 6 2
      src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml
  7. 6 6
      src/main/java/com/dk/mdm/mapper/ivt/InventoryMapper.xml
  8. 1 1
      src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml
  9. 9 0
      src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.java
  10. 8 0
      src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml
  11. 7 3
      src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml
  12. 15 7
      src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml
  13. 14 4
      src/main/java/com/dk/mdm/mapper/sale/OrderMapper.xml
  14. 1 0
      src/main/java/com/dk/mdm/mapper/wxapi/basic/WxCommonMapper.xml
  15. 4 4
      src/main/java/com/dk/mdm/model/pojo/mst/Customer.java
  16. 7 0
      src/main/java/com/dk/mdm/model/pojo/mst/Staff.java
  17. 3 0
      src/main/java/com/dk/mdm/model/pojo/sale/Order.java
  18. 8 0
      src/main/java/com/dk/mdm/model/pojo/sale/OrderItem.java
  19. 6 0
      src/main/java/com/dk/mdm/model/response/sale/OrderItemResponse.java
  20. 8 0
      src/main/java/com/dk/mdm/model/response/sale/OrderResponse.java
  21. 12 0
      src/main/java/com/dk/mdm/model/vo/ivt/InOutRecordVO.java
  22. 11 0
      src/main/java/com/dk/mdm/model/vo/ivt/OutboundItemVO.java
  23. 8 1
      src/main/java/com/dk/mdm/model/vo/sale/OrderItemVO.java
  24. 109 67
      src/main/java/com/dk/mdm/service/common/CommonService.java
  25. 11 1
      src/main/java/com/dk/mdm/service/ivt/inventory/InventoryService.java
  26. 33 15
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java
  27. 4 0
      src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleReturnService.java
  28. 196 171
      src/main/java/com/dk/mdm/service/mac/AccountService.java
  29. 21 10
      src/main/java/com/dk/mdm/service/mst/CustomerService.java
  30. 4 0
      src/main/java/com/dk/mdm/service/mst/GoodsSkuService.java
  31. 1 1
      src/main/java/com/dk/mdm/service/mst/StaffService.java
  32. 289 128
      src/main/java/com/dk/mdm/service/sale/OrderService.java

+ 42 - 32
src/main/java/com/dk/mdm/controller/common/CommonController.java

@@ -4,7 +4,6 @@ import com.dk.common.controller.BaseController;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.service.BaseService;
-import com.dk.mdm.model.query.wxapi.basic.WxCommonQuery;
 import com.dk.mdm.service.common.CommonService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -14,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Dictionary;
 import java.util.List;
 import java.util.Map;
 
@@ -321,9 +319,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     @PostMapping("get_goods_for_purchase")
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForPurchase(@RequestBody Map<String, Object> param) {
@@ -331,9 +329,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     @PostMapping({"get_goods_for_purchase_by_page"})
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForPurchaseByPage(@RequestBody Map<String, Object> param) {
@@ -458,6 +456,7 @@ public class CommonController extends BaseController<Map<String, Object>> {
     public ResponseResultVO<List<Map<String, Object>>> getGoodsBrandListNoPage(@RequestBody Map<String, Object> param) {
         return commonService.getGoodsBrandListNoPage(param);
     }
+
     /**
      * @desc :  商品种类查询
      * @author : 王英杰
@@ -550,8 +549,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
 
 
     /**
-     * @desc   : 查询供应商与客户
-     * @date   : 2024/3/13 14:01
+     * @desc : 查询供应商与客户
+     * @date : 2024/3/13 14:01
      * @author : 寇珊珊
      */
     @PostMapping({"get_supplier_and_customer"})
@@ -560,8 +559,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取供应商和客户数据(分页)
-     * @date   : 2024/3/13 14:53
+     * @desc : 获取供应商和客户数据(分页)
+     * @date : 2024/3/13 14:53
      * @author : 寇珊珊
      */
     @ApiOperation(
@@ -574,8 +573,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取组织机构
-     * @date   : 2024/3/13 16:48
+     * @desc : 获取组织机构
+     * @date : 2024/3/13 16:48
      * @author : 寇珊珊
      */
     @ApiOperation(
@@ -589,8 +588,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取组织机构(分页)
-     * @date   : 2024/3/13 17:03
+     * @desc : 获取组织机构(分页)
+     * @date : 2024/3/13 17:03
      * @author : 寇珊珊
      */
     @ApiOperation(
@@ -642,9 +641,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取多业务部门
+     * @desc : 获取多业务部门
      * @author : 付斌
-     * @date   : 2024-03-20 16:54
+     * @date : 2024-03-20 16:54
      */
     @ApiOperation(
             value = "获取多业务部门",
@@ -656,9 +655,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取多业务员
+     * @desc : 获取多业务员
      * @author : 付斌
-     * @date   : 2024-03-20 16:54
+     * @date : 2024-03-20 16:54
      */
     @ApiOperation(
             value = "获取多业务员",
@@ -670,9 +669,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 组织仓库
+     * @desc : 组织仓库
      * @author : 宋扬
-     * @date   : 2024/3/22 15:47
+     * @date : 2024/3/22 15:47
      */
     @ApiOperation(
             value = "获取组织仓库",
@@ -684,9 +683,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 组织资金账户
+     * @desc : 组织资金账户
      * @author : 宋扬
-     * @date   : 2024/3/22 15:52
+     * @date : 2024/3/22 15:52
      */
     @ApiOperation(
             value = "获取资金账户",
@@ -698,9 +697,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     @PostMapping("get_goods_for_purchase_return")
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForPurchaseReturn(@RequestBody Map<String, Object> param) {
@@ -708,9 +707,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     @PostMapping({"get_goods_for_purchase_return_by_page"})
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForPurchaseReturnByPage(@RequestBody Map<String, Object> param) {
@@ -745,9 +744,9 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取组织仓库
+     * @desc : 获取组织仓库
      * @author : 付斌
-     * @date   : 2024-04-10 13:30
+     * @date : 2024-04-10 13:30
      */
     @ApiOperation(
             value = "获取组织仓库",
@@ -760,8 +759,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取商品(其他入库开单用)
-     * @date   : 2024/4/20 11:19
+     * @desc : 获取商品(其他入库开单用)
+     * @date : 2024/4/20 11:19
      * @author : 寇珊珊
      */
     @PostMapping("get_goods_for_into")
@@ -770,8 +769,8 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(其他入库开单用)(分页)
-     * @date   : 2024/4/20 11:19
+     * @desc : 获取商品(其他入库开单用)(分页)
+     * @date : 2024/4/20 11:19
      * @author : 寇珊珊
      */
     @PostMapping({"get_goods_for_into_by_page"})
@@ -820,6 +819,17 @@ public class CommonController extends BaseController<Map<String, Object>> {
     public ResponseResultVO<Map<String, Object>> selectUserCount(@RequestBody Map<String, Object> param) {
         return commonService.selectUserCount(param);
     }
+
+    /**
+     * @desc : 查询首页实时数据
+     * @author : 付斌
+     * @date : 2024-06-19 11:06
+     */
+    @ApiOperation(value = "查询首页试试数据", notes = "查询首页试试数据")
+    @PostMapping({"get_real_time_data"})
+    public ResponseResultVO<Map<String, Object>> getRealTimeData(@RequestBody Map<String, Object> param) {
+        return commonService.getRealTimeData(param);
+    }
 }
 
 

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

@@ -103,4 +103,13 @@ public class GoodsSkuController{
        return goodsSkuService.importSKU(list,response,cpId);
     }
 
+    /**
+     * @desc : 保存修改数据
+     * @author : 刘尧
+     * @date : 2024/6/17 13:50
+     */
+    @PostMapping("/saveUpdateList")
+    public ResponseResultVO<?> saveUpdateList(@RequestBody List<GoodsSkuVO> goodsSkuVOS){
+        return goodsSkuService.saveUpdateList(goodsSkuVOS);
+    }
 }

+ 7 - 8
src/main/java/com/dk/mdm/generator/Generator.java

@@ -79,11 +79,11 @@ public class Generator {
         PackageConfig pc = new PackageConfig();
 //        pc.setModuleName("task");                  //模块包名
         pc.setParent("com.dk.mdm");        //父包路径
-        pc.setEntity("model.pojo.ivt");                     //实体层路径
-        pc.setMapper("mapper.ivt");                 //mapper层路径
-        pc.setXml("mapper.ivt");                       //xml层路径
-        pc.setServiceImpl("service.ivt");                   //业务层路径
-        pc.setController("controller.ivt");             //控制层路径
+        pc.setEntity("model.pojo.mac");                     //实体层路径
+        pc.setMapper("mapper.mac");                 //mapper层路径
+        pc.setXml("mapper.mac");                       //xml层路径
+        pc.setServiceImpl("service.mac");                   //业务层路径
+        pc.setController("controller.mac");             //控制层路径
         //app相关路径
 //        pc.setEntity("model.app.pojo.pset");                     //实体层路径
 //        pc.setMapper("mapper.app.pset");                 //mapper层路径
@@ -94,9 +94,8 @@ public class Generator {
 
         //4、策略配置
         StrategyConfig strategy = new StrategyConfig();
-        strategy.setTablePrefix("t_psi");                                             //表名前缀
-        strategy.setInclude("t_psi_transfer");                                    //设置要映射的表名,只需改这里即可,可以是一个数组,一次性生成多张表。
-        strategy.setInclude("t_psi_transfer_item");
+        strategy.setTablePrefix("t_mac");                                             //表名前缀
+        strategy.setInclude("t_mac_transfer_item");                                    //设置要映射的表名,只需改这里即可,可以是一个数组,一次性生成多张表。
         strategy.setNaming(NamingStrategy.underline_to_camel);                      //转驼峰
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);                //字段下划线转驼峰
         strategy.setEntityLombokModel(true);                                        //是否使用lombok开启注解

+ 94 - 56
src/main/java/com/dk/mdm/mapper/common/CommonMapper.java

@@ -1,7 +1,6 @@
 package com.dk.mdm.mapper.common;
 
 import com.dk.common.mapper.BaseMapper;
-import com.dk.mdm.model.query.mst.StaffQuery;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
@@ -58,7 +57,6 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     List<Map<String, Object>> getDataKind(Map param);
 
 
-
     /**
      * @desc : 获取组织部门
      * @author : 姜宁
@@ -150,7 +148,8 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
      * @author : 姜宁
      * @date : 2023/2/7 14:45
      */
-    Map<String, Object> selectDictionaryData (Map param );
+    Map<String, Object> selectDictionaryData(Map param);
+
     /**
      * @desc : 获取用户隐藏列
      * @author : 周兴
@@ -211,30 +210,30 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     Long getGoodsCountByPage(Map param);
 
     /**
-     * @desc   : 获取商品(销售订单开单用)
+     * @desc : 获取商品(销售订单开单用)
      * @author : 付斌
-     * @date   : 2024-03-09 9:57
+     * @date : 2024-03-09 9:57
      */
     List<Map<String, Object>> getGoodsForOrder(Map param);
 
     /**
-     * @desc   : 获取商品(销售订单开单用)(数量)
+     * @desc : 获取商品(销售订单开单用)(数量)
      * @author : 付斌
-     * @date   : 2024-03-09 9:57
+     * @date : 2024-03-09 9:57
      */
     Long getGoodsForOrderCountByPage(Map param);
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     List<Map<String, Object>> getGoodsForPurchase(Map param);
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     Long getGoodsForPurchaseCountByPage(Map param);
 
@@ -294,6 +293,7 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
      * @date : 2024/3/1 9:21
      */
     List<Map<String, Object>> getGoodsBrand(Map param);
+
     /**
      * @desc : 获取商品品牌 树形查询
      * @author : 王英杰
@@ -387,12 +387,14 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     Long getInventoryCountByPage(Map param);
 
     List<Map<String, Object>> getSaleChannel(Map param);
+
     /**
      * @desc : 结算方式-小程序
      * @author : 姜永辉
      * @date : 2024-03-05 10:52
      */
     List<Map<String, Object>> getSettlement(Map param);
+
     /**
      * @desc : 渠道-小程序
      * @author : 姜永辉
@@ -402,66 +404,66 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取供应商和客户数据
-     * @date   : 2024/3/13 14:03
+     * @desc : 获取供应商和客户数据
+     * @date : 2024/3/13 14:03
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getSupplierAndCustomer(Map param);
 
     /**
-     * @desc   : 获取供应商和客户数据分页
-     * @date   : 2024/3/13 14:03
+     * @desc : 获取供应商和客户数据分页
+     * @date : 2024/3/13 14:03
      * @author : 寇珊珊
      */
-    List<Map<String,Object>> getSupplierAndCustomerByPage(Map param);
+    List<Map<String, Object>> getSupplierAndCustomerByPage(Map param);
 
     /**
-     * @desc   : 获取供应商和客户数据分页数量
-     * @date   : 2024/3/13 14:53
+     * @desc : 获取供应商和客户数据分页数量
+     * @date : 2024/3/13 14:53
      * @author : 寇珊珊
      */
     Long getSupplierAndCustomerByPageCount(Map param);
 
     /**
-     * @desc   : 获取员工
-     * @date   : 2024/3/13 16:24
+     * @desc : 获取员工
+     * @date : 2024/3/13 16:24
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getStaff(Map param);
 
     /**
-     * @desc   : 获取员工-范围权限
-     * @date   : 2024/3/13 16:24
+     * @desc : 获取员工-范围权限
+     * @date : 2024/3/13 16:24
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getStaffPurviewType(Map param);
 
 
     /**
-     * @desc   : 获取组织机构
-     * @date   : 2024/3/13 17:03
+     * @desc : 获取组织机构
+     * @date : 2024/3/13 17:03
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getOrganization(Map param);
 
     /**
-     * @desc   : 获取组织机构分页
-     * @date   : 2024/3/13 17:03
+     * @desc : 获取组织机构分页
+     * @date : 2024/3/13 17:03
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getOrganizationByPage(Map param);
 
     /**
-     * @desc   : 获取组织机构数量
-     * @date   : 2024/3/13 17:03
+     * @desc : 获取组织机构数量
+     * @date : 2024/3/13 17:03
      * @author : 寇珊珊
      */
     Long getOrganizationCount(Map<String, Object> param);
 
     /**
-     * @desc   : 获取资金账户(下拉)
+     * @desc : 获取资金账户(下拉)
      * @author : 付斌
-     * @date   : 2024-03-14 11:35
+     * @date : 2024-03-14 11:35
      */
     List<Map<String, Object>> getMac(Map param);
 
@@ -480,90 +482,126 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     Long getMoneyAccountCountByPage(Map param);
 
     /**
-     * @desc   : 获取多业务部门
+     * @desc : 获取多业务部门
      * @author : 付斌
-     * @date   : 2024-03-20 16:52
+     * @date : 2024-03-20 16:52
      */
     List<Map<String, Object>> selectMultiOrg(Map param);
 
     /**
-     * @desc   : 获取多业务员
+     * @desc : 获取多业务员
      * @author : 付斌
-     * @date   : 2024-03-20 16:52
+     * @date : 2024-03-20 16:52
      */
     List<Map<String, Object>> selectMultiStaff(Map param);
 
     /**
-     * @desc   : 组织仓库
+     * @desc : 组织仓库
      * @author : 宋扬
-     * @date   : 2024/3/22 15:22
+     * @date : 2024/3/22 15:22
      */
     List<Map<String, Object>> selectMultiWarehouse(Map param);
 
     /**
-     * @desc   : 组织资金账户
+     * @desc : 组织资金账户
      * @author : 宋扬
-     * @date   : 2024/3/22 15:22
+     * @date : 2024/3/22 15:22
      */
     List<Map<String, Object>> selectMultiMoneyAccount(Map param);
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     List<Map<String, Object>> getGoodsForPurchaseReturn(Map param);
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     Long getGoodsForPurchaseReturnByPage(Map param);
 
     /**
-     * @desc   : 获取员工的范围权限类型
+     * @desc : 获取员工的范围权限类型
      * @author : 常皓宁
-     * @date   : 2024/4/2 10:15
+     * @date : 2024/4/2 10:15
      */
     List<Map<String, Object>> getPurviewType(Map param);
+
     List<Map<String, Object>> getInventoryByList(Map param);
 
-    List<Map<String,Object>> getLabelPrintItem(Map param);
+    List<Map<String, Object>> getLabelPrintItem(Map param);
 
     /**
-     * @desc   : 获取组织仓库
+     * @desc : 获取组织仓库
      * @author : 付斌
-     * @date   : 2024-04-10 13:31
+     * @date : 2024-04-10 13:31
      */
     List<Map<String, Object>> getOrgWh(Map param);
 
 
     /**
-     * @desc   :  获取商品(其他入库开单用)
-     * @date   : 2024/4/20 11:21
+     * @desc :  获取商品(其他入库开单用)
+     * @date : 2024/4/20 11:21
      * @author : 寇珊珊
      */
     List<Map<String, Object>> getGoodsForInto(Map param);
 
     /**
-     * @desc   : 获取商品(其他入库开单用)(数量)
-     * @date   : 2024/4/20 11:21
+     * @desc : 获取商品(其他入库开单用)(数量)
+     * @date : 2024/4/20 11:21
      * @author : 寇珊珊
      */
     Long getGoodsForIntoCountByPage(Map param);
 
     /**
-     * @desc   :  销售分析-我的 门店助手的 销售金额 收款金额 库存成本
-     * @date   : 2024/4/20 11:21
+     * @desc :  销售分析-我的 门店助手的 销售金额 收款金额 库存成本
+     * @date : 2024/4/20 11:21
      * @author : 姜永辉
      */
     Map<String, Object> getHomeOrderRecCost(Map param);
 
     /**
-     * @desc   : 查询用户授权数据
+     * @desc : 查询用户授权数据
      * @author : 周兴
-     * @date   : 2024/5/30 10:42
+     * @date : 2024/5/30 10:42
+     */
+    Map<String, Object> selectUserCount(Map param);
+
+    /**
+     * @desc : 获取公司
+     * @author : 付斌
+     * @date : 2024-06-19 9:59
+     */
+    List<Map<String, Object>> getCompany(Map param);
+
+    /**
+     * @desc : 查询首页实时数据1
+     * @author : 付斌
+     * @date : 2024-06-19 10:59
+     */
+    List<Map<String, Object>> getRealTimeData1(Map param);
+
+    /**
+     * @desc : 查询首页实时数据2
+     * @author : 付斌
+     * @date : 2024-06-19 10:59
+     */
+    List<Map<String, Object>> getRealTimeData2(Map param);
+
+    /**
+     * @desc : 查询首页实时数据3
+     * @author : 付斌
+     * @date : 2024-06-19 10:59
+     */
+    List<Map<String, Object>> getRealTimeData3(Map param);
+
+    /**
+     * @desc : 查询首页实时数据4
+     * @author : 付斌
+     * @date : 2024-06-19 10:59
      */
-    Map<String,Object> selectUserCount(Map param);
+    List<Map<String, Object>> getRealTimeData4(Map param);
 }

+ 66 - 1
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -281,6 +281,7 @@
         left join  dkic_b.t_mst_org tmg on tmg.org_id = staff.org_id
         where staff.flg_valid
         and staff.cp_id =#{cpId}
+        and staff.flg_ghost = false
         <if test="staffCode != null and staffCode != ''">
             And position (#{staffCode} in staff.staff_code)>0
         </if>
@@ -310,6 +311,7 @@
         from dkic_b.t_mst_staff AS staff
         where staff.flg_valid
         and staff.cp_id =#{cpId}
+        and staff.flg_ghost = false
         <if test="staffCode != null and staffCode != ''">
             And position (#{staffCode} in staff.staff_code)>0
         </if>
@@ -1425,6 +1427,7 @@
         s.flg_valid
         and s.hr_status = 1
         and s.cp_id = #{cpId}
+        and s.flg_ghost = false
         <if test="staffCode !=null and staffCode !=''">
             AND s.staff_code LIKE concat('%',my_ex.likequery(#{staffCode}),'%')
         </if>
@@ -1454,6 +1457,7 @@
         s.flg_valid
         and s.hr_status = 1
         and s.cp_id = #{cpId}
+        and s.flg_ghost = false
         <if test="staffCode !=null and staffCode !=''">
             AND s.staff_code LIKE concat('%',my_ex.likequery(#{staffCode}),'%')
         </if>
@@ -1633,7 +1637,7 @@
                      ) mo
                            on mo.owner_id = t.staff_id
         where t.flg_valid
-
+        and t.flg_ghost = false
         <if test="staffCode!=null and staffCode!='' ">
             and t.staff_code LIKE concat('%',my_ex.likequery(#{staffCode}),'%')
         </if>
@@ -1965,4 +1969,65 @@
             ),
             CURRENT_DATE as "currentDate"
     </select>
+
+    <!--查询公司-->
+    <select id="getCompany" resultType="java.util.Map">
+        select t.cp_id         as "cpId",
+               t.cp_code       as "cpCode",
+               t.cp_name       as "cpName",
+               t.svc_code      as "svcCode",
+               t.opening_date  as "openingDate",
+               t.grade_code    as "gradeCode",
+               t.end_date      as "endDate",
+               t.max_staff_num as "maxStaffNum",
+               t.flg_valid     as "flgValid",
+               t.remarks,
+               t.owner
+        from dkic_a.t_a_company as t
+        where t.cp_id = #{cpId}
+    </select>
+
+    <!--查询首页实时数据1-->
+    <select id="getRealTimeData1" resultType="java.util.Map">
+        select count(1) as "orderQty", coalesce(sum(t.sum_amount), 0) as "orderAmt"
+        from dkic_b.t_psi_order as t
+        where t.flg_valid
+          and t.cp_id = #{cpId}
+          and t.op_create_time <![CDATA[ >= ]]> #{createTimeStart}
+          and t.op_create_time <![CDATA[ < ]]> #{createTimeEnd}
+    </select>
+
+    <!--查询首页实时数据2-->
+    <select id="getRealTimeData2" resultType="java.util.Map">
+        select count(1) as "outQty", coalesce(sum(t.out_amt), 0) as "outAmt"
+        from dkic_b.t_psi_outbound as t
+        where t.flg_valid
+          and t.out_type = '出库类型-销售出库'
+          and t.cp_id = #{cpId}
+          and t.op_create_time <![CDATA[ >= ]]> #{createTimeStart}
+          and t.op_create_time <![CDATA[ < ]]> #{createTimeEnd}
+    </select>
+
+    <!--查询首页实时数据3-->
+    <select id="getRealTimeData3" resultType="java.util.Map">
+        select count(1) as "returnQty", -coalesce(sum(t.out_amt), 0) as "returnAmt"
+        from dkic_b.t_psi_outbound as t
+        where t.flg_valid
+          and t.out_type = '出库类型-销退回库'
+          and t.cp_id = #{cpId}
+          and t.op_create_time <![CDATA[ >= ]]> #{createTimeStart}
+          and t.op_create_time <![CDATA[ < ]]> #{createTimeEnd}
+    </select>
+
+    <!--查询首页实时数据4-->
+    <select id="getRealTimeData4" resultType="java.util.Map">
+        select count(1) as "cusQty", coalesce(sum(t.sum_amount), 0) as "cusAmt"
+        from (select sum(t.sum_amount) as sum_amount
+              from dkic_b.t_psi_order as t
+              where t.flg_valid
+                and t.cp_id = #{cpId}
+                and t.op_create_time <![CDATA[ >= ]]> #{createTimeStart}
+                and t.op_create_time <![CDATA[ < ]]> #{createTimeEnd}
+              group by t.cus_id) as t
+    </select>
 </mapper>

+ 6 - 2
src/main/java/com/dk/mdm/mapper/ivt/InboundItemMapper.xml

@@ -589,8 +589,8 @@
         <include refid="Base_Column_List_Response"/>
         ,tpid.into_no as "intoNo"
         ,tmgs.sku_code  as "skuCode"
-        ,tpii.sku_model as "skuModel"
-        ,tpii.sku_name  as "skuName"
+        ,tmgs.sku_model as "skuModel"
+        ,tmgs.sku_name  as "skuName"
         ,tmgs.sku_spec  as "skuSpec"
         ,tmgb.brand_name  as "brandName"
         ,tmgb.short_name  as "shortName"
@@ -669,6 +669,9 @@
                 AND tpii.into_status =
                 any(#{intoStatusList, typeHandler= StringListTypeHandler})
             </if>
+            <if test="skuModel != null and skuModel != ''">
+                AND tmgs.sku_model LIKE concat('%',my_ex.likequery(#{skuModel}),'%')
+            </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>
@@ -682,6 +685,7 @@
     <update id="updateCost" parameterType="com.dk.mdm.model.pojo.ivt.InboundItem">
         update dkic_b.t_psi_inbound_item
         <set>
+            flg_cost_check = true,
             <if test="costPrice!= null">
                 cost_price= #{costPrice},
             </if>

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

@@ -312,8 +312,8 @@
         FROM dkic_b.t_psi_inventory tpi
         <include refid="Join_Table"/>
         <where>
-            (tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
-            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit)
+            ((tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
+            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit))
             <if test="whId != null and whId != ''">
                 AND tpi.wh_id = #{whId}::UUID
             </if>
@@ -360,7 +360,7 @@
             <if test="brandId != null and brandId != ''">
                 AND tmgs.brand_id = #{brandId}::UUID
             </if>
-            <if test="searchText != null">
+            <if test="searchText != null and searchText != ''">
                 AND (tmgs.sku_model  like concat('%', my_ex.likequery(#{searchText}) , '%')
                 OR  tmgs.sku_name like concat('%', my_ex.likequery(#{searchText}) , '%')
                 OR  tpi.non_std_code like concat('%', my_ex.likequery(#{searchText}) , '%')
@@ -391,8 +391,8 @@
         LEFT JOIN dkic_b.t_mst_unit tmu ON tmu.unit_id = tmgs.unit_id
         LEFT JOIN dkic_b.t_mst_unit subtmu ON subtmu.unit_id = tmgs.sub_unit_id
         <where>
-            (tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
-            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit)
+            ((tmgs.warning_lower_limit &lt;&gt; 0 AND tpi.inv_qty &lt; tmgs.warning_lower_limit)
+            OR (tmgs.warning_upper_limit &lt;&gt; 0 AND tpi.inv_qty > tmgs.warning_upper_limit))
             <if test="flgValid != null">
                 AND tpi.flg_valid = #{flgValid}
             </if>
@@ -408,7 +408,7 @@
             <if test="brandId != null and brandId != ''">
                 AND tmgs.brand_id = #{brandId}::UUID
             </if>
-            <if test="searchText != null">
+            <if test="searchText != null and searchText != ''">
                 AND (tmgs.sku_model  like concat('%', my_ex.likequery(#{searchText}) , '%')
                 OR  tmgs.sku_name like concat('%', my_ex.likequery(#{searchText}) , '%')
                 OR  tpi.non_std_code like concat('%', my_ex.likequery(#{searchText}) , '%')

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

@@ -282,7 +282,7 @@
         -- tms1.staff_name as follow_staff_name
         (SELECT COUNT(1) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id = tmc.cp_id AND
         tpo.flg_valid) AS "orderQuantity",
-        (SELECT sum(tpo.sum_amount) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id = tmc.cp_id
+        (SELECT sum(tpo.fact_amt) FROM dkic_b.t_psi_order tpo WHERE tpo.cus_id = tmc.cus_id AND tpo.cp_id = tmc.cp_id
         AND tpo.flg_valid) AS "orderAmount",
 
 

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

@@ -6,6 +6,8 @@ import com.dk.mdm.model.query.mst.GoodsSkuQuery;
 import com.dk.mdm.model.query.mst.RoleQuery;
 import com.dk.mdm.model.response.mst.GoodsSkuResponse;
 import com.dk.mdm.model.response.mst.RoleResponse;
+import com.dk.mdm.model.vo.mst.GoodsSkuVO;
+import io.lettuce.core.dynamic.annotation.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -28,5 +30,12 @@ public interface GoodsSkuMapper extends BaseMapper<GoodsSku>{
      * @date : 2024/2/26 10:36
      */
     Long countByCond(GoodsSkuQuery goodsSkuQuery);
+
+    /**
+     * @desc : 更新预警信息
+     * @author : 刘尧
+     * @date : 2024/6/17 13:50
+     */
+    Boolean saveWarningList(@Param("list") List<GoodsSkuVO> goodsSkuVOS);
 }
 

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

@@ -10,6 +10,14 @@
         , 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, warning_upper_limit, warning_lower_limit
     </sql>
+    <!--  更新预警信息  -->
+    <update id="saveWarningList">
+        <foreach collection="list" item="item" index="index" separator=";">
+            UPDATE dkic_b.t_mst_goods_sku
+            SET warning_lower_limit = #{item.warningLowerLimit}, warning_upper_limit = #{item.warningUpperLimit}
+            WHERE sku_id = #{item.skuId}::uuid
+        </foreach>
+    </update>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.GoodsSku">

+ 7 - 3
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_init,
+        t.flg_valid,t.flg_can_login,t.hr_status,t.login_type,t.flg_init,t.flg_ghost,
         t.cp_id, t.op_create_time, t.op_create_user_id, t.op_update_time, t.op_update_user_id
     </sql>
 
@@ -41,12 +41,14 @@
         <result column="default_wh_id" property="defaultWhId" typeHandler="UuidTypeHandler" />
         <result column="default_wh_name" property="defaultWhName"/>
         <result column="flg_init" property="flgInit"/>
+        <result column="flg_ghost" property="flgGhost"/>
         <result column="grade_code" property="gradeCode"/>
     </resultMap>
 
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            t.flg_ghost = false
             <if test="staffId != null">
                 AND t.staff_id = #{staffId}
             </if>
@@ -122,6 +124,7 @@
     <select id="selectByCondByCode" resultMap="BaseResultMap">
         SELECT t.* FROM dkic_b.t_mst_staff t
         <where>
+            t.flg_valid
             <if test="staffCode != null and staffCode != ''">
                 AND t.staff_code  = #{staffCode}
             </if>
@@ -186,6 +189,7 @@
         LEFT JOIN dkic_b.t_mst_warehouse tmw ON tmw.wh_id = tmow.wh_id
         WHERE t.wx_user_id = #{id}::uuid
         AND t.cp_id = #{cpId}
+        and t.flg_valid
     </select>
 
 
@@ -239,8 +243,8 @@
         WHERE
         cp_id = #{cpId}
         AND flg_valid = TRUE
-        <if test="staffName != null and staffName != ''">
-            AND staff_name = #{staffName}
+        <if test="staffCode != null and staffCode != ''">
+            AND staff_code = #{staffCode}
         </if>
     </select>
 </mapper>

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

@@ -55,6 +55,7 @@
         <result column="fact_amt" property="factAmt"/>
         <result column="use_place" property="usePlace"/>
         <result column="discount" property="discount"/>
+        <result column="sup_id" property="supId"/>
     </resultMap>
 
     <!-- 通用查询映射结果 -->
@@ -96,6 +97,7 @@
         <result column="fact_amt" property="factAmt"/>
         <result column="use_place" property="usePlace"/>
         <result column="discount" property="discount"/>
+        <result column="sup_id" property="supId"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -215,10 +217,10 @@
         ,ul.unit_name as "unitName"
         ,u2.unit_name as "subUnitName"
         FROM dkic_b.t_psi_order_item as t
-                 inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+        LEFT join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
                  LEFT JOIN dkic_b.t_mst_unit AS ul ON tmgs.unit_id = ul.unit_id
                  LEFT JOIN dkic_b.t_mst_unit AS u2 ON tmgs.sub_unit_id = u2.unit_id
-                 inner join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
+        LEFT join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
                  left join dkic_b.t_mst_warehouse tmw on tmw.wh_id = t.wh_id
         <include refid="Condition"/>
         order by t.item_index
@@ -341,8 +343,8 @@
                t.item_index,
                t.sku_id,
                tmgs.sku_code                              as "skuCode",
-               tmgs.sku_model                             as "skuModel",
-               tmgs.sku_name                              as "skuName",
+               t.sku_model                             as "skuModel",
+               t.sku_name                              as "skuName",
                tmgs.sku_images AS "skuImages",
                t.pack_box  ,
                sys.f_remove_zero(t.item_qty)              as "orderQty",
@@ -379,6 +381,9 @@
 
                t.price_sale                               as "priceOut",
                t.price_sale * (t.item_qty - t.outing_qty - t.out_qty) as outing_amt,
+               t.fact_price,
+               t.fact_amt,
+               t.discount,
                t.non_std_code,
                t.remarks,
                t.wh_id,
@@ -391,15 +396,18 @@
         ,(select ul.decimal_places from  dkic_b.t_mst_unit ul where t.unit_id = ul.unit_id) as "decimalPlaces"
         ,ul.unit_name as "unitName"
         ,u2.unit_name as "subUnitName"
+         ,tmgb.brand_name
+         ,tmgb.short_name
         ,dkic_b.f_box_piece(u2.unit_name,ul.unit_name,t.box,t.piece) as "boxPiece"
         FROM dkic_b.t_psi_order_item as t
-                 inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+                 LEFT join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
                  left join dkic_b.t_psi_inventory as tpi
                            on tpi.sku_id = t.sku_id and tpi.non_std_code = t.non_std_code
                                and tpi.wh_id = t.wh_id and tpi.cp_id = t.cp_id
             LEFT JOIN dkic_b.t_mst_unit AS ul ON t.unit_id = ul.unit_id
             LEFT JOIN dkic_b.t_mst_unit AS u2 ON t.sub_unit_id = u2.unit_id
+            LEFT join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
         where t.flg_valid
           and t.item_qty > t.outing_qty
           and t.order_id = #{orderId}::uuid
@@ -438,7 +446,7 @@
                ,dkic_b.f_box_piece(u2.unit_name,ul.unit_name,tpobi.out_box,tpobi.out_piece) AS "outBoxPiece"
         FROM dkic_b.t_psi_outbound_item as tpobi
                  inner join dkic_b.t_psi_order_item as t on t.item_id = tpobi.from_item_id
-                 inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+                 LEFT join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
                  left join dkic_b.t_mst_warehouse as tmw on tmw.wh_id = t.wh_id
                  LEFT JOIN dkic_b.t_mst_unit AS ul ON tpobi.unit_id = ul.unit_id
                  LEFT JOIN dkic_b.t_mst_unit AS u2 ON tpobi.sub_unit_id = u2.unit_id
@@ -652,7 +660,7 @@
         ,dkic_b.f_box_piece(u2.unit_name,ul.unit_name,t.box,t.piece) as "boxPiece"
         FROM dkic_b.t_psi_order_item as t
         left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
-        inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
+        LEFT join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id
         left join dkic_b.t_mst_unit ul on t.unit_id = ul.unit_id
         left join dkic_b.t_mst_unit u2 on t.sub_unit_id = u2.unit_id
         left join(select from_item_id,sum(item_qty) as sumQty from dkic_b.t_psi_purchase_item

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

@@ -10,7 +10,7 @@
         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,
-        fact_amt,disc_amt,discount,flg_auto_handle,flg_handle_setting
+        fact_amt,disc_amt,discount,flg_auto_handle,flg_handle_setting,outbound_processing_flag
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -114,7 +114,9 @@
         <result column="discount" property="discount"/>
         <result column="flg_auto_handle" property="flgAutoHandle"/>
         <result column="flg_handle_setting" property="flgHandleSetting"/>
-<!--            <collection property="orderItemResponseList" resultMap="orderItemListMap"  />-->
+        <result column="flg_business" property="flgBusiness"/>
+        <result column="outbound_processing_flag" property="outboundProcessingFlag"/>
+        <!--            <collection property="orderItemResponseList" resultMap="orderItemListMap"  />-->
     </resultMap>
 
     <resultMap id="orderItemListMap" type="java.util.Map">
@@ -208,6 +210,8 @@
         <result column="flg_auto_handle" property="flgAutoHandle"/>
         <result column="flg_handle_setting" property="flgHandleSetting"/>
         <result column="channelName" property="channelName"/>
+        <result column="outbound_processing_flag" property="outboundProcessingFlag"/>
+        <result column="categoryCount" property="categoryCount"/>
         <collection property="orderItemResponseList" resultMap="itemListMap" columnPrefix="list_"/>
 
     </resultMap>
@@ -782,7 +786,8 @@
                t.cp_id,
                t.discount,
                t.fact_amt,
-               t.disc_amt
+               t.disc_amt,
+               tmo.flg_business
         FROM dkic_b.t_psi_order as t
                  left join dkic_b.t_mst_sale_channel tmsc on t.sales_channel = tmsc.channel_id
                  left join dkic_b.t_mst_org tmo on t.org_id = tmo.org_id
@@ -858,6 +863,7 @@
             discount,
             flg_auto_handle,
             flg_handle_setting,
+            outbound_processing_flag,
         </trim>
         )
         values
@@ -904,6 +910,7 @@
                 #{item.discount},
                 #{item.flgAutoHandle},
                 #{item.flgHandleSetting},
+                #{item.outboundProcessingFlag},
             </trim>
             )
         </foreach>
@@ -1045,10 +1052,13 @@
         tmsc.channel_name as "channelName",
 
         <include refid="Base_Column_List_Item_Response_Detail_Join"/>
+        ,(select count(DISTINCT tmgss.category_id) from dkic_b.t_psi_order_item ti
+                LEFT  JOIN dkic_b.t_mst_goods_sku tmgss ON tmgss.sku_id = ti.sku_id
+                where ti.order_id = t.order_id and ti.flg_valid) as "categoryCount"
         FROM dkic_b.t_psi_order as t
         left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
         left join dkic_b.t_psi_order_item toi on toi.order_id  = t.order_id
-        inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id  = toi.sku_id
+        left 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

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

@@ -188,6 +188,7 @@
          from dkic_b.t_mst_staff u
          where u.flg_valid
             and u.hr_status = 1
+           and u.flg_ghost = false
          and u.cp_id = #{cpId}
     </select>
     <!--    获取品牌-->

+ 4 - 4
src/main/java/com/dk/mdm/model/pojo/mst/Customer.java

@@ -174,10 +174,10 @@ public class Customer extends PageInfo<Customer> implements Serializable {
     /**
      * 员工名称
      */
-    @Excel(name = "业务员")
+    @Excel(name = "业务员编码")
     @ApiModelProperty(value = "员工名称")
     @TableField(exist = false)
-    private String staffName;
+    private String staffCode;
 
 
     /**
@@ -190,10 +190,10 @@ public class Customer extends PageInfo<Customer> implements Serializable {
     /**
      * 报备人
      */
-    @Excel(name = "报备人")
+    @Excel(name = "报备人编码")
     @ApiModelProperty(value = "报备人")
     @TableField(exist = false)
-    private String reportStaffName;
+    private String reportStaffCode;
 
 
     /**

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

@@ -214,6 +214,13 @@ public class Staff extends PageInfo<Staff> implements Serializable {
     @ApiModelProperty(value = "初始标识")
     private Boolean flgInit;
 
+    /**
+     * 幽灵标识(用于运维查问题)
+     */
+    @Excel(name = "幽灵标识(用于运维查问题)")
+    @ApiModelProperty(value = "幽灵标识(用于运维查问题)")
+    private Boolean flgGhost;
+
     /*
      * 相关属性
      * @TableField(exist = false)

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

@@ -366,6 +366,9 @@ public class Order extends PageInfo<Order> implements Serializable {
     @ApiModelProperty(value = "自动办理参数")
     private Boolean flgHandleSetting;
 
+    @ApiModelProperty(value = "开单并出库办理标识")
+    private Boolean outboundProcessingFlag;
+
     private static final long serialVersionUID = 1L;
 
 }

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

@@ -280,6 +280,8 @@ public class OrderItem extends PageInfo<OrderItem> implements Serializable {
     @ApiModelProperty(value = "使用位置")
     private String usePlace;
 
+    @ApiModelProperty(value = "成本单价")
+    private BigDecimal costPrice;
     /**
      * 折扣
      */
@@ -287,6 +289,12 @@ public class OrderItem extends PageInfo<OrderItem> implements Serializable {
     @ApiModelProperty(value = "折扣")
     private BigDecimal discount;
 
+    /**
+     * 供应商Id
+     */
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String supId;
+
     private static final long serialVersionUID = 1L;
 
 }

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

@@ -411,6 +411,12 @@ public class OrderItemResponse extends PageInfo<OrderItemResponse> implements Se
     @ApiModelProperty(value = "折扣")
     private BigDecimal discount;
 
+    /**
+     * 供应商Id
+     */
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String supId;
+
     private static final long serialVersionUID = 1L;
 
 }

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

@@ -424,6 +424,14 @@ public class OrderResponse extends PageInfo<OrderResponse> implements Serializab
     @ApiModelProperty(value = "自动办理参数")
     private Boolean flgHandleSetting;
 
+    private Boolean flgBusiness;
+
+    @ApiModelProperty(value = "开单并出库办理标识")
+    private Boolean outboundProcessingFlag;
+
+    @ApiModelProperty(value = "种类数")
+    private BigDecimal categoryCount;
+
 
     private static final long serialVersionUID = 1L;
 

+ 12 - 0
src/main/java/com/dk/mdm/model/vo/ivt/InOutRecordVO.java

@@ -225,6 +225,18 @@ public class InOutRecordVO  {
     @ApiModelProperty(value = "外协供应商Id")
     private String supId;
 
+    @ApiModelProperty(value = "部门Id")
+    private String orgId;
+
+    @ApiModelProperty(value = "业务员Id")
+    private String staffId;
+    /**
+     * 制单员
+     */
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
+
 
 
 

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

@@ -313,6 +313,17 @@ public class OutboundItemVO {
     @ApiModelProperty(value = "不够库存数量----新建出库中数量")
     private BigDecimal notEnoughInventoryQty;
 
+    @ApiModelProperty(value = "部门Id")
+    private String orgId;
+
+    @ApiModelProperty(value = "业务员Id")
+    private String staffId;
+    /**
+     * 制单员
+     */
+    @ApiModelProperty(value = "制单员")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String makeStaff;
 
 
 

+ 8 - 1
src/main/java/com/dk/mdm/model/vo/sale/OrderItemVO.java

@@ -264,6 +264,12 @@ public class OrderItemVO extends PageInfo<OrderItemVO> implements Serializable {
 
     private String invId;
 
+    /**
+     * 供应商Id
+     */
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String supId;
+
 
     /**
      * 优惠后单价
@@ -289,7 +295,8 @@ public class OrderItemVO extends PageInfo<OrderItemVO> implements Serializable {
     @ApiModelProperty(value = "折扣")
     private BigDecimal discount;
 
-
+    @ApiModelProperty(value = "成本单价")
+    private BigDecimal costPrice;
 
     private static final long serialVersionUID = 1L;
 

+ 109 - 67
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -13,14 +13,12 @@ import com.dk.common.service.BaseService;
 import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.mapper.mst.StaffMapper;
-import com.dk.common.model.response.mst.StaffResponse;
-import com.dk.mdm.model.pojo.mst.Staff;
 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 java.time.LocalDate;
 import java.util.*;
 
 /**
@@ -136,8 +134,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
             table = mode + "." + table;
             param.put("table", table);
             // 默认有效标识为true
-            if(param.get("noFlgValid") == null && param.get("flgValid") == null ){
-                param.put("flgValid",true);
+            if (param.get("noFlgValid") == null && param.get("flgValid") == null) {
+                param.put("flgValid", true);
             }
             // 获取最大序号
             Integer maxDisplayNo = commonMapper.getMaxDisplayNo(param);
@@ -177,6 +175,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
         List<Map<String, Object>> list = commonMapper.getOrg(param);
         return ResponseResultUtil.success(list);
     }
+
     /**
      * @desc : 只获取二级部门 按照level_code 排序
      * @author : 王英杰
@@ -187,6 +186,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
         List<Map<String, Object>> list = commonMapper.getProcureOrg(param);
         return ResponseResultUtil.success(list);
     }
+
     /**
      * @desc : 获取部门
      * @author : 姜宁
@@ -289,10 +289,10 @@ public class CommonService extends BaseService<Map<String, Object>> {
         StaffEntity staff = authUtils.getStaff();
         param.put("cpId", staff.getCpId());
         // 选择对象的时候用
-        if (param.get("supplier-customerList")!=null
-                && param.get("supplier-customerList")!=""
-                && !(param.get("supplier-customerList") + "").contains(",") ){
-            param.put("objType", Integer.parseInt(param.get("supplier-customerList").toString())   );
+        if (param.get("supplier-customerList") != null
+                && param.get("supplier-customerList") != ""
+                && !(param.get("supplier-customerList") + "").contains(",")) {
+            param.put("objType", Integer.parseInt(param.get("supplier-customerList").toString()));
         }
         return param;
     }
@@ -390,9 +390,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(销售订单开单用)
+     * @desc : 获取商品(销售订单开单用)
      * @author : 付斌
-     * @date   : 2024-03-09 9:57
+     * @date : 2024-03-09 9:57
      */
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForOrder(Map<String, Object> param) {
         // 获取系统基础数据
@@ -401,9 +401,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(销售订单开单用)(分页)
+     * @desc : 获取商品(销售订单开单用)(分页)
      * @author : 付斌
-     * @date   : 2024-03-09 9:57
+     * @date : 2024-03-09 9:57
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForOrderByPage(Map<String, Object> param) {
         // 校验分页参数
@@ -418,9 +418,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForPurchase(Map<String, Object> param) {
         // 获取系统基础数据
@@ -429,9 +429,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForPurchaseByPage(Map<String, Object> param) {
         // 校验分页参数
@@ -547,7 +547,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
      */
     public ResponseResultVO<List<Map<String, Object>>> getGoodsBrandListNoPage(Map<String, Object> param) {
         // 有效的品牌 230529
-        param.put("flgValid",true);
+        param.put("flgValid", true);
         List<Map<String, Object>> list = commonMapper.getGoodsBrand(param);
         return ResponseResultUtil.success(list);
     }
@@ -689,7 +689,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     public ResponseResultVO<List<Map<String, Object>>> getGoodsCategoryNoPage(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.getGoodsCategory(param);
         return ResponseResultUtil.success(list);
-    }    /**
+    }
+
+    /**
      * @desc :  商品种类查询  树形
      * @author : 王英杰
      * @date : 2024/2/26 10:36
@@ -706,7 +708,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
      */
     public ResponseResultVO<List<Map<String, Object>>> getInitData(Map<String, Object> param) {
         //判断前台是否传 dataSourceCode
-        if (!param.containsKey("dataSourceCode") &&  param.get("dataSourceCode") == null) {
+        if (!param.containsKey("dataSourceCode") && param.get("dataSourceCode") == null) {
             return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.DATASOURCECODE_NOT.getMessage());
         }
         String dataSourceCode = param.get("dataSourceCode").toString();
@@ -714,18 +716,18 @@ public class CommonService extends BaseService<Map<String, Object>> {
 
         List<Map<String, Object>> list = null;
         Map<String, Object> map = new HashMap<>();
-        if(param.containsKey("searchText") && param.get("searchText") != null){
-            map.put("searchText",param.get("searchText").toString());
+        if (param.containsKey("searchText") && param.get("searchText") != null) {
+            map.put("searchText", param.get("searchText").toString());
         }
         //客户来源
         if (dataSourceCode.equals("customerFrom")) {
-            map.put("dictCode","基础资料-来源");
+            map.put("dictCode", "基础资料-来源");
             list = commonMapper.getDictionaryData(map);
         }
         // 基础资料的信息  入库原因
         if (dataSourceCode.equals("baseData")) {
-            map.put("dictCode",param.get("dictCode").toString()); // 需要前台传过dictCode
-            if (!param.containsKey("dictCode") &&  param.get("dictCode") == null) {
+            map.put("dictCode", param.get("dictCode").toString()); // 需要前台传过dictCode
+            if (!param.containsKey("dictCode") && param.get("dictCode") == null) {
                 return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.DATASOURCECODE_NOT.getMessage());
             }
             list = commonMapper.getDictionaryData(map);
@@ -768,32 +770,32 @@ public class CommonService extends BaseService<Map<String, Object>> {
         }
         //客户意向
         if (dataSourceCode.equals("customerIntention")) {
-            map.put("kindType","客户意向");
+            map.put("kindType", "客户意向");
             list = commonMapper.getDataKind(map);
         }
         //留店时长
         if (dataSourceCode.equals("storeRetentionTime")) {
-            map.put("kindType","留店时长");
+            map.put("kindType", "留店时长");
             list = commonMapper.getDataKind(map);
         }
         //邀约结果
         if (dataSourceCode.equals("inviteResult")) {
-            map.put("kindType","邀约结果");
+            map.put("kindType", "邀约结果");
             list = commonMapper.getDataKind(map);
         }
         //量尺状态
         if (dataSourceCode.equals("scaleStatus")) {
-            map.put("kindType","量尺状态");
+            map.put("kindType", "量尺状态");
             list = commonMapper.getDataKind(map);
         }
         //跟进方式
         if (dataSourceCode.equals("followType")) {
-            map.put("kindType","跟进方式");
+            map.put("kindType", "跟进方式");
             list = commonMapper.getDataKind(map);
         }
         //供应商类别
         if (dataSourceCode.equals("supType")) {
-            map.put("kindType","供应商类别");
+            map.put("kindType", "供应商类别");
             list = commonMapper.getDataKind(map);
         }
         // 初始款项
@@ -811,11 +813,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
 
-
-
     /**
-     * @desc   : 获取供应商和客户数据
-     * @date   : 2024/3/13 15:09
+     * @desc : 获取供应商和客户数据
+     * @date : 2024/3/13 15:09
      * @author : 寇珊珊
      */
     public ResponseResultVO<List<Map<String, Object>>> getSupplierAndCustomer(Map<String, Object> param) {
@@ -824,11 +824,11 @@ public class CommonService extends BaseService<Map<String, Object>> {
         return ResponseResultUtil.success(list);
 
     }
-    
-    
+
+
     /**
-     * @desc   : 获取供应商和客户数据(分页)
-     * @date   : 2024/3/13 14:02
+     * @desc : 获取供应商和客户数据(分页)
+     * @date : 2024/3/13 14:02
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getSupplierAndCustomerByPage(Map<String, Object> param) {
@@ -852,8 +852,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取组织机构
-     * @date   : 2024/3/13 17:01
+     * @desc : 获取组织机构
+     * @date : 2024/3/13 17:01
      * @author : 寇珊珊
      */
     public ResponseResultVO<List<Map<String, Object>>> getOrganization(Map<String, Object> param) {
@@ -864,8 +864,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取组织机构(分页)
-     * @date   : 2024/3/13 17:01
+     * @desc : 获取组织机构(分页)
+     * @date : 2024/3/13 17:01
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getOrganizationByPage(Map<String, Object> param) {
@@ -887,9 +887,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取资金账户(下拉)
+     * @desc : 获取资金账户(下拉)
      * @author : 付斌
-     * @date   : 2024-03-14 11:34
+     * @date : 2024-03-14 11:34
      */
     public ResponseResultVO<List<Map<String, Object>>> getMac(Map<String, Object> param) {
         // 获取组织机构
@@ -925,9 +925,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取多业务部门
+     * @desc : 获取多业务部门
      * @author : 付斌
-     * @date   : 2024-03-20 16:54
+     * @date : 2024-03-20 16:54
      */
     public ResponseResultVO<List<Map<String, Object>>> selectMultiOrg(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.selectMultiOrg(param);
@@ -935,9 +935,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取多业务员
+     * @desc : 获取多业务员
      * @author : 付斌
-     * @date   : 2024-03-20 16:54
+     * @date : 2024-03-20 16:54
      */
     public ResponseResultVO<List<Map<String, Object>>> selectMultiStaff(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.selectMultiStaff(param);
@@ -945,9 +945,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 组织仓库
+     * @desc : 组织仓库
      * @author : 宋扬
-     * @date   : 2024/3/22 15:47
+     * @date : 2024/3/22 15:47
      */
     public ResponseResultVO<List<Map<String, Object>>> selectMultiWarehouse(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.selectMultiWarehouse(param);
@@ -955,9 +955,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 组织资金账户
+     * @desc : 组织资金账户
      * @author : 宋扬
-     * @date   : 2024/3/22 15:54
+     * @date : 2024/3/22 15:54
      */
     public ResponseResultVO<List<Map<String, Object>>> selectMultiMoneyAccount(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.selectMultiMoneyAccount(param);
@@ -965,9 +965,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)
+     * @desc : 获取商品(采购订单开单用)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForPurchaseReturn(Map<String, Object> param) {
         // 获取系统基础数据
@@ -976,9 +976,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(采购订单开单用)(分页)
+     * @desc : 获取商品(采购订单开单用)(分页)
      * @author : 常皓宁
-     * @date   : 2024/3/9 10:08
+     * @date : 2024/3/9 10:08
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForPurchaseReturnByPage(Map<String, Object> param) {
         // 校验分页参数
@@ -992,9 +992,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取员工的范围权限类型
+     * @desc : 获取员工的范围权限类型
      * @author : 常皓宁
-     * @date   : 2024/4/2 10:06
+     * @date : 2024/4/2 10:06
      */
     public ResponseResultVO<List<Map<String, Object>>> getPurviewType(Map<String, Object> param) {
         // 获取供应商和客户
@@ -1003,9 +1003,9 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取组织仓库
+     * @desc : 获取组织仓库
      * @author : 付斌
-     * @date   : 2024-04-10 13:30
+     * @date : 2024-04-10 13:30
      */
     public ResponseResultVO<List<Map<String, Object>>> getOrgWh(Map<String, Object> param) {
         List<Map<String, Object>> list = commonMapper.getOrgWh(param);
@@ -1018,8 +1018,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
 
 
     /**
-     * @desc   : 获取商品(其他入库开单用)
-     * @date   : 2024/4/20 11:21
+     * @desc : 获取商品(其他入库开单用)
+     * @date : 2024/4/20 11:21
      * @author : 寇珊珊
      */
     public ResponseResultVO<List<Map<String, Object>>> getGoodsForInto(Map<String, Object> param) {
@@ -1029,8 +1029,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 获取商品(其他入库开单用)(分页)
-     * @date   : 2024/4/20 11:21
+     * @desc : 获取商品(其他入库开单用)(分页)
+     * @date : 2024/4/20 11:21
      * @author : 寇珊珊
      */
     public ResponseResultVO<PageList<Map<String, Object>>> getGoodsForIntoByPage(Map<String, Object> param) {
@@ -1045,8 +1045,8 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
-     * @desc   : 销售分析-我的 门店助手的 销售金额 收款金额 库存成本
-     * @date   : 2024/4/20 11:21
+     * @desc : 销售分析-我的 门店助手的 销售金额 收款金额 库存成本
+     * @date : 2024/4/20 11:21
      * @author : 姜永辉
      */
     public ResponseResultVO<Map<String, Object>> getHomeOrderRecCost(Map<String, Object> param) {
@@ -1054,6 +1054,7 @@ public class CommonService extends BaseService<Map<String, Object>> {
         JSONObject jObject = JSONObject.parseObject(m.get("f_get_home_order_rec_cost").toString());
         return ResponseResultUtil.success(jObject);
     }
+
     /**
      * @desc :  获取商品系列不分页
      * @author : 刘尧
@@ -1083,4 +1084,45 @@ public class CommonService extends BaseService<Map<String, Object>> {
         Map<String, Object> map = commonMapper.selectUserCount(param);
         return ResponseResultUtil.success(map);
     }
+
+    /**
+     * @desc : 获取公司
+     * @author : 付斌
+     * @date : 2024-06-19 10:00
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getCompany(Map<String, Object> param) {
+        List<Map<String, Object>> list = commonMapper.getCompany(param);
+        return ResponseResultUtil.success(list);
+    }
+
+    /**
+     * @desc : 查询首页试试数据
+     * @author : 付斌
+     * @date : 2024-06-19 11:02
+     */
+    public ResponseResultVO<Map<String, Object>> getRealTimeData(Map<String, Object> param) {
+        String realTimeDataType = param.get("realTimeDataType").toString();
+        if ("经营日报".equals(realTimeDataType)) {
+            param.put("createTimeStart", LocalDate.now());
+            param.put("createTimeEnd", LocalDate.now().plusDays(1));
+        } else if ("经营月报".equals(realTimeDataType)) {
+            param.put("createTimeStart", LocalDate.now().withDayOfMonth(1));
+            param.put("createTimeEnd", LocalDate.now().plusMonths(1).withDayOfMonth(1));
+        }
+        List<Map<String, Object>> list1 = commonMapper.getRealTimeData1(param);
+        List<Map<String, Object>> list2 = commonMapper.getRealTimeData2(param);
+        List<Map<String, Object>> list3 = commonMapper.getRealTimeData3(param);
+        List<Map<String, Object>> list4 = commonMapper.getRealTimeData4(param);
+
+        Map<String, Object> res = new HashMap<>();
+        res.put("orderQty", list1.get(0).get("orderQty"));
+        res.put("orderAmt", list1.get(0).get("orderAmt"));
+        res.put("outQty", list2.get(0).get("outQty"));
+        res.put("outAmt", list2.get(0).get("outAmt"));
+        res.put("returnQty", list3.get(0).get("returnQty"));
+        res.put("returnAmt", list3.get(0).get("returnAmt"));
+        res.put("cusQty", list4.get(0).get("cusQty"));
+        res.put("cusAmt", list4.get(0).get("cusAmt"));
+        return ResponseResultUtil.success(res);
+    }
 }

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

@@ -1342,6 +1342,12 @@ public class InventoryService extends BaseService<Inventory> {
                     setIntoNo(codeMap.get("outNote").toString());
             //入库类型
             inbound.setIntoType(Constant.IntoType.OTHER.getName());
+            //部门Id
+            inbound.setOrgId(inOutRecordVOList.get(0).getOrgId());
+            //业务员Id
+            inbound.setStaffId(inOutRecordVOList.get(0).getStaffId());
+            // 制单员
+            inbound.setMakeStaff(inOutRecordVOList.get(0).getMakeStaff());
             //已入库
             inbound.setIntoStatus(Constant.IntoStatus.YIRUKU.getName());
             //已入库数量
@@ -1371,6 +1377,10 @@ public class InventoryService extends BaseService<Inventory> {
                 inboundItem.setFromId(inOutRecordVOList.get(0).getBiznisId());
                 //来源明细
                 inboundItem.setFromItemId(inOutRecordVOList.get(0).getBiznisItemId());
+//                出库商品顺序
+                inboundItem.setItemIndex(inOutRecordVOList.get(0).getItemIndex());
+                // 入库价
+                inboundItem.setPriceInto(inOutRecordVOList.get(0).getPriceInto());
                 //实体转换
                 inboundItemMapper.insert(inboundItem);
                 inOutRecordVO.setIntoId(inbound.getIntoId());
@@ -2228,7 +2238,7 @@ public class InventoryService extends BaseService<Inventory> {
                 item.setWarningMsg("超出警戒上限" + "(" + warningUpperLimit + item.getUnitName() + ")");
             }
             if (warningLowerLimit != 0 && invQty < warningLowerLimit){
-                item.setWarningMsg("超出警戒下限" + "(" + warningLowerLimit + item.getUnitName() + ")");
+                item.setWarningMsg("低于警戒下限" + "(" + warningLowerLimit + item.getUnitName() + ")");
             }
         });
 

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

@@ -148,12 +148,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     .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;
     }
     
@@ -175,6 +169,12 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
             for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
                 //可以输入负数出库标识
                 outboundItemVO.setCanNegativeFlag(true);
+                //业务部门Id
+                outboundItemVO.setOrgId(outboundVO.getOrgId());
+                //业务员Id
+                outboundItemVO.setStaffId(outboundVO.getStaffId());
+                //制单员Id
+                outboundItemVO.setMakeStaff(outboundVO.getMakeStaff());
             }
             //销售出库新建
             this.saleOrderOutboundInsert(outboundVO,true);
@@ -187,16 +187,24 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                 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());
+                    if (inventoryResponse != null) {
+                        BigDecimal invQty = inventoryResponse.getInvQty().subtract(outboundItemVO.getOutingQty());
+                        // (库存量  大于等于  本次出库数量不用做任何处理)
+                        //库存量 小于  本次出库数量
+                        if (invQty.compareTo(BigDecimal.ZERO) < 0) {
+                            outboundItemVO.setOutingQty(inventoryResponse.getInvQty());
+                            //不够库存数量----新建出库中数量
+                            outboundItemVO.setNotEnoughInventoryQty(invQty.abs());
+                        }
+                    } else {
                         //不够库存数量----新建出库中数量
-                        outboundItemVO.setNotEnoughInventoryQty(invQty.abs());
+                        outboundItemVO.setNotEnoughInventoryQty(outboundItemVO.getOutingQty());
                     }
                 }
             }
+            //过滤出库存量足够的数据
+            List<OutboundItemVO> itemList = outboundVO.getItemList().stream().filter(it -> it.getNotEnoughInventoryQty()==null ).collect(Collectors.toList());
+
             //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){
@@ -209,8 +217,10 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
 
             //region  库存够扣减的明细  -----------新建已出库数据并扣减库存
             //销售出库新建
+            outboundVO.setItemList(itemList);
             this.saleOrderOutboundInsert(outboundVO,true);
             //endregion
+
         }
     }
     /*****************************************先判断库存*****************************************/
@@ -291,6 +301,9 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                 inboundVO.setMakeStaff(outboundVO.getMakeStaff());
                 //公司
                 inboundVO.setCpId(outboundVO.getCpId());
+                // 来源Id
+                inboundVO.setFromId(outboundVO.getFromId());
+                inboundVO.setFromNo(outboundVO.getFromNo());
                 //实体转换
                 Inbound inbound = inboundConvert.convertToPo(inboundVO);
                 inboundMapper.insert(inbound);
@@ -305,14 +318,18 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     //入库类型
                     inboundItemVO.setIntoType(inboundVO.getIntoType());
                     //入库状态等于已入库 更新合计入库数量/金额 = 入库中数量/入库中金额
+                    BigDecimal costAmount = outboundItemVO.getOutQty().multiply(outboundItemVO.getPriceOut()).setScale(2, BigDecimal.ROUND_HALF_UP);
                     inboundItemVO
+                            .setFromId(outboundItemVO.getFromId())
+                            .setFromItemId(outboundItemVO.getFromItemId())
                             .setPriceInto(outboundItemVO.getPriceOut())
                             .setIntoQty(outboundItemVO.getOutQty())
-                            .setIntoAmt(outboundItemVO.getOutQty())
+                            .setIntoAmt(outboundItemVO.getOutAmt())
+                            .setIntoAmt(costAmount)
                             .setIntoingQty(BigDecimal.ZERO)
                             .setIntoingAmt(BigDecimal.ZERO)
                             .setCostPrice(outboundItemVO.getPriceOut())
-                            .setCostAmt(outboundItemVO.getOutQty().multiply(outboundItemVO.getPriceOut()).setScale(2, BigDecimal.ROUND_HALF_UP))
+                            .setCostAmt(costAmount)
                     ;
                     //入库状态
                     inboundItemVO.setIntoStatus(inboundVO.getIntoStatus());
@@ -333,6 +350,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     // 商品
                     inboundItemVO.setSkuModel(outboundItemVO.getSkuModel());
                     inboundItemVO.setSkuName(outboundItemVO.getSkuName());
+                    // 来源Id
                     //实体转换
                     InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
                     inboundItemMapper.insert(inboundItem);
@@ -456,7 +474,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
                     ErrorCodeEnum.OUTBOUND_ITEM_NOT_EXIST.getMessage());
         }
         for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
-
+            outboundItemVO.setItemId(null );
             //region 将库存需要的参数赋值
             outboundItemVO.setInventoryType(Constant.InventoryType.OUTBOUND.getName());
             outboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.SALE_ORDER.getValue());

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

@@ -404,6 +404,10 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
             outboundItemVO.setInventoryType(Constant.InventoryType.OUTBOUND.getName());
             outboundItemVO.setInventoryDocCode(Constant.InventoryDocCode.SALE_RETURN.getValue());
             outboundItemVO.setAddOrEditFlag(true);
+            outboundItemVO.setOrgId(outboundVO.getOrgId());
+            outboundItemVO.setStaffId(outboundVO.getStaffId());
+            outboundItemVO.setMakeStaff(outboundVO.getMakeStaff());
+
             //endregion
 
             //region  新建明细

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

@@ -8,6 +8,7 @@ import com.dk.common.infrastructure.enums.ErrorCodeEnum;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.mapper.ivt.InboundMapper;
 import com.dk.mdm.mapper.ivt.OutboundMapper;
 import com.dk.mdm.mapper.mac.*;
@@ -32,10 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
 @Service
 @Transactional
@@ -99,6 +97,9 @@ public class AccountService extends BaseService<Account> {
     @Autowired
     private CommonService commonService;
 
+    @Autowired
+    private CommonMapper commonMapper;
+
     /**
      * @desc : 查看来源单据,总单加明细
      * @author : 姜永辉
@@ -356,120 +357,132 @@ public class AccountService extends BaseService<Account> {
                     .setObjectId(objectId);
             super.updateByUuid(accountUpdate);
 
-            // 如果当前出库单对应的订单全部出库了,并且订单有收款(锁定金额),则自动做应收核销
-            // 如果是销售出库
-            if (outbound.getOutType().equals(Constant.OutType.SALE.getName())) {
-                Order orderForUpdate = orderMapper.selectByIdForUpdate(outbound.getFromId());
-                // 如果当前订单已经全部出库
-                if (orderForUpdate != null && orderForUpdate.getOutQty().compareTo(orderForUpdate.getSumQuantity()) == 0) {
-                    RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderForUpdate.getOrderId(),false);
-                    if (recPayForUpdate != null && recPayForUpdate.getFlgLock()) {
-                        // 先把收款单解锁
-                        RecPay recPayUpdate = new RecPay();
-                        recPayUpdate.setFlgLock(false).setRpId(recPayForUpdate.getRpId());
-                        receiptService.updateByUuid(recPayUpdate);
-
-                        // 账款明细解锁
-                        List<RecPayItem> recPayItemList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
-                        for (RecPayItem recPayItem : recPayItemList) {
-                            AccountItem accountItemUpdate = new AccountItem();
-                            accountItemUpdate.setFlgLock(false).setItemId(recPayItem.getAccItemId());
-                            accountItemService.updateByUuid(accountItemUpdate);
-                        }
+            // 商户产品版本
+            String gradeCode = "PRO";
+            Map<String, Object> paramCompany = new HashMap<>();
+            paramCompany.put("cpId", outbound.getCpId());
+            List<Map<String, Object>> listCompany = commonMapper.getCompany(paramCompany);
+            if (listCompany.size() > 0) {
+                gradeCode = listCompany.get(0).get("gradeCode").toString();
+            }
 
-                        // 钱进到现金池中
-                        accountUpdate = new Account();
-                        accountUpdate.setReceipt(accountForUpdate.getReceipt().add(recPayForUpdate.getSumAmtRec()))
-                                .setReceiptResidue(accountForUpdate.getReceiptResidue().add(recPayForUpdate.getSumAmtRec()))
-                                .setReceiptLock(accountForUpdate.getReceiptLock().subtract(recPayForUpdate.getSumAmtRec()))
-                                .setObjectId(objectId);
-                        super.updateByUuid(accountUpdate);
-
-                        // 查出当前订单需要核销的应收单据
-                        List<AccountItemResponse> accountItemResponseList = accountItemMapper.getReceivableAccountItemForUpdate(
-                                new AccountItemQuery().setObjectId(objectId).setOrderId(orderForUpdate.getOrderId()));
-
-                        if (accountItemResponseList.size() > 0) {
-                            // 生成核销总单
-                            RecPay recPayHandle = new RecPay();
-                            // 获取单号
-                            Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
-                            recPayHandle.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
-                                    .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(objectId)
-                                    .setOrgId(recPayForUpdate.getOrgId()).setStaffId(recPayForUpdate.getStaffId()).setAccDate(LocalDate.now())
-                                    .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(recPayForUpdate.getBiznisId()).setBiznisNo(recPayForUpdate.getBiznisNo())
-                                    .setMakeStaff(recPayForUpdate.getMakeStaff()).setCpId(recPayForUpdate.getCpId()).setFlgOrderHandle(true);
-                            recPayMapper.insert(recPayHandle);
-
-                            // 记录核销了哪些应收账
-                            List<RecPayHandleItem> receivableList = new ArrayList<>();
-
-                            // 锁定金额
-                            BigDecimal lockAmt = recPayForUpdate.getSumAmtRec();
-
-                            for (AccountItemResponse accountItemResponse : accountItemResponseList) {
-                                RecPayHandleItem recPayHandleItem = new RecPayHandleItem();
-                                recPayHandleItem.setRpId(recPayHandle.getRpId()).setCpId(recPayHandle.getCpId()).setAccDate(recPayHandle.getAccDate())
-                                        .setAccItemId(accountItemResponse.getAccItemId());
-                                // 如果定金比应收金额大
-                                if (lockAmt.compareTo(accountItemResponse.getAmtResidue()) == 1) {
-                                    recPayHandleItem.setAmtReceivableHandle(accountItemResponse.getAmtResidue());
-                                    lockAmt = lockAmt.subtract(accountItemResponse.getAmtResidue());
-                                } else {
-                                    recPayHandleItem.setAmtReceivableHandle(lockAmt);
-                                    lockAmt = BigDecimal.ZERO;
-                                }
-                                recPayHandleItemMapper.insert(recPayHandleItem);
-                                receivableList.add(recPayHandleItem);
+            // 专业版自动核销
+            if ("PRO".equals(gradeCode)){
+                // 如果当前出库单对应的订单全部出库了,并且订单有收款(锁定金额),则自动做应收核销
+                // 如果是销售出库
+                if (outbound.getOutType().equals(Constant.OutType.SALE.getName())) {
+                    Order orderForUpdate = orderMapper.selectByIdForUpdate(outbound.getFromId());
+                    // 如果当前订单已经全部出库
+                    if (orderForUpdate != null && orderForUpdate.getOutQty().compareTo(orderForUpdate.getSumQuantity()) == 0) {
+                        RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(orderForUpdate.getOrderId(),false);
+                        if (recPayForUpdate != null && recPayForUpdate.getFlgLock()) {
+                            // 先把收款单解锁
+                            RecPay recPayUpdate = new RecPay();
+                            recPayUpdate.setFlgLock(false).setRpId(recPayForUpdate.getRpId());
+                            receiptService.updateByUuid(recPayUpdate);
 
-                                // 账款明细的核销金额和优惠金额
-                                AccountItem accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItem.getAccItemId());
+                            // 账款明细解锁
+                            List<RecPayItem> recPayItemList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
+                            for (RecPayItem recPayItem : recPayItemList) {
                                 AccountItem accountItemUpdate = new AccountItem();
-                                // 核销金额,超出剩余应收金额
-                                if (accountItemForUpdate.getAmtResidue().compareTo(recPayHandleItem.getAmtReceivableHandle()) == -1) {
-                                    throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
-                                }
-                                accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().add(recPayHandleItem.getAmtReceivableHandle()))
-                                        .setItemId(recPayHandleItem.getAccItemId());
-                                // 剩余金额 = 应收金额-应收收款金额
-                                accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
+                                accountItemUpdate.setFlgLock(false).setItemId(recPayItem.getAccItemId());
                                 accountItemService.updateByUuid(accountItemUpdate);
-
-                                // 如果定金都用完了,跳出循环
-                                if (lockAmt.compareTo(BigDecimal.ZERO) == 0) {
-                                    break;
-                                }
                             }
 
-                            // 计算明细的核销金额,优惠金额合计
-                            RecPayHandleItem recPayHandleItem = receivableList.stream().reduce((x, y) -> {
-                                RecPayHandleItem item = new RecPayHandleItem();
-                                item.setAmtReceivableHandle(x.getAmtReceivableHandle().add(y.getAmtReceivableHandle()));
-                                return item;
-                            }).get();
-
-                            // 更新收款单
-                            recPayUpdate = new RecPay();
-                            recPayUpdate.setSumAmtReceivableHandle(recPayHandleItem.getAmtReceivableHandle())
-                                    .setSumShouldHandle(recPayHandleItem.getAmtReceivableHandle())
-                                    .setRpId(recPayHandle.getRpId());
-                            receiptService.updateByUuid(recPayUpdate);
-
-                            // 更新总账上
-                            accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
+                            // 钱进到现金池中
                             accountUpdate = new Account();
-                            accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().add(recPayHandleItem.getAmtReceivableHandle()))// 总应收收款金额
-                                    .setObjectId(accountForUpdate.getObjectId());
-                            // 剩余应收 = 总应收账款-总应收收款金额
-                            accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
-                            // 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
-                            accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()));
+                            accountUpdate.setReceipt(accountForUpdate.getReceipt().add(recPayForUpdate.getSumAmtRec()))
+                                    .setReceiptResidue(accountForUpdate.getReceiptResidue().add(recPayForUpdate.getSumAmtRec()))
+                                    .setReceiptLock(accountForUpdate.getReceiptLock().subtract(recPayForUpdate.getSumAmtRec()))
+                                    .setObjectId(objectId);
+                            super.updateByUuid(accountUpdate);
 
-                            // 可用金额为负数,则不能保存
-                            if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+                            // 查出当前订单需要核销的应收单据
+                            List<AccountItemResponse> accountItemResponseList = accountItemMapper.getReceivableAccountItemForUpdate(
+                                    new AccountItemQuery().setObjectId(objectId).setOrderId(orderForUpdate.getOrderId()));
+
+                            if (accountItemResponseList.size() > 0) {
+                                // 生成核销总单
+                                RecPay recPayHandle = new RecPay();
+                                // 获取单号
+                                Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+                                recPayHandle.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                                        .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(objectId)
+                                        .setOrgId(recPayForUpdate.getOrgId()).setStaffId(recPayForUpdate.getStaffId()).setAccDate(LocalDate.now())
+                                        .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(recPayForUpdate.getBiznisId()).setBiznisNo(recPayForUpdate.getBiznisNo())
+                                        .setMakeStaff(recPayForUpdate.getMakeStaff()).setCpId(recPayForUpdate.getCpId()).setFlgOrderHandle(true);
+                                recPayMapper.insert(recPayHandle);
+
+                                // 记录核销了哪些应收账
+                                List<RecPayHandleItem> receivableList = new ArrayList<>();
+
+                                // 锁定金额
+                                BigDecimal lockAmt = recPayForUpdate.getSumAmtRec();
+
+                                for (AccountItemResponse accountItemResponse : accountItemResponseList) {
+                                    RecPayHandleItem recPayHandleItem = new RecPayHandleItem();
+                                    recPayHandleItem.setRpId(recPayHandle.getRpId()).setCpId(recPayHandle.getCpId()).setAccDate(recPayHandle.getAccDate())
+                                            .setAccItemId(accountItemResponse.getAccItemId());
+                                    // 如果定金比应收金额大
+                                    if (lockAmt.compareTo(accountItemResponse.getAmtResidue()) == 1) {
+                                        recPayHandleItem.setAmtReceivableHandle(accountItemResponse.getAmtResidue());
+                                        lockAmt = lockAmt.subtract(accountItemResponse.getAmtResidue());
+                                    } else {
+                                        recPayHandleItem.setAmtReceivableHandle(lockAmt);
+                                        lockAmt = BigDecimal.ZERO;
+                                    }
+                                    recPayHandleItemMapper.insert(recPayHandleItem);
+                                    receivableList.add(recPayHandleItem);
+
+                                    // 账款明细的核销金额和优惠金额
+                                    AccountItem accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItem.getAccItemId());
+                                    AccountItem accountItemUpdate = new AccountItem();
+                                    // 核销金额,超出剩余应收金额
+                                    if (accountItemForUpdate.getAmtResidue().compareTo(recPayHandleItem.getAmtReceivableHandle()) == -1) {
+                                        throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.AMT_HANDLE_NO_LESS_AMT_SHOULD.getMessage());
+                                    }
+                                    accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().add(recPayHandleItem.getAmtReceivableHandle()))
+                                            .setItemId(recPayHandleItem.getAccItemId());
+                                    // 剩余金额 = 应收金额-应收收款金额
+                                    accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
+                                    accountItemService.updateByUuid(accountItemUpdate);
+
+                                    // 如果定金都用完了,跳出循环
+                                    if (lockAmt.compareTo(BigDecimal.ZERO) == 0) {
+                                        break;
+                                    }
+                                }
+
+                                // 计算明细的核销金额,优惠金额合计
+                                RecPayHandleItem recPayHandleItem = receivableList.stream().reduce((x, y) -> {
+                                    RecPayHandleItem item = new RecPayHandleItem();
+                                    item.setAmtReceivableHandle(x.getAmtReceivableHandle().add(y.getAmtReceivableHandle()));
+                                    return item;
+                                }).get();
+
+                                // 更新收款单
+                                recPayUpdate = new RecPay();
+                                recPayUpdate.setSumAmtReceivableHandle(recPayHandleItem.getAmtReceivableHandle())
+                                        .setSumShouldHandle(recPayHandleItem.getAmtReceivableHandle())
+                                        .setRpId(recPayHandle.getRpId());
+                                receiptService.updateByUuid(recPayUpdate);
+
+                                // 更新总账上
+                                accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
+                                accountUpdate = new Account();
+                                accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().add(recPayHandleItem.getAmtReceivableHandle()))// 总应收收款金额
+                                        .setObjectId(accountForUpdate.getObjectId());
+                                // 剩余应收 = 总应收账款-总应收收款金额
+                                accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
+                                // 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
+                                accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()));
+
+                                // 可用金额为负数,则不能保存
+                                if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
+                                    throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+                                }
+                                super.updateByUuid(accountUpdate);
                             }
-                            super.updateByUuid(accountUpdate);
                         }
                     }
                 }
@@ -532,72 +545,84 @@ public class AccountService extends BaseService<Account> {
             if (outbound.getReceivableId() == null) {
                 throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CURRENT_INVOICE_ISREVERSE.getMessage());
             }
-
             Account accountForUpdate;
             Account accountUpdate;
-            // 如果当前出库单对应的订单做了应收收款,则自动作废应收核销,并且锁定金额订单收款(锁定金额)
-            // 如果是销售出库
-            if (outbound.getOutType().equals(Constant.OutType.SALE.getName())) {
-                RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),false);        // 款
-                RecPay recPayHandleForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),true);   // 账
-                if (recPayForUpdate != null && recPayHandleForUpdate != null) {
-                    // 查出并锁定所有应收核销明细
-                    List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayHandleForUpdate.getRpId());
-                    if (recPayHandleItemForUpdateList.size() > 0) {
-                        for (RecPayHandleItem recPayHandleItemForUpdate : recPayHandleItemForUpdateList) {
-                            // 更新账款明细应收收款
-                            accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItemForUpdate.getAccItemId());
-                            AccountItem accountItemUpdate = new AccountItem();
-                            accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().subtract(recPayHandleItemForUpdate.getAmtReceivableHandle()))
-                                    .setItemId(recPayHandleItemForUpdate.getAccItemId());
-                            accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
-                            accountItemService.updateByUuid(accountItemUpdate);
-
-                            // 删掉核销明细
-                            recPayHandleItemMapper.deleteById(recPayHandleItemForUpdate.getItemId());
-                        }
 
-                        // 把总帐上的钱加回来
-                        accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
-                        accountUpdate = new Account();
-                        accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().subtract(recPayHandleForUpdate.getSumAmtReceivableHandle()))// 总应收收款金额
-                                .setObjectId(objectId);
-                        // 剩余应收 = 总应收账款-总应收收款金额
-                        accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
-                        // 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
-                        accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()));
-
-                        // 更新前的最后校验
-                        // 可用金额为负数,则不能保存
-                        if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
-                            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
-                        }
-                        super.updateByUuid(accountUpdate);
-
-                        // 删掉收款核销单
-                        recPayMapper.deleteById(recPayHandleForUpdate.getRpId());
-
-                        // 先把收款单锁定
-                        RecPay recPayUpdate = new RecPay();
-                        recPayUpdate.setFlgLock(true).setRpId(recPayForUpdate.getRpId());
-                        receiptService.updateByUuid(recPayUpdate);
-
-                        // 账款明细解锁
-                        List<RecPayItem> recPayItemList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
-                        for (RecPayItem recPayItem : recPayItemList) {
-                            AccountItem accountItemUpdate = new AccountItem();
-                            accountItemUpdate.setFlgLock(true).setItemId(recPayItem.getAccItemId());
-                            accountItemService.updateByUuid(accountItemUpdate);
-                        }
+            // 商户产品版本
+            String gradeCode = "PRO";
+            Map<String, Object> paramCompany = new HashMap<>();
+            paramCompany.put("cpId", outbound.getCpId());
+            List<Map<String, Object>> listCompany = commonMapper.getCompany(paramCompany);
+            if (listCompany.size() > 0) {
+                gradeCode = listCompany.get(0).get("gradeCode").toString();
+            }
 
-                        // 钱进到锁定金额中
-                        accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
-                        accountUpdate = new Account();
-                        accountUpdate.setReceipt(accountForUpdate.getReceipt().subtract(recPayForUpdate.getSumAmtRec()))
-                                .setReceiptResidue(accountForUpdate.getReceiptResidue().subtract(recPayForUpdate.getSumAmtRec()))
-                                .setReceiptLock(accountForUpdate.getReceiptLock().add(recPayForUpdate.getSumAmtRec()))
-                                .setObjectId(objectId);
-                        super.updateByUuid(accountUpdate);
+            // 专业版自动核销
+            if ("PRO".equals(gradeCode)){
+                // 如果当前出库单对应的订单做了应收收款,则自动作废应收核销,并且锁定金额订单收款(锁定金额)
+                // 如果是销售出库
+                if (outbound.getOutType().equals(Constant.OutType.SALE.getName())) {
+                    RecPay recPayForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),false);        // 款
+                    RecPay recPayHandleForUpdate = recPayMapper.selectByBiznisIdForUpdate(outbound.getFromId(),true);   // 账
+                    if (recPayForUpdate != null && recPayHandleForUpdate != null) {
+                        // 查出并锁定所有应收核销明细
+                        List<RecPayHandleItem> recPayHandleItemForUpdateList = recPayHandleItemMapper.selectByZIdForUpdate(recPayHandleForUpdate.getRpId());
+                        if (recPayHandleItemForUpdateList.size() > 0) {
+                            for (RecPayHandleItem recPayHandleItemForUpdate : recPayHandleItemForUpdateList) {
+                                // 更新账款明细应收收款
+                                accountItemForUpdate = accountItemMapper.selectByIdForUpdate(recPayHandleItemForUpdate.getAccItemId());
+                                AccountItem accountItemUpdate = new AccountItem();
+                                accountItemUpdate.setAmtHandle(accountItemForUpdate.getAmtHandle().subtract(recPayHandleItemForUpdate.getAmtReceivableHandle()))
+                                        .setItemId(recPayHandleItemForUpdate.getAccItemId());
+                                accountItemUpdate.setAmtResidue(accountItemForUpdate.getAmtShould().subtract(accountItemUpdate.getAmtHandle()));
+                                accountItemService.updateByUuid(accountItemUpdate);
+
+                                // 删掉核销明细
+                                recPayHandleItemMapper.deleteById(recPayHandleItemForUpdate.getItemId());
+                            }
+
+                            // 把总帐上的钱加回来
+                            accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
+                            accountUpdate = new Account();
+                            accountUpdate.setReceivableHandle(accountForUpdate.getReceivableHandle().subtract(recPayHandleForUpdate.getSumAmtReceivableHandle()))// 总应收收款金额
+                                    .setObjectId(objectId);
+                            // 剩余应收 = 总应收账款-总应收收款金额
+                            accountUpdate.setReceivableResidue(accountForUpdate.getReceivable().subtract(accountUpdate.getReceivableHandle()));
+                            // 可退金额 = 总收款金额-总应收收款金额+总应收优惠金额
+                            accountUpdate.setReceiptResidue(accountForUpdate.getReceipt().subtract(accountUpdate.getReceivableHandle()));
+
+                            // 更新前的最后校验
+                            // 可用金额为负数,则不能保存
+                            if (accountUpdate.getReceiptResidue().compareTo(BigDecimal.ZERO) == -1) {
+                                throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.RESIDUE_NO_LESS.getMessage());
+                            }
+                            super.updateByUuid(accountUpdate);
+
+                            // 删掉收款核销单
+                            recPayMapper.deleteById(recPayHandleForUpdate.getRpId());
+
+                            // 先把收款单锁定
+                            RecPay recPayUpdate = new RecPay();
+                            recPayUpdate.setFlgLock(true).setRpId(recPayForUpdate.getRpId());
+                            receiptService.updateByUuid(recPayUpdate);
+
+                            // 账款明细解锁
+                            List<RecPayItem> recPayItemList = recPayItemMapper.selectByZIdForUpdate(recPayForUpdate.getRpId());
+                            for (RecPayItem recPayItem : recPayItemList) {
+                                AccountItem accountItemUpdate = new AccountItem();
+                                accountItemUpdate.setFlgLock(true).setItemId(recPayItem.getAccItemId());
+                                accountItemService.updateByUuid(accountItemUpdate);
+                            }
+
+                            // 钱进到锁定金额中
+                            accountForUpdate = accountMapper.selectByIdForUpdate(objectId);
+                            accountUpdate = new Account();
+                            accountUpdate.setReceipt(accountForUpdate.getReceipt().subtract(recPayForUpdate.getSumAmtRec()))
+                                    .setReceiptResidue(accountForUpdate.getReceiptResidue().subtract(recPayForUpdate.getSumAmtRec()))
+                                    .setReceiptLock(accountForUpdate.getReceiptLock().add(recPayForUpdate.getSumAmtRec()))
+                                    .setObjectId(objectId);
+                            super.updateByUuid(accountUpdate);
+                        }
                     }
                 }
             }

+ 21 - 10
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -270,6 +270,17 @@ public class CustomerService extends BaseService<Customer> {
                 customer.setErrorMessage(customer.getErrorMessage() + "客户编号不能为空,");
                 importMessage = true;
             }
+            //客户编号不能重复
+            if(customer.getCusCode() != null){
+                // 同商户 客编不同
+                Long count = customerMapper.countByCond(
+                        new CustomerQuery().setCpId(customer.getCpId()).setCusCode(customer.getCusCode()).setFlgValid(true)
+                );
+                if (count > 0) {
+                    customer.setErrorMessage(customer.getErrorMessage() + "客户编码已存在,");
+                    importMessage = true;
+                }
+            }
             //客户名称不能为空
             if(customer.getCusName() == null){
                 customer.setErrorMessage(customer.getErrorMessage() + "客户名称不能为空,");
@@ -316,31 +327,31 @@ public class CustomerService extends BaseService<Customer> {
                 importMessage = true;
             }
             //业务员
-            if(customer.getStaffName() != null){
-                String staffName = customer.getStaffName();
-                StaffResponse staffResponse = staffMapper.selectByUuId(new StaffQuery().setStaffName(staffName).setCpId(cpId));
+            if(customer.getStaffCode() != null){
+                String staffCode = customer.getStaffCode();
+                StaffResponse staffResponse = staffMapper.selectByUuId(new StaffQuery().setStaffCode(staffCode).setCpId(cpId));
                 if(staffResponse == null){
-                    customer.setErrorMessage(customer.getErrorMessage() + "业务员填写错误,");
+                    customer.setErrorMessage(customer.getErrorMessage() + "业务员编码填写错误,");
                     importMessage = true;
                 }else{
                     customer.setStaffId(staffResponse.getStaffId());
                 }
             }else{
-                customer.setErrorMessage(customer.getErrorMessage() + "业务员不能为空,");
+                customer.setErrorMessage(customer.getErrorMessage() + "业务员编码不能为空,");
                 importMessage = true;
             }
             //报备人
-            if(customer.getReportStaffName() != null){
-                String reportStaffName = customer.getReportStaffName();
-                StaffResponse staffResponse = staffMapper.selectByUuId(new StaffQuery().setStaffName(reportStaffName).setCpId(cpId));
+            if(customer.getReportStaffCode() != null){
+                String reportStaffCode = customer.getReportStaffCode();
+                StaffResponse staffResponse = staffMapper.selectByUuId(new StaffQuery().setStaffCode(reportStaffCode).setCpId(cpId));
                 if(staffResponse == null){
-                    customer.setErrorMessage(customer.getErrorMessage() + "报备人填写错误,");
+                    customer.setErrorMessage(customer.getErrorMessage() + "报备人编码填写错误,");
                     importMessage = true;
                 }else{
                     customer.setReportStaff(staffResponse.getStaffId());
                 }
             }else{
-                customer.setErrorMessage(customer.getErrorMessage() + "报备人不能为空,");
+                customer.setErrorMessage(customer.getErrorMessage() + "报备人编码不能为空,");
                 importMessage = true;
             }
             messageList.add(customer);

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

@@ -294,4 +294,8 @@ public class GoodsSkuService extends BaseService<GoodsSku> {
 		}
 	}
 
+    public ResponseResultVO<?> saveUpdateList(List<GoodsSkuVO> goodsSkuVOS) {
+		Boolean saveBoolean = goodsSkuMapper.saveWarningList(goodsSkuVOS);
+		return ResponseResultUtil.success();
+    }
 }

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

@@ -361,7 +361,7 @@ public class StaffService extends BaseService<Staff> {
             List<SettingValue> settingValueList = new ArrayList<>();
             // 自动办理
             settingValueList.add(new SettingValue().setCpId(cpId).setSettingCode(Constant.SystemConstant.IVT_001.getValue())
-                    .setSettingValue("false"));
+                    .setSettingValue("true"));
             // 欠货销售
             settingValueList.add(new SettingValue().setCpId(cpId).setSettingCode(Constant.SystemConstant.IVT_002.getValue())
                     .setSettingValue("false"));

+ 289 - 128
src/main/java/com/dk/mdm/service/sale/OrderService.java

@@ -14,6 +14,7 @@ import com.dk.mdm.infrastructure.convert.mac.RecPayItemConvert;
 import com.dk.mdm.infrastructure.convert.sale.OrderConvert;
 import com.dk.mdm.infrastructure.convert.sale.OrderItemConvert;
 import com.dk.mdm.infrastructure.convert.sale.OutBoundDtoConvert;
+import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.mapper.mac.AccountItemMapper;
 import com.dk.mdm.mapper.mac.RecPayHandleItemMapper;
 import com.dk.mdm.mapper.mac.RecPayItemMapper;
@@ -92,6 +93,9 @@ public class OrderService extends BaseService<Order> {
     private CommonService commonService;
 
     @Autowired
+    private CommonMapper commonMapper;
+
+    @Autowired
     private CustomerMapper customerMapper;
 
     @Autowired
@@ -228,24 +232,24 @@ public class OrderService extends BaseService<Order> {
                     .setReportStaff(orderVO.getMakeStaff()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()).setCpId(orderVO.getCpId());
             customerMapper.insert(customer);
             orderVO.setCusId(customer.getCusId());
-        }else{
+        } else {
             // 如果当前跟进人
             Customer cus = customerMapper.selectByIdForUpdate(orderVO.getCusId());
             List<String> followStaffs = cus.getFollowStaffs();
             Boolean updateFollowFlag = false;
-            if(followStaffs == null ){
+            if (followStaffs == null) {
                 followStaffs.add(orderVO.getMakeStaff());
                 updateFollowFlag = true;
-            }else{
-                if(!followStaffs.contains(orderVO.getMakeStaff())){
+            } else {
+                if (!followStaffs.contains(orderVO.getMakeStaff())) {
                     followStaffs.add(orderVO.getMakeStaff());
                     updateFollowFlag = true;
                 }
             }
-            if(updateFollowFlag){
+            if (updateFollowFlag) {
                 // 更新当前跟进人
                 customerMapper.updateFollowStaffs(new Customer().setCusId(orderVO.getCusId())
-                                                    .setFollowStaffs(followStaffs));
+                        .setFollowStaffs(followStaffs));
             }
         }
 
@@ -293,90 +297,167 @@ public class OrderService extends BaseService<Order> {
             for (OrderItemVO orderItemVO : orderVO.getItemList()) {
                 OrderItem orderItem = orderItemConvert.convertToPo(orderItemVO);
                 orderItem.setOrderId(order.getOrderId()).setCpId(order.getCpId()).setOutStatus(Constant.OutStatus.DAICHUKU.getName());
+                orderItem.setItemId(UUID.randomUUID().toString());
                 orderItemMapper.insert(orderItem);
+                orderItemVO.setItemId(orderItem.getItemId());
             }
         }
 
         /**************************************** 客户收款begin ********************************/
         if (orderVO.getReceiptList() != null && orderVO.getReceiptList().size() > 0) {
-            RecPay recPay = new RecPay();
+            // 商户产品版本
+            String gradeCode = "PRO";
+            Map<String, Object> paramCompany = new HashMap<>();
+            paramCompany.put("cpId", orderVO.getCpId());
+            List<Map<String, Object>> listCompany = commonMapper.getCompany(paramCompany);
+            if (listCompany.size() > 0) {
+                gradeCode = listCompany.get(0).get("gradeCode").toString();
+            }
             // 获取单号
             codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
-            recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
-                    .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
-                    .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
-                    .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
-                    .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId()).setFlgLock(true);
-            // 计算订单明细的出库中数量,金额合计
-            RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
-                RecPayItemVO item = new RecPayItemVO();
-                item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
-                return item;
-            }).get();
-            recPay.setSumAmtRec(itemSum.getAmtRec());
-
-            // 总单保存
-            recPayMapper.insert(recPay);
-
-            // 明细保存
-            for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
-                RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
-                recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
-                recPayItemMapper.insert(recPayItem);
-
-                // 插入账款明细
-                AccountItem accountItem = new AccountItem();
-                accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
-                        .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
-                        .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
-                        .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
-                        .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId()).setFlgLock(true);
-                accountItemMapper.insert(accountItem);
-
-                // 更新收款单上的账款明细Id
-                RecPayItem recPayItemUpdate = new RecPayItem();
-                recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
-                recPayItemService.updateByUuid(recPayItemUpdate);
-
-                // 插入资金流水
-                MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
-                moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
-                        .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
-                        .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
-                moneyAccountItemMapper.insert(moneyAccountItem);
-
-                // 更新资金账户
-                MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
-                MoneyAccount moneyAccountUpdate = new MoneyAccount();
-                moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec()))
-                        .setMacId(moneyAccountForUpdate.getMacId());
-                moneyAccountService.updateByUuid(moneyAccountUpdate);
+            RecPay recPay = new RecPay();
+
+            // 专业版有定金
+            if ("PRO".equals(gradeCode)) {
+                recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                        .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
+                        .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
+                        .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
+                        .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId()).setFlgLock(true);
+                // 计算订单明细的出库中数量,金额合计
+                RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
+                    RecPayItemVO item = new RecPayItemVO();
+                    item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
+                    return item;
+                }).get();
+                recPay.setSumAmtRec(itemSum.getAmtRec());
+
+                // 总单保存
+                recPayMapper.insert(recPay);
+
+                // 明细保存
+                for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
+                    RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                    recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                    recPayItemMapper.insert(recPayItem);
+
+                    // 插入账款明细
+                    AccountItem accountItem = new AccountItem();
+                    accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
+                            .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
+                            .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
+                            .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
+                            .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId()).setFlgLock(true);
+                    accountItemMapper.insert(accountItem);
+
+                    // 更新收款单上的账款明细Id
+                    RecPayItem recPayItemUpdate = new RecPayItem();
+                    recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
+                    recPayItemService.updateByUuid(recPayItemUpdate);
+
+                    // 插入资金流水
+                    MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                    moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                            .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
+                            .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                    moneyAccountItemMapper.insert(moneyAccountItem);
+
+                    // 更新资金账户
+                    MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
+                    MoneyAccount moneyAccountUpdate = new MoneyAccount();
+                    moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec()))
+                            .setMacId(moneyAccountForUpdate.getMacId());
+                    moneyAccountService.updateByUuid(moneyAccountUpdate);
+                }
+
+                // 插入账款总表
+                Account accountForUpdate = accountService.getCusAccountForUpdate(recPay.getObjectId());
+                // 更新账款总表上收款的相关字段
+                Account accountUpdate = new Account();
+                accountUpdate.setReceiptLock(accountForUpdate.getReceiptLock().add(recPay.getSumAmtRec()))//  锁定金额
+                        .setObjectId(accountForUpdate.getObjectId());
+                accountService.updateByUuid(accountUpdate);
+            } else if ("STD".equals(gradeCode)) {
+                recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                        .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
+                        .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
+                        .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
+                        .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId());
+                // 计算订单明细的出库中数量,金额合计
+                RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
+                    RecPayItemVO item = new RecPayItemVO();
+                    item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
+                    return item;
+                }).get();
+                recPay.setSumAmtRec(itemSum.getAmtRec());
+
+                // 总单保存
+                recPayMapper.insert(recPay);
+
+                // 明细保存
+                for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
+                    RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                    recPayItem.setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                    recPayItemMapper.insert(recPayItem);
+
+                    // 插入账款明细
+                    AccountItem accountItem = new AccountItem();
+                    accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
+                            .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
+                            .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
+                            .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
+                            .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId());
+                    accountItemMapper.insert(accountItem);
+
+                    // 更新收款单上的账款明细Id
+                    RecPayItem recPayItemUpdate = new RecPayItem();
+                    recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
+                    recPayItemService.updateByUuid(recPayItemUpdate);
+
+                    // 插入资金流水
+                    MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                    moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                            .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
+                            .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                    moneyAccountItemMapper.insert(moneyAccountItem);
+
+                    // 更新资金账户
+                    MoneyAccount moneyAccountForUpdate = moneyAccountMapper.selectByIdForUpdate(recPayItem.getMacId());
+                    MoneyAccount moneyAccountUpdate = new MoneyAccount();
+                    moneyAccountUpdate.setBalance(moneyAccountForUpdate.getBalance().add(recPayItem.getAmtRec()))
+                            .setMacId(moneyAccountForUpdate.getMacId());
+                    moneyAccountService.updateByUuid(moneyAccountUpdate);
+                }
+
+                // 插入账款总表
+                Account accountForUpdate = accountService.getCusAccountForUpdate(recPay.getObjectId());
+                // 更新账款总表上收款的相关字段
+                Account accountUpdate = new Account();
+                accountUpdate.setReceipt(accountForUpdate.getReceipt().add(recPay.getSumAmtRec()))//  总收款金额
+                        .setReceiptResidue(accountForUpdate.getReceiptResidue().add(recPay.getSumAmtRec()))//  可退金额
+                        .setObjectId(accountForUpdate.getObjectId());
+                accountService.updateByUuid(accountUpdate);
             }
 
-            // 插入账款总表
-            Account accountForUpdate = accountService.getCusAccountForUpdate(recPay.getObjectId());
-            // 更新账款总表上收款的相关字段
-            Account accountUpdate = new Account();
-            accountUpdate.setReceiptLock(accountForUpdate.getReceiptLock().add(recPay.getSumAmtRec()))//  锁定金额
-                    .setObjectId(accountForUpdate.getObjectId());
-            accountService.updateByUuid(accountUpdate);
         }
         /**************************************** 客户收款end ********************************/
         //开单并出库办理
-        if (orderVO.getOutboundProcessingFlag()!=null&& orderVO.getOutboundProcessingFlag()){
+        if (orderVO.getOutboundProcessingFlag() != null && orderVO.getOutboundProcessingFlag()) {
             for (OrderItemVO orderItemVO : orderVO.getItemList()) {
                 orderItemVO.setOutingQty(orderItemVO.getItemQty());
                 orderItemVO.setOutingAmt(orderItemVO.getItemAmt());
                 orderItemVO.setPriceOut(orderItemVO.getPriceSale());
                 orderItemVO.setFromId(orderVO.getOrderId());
-                orderItemVO.setFromItemId(orderItemVO.getFromItemId());
+                orderItemVO.setFromItemId(orderItemVO.getItemId());
             }
             OutboundVO outboundVO = outBoundDtoConvert.convertToPo(orderVO);
             outboundVO.setOutDate(LocalDate.now());
             outboundVO.setOutingQty(orderVO.getSumQuantity());
-            outboundVO.setOutingAmt(orderVO.getSumAmount());
+            outboundVO.setOutingAmt(orderVO.getFactAmt());
             outboundVO.setFlgAutoHandle(orderVO.getFlgAutoHandle());
             outboundVO.setFlgHandleSetting(orderVO.getFlgHandleSetting());
+            outboundVO.setFromId(order.getOrderId());
+            outboundVO.setFromNo(order.getOrderNo());
             outboundSaleOrderService.inventoryOUtBond(outboundVO);
         }
 
@@ -407,7 +488,7 @@ public class OrderService extends BaseService<Order> {
         // 转化实体
         Order order = orderConvert.convertToPo(orderVO);
         //删除的
-        if(orderVO.getDeleteItemList() != null){
+        if (orderVO.getDeleteItemList() != null) {
             List<OrderItemVO> deleteOrderItemVOList = orderVO.getDeleteItemList().stream().filter(it -> it.getItemId() != null).collect(Collectors.toList());
             if (deleteOrderItemVOList.size() > 0) {
                 for (OrderItemVO orderItemVO : deleteOrderItemVOList) {
@@ -508,74 +589,154 @@ public class OrderService extends BaseService<Order> {
             }
         }
 
-        if (orderVO.getReceiptList() != null && orderVO.getReceiptList().size() > 0) {
+        // 商户产品版本
+        String gradeCode = "PRO";
+        Map<String, Object> paramCompany = new HashMap<>();
+        paramCompany.put("cpId", orderVO.getCpId());
+        List<Map<String, Object>> listCompany = commonMapper.getCompany(paramCompany);
+        if (listCompany.size() > 0) {
+            gradeCode = listCompany.get(0).get("gradeCode").toString();
+        }
 
-            // 计算订单明细的出库中数量,金额合计
-            RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
-                RecPayItemVO item = new RecPayItemVO();
-                item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
-                return item;
-            }).get();
-
-            RecPay recPay = null;
-            if (recPayForUpdate == null) {
-                recPay = new RecPay();
-                // 获取单号
-                Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
-                recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
-                        .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
-                        .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
-                        .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
-                        .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId()).setFlgLock(true);
+        // 专业版有定金
+        if ("PRO".equals(gradeCode)) {
+            if (orderVO.getReceiptList() != null && orderVO.getReceiptList().size() > 0) {
+                // 计算订单明细的出库中数量,金额合计
+                RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
+                    RecPayItemVO item = new RecPayItemVO();
+                    item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
+                    return item;
+                }).get();
+
+                RecPay recPay = null;
+                if (recPayForUpdate == null) {
+                    recPay = new RecPay();
+                    // 获取单号
+                    Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+                    recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                            .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
+                            .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
+                            .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
+                            .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId()).setFlgLock(true);
+
+                    recPay.setSumAmtRec(itemSum.getAmtRec());
+                    recPayMapper.insert(recPay);
+                } else {
+                    // 更新收款总额
+                    RecPay recPayUpdate = new RecPay();
+                    recPayUpdate.setSumAmtRec(itemSum.getAmtRec()).setRpId(recPayForUpdate.getRpId());
+                    receiptService.updateByUuid(recPayUpdate);
 
-                recPay.setSumAmtRec(itemSum.getAmtRec());
-                recPayMapper.insert(recPay);
-            } else {
-                // 更新收款总额
-                RecPay recPayUpdate = new RecPay();
-                recPayUpdate.setSumAmtRec(itemSum.getAmtRec()).setRpId(recPayForUpdate.getRpId());
-                receiptService.updateByUuid(recPayUpdate);
+                    // 赋值recPay,下面要用
+                    recPay = recPayForUpdate;
+                }
 
-                // 赋值recPay,下面要用
-                recPay = recPayForUpdate;
+                // 明细保存
+                for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
+                    RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                    recPayItem.setItemId(null).setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                    recPayItemMapper.insert(recPayItem);
+
+                    // 插入账款明细
+                    AccountItem accountItem = new AccountItem();
+                    accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
+                            .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
+                            .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
+                            .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
+                            .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId()).setFlgLock(true);
+                    accountItemMapper.insert(accountItem);
+
+                    // 更新收款单上的账款明细Id
+                    RecPayItem recPayItemUpdate = new RecPayItem();
+                    recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
+                    recPayItemService.updateByUuid(recPayItemUpdate);
+
+                    // 插入资金流水
+                    MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                    moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                            .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
+                            .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                    moneyAccountItemMapper.insert(moneyAccountItem);
+
+                    if (!macList.contains(recPayItem.getMacId())) {
+                        macList.add(recPayItem.getMacId());
+                    }
+                }
             }
+            if (recPayForUpdate != null) {
+                // 更新总账表的锁定金额
+                accountService.updateReceiptLock(recPayForUpdate.getObjectId());
+            }
+        } else if ("STD".equals(gradeCode)) {
+            if (orderVO.getReceiptList() != null && orderVO.getReceiptList().size() > 0) {
+                // 计算订单明细的出库中数量,金额合计
+                RecPayItemVO itemSum = orderVO.getReceiptList().stream().reduce((x, y) -> {
+                    RecPayItemVO item = new RecPayItemVO();
+                    item.setAmtRec(x.getAmtRec().add(y.getAmtRec()));
+                    return item;
+                }).get();
+
+                RecPay recPay = null;
+                if (recPayForUpdate == null) {
+                    recPay = new RecPay();
+                    // 获取单号
+                    Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.RECPAY.getName(), false);
+                    recPay.setRpId(codeMap.get("outId").toString()).setRpNo(codeMap.get("outNote").toString())
+                            .setRpType(Constant.RpType.SHOU_KUAN.getName()).setObjectId(orderVO.getCusId())
+                            .setOrgId(orderVO.getOrgId()).setStaffId(orderVO.getStaffId()).setAccDate(LocalDate.now())
+                            .setBiznisType(Constant.InventoryDocCode.ORDER.getTableName()).setBiznisId(orderVO.getOrderId()).setBiznisNo(orderVO.getOrderNo())
+                            .setMakeStaff(orderVO.getMakeStaff()).setCpId(orderVO.getCpId());
+
+                    recPay.setSumAmtRec(itemSum.getAmtRec());
+                    recPayMapper.insert(recPay);
+                } else {
+                    // 更新收款总额
+                    RecPay recPayUpdate = new RecPay();
+                    recPayUpdate.setSumAmtRec(itemSum.getAmtRec()).setRpId(recPayForUpdate.getRpId());
+                    receiptService.updateByUuid(recPayUpdate);
 
-            // 明细保存
-            for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
-                RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
-                recPayItem.setItemId(null).setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
-                recPayItemMapper.insert(recPayItem);
-
-                // 插入账款明细
-                AccountItem accountItem = new AccountItem();
-                accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
-                        .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
-                        .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
-                        .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
-                        .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId()).setFlgLock(true);
-                accountItemMapper.insert(accountItem);
-
-                // 更新收款单上的账款明细Id
-                RecPayItem recPayItemUpdate = new RecPayItem();
-                recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
-                recPayItemService.updateByUuid(recPayItemUpdate);
-
-                // 插入资金流水
-                MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
-                moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
-                        .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
-                        .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
-                moneyAccountItemMapper.insert(moneyAccountItem);
+                    // 赋值recPay,下面要用
+                    recPay = recPayForUpdate;
+                }
 
-                if (!macList.contains(recPayItem.getMacId())) {
-                    macList.add(recPayItem.getMacId());
+                // 明细保存
+                for (RecPayItemVO recPayItemVO : orderVO.getReceiptList()) {
+                    RecPayItem recPayItem = recPayItemConvert.convertToPo(recPayItemVO);
+                    recPayItem.setItemId(null).setRpId(recPay.getRpId()).setCpId(recPay.getCpId()).setMakeStaff(recPay.getMakeStaff()).setAccDate(recPay.getAccDate());
+                    recPayItemMapper.insert(recPayItem);
+
+                    // 插入账款明细
+                    AccountItem accountItem = new AccountItem();
+                    accountItem.setAccItemType(Constant.accItemType.SHOU_KUAN.getName())
+                            .setObjectId(recPay.getObjectId()).setOrgId(recPay.getOrgId()).setStaffId(recPay.getStaffId())
+                            .setAccDate(recPay.getAccDate()).setRecStatus(Constant.recStatuse.QUE_DING.getName()).setAmtRec(recPayItem.getAmtRec())
+                            .setBiznisType(Constant.InventoryDocCode.REC_PAY_ITEM.getTableName()).setBiznisId(recPayItem.getItemId()).setBiznisNo(recPay.getRpNo())
+                            .setMakeStaff(recPay.getMakeStaff()).setCpId(recPay.getCpId());
+                    accountItemMapper.insert(accountItem);
+
+                    // 更新收款单上的账款明细Id
+                    RecPayItem recPayItemUpdate = new RecPayItem();
+                    recPayItemUpdate.setAccItemId(accountItem.getItemId()).setItemId(recPayItem.getItemId());
+                    recPayItemService.updateByUuid(recPayItemUpdate);
+
+                    // 插入资金流水
+                    MoneyAccountItem moneyAccountItem = new MoneyAccountItem();
+                    moneyAccountItem.setMacId(recPayItem.getMacId()).setFlowType(Constant.FlowType.SHOU_FU_KUAN.getName())
+                            .setInvoiceId(recPayItem.getItemId()).setAmtInflow(recPayItem.getAmtRec()).setAccDate(recPay.getAccDate())
+                            .setMakeStaff(recPayItem.getMakeStaff()).setCpId(recPayItem.getCpId());
+                    moneyAccountItemMapper.insert(moneyAccountItem);
+
+                    if (!macList.contains(recPayItem.getMacId())) {
+                        macList.add(recPayItem.getMacId());
+                    }
                 }
             }
+            if (recPayForUpdate != null) {
+                // 更新总账表的总收款额和可用额
+                accountService.updateReceipt(recPayForUpdate.getObjectId());
+            }
         }
-        if (recPayForUpdate != null) {
-            // 更新总账表的锁定金额
-            accountService.updateReceiptLock(recPayForUpdate.getObjectId());
-        }
+
 
         // 更新账户余额
         for (String macId : macList) {
@@ -664,7 +825,7 @@ public class OrderService extends BaseService<Order> {
         staffList.add(Constant.OwnerType.Z_STAFF.getName());
         staffList.add(Constant.OwnerType.C_STAFF.getName());
         List<MultiOwnerResponse> multiOwnersStaff = multiOwnerMapper.selectByType(new MultiOwnerQuery().setOrderId(id).setOwnerTypes(staffList));
-        if(multiOwnersStaff != null && multiOwnersStaff.size() > 0){
+        if (multiOwnersStaff != null && multiOwnersStaff.size() > 0) {
             dataInfo.put("staffList", multiOwnersStaff);
         }
         //查询主从业务部门
@@ -672,7 +833,7 @@ public class OrderService extends BaseService<Order> {
         orgList.add(Constant.OwnerType.Z_ORG.getName());
         orgList.add(Constant.OwnerType.C_ORG.getName());
         List<MultiOwnerResponse> multiOwnersOrg = multiOwnerMapper.selectByType(new MultiOwnerQuery().setOrderId(id).setOwnerTypes(orgList));
-        if(multiOwnersOrg != null && multiOwnersOrg.size() > 0){
+        if (multiOwnersOrg != null && multiOwnersOrg.size() > 0) {
             dataInfo.put("orgList", multiOwnersOrg);
         }