FengChaoYu vor 3 Monaten
Ursprung
Commit
fb773ed718
100 geänderte Dateien mit 3275 neuen und 800 gelöschten Zeilen
  1. 1 0
      src/main/java/com/zfire/mall/manager/annotation/ZfireField.java
  2. 6 0
      src/main/java/com/zfire/mall/manager/bean/admin/reqDto/AdminUserAddReqBean.java
  3. 0 3
      src/main/java/com/zfire/mall/manager/bean/admin/respDto/AdminUserDto.java
  4. 8 2
      src/main/java/com/zfire/mall/manager/bean/engin/info/EnginInfoOrderBean.java
  5. 2 0
      src/main/java/com/zfire/mall/manager/bean/engin/order/EnginOrderBean.java
  6. 56 56
      src/main/java/com/zfire/mall/manager/bean/engin/v2/info/EnginInfoOrderVO.java
  7. 3 3
      src/main/java/com/zfire/mall/manager/bean/engin/v2/order/HomeEnginOrderVO.java
  8. 81 79
      src/main/java/com/zfire/mall/manager/bean/engin/v2/order/TradeEnginOrderVO.java
  9. 5 4
      src/main/java/com/zfire/mall/manager/bean/invoice/InvoiceProjectVO.java
  10. 10 8
      src/main/java/com/zfire/mall/manager/bean/invoice/InvoiceRetailVO.java
  11. 4 1
      src/main/java/com/zfire/mall/manager/bean/k3/KingDeePurchaseStockInBean.java
  12. 3 0
      src/main/java/com/zfire/mall/manager/bean/k3/StockPosition.java
  13. 5 0
      src/main/java/com/zfire/mall/manager/bean/k3/StockPositionStock.java
  14. 4 4
      src/main/java/com/zfire/mall/manager/bean/k3/bill/K3OtherReceBean.java
  15. 6 4
      src/main/java/com/zfire/mall/manager/bean/k3/bill/SalesOrderBean.java
  16. 6 2
      src/main/java/com/zfire/mall/manager/bean/k3/v2/KingDeePurchaseStockInVO.java
  17. 45 0
      src/main/java/com/zfire/mall/manager/bean/listV2/CustomerWalletAmountVO.java
  18. 62 0
      src/main/java/com/zfire/mall/manager/bean/listV2/MaterialReferPriceVO.java
  19. 3 0
      src/main/java/com/zfire/mall/manager/bean/listV2/NoticeRecordReadVO.java
  20. 2 2
      src/main/java/com/zfire/mall/manager/bean/listV2/ReceivableItemVO.java
  21. 20 0
      src/main/java/com/zfire/mall/manager/bean/listV2/dto/CustomerAmountDTO.java
  22. 6 1
      src/main/java/com/zfire/mall/manager/bean/reserved/ReservedBeanVO.java
  23. 5 1
      src/main/java/com/zfire/mall/manager/bean/sale/SaleOrderVO.java
  24. 4 0
      src/main/java/com/zfire/mall/manager/bean/sale/SaleOrderVOV.java
  25. 4 1
      src/main/java/com/zfire/mall/manager/bean/sale/StorageFeeBean.java
  26. 26 0
      src/main/java/com/zfire/mall/manager/bean/stock/AdminUserForceStockExcel.java
  27. 4 1
      src/main/java/com/zfire/mall/manager/bean/stock/OrderFullCostDayVO.java
  28. 92 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockBeanToCostPrice.java
  29. 1 1
      src/main/java/com/zfire/mall/manager/bean/stock/StockBeanToDay.java
  30. 18 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockCategory.java
  31. 27 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockChangeBean.java
  32. 17 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockForceAdd.java
  33. 22 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockForceUserAdd.java
  34. 21 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockPrice.java
  35. 69 0
      src/main/java/com/zfire/mall/manager/bean/stock/StockStartAccVO.java
  36. 3 3
      src/main/java/com/zfire/mall/manager/bean/trade/HomeLoginOrderVO.java
  37. 4 1
      src/main/java/com/zfire/mall/manager/bean/trade/LoginOrderVO.java
  38. 4 3
      src/main/java/com/zfire/mall/manager/bean/trade/SpanLoginOrderVO.java
  39. 1 0
      src/main/java/com/zfire/mall/manager/bean/trade/TradeLoginOrderBean.java
  40. 253 0
      src/main/java/com/zfire/mall/manager/bean/trade/TradeOrderImportBean.java
  41. 3 3
      src/main/java/com/zfire/mall/manager/bean/trade/WorkLoginOrderVO.java
  42. 17 0
      src/main/java/com/zfire/mall/manager/bean/valid/NotBeforeToday.java
  43. 23 0
      src/main/java/com/zfire/mall/manager/bean/valid/NotBeforeTodayValidator.java
  44. 4 2
      src/main/java/com/zfire/mall/manager/commonmapper/AdminMapper.java
  45. 3 0
      src/main/java/com/zfire/mall/manager/commonmapper/CommonMapper.java
  46. 30 1
      src/main/java/com/zfire/mall/manager/commonmapper/SaleOrderMapper.java
  47. 9 0
      src/main/java/com/zfire/mall/manager/commonmapper/engin/info/EnginInfoOrderReserveMapper.java
  48. 2 0
      src/main/java/com/zfire/mall/manager/commonmapper/engin/order/EnginOrderReserveMapper.java
  49. 21 0
      src/main/java/com/zfire/mall/manager/commonmapper/listV2/CommonCMapper.java
  50. 15 0
      src/main/java/com/zfire/mall/manager/commonmapper/stock/ReservedMapper.java
  51. 11 2
      src/main/java/com/zfire/mall/manager/commonmapper/stock/StockCommonMapper.java
  52. 8 0
      src/main/java/com/zfire/mall/manager/commonmapper/trade/LoginOrderMapper.java
  53. 4 1
      src/main/java/com/zfire/mall/manager/commonmapper/wallet/WalletCommonMapper.java
  54. 2 2
      src/main/java/com/zfire/mall/manager/component/StartRunner.java
  55. 7 0
      src/main/java/com/zfire/mall/manager/config/GlobalDefaultExceptionHandler.java
  56. 1 0
      src/main/java/com/zfire/mall/manager/config/MpMetaObjectHandler.java
  57. 2 1
      src/main/java/com/zfire/mall/manager/config/aop/ZfireFiledAop.java
  58. 10 1
      src/main/java/com/zfire/mall/manager/constant/Constant.java
  59. 3 3
      src/main/java/com/zfire/mall/manager/constant/KingDeeCons.java
  60. 75 2
      src/main/java/com/zfire/mall/manager/controller/admin/AdminUserController.java
  61. 3 4
      src/main/java/com/zfire/mall/manager/controller/admin/NoticeController.java
  62. 1 1
      src/main/java/com/zfire/mall/manager/controller/customer/CustomerController.java
  63. 12 0
      src/main/java/com/zfire/mall/manager/controller/customer/StageCustomerController.java
  64. 37 2
      src/main/java/com/zfire/mall/manager/controller/engin/info/EnginInfoOrderController.java
  65. 8 7
      src/main/java/com/zfire/mall/manager/controller/engin/order/EnginOrderController.java
  66. 90 89
      src/main/java/com/zfire/mall/manager/controller/engin/order/EnginSysController.java
  67. 108 0
      src/main/java/com/zfire/mall/manager/controller/manage/material/MaterialReferPriceController.java
  68. 21 0
      src/main/java/com/zfire/mall/manager/controller/reserved/ReservedController.java
  69. 5 2
      src/main/java/com/zfire/mall/manager/controller/saletype/SaleOrderController.java
  70. 115 0
      src/main/java/com/zfire/mall/manager/controller/saletype/StorageFeeController.java
  71. 35 0
      src/main/java/com/zfire/mall/manager/controller/stock/StockController.java
  72. 48 0
      src/main/java/com/zfire/mall/manager/controller/stock/StockCostController.java
  73. 69 0
      src/main/java/com/zfire/mall/manager/controller/stock/StockForceController.java
  74. 103 0
      src/main/java/com/zfire/mall/manager/controller/stock/StockForceUserController.java
  75. 141 0
      src/main/java/com/zfire/mall/manager/controller/stock/StockStartAccController.java
  76. 52 0
      src/main/java/com/zfire/mall/manager/controller/trade/LoginOrderController.java
  77. 45 12
      src/main/java/com/zfire/mall/manager/controller/wallet/FinanceController.java
  78. 27 0
      src/main/java/com/zfire/mall/manager/controller/wallet/WalletController.java
  79. 6 0
      src/main/java/com/zfire/mall/manager/enums/InvoiceCustomerEnum.java
  80. 11 2
      src/main/java/com/zfire/mall/manager/enums/IsEnum.java
  81. 11 0
      src/main/java/com/zfire/mall/manager/enums/TradeLoginOrderTypeEnum.java
  82. 1 0
      src/main/java/com/zfire/mall/manager/enums/TradeProjectAreaEnum.java
  83. 243 47
      src/main/java/com/zfire/mall/manager/logic/admin/AdminUserLogic.java
  84. 11 3
      src/main/java/com/zfire/mall/manager/logic/admin/NoticeLogic.java
  85. 21 7
      src/main/java/com/zfire/mall/manager/logic/common/CommonLogic.java
  86. 12 5
      src/main/java/com/zfire/mall/manager/logic/customer/CustomerProductTypeLogic.java
  87. 7 0
      src/main/java/com/zfire/mall/manager/logic/customer/Stagek3CustomerLogic.java
  88. 10 7
      src/main/java/com/zfire/mall/manager/logic/displace/order/DisplaceOrderV2Logic.java
  89. 71 39
      src/main/java/com/zfire/mall/manager/logic/engin/deposit/DepositManageLogic.java
  90. 2 1
      src/main/java/com/zfire/mall/manager/logic/engin/info/EnginInfoOrderLogic.java
  91. 18 8
      src/main/java/com/zfire/mall/manager/logic/engin/order/EnginOrderLogic.java
  92. 270 270
      src/main/java/com/zfire/mall/manager/logic/engin/order/EnginSysLogic.java
  93. 4 1
      src/main/java/com/zfire/mall/manager/logic/engin/v2/info/EnginInfoOrderV2Logic.java
  94. 51 51
      src/main/java/com/zfire/mall/manager/logic/external/ExternalEnginLogic.java
  95. 208 19
      src/main/java/com/zfire/mall/manager/logic/invoice/InvoiceLogic.java
  96. 31 6
      src/main/java/com/zfire/mall/manager/logic/invoice/InvoiceRefundLogic.java
  97. 49 18
      src/main/java/com/zfire/mall/manager/logic/k3/K3StockLogic.java
  98. 149 0
      src/main/java/com/zfire/mall/manager/logic/manage/material/MaterialReferPriceLogic.java
  99. 1 0
      src/main/java/com/zfire/mall/manager/logic/pick/PickLogic.java
  100. 5 1
      src/main/java/com/zfire/mall/manager/logic/policy/PolicyLogic.java

+ 1 - 0
src/main/java/com/zfire/mall/manager/annotation/ZfireField.java

@@ -17,4 +17,5 @@ public @interface ZfireField {
     boolean hide() default false;
     boolean isQuery() default true;//是否支持查询
     boolean multiple() default false;//是否支持多选
+    int sortNum() default 999;
 }

+ 6 - 0
src/main/java/com/zfire/mall/manager/bean/admin/reqDto/AdminUserAddReqBean.java

@@ -20,9 +20,15 @@ public class AdminUserAddReqBean extends AdminUser {
     @ApiModelProperty("是否折让 true/false")
     private Boolean isZr;
 
+    @ApiModelProperty("是否商用 true/false")
+    private Boolean isShangYong;
+
     @ApiModelProperty("绑定对应仓库id")
     private List<String> correspondIds;
 
     @ApiModelProperty("对应金蝶物料对象")
     private List<AdminUserCategoryRela> categoryIds;
+
+    @ApiModelProperty("是否为集团客户")
+    private Boolean isGroupCompany;
 }

+ 0 - 3
src/main/java/com/zfire/mall/manager/bean/admin/respDto/AdminUserDto.java

@@ -1,13 +1,10 @@
 package com.zfire.mall.manager.bean.admin.respDto;
 
 import com.zfire.mall.manager.plus.entity.AdminUser;
-import com.zfire.mall.manager.plus.entity.CustomerBillLimitConfig;
-import com.zfire.mall.manager.plus.entity.StockCorrespond;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.util.List;
 
 @ApiModel
 @Data

+ 8 - 2
src/main/java/com/zfire/mall/manager/bean/engin/info/EnginInfoOrderBean.java

@@ -1,9 +1,11 @@
 package com.zfire.mall.manager.bean.engin.info;
 
+import cn.hutool.core.date.DateUtil;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.zfire.mall.manager.bean.admin.AdminUserCom;
 import com.zfire.mall.manager.bean.valid.EditGroup;
+import com.zfire.mall.manager.bean.valid.NotBeforeToday;
 import com.zfire.mall.manager.enums.ExamineStatusEnum;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.plus.entity.EnginInfoOrder;
@@ -21,7 +23,10 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import org.springframework.beans.BeanUtils;
 
-import javax.validation.constraints.*;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -118,7 +123,7 @@ public class EnginInfoOrderBean {
     private String serviceName;
 
     @NotNull(message = "合同有效期不能为空")
-    @Future(message = "不能少于当前日期")
+    @NotBeforeToday(message = "不能少于当前日期")
     @ApiModelProperty(value = "合同有效期")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date contractExpireDate;
@@ -212,6 +217,7 @@ public class EnginInfoOrderBean {
         EnginInfoOrder enginInfoOrder = new EnginInfoOrder();
         BeanUtils.copyProperties(this, enginInfoOrder);
         enginInfoOrder.setCreateBy(CommonUtils.getUsername())
+                .setContractExpireDate(DateUtil.parseDateTime(DateUtil.formatDate(enginInfoOrder.getContractExpireDate()) + " 23:59:59"))
                 .setCreateName(CommonUtils.getNickName())
                 .setUpdateBy(CommonUtils.getUsername())
                 .setUpdateName(CommonUtils.getNickName())

+ 2 - 0
src/main/java/com/zfire/mall/manager/bean/engin/order/EnginOrderBean.java

@@ -391,6 +391,8 @@ public class EnginOrderBean {
                         .setTakeDeposit(this.takeDeposit)
                         .setFileNo(this.fileNo)
                         .setGeLiNote(this.geLiNote)
+                        .setCorrespondName(this.getCorrespondName())
+                        .setCorrespondId(this.getCorrespondId())
                         .setGeLiInerNote(this.geLiInerNote);
             }
         }

+ 56 - 56
src/main/java/com/zfire/mall/manager/bean/engin/v2/info/EnginInfoOrderVO.java

@@ -26,19 +26,19 @@ public class EnginInfoOrderVO {
     @ApiModelProperty(value = "客户id")
     private String customerId;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "经销商编码")
     private String customerNumber;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 4)
     @ApiModelProperty(value = "经销商名称")
     private String customerName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 3)
     @ApiModelProperty(value = "工程登录编号")
     private String enginInfoNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 2)
     @ApiModelProperty(value = "订单日期")
     private Date orderDate;
 
@@ -50,7 +50,7 @@ public class EnginInfoOrderVO {
 //    @ApiModelProperty(value = "产品大类名称")
 //    private String mainName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 5)
     @ApiModelProperty(value = "项目名称")
     private String projectName;
 
@@ -62,51 +62,51 @@ public class EnginInfoOrderVO {
 //    @ApiModelProperty(value = "项目说明")
 //    private String projectNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "机型类别")
     private String machineType;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "使用单位")
     private String useUnit;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "安装地址")
     private String installAddress;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "工程编号")
     private String projectNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "厂工程编号")
     private String enginFactoryNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "工程登录类型")
     private String enginSignType;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "行业类别")
     private String tradeCategory;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "联系人")
     private String linkman;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "联系电话")
     private String phone;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "固定电话")
     private String tel;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "第几申报")
     private String declareNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "权限分类")
     private String powerCategory;
 
@@ -114,11 +114,11 @@ public class EnginInfoOrderVO {
     @ApiModelProperty(value = "业务员")
     private String serviceId;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 6)
     @ApiModelProperty(value = "表头业务员")
     private String serviceName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 21, isQuery = false)
     @ApiModelProperty(value = "合同有效期")
     private Date contractExpireDate;
 
@@ -126,79 +126,79 @@ public class EnginInfoOrderVO {
     @ApiModelProperty(value = "格力回复")
     private String geLiNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "格力内部备注")
     private String geLiInerNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "文件编号")
     private String fileNo;
 
-    @ZfireField(tbName = "a", type = "select")
+    @ZfireField(tbName = "a", type = "select", isShow = false, isQuery = false)
     @ApiModelProperty(value = "是否旧单导入")
     private IsEnum isOldOrder;
 
-    @ZfireField(tbName = "a", type = "select")
+    @ZfireField(tbName = "a", type = "select", isShow = false, isQuery = false)
     @ApiModelProperty(value = "是否计划单")
     private IsEnum isPlanOrder;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "备注")
     private String remark;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 20, isQuery = false)
     @ApiModelProperty(value = "审核说明")
     private String examineNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 1)
     @ApiModelProperty(value = "单据状态")
     private ExamineStatusEnum examineStatus;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "是否提前完结")
     private IsEnum endStatus;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "制表人")
     private String createName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "制表时间")
     private Date createTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 23, isQuery = false)
     @ApiModelProperty(value = "更新人")
     private String updateName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 24, isQuery = false)
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "提交人")
     private String submitName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "提交时间")
     private Date submitTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 18, isQuery = false)
     @ApiModelProperty(value = "审核人")
     private String confirmName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 19, isQuery = false)
     @ApiModelProperty(value = "审核时间")
     private Date confirmTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "弃审人")
     private String abandonName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "弃审时间")
     private Date abandonTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 22)
     @ApiModelProperty(value = "是否关闭")
     private IsEnum isClose;
 
@@ -210,11 +210,11 @@ public class EnginInfoOrderVO {
     @ApiModelProperty(value = "销售类型id")
     private String saleTypeId;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "销售类型编码")
     private String saleTypeCode;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 16, isQuery = false)
     @ApiModelProperty(value = "销售类型名称")
     private String saleTypeName;
 
@@ -222,67 +222,67 @@ public class EnginInfoOrderVO {
     @ApiModelProperty(value = "金蝶物料id")
     private String materialId;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "物料编码")
     private String materialNumber;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 7, isQuery = false)
     @ApiModelProperty(value = "产品名称")
     private String materialName;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "厂产品编码")
     private String materialOldNumber;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 9)
     @ApiModelProperty(value = "规格型号")
     private String specification;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "基本单位编码")
     private String unit;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 11, isQuery = false)
     @ApiModelProperty(value = "单价")
     private BigDecimal price;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 10, isQuery = false)
     @ApiModelProperty(value = "数量")
     private Integer qty;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 12, isQuery = false)
     @ApiModelProperty(value = "总金额")
     private BigDecimal totalAmount;
 
-    @ZfireField(tbName = "b", colName = "remark")
+    @ZfireField(tbName = "b", colName = "remark", isShow = false, isQuery = false)
     @ApiModelProperty(value = "备注")
     private String itemRemark;
 
-    @ZfireField(isQuery = false)
+    @ZfireField(isQuery = false, sortNum = 13)
     @ApiModelProperty(value = "可订数量")
     private String surplusQty;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 14, isQuery = false)
     @ApiModelProperty(value = "已订数量")
     private Integer hasOrderQty;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "出库数量")
     private String hasDeliverQty;
 
-    @ZfireField(isQuery = false)
+    @ZfireField(isQuery = false, sortNum = 15)
     @ApiModelProperty(value = "发货数量")
     private String hasSendQty;
 
-    @ZfireField(tbName = "kdm")
+    @ZfireField(tbName = "kdm", sortNum = 8)
     @ApiModelProperty(value = "物料分组名称")
     private String materialGroupName;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "税率")
     private BigDecimal taxRate;
 
-    @ZfireField(tbName = "kdm")
+    @ZfireField(tbName = "kdm", sortNum = 17, isQuery = false)
     @ApiModelProperty(value = "存货类别")
     private String categoryName;
 

+ 3 - 3
src/main/java/com/zfire/mall/manager/bean/engin/v2/order/HomeEnginOrderVO.java

@@ -90,9 +90,9 @@ public class HomeEnginOrderVO extends EnginOrderVO {
     @ApiModelProperty(value = "项目类型")
     private String refProjectType;
 
-//    @ZfireField(tbName = "a")
-//    @ApiModelProperty(value = "项目说明")
-//    private String refProjectNote;
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "项目说明")
+    private String refProjectNote;
 
     @ZfireField(tbName = "a")
     @ApiModelProperty(value = "使用单位")

+ 81 - 79
src/main/java/com/zfire/mall/manager/bean/engin/v2/order/TradeEnginOrderVO.java

@@ -29,11 +29,11 @@ public class TradeEnginOrderVO extends EnginOrderVO {
     @ApiModelProperty(value = "客户id")
     private String customerId;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "经销商编码")
     private String customerNumber;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 6)
     @ApiModelProperty(value = "经销商名称")
     private String customerName;
 
@@ -41,7 +41,7 @@ public class TradeEnginOrderVO extends EnginOrderVO {
     @ApiModelProperty(value = "表头业务员编号")
     private String serviceId;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 7)
     @ApiModelProperty(value = "表头业务员")
     private String serviceName;
 
@@ -65,107 +65,107 @@ public class TradeEnginOrderVO extends EnginOrderVO {
     @ApiModelProperty(value = "工程类型 TRADE=商用 HOME=家用")
     private OrderTypeEnum enginOrderType;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 5)
     @ApiModelProperty(value = "工程订单号")
     private String enginOrderNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 3)
     @ApiModelProperty(value = "订单日期")
     private Date orderDate;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 19)
     @ApiModelProperty(value = "工程信息单号")
     private String refEnginRecordNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "项目类别")
     private String refProjectCategory;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 8)
     @ApiModelProperty(value = "项目名称")
     private String refProjectName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "项目类型")
     private String refProjectType;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "项目说明")
     private String refProjectNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "使用单位")
     private String refUseUnit;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "安装地址")
     private String refInstallAddress;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "工程编号")
     private String refProjectNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "跨区厂编号")
     private String refFactoryNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "工程登录类型")
     private String refPromiseStatus;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "行业类别")
     private String refTradeCategory;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "权限分类")
     private String refPowerCategory;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "机型类别")
     private String refMachineType;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "购买单位名称")
     private String refBuyUnitName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "保证函")
     private String refPromiseProvide;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "区域")
     private String refRegionWork;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "引用次数")
     private Integer refCount;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "联系人")
     private String refLinkman;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "联系电话")
     private String refPhone;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "固定电话")
     private String refTel;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "第几申报")
     private String refDeclareNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "文件编号")
     private String fileNo;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "是否不扣押金")
     private IsEnum takeDeposit;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "是否直调完结")
     private IsEnum directTransferStatus;
 
@@ -173,75 +173,75 @@ public class TradeEnginOrderVO extends EnginOrderVO {
     @ApiModelProperty(value = "格力回复")
     private String geLiNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "格力内部备注")
     private String geLiInerNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "备注")
     private String remark;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 25, isQuery = false)
     @ApiModelProperty(value = "审核说明")
     private String examineNote;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 1)
     @ApiModelProperty(value = "单据状态")
     private ExamineStatusEnum examineStatus;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "制单人")
     private String createName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "制单日期")
     private Date createTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "最后更新人")
     private String updateName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "最后更新日期")
     private Date updateTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "提交人")
     private String submitName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "提交日期")
     private Date submitTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 23, isQuery = false)
     @ApiModelProperty(value = "审核人")
     private String confirmName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 24, isQuery = false)
     @ApiModelProperty(value = "审核日期")
     private Date confirmTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "弃审人")
     private String abandonName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "弃审日期")
     private Date abandonTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "关闭人")
     private String closeName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "关闭日期")
     private Date closeTime;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "直调完结人")
     private String endDirectName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", isShow = false, isQuery = false)
     @ApiModelProperty(value = "直调完结日期")
     private Date endDirectTime;
 
@@ -260,18 +260,18 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "明细销售类型id")
 //    private String itemSaleTypeId;
 
-    @ZfireField(tbName = "b", colName = "sale_type_code")
+    @ZfireField(tbName = "b", colName = "sale_type_code", isShow = false, isQuery = false)
     @ApiModelProperty(value = "销售类型编码")
     private String itemSaleTypeCode;
 
-    @ZfireField(tbName = "b", colName = "sale_type_name")
+    @ZfireField(tbName = "b", colName = "sale_type_name", isShow = false, isQuery = false)
     @ApiModelProperty(value = "销售类型名称")
     private String itemSaleTypeName;
 
 //    @ApiModelProperty(value = "明细业务员")
 //    private String itemServiceId;
 
-    @ZfireField(tbName = "b", colName = "service_name")
+    @ZfireField(tbName = "b", colName = "service_name", isShow = false, isQuery = false)
     @ApiModelProperty(value = "业务员名称")
     private String itemServiceName;
 
@@ -279,23 +279,23 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "金蝶物料id")
 //    private String materialId;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "物料编码")
     private String materialNumber;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "厂产品代码")
     private String materialOldNumber;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 9, isQuery = false)
     @ApiModelProperty(value = "产品名称")
     private String materialName;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 11)
     @ApiModelProperty(value = "规格型号")
     private String specification;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "基本单位编码")
     private String unit;
 
@@ -311,59 +311,59 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "信息单数量")
 //    private Integer enginNum;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, sortNum = 12, isQuery = false)
     @ApiModelProperty(value = "数量")
     private Integer qty;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 13, isQuery = false)
     @ApiModelProperty(value = "单价")
     private BigDecimal price;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "格力折扣")
     private BigDecimal discAmount;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, sortNum = 14, isQuery = false)
     @ApiModelProperty(value = "订单金额")
     private BigDecimal totalAmount;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "返利钱包的返利比例")
     private BigDecimal rebateRate;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "返利金额")
     private BigDecimal rebateAmount;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "押金比例")
     private BigDecimal depositRate;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "现金钱包编号")
     private String customerWalletId;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 20, isQuery = false)
     @ApiModelProperty(value = "现金钱包")
     private String customerWalletName;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "返利类型编号")
     private String customerWalletId2;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", isShow = false, isQuery = false)
     @ApiModelProperty(value = "返利类型")
     private String customerWalletName2;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 4)
     @ApiModelProperty(value = "是否直调")
     private IsEnum isDirectTransfer;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, sortNum = 21, isQuery = false)
     @ApiModelProperty(value = "直调数量")
     private Integer directTransferQty;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "出库数量")
     private Integer hasSendQty;
 
@@ -379,10 +379,11 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "单个商品的押金金额(单个商品的实际支付金额*押金比例)")
 //    private BigDecimal singleDepositAmount;
 //
+    @ZfireField(sortNum = 16, isQuery = false)
     @ApiModelProperty(value = "实付金额")
     private BigDecimal payAmount;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, sortNum = 15, isQuery = false)
     @ApiModelProperty(value = "实付返利金额")
     private BigDecimal payRebateAmount;
 //
@@ -396,7 +397,7 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "总押金金额")
 //    private BigDecimal totalDepositAmount;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "原订单数量")
     private Integer oldQty;
 
@@ -409,26 +410,27 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty(value = "税率例如: 0.13")
 //    private BigDecimal tax;
 
-    @ZfireField(isQuery = false, isTotal = true)
+    @ZfireField(isQuery = false, isTotal = true, isShow = false)
     @ApiModelProperty(value = "可退订数量")
     private Integer refundableQty;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, sortNum = 18, isQuery = false)
     @ApiModelProperty(value = "已退订数量")
     private Integer retiredQty;
 
-    @ZfireField(tbName = "b", colName = "remark")
+    @ZfireField(tbName = "b", colName = "remark", isShow = false, isQuery = false)
     @ApiModelProperty(value = "表体备注")
     private String itemRemark;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "退货数量")
     private Integer refundProductQty;
 
-    @ZfireField(tbName = "b", isTotal = true)
+    @ZfireField(tbName = "b", isTotal = true, isShow = false, isQuery = false)
     @ApiModelProperty(value = "退货金额")
     private BigDecimal refundProductAmount;
 
+    @ZfireField(sortNum = 17, isQuery = false)
     @ApiModelProperty(value = "发货数量")
     private Integer applySendQty;
 //
@@ -454,15 +456,15 @@ public class TradeEnginOrderVO extends EnginOrderVO {
 //    @ApiModelProperty("发货仓库")
 //    private String correspondName;
 
-    @ZfireField(tbName = "kdm")
+    @ZfireField(tbName = "kdm", sortNum = 10)
     @ApiModelProperty("物料分组")
     private String materialGroupName;
 
-    @ZfireField(tbName = "b")
+    @ZfireField(tbName = "b", sortNum = 22, isQuery = false)
     @ApiModelProperty("存货类别")
     private String k3CategoryName;
 
-    @ZfireField(tbName = "a")
+    @ZfireField(tbName = "a", sortNum = 2)
     @ApiModelProperty(value = "仓库名称")
     private String correspondName;
 

+ 5 - 4
src/main/java/com/zfire/mall/manager/bean/invoice/InvoiceProjectVO.java

@@ -80,9 +80,13 @@ public class InvoiceProjectVO {
     private Date orderTime;
 
     @ZfireField(hide = false,tbName = "ia")
-    @ApiModelProperty(value = "订单日期")
+    @ApiModelProperty(value = "发货创建日期")
     private Date createTime;
 
+    @ZfireField(hide = false,tbName = "iao")
+    @ApiModelProperty(value = "单据日期")
+    private Date theTime;
+
     @ZfireField(hide = false,isQuery = true,tbName = "ia")
     @ApiModelProperty(value = "发货单号")
     private String id;
@@ -345,9 +349,6 @@ public class InvoiceProjectVO {
 
 
 
-    @ZfireField(hide = true)
-    @ApiModelProperty(value = "单据日期")
-    private Date theTime;
 
 
     @ZfireField(hide = true)

+ 10 - 8
src/main/java/com/zfire/mall/manager/bean/invoice/InvoiceRetailVO.java

@@ -72,7 +72,7 @@ public class InvoiceRetailVO {
     @ApiModelProperty(value = "审批说明")
     private String approvalRemark;
 
-    @ZfireField(hide = true,isQuery = true,tbName = "iao")
+    @ZfireField(hide = true,isQuery = true,tbName = "ia")
     @ApiModelProperty(value = "审核时间")
     private Date confirmTime;
 
@@ -81,9 +81,14 @@ public class InvoiceRetailVO {
     private Date orderTime;
 
     @ZfireField(hide = false,tbName = "ia")
-    @ApiModelProperty(value = "订单日期")
+    @ApiModelProperty(value = "发货创建日期")
     private Date createTime;
 
+    @ZfireField(hide = false,tbName = "iao")
+    @ApiModelProperty(value = "单据日期")
+    private Date theTime;
+
+
     @ZfireField(hide = false,isQuery = true,tbName = "ia")
     @ApiModelProperty(value = "发货单号")
     private String id;
@@ -278,15 +283,15 @@ public class InvoiceRetailVO {
     @ApiModelProperty(value = "文件编号")
     private String itemFileNo;
 
-    @ZfireField(hide = false,tbName = "iao")
+    @ZfireField(hide = false,tbName = "ia")
     @ApiModelProperty(value = "创建人(制单人)")
     private String createBy;
 
-    @ZfireField(hide = false,tbName = "iao")
+    @ZfireField(hide = false,tbName = "ia")
     @ApiModelProperty(value = "更新人")
     private String updateBy;
 
-    @ZfireField(hide = false,tbName = "iao")
+    @ZfireField(hide = false,tbName = "ia")
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
 
@@ -334,9 +339,6 @@ public class InvoiceRetailVO {
 
 
 
-    @ZfireField(hide = true)
-    @ApiModelProperty(value = "单据日期")
-    private Date theTime;
 
 
     @ZfireField(hide = true)

+ 4 - 1
src/main/java/com/zfire/mall/manager/bean/k3/KingDeePurchaseStockInBean.java

@@ -26,9 +26,12 @@ public class KingDeePurchaseStockInBean extends KingDeePurchaseStockIn {
     @ApiModelProperty(value = "物料名称")
     private String materialName;
 
-    @ApiModelProperty(value = "仓库")
+    @ApiModelProperty(value = "仓库Id")
     private String stockId;
 
+    @ApiModelProperty(value = "仓库")
+    private String stockName;
+
     @ApiModelProperty(value = "备注")
     private String note;
 

+ 3 - 0
src/main/java/com/zfire/mall/manager/bean/k3/StockPosition.java

@@ -15,4 +15,7 @@ public class StockPosition extends StockCorrespond {
 
     @ApiModelProperty(value = "绑定品类")
     private String[] categoryIds;
+
+    @ApiModelProperty(value = "绑定品类")
+    private String[] qiangzhiCategoryIds;
 }

+ 5 - 0
src/main/java/com/zfire/mall/manager/bean/k3/StockPositionStock.java

@@ -3,6 +3,7 @@ package com.zfire.mall.manager.bean.k3;
 import com.zfire.mall.manager.plus.entity.KingDeeCategory;
 import com.zfire.mall.manager.plus.entity.KingDeeStock;
 import com.zfire.mall.manager.plus.entity.StockCorrespond;
+import com.zfire.mall.manager.plus.entity.StockForceCategory;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -22,4 +23,8 @@ public class StockPositionStock extends StockCorrespond {
 
     @ApiModelProperty(value = "存货类别")
     private List<KingDeeCategory> kingDeeCategories;
+
+
+    @ApiModelProperty(value = "强制仓存货类别")
+    private List<StockForceCategory> stockForceCategories;
 }

+ 4 - 4
src/main/java/com/zfire/mall/manager/bean/k3/bill/K3OtherReceBean.java

@@ -42,14 +42,14 @@ public class K3OtherReceBean extends CommonOrderBean {
     @JsonProperty("FCustId")
     private Map<String, String> custId = new HashMap<String, String>();
 
-    @ApiModelProperty(value = "销售员")
+/*    @ApiModelProperty(value = "销售员")
     private String salerNumber;
     @JsonProperty("FSalerId")
     private Map<String, String> salerId = new HashMap<String, String>() {
         {
             this.put(KingDeeCons.NUMBER, KingDeeCons.SALERID);
         }
-    };
+    };*/
 
     @JsonProperty("FNote")
     @ApiModelProperty(value = "备注")
@@ -72,10 +72,10 @@ public class K3OtherReceBean extends CommonOrderBean {
         this.custId.put(KingDeeCons.NUMBER, this.customerNumber);
     }
 
-    public void setSalerNumber(String salerNumber) {
+/*    public void setSalerNumber(String salerNumber) {
         this.salerNumber = salerNumber;
         this.salerId.put(KingDeeCons.NUMBER, this.salerNumber);
-    }
+    }*/
 
     @Override
     public boolean isPushUpdate() {

+ 6 - 4
src/main/java/com/zfire/mall/manager/bean/k3/bill/SalesOrderBean.java

@@ -42,14 +42,14 @@ public class SalesOrderBean extends CommonOrderBean {
     @JsonProperty("FCustId")
     private Map<String, String> custId = new HashMap<String, String>();
 
-    @ApiModelProperty(value = "销售员")
-    private String salerNumber;
-    @JsonProperty("FSalerId")
+/*    @ApiModelProperty(value = "销售员")
+    private String salerNumber;*/
+/*    @JsonProperty("FSalerId")
     private Map<String, String> salerId = new HashMap<String, String>() {
         {
             this.put(KingDeeCons.NUMBER, KingDeeCons.SALERID);
         }
-    };
+    };*/
 
     @JsonProperty("FNote")
     @ApiModelProperty(value = "备注")
@@ -82,10 +82,12 @@ public class SalesOrderBean extends CommonOrderBean {
         this.custId.put(KingDeeCons.NUMBER, this.customerNumber);
     }
 
+/*
     public void setSalerNumber(String salerNumber) {
         this.salerNumber = salerNumber;
         this.salerId.put(KingDeeCons.NUMBER, this.salerNumber);
     }
+*/
 
     @Override
     public boolean isPushUpdate() {

+ 6 - 2
src/main/java/com/zfire/mall/manager/bean/k3/v2/KingDeePurchaseStockInVO.java

@@ -117,8 +117,8 @@ public class KingDeePurchaseStockInVO {
     @ApiModelProperty(value = "物料名称")
     private String materialName;
 
-    @ZfireField(tbName = "b")
-    @ApiModelProperty(value = "仓库")
+    @ZfireField(tbName = "b",hide = true)
+    @ApiModelProperty(value = "仓库id")
     private String stockId;
 
     @ZfireField(tbName = "b")
@@ -176,4 +176,8 @@ public class KingDeePurchaseStockInVO {
     @ZfireField(tbName = "c", colName = "old_number")
     @ApiModelProperty(value = "物料代码")
     private String materialOldNumber;
+
+    @ZfireField(tbName = "b", colName = "stock_name")
+    @ApiModelProperty(value = "仓库")
+    private String stockName;
 }

+ 45 - 0
src/main/java/com/zfire/mall/manager/bean/listV2/CustomerWalletAmountVO.java

@@ -0,0 +1,45 @@
+package com.zfire.mall.manager.bean.listV2;
+
+import com.zfire.mall.manager.annotation.ZfireField;
+import com.zfire.mall.manager.enums.WalletTypeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 经销商余额
+ * @author :lijh
+ * @description:TODO
+ * @date :2024/5/14 15:54
+ */
+@ZfireField(tbName = "a")
+@Data
+@ApiModel
+public class CustomerWalletAmountVO {
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("经销商编号")
+    private String customerNumber;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("经销商名称")
+    private String customerName;
+
+    @ZfireField(hide = true,tbName = "b")
+    @ApiModelProperty("经销商钱包id")
+    private String customerWalletId;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("钱包名称")
+    private String customerWalletName;
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty("余额")
+    private BigDecimal balanceAmount;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("钱包类型")
+    private WalletTypeEnum type;
+}

+ 62 - 0
src/main/java/com/zfire/mall/manager/bean/listV2/MaterialReferPriceVO.java

@@ -0,0 +1,62 @@
+package com.zfire.mall.manager.bean.listV2;
+
+import com.zfire.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 物料参考成本价格VO
+ * @author :lijh
+ * @description:TODO
+ * @date :2024/2/19 15:48
+ */
+@ZfireField(tbName = "a")
+@ApiModel
+@Data
+public class MaterialReferPriceVO {
+
+
+    @ZfireField(hide = true)
+    @ApiModelProperty("id")
+    private String id;
+    
+    @ApiModelProperty("物料编码")
+    private String materialNumber;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("产品编码")
+    private String oldNumber;
+
+    @ZfireField(tbName = "b",hide = true)
+    @ApiModelProperty("存货类别ID")
+    private String categoryId;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("存货类别")
+    private String categoryName;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("物料名称")
+    private String name;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty("规格型号")
+    private String specification;
+
+    @ApiModelProperty("参考成本价")
+    private BigDecimal costPrice;
+
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+    @ApiModelProperty("修改人")
+    private String updateBy;
+    @ApiModelProperty("修改时间")
+    private Date updateTime;
+}

+ 3 - 0
src/main/java/com/zfire/mall/manager/bean/listV2/NoticeRecordReadVO.java

@@ -1,6 +1,7 @@
 package com.zfire.mall.manager.bean.listV2;
 
 import com.zfire.mall.manager.annotation.ZfireField;
+import com.zfire.mall.manager.enums.IsEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -24,6 +25,8 @@ public class NoticeRecordReadVO {
     private String title;
     @ApiModelProperty(value = "阅读时间")
     private Date readTime;
+    @ApiModelProperty(value = "是否已浏览")
+    private IsEnum isTopRead;
     @ApiModelProperty(value = "接收人昵称")
     private String adminNickName;
     @ApiModelProperty(value = "发布人昵称")

+ 2 - 2
src/main/java/com/zfire/mall/manager/bean/listV2/ReceivableItemVO.java

@@ -15,8 +15,8 @@ import java.util.Date;
 @Data
 public class ReceivableItemVO  {
 
-    @ZfireField(hide = true)
-    @ApiModelProperty(value = "明细Id")
+    @ZfireField(tbName = "b",colName = "id")
+    @ApiModelProperty(value = "表体行号")
     private String itemId;
 
     @ApiModelProperty("单据来源")

+ 20 - 0
src/main/java/com/zfire/mall/manager/bean/listV2/dto/CustomerAmountDTO.java

@@ -0,0 +1,20 @@
+package com.zfire.mall.manager.bean.listV2.dto;
+
+import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author :lijh
+ * @description:TODO
+ * @date :2024/5/14 16:28
+ */
+@ApiModel
+@Data
+public class CustomerAmountDTO extends ZfireParamBean {
+    @ApiModelProperty("筛选时间")
+    private Date time;
+}

+ 6 - 1
src/main/java/com/zfire/mall/manager/bean/reserved/ReservedBeanVO.java

@@ -22,7 +22,7 @@ import java.util.Date;
  */
 @ApiModel
 @Data
-public class ReservedBeanVO  {
+public class ReservedBeanVO   {
 
     @ZfireField(hide = true,tbName = "ro")
     @ApiModelProperty(value = "预留单单号")
@@ -129,5 +129,10 @@ public class ReservedBeanVO  {
     @ApiModelProperty(value = "仓库名称")
     private String correspondName;
 
+    @ZfireField(hide = false,frontCode = FrontCodeConstant.CATEGORY,tbName = "roi",colName = "k3_category_id",type ="select",multiple = true)
+    @ApiModelProperty(value = "存货分类")
+    private String k3CategoryName;
+
+
 
 }

+ 5 - 1
src/main/java/com/zfire/mall/manager/bean/sale/SaleOrderVO.java

@@ -45,7 +45,7 @@ public class SaleOrderVO  {
 
 
     @ZfireField(tbName = "so",colName = "order_time")
-    @ApiModelProperty(value = "出库单时间")
+    @ApiModelProperty(value = "出库单创建时间")
     private Date orderTime;
 
     @ZfireField(tbName = "so",colName = "logistics_name")
@@ -125,6 +125,10 @@ public class SaleOrderVO  {
     @ApiModelProperty(value = "销售类型名称")
     private String saleTypeName;
 
+    @ZfireField(tbName = "cptr",colName = "service_name")
+    @ApiModelProperty(value = "归属业务员")
+    private String cpServiceName;
+
 
     @ZfireField(hide = true,tbName = "iao")
     @ApiModelProperty(value = "金蝶物料id")

+ 4 - 0
src/main/java/com/zfire/mall/manager/bean/sale/SaleOrderVOV.java

@@ -59,6 +59,10 @@ public class SaleOrderVOV {
     @ApiModelProperty(value = "发票号")
     private String billReceipt;
 
+    @ZfireField(tbName = "cptr",colName = "service_name")
+    @ApiModelProperty(value = "归属业务员")
+    private String cpServiceName;
+
     @ZfireField(tbName = "so",colName = "bill_date")
     @ApiModelProperty(value = "发票时间")
     private Date billDate;

+ 4 - 1
src/main/java/com/zfire/mall/manager/bean/sale/StorageFeeBean.java

@@ -42,7 +42,7 @@ public class StorageFeeBean {
     @ApiModelProperty(value = "申请发货日期")
     private Date orderTime;
 
-    @ApiModelProperty(value = "申请发货审批")
+    @ApiModelProperty(value = "申请发货审批时间")
     private Date approvalTime;
 
 
@@ -64,6 +64,9 @@ public class StorageFeeBean {
     @ApiModelProperty(value = "经销商名称")
     private String customerName;
 
+    @ApiModelProperty(value = "存货类别")
+    private String k3CategoryName;
+
 
     @ApiModelProperty(value = "物料编号")
     private String materialCode;

+ 26 - 0
src/main/java/com/zfire/mall/manager/bean/stock/AdminUserForceStockExcel.java

@@ -0,0 +1,26 @@
+package com.zfire.mall.manager.bean.stock;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@ApiModel
+@Data
+public class AdminUserForceStockExcel {
+
+    @ApiModelProperty(value = "账号id")
+    private String adminUserId;
+
+    @ApiModelProperty(value = "账号")
+    private String userName;
+
+    @ApiModelProperty(value = "账号名称")
+    private String nickName;
+
+    @ApiModelProperty(value = "仓库名称")
+    private String stockName;
+
+    @ApiModelProperty(value = "仓库强制分类")
+    private String stockCategory;
+
+}

+ 4 - 1
src/main/java/com/zfire/mall/manager/bean/stock/OrderFullCostDayVO.java

@@ -22,7 +22,7 @@ import java.util.Date;
 @ApiModel
 @Data
 @ZfireField(tbName = "a")
-public class OrderFullCostDayVO   {
+public class OrderFullCostDayVO {
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "日账单id")
@@ -120,4 +120,7 @@ public class OrderFullCostDayVO   {
     @ApiModelProperty(value = "备注")
     private String note;
 
+    @ApiModelProperty(value = "存货类别")
+    private String k3CategoryName;
+
 }

+ 92 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockBeanToCostPrice.java

@@ -0,0 +1,92 @@
+package com.zfire.mall.manager.bean.stock;
+
+import com.zfire.mall.manager.annotation.ZfireField;
+import com.zfire.mall.manager.constant.FrontCodeConstant;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author change
+ */
+@ApiModel
+@Data
+public class StockBeanToCostPrice {
+
+
+    @ZfireField(hide = true,tbName = "scp")
+    @ApiModelProperty(value = "仓库ID")
+    private String correspondId;
+
+    @ZfireField(tbName = "sc",colName = "id",multiple = true,frontCode = FrontCodeConstant.STOCK,type = "select")
+    @ApiModelProperty(value = "仓库名称")
+    private String correspondName;
+
+    @ZfireField(tbName = "kdm",multiple = true,colName = "category_id",frontCode = FrontCodeConstant.CATEGORY,type = "select")
+    @ApiModelProperty(value = "存货类别")
+    private String categoryName;
+
+    @ZfireField(hide = true,tbName = "kdm",colName = "id")
+    @ApiModelProperty(value = "物料id")
+    private String materialId;
+
+    @ZfireField(tbName = "kdm",colName = "number")
+    @ApiModelProperty(value = "物料编码")
+    private String materialNumber;
+
+    @ZfireField(tbName = "kdm",colName = "old_number")
+    @ApiModelProperty(value = "产品编码")
+    private String materialOldNumber;
+
+    @ZfireField(tbName = "kdm",colName = "name")
+    @ApiModelProperty(value = "物料名称")
+    private String materialName;
+
+    @ZfireField(tbName = "kdm",colName = "specification")
+    @ApiModelProperty(value = "规格型号")
+    private String specification;
+
+    @ZfireField(isQuery = false)
+    @ApiModelProperty("可用数量")
+    private Integer stockAdequate;
+
+    @ZfireField(isQuery = false)
+    @ApiModelProperty(value = "开单未提数量")
+    private Integer num;
+
+    @ZfireField(tbName = "s",colName = "stock_qty",isQuery = false)
+    @ApiModelProperty("结存数量")
+    private Integer balanceNumber;
+
+    @ZfireField(isQuery = false)
+    @ApiModelProperty(value = "经销商预留库存")
+    private Integer reservedNum;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "经销商暂扣库存")
+    private Integer temporaryNum;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "产品大类")
+    private String mainName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty("可开数量")
+    private Integer openNumber;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "总库存数量")
+    private Integer stockQty;
+
+    @ApiModelProperty(value = "成本单价")
+    private BigDecimal costPrice;
+
+    @ZfireField(isQuery = false)
+    @ApiModelProperty(value = "金额")
+    private BigDecimal costPriceAll;
+
+
+
+}

+ 1 - 1
src/main/java/com/zfire/mall/manager/bean/stock/StockBeanToDay.java

@@ -60,7 +60,7 @@ public class StockBeanToDay {
     @ApiModelProperty("结存数量")
     private Integer balanceNumber;
 
-    @ZfireField(hide = true)
+    @ZfireField(isQuery = false)
     @ApiModelProperty(value = "经销商预留库存")
     private Integer reservedNum;
 

+ 18 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockCategory.java

@@ -0,0 +1,18 @@
+package com.zfire.mall.manager.bean.stock;
+
+import com.zfire.mall.manager.plus.entity.KingDeeCategory;
+import com.zfire.mall.manager.plus.entity.StockCorrespond;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel
+@Data
+public class StockCategory extends StockCorrespond {
+
+    @ApiModelProperty(value = "品类列表")
+    private List<KingDeeCategory> kingDeeCategories;
+
+}

+ 27 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockChangeBean.java

@@ -0,0 +1,27 @@
+package com.zfire.mall.manager.bean.stock;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author change
+ */
+@ApiModel
+@Data
+public class StockChangeBean {
+
+
+
+    @ApiModelProperty(value = "仓库名称")
+    private String stockName;
+
+
+    @ApiModelProperty(value = "物料id ")
+    private String mId;
+
+
+    @ApiModelProperty(value = "数量 ")
+    private Integer stockQty;
+
+}

+ 17 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockForceAdd.java

@@ -0,0 +1,17 @@
+package com.zfire.mall.manager.bean.stock;
+
+import com.zfire.mall.manager.plus.entity.StockForce;
+import com.zfire.mall.manager.plus.entity.StockForceCategory;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class StockForceAdd  extends StockForce {
+
+
+    @ApiModelProperty(value = "仓库id")
+    private List<StockForceCategory> stockForceCategories;
+
+}

+ 22 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockForceUserAdd.java

@@ -0,0 +1,22 @@
+package com.zfire.mall.manager.bean.stock;
+
+import com.zfire.mall.manager.plus.entity.AdminUserForceStock;
+import com.zfire.mall.manager.plus.entity.KingDeeCategory;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@ApiModel
+@Data
+public class StockForceUserAdd {
+
+    @ApiModelProperty(value = "账号id")
+    private String adminUserId;
+
+    @ApiModelProperty(value = "账号选择的强制仓")
+    private List<AdminUserForceStock> adminUserForceStocks;
+
+
+}

+ 21 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockPrice.java

@@ -0,0 +1,21 @@
+package com.zfire.mall.manager.bean.stock;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@ApiModel
+@Data
+public class StockPrice {
+
+    @ApiModelProperty(value = "类别")
+    private String categoryName;
+
+    @ApiModelProperty(value = "库存数量")
+    private BigDecimal qty;
+
+    @ApiModelProperty(value = "成本")
+    private BigDecimal allPrice;
+}

+ 69 - 0
src/main/java/com/zfire/mall/manager/bean/stock/StockStartAccVO.java

@@ -0,0 +1,69 @@
+package com.zfire.mall.manager.bean.stock;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+@Data
+public class StockStartAccVO {
+
+
+    @ApiModelProperty(value = "仓库名称")
+    private String stockName;
+
+    @ApiModelProperty(value = "存货类别")
+    private String categoryName;
+
+    @ApiModelProperty(value = "物料编码")
+    private String materialNumber;
+
+    @ApiModelProperty(value = "物料名称")
+    private String materialName;
+
+    @ApiModelProperty(value = "产品编码")
+    private String materialOldNumber;
+
+    @ApiModelProperty(value = "规格")
+    private String spec;
+
+    @ApiModelProperty(value = "广州可用")
+    private BigDecimal gzOnNumber;
+
+    @ApiModelProperty(value = "佛山可用")
+    private BigDecimal fsOnNumber;
+
+    @ApiModelProperty(value = "总可用数量")
+    private BigDecimal allOnNumber;
+
+    @ApiModelProperty(value = "广州开单未提")
+    private BigDecimal gzNeverNumber;
+
+    @ApiModelProperty(value = "佛山开单未提")
+    private BigDecimal fsNeverNumber;
+
+    @ApiModelProperty(value = "总开单未提数量")
+    private BigDecimal allNeverNumber;
+
+
+    @ApiModelProperty(value = "广州结存")
+    private BigDecimal gzNumber;
+
+    @ApiModelProperty(value = "佛山结存")
+    private BigDecimal fsNumber;
+
+    @ApiModelProperty(value = "总结存数量")
+    private BigDecimal allNumber;
+
+
+    @ApiModelProperty(value = "广州实际库存")
+    private BigDecimal gzTheTimeNumber;
+
+    @ApiModelProperty(value = "佛山实际库存")
+    private BigDecimal fsTheTimeNumber;
+
+
+}

+ 3 - 3
src/main/java/com/zfire/mall/manager/bean/trade/HomeLoginOrderVO.java

@@ -49,11 +49,11 @@ public class HomeLoginOrderVO {
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "登录时间")
-    private Date createTime;
+    private Date submitTime;
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "更新时间")
-    private Date updateTime;
+    private Date orderUpdateTime;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "跟进人")
@@ -151,7 +151,7 @@ public class HomeLoginOrderVO {
     private TradeLoginStatusEnum loginStatus;
 
     @ApiModelProperty(value = "审核备注")
-    private TradeExamineNoteEnum examineNote;
+    private String note;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "是否申请修改 true=是 false=否")

+ 4 - 1
src/main/java/com/zfire/mall/manager/bean/trade/LoginOrderVO.java

@@ -55,7 +55,7 @@ public class LoginOrderVO {
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "更新时间")
-    private Date updateTime;
+    private Date orderUpdateTime;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "跟进人")
@@ -155,6 +155,9 @@ public class LoginOrderVO {
     @ApiModelProperty(value = "审核备注")
     private TradeExamineNoteEnum examineNote;
 
+    @ApiModelProperty(value = "审核备注(填写)")
+    private String note;
+
     @ZfireField(hide = true)
     @ApiModelProperty(value = "是否申请修改 true=是 false=否")
     private BigDecimal isApplyUpdate;

+ 4 - 3
src/main/java/com/zfire/mall/manager/bean/trade/SpanLoginOrderVO.java

@@ -11,6 +11,7 @@ import java.util.Date;
 
 @Data
 @ApiModel
+@ZfireField(tbName = "a")
 public class SpanLoginOrderVO {
 
     @ZfireField(hide = true)
@@ -50,11 +51,11 @@ public class SpanLoginOrderVO {
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "登录时间")
-    private Date createTime;
+    private Date submitTime;
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "更新时间")
-    private Date updateTime;
+    private Date orderUpdateTime;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "跟进人")
@@ -152,7 +153,7 @@ public class SpanLoginOrderVO {
     private TradeLoginStatusEnum loginStatus;
 
     @ApiModelProperty(value = "审核备注")
-    private TradeExamineNoteEnum examineNote;
+    private String note;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "是否申请修改 true=是 false=否")

+ 1 - 0
src/main/java/com/zfire/mall/manager/bean/trade/TradeLoginOrderBean.java

@@ -78,5 +78,6 @@ public class TradeLoginOrderBean extends TradeLoginOrder {
         order.setStatus(this.getStatus());
         order.setRemark(this.getRemark());
         order.setOtherInfo(this.getOtherInfo());
+        order.setOrderUpdateTime(this.getOrderUpdateTime());
     }
 }

+ 253 - 0
src/main/java/com/zfire/mall/manager/bean/trade/TradeOrderImportBean.java

@@ -0,0 +1,253 @@
+package com.zfire.mall.manager.bean.trade;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class TradeOrderImportBean {
+    @ApiModelProperty(value = "单据类型 WORK=工装  HOME=家装")
+    private String orderType;
+
+    @ApiModelProperty(value = "是否跨区 true=是 false=否")
+    private String isSpanStr;
+
+    @ApiModelProperty(value = "是否跨区 true=是 false=否")
+    private Boolean isSpan;
+
+    @ApiModelProperty(value = "销售公司名称")
+    private String salesCompanyName;
+
+    @ApiModelProperty(value = "项目所在区域")
+    private String projectArea;
+
+    @ApiModelProperty(value = "项目编号")
+    private String projectNo;
+
+    @ApiModelProperty(value = "跟进人")
+    private String serviceId;
+
+    @ApiModelProperty(value = "业务员编码")
+    private String serviceNumber;
+
+    @ApiModelProperty(value = "业务员名称")
+    private String serviceName;
+
+    @ApiModelProperty(value = "甲方id")
+    private String partyAId;
+
+    @ApiModelProperty(value = "甲方名称")
+    private String partyA;
+
+    @ApiModelProperty(value = "经销商id")
+    private String customerId;
+
+    @ApiModelProperty(value = "经销商编码")
+    private String customerNumber;
+
+    @ApiModelProperty(value = "经销商名称")
+    private String customerName;
+
+    @ApiModelProperty(value = "经销商联系人")
+    private String customerLinkName;
+
+    @ApiModelProperty(value = "经销商联系电话")
+    private String customerLinkMobile;
+
+    @ApiModelProperty(value = "经销商办公地址")
+    private String customerAddress;
+
+    @ApiModelProperty(value = "跟进经销商")
+    private String followCustomer;
+
+    @ApiModelProperty(value = "跟进经销商电话")
+    private String followCustomerMobile;
+
+    @ApiModelProperty(value = "工程项目名称")
+    private String projectName;
+
+    @ApiModelProperty(value = "单选工程项目名称 AREA=小区 SELF=自建房 VILLA=别墅")
+    private String homeProjectNameRadio;
+
+    @ApiModelProperty(value = "工程项目名称小区")
+    private String homeProjectNameArea;
+
+    @ApiModelProperty(value = "工程项目名称座")
+    private String homeProjectNameSeat;
+
+    @ApiModelProperty(value = "工程项目名称号")
+    private String homeProjectNameNumber;
+
+    @ApiModelProperty(value = "工程联系人")
+    private String enginLinkName;
+
+    @ApiModelProperty(value = "工程联系电话")
+    private String enginLinkMobile;
+
+    @ApiModelProperty(value = "省")
+    private String provinceId;
+
+    @ApiModelProperty(value = "市")
+    private String cityId;
+
+    @ApiModelProperty(value = "区")
+    private String areaId;
+
+    @ApiModelProperty(value = "街道")
+    private String streetId;
+
+    @ApiModelProperty(value = "详细地址")
+    private String address;
+
+    @ApiModelProperty(value = "拼接地址")
+    private String joinAddress;
+
+    @ApiModelProperty(value = "纬度")
+    private String lat;
+
+    @ApiModelProperty(value = "经度")
+    private String lnt;
+
+    @ApiModelProperty(value = "项目类别 STRATEGY=战略协议下属子项目 COMMON=普通单体项目  RAIL=铁路干线项目")
+    private String projectCategory;
+
+    @ApiModelProperty(value = "类型 DRAW=图纸 MESSAGE=竞品资料 SITE_IMG=现场图片 LICENSE=营业执照 OTHER=其他照片")
+    private String type;
+
+    @ApiModelProperty(value = "建筑面积")
+    private String extent;
+
+    @ApiModelProperty(value = "空调使用面积")
+    private String useExtent;
+
+    @ApiModelProperty(value = "项目所在行业分类")
+    private String tradeParentId;
+
+    @ApiModelProperty(value = "项目所在行业分类名称")
+    private String tradeParentName;
+
+    @ApiModelProperty(value = "行业细分")
+    private String tradeId;
+
+    @ApiModelProperty(value = "行业细分名称")
+    private String tradeName;
+
+    @ApiModelProperty(value = "项目性质")
+    private String projectMent;
+
+    @ApiModelProperty(value = "机组类型")
+    private String machineType;
+
+    @ApiModelProperty(value = "成功机率")
+    private String successRate;
+
+    @ApiModelProperty(value = "预计签定合同日期")
+    private Date preSignDate;
+
+    @ApiModelProperty(value = "预计设备金额")
+    private BigDecimal preDeviceAmount;
+
+    @ApiModelProperty(value = "工程跟进状态 ING=跟进中 LOSS=已丢单 SIGN=签订合同")
+    private String status;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "其他相关信息")
+    private String otherInfo;
+
+    @ApiModelProperty(value = "订单状态 SAVE=保存 WAIT=待审核 OK=登录成功 FAIL=登录不成功 RETURN=返回")
+    private String orderStatus;
+
+    @ApiModelProperty(value = "登录状态 OK=登录成功 FAIL=登录不成功 REJECT=驳回")
+    private String loginStatus;
+
+    @ApiModelProperty(value = "登录成功项目")
+    private String successLoginProject;
+
+    @ApiModelProperty(value = "登录成功业务员编号")
+    private String successServiceNumber;
+
+    @ApiModelProperty(value = "登录成功业务员名称")
+    private String successServiceName;
+
+    @ApiModelProperty(value = "登录成功经销商编码")
+    private String successCustomerNumber;
+
+    @ApiModelProperty(value = "登录成功经销商名称")
+    private String successCustomerName;
+
+    @ApiModelProperty(value = "审核备注")
+    private String examineNote;
+
+    @ApiModelProperty(value = "审核备注补充")
+    private String note;
+
+    @ApiModelProperty(value = "共同跟进项目编号")
+    private String commonFollowProject;
+
+    @ApiModelProperty(value = "申请修改人id")
+    private String applyUpdateBy;
+
+    @ApiModelProperty(value = "申请修改人")
+    private String applyUpdateName;
+
+    @ApiModelProperty(value = "申请修改人公司id")
+    private String applyUpdateCompanyId;
+
+    @ApiModelProperty(value = "申请修改人公司")
+    private String applyUpdateCompanyName;
+
+    @ApiModelProperty(value = "是否申请修改 true=是 false=否")
+    private Boolean isApplyUpdate;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建人名称")
+    private String createName;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "更新人名称")
+    private String updateName;
+
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty(value = "更新时间")
+    private Date orderUpdateTime;
+
+    @ApiModelProperty(value = "提交人")
+    private String submitBy;
+
+    @ApiModelProperty(value = "提交人名称")
+    private String submitName;
+
+    @ApiModelProperty(value = "提交时间")
+    private Date submitTime;
+
+    @ApiModelProperty(value = "审核人")
+    private String confirmBy;
+
+    @ApiModelProperty(value = "审核人名称")
+    private String confirmName;
+
+    @ApiModelProperty(value = "审核时间")
+    private Date confirmTime;
+
+    @ApiModelProperty(value = "旧单附件url")
+    private String oldFileUrl;
+
+    @ApiModelProperty(value = "旧单附件名称")
+    private String oldFileName;
+
+    @ApiModelProperty(value = "登录机型")
+    private String loginMachine;
+}

+ 3 - 3
src/main/java/com/zfire/mall/manager/bean/trade/WorkLoginOrderVO.java

@@ -49,11 +49,11 @@ public class WorkLoginOrderVO {
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "登录时间")
-    private Date createTime;
+    private Date submitTime;
 
     @ZfireField(type = "date")
     @ApiModelProperty(value = "更新时间")
-    private Date updateTime;
+    private Date orderUpdateTime;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "跟进人")
@@ -151,7 +151,7 @@ public class WorkLoginOrderVO {
     private TradeLoginStatusEnum loginStatus;
 
     @ApiModelProperty(value = "审核备注")
-    private TradeExamineNoteEnum examineNote;
+    private String note;
 
     @ZfireField(hide = true)
     @ApiModelProperty(value = "是否申请修改 true=是 false=否")

+ 17 - 0
src/main/java/com/zfire/mall/manager/bean/valid/NotBeforeToday.java

@@ -0,0 +1,17 @@
+package com.zfire.mall.manager.bean.valid;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+@Target({ElementType.FIELD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = NotBeforeTodayValidator.class) // 指定验证器
+@Documented
+public @interface NotBeforeToday {
+    String message() default "日期不能早于当天"; // 默认错误信息
+
+    Class<?>[] groups() default {};
+
+    Class<? extends Payload>[] payload() default {};
+}

+ 23 - 0
src/main/java/com/zfire/mall/manager/bean/valid/NotBeforeTodayValidator.java

@@ -0,0 +1,23 @@
+package com.zfire.mall.manager.bean.valid;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.Date;
+
+public class NotBeforeTodayValidator implements ConstraintValidator<NotBeforeToday, Date> {
+
+    @Override
+    public boolean isValid(Date value, ConstraintValidatorContext context) {
+        if (value == null) {
+            return true; // 允许为空
+        }
+        // 转换为系统默认时区的当天日期
+        LocalDate inputDate = value.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+        LocalDate today = LocalDate.now();
+        return !inputDate.isBefore(today);
+    }
+}

+ 4 - 2
src/main/java/com/zfire/mall/manager/commonmapper/AdminMapper.java

@@ -34,7 +34,7 @@ public interface AdminMapper {
                                        @Param("isMaster") Boolean isMaster,
                                        @Param("customerId") String customerId,
                                        @Param("isCustomer") Boolean isCustomer,
-                                       @Param("roleName") String roleName,
+                                       @Param("roleName")  List<String>  roleName,
                                        @Param("websitNumber") String websitNumber,
                                        @Param("customerNumbers") List<String>  customerNumbers,
                                        @Param("isJiaXian") Integer isJiaXian,
@@ -53,7 +53,9 @@ public interface AdminMapper {
     /**
      * 查询所有子级的业务员
      */
-    public List<String> queryChildServiceId(@Param("adminWebsitIds") List<String> adminWebsitIds,@Param("roleName") String roleName);
+    public List<String> queryChildServiceId(@Param("adminWebsitIds") List<String> adminWebsitIds,
+                                            @Param("roleName") String roleName,
+                                            @Param("notWebsitId") String notWebsitId);
 
     AdminUser selectByUserName(String userName);
 

+ 3 - 0
src/main/java/com/zfire/mall/manager/commonmapper/CommonMapper.java

@@ -2,6 +2,7 @@ package com.zfire.mall.manager.commonmapper;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zfire.mall.manager.bean.stock.AdminUserForceStockExcel;
 import com.zfire.mall.manager.plus.entity.CustomerBillLimitConfig;
 import com.zfire.mall.manager.plus.entity.PartyAInfo;
 import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
@@ -19,4 +20,6 @@ public interface CommonMapper {
     IPage<CustomerBillLimitConfig> merchantLoginQuotaLimitList(Page page, @Param("ex")ZfireParamBean param);
 
     IPage<PartyAInfo> firstPartyCustomerManagementList(Page page, @Param("ex")ZfireParamBean param);
+
+    IPage<AdminUserForceStockExcel> listExcel(Page page);
 }

+ 30 - 1
src/main/java/com/zfire/mall/manager/commonmapper/SaleOrderMapper.java

@@ -72,6 +72,7 @@ public interface SaleOrderMapper {
 
 
     IPage<StorageFeeBean> listStorageFee(IPage page,
+                                         @Param("categoryNum")List<String> categoryNum,
                                          @Param("approvalStartTime")String approvalStartTime,
                                          @Param("approvalEndTime")String approvalEndTime,
                                          @Param("saleExamineStatus")String saleExamineStatus,
@@ -92,7 +93,8 @@ public interface SaleOrderMapper {
                                          @Param("endTime") String endTime,
                                          @Param("serviceIds") List<String> serviceIds,
                                          @Param("adminUserId") String adminUserId,
-                                         @Param("k3CategoryIds") List<String> k3CategoryIds);
+                                         @Param("k3CategoryIds") List<String> k3CategoryIds
+                                         );
 
     @SqlParser(filter = true)
     void updateInvoice(String id);
@@ -160,4 +162,31 @@ public interface SaleOrderMapper {
                               @Param("serviceIds")  List<String> serviceIds,
                               @Param("adminUserId") List<String> adminUserId,
                               @Param("k3CategoryIds") List<String> k3CategoryIds);
+
+    @SqlParser(filter = true)
+    Integer listStorageFeeCount(
+                                @Param("categoryNum")List<String> categoryNum,
+                                @Param("approvalStartTime")String approvalStartTime,
+                                @Param("approvalEndTime")String approvalEndTime,
+                                @Param("saleExamineStatus")String saleExamineStatus,
+                                @Param("saleStartTime")String saleStartTime,
+                                @Param("saleEndTime")String saleEndTime,
+                                @Param("invoiceStartTime")String invoiceStartTime,
+                                @Param("invoiceEndTime")String invoiceEndTime,
+                                @Param("mainOrderId")String mainOrderId,
+                                @Param("id") List<String> id,
+                                @Param("materialNumber")String materialNumber,
+                                @Param("orderNo") List<String> orderNo,
+                                @Param("customerName")String customerName,
+                                @Param("correspondId")List<String> correspondId,
+                                @Param("specification")String specification,
+                                @Param("materialName") String materialName,
+                                @Param("customerNumber") String customerNumber,
+                                @Param("startTime") String startTime,
+                                @Param("endTime") String endTime,
+                                @Param("serviceIds") List<String> serviceIds,
+                                @Param("adminUserId") String adminUserId,
+                                @Param("k3CategoryIds") List<String> k3CategoryIds
+                                );
+
 }

+ 9 - 0
src/main/java/com/zfire/mall/manager/commonmapper/engin/info/EnginInfoOrderReserveMapper.java

@@ -45,7 +45,16 @@ public interface EnginInfoOrderReserveMapper {
             @Param("serviceIds") List<String> serviceIds
     );
 
+
+
+
+
     IPage<EnginInfoOrderVO> v2ListPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 
     IPage<EnginInfoSaleExecVO> v2ExecListPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    @SqlParser(filter = true)
+    Integer v2ExecListTotal(@Param("ex") ZfireParamBean zfireParamBean);
+
+
 }

+ 2 - 0
src/main/java/com/zfire/mall/manager/commonmapper/engin/order/EnginOrderReserveMapper.java

@@ -46,6 +46,8 @@ public interface EnginOrderReserveMapper {
 
 
     IPage<EnginOrderListBean> platformQueryList(Page<Object> objectPage,
+                                                @Param("adminUserId") String adminUserId,
+                                                @Param("customerId") String customerId,
                                                 @Param("recordNo") String recordNo,
                                                 @Param("orderNo") String orderNo,
                                                 @Param("useUnit") String useUnit,

+ 21 - 0
src/main/java/com/zfire/mall/manager/commonmapper/listV2/CommonCMapper.java

@@ -7,6 +7,7 @@ import com.zfire.mall.manager.bean.listV2.*;
 import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Set;
 
@@ -163,4 +164,24 @@ public interface CommonCMapper {
     List<CustomerPushBean> listPush(String encrypted);
 
     IPage<K3CustomerJiaXianVO> jiaXianV2(Page page,@Param("ex") ZfireParamBean zfireParam);
+
+    IPage<K3CustomerVO> queryListV3K3CutomerList(Page page,@Param("ex") ZfireParamBean zfireParam);
+
+    /**
+     * 参考成本价格列表
+     * @param page
+     * @param zfireParamBean
+     * @return
+     */
+    IPage<MaterialReferPriceVO> queryMaterialReferPriceList(Page page,@Param("ex") ZfireParamBean zfireParamBean);
+
+
+    /**
+     * 查询历史余额(快照)
+     * @param page
+     * @param zfireParamBean
+     * @return
+     */
+    IPage<CustomerWalletAmountVO> queryCustomerWalletAmountList(Page page, @Param("ex") ZfireParamBean zfireParamBean, @Param("time")Date time);
+
 }

+ 15 - 0
src/main/java/com/zfire/mall/manager/commonmapper/stock/ReservedMapper.java

@@ -86,4 +86,19 @@ public interface ReservedMapper {
 
     @SqlParser(filter = true)
     Integer listCountV2(@Param("ex") ZfireParamBean zfireParamBean, @Param("customerId")String customerId);
+
+    @SqlParser(filter = true)
+    Integer listOrderCount(
+                           @Param("materialOldNumber")String materialOldNumber,
+                           @Param("customerName")String customerName,
+                           @Param("orderId")String orderId,
+                           @Param("specification")String specification,
+                           @Param("mainName")String mainName,
+                           @Param("orderType")String orderType,
+                           @Param("customerNumber")String customerNumber,
+                           @Param("materialCode")String materialCode,
+                           @Param("materialName")String materialName,
+                           @Param("customerId") String customerId,
+                           @Param("serviceIds") List<String> serviceIds,
+                           @Param("k3CategoryIds") List<String> k3CategoryIds);
 }

+ 11 - 2
src/main/java/com/zfire/mall/manager/commonmapper/stock/StockCommonMapper.java

@@ -81,6 +81,10 @@ public interface StockCommonMapper {
     Integer resverdAllStockNumber(@Param("correspondId")String correspondId,
                                   @Param("materialId")String materialId);
 
+
+    Integer resverdAllStockNumberRE(@Param("correspondId")String correspondId,
+                                  @Param("materialId")String materialId);
+
     Integer sumKingDeeNumber(@Param("correspondId")String correspondId,
                              @Param("materialId")String materialId);
 
@@ -101,7 +105,9 @@ public interface StockCommonMapper {
                                          @Param("materialName")String materialName,
                                          @Param("materialNumber")String materialNumber,
                                          @Param("specification")String specification,
-                                         @Param("adminUserId")String adminUserId);
+                                         @Param("adminUserId")String adminUserId,
+                                         @Param("categoryList")List<String> categoryList
+    );
 
     List<StockBean> sumKingDeeNumberList(@Param("correspondId")List<String> correspondId);
 
@@ -163,7 +169,7 @@ public interface StockCommonMapper {
      * 经销商现存表
      */
     @SqlParser(filter = true)
-    IPage<StockBeanCustomerToDay> listStockToDayCustomerV2(Page page,@Param("ex")  ZfireParamBean zfireParamBean,@Param("adminUserId")  String adminUserId);
+    IPage<StockBeanCustomerToDay> listStockToDayCustomerV2(Page page,@Param("ex")  ZfireParamBean zfireParamBean,@Param("adminUserId")  String adminUserId,@Param("categoryList")List<String> categoryList);
 
     /**
      * 采购退料单
@@ -201,4 +207,7 @@ public interface StockCommonMapper {
 
     @SqlParser(filter = true)
     StockBean listOne(@Param("correspondId") List<String> strings, @Param("materialId") String materialId);
+
+    @SqlParser(filter = true)
+    IPage<StockBeanToCostPrice> listStockToCostPriceV2(Page page,@Param("ex")  ZfireParamBean zfireParamBean,@Param("adminUserId")  String adminUserId);
 }

+ 8 - 0
src/main/java/com/zfire/mall/manager/commonmapper/trade/LoginOrderMapper.java

@@ -26,4 +26,12 @@ public interface LoginOrderMapper {
 
 
     IPage<LoginOrderVO> list(Page page, @Param("ex") ZfireParamBean zfireParamBean, String adminUserId);
+
+    IPage<LoginOrderVO> recycleListPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    void recycleDel(List<String> ids);
+
+    void batchInsertLogin(List<String> ids);
+
+    void recycleRestore(List<String> ids);
 }

+ 4 - 1
src/main/java/com/zfire/mall/manager/commonmapper/wallet/WalletCommonMapper.java

@@ -49,7 +49,10 @@ public interface WalletCommonMapper {
      * 财务汇总
      */
     @SqlParser(filter = true)
-    public List<Map<String,Object>> queryTotalAmount(@Param("adminWebsitIds") List<String> adminWebsitIds);
+    public List<Map<String,Object>> queryTotalAmount(
+            @Param("adminWebsitIds") List<String> adminWebsitIds,
+            @Param("type") String type
+    );
 
     /**
      * 经销商的余额汇总

+ 2 - 2
src/main/java/com/zfire/mall/manager/component/StartRunner.java

@@ -23,10 +23,10 @@ public class StartRunner implements ApplicationRunner {
     @Override
     public void run(ApplicationArguments args) throws Exception {
 
-        if(StringUtils.equals(active,"prd")) {
+  /*      if(StringUtils.equals(active,"prd")) {
             KingDeeCons.SALERID = KingDeeCons.SALERID_PRD;
         }
-
+*/
         String url_format = "http://%s:%s%s/doc.html#";
         String ip = null;
         try {

+ 7 - 0
src/main/java/com/zfire/mall/manager/config/GlobalDefaultExceptionHandler.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.ConstraintViolationException;
+import javax.validation.ValidationException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,6 +40,12 @@ public class GlobalDefaultExceptionHandler {
             return ResponseHelper.error(ResponseHelper.ResponseCode_COMMON, ReUtil.delFirst("^\\w+\\.\\w+: ", ex.getMessage()));
         }
 
+        if(ex instanceof ValidationException){
+            // 手动校验错误异常
+            return ResponseHelper.error(ResponseHelper.ResponseCode_VALIDATION_ERROR, ReUtil.delFirst("^\\w+\\[\\d+\\]\\.\\w+", ex.getMessage()));
+        }
+
+
         if (ex instanceof MethodArgumentNotValidException) {
             MethodArgumentNotValidException methodArgumentNotValidException = (MethodArgumentNotValidException) ex;
             BindingResult bindingResult = methodArgumentNotValidException.getBindingResult();

+ 1 - 0
src/main/java/com/zfire/mall/manager/config/MpMetaObjectHandler.java

@@ -31,6 +31,7 @@ public class MpMetaObjectHandler implements MetaObjectHandler {
      */
     @Override
     public void updateFill(MetaObject metaObject) {
+
         this.setFieldValByName("updateBy", CommonUtils.getNickName(), metaObject);
         this.setFieldValByName("updateTime", new Date(), metaObject);
     }

+ 2 - 1
src/main/java/com/zfire/mall/manager/config/aop/ZfireFiledAop.java

@@ -191,7 +191,8 @@ public class ZfireFiledAop {
 
                 fieldBean.setFrontCode(frontCode);
                 fieldBean.setType(type);
-                fieldBean.setSortNum(0);
+                //fieldBean.setSortNum(0);
+                fieldBean.setSortNum(zfireField.sortNum());
                 fieldBean.setIsShow(show);
                 fieldBean.setHide(hide);
                 fieldBean.setIsTotal(total);

+ 10 - 1
src/main/java/com/zfire/mall/manager/constant/Constant.java

@@ -1,6 +1,8 @@
 package com.zfire.mall.manager.constant;
 
 import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
 
 public class Constant {
 
@@ -9,7 +11,8 @@ public class Constant {
     //不可删除的角色
     public static final String NOT_DEL_ROLE_NAME = "经销商";
     public static final String NOT_DEL_ROLE_YWY = "业务员";
-    public static final String NOT_DEL_ROLE_SPY = "商用登录审核员";
+    public static final String NOT_DEL_SHANGYONG_ROLE_YWY = "商用业务员";
+    public static final List<String> NOT_DEL_ROLE_SPY = Arrays.asList("商用登录审核员", "商用文员");
     //业务员
     public static final String NOT_DEL_ROLE_NAME2 = "财务";
     //商用
@@ -78,6 +81,10 @@ public class Constant {
     public static final BigDecimal STORAGE_FEE_TWO = new BigDecimal("0.0004");
 
 
+    public static final BigDecimal STORAGE_FEE_SHENGHUO_ONE = new BigDecimal("0.003");
+    public static final BigDecimal STORAGE_FEE_SHENGHUO_TWO = new BigDecimal("0.004");
+
+
     public static final String GUANG_ZHOU_WEBSIT_ID = "1552238700943994882";
     public static final String FO_SHAN_WEBSIT_ID = "1552227230273335298";
 
@@ -98,6 +105,8 @@ public class Constant {
 
     //商户经销商权限
     public static final String SUPPLY_ROLE_CHILD_GONGCHENG = "1685182772777353218";
+    public static final String SHANGYONGJINGXIAOSHANG = "1001";
+    public static final String SHANGYONGYEWUYUAN = "1698637034885181441";
 
     public class Ali {
         public final static String ACCESS_KEY_ID = "LTAI5tN5RSgMtdGDrNDAqMLT";

+ 3 - 3
src/main/java/com/zfire/mall/manager/constant/KingDeeCons.java

@@ -9,9 +9,9 @@ public class KingDeeCons {
     public final static String NUMBER = "FNUMBER";
     public final static String FPLAN_DATE = "FPlanDate";
     // TODO 固定金蝶销售员 服务器启动的时候会赋值
-    public  static String SALERID = "test001_GW000001_1";
-    public final static String SALERID_TEST = "test001_GW000001_1";
-    public final static String SALERID_PRD = "yewu01_GW000001_1";
+    //public  static String SALERID = "test001_GW000001_1";
+    //public final static String SALERID_TEST = "test001_GW000001_1";
+    //public final static String SALERID_PRD = "yewu01_GW000001_1";
 
     /**
      * 组织机构

+ 75 - 2
src/main/java/com/zfire/mall/manager/controller/admin/AdminUserController.java

@@ -27,6 +27,8 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
 import java.util.List;
 
 @Slf4j
@@ -53,7 +55,7 @@ public class AdminUserController {
             @ApiParam(value = "短信验证码",required = false) @RequestParam(required = false) String smsCode,
             @ApiParam(value = "登录类型 mobile=手机号登录,account=账号登录 默认account",required = false) @RequestParam(required = false) String loginType,
             HttpServletRequest request
-    ) throws RemoteServiceException {
+    ) throws RemoteServiceException, ParseException {
         AdminUserBean adminUserBean = adminUserLogic.login(userName, password,code,codeValue,smsCode,loginType,request);
         return ResponseHelper.success(adminUserBean);
     }
@@ -188,6 +190,25 @@ public class AdminUserController {
     }
 
 
+    @GetMapping("/listService")
+    @ApiOperation(value = "业务员帐号列表")
+    public ResponseHelper<IPage<AdminUserDto>> listService(
+            @ApiParam(value = "部门id",required = false) @RequestParam(required = false) String adminWebsitId,
+            @ApiParam(value = "角色id",required = false) @RequestParam(required = false) String roleId,
+            @ApiParam(value = "经销商id",required = false) @RequestParam(required = false) String customerId,
+            @ApiParam(value = "1=经销商 0=业务员",required = false) @RequestParam(required = false) Boolean isCustomer,
+            @ApiParam(value = "true=主账号 false=子账号",required = false) @RequestParam(required = false) Boolean isMaster,
+            @ApiParam(value = "状态 true:正常 false:冻结",required = false) @RequestParam(required = false) Boolean status,
+            @ApiParam(value = "用户名",required = false) @RequestParam(required = false) String userName,
+            @ApiParam(value = "页号",required = true) @RequestParam(required = true) Integer pageNum,
+            @ApiParam(value = "页大小",required = true) @RequestParam(required = true) Integer pageSize,
+            HttpServletRequest request
+    ) throws RemoteServiceException {
+        IPage<AdminUserDto> page = adminUserLogic.listService(adminWebsitId,roleId,customerId,isCustomer,isMaster,status,userName,pageNum, pageSize,request);
+        return ResponseHelper.success(page);
+    }
+
+
 
     @GetMapping("/mch/list")
     @ApiOperation(value = "商户列表")
@@ -363,6 +384,16 @@ public class AdminUserController {
     }
 
 
+    @PostMapping("/user/child/addsync")
+    @ApiOperation(value = "更新子账号权限")
+    public ResponseHelper addChild(
+
+    ) throws RemoteServiceException {
+        adminUserLogic.addChildUserSync();
+        return ResponseHelper.success();
+    }
+
+
     @PostMapping("/user/child/update")
     @ApiOperation(value = "编辑经销商子账号")
     public ResponseHelper updateChild(
@@ -469,6 +500,27 @@ public class AdminUserController {
     }
 
 
+    @GetMapping("/listGongCheng/export")
+    @ApiOperation(value = "工程子帐号列表导出")
+    public void exportListGongCheng(
+            @ApiParam(value = "部门id",required = false) @RequestParam(required = false) String adminWebsitId,
+            @ApiParam(value = "角色id",required = false) @RequestParam(required = false) String roleId,
+            @ApiParam(value = "经销商id",required = false) @RequestParam(required = false) String customerId,
+            @ApiParam(value = "1=经销商 0=业务员",required = false) @RequestParam(required = false) Boolean isCustomer,
+            @ApiParam(value = "true=主账号 false=子账号",required = false) @RequestParam(required = false) Boolean isMaster,
+            @ApiParam(value = "状态 true:正常 false:冻结",required = false) @RequestParam(required = false) Boolean status,
+            @ApiParam(value = "用户名",required = false) @RequestParam(required = false) String userName,
+            @ApiParam(value = "页号",required = true) @RequestParam(required = true) Integer pageNum,
+            @ApiParam(value = "页大小",required = true) @RequestParam(required = true) Integer pageSize,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        IPage<AdminUserDto> page = adminUserLogic.listGongCheng(adminWebsitId,roleId,customerId,isCustomer,isMaster,status,userName,pageNum, pageSize,request);
+        ExcelData excelData = adminUserLogic.listExport(page.getRecords());
+        ExcelUtils.exportExcel(request,response,"listGongCheng.xlsx",excelData);
+    }
+
+
     @GetMapping("/detailGongCheng")
     @ApiOperation(value = "工程子帐号详情")
     public ResponseHelper<AdminUserDto> detailGongCheng(
@@ -510,7 +562,7 @@ public class AdminUserController {
     }
 
 
-    @PostMapping("/user/child/delGongCheng")
+    @PostMapping("/child/delGongCheng")
     @ApiOperation(value = "删除工程经销商子账号")
     public ResponseHelper delGongCheng(
 
@@ -521,4 +573,25 @@ public class AdminUserController {
         return ResponseHelper.success();
     }
 
+
+    @PostMapping("/import")
+    @ApiOperation("导入工程子经销商账号")
+    public ResponseHelper importData(
+            @ApiParam(required = true, value = "附件") @RequestPart("file") MultipartFile file,
+            HttpServletRequest request
+    ) throws RemoteServiceException, IOException, ParseException {
+        InputStream inputStream = file.getInputStream();
+        adminUserLogic.importData(inputStream,request);
+        return ResponseHelper.success();
+    }
+
+    @GetMapping("/downloadGongcheng")
+    @ApiOperation("导入工程子经销商账号模板下载")
+    public void downloadGongcheng(
+            HttpServletResponse response
+    ) throws IOException {
+        CommonUtils.downloadFile("daoruzhanghao.xlsx",response);
+    }
+
+
 }

+ 3 - 4
src/main/java/com/zfire/mall/manager/controller/admin/NoticeController.java

@@ -4,13 +4,11 @@ import cn.hutool.core.lang.TypeReference;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zfire.mall.manager.annotation.ZfireList;
 import com.zfire.mall.manager.bean.admin.NoticeRecordReadBean;
-import com.zfire.mall.manager.bean.listV2.ComListVO;
 import com.zfire.mall.manager.bean.listV2.NoticeRecordReadVO;
 import com.zfire.mall.manager.bean.notice.NoticeBean;
 import com.zfire.mall.manager.bean.notice.NoticeRecordBean;
 import com.zfire.mall.manager.helper.ResponseHelper;
 import com.zfire.mall.manager.logic.admin.NoticeLogic;
-import com.zfire.mall.manager.plus.entity.Notice;
 import com.zfire.mall.manager.plus.entity.NoticeRecord;
 import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
 import io.swagger.annotations.Api;
@@ -63,9 +61,10 @@ public class NoticeController {
 
     @GetMapping("/detail")
     public ResponseHelper<NoticeRecordBean> detail(
-            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
+            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id,
+            @ApiParam(value = "是否在登录消息框已读 true=是 false=否") @RequestParam(required = false) Boolean isTopRead
     ){
-        NoticeRecordBean detail = noticeLogic.detail(id);
+        NoticeRecordBean detail = noticeLogic.detail(id, isTopRead);
         return ResponseHelper.success(detail);
     }
 

+ 1 - 1
src/main/java/com/zfire/mall/manager/controller/customer/CustomerController.java

@@ -93,7 +93,7 @@ public class CustomerController {
     @ApiOperation(value = "经销商列表")
     @GetMapping("/list")
     public ResponseHelper<IPage<KingDeeCustomer>> list(
-            @ApiParam(required = false, value = "经销商名称/经销商编号") @RequestParam(required = false) String keyword,
+            @ApiParam(required = false, value = "经销商名称/经销商编号/id") @RequestParam(required = false) String keyword,
             @ApiParam(required = false, value = "地区") @RequestParam(required = false) String region,
             @ApiParam(required = false, value = "KING 金蝶经销商  JIAXIAN嘉贤二级经销商 GONGCHENG 商用经销商") @RequestParam(required = false) String jiaxianType,
             @ApiParam(required = false, value = "未被绑定的经销商列表 true=已绑定 false=未绑定") @RequestParam(required = false) Boolean bindUser,

+ 12 - 0
src/main/java/com/zfire/mall/manager/controller/customer/StageCustomerController.java

@@ -53,6 +53,18 @@ public class StageCustomerController {
 
 
     @ZfireList
+    @PostMapping("/list/v3")
+    @ApiOperation(value = "全部经销商列表V3")
+    public ResponseHelper<K3CustomerVO> listV3(
+            @RequestBody ZfireParamBean zfireParamBean
+    ){
+        IPage<K3CustomerVO> k3CustomerVOIPage = stagek3CustomerLogic.listV3(zfireParamBean);
+        return ResponseHelper.success(k3CustomerVOIPage, new TypeReference<K3CustomerVO>() {});
+    }
+
+
+
+    @ZfireList
     @PostMapping("/list/v2")
     @ApiOperation(value = "子经销商列表V2")
     public ResponseHelper<StageK3CustomerVO> listV2(

+ 37 - 2
src/main/java/com/zfire/mall/manager/controller/engin/info/EnginInfoOrderController.java

@@ -1,19 +1,26 @@
 package com.zfire.mall.manager.controller.engin.info;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zfire.mall.manager.bean.ExcelData;
 import com.zfire.mall.manager.bean.engin.info.EnginInfoOrderBean;
+import com.zfire.mall.manager.bean.engin.info.EnginInfoOrderItemBean;
 import com.zfire.mall.manager.bean.engin.info.EnginInfoOrderListBean;
 import com.zfire.mall.manager.bean.engin.info.EnginInfoSaleExecBean;
 import com.zfire.mall.manager.bean.valid.EditGroup;
 import com.zfire.mall.manager.bean.valid.SubmitGroup;
 import com.zfire.mall.manager.constant.Constant;
+import com.zfire.mall.manager.enums.ExamineStatusEnum;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.helper.ResponseHelper;
 import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.engin.info.EnginInfoOrderLogic;
+import com.zfire.mall.manager.plus.entity.EnginInfoOrder;
 import com.zfire.mall.manager.plus.entity.EnginInfoOrderItem;
+import com.zfire.mall.manager.plus.service.EnginInfoOrderService;
 import com.zfire.mall.manager.utils.CommonUtils;
+import com.zfire.mall.manager.utils.ValidateUtil;
 import com.zfire.mall.manager.utils.excel.ExcelUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -27,9 +34,12 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.validation.ValidationException;
 import javax.validation.groups.Default;
 import java.io.IOException;
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 
@@ -45,6 +55,8 @@ public class EnginInfoOrderController {
     RedisLockRegistry redisLockRegistry;
     @Resource
     CommonLogic commonLogic;
+    @Resource
+    EnginInfoOrderService enginInfoOrderService;
 
     @ApiOperation(value = "工程信息单列表")
     @GetMapping("/list")
@@ -99,9 +111,32 @@ public class EnginInfoOrderController {
     @PostMapping("/edit")
     public ResponseHelper edit(
             @ApiParam(required = true, value = "工程信息单")
-            @RequestBody
-            @Validated(value = { EditGroup.class, Default.class }) EnginInfoOrderBean enginInfoOrderBean
+            @RequestBody EnginInfoOrderBean enginInfoOrderBean
     ) throws Exception {
+        final EnginInfoOrder infoOrder = enginInfoOrderService.getById(enginInfoOrderBean.getEnginInfoId());
+
+        Date tillDate = null;
+        if (infoOrder.getExamineStatus().equals(ExamineStatusEnum.OK.getKey())) {
+            final DateTime dataTime = DateUtil.parseDate(DateUtil.formatDate(infoOrder.getContractExpireDate()));
+            if (dataTime.compareTo(enginInfoOrderBean.getContractExpireDate()) == 0) {
+                tillDate = enginInfoOrderBean.getContractExpireDate();
+                enginInfoOrderBean.setContractExpireDate(DateUtil.date());
+            }
+        }
+
+        // 校验
+        ValidateUtil.validate(enginInfoOrderBean, EditGroup.class, Default.class);
+        for (EnginInfoOrderItemBean itemBean : enginInfoOrderBean.getItems()) {
+            try {
+                ValidateUtil.validate(itemBean, EditGroup.class, Default.class);
+            } catch (ValidationException e) {
+                throw new RemoteServiceException("“" +itemBean.getMaterialName() + "”出错原因:" + e.getMessage());
+            }
+        }
+        if (Objects.nonNull(tillDate)) {
+            enginInfoOrderBean.setContractExpireDate(tillDate);
+        }
+
         return getResponseHelper(enginInfoOrderBean, "edit");
     }
 

+ 8 - 7
src/main/java/com/zfire/mall/manager/controller/engin/order/EnginOrderController.java

@@ -16,6 +16,7 @@ import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.helper.ResponseHelper;
 import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.engin.order.EnginOrderLogic;
+import com.zfire.mall.manager.logic.engin.order.EnginSysLogic;
 import com.zfire.mall.manager.plus.entity.EnginOrder;
 import com.zfire.mall.manager.utils.excel.ExcelUtils;
 import io.swagger.annotations.Api;
@@ -49,8 +50,8 @@ public class EnginOrderController {
     EnginOrderLogic enginOrderLogic;
     @Resource
     RedisLockRegistry redisLockRegistry;
-//    @Resource
-//    EnginSysLogic enginSysLogic;
+    @Resource
+    EnginSysLogic enginSysLogic;
     @Resource
     CommonLogic commonLogic;
 
@@ -502,11 +503,11 @@ public class EnginOrderController {
                     } else {
                         if (orderType.equals(OrderTypeEnum.HOME.getKey())) {
                             EnginOrder enginOrder = enginOrderLogic.execHandlerHome(enginOrderBean, operType);
-//                            if (Objects.nonNull(enginOrder)
-//                                    && enginOrderBean.isExamineResult()
-//                                    && operType.equals(SysDictConstant.EXAMINE)) {
-//                                enginSysLogic.updEngineSystemBill(enginOrder, null);
-//                            }
+                            if (Objects.nonNull(enginOrder)
+                                    && enginOrderBean.isExamineResult()
+                                    && operType.equals(SysDictConstant.EXAMINE)) {
+                                enginSysLogic.updEngineSystemBill(enginOrder, null);
+                            }
                         } else {
                             //商用订单提交审核
                             enginOrderLogic.execHandlerTrade(enginOrderBean, operType);

+ 90 - 89
src/main/java/com/zfire/mall/manager/controller/engin/order/EnginSysController.java

@@ -1,89 +1,90 @@
-//package com.zfire.mall.manager.controller.engin.order;
-//
-//import com.baomidou.mybatisplus.core.metadata.IPage;
-//import com.zfire.mall.manager.annotation.ApiNotAuth;
-//import com.zfire.mall.manager.bean.engin.order.EnginOrderListBean;
-//import com.zfire.mall.manager.datasource.engin.entity.AgencyBills;
-//import com.zfire.mall.manager.datasource.engin.entity.AgencyBillsBean;
-//import com.zfire.mall.manager.helper.ResponseHelper;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiOperation;
-//import io.swagger.annotations.ApiParam;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.web.bind.annotation.*;
-//
-//import javax.annotation.Resource;
-//import javax.validation.constraints.NotBlank;
-//
-//@Slf4j
-//@RestController
-//@Api(value = "工程系统接口API", tags ={"工程系统接口API"} )
-//@RequestMapping(value = "/engin-sys/api", produces = "application/json; charset=utf-8")
-//public class EnginSysController {
-//
-//    @Resource
-//    EnginSysLogic enginSysLogic;
-//
-//    @ApiOperation(value = "工程订单列表")
-//    @GetMapping("/list")
-//    public ResponseHelper<IPage<AgencyBills>> list(
-//            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
-//            @ApiParam(value = "工程项目") @RequestParam(required = false) String projectName,
-//            @ApiParam(value = "使用单位") @RequestParam(required = false) String useUnit,
-//            @ApiParam(value = "页号",required = true)@RequestParam Integer pageNum,
-//            @ApiParam(value = "页大小",required = true)@RequestParam Integer pageSize
-//    ) throws Exception {
-//        IPage<AgencyBills> listPage = enginSysLogic.listPage(recordNo, projectName, useUnit, pageNum, pageSize);
-//        return ResponseHelper.success(listPage);
-//    }
-//
-//    @ApiOperation(value = "工程订单详情")
-//    @GetMapping("/detail")
-//    public ResponseHelper<AgencyBillsBean> detail(
-//            @ApiParam(value = "销售类型") @NotBlank(message = "销售类型不能为空") @RequestParam String saleTypeId,
-//            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
-//            @ApiParam(value = "工程登录用户编号") @RequestParam(required = false) String userId,
-//            @ApiParam(value = "家用工程订单号") @RequestParam(required = false) String enginOrderId,
-//            @ApiParam(value = "经销商id") @RequestParam(required = false) String customerId
-//    ) throws Exception {
-//        AgencyBillsBean bills = enginSysLogic.findBills(saleTypeId, recordNo, userId, enginOrderId, customerId);
-//        return ResponseHelper.success(bills);
-//    }
-//
-//    @ApiNotAuth
-//    @ApiOperation(value = "平台查询工程登录单列表")
-//    @PostMapping("/platform/query/list")
-//    public ResponseHelper<IPage<EnginOrderListBean>> platformQueryList(
-//            @ApiParam(value = "帐号",required = true) @RequestParam String userName,
-//            @ApiParam(value = "密码",required = true) @RequestParam String password,
-//            @ApiParam(value = "时间戳",required = true) @RequestParam String timestamp,
-//            @ApiParam(value = "签名",required = true) @RequestParam String sign,
-//            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
-//            @ApiParam(value = "订单编号") @RequestParam(required = false) String orderNo,
-//            @ApiParam(value = "使用单位") @RequestParam(required = false) String useUnit,
-//            @ApiParam(value = "规格机型") @RequestParam(required = false) String specs,
-//            @ApiParam(value = "实装机型") @RequestParam(required = false) String realModel,
-//            @ApiParam(value = "客户地址") @RequestParam(required = false) String address,
-//            @ApiParam(value = "单据类型") @RequestParam(required = false) String orderType,
-//            @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
-//            @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
-//    ) throws Exception {
-//        IPage<EnginOrderListBean> listPage = enginSysLogic.platformQueryList(userName, password, timestamp, sign, recordNo,
-//                orderNo, useUnit, specs, realModel, address, orderType, pageNum, pageSize);
-//        return ResponseHelper.success(listPage);
-//    }
-//
-//    @ApiNotAuth
-//    @ApiOperation(value = "平台引用工程登录单")
-//    @PostMapping("/platform/ref")
-//    public ResponseHelper platformRef(
-//            @ApiParam(value = "工程登录编号",required = true) @RequestParam String recordNo,
-//            @ApiParam(value = "id",required = true) @RequestParam String itemId,
-//            @ApiParam(value = "引用状态 true=是 false=否",required = true) @RequestParam Boolean isRef,
-//            @ApiParam(value = "时间戳",required = true) @RequestParam String timestamp,
-//            @ApiParam(value = "签名",required = true) @RequestParam String sign
-//    ) throws Exception {
-//        enginSysLogic.platformRef(recordNo, itemId, isRef, timestamp, sign);
-//        return ResponseHelper.success();
-//    }
-//}
+package com.zfire.mall.manager.controller.engin.order;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zfire.mall.manager.annotation.ApiNotAuth;
+import com.zfire.mall.manager.bean.engin.order.EnginOrderListBean;
+import com.zfire.mall.manager.datasource.engin.entity.AgencyBills;
+import com.zfire.mall.manager.datasource.engin.entity.AgencyBillsBean;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.engin.order.EnginSysLogic;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.NotBlank;
+
+@Slf4j
+@RestController
+@Api(value = "工程系统接口API", tags ={"工程系统接口API"} )
+@RequestMapping(value = "/engin-sys/api", produces = "application/json; charset=utf-8")
+public class EnginSysController {
+
+    @Resource
+    EnginSysLogic enginSysLogic;
+
+    @ApiOperation(value = "工程订单列表")
+    @GetMapping("/list")
+    public ResponseHelper<IPage<AgencyBills>> list(
+            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
+            @ApiParam(value = "工程项目") @RequestParam(required = false) String projectName,
+            @ApiParam(value = "使用单位") @RequestParam(required = false) String useUnit,
+            @ApiParam(value = "页号",required = true)@RequestParam Integer pageNum,
+            @ApiParam(value = "页大小",required = true)@RequestParam Integer pageSize
+    ) throws Exception {
+        IPage<AgencyBills> listPage = enginSysLogic.listPage(recordNo, projectName, useUnit, pageNum, pageSize);
+        return ResponseHelper.success(listPage);
+    }
+
+    @ApiOperation(value = "工程订单详情")
+    @GetMapping("/detail")
+    public ResponseHelper<AgencyBillsBean> detail(
+            @ApiParam(value = "销售类型") @NotBlank(message = "销售类型不能为空") @RequestParam String saleTypeId,
+            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
+            @ApiParam(value = "工程登录用户编号") @RequestParam(required = false) String userId,
+            @ApiParam(value = "家用工程订单号") @RequestParam(required = false) String enginOrderId,
+            @ApiParam(value = "经销商id") @RequestParam(required = false) String customerId
+    ) throws Exception {
+        AgencyBillsBean bills = enginSysLogic.findBills(saleTypeId, recordNo, userId, enginOrderId, customerId);
+        return ResponseHelper.success(bills);
+    }
+
+    @ApiNotAuth
+    @ApiOperation(value = "平台查询工程登录单列表")
+    @PostMapping("/platform/query/list")
+    public ResponseHelper<IPage<EnginOrderListBean>> platformQueryList(
+            @ApiParam(value = "帐号",required = true) @RequestParam String userName,
+            @ApiParam(value = "密码",required = true) @RequestParam String password,
+            @ApiParam(value = "时间戳",required = true) @RequestParam String timestamp,
+            @ApiParam(value = "签名",required = true) @RequestParam String sign,
+            @ApiParam(value = "工程登录编号") @RequestParam(required = false) String recordNo,
+            @ApiParam(value = "订单编号") @RequestParam(required = false) String orderNo,
+            @ApiParam(value = "使用单位") @RequestParam(required = false) String useUnit,
+            @ApiParam(value = "规格机型") @RequestParam(required = false) String specs,
+            @ApiParam(value = "实装机型") @RequestParam(required = false) String realModel,
+            @ApiParam(value = "客户地址") @RequestParam(required = false) String address,
+            @ApiParam(value = "单据类型") @RequestParam(required = false) String orderType,
+            @ApiParam(value = "页号",required = true) @RequestParam Integer pageNum,
+            @ApiParam(value = "页大小",required = true) @RequestParam Integer pageSize
+    ) throws Exception {
+        IPage<EnginOrderListBean> listPage = enginSysLogic.platformQueryList(userName, password, timestamp, sign, recordNo,
+                orderNo, useUnit, specs, realModel, address, orderType, pageNum, pageSize);
+        return ResponseHelper.success(listPage);
+    }
+
+    @ApiNotAuth
+    @ApiOperation(value = "平台引用工程登录单")
+    @PostMapping("/platform/ref")
+    public ResponseHelper platformRef(
+            @ApiParam(value = "工程登录编号",required = true) @RequestParam String recordNo,
+            @ApiParam(value = "id",required = true) @RequestParam String itemId,
+            @ApiParam(value = "引用状态 true=是 false=否",required = true) @RequestParam Boolean isRef,
+            @ApiParam(value = "时间戳",required = true) @RequestParam String timestamp,
+            @ApiParam(value = "签名",required = true) @RequestParam String sign
+    ) throws Exception {
+        enginSysLogic.platformRef(recordNo, itemId, isRef, timestamp, sign);
+        return ResponseHelper.success();
+    }
+}

+ 108 - 0
src/main/java/com/zfire/mall/manager/controller/manage/material/MaterialReferPriceController.java

@@ -0,0 +1,108 @@
+package com.zfire.mall.manager.controller.manage.material;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zfire.mall.manager.annotation.ZfireList;
+import com.zfire.mall.manager.bean.listV2.MaterialReferPriceVO;
+import com.zfire.mall.manager.exception.RemoteServiceException;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.manage.material.MaterialReferPriceLogic;
+import com.zfire.mall.manager.plus.entity.MaterialReferPrice;
+import com.zfire.mall.manager.utils.CommonUtils;
+import com.zfire.mall.manager.utils.excel.ExcelUtils;
+import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
+import com.zfire.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RequiredArgsConstructor
+@Slf4j
+@RestController
+@Api(value = "物料参考价格API", tags ={"物料参考价格API"} )
+@RequestMapping(value = "/material/refer/price", produces = "application/json; charset=utf-8")
+public class MaterialReferPriceController {
+
+    private final MaterialReferPriceLogic materialReferPriceLogic;
+
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation("列表")
+    public ResponseHelper<IPage<MaterialReferPriceVO>> list(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws RemoteServiceException {
+        IPage<MaterialReferPriceVO> list = materialReferPriceLogic.list(zfireParamBean);
+        return ResponseHelper.success(list, new TypeReference<MaterialReferPriceVO>() {});
+    }
+
+    @PostMapping("/list/export")
+    @ApiOperation("导出")
+    public void listV2Export(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<MaterialReferPriceVO> list = materialReferPriceLogic.list(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(list.getRecords(),zfireParam.getExportFields(),request,response);
+    }
+
+
+    @PostMapping("/save")
+    @ApiOperation("保存")
+    public ResponseHelper save(
+            @RequestBody MaterialReferPrice materialReferPrice
+    ){
+        materialReferPriceLogic.add(materialReferPrice);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation("详情")
+    public ResponseHelper<MaterialReferPrice> detail(
+            @RequestParam String id
+    ){
+        MaterialReferPrice detail = materialReferPriceLogic.detail(id);
+        return ResponseHelper.success(detail);
+    }
+
+    @PostMapping("/delete")
+    @ApiOperation("删除")
+    public ResponseHelper delete(
+            @RequestParam String id
+    ){
+        materialReferPriceLogic.delete(id);
+        return ResponseHelper.success();
+    }
+
+    @GetMapping("/download")
+    @ApiOperation("下载模板")
+    public void download(
+            HttpServletResponse response
+    ) throws IOException {
+        CommonUtils.downloadFile("参考成本价.xlsx",response);
+    }
+
+    @PostMapping("/import")
+    @ApiOperation("导入成本价")
+    public ResponseHelper importData(
+            @RequestPart("file") MultipartFile file
+    ) throws IOException {
+        List<Object> objects = ExcelUtils.importExcel(file);
+        materialReferPriceLogic.importData(objects);
+        return ResponseHelper.success();
+    }
+
+}

+ 21 - 0
src/main/java/com/zfire/mall/manager/controller/reserved/ReservedController.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zfire.mall.manager.annotation.ApiNotAuth;
 import com.zfire.mall.manager.annotation.ZfireList;
 import com.zfire.mall.manager.bean.ExcelData;
+import com.zfire.mall.manager.bean.admin.AdminUserCom;
 import com.zfire.mall.manager.bean.invoice.InvoiceProjectVO;
 import com.zfire.mall.manager.bean.k3.KingDeeMaterialBean;
 import com.zfire.mall.manager.bean.k3.StockPositionStock;
@@ -14,6 +15,7 @@ import com.zfire.mall.manager.bean.reserved.*;
 import com.zfire.mall.manager.constant.Constant;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.reserved.ReservedLogic;
 import com.zfire.mall.manager.plus.entity.KingDeeCustomer;
 import com.zfire.mall.manager.plus.entity.KingDeeMaterial;
@@ -53,6 +55,9 @@ public class ReservedController {
     @Autowired
     ReservedLogic reservedLogic;
 
+    @Autowired
+    CommonLogic commonLogic;
+
 
 
     @ApiOperation(value = "订单选择列表")
@@ -143,6 +148,12 @@ public class ReservedController {
             if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
                 throw new RemoteServiceException("系统繁忙,请稍后再试");
             }
+
+            AdminUserCom adminUser = commonLogic.getAdminUser();
+
+            if (adminUser.getIsCustomer())
+                throw new RemoteServiceException("经销商不可操作预留单");
+
             reservedLogic.add(reservedAdd);
         } finally {
             obtain.unlock();
@@ -166,6 +177,16 @@ public class ReservedController {
         return ResponseHelper.success();
     }
 
+    @PostMapping("/closeList")
+    @ApiOperation("批量预留单关闭")
+    public ResponseHelper closeList( @ApiParam(required = false, value = "预留详细单号") @RequestParam(required = false) List<String> itemId,
+                                  HttpServletRequest request) throws Exception {
+
+            reservedLogic.closeList(itemId, request);
+
+        return ResponseHelper.success();
+    }
+
     @PostMapping("/updateReserved")
     @ApiOperation("预留单修改")
     public ResponseHelper updateReserved( @RequestBody ReservedAdd reservedAdd,

+ 5 - 2
src/main/java/com/zfire/mall/manager/controller/saletype/SaleOrderController.java

@@ -381,6 +381,7 @@ public class SaleOrderController {
             @ApiParam(required = false, value = "发货开始时间") @RequestParam(required = false) String invoiceStartTime,
             @ApiParam(required = false, value = "发货结束时间") @RequestParam(required = false) String invoiceEndTime,
             @ApiParam(required = false, value = "仓库ID") @RequestParam(required = false) List<String> correspondId,
+            @ApiParam(required = false, value = "物料分类编码") @RequestParam(required = false) List<String> categoryNum,
             @ApiParam(required = false, value = "经销商名称") @RequestParam(required = false) String customerName,
             @ApiParam(required = false, value = "经销商编号") @RequestParam(required = false) String customerNumber,
             @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
@@ -394,7 +395,7 @@ public class SaleOrderController {
             @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
             @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
     ) throws Exception {
-        IPage<StorageFeeBean> list = saleOrderLogic.listStorageFee(approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
+        IPage<StorageFeeBean> list = saleOrderLogic.listStorageFee(categoryNum,approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
                 ,startTime,endTime, pageNum, pageSize);
         return ResponseHelper.success(list);
     }
@@ -410,6 +411,7 @@ public class SaleOrderController {
             @ApiParam(required = false, value = "订单结束时间") @RequestParam(required = false) String endTime,
             @ApiParam(required = false, value = "发货开始时间") @RequestParam(required = false) String invoiceStartTime,
             @ApiParam(required = false, value = "发货结束时间") @RequestParam(required = false) String invoiceEndTime,
+            @ApiParam(required = false, value = "物料分类编码") @RequestParam(required = false) List<String> categoryNum,
             @ApiParam(required = false, value = "仓库ID") @RequestParam(required = false) List<String> correspondId,
             @ApiParam(required = false, value = "经销商名称") @RequestParam(required = false) String customerName,
             @ApiParam(required = false, value = "经销商编号") @RequestParam(required = false) String customerNumber,
@@ -423,7 +425,7 @@ public class SaleOrderController {
             @ApiParam(required = false, value = "出库结束时间") @RequestParam(required = false) String saleEndTime,
             HttpServletRequest request, HttpServletResponse response
     ) throws Exception {
-        IPage<StorageFeeBean> list = saleOrderLogic.listStorageFee(approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
+        IPage<StorageFeeBean> list = saleOrderLogic.listStorageFee(categoryNum,approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
                 ,startTime,endTime, 1, -1);
         ExcelData excelData = saleOrderLogic.listStorageFeeExport(list.getRecords());
         ExcelUtils.exportExcel(request,response,"仓储费报表.xlsx",excelData);
@@ -473,6 +475,7 @@ public class SaleOrderController {
     public void stockInSyncInvoiceOrder(
 
     ) throws Exception {
+
         saleOrderLogic.stockInSyncInvoiceOrder();
 
     }

+ 115 - 0
src/main/java/com/zfire/mall/manager/controller/saletype/StorageFeeController.java

@@ -0,0 +1,115 @@
+package com.zfire.mall.manager.controller.saletype;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zfire.mall.manager.annotation.ApiNotAuth;
+import com.zfire.mall.manager.annotation.ZfireList;
+import com.zfire.mall.manager.bean.ExcelData;
+import com.zfire.mall.manager.bean.PoySaleCountBean;
+import com.zfire.mall.manager.bean.admin.AdminUserCom;
+import com.zfire.mall.manager.bean.sale.*;
+import com.zfire.mall.manager.constant.Constant;
+import com.zfire.mall.manager.exception.RemoteServiceException;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.common.CommonLogic;
+import com.zfire.mall.manager.logic.saletype.SaleOrderLogic;
+import com.zfire.mall.manager.logic.saletype.SaleRetreatOrderLogic;
+import com.zfire.mall.manager.logic.stock.StorageFeeLogic;
+import com.zfire.mall.manager.plus.entity.SaleType;
+import com.zfire.mall.manager.plus.entity.SalesOrder;
+import com.zfire.mall.manager.plus.service.SalesOrderService;
+import com.zfire.mall.manager.utils.excel.ExcelUtils;
+import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
+import com.zfire.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.integration.redis.util.RedisLockRegistry;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.stream.Collectors;
+
+@Slf4j
+@RestController
+@Api(value = "仓储费报表", tags ={"仓储费报表"} )
+@RequestMapping(value = "/sale/storageFee", produces = "application/json; charset=utf-8")
+public class StorageFeeController {
+
+    @Autowired
+    StorageFeeLogic storageFeeLogic;
+
+
+
+
+    @ApiOperation(value = "仓储费报表列表")
+    @GetMapping("/listStorageFee")
+    public ResponseHelper<IPage<StorageFeeBean>> listStorageFee(
+            @ApiParam(required = false, value = "发货申请单") @RequestParam(required = false) List<String> orderNo,
+            @ApiParam(required = false, value = "销售出库单号") @RequestParam(required = false) List<String> id,
+            @ApiParam(required = false, value = "订单类型 TRADE=商用 HOME=家用 RETAIL=零售单 RETAIL_POLICY 销售政策单  PERMU_HOME = 置换单家用        PERMU_TRADE 置换商用   PERMU_RETAIL  置换零售   PERMU_RETAIL_POLICY 置换销售政策单  REQUISITION_RETAIL 调拨单零售   REQUISITION_RETAIL_POLICY 调拨单销售政策REQUISITION_TRADE 调拨单商用 REQUISITION_HOME 调拨单家用") @RequestParam(required = false) String orderType,
+            @ApiParam(required = false, value = "订单号") @RequestParam(required = false) String mainOrderId,
+            @ApiParam(required = false, value = "订单开始时间") @RequestParam(required = false) String startTime,
+            @ApiParam(required = false, value = "订单结束时间") @RequestParam(required = false) String endTime,
+            @ApiParam(required = false, value = "发货开始时间") @RequestParam(required = false) String invoiceStartTime,
+            @ApiParam(required = false, value = "发货结束时间") @RequestParam(required = false) String invoiceEndTime,
+            @ApiParam(required = false, value = "仓库ID") @RequestParam(required = false) List<String> correspondId,
+            @ApiParam(required = false, value = "物料分类编码") @RequestParam(required = false) List<String> categoryNum,
+            @ApiParam(required = false, value = "经销商名称") @RequestParam(required = false) String customerName,
+            @ApiParam(required = false, value = "经销商编号") @RequestParam(required = false) String customerNumber,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            @ApiParam(required = false, value = "审核开始时间") @RequestParam(required = false) String approvalStartTime,
+            @ApiParam(required = false, value = "审核结束时间") @RequestParam(required = false) String approvalEndTime,
+            @ApiParam(required = false, value = "出库单据状态 SAVE=保存 WAIT=待审核 OK=通过 FAIL=不通过 CLOSE=关闭") @RequestParam(required = false) String saleExamineStatus,
+            @ApiParam(required = false, value = "出库开始时间") @RequestParam(required = false) String saleStartTime,
+            @ApiParam(required = false, value = "出库结束时间") @RequestParam(required = false) String saleEndTime,
+            @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
+            @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
+    ) throws Exception {
+        IPage<StorageFeeBean> list = storageFeeLogic.listStorageFee(categoryNum,approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
+                ,startTime,endTime, pageNum, pageSize);
+        return ResponseHelper.success(list);
+    }
+
+    @ApiOperation(value = "仓储费报表导出")
+    @GetMapping("/listStorageFeeExport")
+    public void listStorageFeeExport(
+            @ApiParam(required = false, value = "发货申请单") @RequestParam(required = false) List<String> orderNo,
+            @ApiParam(required = false, value = "销售出库单号") @RequestParam(required = false) List<String> id,
+            @ApiParam(required = false, value = "订单类型 TRADE=商用 HOME=家用 RETAIL=零售单 RETAIL_POLICY 销售政策单  PERMU_HOME = 置换单家用        PERMU_TRADE 置换商用   PERMU_RETAIL  置换零售   PERMU_RETAIL_POLICY 置换销售政策单  REQUISITION_RETAIL 调拨单零售   REQUISITION_RETAIL_POLICY 调拨单销售政策REQUISITION_TRADE 调拨单商用 REQUISITION_HOME 调拨单家用") @RequestParam(required = false) String orderType,
+            @ApiParam(required = false, value = "订单号") @RequestParam(required = false) String mainOrderId,
+            @ApiParam(required = false, value = "订单开始时间") @RequestParam(required = false) String startTime,
+            @ApiParam(required = false, value = "订单结束时间") @RequestParam(required = false) String endTime,
+            @ApiParam(required = false, value = "发货开始时间") @RequestParam(required = false) String invoiceStartTime,
+            @ApiParam(required = false, value = "发货结束时间") @RequestParam(required = false) String invoiceEndTime,
+            @ApiParam(required = false, value = "仓库ID") @RequestParam(required = false) List<String> correspondId,
+            @ApiParam(required = false, value = "物料分类编码") @RequestParam(required = false) List<String> categoryNum,
+            @ApiParam(required = false, value = "经销商名称") @RequestParam(required = false) String customerName,
+            @ApiParam(required = false, value = "经销商编号") @RequestParam(required = false) String customerNumber,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            @ApiParam(required = false, value = "审核开始时间") @RequestParam(required = false) String approvalStartTime,
+            @ApiParam(required = false, value = "审核结束时间") @RequestParam(required = false) String approvalEndTime,
+            @ApiParam(required = false, value = "出库单据状态 SAVE=保存 WAIT=待审核 OK=通过 FAIL=不通过 CLOSE=关闭") @RequestParam(required = false) String saleExamineStatus,
+            @ApiParam(required = false, value = "出库开始时间") @RequestParam(required = false) String saleStartTime,
+            @ApiParam(required = false, value = "出库结束时间") @RequestParam(required = false) String saleEndTime,
+            HttpServletRequest request, HttpServletResponse response
+    ) throws Exception {
+        IPage<StorageFeeBean> list = storageFeeLogic.listStorageFee(categoryNum,approvalStartTime,approvalEndTime,saleExamineStatus,saleStartTime,saleEndTime,invoiceStartTime,invoiceEndTime,mainOrderId,id,orderNo,materialNumber, customerName,correspondId,specification,materialName,customerNumber
+                ,startTime,endTime, 1, -1);
+        ExcelData excelData = storageFeeLogic.listStorageFeeExport(list.getRecords());
+        ExcelUtils.exportExcel(request,response,"仓储费报表.xlsx",excelData);
+    }
+
+
+}

+ 35 - 0
src/main/java/com/zfire/mall/manager/controller/stock/StockController.java

@@ -299,6 +299,41 @@ public class StockController {
         ExcelUtils.exportExcel(request,response,"仓库现存列表导出.xlsx",excelData);
     }
 
+    @ZfireList
+    @PostMapping("/allPrice")
+    @ApiOperation("成本价统计")
+    public ResponseHelper<List<StockPrice>> allPrice(
+            @ApiParam(required = false, value = "仓库id") @RequestParam(required = false) List<String> correspondId
+            ) throws RemoteServiceException {
+        List<StockPrice> list = stockCommonLogic.allPrice(correspondId);
+        return ResponseHelper.success(list);
+    }
+
+    @ZfireList
+    @PostMapping("/listStockToCostPriceV2")
+    @ApiOperation("产品现存成本-列表V2")
+    public ResponseHelper<IPage<StockBeanToCostPrice>> listStockToCostPriceV2(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws RemoteServiceException {
+        IPage<StockBeanToCostPrice> list = stockCommonLogic.listStockToCostPriceV2(zfireParamBean);
+        return ResponseHelper.success(list, new TypeReference<StockBeanToCostPrice>() {});
+    }
+
+    @PostMapping("/listStockToCostPriceV2/export")
+    @ApiOperation("产品现存成本-列表V2导出")
+    public void listStockToCostPriceV2Export(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<StockBeanToCostPrice> list = stockCommonLogic.listStockToCostPriceV2(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(list.getRecords(),zfireParam.getExportFields(),request,response);
+    }
+
 
     @ZfireList
     @PostMapping("/listStockToDayV2")

+ 48 - 0
src/main/java/com/zfire/mall/manager/controller/stock/StockCostController.java

@@ -228,6 +228,54 @@ public class StockCostController {
 
 
 
+    @ApiNotAuth
+    @ApiOperation(value = "估算库存")
+    @GetMapping("/syncStockNum")
+    public ResponseHelper syncStockNum(
+    ) throws Exception {
+
+        stockCostLogic.syncStockNum();
+        return ResponseHelper.success();
+
+    }
+
+
+
+
+    @ApiNotAuth
+    @ApiOperation(value = "生成账单")
+    @GetMapping("/syncStockPrice")
+    public ResponseHelper syncStockPrice(
+    ) throws Exception {
+
+        //stockCostLogic.syncStockPrice();
+        return ResponseHelper.success();
+
+    }
+
+
+    @ApiNotAuth
+    @ApiOperation(value = "生成账单engin")
+    @GetMapping("/syncStockPriceEngin")
+    public ResponseHelper syncStockPriceEngin(
+    ) throws Exception {
+
+       // stockCostLogic.syncStockPriceEngin();
+        return ResponseHelper.success();
+
+    }
+
+
+    @ApiNotAuth
+    @ApiOperation(value = "生成3.21之后订单")
+    @GetMapping("/syncStockThree")
+    public ResponseHelper syncStockThree(
+    ) throws Exception {
+
+       // stockCostLogic.syncStockThree();
+        return ResponseHelper.success();
+
+    }
 
 
 

+ 69 - 0
src/main/java/com/zfire/mall/manager/controller/stock/StockForceController.java

@@ -0,0 +1,69 @@
+package com.zfire.mall.manager.controller.stock;
+
+
+import com.zfire.mall.manager.annotation.ApiNotAuth;
+import com.zfire.mall.manager.bean.stock.StockForceAdd;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.stock.StockForceLogic;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author CHANGE
+ */
+@Slf4j
+@RestController
+@Api(value = "强制仓库选择", tags ={"强制仓库选择"} )
+@RequestMapping(value = "/stock/force", produces = "application/json; charset=utf-8")
+public class StockForceController {
+
+    @Autowired
+    StockForceLogic stockForceLogic;
+
+
+
+    @ApiOperation(value = "添加强制仓库")
+    @PostMapping("/update")
+    public ResponseHelper update(
+            @RequestBody StockForceAdd stockForceAdd
+    ) throws Exception {
+
+        stockForceLogic.update(stockForceAdd);
+        return ResponseHelper.success();
+
+    }
+
+
+
+    @ApiOperation(value = "强制仓库展示")
+    @PostMapping("/detail")
+    public ResponseHelper<StockForceAdd> syncFullCost(
+    ) throws Exception {
+
+        StockForceAdd stockForceAdd = stockForceLogic.deatil();
+        return ResponseHelper.success(stockForceAdd);
+
+    }
+
+
+    @ApiOperation(value = "删除强制仓")
+    @PostMapping("/del")
+    public ResponseHelper del(
+
+    ) throws Exception {
+
+        stockForceLogic.del();
+        return ResponseHelper.success();
+
+    }
+
+
+
+}
+

+ 103 - 0
src/main/java/com/zfire/mall/manager/controller/stock/StockForceUserController.java

@@ -0,0 +1,103 @@
+package com.zfire.mall.manager.controller.stock;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zfire.mall.manager.bean.ExcelData;
+import com.zfire.mall.manager.bean.admin.respDto.AdminUserDto;
+import com.zfire.mall.manager.bean.stock.*;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.stock.StockForceLogic;
+import com.zfire.mall.manager.plus.entity.AdminUserForceStock;
+import com.zfire.mall.manager.utils.CommonUtils;
+import com.zfire.mall.manager.utils.excel.ExcelUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author CHANGE
+ */
+@Slf4j
+@RestController
+@Api(value = "账号强制仓库选择", tags ={"账号强制仓库选择"} )
+@RequestMapping(value = "/stock/forceUser", produces = "application/json; charset=utf-8")
+public class StockForceUserController {
+
+    @Autowired
+    StockForceLogic stockForceLogic;
+
+
+
+    @ApiOperation(value = "仓库品类选择列表")
+    @GetMapping("/list")
+    public ResponseHelper<List<StockCategory>> list(
+
+    ) throws Exception {
+        List<StockCategory> stockBeans = stockForceLogic.list();
+        return ResponseHelper.success(stockBeans);
+    }
+
+    @ApiOperation(value = "添加账号强制仓")
+    @PostMapping("/add")
+    public ResponseHelper add(
+            @RequestBody StockForceUserAdd stockForceUserAdd
+    ) throws Exception {
+
+        stockForceLogic.addForceUser(stockForceUserAdd);
+        return ResponseHelper.success();
+
+    }
+
+    @ApiOperation(value = "用户的强制仓选择")
+    @GetMapping("/forceStockList")
+    public ResponseHelper<List<AdminUserForceStock>> forceStockList(
+            @ApiParam(required = true, value = "账号ID") @RequestParam(required = true) String adminUserId
+            ) throws Exception {
+        List<AdminUserForceStock> stockBeans = stockForceLogic.forceStockList(adminUserId);
+        return ResponseHelper.success(stockBeans);
+    }
+
+
+    @GetMapping("/export")
+    @ApiOperation(value = "导出账号强制仓")
+    public void exportMch(
+
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        IPage<AdminUserForceStockExcel> page = stockForceLogic.listExcel(1, -1);
+        ExcelData excelData = stockForceLogic.listExcelEx(page.getRecords());
+        ExcelUtils.exportExcel(request,response,"force.xlsx",excelData);
+    }
+
+    @PostMapping("/batch/update")
+    @ApiOperation("批量导入强制仓")
+    public ResponseHelper batchUpdate(
+            @ApiParam(required = true, value = "附件") @RequestPart("file") MultipartFile file,
+            HttpServletRequest request,HttpServletResponse response
+    ) throws Exception {
+
+        stockForceLogic.batchUpdate(file);
+        return ResponseHelper.success();
+    }
+
+    @GetMapping("/downloadGongcheng")
+    @ApiOperation("批量导入强制仓模板下载")
+    public void downloadGongcheng(
+            HttpServletResponse response
+    ) throws IOException {
+        CommonUtils.downloadFile("导入账号强制仓库.xlsx",response);
+    }
+
+
+}
+

+ 141 - 0
src/main/java/com/zfire/mall/manager/controller/stock/StockStartAccController.java

@@ -0,0 +1,141 @@
+package com.zfire.mall.manager.controller.stock;
+
+
+import cn.hutool.db.Page;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zfire.mall.manager.annotation.ApiNotAuth;
+import com.zfire.mall.manager.bean.ExcelData;
+import com.zfire.mall.manager.bean.sale.StorageFeeBean;
+import com.zfire.mall.manager.bean.stock.KingDeePurchaseStockOutBean;
+import com.zfire.mall.manager.bean.stock.StockStartAccVO;
+import com.zfire.mall.manager.helper.ResponseHelper;
+import com.zfire.mall.manager.logic.stock.StockStartAccLogic;
+import com.zfire.mall.manager.utils.excel.ExcelUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * @author CHANGE
+ */
+@Slf4j
+@RestController
+@Api(value = "广佛仓库区分", tags ={"广佛仓库区分"} )
+@RequestMapping(value = "/stock/startAcc", produces = "application/json; charset=utf-8")
+public class StockStartAccController {
+
+
+    @Autowired
+    StockStartAccLogic stockStartAccLogic;
+
+
+    @ApiOperation(value = "广佛库存列表")
+    @GetMapping("/stock")
+    public ResponseHelper<IPage<StockStartAccVO>> list(
+            @ApiParam(required = false, value = "仓库名称") @RequestParam(required = false) String correspondName,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            @ApiParam(required = false, value = "分页大小") @RequestParam(required = false) Integer pageSize,
+            @ApiParam(required = false, value = "页数") @RequestParam(required = false) Integer pageNumber
+
+    ) throws Exception {
+        IPage<StockStartAccVO> stockStartAccVOIPage = stockStartAccLogic.list(correspondName,materialName,materialNumber,specification,pageSize,pageNumber);
+        return ResponseHelper.success(stockStartAccVOIPage);
+    }
+
+
+
+    @ApiOperation(value = "广佛库存列表和库存对比结果")
+    @GetMapping("/listDuiBi")
+    public ResponseHelper listDuiBi(
+
+
+    ) throws Exception {
+        stockStartAccLogic.listDuiBi();
+        return ResponseHelper.success();
+    }
+
+
+    @ApiOperation(value = "广佛库存列表1导出")
+    @GetMapping("/stockExport")
+    public void stockExport(
+            @ApiParam(required = false, value = "仓库名称") @RequestParam(required = false) String correspondName,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            HttpServletRequest request, HttpServletResponse response
+    ) throws Exception {
+        List<StockStartAccVO> stockStartAccVOIPage = stockStartAccLogic.listExport(correspondName,materialName,materialNumber,
+                specification,-1,1);
+
+        ExcelData excelData = stockStartAccLogic.stockExport(stockStartAccVOIPage);
+        ExcelUtils.exportExcel(request,response,"广佛库存1.xlsx",excelData);
+    }
+
+    @ApiOperation(value = "广佛库存列表2后导出")
+    @GetMapping("/stockExport2")
+    public void stockExport2(
+            @ApiParam(required = false, value = "仓库名称") @RequestParam(required = false) String correspondName,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            HttpServletRequest request, HttpServletResponse response
+    ) throws Exception {
+        List<StockStartAccVO> stockStartAccVOIPage = stockStartAccLogic.listExport2(correspondName,materialName,materialNumber,
+                specification,-1,1);
+
+
+        ExcelData excelData = stockStartAccLogic.stockExport(stockStartAccVOIPage);
+        ExcelUtils.exportExcel(request,response,"广佛库存2.xlsx",excelData);
+    }
+
+
+    @ApiOperation(value = "广佛库存列表3导出")
+    @GetMapping("/stockExport3")
+    public void stockExport3(
+            @ApiParam(required = false, value = "仓库名称") @RequestParam(required = false) String correspondName,
+            @ApiParam(required = false, value = "物料名称") @RequestParam(required = false) String materialName,
+            @ApiParam(required = false, value = "物料编码") @RequestParam(required = false) String materialNumber,
+            @ApiParam(required = false, value = "规格型号") @RequestParam(required = false) String specification,
+            HttpServletRequest request, HttpServletResponse response
+    ) throws Exception {
+        List<StockStartAccVO> stockStartAccVOIPage = stockStartAccLogic.listExport3(correspondName,materialName,materialNumber,
+                specification,-1,1);
+
+
+        ExcelData excelData = stockStartAccLogic.stockExport(stockStartAccVOIPage);
+        ExcelUtils.exportExcel(request,response,"广佛库存3.xlsx",excelData);
+    }
+
+
+
+    @ApiNotAuth
+    @ApiOperation(value = "同步新入库机型到期初")
+    @GetMapping("/syncStartAcc")
+    public ResponseHelper test3(
+
+    ) throws Exception {
+        stockStartAccLogic.test3();
+        return ResponseHelper.success();
+    }
+
+
+    @ApiNotAuth
+    @ApiOperation(value = "同步机型库存")
+    @GetMapping("/syncStartAccSync")
+    public ResponseHelper test4(
+
+    ) throws Exception {
+        stockStartAccLogic.test4();
+        return ResponseHelper.success();
+    }
+}
+

+ 52 - 0
src/main/java/com/zfire/mall/manager/controller/trade/LoginOrderController.java

@@ -23,11 +23,13 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotBlank;
+import java.io.InputStream;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
@@ -448,4 +450,54 @@ public class LoginOrderController {
         //3.导出
         FieldUtils.exportData(list.getRecords(),zfireParam.getExportFields(),request,response);
     }
+
+    @PostMapping("/import")
+    @ApiOperation("商用工程登录单-导入旧数据")
+    public ResponseHelper<String> importData(
+            @ApiParam(required = true, value = "附件") @RequestPart("file") MultipartFile file,
+            @ApiParam(required = true, value = "审核人") @RequestParam String confirmBy,
+            @ApiParam(required = true, value = "审核名称") @RequestParam String confirmName,
+            HttpServletRequest request,HttpServletResponse response
+    ) throws Exception {
+        InputStream inputStream = file.getInputStream();
+        String msg = loginOrderLogic.importData(inputStream, request, confirmBy, confirmName);
+        return ResponseHelper.success(msg);
+    }
+
+    @PostMapping("/check/limit")
+    @ApiOperation("商用工程登录单-检查登录额")
+    public ResponseHelper checkLimit(
+            @ApiParam(required = true, value = "商用工装工程登录单") @RequestBody TradeLoginOrderBean bean
+    ) throws Exception {
+        loginOrderLogic.checkLimit(bean);
+        return ResponseHelper.success();
+    }
+
+    @ZfireList
+    @ApiOperation(value = "商用工程登录单-垃圾站列表")
+    @PostMapping("/recycle/list")
+    public ResponseHelper<IPage<LoginOrderVO>> recycleListPage(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) throws RemoteServiceException {
+        IPage<LoginOrderVO> list = loginOrderLogic.recycleListPage(zfireParamBean);
+        return ResponseHelper.success(list, new TypeReference<LoginOrderVO>() {});
+    }
+
+    @ApiOperation(value = "商用工程登录单-垃圾站删除")
+    @PostMapping("/recycle/del")
+    public ResponseHelper recycleDel(
+            @ApiParam(required = true, value = "单据id") @RequestBody List<String> ids
+    ) throws Exception {
+        loginOrderLogic.recycleDel(ids);
+        return ResponseHelper.success();
+    }
+
+    @ApiOperation(value = "商用工程登录单-垃圾站恢复")
+    @PostMapping("/recycle/restore")
+    public ResponseHelper recycleRestore(
+            @ApiParam(required = true, value = "单据id") @RequestBody List<String> ids
+    ) throws Exception {
+        loginOrderLogic.recycleRestore(ids);
+        return ResponseHelper.success();
+    }
 }

+ 45 - 12
src/main/java/com/zfire/mall/manager/controller/wallet/FinanceController.java

@@ -343,9 +343,10 @@ public class FinanceController {
     @GetMapping("/total")
     @ApiOperation(value = "财务汇总-字段简单,直接看返回结果接")
     public ResponseHelper<List<Map<String,Object>>> countTotal(
-            @ApiParam(value = "websitId",required = false) @RequestParam(required = false) String websitId
+            @ApiParam(value = "websitId",required = false) @RequestParam(required = false) String websitId,
+            @ApiParam(value = "钱包类型 COMMONLY=现金钱包 REBATE=返利钱包",required = false) @RequestParam(required = false) String type
     ) throws Exception {
-        List<Map<String, Object>> maps = walletLogic.queryTotalAmount(websitId);
+        List<Map<String, Object>> maps = walletLogic.queryTotalAmount(websitId,type);
         return ResponseHelper.success(maps);
     }
 
@@ -452,6 +453,26 @@ public class FinanceController {
     @PostMapping("/other/rece/apply")
     @ApiOperation("其他应收单-提审")
     public ResponseHelper applyOtherRece(
+            @ApiParam(value = "id",required = true) @RequestParam(required = true) List<String> id
+    ) throws InterruptedException {
+        for (String s : id) {
+            Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_OTHER + s);
+            if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
+                throw new RemoteServiceException("系统繁忙,请稍后再试");
+            }
+            try {
+                walletLogic.applyExamineOtherRece(s);
+            }finally {
+                obtain.unlock();
+            }
+        }
+
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/other/rece/cancelApply")
+    @ApiOperation("其他应收单-取消提审")
+    public ResponseHelper cancelApplyOtherRece(
             @ApiParam(value = "id",required = true) @RequestParam(required = true) String id
     ) throws InterruptedException {
         Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_OTHER + id);
@@ -459,7 +480,7 @@ public class FinanceController {
             throw new RemoteServiceException("系统繁忙,请稍后再试");
         }
         try {
-            walletLogic.applyExamineOtherRece(id);
+            walletLogic.cancelApplyOtherRece(id);
         }finally {
             obtain.unlock();
         }
@@ -469,19 +490,22 @@ public class FinanceController {
     @PostMapping("/other/rece/examine")
     @ApiOperation("其他应收单-审核")
     public ResponseHelper examineOtherRece(
-            @ApiParam(value = "id",required = true) @RequestParam(required = true) String id,
+            @ApiParam(value = "id",required = true) @RequestParam(required = true) List<String> id,
             @ApiParam(value = "OK=通过 FAIL=不通过",required = true) @RequestParam(required = true) String examineStatus,
             @ApiParam(value = "审核备注",required = false) @RequestParam(required = false) String examineRemark
     ) throws InterruptedException {
-        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_OTHER + id);
-        if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
-            throw new RemoteServiceException("系统繁忙,请稍后再试");
-        }
-        try {
-            walletLogic.examineOtherRece(id, examineStatus, examineRemark);
-        }finally {
-            obtain.unlock();
+        for (String s : id) {
+            Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_OTHER + s);
+            if (!obtain.tryLock(10, TimeUnit.SECONDS)) {
+                throw new RemoteServiceException("系统繁忙,请稍后再试");
+            }
+            try {
+                walletLogic.examineOtherRece(s, examineStatus, examineRemark);
+            }finally {
+                obtain.unlock();
+            }
         }
+
         return ResponseHelper.success();
     }
 
@@ -540,6 +564,15 @@ public class FinanceController {
     }
 
 
+    @PostMapping("/rece/import/dataImport")
+    @ApiOperation("导入其他应收单-插入")
+    public ResponseHelper dataImportData(MultipartFile file) throws Exception {
+        List<Object> objects = ExcelUtils.importExcel(file);
+        rebateOrderLogic.dataImportData(objects);
+        return ResponseHelper.success();
+    }
+
+
     @GetMapping("/totalCustomer/export")
     @ApiOperation(value = "财务汇总-字段简单,直接看返回结果接")
     public void countTotalExport(

+ 27 - 0
src/main/java/com/zfire/mall/manager/controller/wallet/WalletController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.zfire.mall.manager.annotation.ZfireList;
 import com.zfire.mall.manager.bean.ExcelData;
 import com.zfire.mall.manager.bean.listV2.*;
+import com.zfire.mall.manager.bean.listV2.dto.CustomerAmountDTO;
 import com.zfire.mall.manager.bean.wallet.CustomerWalletBean;
 import com.zfire.mall.manager.bean.wallet.RebateWalletSaleBean;
 import com.zfire.mall.manager.bean.wallet.WalletListBean;
@@ -334,4 +335,30 @@ public class WalletController {
         return ResponseHelper.success(walletListBeans);
     }
 
+
+    @ZfireList
+    @PostMapping("/history/list")
+    @ApiOperation("经销商历史钱包余额-列表")
+    public ResponseHelper<IPage<CustomerWalletAmountVO>> customerHistoryAmount(
+            @RequestBody CustomerAmountDTO zfireParamBean
+    ) throws RemoteServiceException {
+        IPage<CustomerWalletAmountVO> page = walletLogic.historyAmountList(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<CustomerWalletAmountVO>() {});
+    }
+
+    @PostMapping("/history/list/export")
+    @ApiOperation("经销商历史钱包余额-导出")
+    public void historyListExport(
+            @RequestBody CustomerAmountDTO zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //1.组装查询条件
+        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
+        //2.查询要导出的内容
+        IPage<CustomerWalletAmountVO> page = walletLogic.historyAmountList(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(page.getRecords(),zfireParam.getExportFields(),request,response);
+    }
+
 }

+ 6 - 0
src/main/java/com/zfire/mall/manager/enums/InvoiceCustomerEnum.java

@@ -11,8 +11,14 @@ public enum InvoiceCustomerEnum {
     GEJIANG_FOSHAN("600023","格匠佛山"),
     GEJIANG_GUANGZHOU_STOCK("虚拟仓","格匠广州"),
     GEJIANG_LUBAO_STOCK("芦苞仓","格匠广州"),
+    GEJIANG_LUBAOWANGPI_STOCK("网批芦苞仓","格匠广州"),
+    GEJIANG_LUBAOFOSHAN_STOCK("芦苞仓(佛山)","格匠广州"),
+    GEJIANG_SANSHUIFOSHAN_STOCK("三水仓(佛山)","格匠广州"),
+    GEJIANG_SANSHUIFOSHANZHUHAI_STOCK("三水珠海仓","格匠广州"),
+    GEJIANG_SHANSHUIZHUHAIFOSHAN_STOCK("三水珠海仓(佛山)","格匠广州"),
     GEJIANG_ZIXUE_STOCK("孜学仓","格匠广州"),
     GEJIANG_WANHAO_STOCK("万豪仓","格匠广州"),
+    GEJIANG_WANHAOYANGJI_STOCK("万豪仓(样机)","格匠广州"),
     GEJIANG_GUANGZHOU_STOCK_LONGSHAN("龙山仓","格匠广州"),
     GEJIANG_GUANGZHOU_STOCK_CHANGZHIDIAO("厂直调","格匠广州"),
     GEJIANG_GUANGZHOU_SUPPLIER("GZ02799","格匠广州"),

+ 11 - 2
src/main/java/com/zfire/mall/manager/enums/IsEnum.java

@@ -1,9 +1,8 @@
 package com.zfire.mall.manager.enums;
 
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.EnumValue;
-import com.baomidou.mybatisplus.core.enums.IEnum;
-import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
 import com.fasterxml.jackson.annotation.JsonValue;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -30,4 +29,14 @@ public enum IsEnum {
         return null;
     }
 
+    public static Boolean findKeyByValue(String value) {
+        IsEnum[] enums = IsEnum.values();
+        for (IsEnum anEnum : enums) {
+            boolean b = anEnum.getValue().equals(StrUtil.trim(value));
+            if (b)
+                return anEnum.getKey();
+        }
+        return null;
+    }
+
 }

+ 11 - 0
src/main/java/com/zfire/mall/manager/enums/TradeLoginOrderTypeEnum.java

@@ -1,5 +1,6 @@
 package com.zfire.mall.manager.enums;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.EnumValue;
 import com.fasterxml.jackson.annotation.JsonValue;
 import lombok.AllArgsConstructor;
@@ -15,4 +16,14 @@ public enum TradeLoginOrderTypeEnum {
     @EnumValue
     private final String key;
     private final String value;
+
+    public static String findKeyByValue(String value) {
+        TradeLoginOrderTypeEnum[] enums = TradeLoginOrderTypeEnum.values();
+        for (TradeLoginOrderTypeEnum anEnum : enums) {
+            boolean b = anEnum.getValue().equals(StrUtil.trim(value));
+            if (b)
+                return anEnum.getKey();
+        }
+        return null;
+    }
 }

+ 1 - 0
src/main/java/com/zfire/mall/manager/enums/TradeProjectAreaEnum.java

@@ -15,4 +15,5 @@ public enum TradeProjectAreaEnum {
     @EnumValue
     private final String key;
     private final String value;
+
 }

+ 243 - 47
src/main/java/com/zfire/mall/manager/logic/admin/AdminUserLogic.java

@@ -4,7 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.SecureUtil;
+import cn.hutool.poi.excel.ExcelReader;
+import cn.hutool.poi.excel.ExcelUtil;
 import com.aliyuncs.utils.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -29,6 +32,7 @@ import com.zfire.mall.manager.enums.SMSTypeEnum;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.common.SMSLogic;
+import com.zfire.mall.manager.logic.external.ExternalEnginLogic;
 import com.zfire.mall.manager.logic.k3.K3CustomerLogic;
 import com.zfire.mall.manager.logic.wallet.WalletLogic;
 import com.zfire.mall.manager.plus.entity.*;
@@ -37,15 +41,11 @@ import com.zfire.mall.manager.utils.CommonUtils;
 import com.zfire.mall.manager.utils.JiaSMUtil;
 import com.zfire.mall.manager.utils.JwtUtils;
 import com.zfire.mall.manager.utils.RedisUtil;
-import com.zfire.mall.manager.utils.JiaSMUtil;
-import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
@@ -53,6 +53,9 @@ import javax.servlet.http.HttpServletRequest;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -65,8 +68,8 @@ public class AdminUserLogic {
     DefaultKaptcha defaultKaptcha;
     @Autowired
     CommonLogic commonLogic;
-//    @Autowired
-//    ExternalEnginLogic externalEnginLogic;
+    @Autowired
+    ExternalEnginLogic externalEnginLogic;
     @Autowired
     AdminWebsitLogic adminWebsitLogic;
     @Autowired
@@ -110,6 +113,12 @@ public class AdminUserLogic {
     @Autowired
     CustomerBillLimitConfigService customerBillLimitConfigService;
 
+    @Autowired
+    CustomerProductTypeRelaService customerProductTypeRelaService;
+
+    @Autowired
+    TradeLoginOrderService tradeLoginOrderService;
+
 
     /**
      * 验证码
@@ -138,7 +147,8 @@ public class AdminUserLogic {
     /**
      * 登录
      */
-    public AdminUserBean login(String userName, String password, String code, String codeValue,String smsCode,String loginType,HttpServletRequest request) throws RemoteServiceException {
+    @Transactional(rollbackFor = Exception.class)
+    public AdminUserBean login(String userName, String password, String code, String codeValue,String smsCode,String loginType,HttpServletRequest request) throws RemoteServiceException, ParseException {
         String value = (String) redisUtil.get(Constant.RedisPrefix.VERIFICATION + code);
         if (Constant.LOGIN_TYPE_ACCOUNT.equals(loginType) && (value == null || !value.toLowerCase().equals(codeValue.toLowerCase()))) {
             throw new RemoteServiceException("验证码错误");
@@ -173,6 +183,8 @@ public class AdminUserLogic {
 
             //经销商获得是否前置仓
             KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
+            if(kingDeeCustomer == null)
+                throw new RemoteServiceException("绑定了无效的经销商信息,请联系相关人员");
             adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
             adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
             adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
@@ -190,8 +202,18 @@ public class AdminUserLogic {
 
         AdminUserCom adminUserCom = commonLogic.getAdminUser(adminUser.getAdminUserId(),true, request);
         adminUserBean.setAdminWebsit(adminUserCom.getAdminWebsit());
+
+        String timeString = "2024-07-18 17:30:00";
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        Date date = format.parse(timeString);
+
+        if (adminUserCom.getIsCustomer() && new Date().before(DateUtil.offsetHour(date,12))){
+            throw new RemoteServiceException("系统更新中");
+        }
+
         //存放到redis
-        redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + adminUserBean.getToken(), adminUserCom, 20 * 60 * 60 * 1000);
+        redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + adminUserBean.getToken(), adminUserCom, 20 * 60 * 60);
         return adminUserBean;
     }
 
@@ -280,7 +302,7 @@ public class AdminUserLogic {
         if (count > 0) {
             throw new RemoteServiceException("帐号已被注册");
         }
-        if(CollectionUtils.isEmpty(adminUser.getAdminWebsitIds()) && adminUser.getType() != null && adminUser.getType() == 0){
+        if(CollectionUtils.isEmpty(adminUser.getAdminWebsitIds())){
             throw new RemoteServiceException("请选择部门");
         }
         if(adminUser.getType() != null && admin.getType() == 0 && adminUser.getAdminWebsitIds().size() > 1){
@@ -319,7 +341,7 @@ public class AdminUserLogic {
             walletLogic.initByAddUser(admin.getAdminCompanyIds(),adminUser.getCustomerId());
         }
         //业务员
-        if(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_NAME) && addUserRole.getName().equals(Constant.NOT_DEL_ROLE_NAME2)){
+        if(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY) || addUserRole.getName().equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY)){
             adminUser.setIsService(true);
         }
 
@@ -433,6 +455,8 @@ public class AdminUserLogic {
         if(newUser.getType() == null){
             newUser.setType(oldUser.getType());
         }
+        //前端传参错误,所以这里赋值下
+        newUser.setIsCustomerCompany(newUser.getIsGroupCompany());
 
         //添加账户绑定仓库
         if (CollectionUtils.isNotEmpty(newUser.getCorrespondIds())) {
@@ -445,6 +469,31 @@ public class AdminUserLogic {
                 adminUserList.add(adminUserStock);
             }
             adminUserStockService.saveBatch(adminUserList);
+
+            //把所有子账号都变更
+            if (admin.getIsCustomer() && !admin.getIsMaster()) {
+                List<AdminUser> adminUsers = adminUserService.lambdaQuery().eq(AdminUser::getCustomerId, admin.getCustomerNumber())
+                        .eq(AdminUser::getIsMaster, false).list();
+
+
+                List<String> adminUserId = adminUsers.stream().map(AdminUser::getAdminUserId).collect(Collectors.toList());
+
+                adminUserStockService.lambdaUpdate().in(AdminUserStock::getAdminUserId,adminUserId).remove();
+
+                for (AdminUser adminUser : adminUsers) {
+
+                    List<AdminUserStock> adminUserListin = new ArrayList<>();
+                    for (String correspondId : newUser.getCorrespondIds()) {
+                        AdminUserStock adminUserStock = new AdminUserStock();
+                        adminUserStock.setAdminUserId(adminUser.getAdminUserId());
+                        adminUserStock.setCorrespondId(correspondId);
+                        adminUserListin.add(adminUserStock);
+                    }
+                    adminUserStockService.saveBatch(adminUserListin);
+
+                }
+            }
+
         }
 
         //添加金蝶物料权限
@@ -484,6 +533,10 @@ public class AdminUserLogic {
 //            if(adminUserCount > 0){
 //                throw new RemoteServiceException("该经销商已被绑定");
 //            }
+
+            kingDeeCustomerService.lambdaUpdate().eq(KingDeeCustomer::getId,oldUser.getCustomerId())
+                    .set(KingDeeCustomer::getBindUser,false).update();
+
             KingDeeCustomer kingDeeCustomer = k3CustomerLogic.bindUser(newUser.getCustomerId());
             newUser.setCustomerNumber(kingDeeCustomer.getNumber());
             newUser.setCustomerName(kingDeeCustomer.getName());
@@ -495,8 +548,13 @@ public class AdminUserLogic {
         }
 
         //业务员
-        if(oldUser.getIsService() && !addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY)){
-            throw new RemoteServiceException("业务员帐号不可更改职位/角色");
+        if(oldUser.getIsService() && !(addUserRole.getName().equals(Constant.NOT_DEL_ROLE_YWY) || addUserRole.getName().equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY))){
+
+            if (customerProductTypeRelaService.lambdaQuery().eq(CustomerProductTypeRela::getServiceId,newUser.getAdminUserId()).count() > 0) {
+                throw new RemoteServiceException("有钱包关联不可更改角色");
+            }
+            newUser.setIsService(false);
+
         }
 
         //  添加用户的角色级别 <= 被添加的用户的角色级别
@@ -597,7 +655,7 @@ public class AdminUserLogic {
      * @return
      */
     public IPage<AdminUserDto> list(String adminWebsitId,String roleId,String customerId,Boolean isCustomer,Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
-        String roleName = "";
+        List<String> roleName = new ArrayList<>();
 
         AdminUserCom adminUser = commonLogic.getAdminUser(true);
         List<String> adminWebsitIds = new ArrayList<>();
@@ -614,7 +672,8 @@ public class AdminUserLogic {
         }
         String websitNumber = "";
         if(isCustomer != null && !isCustomer){
-            roleName = Constant.NOT_DEL_ROLE_YWY;
+            roleName.add(Constant.NOT_DEL_ROLE_YWY);
+            roleName.add(Constant.NOT_DEL_SHANGYONG_ROLE_YWY);
             if(adminUser.getAdminWebsit() != null) {
                 websitNumber = adminUser.getAdminWebsit().getWebsitNumber();
             }
@@ -716,7 +775,7 @@ public class AdminUserLogic {
             AdminWebsit adminWebsit = adminWebsitService.getById(list.get(0).getAdminWebsitId());
             adminUserBean.setAdminWebsit(adminWebsit);
         }
-//        adminUserBean.setEnginSysUrl(externalEnginLogic.getLoginUrl());
+        adminUserBean.setEnginSysUrl(externalEnginLogic.getLoginUrl());
         if(detail != null) {
             adminUserBean.setIsZr(detail.getIsZr());
         }
@@ -740,13 +799,15 @@ public class AdminUserLogic {
         if (adminUserBean.getIsCustomer()){
             //经销商获得是否前置仓
             KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
-            adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
-            adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
-            adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
-
-            //所属集团
-            adminUserBean.setIsCustomerCompany(kingDeeCustomer.getIsGroupCompany());
-            adminUserBean.setGroupCompanyId(kingDeeCustomer.getParentId());
+            if(kingDeeCustomer != null) {
+                adminUserBean.setIsFront(kingDeeCustomer.getIsFront());
+                adminUserBean.setFrontPickType(kingDeeCustomer.getFrontPickType());
+                adminUserBean.setIsPick(kingDeeCustomer.getIsPick());
+
+                //所属集团
+                adminUserBean.setIsCustomerCompany(kingDeeCustomer.getIsGroupCompany());
+                adminUserBean.setGroupCompanyId(kingDeeCustomer.getParentId());
+            }
         }
         if (!CollectionUtils.isEmpty(adminUserBean.getAdminWebsitIds()) && !CollectionUtils.isEmpty(adminUserBean.getAdminWebsitIds().stream().filter(item -> item.equals("1")).collect(Collectors.toList()))){
             adminUserBean.setIsHongGe(true);
@@ -755,7 +816,21 @@ public class AdminUserLogic {
         adminUserBean.setChangeNum(Convert.toInt(redisUtil.get(Constant.SUPPLY_CHANGE_NUM+adminUser.getAdminUserId())));
 
         // 商用登录审核员
-        adminUserBean.setIsTradeExaminer(adminUser.getRoleName().equals(Constant.NOT_DEL_ROLE_SPY));
+        if (StrUtil.isNotBlank(adminUser.getRoleName()) ) {
+            for (String str : Constant.NOT_DEL_ROLE_SPY) {
+                if (adminUser.getRoleName().contains(str)) {
+                    adminUserBean.setIsTradeExaminer(true);
+                    break;
+                } else {
+                    adminUserBean.setIsTradeExaminer(false);
+                }
+            }
+        }
+
+        if (Objects.isNull(adminUserBean.getIsTradeExaminer())) {
+            adminUserBean.setIsTradeExaminer(false);
+        }
+//        adminUserBean.setIsTradeExaminer(Constant.NOT_DEL_ROLE_SPY.contains(adminUser.getRoleName()));
 
         return adminUserBean;
     }
@@ -790,11 +865,11 @@ public class AdminUserLogic {
      * 检查工程机系统是否合法
      */
     public void checkEnginUser(HttpServletRequest request){
-//        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-//        Integer result = externalEnginLogic.checkEnginUser(adminUser.getEnginUserName(), adminUser.getEnginPassword());
-//        if(Objects.isNull(result)){
-//            throw new RemoteServiceException(4444,"帐号密码验证失败");
-//        }
+        AdminUserCom adminUser = commonLogic.getAdminUser(request);
+        Integer result = externalEnginLogic.checkEnginUser(adminUser.getEnginUserName(), adminUser.getEnginPassword());
+        if(Objects.isNull(result)){
+            throw new RemoteServiceException(4444,"帐号密码验证失败");
+        }
     }
 
 
@@ -825,10 +900,10 @@ public class AdminUserLogic {
 //            }
 //        }
 
-//        Integer result = externalEnginLogic.checkEnginUser(userName, password);
-//        if(Objects.isNull(result)){
-//            throw new RemoteServiceException(4444,"帐号密码验证失败");
-//        }
+        Integer result = externalEnginLogic.checkEnginUser(userName, password);
+        if(Objects.isNull(result)){
+            throw new RemoteServiceException(4444,"帐号密码验证失败");
+        }
 
 //        if (!isReset) {
 //            AdminUserBindEngin adminUserBindEngin = new AdminUserBindEngin();
@@ -855,21 +930,35 @@ public class AdminUserLogic {
         //String adminUserId = CommonUtils.getUserId(request);
 
         AdminUser adminUser = adminUserService.getById(adminUserId);
+
+        List<AdminModuleTree> adminModuleTrees = new ArrayList<>();
+        
         if (adminUser.getUserName().equals("admin")) {
             return this.queryAdminModuleTree(null, true, null, flag);
         } else {
             if(adminUser.getIsCustomer() && !adminUser.getIsMaster()){
                 KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.getById(adminUser.getCustomerId());
-                if (kingDeeCustomer.getJiaxianType().equals(JiaXianStockEnum.JIAXIAN.getKey()) || adminUser.getIsGongcheng())
-                    return this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
-
-                return this.queryAdminModuleTree(adminUser.getAdminUserId(), false, null, flag);
+                if (kingDeeCustomer.getJiaxianType().equals(JiaXianStockEnum.JIAXIAN.getKey()) || adminUser.getIsGongcheng()) 
+                    adminModuleTrees = this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
+                else
+                    adminModuleTrees =  this.queryAdminModuleTree(adminUser.getAdminUserId(), false, null, flag);
             }else {
-                return this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
+                adminModuleTrees =  this.queryAdminModuleTree(adminUser.getRoleId(), false, null, flag);
             }
         }
+
+        if (adminUser.getIsShangyong() && adminUser.getIsCustomer()){
+            adminModuleTrees.addAll(this.queryAdminModuleTree(Constant.SHANGYONGJINGXIAOSHANG, false, null, flag));
+        }
+
+   /*     if (adminUser.getIsShangyong() && adminUser.getIsService()){
+            adminModuleTrees.addAll(this.queryAdminModuleTree(Constant.SHANGYONGYEWUYUAN ,false, null, flag));
+        }*/
+        
+        return adminModuleTrees;
     }
 
+
     /**
      * 给角色授权
      */
@@ -1116,7 +1205,7 @@ public class AdminUserLogic {
             }
 
             //业务员
-            if (roleName.equals(Constant.NOT_DEL_ROLE_NAME) && roleName.equals(Constant.NOT_DEL_ROLE_NAME2)) {
+            if (roleName.equals(Constant.NOT_DEL_ROLE_YWY) || roleName.equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY)) {
                 saveUser.setIsService(true);
             }
 
@@ -1268,7 +1357,7 @@ public class AdminUserLogic {
 
             AdminUser adminUser = adminUserService.lambdaQuery().eq(AdminUser::getUserName, userName).one();
             if(adminUser == null){
-                throw new RemoteServiceException("帐号【"+adminUser.getUserName()+"】不存在");
+                throw new RemoteServiceException("帐号【"+userName+"】不存在");
             }
             if(StringUtils.isNotEmpty(canUseStore)) {
                 canUseStore = canUseStore.replaceAll(",",",");
@@ -1455,7 +1544,7 @@ public class AdminUserLogic {
      */
     public ExcelData listExport(List<AdminUserDto> adminUserDtos) {
         String[] titles = new String[]{"账号", "用户名", "角色组称", "部门", "经销商", "集团公司",
-                "所属集团", "是否折让", "密码", "可用仓库", "登录手机号","金蝶物料权限","状态"};
+                "所属集团", "是否折让", "密码", "可用仓库", "登录手机号","金蝶物料权限","状态","是否商用经销商"};
         List<List<Object>> rows = new ArrayList<>();
         if(adminUserDtos.size() >2000){
             throw new RemoteServiceException("数据量太大,请分批导出");
@@ -1535,6 +1624,7 @@ public class AdminUserLogic {
             row.add(user.getLoginMobile());
             row.add(user.getBindCategoryName());
             row.add(user.getStatus()?"正常":"冻结");
+            row.add(user.getIsCustomer()?user.getIsShangyong()?"是":"否":"");
             rows.add(row);
         }
 
@@ -1579,7 +1669,7 @@ public class AdminUserLogic {
         if(!adminUser.getIsCustomer()){
             //List<String> allAdminWebsitIds = adminWebsitLogic.getAllAdminWebsitIds(adminUserCom.getAdminWebsitId());
             //List<String> serviceIds = adminMapper.queryChildServiceId(allAdminWebsitIds,Constant.NOT_DEL_ROLE_YWY);
-            List<String> serviceIds = adminMapper.queryChildServiceId(adminUser.getAdminWebsitIds(),null);
+            List<String> serviceIds = adminMapper.queryChildServiceId(adminUser.getAdminWebsitIds(),null,adminUser.getAdminWebsitId());
             adminUser.setServiceIds(serviceIds);
             //添加自己
             if(CollectionUtils.isEmpty(serviceIds)) {
@@ -1590,7 +1680,6 @@ public class AdminUserLogic {
         }
         String token = CommonUtils.getToken(request);
         redisUtil.set(Constant.RedisPrefix.TOKEN_MGR + token, adminUser, 20 * 60 * 60 * 1000);
-        AdminUserCom adminUserCom = commonLogic.getAdminUser();
     }
 
     public IPage<AdminUserDto> listJiaXian(String adminWebsitId, String roleId, String customerId, Boolean isCustomer, Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
@@ -1630,7 +1719,7 @@ public class AdminUserLogic {
 
         List<String> customerNumbers = (isCustomer != null && !isCustomer) || (isMaster!= null && isMaster)?null:customerNumberS;
         IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),adminUser.getAdminCompanyIds(),adminWebsitIds,
-                userName, null,null,null, status,roleId,isMaster,null,isCustomer,roleName,websitNumber,customerNumbers,1,null);
+                userName, null,null,null, status,roleId,isMaster,null,isCustomer,null,websitNumber,customerNumbers,1,null);
 
         return adminUserIPage;
     }
@@ -1736,7 +1825,7 @@ public class AdminUserLogic {
 
         List<String> customerNumbers = (isCustomer != null && !isCustomer) || (isMaster!= null && isMaster)?null:customerNumberS;
         IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),adminUser.getAdminCompanyIds(),null,
-                userName, null,null,null, status,roleId,isMaster,null,isCustomer,roleName,websitNumber,customerNumbers,0,1);
+                userName, null,null,null, status,roleId,isMaster,null,isCustomer,null,websitNumber,customerNumbers,0,1);
 
         return adminUserIPage;
     }
@@ -1765,8 +1854,19 @@ public class AdminUserLogic {
                 .like(KingDeeCustomer::getNumber, "CUST" + byId.getNumber())
                 .orderByDesc(KingDeeCustomer::getId).count();
         int num = count+1;
+        String number = "CUST" + byId.getNumber();
+
 
-        byId.setNumber("CUST" + byId.getNumber()+(num>9?num:"0"+num));
+
+        while (true){
+            byId.setNumber(number+(num>9?num:"0"+num));
+            if (kingDeeCustomerService.lambdaQuery()
+                    .eq(KingDeeCustomer::getNumber, byId.getNumber()).count()>0) {
+                num = num +1;
+            }else {
+                break;
+            }
+        }
 
         byId.setJiaxianType(CuseromtTypeEnum.GONGCHENG.getKey());
         byId.setId(IdWorker.getIdStr());
@@ -1817,8 +1917,8 @@ public class AdminUserLogic {
 
         adminUser.setRoleName(adminRole.getName());
         adminUser.setCustomerId(byId.getId());
-        adminUser.setCustomerName(byId.getHigherPrantName());
-        adminUser.setCustomerNumber(byId.getHigherPrantNumber());
+        adminUser.setCustomerName(byId.getName());
+        adminUser.setCustomerNumber(byId.getNumber());
         adminUser.setRoleId(adminRole.getAdminRoleId());
         adminUser.setPassword(SecureUtil.md5(password));
         adminUser.setIsMaster(false);
@@ -1866,6 +1966,11 @@ public class AdminUserLogic {
         adminUser.setNickName(nickName);
         adminUser.updateById();
 
+        kingDeeCustomerService.lambdaUpdate()
+                .eq(KingDeeCustomer::getNumber,adminUser.getCustomerNumber())
+                .set(KingDeeCustomer::getName,nickName)
+                .update();
+
         customerBillLimitConfigService
                 .lambdaUpdate()
                 .eq(CustomerBillLimitConfig::getCustomerId,adminUser.getCustomerId())
@@ -1873,6 +1978,12 @@ public class AdminUserLogic {
                 .set(CustomerBillLimitConfig::getHomeLoginLimit,homeLoginLimit)
                 .set(CustomerBillLimitConfig::getSpanLoginLimit,spanLoginLimit)
                 .update();
+
+        tradeLoginOrderService
+                .lambdaUpdate()
+                .eq(TradeLoginOrder::getCustomerId,adminUser.getCustomerId())
+                .set(TradeLoginOrder::getCustomerName,nickName)
+                .update();
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -1903,4 +2014,89 @@ public class AdminUserLogic {
         adminMapper.delByUserName(userName);
 
     }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void importData(InputStream inputStream, HttpServletRequest request) {
+
+        ExcelReader reader = ExcelUtil.getReader(inputStream);
+        reader.addHeaderAlias("工程登录名额", "barCode");
+        reader.addHeaderAlias("家装登录名额", "specification");
+        reader.addHeaderAlias("跨区登录名额", "id");
+        reader.addHeaderAlias("上级经销商", "salesCompany");
+        reader.addHeaderAlias("子经销商名称", "address");
+        reader.addHeaderAlias("密码", "materialType");
+
+        List<CustomerCode> customerCodes = reader.readAll(CustomerCode.class);
+
+        for (CustomerCode customerCode : customerCodes) {
+
+            KingDeeCustomer kingDeeCustomer = kingDeeCustomerService.lambdaQuery().eq(KingDeeCustomer::getName, customerCode.getSalesCompany()).last("limit 1").one();
+
+            if (kingDeeCustomer == null)
+                throw new RemoteServiceException(customerCode.getSalesCompany());
+
+            this.addGongCheng(null,"123456",kingDeeCustomer.getId(),customerCode.getAddress(),
+                    Convert.toInt(customerCode.getBarCode()),Convert.toInt(customerCode.getSpecification()),Convert.toInt(customerCode.getId()));
+        }
+    }
+
+    public IPage<AdminUserDto> listService(String adminWebsitId, String roleId, String customerId, Boolean isCustomer, Boolean isMaster, Boolean status, String userName, Integer pageNum, Integer pageSize, HttpServletRequest request) {
+        List<String> roleName = new ArrayList<>();
+
+
+        roleName.add(Constant.NOT_DEL_SHANGYONG_ROLE_YWY);
+
+        IPage<AdminUserDto> adminUserIPage = adminMapper.mchList(new Page(pageNum, pageSize),null,null,
+                userName, null,null,null, status,roleId,isMaster,customerId,isCustomer,roleName,null,null,null,null);
+
+        return adminUserIPage;
+    }
+
+    public void addChildUserSync() {
+
+        List<AdminUser> adminUserList = adminUserService.lambdaQuery().eq(AdminUser::getIsCustomer, true)
+                .eq(AdminUser::getIsMaster, true).list();
+
+        for (AdminUser adminUser : adminUserList) {
+
+            List<AdminUser> adminUserListZi = adminUserService.lambdaQuery().eq(AdminUser::getIsCustomer, true)
+                    .eq(AdminUser::getIsMaster, false)
+                    .eq(AdminUser::getCustomerId, adminUser.getCustomerId())
+                    .list();
+
+            for (AdminUser user : adminUserListZi) {
+                //仓库权限
+                List<AdminUserStock> stocks = adminUserStockService.lambdaQuery()
+                        .eq(AdminUserStock::getAdminUserId, adminUser.getAdminUserId()).list();
+
+
+                adminUserStockService.lambdaUpdate().eq(AdminUserStock::getAdminUserId,user.getAdminUserId()).remove();
+
+                if(CollectionUtils.isNotEmpty(stocks)){
+                    for (AdminUserStock stock : stocks) {
+                        stock.setId(null);
+                        stock.setAdminUserId(user.getAdminUserId());
+                        stock.insert();
+                    }
+                }
+                //分类权限
+                List<AdminUserCategoryRela> categoryRelas = adminUserCategoryRelaService.lambdaQuery()
+                        .eq(AdminUserCategoryRela::getAdminUserId, adminUser.getAdminUserId()).list();
+
+                adminUserCategoryRelaService.lambdaUpdate()
+                        .eq(AdminUserCategoryRela::getAdminUserId, user.getAdminUserId()).remove();
+
+                if(CollectionUtils.isNotEmpty(categoryRelas)){
+                    for(AdminUserCategoryRela rela:categoryRelas){
+                        rela.setId(null);
+                        rela.setAdminUserId(user.getAdminUserId());
+                        rela.insert();
+                    }
+                }
+            }
+
+        }
+
+
+    }
 }

+ 11 - 3
src/main/java/com/zfire/mall/manager/logic/admin/NoticeLogic.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zfire.mall.manager.bean.admin.AdminUserCom;
 import com.zfire.mall.manager.bean.admin.NoticeRecordReadBean;
-import com.zfire.mall.manager.bean.listV2.ComListVO;
 import com.zfire.mall.manager.bean.listV2.NoticeRecordReadVO;
 import com.zfire.mall.manager.bean.notice.NoticeBean;
 import com.zfire.mall.manager.bean.notice.NoticeRecordBean;
@@ -30,7 +29,10 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 
 @Component
 public class NoticeLogic {
@@ -107,13 +109,19 @@ public class NoticeLogic {
 
     }
 
-    public NoticeRecordBean detail(String id){
+    public NoticeRecordBean detail(String id, Boolean isTopRead){
         NoticeRecord byId = noticeRecordService.getById(id);
         List<CommonFile> commonFiles = commonLogic.queryFileByObjId(byId.getNoticeId(), Constant.File.NOTICE);
 
         NoticeRecordBean noticeRecordBean = new NoticeRecordBean();
         BeanUtils.copyProperties(byId,noticeRecordBean);
         noticeRecordBean.setFiles(commonFiles);
+
+        if (Objects.nonNull(isTopRead) && isTopRead) {
+            byId.setIsTopRead(true)
+                    .updateById();
+        }
+
         return noticeRecordBean;
     }
 

+ 21 - 7
src/main/java/com/zfire/mall/manager/logic/common/CommonLogic.java

@@ -2,6 +2,7 @@ package com.zfire.mall.manager.logic.common;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.servlet.ServletUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -166,8 +167,21 @@ public class CommonLogic {
 
         //财务
         adminUserCom.setIsCw(adminUserCom.getRoleName().equals(Constant.NOT_DEL_ROLE_NAME2));
-        adminUserCom.setIsService(adminUserCom.getRoleName().equals(Constant.NOT_DEL_ROLE_YWY));
-        adminUserCom.setIsTradeExaminer(adminUserCom.getRoleName().equals(Constant.NOT_DEL_ROLE_SPY));
+        adminUserCom.setIsService(adminUserCom.getRoleName().equals(Constant.NOT_DEL_ROLE_YWY) || adminUserCom.getRoleName().equals(Constant.NOT_DEL_SHANGYONG_ROLE_YWY));
+        if (StrUtil.isNotBlank(adminUser.getRoleName()) ) {
+            for (String str : Constant.NOT_DEL_ROLE_SPY) {
+                if (adminUser.getRoleName().contains(str)) {
+                    adminUserCom.setIsTradeExaminer(true);
+                    break;
+                } else {
+                    adminUserCom.setIsTradeExaminer(false);
+                }
+            }
+        }
+        if (Objects.isNull(adminUserCom.getIsTradeExaminer())) {
+            adminUserCom.setIsTradeExaminer(false);
+        }
+//        adminUserCom.setIsTradeExaminer(Constant.NOT_DEL_ROLE_SPY.contains(adminUserCom.getRoleName()));
         //部门帐号
         if(adminUserCom.getType() == 0){
             adminUserCom = this.websitAccount(adminUserCom, request);
@@ -192,14 +206,14 @@ public class CommonLogic {
         if(allServiceId && !adminUser.getIsCustomer()){
             //List<String> allAdminWebsitIds = adminWebsitLogic.getAllAdminWebsitIds(adminUserCom.getAdminWebsitId());
             //List<String> serviceIds = adminMapper.queryChildServiceId(allAdminWebsitIds,Constant.NOT_DEL_ROLE_YWY);
-            List<String> serviceIds = adminMapper.queryChildServiceId(adminUserCom.getAdminWebsitIds(),null);
-            adminUserCom.setServiceIds(serviceIds);
-            //添加自己
+            //剔除掉自己部门
+            List<String> serviceIds = adminMapper.queryChildServiceId(adminUserCom.getAdminWebsitIds(),null,adminUserCom.getAdminWebsitId());
             if(CollectionUtils.isEmpty(serviceIds)) {
                 serviceIds = new ArrayList<>();
-                serviceIds.add(adminUser.getAdminUserId());
-                adminUserCom.setServiceIds(serviceIds);
             }
+            //添加自己
+            serviceIds.add(adminUser.getAdminUserId());
+            adminUserCom.setServiceIds(serviceIds);
         }
         //如果是子账号,根据主账号的权限拿业务员和仓库和品类权限
         String masterAdminUserId = adminUser.getAdminUserId();

+ 12 - 5
src/main/java/com/zfire/mall/manager/logic/customer/CustomerProductTypeLogic.java

@@ -177,11 +177,18 @@ public class CustomerProductTypeLogic {
         if(adminWebsit1 != null){
             AdminWebsit adminWebsit2 = adminWebsitService.getById(adminWebsit1.getParentId());
             if(adminWebsit2 != null) {
-                bean.setAdminWebsitId2(adminWebsit2.getAdminWebsitId());
-                if (adminWebsit2 != null) {
-                    AdminWebsit adminWebsit3 = adminWebsitService.getById(adminWebsit2.getParentId());
-                    if (adminWebsit3 != null) {
-                        bean.setAdminWebsitId1(adminWebsit3.getAdminWebsitId());
+                if (adminWebsit2.getParentId().equals("1")){
+                    bean.setAdminWebsitId1(adminWebsit2.getAdminWebsitId());
+                    bean.setAdminWebsitId2(adminWebsit1.getAdminWebsitId());
+                    bean.setAdminWebsitId3(null);
+
+                }else {
+                    bean.setAdminWebsitId2(adminWebsit2.getAdminWebsitId());
+                    if (adminWebsit2 != null) {
+                        AdminWebsit adminWebsit3 = adminWebsitService.getById(adminWebsit2.getParentId());
+                        if (adminWebsit3 != null) {
+                            bean.setAdminWebsitId1(adminWebsit3.getAdminWebsitId());
+                        }
                     }
                 }
             }

+ 7 - 0
src/main/java/com/zfire/mall/manager/logic/customer/Stagek3CustomerLogic.java

@@ -117,4 +117,11 @@ public class Stagek3CustomerLogic {
         List<CustomerPushBean> customerPushBean = commonCMapper.listPush(encrypted);
         return customerPushBean;
     }
+
+    public IPage<K3CustomerVO> listV3(ZfireParamBean zfireParamBean) {
+
+        zfireParamBean = FieldUtils.supplyParam(zfireParamBean);
+        IPage<K3CustomerVO> k3CustomerVOIPage = commonCMapper.queryListV3K3CutomerList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+        return k3CustomerVOIPage;
+    }
 }

+ 10 - 7
src/main/java/com/zfire/mall/manager/logic/displace/order/DisplaceOrderV2Logic.java

@@ -400,6 +400,7 @@ public class DisplaceOrderV2Logic {
         newItem.insert();
 
         // 订单执行记录
+        //newOrder.setCreateTime(oldOrder.getCreateTime());
         this.insertRetailOrderRecord(newOrder, execRecord, newItem, false);
 
         //新机
@@ -474,7 +475,7 @@ public class DisplaceOrderV2Logic {
                 .setOrderOperationType(OrderOperationTypeEnum.ORDER_DISPLACE.getKey())
                 .setDirection(1)
                 .setRefType("订单置换")
-                .setOrderCreateTime(DateUtil.date())
+                .setOrderCreateTime(order.getCreateTime())
                 .setCreateBy(null)
                 .setCreateTime(null));
 
@@ -525,7 +526,7 @@ public class DisplaceOrderV2Logic {
                 .setOrderOperationType(OrderOperationTypeEnum.ORDER_DISPLACE.getKey())
                 .setDirection(1)
                 .setRefType("订单置换")
-                .setOrderCreateTime(DateUtil.date())
+                .setOrderCreateTime(oldOrder.getCreateTime())
                 .setCreateBy(null)
                 .setCreateTime(null));
 
@@ -809,7 +810,8 @@ public class DisplaceOrderV2Logic {
         depositManageItem.setQty(depositManageItem.getQty() - newItem.getQty())
                 .setTotalAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getQty())))
                 .setSalesQty(depositManageItem.getSalesQty() - newItem.getQty())
-                .setSalesAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getSalesQty())));
+                .setSalesAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getSalesQty())))
+                .setDataQty(depositManageItem.getDataQty() - newItem.getQty());
 
         if (depositManageItem.getQty() > 0) {
             depositManageItem.updateById();
@@ -829,10 +831,11 @@ public class DisplaceOrderV2Logic {
                 .one();
 
         if (Objects.nonNull(newDepositManageItem)) {
-            newDepositManageItem.setQty(depositManageItem.getQty() + newItem.getQty())
-                    .setTotalAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getQty())))
-                    .setSalesQty(depositManageItem.getSalesQty() + newItem.getQty())
-                    .setSalesAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getSalesQty())))
+            newDepositManageItem.setQty(newDepositManageItem.getQty() + newItem.getQty())
+                    .setTotalAmount(newDepositManageItem.getPrice().multiply(BigDecimal.valueOf(newDepositManageItem.getQty())))
+                    .setSalesQty(newDepositManageItem.getSalesQty() + newItem.getQty())
+                    .setSalesAmount(newDepositManageItem.getPrice().multiply(BigDecimal.valueOf(newDepositManageItem.getSalesQty())))
+                    .setDataQty(newDepositManageItem.getDataQty() + newItem.getQty())
                     .updateById();
         } else {
             new DepositManageItem().setParentId(depositManage.getDepositManageId())

+ 71 - 39
src/main/java/com/zfire/mall/manager/logic/engin/deposit/DepositManageLogic.java

@@ -31,6 +31,7 @@ import com.zfire.mall.manager.enums.*;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.engin.deposit.bacth.ExamineHomeLogic;
+import com.zfire.mall.manager.logic.engin.order.EnginSysLogic;
 import com.zfire.mall.manager.logic.retail.RetailOrderLogic;
 import com.zfire.mall.manager.logic.wallet.WalletLogic;
 import com.zfire.mall.manager.plus.entity.*;
@@ -40,6 +41,7 @@ import com.zfire.mall.manager.utils.CompressDownUtil;
 import com.zfire.mall.manager.utils.oss.OSSUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.integration.redis.util.RedisLockRegistry;
@@ -91,8 +93,8 @@ public class DepositManageLogic {
     RedisLockRegistry redisLockRegistry;
     @Autowired
     OSSUtil ossUtil;
-//    @Resource
-//    EnginSysLogic enginSysLogic;
+    @Resource
+    EnginSysLogic enginSysLogic;
     @Resource
     ExamineHomeLogic examineHomeLogic;
     @Resource
@@ -238,13 +240,13 @@ public class DepositManageLogic {
         detail.setDataList(dataList);
         detail.setCheckRecordItems(checkRecords);
 
-//        List<AgencyBills> sysAgencyBills = enginSysLogic.queryBills(new ArrayList<String>() {{ this.add(detail.getRefEnginRecordNo()); }});
-//        if (CollectionUtil.isNotEmpty(sysAgencyBills)) {
-//            AgencyBills agencyBill = sysAgencyBills.get(0);
-//            if (Objects.isNull(detail.getInstallDate()) && Objects.nonNull(agencyBill.getInstallDate())) {
-//                detail.setInstallDate(agencyBill.getInstallDate());
-//            }
-//        }
+        List<AgencyBills> sysAgencyBills = enginSysLogic.queryBills(new ArrayList<String>() {{ this.add(detail.getRefEnginRecordNo()); }});
+        if (CollectionUtil.isNotEmpty(sysAgencyBills)) {
+            AgencyBills agencyBill = sysAgencyBills.get(0);
+            if (Objects.isNull(detail.getInstallDate()) && Objects.nonNull(agencyBill.getInstallDate())) {
+                detail.setInstallDate(agencyBill.getInstallDate());
+            }
+        }
 
         List<EnginOrderItem> orderItems = depositMangeReserveMapper.queryOrderHasSendQty(new ArrayList<String>() {{ this.add(detail.getRefEnginRecordNo()); }});
         Map<String, EnginOrderItem> orderItemMap = orderItems.stream()
@@ -261,8 +263,8 @@ public class DepositManageLogic {
 //                .sorted(Comparator.comparing(DepositMangeItemBean::getSalesQty).reversed())
 //                .collect(Collectors.toList());
         // 以销售数量不为0的机型靠上显示,为0的靠下显示
-        List<DepositMangeItemBean> itemBeans1 = detail.getItems().stream().filter(v -> v.getSalesQty() > 0).collect(Collectors.toList());
-        List<DepositMangeItemBean> itemBeans0 = detail.getItems().stream().filter(v -> v.getSalesQty() == 0).collect(Collectors.toList());
+        List<DepositMangeItemBean> itemBeans1 = detail.getItems().stream().filter(v -> v.getQty() > 0).collect(Collectors.toList());
+        List<DepositMangeItemBean> itemBeans0 = detail.getItems().stream().filter(v -> v.getQty() <= 0).collect(Collectors.toList());
         itemBeans1.addAll(itemBeans0);
         detail.setItems(itemBeans1);
 
@@ -464,7 +466,12 @@ public class DepositManageLogic {
         Map<String, ProductPriceBean> priceBeanMap = priceBeans.stream()
                 .collect(Collectors.toMap(v -> v.getSaleId() + "|" + v.getMaterialOldNumber(), Function.identity()));
 
-        Map<String, DepositMangeItemBean> beanMap = depositManageBean.getItems().stream()
+        // 有源
+        List<DepositMangeItemBean> sourceList = depositManageBean.getItems().stream().filter(DepositManageItem::getIsSource).collect(Collectors.toList());
+        // 无源
+        List<DepositMangeItemBean> notSourceList = depositManageBean.getItems().stream().filter(v -> !v.getIsSource()).collect(Collectors.toList());
+
+        Map<String, DepositMangeItemBean> beanMap = sourceList.stream()
                 .collect(Collectors.toMap(v -> v.getMaterialId() + "|" + v.getRealMaterialId() + "|" + v.getPrice().setScale(6), Function.identity()));
         List<ReceivableOrderItem> receivableOrderItemList = new ArrayList<>();
 
@@ -557,6 +564,13 @@ public class DepositManageLogic {
         depositManage.updateById();
 
         // 更新明细
+        if (CollectionUtil.isNotEmpty(notSourceList) && depositManageBean.isExamineResult()) {
+            for (DepositMangeItemBean bean : notSourceList) {
+                DepositManageItem item = new DepositManageItem();
+                BeanUtils.copyProperties(bean, item);
+                depositManageItems.add(item);
+            }
+        }
         depositManageItemService.saveOrUpdateBatch(depositManageItems);
 
         // 审核通过并且是退押
@@ -700,12 +714,20 @@ public class DepositManageLogic {
                         .list();
 
                 Map<String, DepositMangeItemBean> beanMap = depositManageBean.getItems().stream()
+                        .filter(v -> StringUtils.isNotBlank(v.getMaterialId()) && StringUtils.isNotBlank(v.getRealMaterialId()) && Objects.nonNull(v.getPrice()))
                         .collect(Collectors.toMap(v -> v.getMaterialId() + v.getPrice().setScale(6) + v.getRealMaterialId(), Function.identity(), (key1, key2) -> key2));
 
+                Map<String, DepositMangeItemBean> emptyBeanMap = depositManageBean.getItems().stream()
+                        .filter(v -> StringUtils.isNotBlank(v.getId()) && (StringUtils.isBlank(v.getMaterialId()) || StringUtils.isBlank(v.getRealMaterialId()) || Objects.isNull(v.getPrice())))
+                        .collect(Collectors.toMap(DepositManageItem::getId, Function.identity()));
+
                 for (DepositManageItem depositManageItem : depositManageItems) {
-                    DepositMangeItemBean itemBean = beanMap.get( depositManageItem.getMaterialId() + depositManageItem.getPrice().setScale(6) + depositManageItem.getRealMaterialId());
+                    DepositMangeItemBean itemBean = beanMap.get( depositManageItem.getMaterialId() + Optional.ofNullable(depositManageItem.getPrice()).orElse(BigDecimal.ZERO).setScale(6) + depositManageItem.getRealMaterialId());
                     if (Objects.isNull(itemBean)) {
-                        continue;
+                        itemBean = emptyBeanMap.get(depositManageItem.getId());
+                        if (Objects.isNull(itemBean)) {
+                            continue;
+                        }
                     }
                     depositManageItem.setDataQty(itemBean.getDataQty())
                             .setDiffAmount(itemBean.getDiffAmount())
@@ -748,12 +770,20 @@ public class DepositManageLogic {
                         .list();
 
                 Map<String, DepositMangeItemBean> beanMap = depositManageBean.getItems().stream()
+                        .filter(v -> StringUtils.isNotBlank(v.getMaterialId()) && StringUtils.isNotBlank(v.getRealMaterialId()) && Objects.nonNull(v.getPrice()))
                         .collect(Collectors.toMap(v -> v.getMaterialId() + v.getPrice().setScale(6) + v.getRealMaterialId(), Function.identity(), (key1, key2) -> key2));
 
+                Map<String, DepositMangeItemBean> emptyBeanMap = depositManageBean.getItems().stream()
+                        .filter(v -> StringUtils.isNotBlank(v.getId()) && (StringUtils.isBlank(v.getMaterialId()) || StringUtils.isBlank(v.getRealMaterialId()) || Objects.isNull(v.getPrice())))
+                        .collect(Collectors.toMap(DepositManageItem::getId, Function.identity()));
+
                 for (DepositManageItem depositManageItem : depositManageItems) {
                     DepositMangeItemBean itemBean = beanMap.get( depositManageItem.getMaterialId() + depositManageItem.getPrice().setScale(6) + depositManageItem.getRealMaterialId());
                     if (Objects.isNull(itemBean)) {
-                        continue;
+                        itemBean = emptyBeanMap.get(depositManageItem.getId());
+                        if (Objects.isNull(itemBean)) {
+                            continue;
+                        }
                     }
                     depositManageItem.setDataQty(itemBean.getDataQty())
                             .setDiffAmount(itemBean.getDiffAmount())
@@ -915,6 +945,7 @@ public class DepositManageLogic {
             // 查询汇总明细记录
             List<DepositManageItem> manageItems = depositManageItemService.lambdaQuery()
                     .eq(DepositManageItem::getRefEnginRecordNo, recordNo)
+                    .eq(DepositManageItem::getIsSource, 1)
                     .list();
             Map<String, DepositManageItem> manageItemMap = manageItems.stream()
                     .collect(Collectors.toMap(v -> v.getMaterialId() + "|" + v.getRealMaterialId() + "|" + v.getPrice().setScale(6), Function.identity()));
@@ -1037,6 +1068,7 @@ public class DepositManageLogic {
             // 查询汇总明细记录
             List<DepositManageItem> manageItems = depositManageItemService.lambdaQuery()
                     .eq(DepositManageItem::getRefEnginRecordNo, recordNo)
+                    .eq(DepositManageItem::getIsSource, 1)
                     .list();
 
             Map<String, DepositManageItem> manageItemMap = manageItems.stream()
@@ -1266,30 +1298,30 @@ public class DepositManageLogic {
     }
 
     public void syncEnginData(DepositManage depositManage) {
-//        List<AgencyBills> sysAgencyBills = enginSysLogic.queryBills(new ArrayList<String>() {{ this.add(depositManage.getRefEnginRecordNo()); }});
-//        if (CollectionUtil.isNotEmpty(sysAgencyBills)) {
-//            AgencyBills agencyBill = sysAgencyBills.get(0);
-//            depositManage.setRefPromiseProvide(Optional.ofNullable(agencyBill.getPromiseProvide()).orElse(0) == 0 ? "未保证" : "已保证")
-//                    .setRefPromiseAcceptStatus(agencyBill.getPromiseAcceptStatus())
-//                    .setRefPromisePriceRemark(agencyBill.getPromisePriceRemark())
-//                    .setRefFollowAcceptRemark(agencyBill.getFollowAcceptRemark())
-//                    .setRefFjShenPiRemark(agencyBill.getFjShenPiRemark())
-//                    .setRefDatumProvide(Optional.ofNullable(agencyBill.getDatumProvide()).orElse(0) == 0 ? "未提供" : "已提供")
-//                    .setRefDatumProvideDate(Objects.nonNull(agencyBill.getDatumProvideDate()) ? DateUtil.date(agencyBill.getDatumProvideDate().getTime()) : null)
-//                    .setRefDatumAcceptStatus(agencyBill.getDatumAcceptStatus())
-//                    .setRefIsBigAmounts(Optional.ofNullable(agencyBill.getIsBigAmount()).orElse(0) == 0 ? "否" : "是")
-//                    .setRefContractResult(agencyBill.getContractResult())
-//                    .setRefContractIdea(agencyBill.getContractIdea())
-//                    .setRefToRetailResult(agencyBill.getToRetailResult())
-//                    .setRefToRetailIdea(agencyBill.getToRetailIdea())
-//                    .setRefDataDelayResult(agencyBill.getDataDelayResult())
-//                    .setRefDataDelayIdea(agencyBill.getDataDelayIdea())
-//                    .setRefOtherAnnexResult(agencyBill.getOtherAnnexResult())
-//                    .setRefOtherAnnexIdea(agencyBill.getOtherAnnexIdea())
-//                    .setRefDatumAcceptDate(agencyBill.getDatumAcceptDate());
-//
-//            depositManage.updateById();
-//        }
+        List<AgencyBills> sysAgencyBills = enginSysLogic.queryBills(new ArrayList<String>() {{ this.add(depositManage.getRefEnginRecordNo()); }});
+        if (CollectionUtil.isNotEmpty(sysAgencyBills)) {
+            AgencyBills agencyBill = sysAgencyBills.get(0);
+            depositManage.setRefPromiseProvide(Optional.ofNullable(agencyBill.getPromiseProvide()).orElse(0) == 0 ? "未保证" : "已保证")
+                    .setRefPromiseAcceptStatus(agencyBill.getPromiseAcceptStatus())
+                    .setRefPromisePriceRemark(agencyBill.getPromisePriceRemark())
+                    .setRefFollowAcceptRemark(agencyBill.getFollowAcceptRemark())
+                    .setRefFjShenPiRemark(agencyBill.getFjShenPiRemark())
+                    .setRefDatumProvide(Optional.ofNullable(agencyBill.getDatumProvide()).orElse(0) == 0 ? "未提供" : "已提供")
+                    .setRefDatumProvideDate(Objects.nonNull(agencyBill.getDatumProvideDate()) ? DateUtil.date(agencyBill.getDatumProvideDate().getTime()) : null)
+                    .setRefDatumAcceptStatus(agencyBill.getDatumAcceptStatus())
+                    .setRefIsBigAmounts(Optional.ofNullable(agencyBill.getIsBigAmount()).orElse(0) == 0 ? "否" : "是")
+                    .setRefContractResult(agencyBill.getContractResult())
+                    .setRefContractIdea(agencyBill.getContractIdea())
+                    .setRefToRetailResult(agencyBill.getToRetailResult())
+                    .setRefToRetailIdea(agencyBill.getToRetailIdea())
+                    .setRefDataDelayResult(agencyBill.getDataDelayResult())
+                    .setRefDataDelayIdea(agencyBill.getDataDelayIdea())
+                    .setRefOtherAnnexResult(agencyBill.getOtherAnnexResult())
+                    .setRefOtherAnnexIdea(agencyBill.getOtherAnnexIdea())
+                    .setRefDatumAcceptDate(agencyBill.getDatumAcceptDate());
+
+            depositManage.updateById();
+        }
 
 //        List<DepositManage> depositManageList = depositManageService.lambdaQuery()
 //                .eq(DepositManage::getEnginOrderType, OrderTypeEnum.HOME.getKey())

+ 2 - 1
src/main/java/com/zfire/mall/manager/logic/engin/info/EnginInfoOrderLogic.java

@@ -379,7 +379,7 @@ public class EnginInfoOrderLogic {
                 .setPowerCategory(enginInfoOrderBean.getPowerCategory())
                 .setServiceId(enginInfoOrderBean.getServiceId())
                 .setServiceName(enginInfoOrderBean.getServiceName())
-                .setContractExpireDate(enginInfoOrderBean.getContractExpireDate())
+                .setContractExpireDate(DateUtil.parseDateTime(DateUtil.formatDate(enginInfoOrderBean.getContractExpireDate()) + " 23:59:59"))
                 .setGeLiInerNote(enginInfoOrderBean.getGeLiInerNote())
                 .setGeLiNote(enginInfoOrderBean.getGeLiNote())
                 .setFileNo(enginInfoOrderBean.getFileNo())
@@ -469,6 +469,7 @@ public class EnginInfoOrderLogic {
                                                                String confirmName,
                                                                Integer pageNum,Integer pageSize){
         AdminUserCom adminUser = commonLogic.getAdminUser();
+
         IPage<EnginInfoSaleExecBean> enginInfoSaleExecBeanIPage = enginInfoOrderReserveMapper
                 .queryEnginInfoSaleExec(new Page<>(pageNum, pageSize), startOrderDate, endOrderDate, customerId, refProjectName,
                         specification, refEnginRecordNo, serviceId,isClose,confirmName,adminUser.getServiceIds());

+ 18 - 8
src/main/java/com/zfire/mall/manager/logic/engin/order/EnginOrderLogic.java

@@ -104,8 +104,8 @@ public class EnginOrderLogic {
     InvoiceMapper invoiceMapper;
     @Resource
     ReservedOrderItemService reservedOrderItemService;
-//    @Resource
-//    EnginSysLogic enginSysLogic;
+    @Resource
+    EnginSysLogic enginSysLogic;
     @Resource
     CommonCountMapper commonCountMapper;
     @Resource
@@ -309,6 +309,9 @@ public class EnginOrderLogic {
         List<EnginOrderItem> enginOrderItems = enginOrderBean.handleAddHomeOrderItem(enginOrder);
 
         // 返利和现金钱包金额处理
+        if (Objects.isNull(enginOrder.getTakeDeposit())) {
+            enginOrder.setTakeDeposit(false);
+        }
         itemWalletHandleHome(enginOrder, enginOrderItems, "", false);
 
         // 业务员为空时默认钱包第一个业务员
@@ -818,6 +821,8 @@ public class EnginOrderLogic {
         enginOrder.setUpdateBy(CommonUtils.getUsername());
         enginOrder.setUpdateName(CommonUtils.getNickName());
         enginOrder.setIsPlanOrder(enginOrderBean.getIsPlanOrder());
+        enginOrder.setCorrespondId(enginOrderBean.getCorrespondId());
+        enginOrder.setCorrespondName(enginOrderBean.getCorrespondName());
 
         return enginOrder;
     }
@@ -1260,13 +1265,13 @@ public class EnginOrderLogic {
         invoiceRequestJson.setExamineStatus("WAIT");
         invoiceRequestJson.setAutomaticStatus(true);
         invoiceRequestJson.setSyncType(2);
-        invoiceRequestJson.setCorrespondName(enginOrder.getCorrespondName());
+        invoiceRequestJson.setCorrespondName(enginOrderServiceById.getCorrespondName());
         invoiceRequestJson.setCorrespondId(enginOrderServiceById.getCorrespondId());
         if (StringUtils.isEmpty(enginOrderServiceById.getCorrespondId()) && enginOrder.getIsPlanOrder() != null && !enginOrder.getIsPlanOrder())
             throw new RemoteServiceException("仓库为空,请选择仓库");
-        invoiceRequestJson.setCorrespondId(enginOrder.getCorrespondId());
-        invoiceRequestJson.setCustomerId(enginOrder.getCustomerId());
-        invoiceRequestJson.setCorrespondName(enginOrder.getCorrespondName());
+        invoiceRequestJson.setCorrespondId(enginOrderServiceById.getCorrespondId());
+        invoiceRequestJson.setCustomerId(enginOrderServiceById.getCustomerId());
+        invoiceRequestJson.setCorrespondName(enginOrderServiceById.getCorrespondName());
         List<InvoiceApplicationOrderRequest> invoiceApplicationOrderRequests = new ArrayList<>();
         for (EnginOrderItem orderItem : orderItems) {
             InvoiceApplicationOrderRequest invoiceApplicationOrderRequest = BeanUtil.toBean(orderItem, InvoiceApplicationOrderRequest.class);
@@ -1292,6 +1297,9 @@ public class EnginOrderLogic {
 
         InvoiceRequestJson invoiceRequestJson = new InvoiceRequestJson();
         invoiceRequestJson.setId(one.getId());
+        invoiceRequestJson.setCorrespondId(enginOrder.getCorrespondId());
+        invoiceRequestJson.setCorrespondName(enginOrder.getCorrespondName());
+        invoiceRequestJson.setId(one.getId());
         invoiceRequestJson.setRemark(enginOrder.getRemark());
         invoiceRequestJson.setExamineStatus("OK");
         List<InvoiceApplicationOrderRequest> invoiceApplicationOrderRequests = new ArrayList<>();
@@ -2044,7 +2052,7 @@ public class EnginOrderLogic {
 //                        .setCustomerWalletNumber(orderItem.getCustomerWalletNumber())
 //                        .setCustomerWalletName(orderItem.getCustomerWalletName())
 //                        .setTax(orderItem.getTax())
-                        .setDataQty(depositManageItem.getDataQty() + depositManageItem.getQty())
+                        .setDataQty(depositManageItem.getDataQty() + orderItem.getQty())
                         .setSalesQty(depositManageItem.getSalesQty() + orderItem.getQty())
                         .setSalesAmount(depositManageItem.getSalesAmount().add(orderItem.getPayAmount()));
             }
@@ -2422,7 +2430,9 @@ public class EnginOrderLogic {
 
             depositManageItem.setQty(depositManageItem.getQty() - orderItem.getQty())
                     .setTotalAmount(orderItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getQty())))
-                    .setDataQty(depositManageItem.getDataQty() - orderItem.getQty());
+                    .setDataQty(depositManageItem.getDataQty() - orderItem.getQty())
+                    .setSalesQty(depositManageItem.getSalesQty() - orderItem.getQty())
+                    .setSalesAmount(depositManageItem.getPrice().multiply(BigDecimal.valueOf(depositManageItem.getSalesQty())));;
 
             depositManageItems.add(depositManageItem);
             totalQty = totalQty + orderItem.getQty();

+ 270 - 270
src/main/java/com/zfire/mall/manager/logic/engin/order/EnginSysLogic.java

@@ -1,279 +1,279 @@
-//package com.zfire.mall.manager.logic.engin.order;
-//
-//import cn.hutool.core.collection.CollectionUtil;
-//import com.baomidou.mybatisplus.core.metadata.IPage;
-//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-//import com.zfire.mall.manager.bean.admin.AdminUserCom;
-//import com.zfire.mall.manager.bean.engin.order.EnginOrderBean;
-//import com.zfire.mall.manager.bean.engin.order.EnginOrderListBean;
-//import com.zfire.mall.manager.bean.retail.ProductPriceBean;
-//import com.zfire.mall.manager.commonmapper.engin.order.EnginOrderReserveMapper;
-//import com.zfire.mall.manager.datasource.engin.entity.AgencyBills;
-//import com.zfire.mall.manager.datasource.engin.entity.AgencyBillsBean;
-//import com.zfire.mall.manager.datasource.engin.entity.Machine4Agency;
-//import com.zfire.mall.manager.datasource.engin.logic.AgencyBillsLogic;
-//import com.zfire.mall.manager.enums.OrderTypeEnum;
-//import com.zfire.mall.manager.exception.RemoteServiceException;
-//import com.zfire.mall.manager.logic.admin.AdminUserLogic;
-//import com.zfire.mall.manager.logic.common.CommonLogic;
-//import com.zfire.mall.manager.logic.retail.RetailOrderLogic;
-//import com.zfire.mall.manager.logic.wallet.WalletLogic;
-//import com.zfire.mall.manager.plus.entity.AdminUser;
-//import com.zfire.mall.manager.plus.entity.EnginOrder;
-//import com.zfire.mall.manager.plus.entity.EnginOrderItem;
-//import com.zfire.mall.manager.plus.entity.SaleType;
-//import com.zfire.mall.manager.plus.service.*;
-//import com.zfire.mall.manager.utils.JiaSMUtil;
-//import lombok.extern.slf4j.Slf4j;
-//import org.apache.commons.lang3.StringUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Service;
-//
-//import javax.annotation.Resource;
-//import java.util.*;
-//import java.util.function.Function;
-//import java.util.stream.Collectors;
-//
-//@Service
-//@Slf4j
-//public class EnginSysLogic {
-//
-//    @Value("${spring.profiles.active}")
-//    private String profiles;
-//
-////    @Value("${engin.url}")
-////    private String enginUrl;
-//    @Resource
-//    CommonLogic commonLogic;
-//    @Resource
-//    KingDeeMaterialService kingDeeMaterialService;
-//    @Resource
-//    KingDeeCustomerService kingDeeCustomerService;
-//    @Resource
-//    SaleTypeService saleTypeService;
-//    @Resource
-//    WalletLogic walletLogic;
-//    @Resource
-//    EnginOrderLogic enginOrderLogic;
-//    @Resource
-//    RetailOrderLogic retailOrderLogic;
-//    @Autowired
-//    AdminUserService adminUserService;
-//    @Resource
-//    AgencyBillsLogic agencyBillsLogic;
-//    @Resource
-//    AdminUserLogic adminUserLogic;
-//    @Resource
-//    EnginOrderReserveMapper enginOrderReserveMapper;
-//    @Resource
-//    EnginOrderItemService enginOrderItemService;
-//
-//
-//    public IPage<AgencyBills> listPage(String recordNo, String projectName, String useUnit,
-//                                       Integer pageNum, Integer pageSize) {
-//        AdminUserCom adminUser = commonLogic.getAdminUser();
-////        if (!adminUser.getIsCustomer()) {
-////            throw new RemoteServiceException("当前账号不是经销商,请使用经销商登录操作单据");
-////        }
-//        AdminUser adminUserNew = adminUserService.getById(adminUser.getAdminUserId());
-//        if (!adminUserNew.getBindEngin()) {
-//            throw new RemoteServiceException("当前经销商,未绑定工程系统账号");
+package com.zfire.mall.manager.logic.engin.order;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zfire.mall.manager.bean.admin.AdminUserCom;
+import com.zfire.mall.manager.bean.engin.order.EnginOrderBean;
+import com.zfire.mall.manager.bean.engin.order.EnginOrderListBean;
+import com.zfire.mall.manager.bean.retail.ProductPriceBean;
+import com.zfire.mall.manager.commonmapper.engin.order.EnginOrderReserveMapper;
+import com.zfire.mall.manager.datasource.engin.entity.AgencyBills;
+import com.zfire.mall.manager.datasource.engin.entity.AgencyBillsBean;
+import com.zfire.mall.manager.datasource.engin.entity.Machine4Agency;
+import com.zfire.mall.manager.datasource.engin.logic.AgencyBillsLogic;
+import com.zfire.mall.manager.enums.OrderTypeEnum;
+import com.zfire.mall.manager.exception.RemoteServiceException;
+import com.zfire.mall.manager.logic.admin.AdminUserLogic;
+import com.zfire.mall.manager.logic.common.CommonLogic;
+import com.zfire.mall.manager.logic.retail.RetailOrderLogic;
+import com.zfire.mall.manager.logic.wallet.WalletLogic;
+import com.zfire.mall.manager.plus.entity.AdminUser;
+import com.zfire.mall.manager.plus.entity.EnginOrder;
+import com.zfire.mall.manager.plus.entity.EnginOrderItem;
+import com.zfire.mall.manager.plus.entity.SaleType;
+import com.zfire.mall.manager.plus.service.*;
+import com.zfire.mall.manager.utils.JiaSMUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+public class EnginSysLogic {
+
+    @Value("${spring.profiles.active}")
+    private String profiles;
+
+    @Value("${engin.url}")
+    private String enginUrl;
+    @Resource
+    CommonLogic commonLogic;
+    @Resource
+    KingDeeMaterialService kingDeeMaterialService;
+    @Resource
+    KingDeeCustomerService kingDeeCustomerService;
+    @Resource
+    SaleTypeService saleTypeService;
+    @Resource
+    WalletLogic walletLogic;
+    @Resource
+    EnginOrderLogic enginOrderLogic;
+    @Resource
+    RetailOrderLogic retailOrderLogic;
+    @Autowired
+    AdminUserService adminUserService;
+    @Resource
+    AgencyBillsLogic agencyBillsLogic;
+    @Resource
+    AdminUserLogic adminUserLogic;
+    @Resource
+    EnginOrderReserveMapper enginOrderReserveMapper;
+    @Resource
+    EnginOrderItemService enginOrderItemService;
+
+
+    public IPage<AgencyBills> listPage(String recordNo, String projectName, String useUnit,
+                                       Integer pageNum, Integer pageSize) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+//        if (!adminUser.getIsCustomer()) {
+//            throw new RemoteServiceException("当前账号不是经销商,请使用经销商登录操作单据");
 //        }
-//
-////        HashMap<String, Object> paramMap = new HashMap<>();
-////        if (profiles.equals("dev")) {
-////            paramMap.put("userName", "test002");
-////            paramMap.put("userIds", Arrays.asList("266","268"));
-////        } else {
-////            paramMap.put("userName", adminUserNew.getEnginUserName());
-////            paramMap.put("userIds", adminUser.getEnginUserIds());
-////        }
-////        paramMap.put("recordNo", recordNo);
-////        paramMap.put("projectName", projectName);
-////        paramMap.put("useUnit", useUnit);
-////        paramMap.put("pageNum", pageNum);
-////        paramMap.put("pageSize", pageSize);
-//
-////        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/queryAgencyBills", paramMap);
-////
-////        JSONObject data = this.CommonHandleInfo(jsonStr);
-////
-////        return JSONUtil.toBean(data, new TypeReference<Page<EnginSysAgencyBills>>() {
-////        }, false);
-//
-//        return agencyBillsLogic.queryAllowAgencyBills(adminUserNew.getEnginUserName(), recordNo, projectName, useUnit, pageNum, pageSize);
-//    }
-//
-//    public AgencyBillsBean findBills(String saleTypeId, String recordNo, String userId, String enginOrderId, String customerId) {
-//        AdminUserCom adminUser = commonLogic.getAdminUser();
-//
-//        if (!adminUser.getBindEngin()) {
-//            throw new RemoteServiceException("当前帐号,未绑定工程系统帐号");
+        AdminUser adminUserNew = adminUserService.getById(adminUser.getAdminUserId());
+        if (!adminUserNew.getBindEngin()) {
+            throw new RemoteServiceException("当前经销商,未绑定工程系统账号");
+        }
+
+//        HashMap<String, Object> paramMap = new HashMap<>();
+//        if (profiles.equals("dev")) {
+//            paramMap.put("userName", "test002");
+//            paramMap.put("userIds", Arrays.asList("266","268"));
+//        } else {
+//            paramMap.put("userName", adminUserNew.getEnginUserName());
+//            paramMap.put("userIds", adminUser.getEnginUserIds());
 //        }
-//
-//        SaleType saleType = saleTypeService.getById(saleTypeId);
-//        if (Objects.isNull(saleType)) {
-//            throw new RemoteServiceException("销售类型不存在");
-//        }
-//
-//        // 查询引用单号历史
-//        EnginOrderBean enginOrderBean = new EnginOrderBean();
-//        enginOrderBean.setEnginOrderId(enginOrderId);
-//        enginOrderBean.setAdminCompanyId(adminUser.getAdminCompanyId());
-//        enginOrderBean.setRefEnginRecordNo(recordNo);
-//        enginOrderBean.setEnginOrderType(OrderTypeEnum.HOME.getKey());
-//        enginOrderBean.setCustomerId(StringUtils.isNotBlank(customerId) ? customerId : adminUser.getCustomerId());
-//        Integer refCount = enginOrderLogic.checkEnginOrderRecord(enginOrderBean);
-//        enginOrderBean.setRefCount(refCount);
-//
-//        AgencyBillsBean bills = this.reqFindBills(recordNo, userId);
-//        Integer canUseCount = Objects.isNull(bills.getCanUse()) ? 1 : bills.getCanUse();
-//
-//        if (refCount >= canUseCount) {
-//            throw new RemoteServiceException(recordNo + ":无法再引用,已达最大引用次数" + canUseCount);
+//        paramMap.put("recordNo", recordNo);
+//        paramMap.put("projectName", projectName);
+//        paramMap.put("useUnit", useUnit);
+//        paramMap.put("pageNum", pageNum);
+//        paramMap.put("pageSize", pageSize);
+
+//        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/queryAgencyBills", paramMap);
+//
+//        JSONObject data = this.CommonHandleInfo(jsonStr);
+//
+//        return JSONUtil.toBean(data, new TypeReference<Page<EnginSysAgencyBills>>() {
+//        }, false);
+
+        return agencyBillsLogic.queryAllowAgencyBills(adminUserNew.getEnginUserName(), recordNo, projectName, useUnit, pageNum, pageSize);
+    }
+
+    public AgencyBillsBean findBills(String saleTypeId, String recordNo, String userId, String enginOrderId, String customerId) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        if (!adminUser.getBindEngin()) {
+            throw new RemoteServiceException("当前帐号,未绑定工程系统帐号");
+        }
+
+        SaleType saleType = saleTypeService.getById(saleTypeId);
+        if (Objects.isNull(saleType)) {
+            throw new RemoteServiceException("销售类型不存在");
+        }
+
+        // 查询引用单号历史
+        EnginOrderBean enginOrderBean = new EnginOrderBean();
+        enginOrderBean.setEnginOrderId(enginOrderId);
+        enginOrderBean.setAdminCompanyId(adminUser.getAdminCompanyId());
+        enginOrderBean.setRefEnginRecordNo(recordNo);
+        enginOrderBean.setEnginOrderType(OrderTypeEnum.HOME.getKey());
+        enginOrderBean.setCustomerId(StringUtils.isNotBlank(customerId) ? customerId : adminUser.getCustomerId());
+        Integer refCount = enginOrderLogic.checkEnginOrderRecord(enginOrderBean);
+        enginOrderBean.setRefCount(refCount);
+
+        AgencyBillsBean bills = this.reqFindBills(recordNo, userId);
+        Integer canUseCount = Objects.isNull(bills.getCanUse()) ? 1 : bills.getCanUse();
+
+        if (refCount >= canUseCount) {
+            throw new RemoteServiceException(recordNo + ":无法再引用,已达最大引用次数" + canUseCount);
+        }
+
+        bills.setSaleTypeId(saleType.getId());
+        bills.setSaleTypeCode(saleType.getSaleCode());
+        bills.setSaleTypeName(saleType.getSaleName());
+
+        queryItemDataHandle(bills, enginOrderBean, refCount, saleType);
+
+        return bills;
+    }
+
+    private void queryItemDataHandle(AgencyBillsBean bills, EnginOrderBean enginOrderBean, Integer refCount, SaleType saleType) {
+        List<String> oldNumbers = bills.getItems().stream()
+                .map(Machine4Agency::getCode)
+                .collect(Collectors.toList());
+        // 获取产品价格列表
+        IPage<ProductPriceBean> productPricePage = retailOrderLogic.queryProductList(null, null, null, null, null, null, null, enginOrderBean.getCustomerId(), oldNumbers, OrderTypeEnum.HOME.getKey(), 1, -1);
+        List<ProductPriceBean> records = productPricePage.getRecords();
+        Map<String, ProductPriceBean> priceBeanMap = records.stream()
+                .collect(Collectors.toMap(v -> v.getSaleCode() + v.getMaterialOldNumber(), Function.identity(), (key1, key2) -> key1));
+
+        for (Machine4Agency billsItem : bills.getItems()) {
+            ProductPriceBean priceBean = priceBeanMap.get(bills.getSaleTypeCode() + billsItem.getCode());
+            if (Objects.isNull(priceBean)) {
+                throw new RemoteServiceException(billsItem.getCode() + billsItem.getMachine() + ":没有找到关联价格产品");
+            }
+            billsItem.setUseRefCount(refCount);
+            billsItem.setSaleTypeId(saleType.getId());
+            billsItem.setSaleTypeCode(saleType.getSaleCode());
+            billsItem.setSaleTypeName(saleType.getSaleName());
+            billsItem.setMaterialId(priceBean.getMaterialId());
+            billsItem.setMaterialNumber(priceBean.getMaterialNumber());
+            billsItem.setMaterialOldNumber(priceBean.getMaterialOldNumber());
+            billsItem.setMaterialName(priceBean.getMaterialName());
+            billsItem.setSpecification(priceBean.getSpecification());
+            billsItem.setUnit(priceBean.getBaseUnit());
+
+            if (CollectionUtil.isEmpty(billsItem.getCustomerWalletList())) {
+                billsItem.setCustomerWalletList(new ArrayList<>());
+            }
+            billsItem.getCustomerWalletList().addAll(priceBean.getRebateWallets());
+            billsItem.getCustomerWalletList().addAll(priceBean.getWallets());
+        }
+    }
+
+    public AgencyBillsBean reqFindBills(String recordNo, String userId) {
+//        HashMap<String, Object> paramMap = new HashMap<>();
+//
+//        paramMap.put("userId", userId);
+//        paramMap.put("recordNo", recordNo);
+//
+//        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/findAgencyBills", paramMap);
+//
+//        JSONObject data = this.CommonHandleInfo(jsonStr);
+//
+//        EnginSysAgencyBills enginSysAgencyBills = JSONUtil.toBean(data, new TypeReference<EnginSysAgencyBills>() {
+//        }, true);
+//
+//        if (Objects.isNull(enginSysAgencyBills)) {
+//            throw new RemoteServiceException(recordNo + ":单据不存在");
 //        }
-//
-//        bills.setSaleTypeId(saleType.getId());
-//        bills.setSaleTypeCode(saleType.getSaleCode());
-//        bills.setSaleTypeName(saleType.getSaleName());
-//
-//        queryItemDataHandle(bills, enginOrderBean, refCount, saleType);
-//
-//        return bills;
-//    }
-//
-//    private void queryItemDataHandle(AgencyBillsBean bills, EnginOrderBean enginOrderBean, Integer refCount, SaleType saleType) {
-//        List<String> oldNumbers = bills.getItems().stream()
-//                .map(Machine4Agency::getCode)
-//                .collect(Collectors.toList());
-//        // 获取产品价格列表
-//        IPage<ProductPriceBean> productPricePage = retailOrderLogic.queryProductList(null, null, null, null, null, null, null, enginOrderBean.getCustomerId(), oldNumbers, OrderTypeEnum.HOME.getKey(), 1, -1);
-//        List<ProductPriceBean> records = productPricePage.getRecords();
-//        Map<String, ProductPriceBean> priceBeanMap = records.stream()
-//                .collect(Collectors.toMap(v -> v.getSaleCode() + v.getMaterialOldNumber(), Function.identity(), (key1, key2) -> key1));
-//
-//        for (Machine4Agency billsItem : bills.getItems()) {
-//            ProductPriceBean priceBean = priceBeanMap.get(bills.getSaleTypeCode() + billsItem.getCode());
-//            if (Objects.isNull(priceBean)) {
-//                throw new RemoteServiceException(billsItem.getCode() + billsItem.getMachine() + ":没有找到关联价格产品");
+
+        return agencyBillsLogic.findBills(recordNo, userId);
+    }
+
+//    private JSONObject CommonHandleInfo(String jsonStr) {
+//        try {
+//            if (StringUtils.isBlank(jsonStr)) {
+//                throw new RemoteServiceException("工程机系统返回数据异常");
 //            }
-//            billsItem.setUseRefCount(refCount);
-//            billsItem.setSaleTypeId(saleType.getId());
-//            billsItem.setSaleTypeCode(saleType.getSaleCode());
-//            billsItem.setSaleTypeName(saleType.getSaleName());
-//            billsItem.setMaterialId(priceBean.getMaterialId());
-//            billsItem.setMaterialNumber(priceBean.getMaterialNumber());
-//            billsItem.setMaterialOldNumber(priceBean.getMaterialOldNumber());
-//            billsItem.setMaterialName(priceBean.getMaterialName());
-//            billsItem.setSpecification(priceBean.getSpecification());
-//            billsItem.setUnit(priceBean.getBaseUnit());
+//            log.info("工程机返回数据:{}", jsonStr);
+//            JSONObject result = JSONUtil.parseObj(jsonStr);
 //
-//            if (CollectionUtil.isEmpty(billsItem.getCustomerWalletList())) {
-//                billsItem.setCustomerWalletList(new ArrayList<>());
+//            if (result.get("status", Integer.class) != 1) {
+//                throw new RemoteServiceException(result.get("msg", String.class));
 //            }
-//            billsItem.getCustomerWalletList().addAll(priceBean.getRebateWallets());
-//            billsItem.getCustomerWalletList().addAll(priceBean.getWallets());
-//        }
-//    }
-//
-//    public AgencyBillsBean reqFindBills(String recordNo, String userId) {
-////        HashMap<String, Object> paramMap = new HashMap<>();
-////
-////        paramMap.put("userId", userId);
-////        paramMap.put("recordNo", recordNo);
-////
-////        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/findAgencyBills", paramMap);
-////
-////        JSONObject data = this.CommonHandleInfo(jsonStr);
-////
-////        EnginSysAgencyBills enginSysAgencyBills = JSONUtil.toBean(data, new TypeReference<EnginSysAgencyBills>() {
-////        }, true);
-////
-////        if (Objects.isNull(enginSysAgencyBills)) {
-////            throw new RemoteServiceException(recordNo + ":单据不存在");
-////        }
-//
-//        return agencyBillsLogic.findBills(recordNo, userId);
-//    }
-//
-////    private JSONObject CommonHandleInfo(String jsonStr) {
-////        try {
-////            if (StringUtils.isBlank(jsonStr)) {
-////                throw new RemoteServiceException("工程机系统返回数据异常");
-////            }
-////            log.info("工程机返回数据:{}", jsonStr);
-////            JSONObject result = JSONUtil.parseObj(jsonStr);
-////
-////            if (result.get("status", Integer.class) != 1) {
-////                throw new RemoteServiceException(result.get("msg", String.class));
-////            }
-////
-////            return result.get("data", JSONObject.class);
-////        } catch (NullPointerException e) {
-////            throw new RemoteServiceException("工程机系统通信异常");
-////        }
-////    }
-//
-//    public void updEngineSystemBill(EnginOrder enginOrder, List<EnginOrderItem> orderItems) {
-////        List<Machine4Agency> items = new ArrayList<>();
-////        for (EnginOrderItem orderItem : orderItems) {
-////            Machine4Agency machine4Agency = new Machine4Agency();
-////            machine4Agency.setCode(orderItem.getMaterialOldNumber());
-////            machine4Agency.setHasDeliverQty(orderItem.getQty());
-////            items.add(machine4Agency);
-////        }
 //
-////        HashMap<String, Object> paramMap = new HashMap<>();
-////        if (profiles.equals("dev")) {
-////            paramMap.put("userId", "268");
-////        } else {
-////            paramMap.put("userId", enginOrder.getEnginUserName());
-////        }
-////        paramMap.put("recordNo", enginOrder.getRefEnginRecordNo());
-////        paramMap.put("items", items);
-//
-////        String reqStr = JSONUtil.toJsonStr(paramMap);
-////        log.info("send engine system data:{}", reqStr);
-////        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/updateBill", reqStr);
-////
-////        this.CommonHandleInfo(jsonStr);
-//        agencyBillsLogic.updateAgencyBillsStatus(enginOrder.getEnginUserName(), enginOrder.getRefEnginRecordNo());
-//    }
-//
-//    public List<AgencyBills> queryBills(Collection<String> bills) {
-////        HashMap<String, Object> paramMap = new HashMap<>();
-////        paramMap.put("bills", bills);
-////
-////        String jsonStr = HttpUtil.get(enginUrl.replace("sysadmin", "") + "api/supply/queryBills", paramMap);
-////
-////        this.CommonHandleInfo(jsonStr);
-////
-////        JSONObject result = JSONUtil.parseObj(jsonStr);
-////        JSONArray data = result.getJSONArray("data");
-////
-////        return JSONUtil.toBean(data, new TypeReference<List<EnginSysAgencyBills>>() {
-////        }, true);
-//        return agencyBillsLogic.queryBills(bills);
-//    }
-//
-//    public IPage<EnginOrderListBean> platformQueryList(String userName, String password, String timestamp, String sign,
-//                                                       String recordNo, String orderNo, String useUnit, String specs,
-//                                                       String realModel, String address, String orderType, Integer pageNum, Integer pageSize) {
-//        AdminUser adminUser = adminUserLogic.checkPlatformBind(userName, password, timestamp, sign);
-//
-//        return enginOrderReserveMapper.platformQueryList(new Page<>(pageNum, pageSize), recordNo, orderNo, useUnit,
-//                specs, realModel, address, orderType);
-//    }
-//
-//    public void platformRef(String recordNo, String itemId, Boolean isRef, String timestamp, String sign) {
-//        String newSign = JiaSMUtil.jiasmDigest(recordNo, timestamp);
-//        if (!sign.equals(newSign) || Objects.isNull(isRef)) {
-//            throw new RemoteServiceException("请求不合法");
+//            return result.get("data", JSONObject.class);
+//        } catch (NullPointerException e) {
+//            throw new RemoteServiceException("工程机系统通信异常");
 //        }
-//        enginOrderItemService.lambdaUpdate()
-//                .set(EnginOrderItem::getPlatformRef, isRef)
-//                .eq(EnginOrderItem::getRefEnginRecordNo, recordNo)
-//                .eq(EnginOrderItem::getId, itemId);
 //    }
-//}
+
+    public void updEngineSystemBill(EnginOrder enginOrder, List<EnginOrderItem> orderItems) {
+//        List<Machine4Agency> items = new ArrayList<>();
+//        for (EnginOrderItem orderItem : orderItems) {
+//            Machine4Agency machine4Agency = new Machine4Agency();
+//            machine4Agency.setCode(orderItem.getMaterialOldNumber());
+//            machine4Agency.setHasDeliverQty(orderItem.getQty());
+//            items.add(machine4Agency);
+//        }
+
+//        HashMap<String, Object> paramMap = new HashMap<>();
+//        if (profiles.equals("dev")) {
+//            paramMap.put("userId", "268");
+//        } else {
+//            paramMap.put("userId", enginOrder.getEnginUserName());
+//        }
+//        paramMap.put("recordNo", enginOrder.getRefEnginRecordNo());
+//        paramMap.put("items", items);
+
+//        String reqStr = JSONUtil.toJsonStr(paramMap);
+//        log.info("send engine system data:{}", reqStr);
+//        String jsonStr = HttpUtil.post(enginUrl.replace("sysadmin", "") + "api/supply/updateBill", reqStr);
+//
+//        this.CommonHandleInfo(jsonStr);
+        agencyBillsLogic.updateAgencyBillsStatus(enginOrder.getEnginUserName(), enginOrder.getRefEnginRecordNo());
+    }
+
+    public List<AgencyBills> queryBills(Collection<String> bills) {
+//        HashMap<String, Object> paramMap = new HashMap<>();
+//        paramMap.put("bills", bills);
+//
+//        String jsonStr = HttpUtil.get(enginUrl.replace("sysadmin", "") + "api/supply/queryBills", paramMap);
+//
+//        this.CommonHandleInfo(jsonStr);
+//
+//        JSONObject result = JSONUtil.parseObj(jsonStr);
+//        JSONArray data = result.getJSONArray("data");
+//
+//        return JSONUtil.toBean(data, new TypeReference<List<EnginSysAgencyBills>>() {
+//        }, true);
+        return agencyBillsLogic.queryBills(bills);
+    }
+
+    public IPage<EnginOrderListBean> platformQueryList(String userName, String password, String timestamp, String sign,
+                                                       String recordNo, String orderNo, String useUnit, String specs,
+                                                       String realModel, String address, String orderType, Integer pageNum, Integer pageSize) {
+        AdminUser adminUser = adminUserLogic.checkPlatformBind(userName, password, timestamp, sign);
+
+        return enginOrderReserveMapper.platformQueryList(new Page<>(pageNum, pageSize), adminUser.getAdminUserId(), adminUser.getCustomerId(), recordNo, orderNo, useUnit,
+                specs, realModel, address, orderType);
+    }
+
+    public void platformRef(String recordNo, String itemId, Boolean isRef, String timestamp, String sign) {
+        String newSign = JiaSMUtil.jiasmDigest(recordNo, timestamp);
+        if (!sign.equals(newSign) || Objects.isNull(isRef)) {
+            throw new RemoteServiceException("请求不合法");
+        }
+        enginOrderItemService.lambdaUpdate()
+                .set(EnginOrderItem::getPlatformRef, isRef)
+                .eq(EnginOrderItem::getRefEnginRecordNo, recordNo)
+                .eq(EnginOrderItem::getId, itemId);
+    }
+}

+ 4 - 1
src/main/java/com/zfire/mall/manager/logic/engin/v2/info/EnginInfoOrderV2Logic.java

@@ -74,6 +74,9 @@ public class EnginInfoOrderV2Logic {
                     .setValue(adminUser.getServiceIds()));
         }
         FieldUtils.supplyParam(zfireParamBean);
-        return enginInfoOrderReserveMapper.v2ExecListPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+
+        Integer total = enginInfoOrderReserveMapper.v2ExecListTotal(zfireParamBean);
+
+        return enginInfoOrderReserveMapper.v2ExecListPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize(),total,false), zfireParamBean);
     }
 }

+ 51 - 51
src/main/java/com/zfire/mall/manager/logic/external/ExternalEnginLogic.java

@@ -1,51 +1,51 @@
-//package com.zfire.mall.manager.logic.external;
-//
-//import cn.hutool.http.HttpUtil;
-//import com.alibaba.fastjson.JSONObject;
-//import com.zfire.mall.manager.exception.RemoteServiceException;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.HashMap;
-//import java.util.Map;
-//
-///**
-// * 第三方系统/外部系统对接
-// *  工程机系统服务
-// */
-//@Slf4j
-//@Service
-//public class ExternalEnginLogic {
-//
-//    @Value("${engin.user.check.url}")
-//    private String enginUserCheckUrl;
-//    @Value("${engin.user.login.url}")
-//    private String enginUserLoginUrl;
-//
-//    /**
-//     * 检查工程机帐号密码是否正确
-//     * @param userName
-//     * @param password
-//     * @return
-//     */
-//    public Integer checkEnginUser(String userName, String password){
-//        Map<String,Object> map = new HashMap<>();
-//        map.put("username",userName);
-//        map.put("password",password);
-//        log.info("【工程机系统帐号验证】request:"+JSONObject.toJSONString(map));
-//        String post = HttpUtil.post(enginUserCheckUrl, map);
-//        JSONObject result = JSONObject.parseObject(post);
-//        log.info("【工程机系统帐号验证】response:"+result);
-//        if(!result.get("code").toString().equals("200")){
-//            throw new RemoteServiceException(4444,"工程机系统认证失败");
-//        }
-//        return result.getInteger("data");
-//    }
-//
-//
-//    public String getLoginUrl(){
-//        return this.enginUserLoginUrl;
-//    }
-//
-//}
+package com.zfire.mall.manager.logic.external;
+
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.zfire.mall.manager.exception.RemoteServiceException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 第三方系统/外部系统对接
+ *  工程机系统服务
+ */
+@Slf4j
+@Service
+public class ExternalEnginLogic {
+
+    @Value("${engin.user.check.url}")
+    private String enginUserCheckUrl;
+    @Value("${engin.user.login.url}")
+    private String enginUserLoginUrl;
+
+    /**
+     * 检查工程机帐号密码是否正确
+     * @param userName
+     * @param password
+     * @return
+     */
+    public Integer checkEnginUser(String userName, String password){
+        Map<String,Object> map = new HashMap<>();
+        map.put("username",userName);
+        map.put("password",password);
+        log.info("【工程机系统帐号验证】request:"+JSONObject.toJSONString(map));
+        String post = HttpUtil.post(enginUserCheckUrl, map);
+        JSONObject result = JSONObject.parseObject(post);
+        log.info("【工程机系统帐号验证】response:"+result);
+        if(!result.get("code").toString().equals("200")){
+            throw new RemoteServiceException(4444,"工程机系统认证失败");
+        }
+        return result.getInteger("data");
+    }
+
+
+    public String getLoginUrl(){
+        return this.enginUserLoginUrl;
+    }
+
+}

+ 208 - 19
src/main/java/com/zfire/mall/manager/logic/invoice/InvoiceLogic.java

@@ -19,6 +19,7 @@ import com.zfire.mall.manager.constant.Constant;
 import com.zfire.mall.manager.constant.KingDeeCons;
 import com.zfire.mall.manager.enums.ExamineStatusEnum;
 import com.zfire.mall.manager.enums.InvoiceCustomerEnum;
+import com.zfire.mall.manager.enums.IsEnum;
 import com.zfire.mall.manager.exception.RemoteServiceException;
 import com.zfire.mall.manager.logic.common.CommonLogic;
 import com.zfire.mall.manager.logic.customer.CustomerProductTypeLogic;
@@ -49,6 +50,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 import java.util.stream.Collectors;
 
@@ -184,6 +186,15 @@ public class InvoiceLogic {
     @Autowired
     RedisLockRegistry redisLockRegistry;
 
+    @Autowired
+    StockForceCategoryService stockForceCategoryService;
+
+    @Autowired
+    StockForceService stockForceService;
+
+    @Autowired
+    AdminUserForceStockService adminUserForceStockService;
+
 
     public IPage<InvoiceBean> list(Integer automaticStatus, String createBy, String approvalName, String categoryId, String k3ServiceId, String mainOrderId, String id, String categoryName, Integer type, String customerName, String correspondId, String correspondName, String materialName, String specification, String startTime, String endTime,
                                    String customerNumber, String examineStatus, String orderType, Integer pageNum, Integer pageSize, String serviceId) {
@@ -219,6 +230,7 @@ public class InvoiceLogic {
         //1查看发货单即时库存是否充足
         checkAdd(invoiceRequest.getOrders(), invoiceRequest.getCorrespondId(), invoiceRequest.getExamineStatus(),invoiceRequest.getCustomerId());
 
+
         //查询仓库是否符合
         List<String> collect = invoiceRequest.getOrders().stream().map(InvoiceApplicationOrderRequest::getMaterialId).collect(Collectors.toList());
         checkStock(invoiceRequest.getCorrespondId(),collect);
@@ -258,6 +270,7 @@ public class InvoiceLogic {
         //添加产品明细
         for (InvoiceApplicationOrder order : invoiceRequest.getOrders()) {
 
+
             if (order.getInvoiceNum() == null || order.getInvoiceNum().equals(0))
                 continue;
             if (order.getInvoiceNum() < 0)
@@ -272,6 +285,10 @@ public class InvoiceLogic {
                 RetailOrder retailOrder = retailOrderService.getById(order.getMainOrderId());
                 RetailOrderItem retailOrderItem = retailOrderItemService.getById(order.getOrderId());
 
+                if (retailOrderItem.getQty() < (retailOrderItem.getRefundableQty()+retailOrderItem.getHasSendQty()))
+                    throw new RemoteServiceException("可退数量大于了订单数量!");
+
+
                 if (!retailOrder.getExamineStatus().equals(ExamineStatusEnum.OK.getKey()) && retailOrder.getIsPlanOrder())
                     throw new RemoteServiceException("订单不属于审核状态,无法发货");
 
@@ -282,6 +299,29 @@ public class InvoiceLogic {
 
                 map.put(kingDeeMaterial.getCategoryNumber(),kingDeeMaterial.getCategoryName());
 
+
+                if (adminUser.getIsCustomer() && adminUserForceStockService.lambdaQuery()
+                        .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(AdminUserForceStock::getCorrespondId,invoiceRequest.getCorrespondId())
+                        .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                        .count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<AdminUserForceStock> list = adminUserForceStockService.lambdaQuery()
+                            .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .ne(AdminUserForceStock::getCorrespondId, invoiceRequest.getCorrespondId())
+                            .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                            .list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (AdminUserForceStock adminUserForceStock : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(null, adminUserForceStock.getCorrespondId(), order.getMaterialId(), null) > 0) {
+                                throw new RemoteServiceException("物料规格"+order.getSpecification()+"没有库存请去"+adminUserForceStock.getCorrespondName());
+                            }
+                        }
+
+
+                    }
+                }
+
                 //判断是否直调发货未完成
                 if (retailOrderItem.getIsDirectTransfer().equals(1) && retailOrderItem.getDirectTransferStatus().equals(0))
                     throw new RemoteServiceException(retailOrderItem.getMaterialName() + "直调未完成不能申请发货");
@@ -450,6 +490,10 @@ public class InvoiceLogic {
         invoiceApplicationOrderService.lambdaUpdate().eq(InvoiceApplicationOrder::getInvoiceId, invoiceRequest.getId()).remove();
         List<InvoiceApplicationOrder> invoiceApplicationOrders = new ArrayList<>();
 
+        InvoiceApplication invoiceApplication = invoiceApplicationService.getById(invoiceRequest.getId());
+
+        if (invoiceApplication.getIsRe().equals("YES"))
+            throw new RemoteServiceException("预留发货单不可编辑改变预留数量");
 
         String categoryId = null;
 
@@ -466,6 +510,8 @@ public class InvoiceLogic {
 
         for (InvoiceApplicationOrder order : invoiceRequest.getOrders()) {
 
+
+
             if (order.getInvoiceNum() == null || order.getInvoiceNum().equals(0))
                 continue;
             if (order.getInvoiceNum() < 0)
@@ -488,6 +534,31 @@ public class InvoiceLogic {
                 if (!categoryId.equals(kingDeeMaterial.getCategoryId()))
                     throw new RemoteServiceException("产品类别不同,无法申请发货");
 
+
+                if (adminUser.getIsCustomer() && adminUserForceStockService.lambdaQuery()
+                        .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(AdminUserForceStock::getCorrespondId,invoiceRequest.getCorrespondId())
+                        .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                        .count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<AdminUserForceStock> list = adminUserForceStockService.lambdaQuery()
+                            .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .ne(AdminUserForceStock::getCorrespondId, invoiceRequest.getCorrespondId())
+                            .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                            .list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (AdminUserForceStock adminUserForceStock : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(null, adminUserForceStock.getCorrespondId(), order.getMaterialId(), null) > 0) {
+                                throw new RemoteServiceException("物料规格"+order.getSpecification()+"没有库存请去"+adminUserForceStock.getCorrespondName());
+                            }
+                        }
+
+
+                    }
+                }
+
+
+
                 //判断是否直调发货未完成
                 if (retailOrderItem.getIsDirectTransfer().equals(1) && retailOrderItem.getDirectTransferStatus().equals(0))
                     throw new RemoteServiceException(retailOrderItem.getMaterialName() + "直调未完成不能申请发货");
@@ -770,18 +841,7 @@ public class InvoiceLogic {
         salesOrder.setOrderTime(new Date());
         salesOrder.setExamineStatus("WAIT");
         salesOrder.insert();
-        List<InvoiceApplicationOrder> list = invoiceApplicationOrderService.lambdaQuery().eq(InvoiceApplicationOrder::getInvoiceId, invoiceApplication.getId()).list();
-        List<SalesOrderItem> salesOrders = new ArrayList<>();
-        for (InvoiceApplicationOrder invoiceApplicationOrder : list) {
-            SalesOrderItem salesOrderItem = BeanUtil.toBean(invoiceApplicationOrder, SalesOrderItem.class);
-            salesOrderItem.setSalesOrderNo(salesOrder.getId());
-            salesOrderItem.setInvoiceId(salesOrder.getId());
-            salesOrderItem.setInvoiceItemId(invoiceApplicationOrder.getId());
-            salesOrderItem.setGoodsOrderId(invoiceApplicationOrder.getGoodsOrderId());
-            salesOrderItem.setId(null);
-            salesOrders.add(salesOrderItem);
-        }
-        salesOrderItemService.saveBatch(salesOrders);
+
 
         for (InvoiceApplicationOrderRequest order : invoiceRequestJson.getOrders()) {
 
@@ -792,15 +852,27 @@ public class InvoiceLogic {
                 stockCommonLogic.reduceStockCustomerSuspended(order.getMaterialId(), invoiceApplication.getCustomerId(), order.getInvoiceNum() - order.getRefundableQty());
             }
 
-            //变更可退货数量
-            if (order.getOrderType().equals("RETAIL") || order.getOrderType().equals("RETAIL_POLICY"))
-                retailOrderLogic.changeRefundableQty(order.getOrderId(), order.getApprovalNumber());
+            //因为可能同时审核同一个订单的数据,所以要锁住一个一个订单拿
+
+            Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.INVOICE_APPLICATION+order.getOrderId());
+            try {
+                if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+                    throw new RemoteServiceException("系统繁忙,请稍后再试");
+                }
+                //变更可退货数量
+                if (order.getOrderType().equals("RETAIL") || order.getOrderType().equals("RETAIL_POLICY"))
+                    retailOrderLogic.changeRefundableQty(order.getOrderId(), order.getApprovalNumber());
+
+                if (order.getOrderType().equals("PERMU_RETAIL") || order.getOrderType().equals("PERMU_RETAIL_POLICY"))
+                    changeDiplaceRefundableQty(order.getOrderId(), order.getApprovalNumber());
+
+                if (order.getOrderType().equals("REQUISITION_RETAIL") || order.getOrderType().equals("REQUISITION_RETAIL_POLICY"))
+                    changeRqquisitionRefundableQty(order.getRequisitionItemId(), order.getApprovalNumber());
+            } finally {
+                obtain.unlock();
+            }
 
-            if (order.getOrderType().equals("PERMU_RETAIL") || order.getOrderType().equals("PERMU_RETAIL_POLICY"))
-                changeDiplaceRefundableQty(order.getOrderId(), order.getApprovalNumber());
 
-            if (order.getOrderType().equals("REQUISITION_RETAIL") || order.getOrderType().equals("REQUISITION_RETAIL_POLICY"))
-                changeRqquisitionRefundableQty(order.getRequisitionItemId(), order.getApprovalNumber());
             //记录台账记录
             String customerWalletId = null;
             if (order.getOrderType().equals("RETAIL") || order.getOrderType().equals("RETAIL_POLICY")) {
@@ -808,6 +880,7 @@ public class InvoiceLogic {
                 if (retailOrderItem.getRefundableQty().equals("0") && retailOrderItem.getIsDirectTransfer() == false) {
                     order.setPayAmount(
                             retailOrderItem.getPayAmount().subtract(new BigDecimal((retailOrderItem.getHasSendQty() - retailOrderItem.getDirectTransferQty())).multiply(retailOrderItem.getSinglePayPrice())));
+
                 }
                 customerWalletId = retailOrderItem.getCustomerWalletId();
             }
@@ -827,6 +900,7 @@ public class InvoiceLogic {
                 if (requisitionOrderItem.getRefundableQty().equals("0")) {
                     order.setPayAmount(
                             requisitionOrderItem.getPayAmount().subtract(new BigDecimal((requisitionOrderItem.getHasSendQty())).multiply(requisitionOrderItem.getSinglePayPrice())));
+
                 }
                 customerWalletId = requisitionOrderItem.getCustomerWalletId();
             }
@@ -838,6 +912,19 @@ public class InvoiceLogic {
         }
         salesOrder.updateById();
 
+        List<InvoiceApplicationOrder> list = invoiceApplicationOrderService.lambdaQuery().eq(InvoiceApplicationOrder::getInvoiceId, invoiceApplication.getId()).list();
+        List<SalesOrderItem> salesOrders = new ArrayList<>();
+        for (InvoiceApplicationOrder invoiceApplicationOrder : list) {
+            SalesOrderItem salesOrderItem = BeanUtil.toBean(invoiceApplicationOrder, SalesOrderItem.class);
+            salesOrderItem.setSalesOrderNo(salesOrder.getId());
+            salesOrderItem.setInvoiceId(salesOrder.getId());
+            salesOrderItem.setInvoiceItemId(invoiceApplicationOrder.getId());
+            salesOrderItem.setGoodsOrderId(invoiceApplicationOrder.getGoodsOrderId());
+            salesOrderItem.setId(null);
+            salesOrders.add(salesOrderItem);
+        }
+        salesOrderItemService.saveBatch(salesOrders);
+
         //格匠同步采购入库单
         if (invoiceApplication.getCustomerNumber().equals(InvoiceCustomerEnum.GEJIANG_FOSHAN.getCode()) ||
                 invoiceApplication.getCustomerNumber().equals(InvoiceCustomerEnum.GEJIANG_GUANGZHOU.getCode())){
@@ -1118,6 +1205,7 @@ public class InvoiceLogic {
             }
         }
 
+        AdminUserCom adminUser = commonLogic.getAdminUser();
         //添加发货申请单
         AdminWebsit adminWebsit = adminWebsitService.lambdaQuery()
                 .eq(AdminWebsit::getAdminWebsitId, adminWebsitService.getById(adminWebsitId).getAdminWebsitId()).one();
@@ -1168,6 +1256,11 @@ public class InvoiceLogic {
                 EnginOrder enginOrder = enginOrderService.getById(order.getMainOrderId());
                 EnginOrderItem enginOrderItem = enginOrderItemService.getById(order.getOrderId());
 
+                if (enginOrderItem.getQty() < (enginOrderItem.getRefundableQty()+enginOrderItem.getHasSendQty()))
+                    throw new RemoteServiceException("可退数量大于了订单数量!");
+
+
+
                 if (!enginOrder.getExamineStatus().equals(ExamineStatusEnum.OK.getKey()) && enginOrder.getIsPlanOrder())
                     throw new RemoteServiceException("订单不属于审核状态,无法发货");
 
@@ -1178,6 +1271,30 @@ public class InvoiceLogic {
 
                 map.put(kingDeeMaterial.getCategoryNumber(),kingDeeMaterial.getCategoryName());
 
+
+                if (adminUser.getIsCustomer() && adminUserForceStockService.lambdaQuery()
+                        .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(AdminUserForceStock::getCorrespondId,invoiceRequest.getCorrespondId())
+                        .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                        .count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<AdminUserForceStock> list = adminUserForceStockService.lambdaQuery()
+                            .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .ne(AdminUserForceStock::getCorrespondId, invoiceRequest.getCorrespondId())
+                            .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                            .list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (AdminUserForceStock adminUserForceStock : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(null, adminUserForceStock.getCorrespondId(), order.getMaterialId(), null) > 0) {
+                                throw new RemoteServiceException("物料规格"+order.getSpecification()+"没有库存请去"+adminUserForceStock.getCorrespondName());
+                            }
+                        }
+
+
+                    }
+                }
+
+
                 //判断是否直调发货未完成
                 if (enginOrderItem.getIsDirectTransfer().equals(1) && enginOrderItem.getDirectTransferStatus().equals(0))
                     throw new RemoteServiceException(enginOrderItem.getMaterialName() + "直调未完成不能申请发货");
@@ -1355,6 +1472,9 @@ public class InvoiceLogic {
 
         InvoiceApplication byId = invoiceApplicationService.getById(invoiceRequest.getId());
 
+        if (byId.getIsRe().equals("YES"))
+            throw new RemoteServiceException("预留发货单不可编辑改变预留数量");
+
         //3,添加发货申请单
         //3,添加发货申请单
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
@@ -1450,6 +1570,25 @@ public class InvoiceLogic {
                 if (!categoryId.equals(kingDeeMaterial.getCategoryId()))
                     throw new RemoteServiceException("产品类别不同,无法申请发货");
 
+                if (adminUser.getIsCustomer() && stockForceCategoryService.lambdaQuery()
+                        .eq(StockForceCategory::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(StockForceCategory::getCorrespondId,invoiceRequest.getCorrespondId()).count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<StockForceCategory> list = stockForceCategoryService.lambdaQuery()
+                            .eq(StockForceCategory::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .ne(StockForceCategory::getCorrespondId, invoiceRequest.getCorrespondId()).list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (StockForceCategory stockForceCategory : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(null, stockForceCategory.getCorrespondId(), order.getMaterialId(), null) > 0) {
+                                throw new RemoteServiceException("物料规格"+order.getSpecification()+"没有库存请去"+stockForceCategory.getCorrespondName());
+                            }
+                        }
+
+
+                    }
+                }
+
+
                 //判断是否直调发货未完成
                 if (enginOrderItem.getIsDirectTransfer().equals(1) && enginOrderItem.getDirectTransferStatus().equals(0))
                     throw new RemoteServiceException(enginOrderItem.getMaterialName() + "直调未完成不能申请发货");
@@ -2218,6 +2357,10 @@ public class InvoiceLogic {
         if (enginOrderItem.getRefundableQty().intValue() < qty.intValue()) {
             throw new RemoteServiceException("可申请货数量不足!");
         }
+
+        if (enginOrderItem.getQty() < (enginOrderItem.getRefundableQty()+enginOrderItem.getHasSendQty()))
+            throw new RemoteServiceException("可退数量大于了订单数量!");
+
         enginOrderItem.setRefundableQty(enginOrderItem.getRefundableQty() - qty);
         enginOrderItem.updateById();
     }
@@ -2273,6 +2416,29 @@ public class InvoiceLogic {
 
                 }
 
+                //查不到这个仓库得强制仓,才进去查是否有强制仓
+                if (adminUser.getIsCustomer() && adminUserForceStockService.lambdaQuery()
+                        .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(AdminUserForceStock::getCorrespondId,correspondId)
+                        .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                        .count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<AdminUserForceStock> list = adminUserForceStockService.lambdaQuery()
+                            .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                            .ne(AdminUserForceStock::getCorrespondId, correspondId)
+                            .list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (AdminUserForceStock adminUserForceStock : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(item.getOrderId(), adminUserForceStock.getCorrespondId(), item.getMaterialId(), null) > 0) {
+                                item.setStockCorrespond(0);
+                            }
+                        }
+
+
+                    }
+                }
+
 
 
 
@@ -2341,6 +2507,29 @@ public class InvoiceLogic {
                 //可用数
                 item.setStockAdequate(stockCommonLogic.stockAdequate(null, item.getMaterialId()));
 
+                //查不到这个仓库得强制仓,才进去查是否有强制仓
+                if (adminUser.getIsCustomer() && adminUserForceStockService.lambdaQuery()
+                        .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                        .eq(AdminUserForceStock::getCorrespondId,correspondId)
+                        .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                        .count() < 1) {
+                    //强制仓返回,有强制仓,判断强制是否有库存,有库存都返回0,没返回正常库存
+                    List<AdminUserForceStock> list = adminUserForceStockService.lambdaQuery()
+                            .eq(AdminUserForceStock::getCategoryId, kingDeeMaterial.getCategoryId())
+                            .eq(AdminUserForceStock::getAdminUserId,adminUser.getAdminUserId())
+                            .ne(AdminUserForceStock::getCorrespondId, correspondId)
+                            .list();
+                    if (!CollectionUtils.isEmpty(list) ) {
+                        for (AdminUserForceStock adminUserForceStock : list) {
+                            if (stockCommonLogic.stockCorrespondStatus(item.getOrderId(), adminUserForceStock.getCorrespondId(), item.getMaterialId(), null) > 0) {
+                                item.setStockCorrespond(0);
+                            }
+                        }
+
+
+                    }
+                }
+
 
                 Integer integer = invoiceMapper.selectInvoiceOk(item.getOrderId());
                 item.setAlreadyInvoiceNum(integer);

+ 31 - 6
src/main/java/com/zfire/mall/manager/logic/invoice/InvoiceRefundLogic.java

@@ -42,12 +42,15 @@ import com.zfire.mall.manager.plus.service.*;
 import com.zfire.mall.manager.utils.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.integration.redis.util.RedisLockRegistry;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -185,6 +188,10 @@ public class InvoiceRefundLogic {
     SalesOrderPictureService salesOrderPictureService;
 
 
+    @Autowired
+    RedisLockRegistry redisLockRegistry;
+
+
     public IPage<SaleOrderBean> salesList(String categoryName,String mainOrderId, String enginOrderNo, String refEnginRecordNo, String refProjectName, Integer saleType, String id, String orderNo, String correspondName, String materialNumber, String customerName, String correspondId, String specification, String materialName, String customerNumber, String startTime, String endTime, Integer pageNum, Integer pageSize) {
         AdminUserCom adminUser = commonLogic.getAdminUser();
         String customerId = adminUser.getIsCustomer() ? adminUser.getCustomerId() : "";
@@ -501,7 +508,10 @@ public class InvoiceRefundLogic {
             EnginOrder enginOrder = enginOrderService.getById(invoiceApplicationOrder.getMainOrderId());
             EnginOrderItem enginOrderItem = enginOrderItemService.getById(invoiceApplicationOrder.getOrderId());
             OrderExecRecord orderExecRecord = new OrderExecRecord();
-            orderExecRecord.setRefOrderId(orderId);
+
+            orderExecRecord.setOrderCreateTime(enginOrder != null ? enginOrder.getOrderDate() : retailOrder.getCreateTime());
+
+            orderExecRecord.setRefOrderId(orderId+"T");
             orderExecRecord.setRefEnginRecordNo(enginOrder != null ?enginOrder.getRefEnginRecordNo():null);
             orderExecRecord.setRefOrderItemId(invoiceApplicationOrder.getOrderId());
             orderExecRecord.setAdminUserId(enginOrder != null?enginOrder.getAdminUserId():retailOrder.getAdminUserId());
@@ -546,7 +556,7 @@ public class InvoiceRefundLogic {
             orderExecRecord.setOldQty(enginOrder != null?enginOrderItem.getOldQty():retailOrderItem.getOldQty());
             orderExecRecord.setOldPayAmount(enginOrder != null?enginOrderItem.getOldPayAmount():retailOrderItem.getOldPayAmount());
             orderExecRecord.setOrgPrice(enginOrder != null?null:retailOrderItem.getOrgPrice());
-            orderExecRecord.setRefType("退货单");
+            orderExecRecord.setRefType("反审退货单");
             orderExecRecord.setAdminCompanyId(enginOrder != null ?enginOrder.getAdminCompanyId():retailOrder.getAdminCompanyId());
             orderExecRecords.add(orderExecRecord);
         }
@@ -796,9 +806,19 @@ public class InvoiceRefundLogic {
                 stockCommonLogic.reduceStockCustomerSuspended(order.getMaterialId(), invoiceApplication.getCustomerId(), order.getRefundableQty());
             }
 
+
+
             //记录台账记录
             String customerWalletId = null;
-            if (order.getOrderType().equals("RETAIL") || order.getOrderType().equals("RETAIL_POLICY")) {
+
+            Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.INVOICE_APPLICATION+order.getOrderId());
+            try {
+                if (!obtain.tryLock(5, TimeUnit.SECONDS)) {
+                    throw new RemoteServiceException("系统繁忙,请稍后再试");
+                }
+
+
+                if (order.getOrderType().equals("RETAIL") || order.getOrderType().equals("RETAIL_POLICY")) {
                 RetailOrderItem retailOrderItem = retailOrderItemService.getById(order.getOrderId());
                 retailOrderItem.setRefundProductQty(retailOrderItem.getRefundProductQty()+(order.getRefundableQty()));
                 BigDecimal tdQty = BigDecimal.valueOf(order.getRefundableQty());
@@ -815,6 +835,9 @@ public class InvoiceRefundLogic {
                 enginOrderItem.updateById();
                 customerWalletId = enginOrderItem.getCustomerWalletId();
             }
+            } finally {
+                obtain.unlock();
+            }
 
 
             CustomerWallet customerWallet = customerWalletService.getById(customerWalletId);
@@ -880,7 +903,7 @@ public class InvoiceRefundLogic {
             orderExecRecord.setAdminWebsitId(enginOrder != null?enginOrder.getAdminWebsitId():retailOrder.getAdminWebsitId());
 
             orderExecRecord.setTheTime(new Date());
-            orderExecRecord.setOrderCreateTime(enginOrder != null?enginOrder.getOrderDate():retailOrder.getTheTime());
+            orderExecRecord.setOrderCreateTime(enginOrder != null ? enginOrder.getOrderDate() : retailOrder.getCreateTime());
 
             orderExecRecord.setOrderType(invoiceApplicationOrder.getOrderType());
             orderExecRecord.setSaleTypeCode(invoiceApplicationOrder.getSaleTypeCode());
@@ -1239,6 +1262,8 @@ public class InvoiceRefundLogic {
 
         InvoiceApplication invoiceApplication = BeanUtil.toBean(retailOrder, InvoiceApplication.class);
         invoiceApplication.setOrderTime(new Date());
+        invoiceApplication.setCreateTime(new Date());
+        invoiceApplication.setUpdateTime(new Date());
         //生成订单流水号
         String yyyyMM = DateUtil.format(new Date(), "yyyyMM");
         String orderWater = yyyyMM.substring(yyyyMM.length() - 4);
@@ -1253,7 +1278,7 @@ public class InvoiceRefundLogic {
         }
         redisUtil.set(Constant.RedisPrefix.INVOICE_APPLICATION + orderWater, s, 2726560);
         invoiceApplication.setId(adminWebsit.getWebsitNumber() + orderWater + s);
-        invoiceApplication.setExamineStatus("SAVE");
+        invoiceApplication.setExamineStatus("WAIT");
         invoiceApplication.setCorrespondId(stockCorrespond.getId());
         invoiceApplication.setCorrespondName(stockCorrespond.getName());
         invoiceApplication.setStockId(kingDeeStock.getId());
@@ -1433,7 +1458,7 @@ public class InvoiceRefundLogic {
         StockCorrespondPosition one = stockCorrespondPositionService.lambdaQuery().eq(StockCorrespondPosition::getCorrespondId, stockCorrespond.getId()).one();
         KingDeeStock kingDeeStock = kingDeeStockService.getById(one.getStockId());
         invoiceApplication.setStockId(kingDeeStock.getId());
-        invoiceApplication.setExamineStatus("SAVE");
+        invoiceApplication.setExamineStatus("WAIT");
         invoiceApplication.setCorrespondId(stockCorrespond.getId());
         invoiceApplication.setCorrespondName(stockCorrespond.getName());
         invoiceApplication.setStockId(kingDeeStock.getId());

+ 49 - 18
src/main/java/com/zfire/mall/manager/logic/k3/K3StockLogic.java

@@ -86,6 +86,12 @@ public class K3StockLogic {
     @Autowired
     StockCorrespondCategoryService stockCorrespondCategoryService;
 
+    @Autowired
+    StockForceCategoryService stockForceCategoryService;
+
+    @Autowired
+    AdminWebsitService adminWebsitService;
+
 //    public void allSync(String orgId, String orgNumber, String startTime, String endTime) throws Exception {
 //        // 调用仓库接口
 //        RequestApiBean request = k3Logic.getInstance(orgId, orgNumber, KingDeeCons.STOCK_INFO, startTime, endTime);
@@ -161,14 +167,7 @@ public class K3StockLogic {
         }
         stockCorrespondPositionService.saveBatch(stockCorrespondPositions);
 
-        List<StockCorrespondCategory> stockCorrespondCategories = new ArrayList<>();
-        for (String stockId : stockPosition.getCategoryIds()) {
-            StockCorrespondCategory stockCorrespondCategory = new StockCorrespondCategory();
-            stockCorrespondCategory.setCategoryId(stockId);
-            stockCorrespondCategory.setCorrespondId(stockPosition.getId());
-            stockCorrespondCategories.add(stockCorrespondCategory);
-        }
-        stockCorrespondCategoryService.saveBatch(stockCorrespondCategories);
+        this.addCategorys(stockPosition);
     }
 
     public IPage<StockPositionStock> listStock(String name, String stockName, Integer pageNum, Integer pageSize) {
@@ -187,6 +186,13 @@ public class K3StockLogic {
             List<KingDeeCategory> kingDeeCategories = kingDeeCategoryService.lambdaQuery().in(KingDeeCategory::getId, collect).list();
             stockPositionStock.setKingDeeCategories(kingDeeCategories);
         }
+
+        List<StockForceCategory> stockForceCategories = stockForceCategoryService.lambdaQuery().eq(StockForceCategory::getCorrespondId, id).list();
+
+        if (!CollectionUtils.isEmpty(stockForceCategories)) {
+            stockPositionStock.setStockForceCategories(stockForceCategories);
+        }
+
         return stockPositionStock;
     }
 
@@ -252,6 +258,7 @@ public class K3StockLogic {
         stockCorrespondService.removeByIds(id);
         stockCorrespondPositionService.lambdaUpdate().in(StockCorrespondPosition::getCorrespondId,id).remove();
         stockCorrespondCategoryService.lambdaUpdate().in(StockCorrespondCategory::getCorrespondId,id).remove();
+        stockForceCategoryService.lambdaUpdate().in(StockForceCategory::getCorrespondId,id).remove();
     }
 
     public void deleteToll(String id) {
@@ -261,15 +268,9 @@ public class K3StockLogic {
     @Transactional
     public void updateStock(StockPosition stockPosition, HttpServletRequest request) {
         if (invoiceApplicationService.lambdaQuery().eq(InvoiceApplication::getCorrespondId,stockPosition.getId()).count()>0) {
-            stockCorrespondCategoryService.lambdaUpdate().eq(StockCorrespondCategory::getCorrespondId,stockPosition.getId()).remove();
-            List<StockCorrespondCategory> stockCorrespondCategories = new ArrayList<>();
-            for (String stockId : stockPosition.getCategoryIds()) {
-                StockCorrespondCategory stockCorrespondCategory = new StockCorrespondCategory();
-                stockCorrespondCategory.setCategoryId(stockId);
-                stockCorrespondCategory.setCorrespondId(stockPosition.getId());
-                stockCorrespondCategories.add(stockCorrespondCategory);
-            }
-            stockCorrespondCategoryService.saveBatch(stockCorrespondCategories);
+
+            this.addCategorys(stockPosition);
+
             return;
         }
 
@@ -278,6 +279,11 @@ public class K3StockLogic {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
         stockPosition.updateById();
 
+        this.addCategorys(stockPosition);
+
+    }
+
+    public void addCategorys(StockPosition stockPosition) {
         stockCorrespondPositionService.lambdaUpdate().eq(StockCorrespondPosition::getCorrespondId,stockPosition.getId()).remove();
         List<StockCorrespondPosition> stockCorrespondPositions = new ArrayList<>();
         for (String stockId : stockPosition.getStockIds()) {
@@ -288,8 +294,31 @@ public class K3StockLogic {
         }
         stockCorrespondPositionService.saveBatch(stockCorrespondPositions);
 
+        stockCorrespondCategoryService.lambdaUpdate().eq(StockCorrespondCategory::getCorrespondId,stockPosition.getId()).remove();
+
+        List<StockCorrespondCategory> stockCorrespondCategories = new ArrayList<>();
+        for (String category : stockPosition.getCategoryIds()) {
+            StockCorrespondCategory stockCorrespondCategory = new StockCorrespondCategory();
+            stockCorrespondCategory.setCorrespondId(stockPosition.getId());
+            stockCorrespondCategory.setCategoryId(category);
+            stockCorrespondCategories.add(stockCorrespondCategory);
+        }
+        stockCorrespondCategoryService.saveBatch(stockCorrespondCategories);
+
+
+/*        stockForceCategoryService.lambdaUpdate().eq(StockForceCategory::getCorrespondId,stockPosition.getId()).remove();
+        List<StockForceCategory> stockForceCategories = new ArrayList<>();
+        for (String stockId : stockPosition.getQiangzhiCategoryIds()) {
+            StockForceCategory stockForceCategory = new StockForceCategory();
+            stockForceCategory.setCategoryId(stockId);
+            stockForceCategory.setCorrespondId(stockPosition.getId());
+            stockForceCategory.setCorrespondName(stockPosition.getName());
+            stockForceCategories.add(stockForceCategory);
+        }
+        stockForceCategoryService.saveBatch(stockForceCategories);*/
     }
 
+
     public List<KingDeeStock> listPosition(String correspondId, Integer inquire) {
         return stockK3Mapper.listPosition(correspondId,inquire);
     }
@@ -350,12 +379,14 @@ public class K3StockLogic {
                 materialIds.addAll(materialIds2);
             }
         }
+
         //要过滤的仓库
         List<AdminUserStock> adminUserStocks = adminUserStockService.lambdaQuery().eq(AdminUserStock::getAdminUserId, adminUser.getAdminUserId()).list();
         List<String> correspondIds = adminUserStocks.stream().map(AdminUserStock::getCorrespondId).collect(Collectors.toList());
 
 
-        IPage<AdminUserVisitAccBean> page = stockK3Mapper.visitAccList(new Page(pageNum, pageSize),specification, DateUtil.formatDateTime(date),materialIds,correspondIds);
+        IPage<AdminUserVisitAccBean> page = stockK3Mapper
+                .visitAccList(new Page(pageNum, pageSize),specification, DateUtil.formatDateTime(date),materialIds,correspondIds);
         adminUser.setVisitAccTime(new Date());
         adminUser.updateById();
 

+ 149 - 0
src/main/java/com/zfire/mall/manager/logic/manage/material/MaterialReferPriceLogic.java

@@ -0,0 +1,149 @@
+package com.zfire.mall.manager.logic.manage.material;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zfire.mall.manager.bean.listV2.MaterialReferPriceVO;
+import com.zfire.mall.manager.commonmapper.listV2.CommonCMapper;
+import com.zfire.mall.manager.exception.RemoteServiceException;
+import com.zfire.mall.manager.plus.entity.KingDeeMaterial;
+import com.zfire.mall.manager.plus.entity.MaterialReferPrice;
+import com.zfire.mall.manager.plus.service.KingDeeMaterialService;
+import com.zfire.mall.manager.plus.service.MaterialReferPriceService;
+import com.zfire.mall.manager.utils.CommonUtils;
+import com.zfire.mall.manager.zfire.bean.ZfireParamBean;
+import com.zfire.mall.manager.zfire.util.FieldUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 物料参考成本价格
+ * @author :lijh
+ * @description:TODO
+ * @date :2024/2/19 15:44
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class MaterialReferPriceLogic {
+
+    private final MaterialReferPriceService materialReferPriceService;
+    private final KingDeeMaterialService kingDeeMaterialService;
+    private final CommonCMapper commonCMapper;
+
+
+    /**
+     * 列表
+     * @param zfireParamBean
+     * @return
+     */
+    public IPage<MaterialReferPriceVO> list(ZfireParamBean zfireParamBean){
+        FieldUtils.supplyParam(zfireParamBean);
+        IPage<MaterialReferPriceVO> list = commonCMapper.queryMaterialReferPriceList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+        return list;
+    }
+
+
+    /**
+     * 新增/编辑
+     * @param materialReferPrice
+     */
+    public void add(MaterialReferPrice materialReferPrice){
+        if(StringUtils.isAnyBlank(materialReferPrice.getMaterialNumber())){
+            throw new RemoteServiceException("物料编码不能为空");
+        }
+        if(materialReferPrice.getCostPrice() == null){
+            throw new RemoteServiceException("参考成本价不能为空");
+        }
+        KingDeeMaterial kingDeeMaterial = kingDeeMaterialService.lambdaQuery().eq(KingDeeMaterial::getNumber, materialReferPrice.getMaterialNumber())
+                .last("limit 1").one();
+
+        KingDeeMaterial upKing = new KingDeeMaterial();
+        upKing.setId(kingDeeMaterial.getId());
+        upKing.setCostPrice(materialReferPrice.getCostPrice());
+
+        upKing.updateById();
+
+        materialReferPrice.insertOrUpdate();
+    }
+
+    /**
+     * 详情
+     * @param id
+     * @return
+     */
+    public MaterialReferPrice detail(String id){
+        return materialReferPriceService.getById(id);
+    }
+
+    /**
+     * 删除
+     * @param id
+     */
+    public void delete(String id){
+        materialReferPriceService.removeById(id);
+    }
+
+    /**
+     * 导入
+     * @param datas
+     */
+    public void importData(List<Object> datas){
+        int index = 1;
+
+        List<MaterialReferPrice> list = new ArrayList<>();
+        List<KingDeeMaterial> kingDeeMaterials = new ArrayList<>();
+
+        for(Object o : datas){
+
+            index ++ ;
+            List<Object> row = (List<Object>) o;
+            if (StringUtils.isEmpty((String)row.get(0)))
+                continue;
+
+            CommonUtils.initList2(row,10);
+            String materialNumber = (String)row.get(0);
+            BigDecimal costPrice = new BigDecimal((String)row.get(4));
+            if(StringUtils.isAnyBlank(materialNumber) || costPrice == null){
+                throw new RemoteServiceException("第"+index+"行,黄色区域为必填区域");
+            }
+            KingDeeMaterial kingDeeMaterial = kingDeeMaterialService.lambdaQuery().eq(KingDeeMaterial::getNumber, materialNumber).last("limit 1").one();
+            if(kingDeeMaterial == null){
+                throw new RemoteServiceException("第"+index+"行,物料编号不存在于系统,请检查");
+            }
+
+            MaterialReferPrice materialReferPrice = materialReferPriceService.lambdaQuery().eq(MaterialReferPrice::getMaterialNumber, materialNumber).last("limit 1").one();
+            if(materialReferPrice == null){
+                materialReferPrice = new MaterialReferPrice();
+            }
+            materialReferPrice
+                    .setMaterialNumber(materialNumber)
+                    .setCostPrice(costPrice);
+
+            KingDeeMaterial upKing = new KingDeeMaterial();
+            upKing.setId(kingDeeMaterial.getId());
+            upKing.setCostPrice(costPrice);
+
+            kingDeeMaterials.add(upKing);
+            list.add(materialReferPrice);
+        }
+        //检查是否有重复的物料编号
+        long count = list.stream().map(MaterialReferPrice::getMaterialNumber).distinct().count();
+        if(count != list.size()){
+            throw new RemoteServiceException("excel表格存在重复相同的物料编号");
+        }
+        if(CollectionUtils.isNotEmpty(list)) {
+            materialReferPriceService.saveOrUpdateBatch(list);
+        }
+        if(CollectionUtils.isNotEmpty(kingDeeMaterials)) {
+            kingDeeMaterialService.saveOrUpdateBatch(kingDeeMaterials);
+        }
+
+    }
+}

+ 1 - 0
src/main/java/com/zfire/mall/manager/logic/pick/PickLogic.java

@@ -731,6 +731,7 @@ public class PickLogic {
         StockCorrespond stockCorrespond = stockCorrespondService.getById(pickManagerRequest.getCorrespondId());
         PickManager pickManager = pickManagerService.getById(pickManagerRequest.getId());
         pickManager.setCorrespondName(stockCorrespond.getName());
+        pickManager.setPickStatus(pickManagerRequest.getPickStatus());
         if (!StringUtils.isEmpty(pickManagerRequest.getTakerId())) {
             TakerRecord takerRecord = takerRecordService.getById(pickManagerRequest.getTakerId());
             pickManager.setTakerPhone(takerRecord.getPhone());

+ 5 - 1
src/main/java/com/zfire/mall/manager/logic/policy/PolicyLogic.java

@@ -305,7 +305,11 @@ public class PolicyLogic {
      * 作废
      */
     public void cancel(String id){
-        policyService.lambdaUpdate().set(Policy::getStatus,false).eq(Policy::getId,id).update();
+        policyService.lambdaUpdate()
+                .set(Policy::getStatus,false)
+                .set(Policy::getUpdateBy,CommonUtils.getNickName())
+                .set(Policy::getUpdateTime,new Date())
+                .eq(Policy::getId,id).update();
     }
 
     /**

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.