Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/saas-platform into dev

# Conflicts:
#	applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
zhoudw 7 years ago
parent
commit
f7963fa185
95 changed files with 4659 additions and 489 deletions
  1. 2 2
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java
  2. 22 16
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MessageLogService.java
  3. 5 0
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  4. 5 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Status.java
  5. 71 16
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java
  6. 11 8
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java
  7. 26 17
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MessageLogServiceImpl.java
  8. 1 1
      applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/ProductApi.java
  9. 2 2
      applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/WarehouseApi.java
  10. 128 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java
  11. 41 31
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendorcontact.java
  12. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BankinformationController.java
  13. 5 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerkindController.java
  14. 28 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  15. 69 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  16. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java
  17. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  18. 3 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  19. 10 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorcontactMapper.java
  20. 4 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerkindService.java
  21. 30 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  22. 51 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  23. 23 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java
  24. 35 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerkindServiceImpl.java
  25. 21 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java
  26. 91 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java
  27. 7 6
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java
  28. 24 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java
  29. 25 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java
  30. 144 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java
  31. 23 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java
  32. 25 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java
  33. 3 0
      applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml
  34. 49 0
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  35. 219 49
      applications/document/document-server/src/main/resources/mapper/VendorcontactMapper.xml
  36. 1 3
      applications/money/money-server/pom.xml
  37. 2 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/MoneyApplicatiion.java
  38. 58 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/FundtransferController.java
  39. 6 8
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/OthreceiptsController.java
  40. 11 8
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/OthspengdingsController.java
  41. 12 9
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/PaybalanceController.java
  42. 7 7
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/RecbalanceContorller.java
  43. 21 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/FundtransferMapper.java
  44. 18 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/FundtransferdetailMapper.java
  45. 28 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtran.java
  46. 175 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java
  47. 225 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransferdetail.java
  48. 24 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/FundtransferService.java
  49. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/OthspendingsService.java
  50. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/PaybalanceService.java
  51. 4 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/RecbalanceService.java
  52. 106 0
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java
  53. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java
  54. 1 1
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java
  55. 6 6
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java
  56. 5 5
      applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java
  57. 241 0
      applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml
  58. 300 0
      applications/money/money-server/src/main/resources/mapper/FundtransferdetailMapper.xml
  59. 7 6
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java
  60. 3 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java
  61. 2 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java
  62. 3 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java
  63. 6 4
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  64. 6 6
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  65. 9 1
      applications/sale/sale-dto/pom.xml
  66. 91 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java
  67. 73 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutDTO.java
  68. 18 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutFormDTO.java
  69. 140 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutListDTO.java
  70. 28 0
      applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutReqDTO.java
  71. 1 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java
  72. 161 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java
  73. 4 4
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java
  74. 18 7
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java
  75. 20 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutListMapper.java
  76. 32 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java
  77. 2 2
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java
  78. 76 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java
  79. 584 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java
  80. 23 21
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  81. 297 25
      applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml
  82. 100 0
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml
  83. 252 5
      applications/sale/sale-server/src/main/resources/mapper/ProdInOutMapper.xml
  84. 3 3
      applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml
  85. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java
  86. 3 1
      frontend/saas-web/app/util/BaseUtil.js
  87. 88 0
      frontend/saas-web/app/view/core/query/MoreQueryWin.js
  88. 12 3
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  89. 65 33
      frontend/saas-web/app/view/core/query/QueryPanel.js
  90. 28 23
      frontend/saas-web/app/view/core/query/QueryPanelController.js
  91. 7 4
      frontend/saas-web/app/view/money/recBalance/FormPanel.js
  92. 20 61
      frontend/saas-web/app/view/money/recBalance/FormPanelController.js
  93. 9 30
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  94. 3 3
      frontend/saas-web/app/view/purchase/purchase/FormPanelController.js
  95. 0 11
      frontend/saas-web/app/view/purchase/purchase/QueryPanel.js

+ 2 - 2
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java

@@ -18,7 +18,7 @@ public interface MaxnumberService {
      * @Author: guq
      * @Date: 2018/10/19 api/commons
      */
-    @PostMapping("/api/commons/number/pushMaxnubmer")
+    @PostMapping("/number/pushMaxnubmer")
     public Result<String> pushMaxnubmer(@RequestParam("count") Integer count,@RequestParam("code") String code,
                                 @RequestParam("caller") String caller);
     /**
@@ -28,6 +28,6 @@ public interface MaxnumberService {
      * @Author: guq
      * @Date: 2018/10/22
      */
-    @PostMapping("/api/commons/numnber/getMaxnumber")
+    @PostMapping("/numnber/getMaxnumber")
     public Result<String> getMaxnumber(@RequestParam("caller") String caller, @RequestParam("update") boolean update);
 }

+ 22 - 16
applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MessageLogService.java

@@ -1,9 +1,12 @@
 package com.usoftchina.saas.commons.api;
 
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Operation;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.context.request.async.DeferredResult;
 
 /**
 * @Description: 日志接口
@@ -13,27 +16,30 @@ import org.springframework.web.bind.annotation.RequestMapping;
 @FeignClient("commons-server")
 public interface MessageLogService {
 
-    @RequestMapping("/api/commons/messagelog/save")
-    public void save(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/save")
+    public String save(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/update")
-    public void update(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/update")
+    public String update(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/delete")
-    public void delete(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/delete")
+    public String delete(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/deleteDetail")
-    public void deleteDetail(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/deleteDetail")
+    public String deleteDetail(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/audit")
-    public void audit(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/audit")
+    public String audit(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/unAudit")
-    public void unAudit(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/unAudit")
+    public String unAudit(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/close")
-    public void close(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/close")
+    public String close(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/api/commons/messagelog/open")
-    public void open(@RequestBody DocBaseDTO baseDTO);
+    @RequestMapping("/messagelog/open")
+    public String open(@RequestBody DocBaseDTO baseDTO);
+
+    @RequestMapping("/messagelog/customizeLog")
+    public String customizeLog(@RequestBody DocBaseDTO baseDTO, @RequestParam("operation") Operation operation);
 }

+ 5 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -22,6 +22,9 @@ public enum BizExceptionCode implements BaseExceptionCode {
     CODE_EXISTS(79200, "单据编号已存在"),
     BIZ_CLOSE(79301, "只能关闭已审核的单据"),
     BIZ_OPEN(79002, "只能打开已关闭的单据"),
+    NO_DATA(79998, "未找到数据"),
+    ILLEGAL_ID(79999, "id不正确"),
+
 
     //采购
 
@@ -30,6 +33,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
     SALE_CLOSE(72001, "单据已关闭,无法进行操作"),
     SALE_YQTYBEYONDQTY(72001, "明细行已转数量大于数量"),
     SALE_NULL_BILL(72002, "单据不存在或者明细为空"),
+    SALEOUT_ALL_TURNIN(72003, "该销售出货单已全部转退货,无法转销售退货单"),
+    SALEOUT_POSTSTATUS_ERROR(72004,"单据状态异常,无法反审核"),
     //资金
 
     //库存

+ 5 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Status.java

@@ -50,8 +50,12 @@ public enum Status {
     /**
      * 未出库
      */
-    UNTURNOUT("未出库")
+    UNTURNOUT("未出库"),
 
+    /**
+     * 开启
+     */
+    OPEN("开启")
 
     ;
     private String display;

+ 71 - 16
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java

@@ -1,11 +1,17 @@
 package com.usoftchina.saas.commons.controller;
 
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.service.MessageLogService;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.async.DeferredResult;
+
+import java.util.concurrent.CompletableFuture;
 
 /**
  * @author: guq
@@ -19,42 +25,91 @@ public class MessageLogController {
     private MessageLogService messageLogService;
 
     @RequestMapping("/save")
-    public void save(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.save(baseDTO);
+    public DeferredResult<String> save(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.save(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/update")
-    public void update(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.update(baseDTO);
+    public DeferredResult<String> update(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.update(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/delete")
-    public void delete(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.delete(baseDTO);
+    public DeferredResult<String> delete(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.delete(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/deleteDetail")
-    public void deleteDetail(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.deleteDetail(baseDTO);
+    public DeferredResult<String> deleteDetail(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.deleteDetail(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/audit")
-    public void audit(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.audit(baseDTO);
+    public DeferredResult<String> audit(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.audit(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/unAudit")
-    public void unAudit(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.unAudit(baseDTO);
+    public DeferredResult<String> unAudit(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.unAudit(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/close")
-    public void close(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.close(baseDTO);
+    public DeferredResult<String> close(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.close(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 
     @RequestMapping("/open")
-    public void open(@RequestBody DocBaseDTO baseDTO) {
-        messageLogService.open(baseDTO);
+    public DeferredResult<String> open(@RequestBody DocBaseDTO baseDTO) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        CompletableFuture.supplyAsync(() -> messageLogService.open(baseDTO))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
+    }
+
+    /**
+    * @Description 自定义的Log
+    * @Param: [baseDTO]
+    * @return: org.springframework.web.context.request.async.DeferredResult<java.lang.String>
+    * @Author: guq
+    * @Date: 2018/10/25
+    */
+    @RequestMapping("/customizeLog")
+    public DeferredResult<String> customizeLog(@RequestBody DocBaseDTO baseDTO, @RequestParam Operation operation) {
+        // Create the deferredResult and initiate a callback object, task, with it
+        DeferredResult<String> deferredResult = new DeferredResult<>();
+        System.out.println(operation.getTitle() + "  : " + operation.getResult());
+        CompletableFuture.supplyAsync(() -> messageLogService.customizeLog(baseDTO, operation))
+                .whenCompleteAsync((result, throwable) -> deferredResult.setResult(result));
+        return deferredResult;
     }
 }

+ 11 - 8
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/MessageLogService.java

@@ -4,21 +4,24 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.mapper.MessagelogMapper;
 import com.usoftchina.saas.commons.po.Messagelog;
+import com.usoftchina.saas.commons.po.Operation;
 
 public interface MessageLogService extends CommonBaseService<MessagelogMapper, Messagelog>{
-    void save(DocBaseDTO baseDTO);
+    String save(DocBaseDTO baseDTO);
 
-    void update(DocBaseDTO baseDTO);
+    String update(DocBaseDTO baseDTO);
 
-    void delete(DocBaseDTO baseDTO);
+    String delete(DocBaseDTO baseDTO);
 
-    void deleteDetail(DocBaseDTO baseDTO);
+    String deleteDetail(DocBaseDTO baseDTO);
 
-    void audit(DocBaseDTO baseDTO);
+    String audit(DocBaseDTO baseDTO);
 
-    void unAudit(DocBaseDTO baseDTO);
+    String unAudit(DocBaseDTO baseDTO);
 
-    void close(DocBaseDTO baseDTO);
+    String close(DocBaseDTO baseDTO);
 
-    void open(DocBaseDTO baseDTO);
+    String open(DocBaseDTO baseDTO);
+
+    String customizeLog(DocBaseDTO baseDTO, Operation operation);
 }

+ 26 - 17
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/MessageLogServiceImpl.java

@@ -7,6 +7,8 @@ import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.commons.po.Operation;
 import com.usoftchina.saas.commons.service.MessageLogService;
 import com.usoftchina.saas.context.BaseContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.MessageSource;
 import org.springframework.stereotype.Service;
@@ -25,46 +27,52 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
     private MessageSource messageSource;
 
     @Override
-    public void save(DocBaseDTO baseDTO) {
-        log(Operation.SAVE, baseDTO);
+    public String save(DocBaseDTO baseDTO) {
+        return log(Operation.SAVE, baseDTO);
+
+    }
+
+    @Override
+    public String update(DocBaseDTO baseDTO) {
+        return log(Operation.UPDATE, baseDTO);
     }
 
     @Override
-    public void update(DocBaseDTO baseDTO) {
-        log(Operation.UPDATE, baseDTO);
+    public String delete(DocBaseDTO baseDTO) {
+        return log(Operation.DELETE, baseDTO);
     }
 
     @Override
-    public void delete(DocBaseDTO baseDTO) {
-        log(Operation.DELETE, baseDTO);
+    public String deleteDetail(DocBaseDTO baseDTO) {
+        return log(Operation.DELETEDETAIL, baseDTO);
     }
 
     @Override
-    public void deleteDetail(DocBaseDTO baseDTO) {
-        log(Operation.DELETEDETAIL, baseDTO);
+    public String audit(DocBaseDTO baseDTO) {
+        return log(Operation.AUDIT, baseDTO);
     }
 
     @Override
-    public void audit(DocBaseDTO baseDTO) {
-        log(Operation.AUDIT, baseDTO);
+    public String unAudit(DocBaseDTO baseDTO) {
+        return log(Operation.RESAUDIT, baseDTO);
     }
 
     @Override
-    public void unAudit(DocBaseDTO baseDTO) {
-        log(Operation.RESAUDIT, baseDTO);
+    public String close(DocBaseDTO baseDTO) {
+        return log(Operation.CLOSE, baseDTO);
     }
 
     @Override
-    public void close(DocBaseDTO baseDTO) {
-        log(Operation.CLOSE, baseDTO);
+    public String open(DocBaseDTO baseDTO) {
+        return log(Operation.OPEN, baseDTO);
     }
 
     @Override
-    public void open(DocBaseDTO baseDTO) {
-        log(Operation.OPEN, baseDTO);
+    public String customizeLog(DocBaseDTO baseDTO, Operation operation) {
+        return log(operation, baseDTO);
     }
 
-    private void log(Operation operation, DocBaseDTO baseDTO) {
+    private String log(Operation operation, DocBaseDTO baseDTO) {
         String language = "zh_CN";
         Messagelog msg = new Messagelog();
         msg.setMl_caller(baseDTO.getName());
@@ -76,6 +84,7 @@ public class MessageLogServiceImpl extends CommonBaseServiceImpl<MessagelogMappe
         msg.setCreatorId(BaseContextHolder.getUserId());
         msg.setMl_keyvalue(baseDTO.getId());
         getMapper().insert(msg);
+        return "success";
     }
 
     private String getLocalMessage(String msg, String language) {

+ 1 - 1
applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/ProductApi.java

@@ -29,6 +29,6 @@ public interface ProductApi {
     * @Author: guq
     * @Date: 2018/10/16
     */
-    @RequestMapping("/api/document/product/updateLatestPurchasePrice")
+    @RequestMapping("/product/updateLatestPurchasePrice")
     public void updateLatestPurchasePrice(@RequestParam(value = "id") Long pu_id);
 }

+ 2 - 2
applications/document/document-api/src/main/java/com/usoftchina/saas/document/api/WarehouseApi.java

@@ -9,10 +9,10 @@ import java.util.Map;
 @FeignClient(name = "document-server")
 public interface WarehouseApi {
 
-    @GetMapping("/api/document/warehouse/post")
+    @GetMapping("/warehouse/post")
     public Result post(Map<String, Object> param);
 
-    @GetMapping("/api/document/warehouse/unPost")
+    @GetMapping("/warehouse/unPost")
     public Result unPost(Map<String, Object> param);
 
 }

+ 128 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/VendorList.java

@@ -0,0 +1,128 @@
+package com.usoftchina.saas.document.entities;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class VendorList implements Serializable {
+
+    /* 主表字段 */
+    private Long ve_id;
+    /**
+     * 供应商编号
+     */
+    private String ve_code;
+    /**
+     * 供应商名称
+     */
+    private String ve_name;
+    /**
+     * 供应商UU
+     */
+    private String ve_uu;
+    /**
+     * 供应商类型
+     */
+    private String ve_type;
+    /**
+     * 期初日期
+     */
+    private Date ve_begindate;
+    /**
+     * 期初应付
+     */
+    private long ve_beginapamount;
+    /**
+     * 期初预付
+     */
+    private long ve_beginprepayamount;
+    /**
+     * 承付天数
+     */
+    private long ve_promisedays;
+    /**
+     * 税率
+     */
+    private double ve_taxrate;
+    /**
+     * 纳税人识别号
+     */
+    private String ve_nsrzh;
+    /**
+     * 银行账号
+     */
+    private String ve_bankaccount;
+    /**
+     * 银行行号
+     */
+    private String ve_bankcode;
+    /**
+     * 状态   defualt "启用"
+     */
+    private String ve_status;
+    /**
+     * 状态码
+     */
+    private String ve_statuscode;
+    /**
+     * 录入人ID
+     */
+    private long ve_recordid;
+    /**
+     * 录入人
+     */
+    private String ve_recordname;
+    /**
+     * 建立日期
+     */
+    private Date ve_initdate;
+    /**
+     * 自定义字段
+     */
+    private String ve_text1;
+    /**
+     * 自定义字段
+     */
+    private String ve_text2;
+    /**
+     * 自定义字段
+     */
+    private String ve_text3;
+    /**
+     * 自定义字段
+     */
+    private String ve_text4;
+    /**
+     * 自定义字段
+     */
+    private String ve_text5;
+
+    /* 从表字段 */
+
+    private Integer vc_veid;
+
+    private Integer vc_detno;
+
+    private String vc_name;
+
+    private Integer vc_tel;
+
+    private String vc_qq;
+
+    private String vc_email;
+
+    private String vc_text1;
+
+    private String vc_text2;
+
+    private String vc_text3;
+
+    private String vc_text4;
+
+    private String vc_text5;
+
+    private String vc_default;
+
+}

+ 41 - 31
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendorcontact.java

@@ -6,7 +6,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 public class Vendorcontact extends CommonBaseEntity implements Serializable {
-    private Integer vc_veid;
+    private Long vc_veid;
 
     private Integer vc_detno;
 
@@ -18,21 +18,23 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
 
     private String vc_email;
 
-    private String ve_text1;
+    private String vc_text1;
 
-    private String ve_text2;
+    private String vc_text2;
 
-    private String ve_text3;
+    private String vc_text3;
 
-    private String ve_text4;
+    private String vc_text4;
 
-    private String ve_text5;
+    private String vc_text5;
 
-    public Integer getVc_veid() {
+    private String vc_default;
+
+    public Long getVc_veid() {
         return vc_veid;
     }
 
-    public void setVc_veid(Integer vc_veid) {
+    public void setVc_veid(Long vc_veid) {
         this.vc_veid = vc_veid;
     }
 
@@ -49,7 +51,7 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_name(String vc_name) {
-        this.vc_name = vc_name == null ? null : vc_name.trim();
+        this.vc_name = vc_name;
     }
 
     public Integer getVc_tel() {
@@ -65,7 +67,7 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_qq(String vc_qq) {
-        this.vc_qq = vc_qq == null ? null : vc_qq.trim();
+        this.vc_qq = vc_qq;
     }
 
     public String getVc_email() {
@@ -73,46 +75,54 @@ public class Vendorcontact extends CommonBaseEntity implements Serializable {
     }
 
     public void setVc_email(String vc_email) {
-        this.vc_email = vc_email == null ? null : vc_email.trim();
+        this.vc_email = vc_email;
+    }
+
+    public String getVc_text1() {
+        return vc_text1;
+    }
+
+    public void setVc_text1(String vc_text1) {
+        this.vc_text1 = vc_text1;
     }
 
-    public String getVe_text1() {
-        return ve_text1;
+    public String getVc_text2() {
+        return vc_text2;
     }
 
-    public void setVe_text1(String ve_text1) {
-        this.ve_text1 = ve_text1 == null ? null : ve_text1.trim();
+    public void setVc_text2(String vc_text2) {
+        this.vc_text2 = vc_text2;
     }
 
-    public String getVe_text2() {
-        return ve_text2;
+    public String getVc_text3() {
+        return vc_text3;
     }
 
-    public void setVe_text2(String ve_text2) {
-        this.ve_text2 = ve_text2 == null ? null : ve_text2.trim();
+    public void setVc_text3(String vc_text3) {
+        this.vc_text3 = vc_text3;
     }
 
-    public String getVe_text3() {
-        return ve_text3;
+    public String getVc_text4() {
+        return vc_text4;
     }
 
-    public void setVe_text3(String ve_text3) {
-        this.ve_text3 = ve_text3 == null ? null : ve_text3.trim();
+    public void setVc_text4(String vc_text4) {
+        this.vc_text4 = vc_text4;
     }
 
-    public String getVe_text4() {
-        return ve_text4;
+    public String getVc_text5() {
+        return vc_text5;
     }
 
-    public void setVe_text4(String ve_text4) {
-        this.ve_text4 = ve_text4 == null ? null : ve_text4.trim();
+    public void setVc_text5(String vc_text5) {
+        this.vc_text5 = vc_text5;
     }
 
-    public String getVe_text5() {
-        return ve_text5;
+    public String getVc_default() {
+        return vc_default;
     }
 
-    public void setVe_text5(String ve_text5) {
-        this.ve_text5 = ve_text5 == null ? null : ve_text5.trim();
+    public void setVc_default(String vc_default) {
+        this.vc_default = vc_default;
     }
 }

+ 1 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/BankinformationController.java

@@ -13,7 +13,7 @@ import java.util.List;
  * @date 2018/10/25 15:33
  **/
 @RestController
-@RequestMapping("/Bankinformation")
+@RequestMapping("/bankinformation")
 public class BankinformationController {
     @Autowired
     BankinformationService bankinformationService;

+ 5 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerkindController.java

@@ -34,4 +34,9 @@ public class CustomerkindController {
         return Result.success(customerkindList);
     }
 
+    @GetMapping("/getCombo")
+    public Result getCombo(){
+        List<Customerkind> customerkindList = customerkindService.getCombo();
+        return Result.success(customerkindList);
+    }
 }

+ 28 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java

@@ -6,10 +6,12 @@ import com.usoftchina.saas.base.Result;
 
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -22,9 +24,15 @@ public class ProductController {
     @Autowired
     private ProductService productService;
 
+    /**
+     * 通过条件查找物料
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  Result<List<ProductDTO>>
+     */
     @RequestMapping("/getProductsByCondition")
-    public Result<List<ProductDTO>> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO){
-        PageInfo<ProductDTO> productList = productService.getProductsByCondition(page, docReqDTO);
+    public Result<List<ProductDTO>> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO){
+        PageInfo<ProductDTO> productList = productService.getProductsByCondition(page, listReqDTO);
         return Result.success(productList);
     }
 
@@ -44,4 +52,22 @@ public class ProductController {
         return productService.getProductsByPK(id);
     }
 
+    @PostMapping("/save")
+    public Result save(@RequestBody Product product){
+        productService.save(product);
+        return Result.success();
+    }
+
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        productService.removeByPrimaryKey(id);
+        return Result.success();
+    }
+
+    @PostMapping("/close/{id}")
+    public Result close(@PathVariable("id") Long id){
+        productService.close(id);
+        return Result.success();
+    }
+
 }

+ 69 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java

@@ -3,10 +3,12 @@ package com.usoftchina.saas.document.controller;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
 
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
 import com.usoftchina.saas.document.dto.VendorListDTO;
+import com.usoftchina.saas.document.entities.VendorList;
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,16 +23,81 @@ public class VendorController {
     @Autowired
     private VendorService vendorService;
 
+    /**
+     * 获取供应商信息
+     * @param page
+     * @param listReqDTO
+     * @return
+     */
     @GetMapping("/getVendorsByCondition")
     public Result<List<VendorDTO>> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO){
         PageInfo<VendorDTO> vendorList = vendorService.getVendorsByCondition(page, listReqDTO);
         return Result.success(vendorList);
     }
 
+    /**
+     * 通过供应商ID查找  供应商主从表数据
+     * @param id
+     * @return
+     */
     @GetMapping("/getListById/{id}")
     public Result<VendorListDTO> getDataById(@PathVariable("id") Long id){
-//        List<> vendorService.getListById(id);
-        return null;
+        VendorListDTO vendorListDTO = vendorService.getListById(id);
+        return Result.success(vendorListDTO);
+    }
+
+    /**
+     * 获取 供应商列表数据,包含供应商主表、从表数据
+     * @param listReqDTO
+     * @return
+     */
+    @GetMapping("/getListDataByCondition")
+    public Result<List<VendorList>> getListDataByCondition(ListReqDTO listReqDTO){
+        return Result.success(vendorService.getListDataByCondition(listReqDTO));
+    }
+
+    /**
+     * 保存供应商资料, 主从表数据
+     * @param vendorListDTO
+     * @return
+     */
+    @PostMapping("/save")
+    public Result saveFormData(@RequestBody VendorListDTO vendorListDTO){
+        DocBaseDTO docBaseDTO = vendorService.saveFormData(vendorListDTO);
+        return Result.success(docBaseDTO);
+    }
+
+    /**
+     * 删除
+     * @param id
+     * @return
+     */
+    @PostMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id){
+        vendorService.deleteById(id);
+        return Result.success();
+    }
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    @PostMapping("/close/{id}")
+    public Result close(@PathVariable("id") Long id){
+        vendorService.close(id);
+        return Result.success();
+    }
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    @PostMapping("/open/{id}")
+    public Result open(@PathVariable("id") Long id){
+        vendorService.open(id);
+        return Result.success();
     }
 
 }

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerkindMapper.java

@@ -3,6 +3,8 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Customerkind;
 
+import java.util.List;
+
 public interface CustomerkindMapper extends CommonBaseMapper<Customerkind> {
     int deleteByPrimaryKey(Long id);
 
@@ -15,4 +17,6 @@ public interface CustomerkindMapper extends CommonBaseMapper<Customerkind> {
     int updateByPrimaryKeySelective(Customerkind record);
 
     int updateByPrimaryKey(Customerkind record);
+
+    List<Customerkind> getCombo();
 }

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java

@@ -6,12 +6,13 @@ import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 public interface ProductMapper extends CommonBaseMapper<Product> {
 
-    List<ProductDTO> getProductsByCondition(DocReqDTO docReqDTO);
+    List<ProductDTO> getProductsByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
     List<ComboDTO> getProdUnit();
     void updateLatestPurchasePrice(Long pu_id);
 

+ 3 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java

@@ -4,7 +4,9 @@ import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 
 
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -13,4 +15,5 @@ public interface VendorMapper extends CommonBaseMapper<Vendor> {
 
     List<VendorDTO> getVendorsByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
 
+    List<VendorList> getListDataByCondition(@Param("condition") String condition, @Param("companyId") Long companyId);
 }

+ 10 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorcontactMapper.java

@@ -3,6 +3,8 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Vendorcontact;
 
+import java.util.List;
+
 public interface VendorcontactMapper extends CommonBaseMapper<Vendorcontact> {
     int deleteByPrimaryKey(Long vc_id);
 
@@ -15,4 +17,12 @@ public interface VendorcontactMapper extends CommonBaseMapper<Vendorcontact> {
     int updateByPrimaryKeySelective(Vendorcontact record);
 
     int updateByPrimaryKey(Vendorcontact record);
+
+    List<Vendorcontact> selectByFK(Long id);
+
+    void batchInsert(List<Vendorcontact> vendorcontactList);
+
+    void batchUpdate(List<Vendorcontact> vendorcontactList);
+
+    void deleteByFK(Long id);
 }

+ 4 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerkindService.java

@@ -4,6 +4,10 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.document.entities.Customerkind;
 import com.usoftchina.saas.document.mapper.CustomerkindMapper;
 
+import java.util.List;
+
 public interface CustomerkindService extends CommonBaseService<CustomerkindMapper, Customerkind> {
 
+    List<Customerkind> getCombo();
+
 }

+ 30 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java

@@ -5,7 +5,8 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 
 
 import com.usoftchina.saas.commons.dto.ComboDTO;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
@@ -16,12 +17,38 @@ import java.util.List;
 
 public interface ProductService extends CommonBaseService<ProductMapper, Product> {
 
-
-    PageInfo<ProductDTO> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO);
+    /**
+     * 获取物料
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  PageInfo<ProductDTO>
+     */
+    PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO);
 
     List<ComboDTO> getProdUnit();
 
     void updateLatestPurchasePrice(Long pu_id);
 
     Product getProductsByPK(Long id);
+
+    /**
+     * 保存/更新
+     * @param product
+     * @return
+     */
+    DocBaseDTO saveData(Product product);
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    boolean close(Long id);
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    boolean open(Long id);
 }

+ 51 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java

@@ -3,18 +3,67 @@ package com.usoftchina.saas.document.service;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
 
-
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
 import com.usoftchina.saas.document.mapper.VendorMapper;
 
 import com.usoftchina.saas.page.PageRequest;
 
+import java.util.List;
+
 
 public interface VendorService extends CommonBaseService<VendorMapper, Vendor>{
 
+    /**
+     * 获取主表数据
+     * @param page      分页对象
+     * @param listReqDTO    条件对象
+     * @return  PageInfo<VendorDTO>
+     */
     PageInfo<VendorDTO> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO);
 
+    /**
+     * 通过ID 获取主从表数据
+     * @param id
+     * @return VendorListDTO
+     */
+    VendorListDTO getListById(Long id);
+
+    /**
+     * 获取供应商资料列表
+     * @param listReqDTO  条件对象
+     * @return List<VendorList>
+     */
+    List<VendorList> getListDataByCondition(ListReqDTO listReqDTO);
+
+    /**
+     * 保存主从表数据
+     * @param vendorListDTO
+     * @return  DocBaseDTO
+     */
+    DocBaseDTO saveFormData(VendorListDTO vendorListDTO);
+
+    /**
+     * 通过主表ID  删除主从表数据
+     * @param id
+     */
+    void deleteById(Long id);
+
+    /**
+     * 关闭
+     * @param id
+     * @return  boolean
+     */
+    boolean close(Long id);
+
+    /**
+     * 开启
+     * @param id
+     * @return  boolean
+     */
+    boolean open(Long id);
 }

+ 23 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/AddressServiceImpl.java

@@ -1,6 +1,10 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Address;
 import com.usoftchina.saas.document.mapper.AddressMapper;
 import com.usoftchina.saas.document.service.AddressService;
@@ -12,6 +16,10 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
 
     @Autowired
     private AddressMapper addressMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
+
 
     /**
      * 保存
@@ -20,7 +28,16 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
      */
     @Override
     public boolean save(Address address){
-        addressMapper.insertSelective(address);
+        if(address.getId() == 0){
+            address.setCompanyId(BaseContextHolder.getCompanyId());
+            addressMapper.insertSelective(address);
+            //记录LOG
+            messageLogService.save(generateMsgObj(address.getId()));
+        }else{
+            addressMapper.updateByPrimaryKeySelective(address);
+            //记录LOG
+            messageLogService.update(generateMsgObj(address.getId()));
+        }
         return true;
     }
 
@@ -33,6 +50,7 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
     public boolean removeByPrimaryKey(Long id){
         if(id != null && id > 0){
             addressMapper.deleteByPrimaryKey(id);
+            messageLogService.delete(generateMsgObj(id));
         }
         return true;
     }
@@ -47,4 +65,8 @@ public class AddressServiceImpl extends CommonBaseServiceImpl<AddressMapper, Add
             addressMapper.deleteByIds(ids);
         }
     }
+
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Address");
+    }
 }

+ 35 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerkindServiceImpl.java

@@ -1,17 +1,24 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Customerkind;
 import com.usoftchina.saas.document.mapper.CustomerkindMapper;
 import com.usoftchina.saas.document.service.CustomerkindService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindMapper, Customerkind> implements CustomerkindService {
 
     @Autowired
     private CustomerkindMapper customerkindMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     /**
      * 保存
@@ -21,17 +28,44 @@ public class CustomerkindServiceImpl extends CommonBaseServiceImpl<CustomerkindM
     @Override
     public boolean save(Customerkind customerkind){
         if(customerkind.getId() == 0){
+            customerkind.setCompanyId(BaseContextHolder.getCompanyId());
             customerkindMapper.insertSelective(customerkind);
+            //记录LOG
+            messageLogService.save(generateMsgObj(customerkind.getId()));
         }else{
             customerkindMapper.updateByPrimaryKeySelective(customerkind);
+            //记录LOG
+            messageLogService.update(generateMsgObj(customerkind.getId()));
         }
         return true;
     }
 
+    /**
+     * 删除
+     * @param id
+     * @return
+     */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        customerkindMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            customerkindMapper.deleteByPrimaryKey(id);
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "CustomerKind");
+    }
+
+    @Override
+    public List<Customerkind> getCombo() {
+        List<Customerkind> customerkindList = getMapper().getCombo();
+        return customerkindList;
+    }
 }

+ 21 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/FundinouttypeServiceImpl.java

@@ -1,10 +1,14 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.po.Messagelog;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Fundinouttype;
 import com.usoftchina.saas.document.mapper.FundinouttypeMapper;
 import com.usoftchina.saas.document.service.FundinouttypeService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -12,6 +16,9 @@ import java.util.List;
 @Service
 public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<FundinouttypeMapper, Fundinouttype> implements FundinouttypeService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     /**
      * 保存/更新
      * @param fundinouttype
@@ -19,11 +26,15 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      */
     @Override
     public boolean save(Fundinouttype fundinouttype){
-        fundinouttype.setCompanyId(BaseContextHolder.getCompanyId());
         if(fundinouttype.getId() == 0){
+            fundinouttype.setCompanyId(BaseContextHolder.getCompanyId());
             getMapper().insertSelective(fundinouttype);
+            //记录LOG
+            messageLogService.save(generateMsgObj(fundinouttype.getId()));
         }else{
             getMapper().updateByPrimaryKeySelective(fundinouttype);
+            //记录LOG
+            messageLogService.update(generateMsgObj(fundinouttype.getId()));
         }
         return true;
     }
@@ -35,8 +46,16 @@ public class FundinouttypeServiceImpl extends CommonBaseServiceImpl<Fundinouttyp
      */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        getMapper().deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, null, "FundInOutType");
+    }
+
 }

+ 91 - 4
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductServiceImpl.java

@@ -3,13 +3,20 @@ package com.usoftchina.saas.document.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.ComboDTO;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.Status;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.ProductDTO;
 import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
 import com.usoftchina.saas.document.service.ProductService;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -17,8 +24,11 @@ import java.util.List;
 @Service
 public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Product> implements ProductService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
-    public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, DocReqDTO docReqDTO) {
+    public PageInfo<ProductDTO> getProductsByCondition(PageRequest page, ListReqDTO listReqDTO) {
         //设置分页
         if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
             page = new PageRequest();
@@ -26,7 +36,7 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
             page.setSize(10);
         }
         PageHelper.startPage(page.getNumber(), page.getSize());
-        List<ProductDTO> productList = getMapper().getProductsByCondition(docReqDTO);
+        List<ProductDTO> productList = getList(listReqDTO);
         //取分页信息
         PageInfo<ProductDTO> pageInfo = new PageInfo<ProductDTO>(productList);
         return pageInfo;
@@ -40,13 +50,90 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     @Override
     public void updateLatestPurchasePrice(Long pu_id) {
         getMapper().updateLatestPurchasePrice(pu_id);
+        messageLogService.update(generateMsgObj(pu_id));
     }
 
     @Override
     public Product getProductsByPK(Long id) {
-        if (null == id) {
+        if (null != id) {
             return getMapper().selectByPrimaryKey(id);
         }
         return null;
     }
+
+    @Override
+    public DocBaseDTO saveData(Product product){
+        DocBaseDTO docBaseDTO = null;
+        if(product.getId() == 0){
+            product.setCompanyId(BaseContextHolder.getCompanyId());
+            getMapper().insertSelective(product);
+            docBaseDTO = generateMsgObj(product.getId());
+            //记录LOG
+            messageLogService.save(docBaseDTO);
+        }else{
+            getMapper().updateByPrimaryKeySelective(product);
+            docBaseDTO = generateMsgObj(product.getId());
+            //记录LOG
+            messageLogService.update(docBaseDTO);
+        }
+        return docBaseDTO;
+    }
+
+    @Override
+    public boolean close(Long id) {
+        if(id != null && id > 0){
+            Product product = new Product();
+            product.setId(id);
+            product.setPr_status(Status.CLOSE.getDisplay());
+            product.setPr_statuscode(Status.CLOSE.name());
+            getMapper().updateByPrimaryKeySelective(product);
+            //记录LOG
+            messageLogService.close(generateMsgObj(id));
+            return true;
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    @Override
+    public boolean open(Long id) {
+        if(id != null && id > 0){
+            Product product = getMapper().selectByPrimaryKey(id);
+            if (product == null) {
+                throw new BizException(BizExceptionCode.NO_DATA);
+            }
+            if (!Status.CLOSE.getDisplay().equals(product.getPr_status())){
+                throw new BizException(BizExceptionCode.BIZ_OPEN);
+            }else{
+                product.setId(id);
+                product.setPr_statuscode(Status.OPEN.name());
+                product.setPr_status(Status.OPEN.getDisplay());
+                getMapper().updateByPrimaryKeySelective(product);
+                //记录LOG
+                messageLogService.open(generateMsgObj(id));
+                return true;
+            }
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    private List<ProductDTO> getList(ListReqDTO listReqDTO){
+        Long companyId = BaseContextHolder.getCompanyId();
+        String condition = listReqDTO.getFinalCondition();
+        if(condition == null){
+            condition = "1=1";
+        }
+        List<ProductDTO> productDTOList = getMapper().getProductsByCondition(condition, companyId);
+        return productDTOList;
+    }
+
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Product");
+    }
 }

+ 7 - 6
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productbrand;
@@ -14,10 +15,10 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
 
     @Autowired
     private ProductbrandMapper productbrandMapper;
-//    @Autowired
-//    private MessageLogService messageLogService;
+    @Autowired
+    private MessageLogService messageLogService;
 
-    private final String LOG_NAME = "物料品牌";
+    private final String LOG_NAME = "ProductBrand";
 
     @Override
     public boolean save(Productbrand productbrand){
@@ -26,12 +27,12 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
             productbrandMapper.insertSelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
-//            messageLogService.save(docBaseDTO);
+            messageLogService.save(docBaseDTO);
         }else{
             productbrandMapper.updateByPrimaryKeySelective(productbrand);
             //记录日志
             DocBaseDTO docBaseDTO = new DocBaseDTO(productbrand.getId(), null, LOG_NAME);
-//            messageLogService.update(docBaseDTO);
+            messageLogService.update(docBaseDTO);
         }
         return true;
     }
@@ -41,7 +42,7 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
         productbrandMapper.deleteByPrimaryKey(id);
         //记录日志
         DocBaseDTO docBaseDTO = new DocBaseDTO(id, null, LOG_NAME);
-//        messageLogService.delete(docBaseDTO);
+        messageLogService.delete(docBaseDTO);
         return true;
     }
 

+ 24 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProducttypeServiceImpl.java

@@ -1,6 +1,9 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Producttype;
 import com.usoftchina.saas.document.mapper.ProducttypeMapper;
 import com.usoftchina.saas.document.service.ProducttypeService;
@@ -14,6 +17,8 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
 
     @Autowired
     private ProducttypeMapper producttypeMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     /**
      * 保存
@@ -23,9 +28,14 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
     @Override
     public boolean save(Producttype producttype){
         if(producttype.getId() == 0){
+            producttype.setCompanyId(BaseContextHolder.getCompanyId());
             producttypeMapper.insertSelective(producttype);
+            //记录LOG
+            messageLogService.save(generateMsgObj(producttype.getId()));
         }else{
             producttypeMapper.updateByPrimaryKeySelective(producttype);
+            //记录LOG
+            messageLogService.update(generateMsgObj(producttype.getId()));
         }
         return true;
     }
@@ -37,8 +47,21 @@ public class ProducttypeServiceImpl extends CommonBaseServiceImpl<ProducttypeMap
      */
     @Override
     public boolean removeByPrimaryKey(Long id){
-        producttypeMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            producttypeMapper.deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "ProductType");
+    }
+
 }

+ 25 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductunitServiceImpl.java

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Productunit;
 import com.usoftchina.saas.document.mapper.ProductunitMapper;
 import com.usoftchina.saas.document.service.ProductunitService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -12,20 +15,31 @@ import java.util.List;
 @Service
 public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMapper, Productunit> implements ProductunitService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
     public boolean save(Productunit productunit){
-        productunit.setCompanyId(BaseContextHolder.getCompanyId());
         if(productunit.getId() == 0){
+            productunit.setCompanyId(BaseContextHolder.getCompanyId());
             getMapper().insertSelective(productunit);
+            //记录LOG
+            messageLogService.save(generateMsgObj(productunit.getId()));
         }else{
             getMapper().updateByPrimaryKeySelective(productunit);
+            //记录LOG
+            messageLogService.update(generateMsgObj(productunit.getId()));
         }
         return true;
     }
 
     @Override
     public boolean removeByPrimaryKey(Long id){
-        getMapper().deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
@@ -35,4 +49,13 @@ public class ProductunitServiceImpl extends CommonBaseServiceImpl<ProductunitMap
         return productunitList;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "ProductUnit");
+    }
+
 }

+ 144 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorServiceImpl.java

@@ -3,15 +3,23 @@ package com.usoftchina.saas.document.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
-import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.dto.VendorListDTO;
 import com.usoftchina.saas.document.entities.Vendor;
+import com.usoftchina.saas.document.entities.VendorList;
+import com.usoftchina.saas.document.entities.Vendorcontact;
 import com.usoftchina.saas.document.mapper.VendorMapper;
+import com.usoftchina.saas.document.mapper.VendorcontactMapper;
 import com.usoftchina.saas.document.service.VendorService;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
-import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -23,6 +31,11 @@ import java.util.List;
 @Service
 public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendor> implements VendorService {
 
+    @Autowired
+    private VendorcontactMapper vendorcontactMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
     @Override
     public PageInfo<VendorDTO> getVendorsByCondition(PageRequest page, ListReqDTO listReqDTO) {
         //设置分页
@@ -38,6 +51,126 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
         return pageInfo;
     }
 
+    /**
+     * 通过ID查找主从表数据
+     * @param id
+     * @return
+     */
+    @Override
+    public VendorListDTO getListById(Long id) {
+        VendorListDTO vendorListDTO = new VendorListDTO();
+        Vendor vendor = getMapper().selectByPrimaryKey(id);
+        List<Vendorcontact> vendorcontactList = vendorcontactMapper.selectByFK(id);
+        //设置主从表信息
+        vendorListDTO.setMain(vendor);
+        vendorListDTO.setItems(vendorcontactList);
+        return vendorListDTO;
+    }
+
+    /**
+     * 返回列表数据
+     * @return
+     */
+    public List<VendorList> getListDataByCondition(ListReqDTO listReqDTO){
+        String condition = listReqDTO.getFinalCondition();
+        return getMapper().getListDataByCondition(condition, BaseContextHolder.getCompanyId());
+    }
+
+    /**
+     * 保存主从表数据
+     * @param vendorListDTO
+     */
+    @Override
+    public DocBaseDTO saveFormData(VendorListDTO vendorListDTO) {
+        Vendor main = vendorListDTO.getMain();
+        main.setCompanyId(BaseContextHolder.getCompanyId());
+        List<Vendorcontact> items = vendorListDTO.getItems();
+        if(main.getId() == 0){
+            //保存主表信息
+            getMapper().insertSelective(main);
+            Long mainId = main.getId();
+            //更新明细表vc_veid
+            for(Vendorcontact item : items){
+                item.setVc_veid(mainId);
+                item.setCompanyId(BaseContextHolder.getCompanyId());
+            }
+            //保存明细表信息
+            vendorcontactMapper.batchInsert(items);
+            //记录LOG
+            messageLogService.save(generateMsgObj(mainId));
+        }else{
+            getMapper().updateByPrimaryKeySelective(main);
+            vendorcontactMapper.batchUpdate(items);
+            //记录LOG
+            messageLogService.update(generateMsgObj(main.getId()));
+        }
+        return generateMsgObj(main.getId());
+    }
+
+    /**
+     * 删除主从表数据
+     * @param id
+     */
+    @Override
+    public void deleteById(Long id) {
+        if(id != null && id > 0){
+            getMapper().deleteByPrimaryKey(id);
+            vendorcontactMapper.deleteByFK(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
+    }
+
+    /**
+     * 关闭
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean close(Long id){
+        if(id != null && id > 0){
+            Vendor vendor = new Vendor();
+            vendor.setId(id);
+            vendor.setVe_status(Status.CLOSE.getDisplay());
+            vendor.setVe_statuscode(Status.CLOSE.name());
+            getMapper().updateByPrimaryKeySelective(vendor);
+            //记录LOG
+            messageLogService.close(generateMsgObj(id));
+            return true;
+        }else{
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
+    /**
+     * 开启
+     * @param id
+     * @return
+     */
+    @Override
+    public boolean open(Long id){
+        if (id != null && id > 0){
+            Vendor vendor = getMapper().selectByPrimaryKey(id);
+            if(vendor == null){
+                throw new BizException(BizExceptionCode.NO_DATA);
+            }
+            if (Status.CLOSE.name().equals(vendor.getVe_statuscode())){
+                vendor = new Vendor();
+                vendor.setId(id);
+                vendor.setVe_statuscode(Status.OPEN.name());
+                vendor.setVe_status(Status.OPEN.getDisplay());
+                getMapper().updateByPrimaryKeySelective(vendor);
+                //记录LOG
+                messageLogService.open(generateMsgObj(id));
+                return true;
+            }else {
+                throw new BizException(BizExceptionCode.BIZ_OPEN);
+            }
+        }else {
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+    }
+
     private List<VendorDTO> getList(ListReqDTO listReqDTO){
         Long companyId = BaseContextHolder.getCompanyId();
         String condition = listReqDTO.getFinalCondition();
@@ -48,4 +181,13 @@ public class VendorServiceImpl extends CommonBaseServiceImpl<VendorMapper, Vendo
         return vendorDTOList;
     }
 
+    /**
+     * 构造日记记录对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Vendor");
+    }
+
 }

+ 23 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/VendorkindServiceImpl.java

@@ -1,6 +1,9 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Vendorkind;
 import com.usoftchina.saas.document.mapper.VendorkindMapper;
 import com.usoftchina.saas.document.service.VendorkindService;
@@ -12,21 +15,40 @@ public class VendorkindServiceImpl extends CommonBaseServiceImpl<VendorkindMappe
 
     @Autowired
     private VendorkindMapper vendorkindMapper;
+    @Autowired
+    private MessageLogService messageLogService;
 
     @Override
     public boolean save(Vendorkind vendorkind){
         if(vendorkind.getId() == 0){
+            vendorkind.setCompanyId(BaseContextHolder.getCompanyId());
             vendorkindMapper.insertSelective(vendorkind);
+            //记录LOG
+            messageLogService.save(generateMsgObj(vendorkind.getId()));
         }else{
             vendorkindMapper.updateByPrimaryKeySelective(vendorkind);
+            //记录LOG
+            messageLogService.update(generateMsgObj(vendorkind.getId()));
         }
         return true;
     }
 
     @Override
     public boolean removeByPrimaryKey(Long id){
-        vendorkindMapper.deleteByPrimaryKey(id);
+        if(id != null && id > 0){
+            vendorkindMapper.deleteByPrimaryKey(id);
+            //记录LOG
+            messageLogService.delete(generateMsgObj(id));
+        }
         return true;
     }
 
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "VendorKind");
+    }
 }

+ 25 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/WarehouseServiceImpl.java

@@ -1,10 +1,13 @@
 package com.usoftchina.saas.document.service.impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
 import com.usoftchina.saas.document.service.WarehouseService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -13,6 +16,9 @@ import java.util.Map;
 @Service
 public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService {
 
+    @Autowired
+    private MessageLogService messageLogService;
+
     /**
      * 过账
      * @param map
@@ -48,7 +54,16 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
      */
     @Override
     public int insertSelective(Warehouse record) {
-        int count = getMapper().insertSelective(record);
+        int count = 0;
+        if(record.getId() == 0){
+            count = getMapper().insertSelective(record);
+            //记录LOG
+            messageLogService.save(generateMsgObj(record.getId()));
+        }else{
+            getMapper().updateByPrimaryKeySelective(record);
+            //记录LOG
+            messageLogService.update(generateMsgObj(record.getId()));
+        }
         return count;
     }
 
@@ -60,4 +75,13 @@ public class WarehouseServiceImpl extends CommonBaseServiceImpl<WarehouseMapper,
     public void unPost(Map<String, Object> map) {
         getMapper().unPost(map);
     }
+
+    /**
+     * 构造 记录日志对象
+     * @param id
+     * @return
+     */
+    private DocBaseDTO generateMsgObj(Long id){
+        return new DocBaseDTO(id, "", "Warehouse");
+    }
 }

+ 3 - 0
applications/document/document-server/src/main/resources/mapper/CustomerkindMapper.xml

@@ -122,4 +122,7 @@
   <select id="selectAll" resultMap="BaseResultMap">
     SELECT * FROM CUSTOMERKIND
   </select>
+  <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
+    SELECT ck_name display,ck_name value FROM CUSTOMERKIND
+  </select>
 </mapper>

+ 49 - 0
applications/document/document-server/src/main/resources/mapper/VendorMapper.xml

@@ -50,5 +50,54 @@
         ORDER BY VE_ID
     </select>
 
+    <resultMap id="VendorListResultMapper" type="com.usoftchina.saas.document.entities.VendorList">
+        <id column="ve_id" property="ve_id" jdbcType="INTEGER" />
+        <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
+        <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
+        <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
+        <result column="ve_type" property="ve_type" jdbcType="VARCHAR" />
+        <result column="ve_begindate" property="ve_begindate" jdbcType="TIMESTAMP" />
+        <result column="ve_beginapamount" property="ve_beginapamount" jdbcType="INTEGER" />
+        <result column="ve_beginprepayamount" property="ve_beginprepayamount" jdbcType="INTEGER" />
+        <result column="ve_promisedays" property="ve_promisedays" jdbcType="INTEGER" />
+        <result column="ve_taxrate" property="ve_taxrate" jdbcType="DOUBLE" />
+        <result column="ve_nsrzh" property="ve_nsrzh" jdbcType="VARCHAR" />
+        <result column="ve_bankaccount" property="ve_bankaccount" jdbcType="VARCHAR" />
+        <result column="ve_bankcode" property="ve_bankcode" jdbcType="VARCHAR" />
+        <result column="ve_status" property="ve_status" jdbcType="VARCHAR" />
+        <result column="ve_statuscode" property="ve_statuscode" jdbcType="VARCHAR" />
+        <result column="ve_recordid" property="ve_recordid" jdbcType="INTEGER" />
+        <result column="ve_recordname" property="ve_recordname" jdbcType="VARCHAR" />
+        <result column="ve_initdate" property="ve_initdate" jdbcType="TIMESTAMP" />
+        <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
+        <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
+        <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
+        <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
+        <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
+        <result column="vc_veid" property="vc_veid" jdbcType="INTEGER" />
+        <result column="vc_detno" property="vc_detno" jdbcType="INTEGER" />
+        <result column="vc_name" property="vc_name" jdbcType="VARCHAR" />
+        <result column="vc_tel" property="vc_tel" jdbcType="INTEGER" />
+        <result column="vc_qq" property="vc_qq" jdbcType="VARCHAR" />
+        <result column="vc_email" property="vc_email" jdbcType="VARCHAR" />
+        <result column="vc_text1" property="vc_text1" jdbcType="VARCHAR" />
+        <result column="vc_text2" property="vc_text2" jdbcType="VARCHAR" />
+        <result column="vc_text3" property="vc_text3" jdbcType="VARCHAR" />
+        <result column="vc_text4" property="vc_text4" jdbcType="VARCHAR" />
+        <result column="vc_text5" property="vc_text5" jdbcType="VARCHAR" />
+        <result column="vc_default" property="vc_default" jdbcType="VARCHAR" />
+    </resultMap>
+
+    <select id="getListDataByCondition" resultMap="VendorListResultMapper">
+        SELECT * FROM VENDOR LEFT JOIN VENDORCONTACT ON VE_ID = VC_VEID
+        <where>
+            <if test="condition!=null">
+                ${condition}
+            </if>
+            AND VENDOR.COMPANYID = #{companyId}
+        </where>
+        order by VE_ID,VC_DETNO
+    </select>
+
 </mapper>
 

+ 219 - 49
applications/document/document-server/src/main/resources/mapper/VendorcontactMapper.xml

@@ -12,15 +12,16 @@
     <result column="companyId" property="companyId" jdbcType="INTEGER" />
     <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
     <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
-    <result column="ve_text1" property="ve_text1" jdbcType="VARCHAR" />
-    <result column="ve_text2" property="ve_text2" jdbcType="VARCHAR" />
-    <result column="ve_text3" property="ve_text3" jdbcType="VARCHAR" />
-    <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
-    <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
+    <result column="vc_text1" property="vc_text1" jdbcType="VARCHAR" />
+    <result column="vc_text2" property="vc_text2" jdbcType="VARCHAR" />
+    <result column="vc_text3" property="vc_text3" jdbcType="VARCHAR" />
+    <result column="vc_text4" property="vc_text4" jdbcType="VARCHAR" />
+    <result column="vc_text5" property="vc_text5" jdbcType="VARCHAR" />
+    <result column="vc_default" property="vc_default" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     vc_id, vc_veid, vc_detno, vc_name, vc_tel, vc_qq, vc_email, companyId, updaterId, 
-    updateTime, ve_text1, ve_text2, ve_text3, ve_text4, ve_text5
+    updateTime, vc_text1, vc_text2, vc_text3, vc_text4, vc_text5, ve_default
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
     select 
@@ -28,22 +29,33 @@
     from vendorcontact
     where vc_id = #{id}
   </select>
+  <select id="selectByFK" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+    select
+    <include refid="Base_Column_List" />
+    from vendorcontact
+    where vc_veid = #{id}
+  </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
     delete from vendorcontact
     where vc_id = #{id}
   </delete>
+  <delete id="deleteByFK" parameterType="java.lang.Long">
+    DELETE FROM VENDORCONTACT
+    WHERE VC_VEID=#{id}
+  </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
     insert into vendorcontact (vc_veid, vc_detno,
       vc_name, vc_tel, vc_qq, 
       vc_email, companyId, updaterId, 
-      updateTime, ve_text1, ve_text2, 
-      ve_text3, ve_text4, ve_text5
+      updateTime, vc_text1, vc_text2, 
+      vc_text3, vc_text4, vc_text5, ve_default
       )
-    values (#{vc_veid,jdbcType=INTEGER}, #{vc_detno,jdbcType=INTEGER},
+    values (#{vc_veid}, #{vc_detno,jdbcType=INTEGER},
       #{vc_name,jdbcType=VARCHAR}, #{vc_tel,jdbcType=INTEGER}, #{vc_qq,jdbcType=VARCHAR}, 
       #{vc_email,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, 
-      #{updateTime,jdbcType=TIMESTAMP}, #{ve_text1,jdbcType=VARCHAR}, #{ve_text2,jdbcType=VARCHAR}, 
-      #{ve_text3,jdbcType=VARCHAR}, #{ve_text4,jdbcType=VARCHAR}, #{ve_text5,jdbcType=VARCHAR}
+      #{updateTime,jdbcType=TIMESTAMP}, #{vc_text1,jdbcType=VARCHAR}, #{vc_text2,jdbcType=VARCHAR}, 
+      #{vc_text3,jdbcType=VARCHAR}, #{vc_text4,jdbcType=VARCHAR}, #{vc_text5,jdbcType=VARCHAR},
+      #{ve_default,jdbcType=VARCHAR}
       )
   </insert>
   <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
@@ -76,25 +88,28 @@
       <if test="updateTime != null" >
         updateTime,
       </if>
-      <if test="ve_text1 != null" >
-        ve_text1,
+      <if test="vc_text1 != null" >
+        vc_text1,
+      </if>
+      <if test="vc_text2 != null" >
+        vc_text2,
       </if>
-      <if test="ve_text2 != null" >
-        ve_text2,
+      <if test="vc_text3 != null" >
+        vc_text3,
       </if>
-      <if test="ve_text3 != null" >
-        ve_text3,
+      <if test="vc_text4 != null" >
+        vc_text4,
       </if>
-      <if test="ve_text4 != null" >
-        ve_text4,
+      <if test="vc_text5 != null" >
+        vc_text5,
       </if>
-      <if test="ve_text5 != null" >
-        ve_text5,
+      <if test="ve_default != null" >
+        ve_default,
       </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="vc_veid != null" >
-        #{vc_veid,jdbcType=INTEGER},
+        #{vc_veid},
       </if>
       <if test="vc_detno != null" >
         #{vc_detno,jdbcType=INTEGER},
@@ -120,20 +135,23 @@
       <if test="updateTime != null" >
         #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="ve_text1 != null" >
-        #{ve_text1,jdbcType=VARCHAR},
+      <if test="vc_text1 != null" >
+        #{vc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="vc_text2 != null" >
+        #{vc_text2,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text2 != null" >
-        #{ve_text2,jdbcType=VARCHAR},
+      <if test="vc_text3 != null" >
+        #{vc_text3,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text3 != null" >
-        #{ve_text3,jdbcType=VARCHAR},
+      <if test="vc_text4 != null" >
+        #{vc_text4,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text4 != null" >
-        #{ve_text4,jdbcType=VARCHAR},
+      <if test="vc_text5 != null" >
+        #{vc_text5,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text5 != null" >
-        #{ve_text5,jdbcType=VARCHAR},
+      <if test="ve_default != null" >
+        #{ve_default,jdbcType=VARCHAR},
       </if>
     </trim>
   </insert>
@@ -141,7 +159,7 @@
     update vendorcontact
     <set >
       <if test="vc_veid != null" >
-        vc_veid = #{vc_veid,jdbcType=INTEGER},
+        vc_veid = #{vc_veid},
       </if>
       <if test="vc_detno != null" >
         vc_detno = #{vc_detno,jdbcType=INTEGER},
@@ -167,27 +185,30 @@
       <if test="updateTime != null" >
         updateTime = #{updateTime,jdbcType=TIMESTAMP},
       </if>
-      <if test="ve_text1 != null" >
-        ve_text1 = #{ve_text1,jdbcType=VARCHAR},
+      <if test="vc_text1 != null" >
+        vc_text1 = #{vc_text1,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text2 != null" >
-        ve_text2 = #{ve_text2,jdbcType=VARCHAR},
+      <if test="vc_text2 != null" >
+        vc_text2 = #{vc_text2,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text3 != null" >
-        ve_text3 = #{ve_text3,jdbcType=VARCHAR},
+      <if test="vc_text3 != null" >
+        vc_text3 = #{vc_text3,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text4 != null" >
-        ve_text4 = #{ve_text4,jdbcType=VARCHAR},
+      <if test="vc_text4 != null" >
+        vc_text4 = #{vc_text4,jdbcType=VARCHAR},
       </if>
-      <if test="ve_text5 != null" >
-        ve_text5 = #{ve_text5,jdbcType=VARCHAR},
+      <if test="vc_text5 != null" >
+        vc_text5 = #{vc_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="ve_default != null" >
+        ve_default = #{ve_default,jdbcType=VARCHAR},
       </if>
     </set>
     where vc_id = #{id}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Vendorcontact" >
     update vendorcontact
-    set vc_veid = #{vc_veid,jdbcType=INTEGER},
+    set vc_veid = #{vc_veid},
       vc_detno = #{vc_detno,jdbcType=INTEGER},
       vc_name = #{vc_name,jdbcType=VARCHAR},
       vc_tel = #{vc_tel,jdbcType=INTEGER},
@@ -196,11 +217,160 @@
       companyId = #{companyId,jdbcType=INTEGER},
       updaterId = #{updaterId,jdbcType=INTEGER},
       updateTime = #{updateTime,jdbcType=TIMESTAMP},
-      ve_text1 = #{ve_text1,jdbcType=VARCHAR},
-      ve_text2 = #{ve_text2,jdbcType=VARCHAR},
-      ve_text3 = #{ve_text3,jdbcType=VARCHAR},
-      ve_text4 = #{ve_text4,jdbcType=VARCHAR},
-      ve_text5 = #{ve_text5,jdbcType=VARCHAR}
+      vc_text1 = #{vc_text1,jdbcType=VARCHAR},
+      vc_text2 = #{vc_text2,jdbcType=VARCHAR},
+      vc_text3 = #{vc_text3,jdbcType=VARCHAR},
+      vc_text4 = #{vc_text4,jdbcType=VARCHAR},
+      vc_text5 = #{vc_text5,jdbcType=VARCHAR},
+      ve_default = #{ve_default,jdbcType=VARCHAR}
     where vc_id = #{id}
   </update>
+  <insert id="batchInsert" parameterType="java.util.List">
+    <foreach collection="list" item="item" separator=",">
+      INSERT INTO VENDORCONTACT
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="item.vc_veid != null" >
+          vc_veid,
+        </if>
+        <if test="item.vc_detno != null" >
+          vc_detno,
+        </if>
+        <if test="item.vc_name != null" >
+          vc_name,
+        </if>
+        <if test="item.vc_tel != null" >
+          vc_tel,
+        </if>
+        <if test="item.vc_qq != null" >
+          vc_qq,
+        </if>
+        <if test="item.vc_email != null" >
+          vc_email,
+        </if>
+        <if test="item.companyId != null" >
+          companyId,
+        </if>
+        <if test="item.updaterId != null" >
+          updaterId,
+        </if>
+        <if test="item.updateTime != null" >
+          updateTime,
+        </if>
+        <if test="item.vc_text1 != null" >
+          vc_text1,
+        </if>
+        <if test="item.vc_text2 != null" >
+          vc_text2,
+        </if>
+        <if test="item.vc_text3 != null" >
+          vc_text3,
+        </if>
+        <if test="item.vc_text4 != null" >
+          vc_text4,
+        </if>
+        <if test="item.vc_text5 != null" >
+          vc_text5,
+        </if>
+        <if test="item.ve_default != null" >
+          ve_default,
+        </if>
+      </trim>
+      <trim prefix="(" suffix=")" suffixOverrides=",">
+        <if test="item.vc_veid != null" >
+          #{item.vc_veid},
+        </if>
+        <if test="item.vc_detno != null" >
+          #{item.vc_detno,jdbcType=INTEGER},
+        </if>
+        <if test="item.vc_name != null" >
+          #{item.vc_name,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_tel != null" >
+          #{item.vc_tel,jdbcType=INTEGER},
+        </if>
+        <if test="item.vc_qq != null" >
+          #{item.vc_qq,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_email != null" >
+          #{item.vc_email,jdbcType=VARCHAR},
+        </if>
+        <if test="item.companyId != null" >
+          #{item.companyId,jdbcType=INTEGER},
+        </if>
+        <if test="item.updaterId != null" >
+          #{item.updaterId,jdbcType=INTEGER},
+        </if>
+        <if test="item.updateTime != null" >
+          #{item.updateTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="item.vc_text1 != null" >
+          #{item.vc_text1,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text2 != null" >
+          #{item.vc_text2,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text3 != null" >
+          #{item.vc_text3,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text4 != null" >
+          #{item.vc_text4,jdbcType=VARCHAR},
+        </if>
+        <if test="item.vc_text5 != null" >
+          #{item.vc_text5,jdbcType=VARCHAR},
+        </if>
+        <if test="item.ve_default != null" >
+          #{item.ve_default,jdbcType=VARCHAR},
+        </if>
+      </trim>
+    </foreach>
+  </insert>
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.Vendorcontact">
+    <foreach collection="list" item="item" index="index" separator=";">
+      UPDATE VENDORCONTACT
+      <if test="item.vc_detno != null" >
+        vc_detno = #{item.vc_detno,jdbcType=INTEGER},
+      </if>
+      <if test="item.vc_name != null" >
+        vc_name = #{item.vc_name,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_tel != null" >
+        vc_tel = #{item.vc_tel,jdbcType=INTEGER},
+      </if>
+      <if test="item.vc_qq != null" >
+        vc_qq = #{item.vc_qq,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_email != null" >
+        vc_email = #{item.vc_email,jdbcType=VARCHAR},
+      </if>
+      <if test="item.companyId != null" >
+        companyId = #{item.companyId,jdbcType=INTEGER},
+      </if>
+      <if test="item.updaterId != null" >
+        updaterId = #{item.updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="item.updateTime != null" >
+        updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="item.vc_text1 != null" >
+        vc_text1 = #{item.vc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text2 != null" >
+        vc_text2 = #{item.vc_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text3 != null" >
+        vc_text3 = #{item.vc_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text4 != null" >
+        vc_text4 = #{item.vc_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="item.vc_text5 != null" >
+        vc_text5 = #{item.vc_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="item.ve_default != null" >
+        ve_default = #{item.ve_default,jdbcType=VARCHAR},
+      </if>
+      WHERE VC_ID= #{item.id,jdbcType=INTEGER}
+    </foreach>
+  </update>
+
 </mapper>

+ 1 - 3
applications/money/money-server/pom.xml

@@ -78,9 +78,7 @@
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
-            <artifactId>commons-server</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-            <scope>compile</scope>
+            <artifactId>commons-api</artifactId>
         </dependency>
     </dependencies>
 

+ 2 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/MoneyApplicatiion.java

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 //import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
@@ -12,7 +13,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  * @create: 2018-10-20 11:29
  **/
 @SpringBootApplication
-//@EnableEurekaClient
+@EnableEurekaClient
 @EnableTransactionManagement
 @EnableFeignClients("com.usoftchina.saas")
 //@EnableAuthClient

+ 58 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/FundtransferController.java

@@ -0,0 +1,58 @@
+package com.usoftchina.saas.money.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.money.po.Fundtran;
+import com.usoftchina.saas.money.po.Fundtransfer;
+import com.usoftchina.saas.money.service.FundtransferService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author heqw
+ * @date 2018/10/25 19:21
+ **/
+@RestController
+@RequestMapping("/money/fundtransfer")
+public class FundtransferController {
+    @Autowired
+    private FundtransferService fundtransferService;
+
+    @RequestMapping("/save")
+    public Result insert(@RequestBody Fundtran body) {
+        int id = fundtransferService.insert(body);
+        return Result.success(id);
+    }
+
+
+    @PostMapping("/delete")
+    public Result delete(@RequestBody int id){
+        fundtransferService.delete(id);
+        return Result.success();
+    }
+
+
+    @GetMapping("/read")
+    public Result read(int id){
+        return Result.success(fundtransferService.select(id));
+    }
+
+    @GetMapping("/List")
+    public Result getList(PageRequest page){
+        PageInfo<Fundtransfer> list = fundtransferService.selectList(page);
+        return Result.success(list);
+    }
+
+    @RequestMapping("/audit")
+    public Result audit(@RequestBody Fundtran body){
+        fundtransferService.audit(body);
+        return Result.success();
+    }
+
+    @PostMapping("/unAudit")
+    public Result unAudit(@RequestBody int id){
+        fundtransferService.unAudit(id);
+        return Result.success();
+    }
+}

+ 6 - 8
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/OthreceiptsController.java

@@ -7,10 +7,7 @@ import com.usoftchina.saas.money.po.Othte;
 import com.usoftchina.saas.money.service.OthreceiptsService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author heqw
@@ -29,12 +26,13 @@ public class OthreceiptsController {
     }
 
 
-    @GetMapping("/delete")
-    public Result deletePaybalance(int id){
+    @PostMapping("/delete")
+    public Result deletePaybalance(@RequestBody int id){
         othreceiptsService.delete(id);
         return Result.success();
     }
 
+
     @GetMapping("/read")
     public Result getPaybalance(int id){
         return Result.success(othreceiptsService.select(id));
@@ -52,8 +50,8 @@ public class OthreceiptsController {
         return Result.success();
     }
 
-    @GetMapping("/unAudit")
-    public Result unAudit(int id){
+    @PostMapping("/unAudit")
+    public Result unAudit(@RequestBody int id){
         othreceiptsService.unAudit(id);
         return Result.success();
     }

+ 11 - 8
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/OthspengdingsController.java

@@ -10,10 +10,7 @@ import com.usoftchina.saas.money.service.OthspendingsService;
 import com.usoftchina.saas.page.PageRequest;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author heqw
@@ -32,12 +29,18 @@ public class OthspengdingsController {
     }
 
 
-    @GetMapping("/delete")
-    public Result deletePaybalance(int id){
+    @PostMapping("/delete")
+    public Result deletePaybalance(@RequestBody int id){
         othspendingsService.delete(id);
         return Result.success();
     }
 
+    @PostMapping("/deleteItem/")
+    public Result deleteItem(@RequestBody int id){
+        othspendingsService.deleteItem(id);
+        return Result.success();
+    }
+
     @GetMapping("/read")
     public Result getPaybalance(int id){
         return Result.success(othspendingsService.select(id));
@@ -55,8 +58,8 @@ public class OthspengdingsController {
         return Result.success();
     }
 
-    @GetMapping("/unAudit")
-    public Result unAudit(int id){
+    @PostMapping("/unAudit")
+    public Result unAudit(@RequestBody int id){
         othspendingsService.unAudit(id);
         return Result.success();
     }

+ 12 - 9
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/PaybalanceController.java

@@ -8,17 +8,14 @@ import com.usoftchina.saas.money.po.Paybalance;
 import com.usoftchina.saas.money.service.PaybalanceService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author heqw
  * @date 2018/10/22 15:03
  **/
 @RestController
-@RequestMapping("/money")
+@RequestMapping("/money/Paybalance")
 public class PaybalanceController {
     @Autowired
     private PaybalanceService paybalanceService;
@@ -30,12 +27,18 @@ public class PaybalanceController {
     }
 
 
-    @GetMapping("/delete")
-    public Result deletePaybalance(int id){
+    @PostMapping("/delete")
+    public Result deletePaybalance(@RequestBody int id){
         paybalanceService.delete(id);
         return Result.success();
     }
 
+    @PostMapping("/deleteItem/")
+    public Result deleteItem(@RequestBody int id){
+        paybalanceService.deleteItem(id);
+        return Result.success();
+    }
+
     @GetMapping("/read")
     public Result getPaybalance(int id){
         return Result.success(paybalanceService.select(id));
@@ -53,8 +56,8 @@ public class PaybalanceController {
         return Result.success();
     }
 
-    @GetMapping("/unAudit")
-    public Result unAudit(int id){
+    @PostMapping("/unAudit")
+    public Result unAudit(@RequestBody int id){
         paybalanceService.unAudit(id);
         return Result.success();
     }

+ 7 - 7
applications/money/money-server/src/main/java/com/usoftchina/saas/money/controller/RecbalanceContorller.java

@@ -23,15 +23,15 @@ public class RecbalanceContorller {
         return Result.success();
     }
 
-    @GetMapping("/delete")
-    public Result delete(int id){
+    @PostMapping("/delete")
+    public Result delete(@RequestBody int id){
         recbalanceService.delect(id);
         return Result.success();
     }
 
-    @GetMapping("/deleteItem/{id}")
-    public Result deleteItem(@PathVariable int id){
-        recbalanceService.delectItem(id);
+    @PostMapping("/deleteItem/")
+    public Result deleteItem(@RequestBody int id){
+        recbalanceService.deleteItem(id);
         return Result.success();
     }
 
@@ -51,8 +51,8 @@ public class RecbalanceContorller {
         return Result.success();
     }
 
-    @GetMapping("/unAudit")
-    public Result unAudit(int id){
+    @PostMapping("/unAudit")
+    public Result unAudit(@RequestBody int id){
         recbalanceService.unAudit(id);
         return Result.success();
     }

+ 21 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/FundtransferMapper.java

@@ -0,0 +1,21 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.Fundtransfer;
+
+import java.util.List;
+
+public interface FundtransferMapper {
+    int deleteByPrimaryKey(Integer ftId);
+    int deleteItem(int id);
+
+    int insert(Fundtransfer record);
+
+    int insertSelective(Fundtransfer record);
+    List<Fundtransfer> selectList();
+
+    Fundtransfer selectByPrimaryKey(Integer ftId);
+
+    int updateByPrimaryKeySelective(Fundtransfer record);
+
+    int updateByPrimaryKey(Fundtransfer record);
+}

+ 18 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/mapper/FundtransferdetailMapper.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.money.mapper;
+
+import com.usoftchina.saas.money.po.Fundtransferdetail;
+
+public interface FundtransferdetailMapper {
+    int deleteByPrimaryKey(Integer ftdId);
+    int deleteItem(int id);
+
+    int insert(Fundtransferdetail record);
+
+    int insertSelective(Fundtransferdetail record);
+
+    Fundtransferdetail selectByPrimaryKey(Integer ftdId);
+
+    int updateByPrimaryKeySelective(Fundtransferdetail record);
+
+    int updateByPrimaryKey(Fundtransferdetail record);
+}

+ 28 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtran.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.List;
+
+/**
+ * @author heqw
+ * @date 2018/10/25 19:28
+ **/
+public class Fundtran {
+    private Fundtransfer main;
+    private List<Fundtransferdetail> items;
+
+    public Fundtransfer getMain() {
+        return main;
+    }
+
+    public void setMain(Fundtransfer main) {
+        this.main = main;
+    }
+
+    public List<Fundtransferdetail> getItems() {
+        return items;
+    }
+
+    public void setItems(List<Fundtransferdetail> items) {
+        this.items = items;
+    }
+}

+ 175 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransfer.java

@@ -0,0 +1,175 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class Fundtransfer {
+    private Integer ftId;
+
+    private String ftCode;
+
+    private Date ftDate;
+
+    private Integer ftRecorderid;
+
+    private String ftRecorder;
+
+    private Date ftRecorddate;
+
+    private String ftStatus;
+
+    private String ftStatuscode;
+
+    private String ftRemark;
+
+    private Integer companyid;
+
+    private Integer updaterid;
+
+    private Date updatedate;
+
+    private String ftText1;
+
+    private String ftText2;
+
+    private String ftText3;
+
+    private String ftText4;
+
+    private String ftText5;
+
+    public Integer getFtId() {
+        return ftId;
+    }
+
+    public void setFtId(Integer ftId) {
+        this.ftId = ftId;
+    }
+
+    public String getFtCode() {
+        return ftCode;
+    }
+
+    public void setFtCode(String ftCode) {
+        this.ftCode = ftCode == null ? null : ftCode.trim();
+    }
+
+    public Date getFtDate() {
+        return ftDate;
+    }
+
+    public void setFtDate(Date ftDate) {
+        this.ftDate = ftDate;
+    }
+
+    public Integer getFtRecorderid() {
+        return ftRecorderid;
+    }
+
+    public void setFtRecorderid(Integer ftRecorderid) {
+        this.ftRecorderid = ftRecorderid;
+    }
+
+    public String getFtRecorder() {
+        return ftRecorder;
+    }
+
+    public void setFtRecorder(String ftRecorder) {
+        this.ftRecorder = ftRecorder == null ? null : ftRecorder.trim();
+    }
+
+    public Date getFtRecorddate() {
+        return ftRecorddate;
+    }
+
+    public void setFtRecorddate(Date ftRecorddate) {
+        this.ftRecorddate = ftRecorddate;
+    }
+
+    public String getFtStatus() {
+        return ftStatus;
+    }
+
+    public void setFtStatus(String ftStatus) {
+        this.ftStatus = ftStatus == null ? null : ftStatus.trim();
+    }
+
+    public String getFtStatuscode() {
+        return ftStatuscode;
+    }
+
+    public void setFtStatuscode(String ftStatuscode) {
+        this.ftStatuscode = ftStatuscode == null ? null : ftStatuscode.trim();
+    }
+
+    public String getFtRemark() {
+        return ftRemark;
+    }
+
+    public void setFtRemark(String ftRemark) {
+        this.ftRemark = ftRemark == null ? null : ftRemark.trim();
+    }
+
+    public Integer getCompanyid() {
+        return companyid;
+    }
+
+    public void setCompanyid(Integer companyid) {
+        this.companyid = companyid;
+    }
+
+    public Integer getUpdaterid() {
+        return updaterid;
+    }
+
+    public void setUpdaterid(Integer updaterid) {
+        this.updaterid = updaterid;
+    }
+
+    public Date getUpdatedate() {
+        return updatedate;
+    }
+
+    public void setUpdatedate(Date updatedate) {
+        this.updatedate = updatedate;
+    }
+
+    public String getFtText1() {
+        return ftText1;
+    }
+
+    public void setFtText1(String ftText1) {
+        this.ftText1 = ftText1 == null ? null : ftText1.trim();
+    }
+
+    public String getFtText2() {
+        return ftText2;
+    }
+
+    public void setFtText2(String ftText2) {
+        this.ftText2 = ftText2 == null ? null : ftText2.trim();
+    }
+
+    public String getFtText3() {
+        return ftText3;
+    }
+
+    public void setFtText3(String ftText3) {
+        this.ftText3 = ftText3 == null ? null : ftText3.trim();
+    }
+
+    public String getFtText4() {
+        return ftText4;
+    }
+
+    public void setFtText4(String ftText4) {
+        this.ftText4 = ftText4 == null ? null : ftText4.trim();
+    }
+
+    public String getFtText5() {
+        return ftText5;
+    }
+
+    public void setFtText5(String ftText5) {
+        this.ftText5 = ftText5 == null ? null : ftText5.trim();
+    }
+}

+ 225 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/po/Fundtransferdetail.java

@@ -0,0 +1,225 @@
+package com.usoftchina.saas.money.po;
+
+import java.util.Date;
+
+public class Fundtransferdetail {
+    private Integer ftdId;
+
+    private Integer ftdFtid;
+
+    private Integer ftdDetno;
+
+    private Integer ftdYm;
+
+    private Integer ftdBankid;
+
+    private String ftdBankcode;
+
+    private String ftdBankname;
+
+    private Integer ftdInbankid;
+
+    private String ftdInbankcode;
+
+    private String ftdInbankname;
+
+    private Double ftdNowbalance;
+
+    private String ftdPaymethod;
+
+    private String ftdPaycode;
+
+    private String ftdRemark;
+
+    private Integer companyid;
+
+    private Integer updaterid;
+
+    private Date updatedate;
+
+    private String ftdText1;
+
+    private String ftdText2;
+
+    private String ftdText3;
+
+    private String ftdText4;
+
+    private String ftdText5;
+
+    public Integer getFtdId() {
+        return ftdId;
+    }
+
+    public void setFtdId(Integer ftdId) {
+        this.ftdId = ftdId;
+    }
+
+    public Integer getFtdFtid() {
+        return ftdFtid;
+    }
+
+    public void setFtdFtid(Integer ftdFtid) {
+        this.ftdFtid = ftdFtid;
+    }
+
+    public Integer getFtdDetno() {
+        return ftdDetno;
+    }
+
+    public void setFtdDetno(Integer ftdDetno) {
+        this.ftdDetno = ftdDetno;
+    }
+
+    public Integer getFtdYm() {
+        return ftdYm;
+    }
+
+    public void setFtdYm(Integer ftdYm) {
+        this.ftdYm = ftdYm;
+    }
+
+    public Integer getFtdBankid() {
+        return ftdBankid;
+    }
+
+    public void setFtdBankid(Integer ftdBankid) {
+        this.ftdBankid = ftdBankid;
+    }
+
+    public String getFtdBankcode() {
+        return ftdBankcode;
+    }
+
+    public void setFtdBankcode(String ftdBankcode) {
+        this.ftdBankcode = ftdBankcode == null ? null : ftdBankcode.trim();
+    }
+
+    public String getFtdBankname() {
+        return ftdBankname;
+    }
+
+    public void setFtdBankname(String ftdBankname) {
+        this.ftdBankname = ftdBankname == null ? null : ftdBankname.trim();
+    }
+
+    public Integer getFtdInbankid() {
+        return ftdInbankid;
+    }
+
+    public void setFtdInbankid(Integer ftdInbankid) {
+        this.ftdInbankid = ftdInbankid;
+    }
+
+    public String getFtdInbankcode() {
+        return ftdInbankcode;
+    }
+
+    public void setFtdInbankcode(String ftdInbankcode) {
+        this.ftdInbankcode = ftdInbankcode == null ? null : ftdInbankcode.trim();
+    }
+
+    public String getFtdInbankname() {
+        return ftdInbankname;
+    }
+
+    public void setFtdInbankname(String ftdInbankname) {
+        this.ftdInbankname = ftdInbankname == null ? null : ftdInbankname.trim();
+    }
+
+    public Double getFtdNowbalance() {
+        return ftdNowbalance;
+    }
+
+    public void setFtdNowbalance(Double ftdNowbalance) {
+        this.ftdNowbalance = ftdNowbalance;
+    }
+
+    public String getFtdPaymethod() {
+        return ftdPaymethod;
+    }
+
+    public void setFtdPaymethod(String ftdPaymethod) {
+        this.ftdPaymethod = ftdPaymethod == null ? null : ftdPaymethod.trim();
+    }
+
+    public String getFtdPaycode() {
+        return ftdPaycode;
+    }
+
+    public void setFtdPaycode(String ftdPaycode) {
+        this.ftdPaycode = ftdPaycode == null ? null : ftdPaycode.trim();
+    }
+
+    public String getFtdRemark() {
+        return ftdRemark;
+    }
+
+    public void setFtdRemark(String ftdRemark) {
+        this.ftdRemark = ftdRemark == null ? null : ftdRemark.trim();
+    }
+
+    public Integer getCompanyid() {
+        return companyid;
+    }
+
+    public void setCompanyid(Integer companyid) {
+        this.companyid = companyid;
+    }
+
+    public Integer getUpdaterid() {
+        return updaterid;
+    }
+
+    public void setUpdaterid(Integer updaterid) {
+        this.updaterid = updaterid;
+    }
+
+    public Date getUpdatedate() {
+        return updatedate;
+    }
+
+    public void setUpdatedate(Date updatedate) {
+        this.updatedate = updatedate;
+    }
+
+    public String getFtdText1() {
+        return ftdText1;
+    }
+
+    public void setFtdText1(String ftdText1) {
+        this.ftdText1 = ftdText1 == null ? null : ftdText1.trim();
+    }
+
+    public String getFtdText2() {
+        return ftdText2;
+    }
+
+    public void setFtdText2(String ftdText2) {
+        this.ftdText2 = ftdText2 == null ? null : ftdText2.trim();
+    }
+
+    public String getFtdText3() {
+        return ftdText3;
+    }
+
+    public void setFtdText3(String ftdText3) {
+        this.ftdText3 = ftdText3 == null ? null : ftdText3.trim();
+    }
+
+    public String getFtdText4() {
+        return ftdText4;
+    }
+
+    public void setFtdText4(String ftdText4) {
+        this.ftdText4 = ftdText4 == null ? null : ftdText4.trim();
+    }
+
+    public String getFtdText5() {
+        return ftdText5;
+    }
+
+    public void setFtdText5(String ftdText5) {
+        this.ftdText5 = ftdText5 == null ? null : ftdText5.trim();
+    }
+}

+ 24 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/FundtransferService.java

@@ -0,0 +1,24 @@
+package com.usoftchina.saas.money.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.money.po.Fundtran;
+import com.usoftchina.saas.money.po.Fundtransfer;
+import com.usoftchina.saas.page.PageRequest;
+
+/**
+ * @author heqw
+ * @date 2018/10/25 19:26
+ **/
+public interface FundtransferService {
+    int insert(Fundtran fundtran);
+
+    void audit(Fundtran fundtran);
+
+    void unAudit(int id);
+
+    void delete(int id);
+
+    Fundtran select(int id);
+
+    PageInfo<Fundtransfer> selectList(PageRequest page);
+}

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/OthspendingsService.java

@@ -17,7 +17,7 @@ public interface OthspendingsService {
 
     void delete(int id);
 
-    void delectItem(int id);
+    void deleteItem(int id);
 
     Othsp select(int id);
 

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/PaybalanceService.java

@@ -19,7 +19,7 @@ public interface PaybalanceService {
 
     void delete(int id);
 
-    void delectItem(int id);
+    void deleteItem(int id);
 
     Pay select(int id);
 

+ 4 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/RecbalanceService.java

@@ -13,9 +13,12 @@ import com.usoftchina.saas.page.PageRequest;
 public interface RecbalanceService {
     int insert(Rec rec);
     void delect(int id);
-    void delectItem(int id);
+
+    void deleteItem(int id);
+
     Rec select(int id);
 
+
     void audit(Rec rec);
 
     void unAudit(int id);

+ 106 - 0
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/FundtransferServiceImpl.java

@@ -0,0 +1,106 @@
+package com.usoftchina.saas.money.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.po.Status;
+import com.usoftchina.saas.money.mapper.FundtransferMapper;
+import com.usoftchina.saas.money.mapper.FundtransferdetailMapper;
+import com.usoftchina.saas.money.po.Fundtran;
+import com.usoftchina.saas.money.po.Fundtransfer;
+import com.usoftchina.saas.money.po.Fundtransferdetail;
+import com.usoftchina.saas.money.service.FundtransferService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author heqw
+ * @date 2018/10/25 19:32
+ **/
+@Service
+public class FundtransferServiceImpl implements FundtransferService {
+    @Autowired
+    private FundtransferMapper fundtransferMapper;
+    @Autowired
+    private FundtransferdetailMapper fundtransferdetailMapper;
+
+    @Override
+    public int insert(Fundtran fundtran) {
+        Fundtransfer fundtransfer = fundtran.getMain();
+        List<Fundtransferdetail> fundtransferdetails = fundtran.getItems();
+
+        if (fundtransfer.getFtId() > 0){
+            fundtransferMapper.updateByPrimaryKeySelective(fundtransfer);
+        }else {
+            fundtransferMapper.insert(fundtransfer);
+        }
+
+        Iterator isdet = fundtransferdetails.iterator();
+        while (isdet.hasNext()){
+            Fundtransferdetail fundtransferdetail= (Fundtransferdetail) isdet.next();
+            if (fundtransferdetail.getFtdId() > 0 ){
+                fundtransferdetailMapper.updateByPrimaryKey(fundtransferdetail);
+            }else {
+                fundtransferdetailMapper.insertSelective(fundtransferdetail);
+            }
+        }
+        return 0;
+    }
+
+    @Override
+    public void audit(Fundtran fundtran) {
+        int id = fundtran.getMain().getFtId();
+        Fundtransfer fundtransfer = fundtransferMapper.selectByPrimaryKey(id);
+        if ( fundtransfer == null || "".equals(fundtransfer)){
+            this.insert(fundtran);
+        }else {
+            fundtransferMapper.updateByPrimaryKey(fundtransfer);
+        }
+    }
+
+    @Override
+    public void unAudit(int id) {
+        Fundtransfer fundtransfer = new Fundtransfer();
+        fundtransfer.setFtId(id);
+        fundtransfer.setFtStatus(com.usoftchina.saas.commons.po.Status.UNAUDITED.getDisplay());
+        fundtransfer.setFtStatuscode(Status.UNAUDITED.name());
+        fundtransferMapper.updateByPrimaryKey(fundtransfer);
+    }
+
+
+    @Override
+    public void delete(int id) {
+        fundtransferMapper.deleteByPrimaryKey(id);
+        fundtransferdetailMapper.deleteByPrimaryKey(id);
+    }
+
+    public void deleteItem(int id) {
+        fundtransferdetailMapper.deleteItem(id);
+    }
+
+    @Override
+    public Fundtran select(int id) {
+        Fundtran fundtran = new Fundtran();
+        fundtran.setMain(fundtransferMapper.selectByPrimaryKey(id));
+        fundtran.setItems((List<Fundtransferdetail>) fundtransferdetailMapper.selectByPrimaryKey(id));
+        return fundtran;
+    }
+
+    @Override
+    public PageInfo<Fundtransfer> selectList(PageRequest page) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        List<Fundtransfer> fundtransfers = fundtransferMapper.selectList();
+        //取分页信息
+        PageInfo<Fundtransfer> pageInfo = new PageInfo<>(fundtransfers);
+        return pageInfo;
+    }
+}

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/OthspendingsServiceImpl.java

@@ -57,7 +57,7 @@ public class OthspendingsServiceImpl implements OthspendingsService {
     }
 
     @Override
-    public void delectItem(int id) {
+    public void deleteItem(int id) {
         othspendingsdetailMapper.deleteItem(id);
     }
 

+ 1 - 1
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/PaybalanceServiceImpl.java

@@ -89,7 +89,7 @@ public class PaybalanceServiceImpl implements PaybalanceService {
     }
 
     @Override
-    public void delectItem(int id) {
+    public void deleteItem(int id) {
         paybalancedetailMapper.deleteItem(id);
         paybalancedetMapper.deleteItem(id);
     }

+ 6 - 6
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/RecbalanceServiceImpl.java

@@ -70,12 +70,6 @@ public class RecbalanceServiceImpl implements RecbalanceService {
         recbalancedetailMapper.deleteByPrimaryKey(id);
     }
 
-    @Override
-    public void delectItem(int id) {
-        recbalancedetMapper.deleteItem(id);
-        recbalancedetailMapper.deleteItem(id);
-    }
-
     @Override
     public Rec select(int id) {
         Recbalance recbalance = recbalanceMapper.selectByPrimaryKey(id);
@@ -88,6 +82,12 @@ public class RecbalanceServiceImpl implements RecbalanceService {
         return rec;
     }
 
+    @Override
+    public void deleteItem(int id) {
+        recbalancedetailMapper.deleteItem(id);
+        recbalancedetMapper.deleteItem(id);
+    }
+
     @Override
     public void audit(Rec rec) {
         int id = rec.getMain().getRb_id();

+ 5 - 5
applications/money/money-server/src/main/java/com/usoftchina/saas/money/service/impl/VerificationServiceImpl.java

@@ -3,13 +3,13 @@ package com.usoftchina.saas.money.service.impl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocSavedDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.commons.po.Operation;
-import com.usoftchina.saas.commons.service.MaxnumberService;
-import com.usoftchina.saas.commons.service.MessageLogService;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.money.dto.*;
@@ -42,7 +42,7 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
     @Autowired
     private VerificationListMapper verificationListMapper;
 //    @Autowired
-//    private MessageLogService messageLogService;
+ //   private MessageLogService messageLogService;
 
 
     @Override
@@ -223,8 +223,8 @@ public class VerificationServiceImpl extends CommonBaseServiceImpl<VerificationM
                 id = saveDTO.getId();
             }
             Verification verification = new Verification();
-//          verification.setVc_status(Operation.AUDIT.getTitle());
-//          verification.setVc_statuscode(Status.AUDITED.name());
+           // verification.setVc_status(Operation.AUDIT.getTitle());
+           // verification.setVc_statuscode(Status.AUDITED.name());
             verificationMapper.updateByPrimaryKeySelective(verification);
         }
         savedDTO.setId(id);

+ 241 - 0
applications/money/money-server/src/main/resources/mapper/FundtransferMapper.xml

@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.money.mapper.FundtransferMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Fundtransfer" >
+    <id column="ft_id" property="ftId" jdbcType="INTEGER" />
+    <result column="ft_code" property="ftCode" jdbcType="VARCHAR" />
+    <result column="ft_date" property="ftDate" jdbcType="TIMESTAMP" />
+    <result column="ft_recorderid" property="ftRecorderid" jdbcType="INTEGER" />
+    <result column="ft_recorder" property="ftRecorder" jdbcType="VARCHAR" />
+    <result column="ft_recorddate" property="ftRecorddate" jdbcType="TIMESTAMP" />
+    <result column="ft_status" property="ftStatus" jdbcType="VARCHAR" />
+    <result column="ft_statuscode" property="ftStatuscode" jdbcType="VARCHAR" />
+    <result column="ft_remark" property="ftRemark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterid" jdbcType="INTEGER" />
+    <result column="updatedate" property="updatedate" jdbcType="TIMESTAMP" />
+    <result column="ft_text1" property="ftText1" jdbcType="VARCHAR" />
+    <result column="ft_text2" property="ftText2" jdbcType="VARCHAR" />
+    <result column="ft_text3" property="ftText3" jdbcType="VARCHAR" />
+    <result column="ft_text4" property="ftText4" jdbcType="VARCHAR" />
+    <result column="ft_text5" property="ftText5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    ft_id, ft_code, ft_date, ft_recorderid, ft_recorder, ft_recorddate, ft_status, ft_statuscode, 
+    ft_remark, companyid, updaterId, updatedate, ft_text1, ft_text2, ft_text3, ft_text4, 
+    ft_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    from fundtransfer
+    where ft_id = #{ftId,jdbcType=INTEGER}
+  </select>
+
+  <select id="selectList" resultMap="BaseResultMap" >
+    select
+    <include refid="Base_Column_List" />
+    from fundtransfer
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    delete from fundtransfer
+    where ft_id = #{ftId,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.money.po.Fundtransfer" >
+    insert into fundtransfer (ft_id, ft_code, ft_date, 
+      ft_recorderid, ft_recorder, ft_recorddate, 
+      ft_status, ft_statuscode, ft_remark, 
+      companyid, updaterId, updatedate, 
+      ft_text1, ft_text2, ft_text3, 
+      ft_text4, ft_text5)
+    values (#{ftId,jdbcType=INTEGER}, #{ftCode,jdbcType=VARCHAR}, #{ftDate,jdbcType=TIMESTAMP}, 
+      #{ftRecorderid,jdbcType=INTEGER}, #{ftRecorder,jdbcType=VARCHAR}, #{ftRecorddate,jdbcType=TIMESTAMP}, 
+      #{ftStatus,jdbcType=VARCHAR}, #{ftStatuscode,jdbcType=VARCHAR}, #{ftRemark,jdbcType=VARCHAR}, 
+      #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, #{updatedate,jdbcType=TIMESTAMP}, 
+      #{ftText1,jdbcType=VARCHAR}, #{ftText2,jdbcType=VARCHAR}, #{ftText3,jdbcType=VARCHAR}, 
+      #{ftText4,jdbcType=VARCHAR}, #{ftText5,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Fundtransfer" >
+    insert into fundtransfer
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="ftId != null" >
+        ft_id,
+      </if>
+      <if test="ftCode != null" >
+        ft_code,
+      </if>
+      <if test="ftDate != null" >
+        ft_date,
+      </if>
+      <if test="ftRecorderid != null" >
+        ft_recorderid,
+      </if>
+      <if test="ftRecorder != null" >
+        ft_recorder,
+      </if>
+      <if test="ftRecorddate != null" >
+        ft_recorddate,
+      </if>
+      <if test="ftStatus != null" >
+        ft_status,
+      </if>
+      <if test="ftStatuscode != null" >
+        ft_statuscode,
+      </if>
+      <if test="ftRemark != null" >
+        ft_remark,
+      </if>
+      <if test="companyid != null" >
+        companyid,
+      </if>
+      <if test="updaterid != null" >
+        updaterId,
+      </if>
+      <if test="updatedate != null" >
+        updatedate,
+      </if>
+      <if test="ftText1 != null" >
+        ft_text1,
+      </if>
+      <if test="ftText2 != null" >
+        ft_text2,
+      </if>
+      <if test="ftText3 != null" >
+        ft_text3,
+      </if>
+      <if test="ftText4 != null" >
+        ft_text4,
+      </if>
+      <if test="ftText5 != null" >
+        ft_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="ftId != null" >
+        #{ftId,jdbcType=INTEGER},
+      </if>
+      <if test="ftCode != null" >
+        #{ftCode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftDate != null" >
+        #{ftDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftRecorderid != null" >
+        #{ftRecorderid,jdbcType=INTEGER},
+      </if>
+      <if test="ftRecorder != null" >
+        #{ftRecorder,jdbcType=VARCHAR},
+      </if>
+      <if test="ftRecorddate != null" >
+        #{ftRecorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftStatus != null" >
+        #{ftStatus,jdbcType=VARCHAR},
+      </if>
+      <if test="ftStatuscode != null" >
+        #{ftStatuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftRemark != null" >
+        #{ftRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null" >
+        #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null" >
+        #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatedate != null" >
+        #{updatedate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftText1 != null" >
+        #{ftText1,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText2 != null" >
+        #{ftText2,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText3 != null" >
+        #{ftText3,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText4 != null" >
+        #{ftText4,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText5 != null" >
+        #{ftText5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.money.po.Fundtransfer" >
+    update fundtransfer
+    <set >
+      <if test="ftCode != null" >
+        ft_code = #{ftCode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftDate != null" >
+        ft_date = #{ftDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftRecorderid != null" >
+        ft_recorderid = #{ftRecorderid,jdbcType=INTEGER},
+      </if>
+      <if test="ftRecorder != null" >
+        ft_recorder = #{ftRecorder,jdbcType=VARCHAR},
+      </if>
+      <if test="ftRecorddate != null" >
+        ft_recorddate = #{ftRecorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftStatus != null" >
+        ft_status = #{ftStatus,jdbcType=VARCHAR},
+      </if>
+      <if test="ftStatuscode != null" >
+        ft_statuscode = #{ftStatuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftRemark != null" >
+        ft_remark = #{ftRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null" >
+        companyid = #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null" >
+        updaterId = #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatedate != null" >
+        updatedate = #{updatedate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftText1 != null" >
+        ft_text1 = #{ftText1,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText2 != null" >
+        ft_text2 = #{ftText2,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText3 != null" >
+        ft_text3 = #{ftText3,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText4 != null" >
+        ft_text4 = #{ftText4,jdbcType=VARCHAR},
+      </if>
+      <if test="ftText5 != null" >
+        ft_text5 = #{ftText5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where ft_id = #{ftId,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.money.po.Fundtransfer" >
+    update fundtransfer
+    set ft_code = #{ftCode,jdbcType=VARCHAR},
+      ft_date = #{ftDate,jdbcType=TIMESTAMP},
+      ft_recorderid = #{ftRecorderid,jdbcType=INTEGER},
+      ft_recorder = #{ftRecorder,jdbcType=VARCHAR},
+      ft_recorddate = #{ftRecorddate,jdbcType=TIMESTAMP},
+      ft_status = #{ftStatus,jdbcType=VARCHAR},
+      ft_statuscode = #{ftStatuscode,jdbcType=VARCHAR},
+      ft_remark = #{ftRemark,jdbcType=VARCHAR},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterId = #{updaterid,jdbcType=INTEGER},
+      updatedate = #{updatedate,jdbcType=TIMESTAMP},
+      ft_text1 = #{ftText1,jdbcType=VARCHAR},
+      ft_text2 = #{ftText2,jdbcType=VARCHAR},
+      ft_text3 = #{ftText3,jdbcType=VARCHAR},
+      ft_text4 = #{ftText4,jdbcType=VARCHAR},
+      ft_text5 = #{ftText5,jdbcType=VARCHAR}
+    where ft_id = #{ftId,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 300 - 0
applications/money/money-server/src/main/resources/mapper/FundtransferdetailMapper.xml

@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.usoftchina.saas.money.mapper.FundtransferdetailMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.Fundtransferdetail" >
+    <id column="ftd_id" property="ftdId" jdbcType="INTEGER" />
+    <result column="ftd_ftid" property="ftdFtid" jdbcType="INTEGER" />
+    <result column="ftd_detno" property="ftdDetno" jdbcType="INTEGER" />
+    <result column="ftd_ym" property="ftdYm" jdbcType="INTEGER" />
+    <result column="ftd_bankid" property="ftdBankid" jdbcType="INTEGER" />
+    <result column="ftd_bankcode" property="ftdBankcode" jdbcType="VARCHAR" />
+    <result column="ftd_bankname" property="ftdBankname" jdbcType="VARCHAR" />
+    <result column="ftd_inbankid" property="ftdInbankid" jdbcType="INTEGER" />
+    <result column="ftd_inbankcode" property="ftdInbankcode" jdbcType="VARCHAR" />
+    <result column="ftd_inbankname" property="ftdInbankname" jdbcType="VARCHAR" />
+    <result column="ftd_nowbalance" property="ftdNowbalance" jdbcType="DOUBLE" />
+    <result column="ftd_paymethod" property="ftdPaymethod" jdbcType="VARCHAR" />
+    <result column="ftd_paycode" property="ftdPaycode" jdbcType="VARCHAR" />
+    <result column="ftd_remark" property="ftdRemark" jdbcType="VARCHAR" />
+    <result column="companyid" property="companyid" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterid" jdbcType="INTEGER" />
+    <result column="updatedate" property="updatedate" jdbcType="TIMESTAMP" />
+    <result column="ftd_text1" property="ftdText1" jdbcType="VARCHAR" />
+    <result column="ftd_text2" property="ftdText2" jdbcType="VARCHAR" />
+    <result column="ftd_text3" property="ftdText3" jdbcType="VARCHAR" />
+    <result column="ftd_text4" property="ftdText4" jdbcType="VARCHAR" />
+    <result column="ftd_text5" property="ftdText5" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    ftd_id, ftd_ftid, ftd_detno, ftd_ym, ftd_bankid, ftd_bankcode, ftd_bankname, ftd_inbankid, 
+    ftd_inbankcode, ftd_inbankname, ftd_nowbalance, ftd_paymethod, ftd_paycode, ftd_remark, 
+    companyid, updaterId, updatedate, ftd_text1, ftd_text2, ftd_text3, ftd_text4, ftd_text5
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    from fundtransferdetail
+    where ftd_id = #{ftdId,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    delete from fundtransferdetail
+    where ftd_id = #{ftdId,jdbcType=INTEGER}
+  </delete>
+
+  <delete id="deleteItem" parameterType="java.lang.Integer" >
+    delete from fundtransferdetail
+    where ftd_ftid = #{ftdFtid,jdbcType=INTEGER}
+  </delete>
+
+  <insert id="insert" parameterType="com.usoftchina.saas.money.po.Fundtransferdetail" >
+    insert into fundtransferdetail (ftd_id, ftd_ftid, ftd_detno, 
+      ftd_ym, ftd_bankid, ftd_bankcode, 
+      ftd_bankname, ftd_inbankid, ftd_inbankcode, 
+      ftd_inbankname, ftd_nowbalance, ftd_paymethod, 
+      ftd_paycode, ftd_remark, companyid, 
+      updaterId, updatedate, ftd_text1, 
+      ftd_text2, ftd_text3, ftd_text4, 
+      ftd_text5)
+    values (#{ftdId,jdbcType=INTEGER}, #{ftdFtid,jdbcType=INTEGER}, #{ftdDetno,jdbcType=INTEGER}, 
+      #{ftdYm,jdbcType=INTEGER}, #{ftdBankid,jdbcType=INTEGER}, #{ftdBankcode,jdbcType=VARCHAR}, 
+      #{ftdBankname,jdbcType=VARCHAR}, #{ftdInbankid,jdbcType=INTEGER}, #{ftdInbankcode,jdbcType=VARCHAR}, 
+      #{ftdInbankname,jdbcType=VARCHAR}, #{ftdNowbalance,jdbcType=DOUBLE}, #{ftdPaymethod,jdbcType=VARCHAR}, 
+      #{ftdPaycode,jdbcType=VARCHAR}, #{ftdRemark,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, 
+      #{updaterid,jdbcType=INTEGER}, #{updatedate,jdbcType=TIMESTAMP}, #{ftdText1,jdbcType=VARCHAR}, 
+      #{ftdText2,jdbcType=VARCHAR}, #{ftdText3,jdbcType=VARCHAR}, #{ftdText4,jdbcType=VARCHAR}, 
+      #{ftdText5,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.money.po.Fundtransferdetail" >
+    insert into fundtransferdetail
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="ftdId != null" >
+        ftd_id,
+      </if>
+      <if test="ftdFtid != null" >
+        ftd_ftid,
+      </if>
+      <if test="ftdDetno != null" >
+        ftd_detno,
+      </if>
+      <if test="ftdYm != null" >
+        ftd_ym,
+      </if>
+      <if test="ftdBankid != null" >
+        ftd_bankid,
+      </if>
+      <if test="ftdBankcode != null" >
+        ftd_bankcode,
+      </if>
+      <if test="ftdBankname != null" >
+        ftd_bankname,
+      </if>
+      <if test="ftdInbankid != null" >
+        ftd_inbankid,
+      </if>
+      <if test="ftdInbankcode != null" >
+        ftd_inbankcode,
+      </if>
+      <if test="ftdInbankname != null" >
+        ftd_inbankname,
+      </if>
+      <if test="ftdNowbalance != null" >
+        ftd_nowbalance,
+      </if>
+      <if test="ftdPaymethod != null" >
+        ftd_paymethod,
+      </if>
+      <if test="ftdPaycode != null" >
+        ftd_paycode,
+      </if>
+      <if test="ftdRemark != null" >
+        ftd_remark,
+      </if>
+      <if test="companyid != null" >
+        companyid,
+      </if>
+      <if test="updaterid != null" >
+        updaterId,
+      </if>
+      <if test="updatedate != null" >
+        updatedate,
+      </if>
+      <if test="ftdText1 != null" >
+        ftd_text1,
+      </if>
+      <if test="ftdText2 != null" >
+        ftd_text2,
+      </if>
+      <if test="ftdText3 != null" >
+        ftd_text3,
+      </if>
+      <if test="ftdText4 != null" >
+        ftd_text4,
+      </if>
+      <if test="ftdText5 != null" >
+        ftd_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="ftdId != null" >
+        #{ftdId,jdbcType=INTEGER},
+      </if>
+      <if test="ftdFtid != null" >
+        #{ftdFtid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdDetno != null" >
+        #{ftdDetno,jdbcType=INTEGER},
+      </if>
+      <if test="ftdYm != null" >
+        #{ftdYm,jdbcType=INTEGER},
+      </if>
+      <if test="ftdBankid != null" >
+        #{ftdBankid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdBankcode != null" >
+        #{ftdBankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdBankname != null" >
+        #{ftdBankname,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdInbankid != null" >
+        #{ftdInbankid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdInbankcode != null" >
+        #{ftdInbankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdInbankname != null" >
+        #{ftdInbankname,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdNowbalance != null" >
+        #{ftdNowbalance,jdbcType=DOUBLE},
+      </if>
+      <if test="ftdPaymethod != null" >
+        #{ftdPaymethod,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdPaycode != null" >
+        #{ftdPaycode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdRemark != null" >
+        #{ftdRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null" >
+        #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null" >
+        #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatedate != null" >
+        #{updatedate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftdText1 != null" >
+        #{ftdText1,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText2 != null" >
+        #{ftdText2,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText3 != null" >
+        #{ftdText3,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText4 != null" >
+        #{ftdText4,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText5 != null" >
+        #{ftdText5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.money.po.Fundtransferdetail" >
+    update fundtransferdetail
+    <set >
+      <if test="ftdFtid != null" >
+        ftd_ftid = #{ftdFtid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdDetno != null" >
+        ftd_detno = #{ftdDetno,jdbcType=INTEGER},
+      </if>
+      <if test="ftdYm != null" >
+        ftd_ym = #{ftdYm,jdbcType=INTEGER},
+      </if>
+      <if test="ftdBankid != null" >
+        ftd_bankid = #{ftdBankid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdBankcode != null" >
+        ftd_bankcode = #{ftdBankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdBankname != null" >
+        ftd_bankname = #{ftdBankname,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdInbankid != null" >
+        ftd_inbankid = #{ftdInbankid,jdbcType=INTEGER},
+      </if>
+      <if test="ftdInbankcode != null" >
+        ftd_inbankcode = #{ftdInbankcode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdInbankname != null" >
+        ftd_inbankname = #{ftdInbankname,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdNowbalance != null" >
+        ftd_nowbalance = #{ftdNowbalance,jdbcType=DOUBLE},
+      </if>
+      <if test="ftdPaymethod != null" >
+        ftd_paymethod = #{ftdPaymethod,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdPaycode != null" >
+        ftd_paycode = #{ftdPaycode,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdRemark != null" >
+        ftd_remark = #{ftdRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null" >
+        companyid = #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null" >
+        updaterId = #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatedate != null" >
+        updatedate = #{updatedate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ftdText1 != null" >
+        ftd_text1 = #{ftdText1,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText2 != null" >
+        ftd_text2 = #{ftdText2,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText3 != null" >
+        ftd_text3 = #{ftdText3,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText4 != null" >
+        ftd_text4 = #{ftdText4,jdbcType=VARCHAR},
+      </if>
+      <if test="ftdText5 != null" >
+        ftd_text5 = #{ftdText5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where ftd_id = #{ftdId,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.money.po.Fundtransferdetail" >
+    update fundtransferdetail
+    set ftd_ftid = #{ftdFtid,jdbcType=INTEGER},
+      ftd_detno = #{ftdDetno,jdbcType=INTEGER},
+      ftd_ym = #{ftdYm,jdbcType=INTEGER},
+      ftd_bankid = #{ftdBankid,jdbcType=INTEGER},
+      ftd_bankcode = #{ftdBankcode,jdbcType=VARCHAR},
+      ftd_bankname = #{ftdBankname,jdbcType=VARCHAR},
+      ftd_inbankid = #{ftdInbankid,jdbcType=INTEGER},
+      ftd_inbankcode = #{ftdInbankcode,jdbcType=VARCHAR},
+      ftd_inbankname = #{ftdInbankname,jdbcType=VARCHAR},
+      ftd_nowbalance = #{ftdNowbalance,jdbcType=DOUBLE},
+      ftd_paymethod = #{ftdPaymethod,jdbcType=VARCHAR},
+      ftd_paycode = #{ftdPaycode,jdbcType=VARCHAR},
+      ftd_remark = #{ftdRemark,jdbcType=VARCHAR},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterId = #{updaterid,jdbcType=INTEGER},
+      updatedate = #{updatedate,jdbcType=TIMESTAMP},
+      ftd_text1 = #{ftdText1,jdbcType=VARCHAR},
+      ftd_text2 = #{ftdText2,jdbcType=VARCHAR},
+      ftd_text3 = #{ftdText3,jdbcType=VARCHAR},
+      ftd_text4 = #{ftdText4,jdbcType=VARCHAR},
+      ftd_text5 = #{ftdText5,jdbcType=VARCHAR}
+    where ftd_id = #{ftdId,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 7 - 6
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java

@@ -1,8 +1,10 @@
 package com.usoftchina.saas.purchase.controller;
 
 import com.github.pagehelper.PageInfo;
+import com.netflix.discovery.converters.Auto;
 import com.usoftchina.saas.base.Result;
 
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -13,6 +15,7 @@ import com.usoftchina.saas.purchase.service.PurchaseService;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.async.DeferredResult;
 
 
 /**
@@ -69,7 +72,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/delete/{id}")
+    @PostMapping("/delete/{id}")
     public Result delete(@PathVariable("id") Long id) {
         purchaseService.delete(id);
         return Result.success();
@@ -81,7 +84,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/deleteDetail/{id}")
+    @PostMapping("/deleteDetail/{id}")
     public Result deleteDetail(@PathVariable("id") Long id) {
         purchaseService.deleteDetail(id);
         return Result.success();
@@ -105,7 +108,7 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/unAudit/{id}")
+    @PostMapping("/unAudit/{id}")
     public Result unAudit(@PathVariable("id") Long id) {
         purchaseService.unAudit(id);
         return Result.success();
@@ -159,12 +162,10 @@ public class PurchaseController {
         return Result.success();
     }
 
-    @GetMapping("/turnProdin/{id}")
+    @PostMapping("/turnProdin/{id}")
     public Result turnProdin(@PathVariable("id") Long id){
         purchaseService.turnProdin(id);
         return Result.success();
     }
 
-
-
 }

+ 3 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java

@@ -23,9 +23,10 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
 
     String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 
-    Integer validateCodeWhenInsert(String code);
+    Integer validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
 
-    Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
+    Integer validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id,
+                                   @Param("companyId") Long companyId);
 
     String selectCodeById(Long id);
 }

+ 2 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/ProdInOutService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.DocSavedDTO;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.purchase.dto.ProdInOutFormDTO;
@@ -32,7 +33,7 @@ public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, Pro
      * @param formdata
      * @return
      */
-    DocSavedDTO saveFormData(ProdInOutFormDTO formdata,Boolean isbfaudit);
+    DocBaseDTO saveFormData(ProdInOutFormDTO formdata);
 
     /**
      * 删除出入库单

+ 3 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/ProdInOutServiceImpl.java

@@ -339,8 +339,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code) :
-                purchaseMapper.validateCodeWhenUpdate(code, id);
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
+                purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
         return maxnumberService.pushMaxnubmer(count, code, "Purchase").toString();
     }
 

+ 6 - 4
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java

@@ -10,6 +10,7 @@ import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
@@ -469,9 +470,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code) :
-                purchaseMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code, companyId) :
+                purchaseMapper.validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.PURCHASE.getCaller()).getData();
     }
     
     /** 
@@ -486,7 +488,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             return null;
         }
         String code = purchaseMapper.selectCodeById(id);
-        DocBaseDTO baseDTO = new DocBaseDTO(id, code, "Purchase");
+        DocBaseDTO baseDTO = new DocBaseDTO(id, code, BillCodeSeq.PURCHASE.getCaller());
         return baseDTO;
     }
 }

+ 6 - 6
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml

@@ -406,20 +406,20 @@
   <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
     select pu_code from purchase where pu_id = #{pu_id} and IFNULL(pu_statuscode,'UNAUDITED')='UNAUDITED'
   </select>
-  <select id="selectByTest" resultMap="BaseResultMap" parameterType="string" >
+  <!--<select id="selectByTest" resultMap="BaseResultMap" parameterType="string" >
     select * from purchase <where>
     <if test="_parameter != null">
        ${value}
     </if>
   </where>
-  </select>
-  <select id="validateCodeWhenInsert" resultType="int" parameterType="string" >
-    select count(1) from purchase where pu_code = #{code}
+  </select>-->
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(1) from purchase where pu_code = #{code} and companyId =#{companyId}
   </select>
   <select id="validateCodeWhenUpdate" resultType="int" >
-    select count(1) from purchase where pu_code = #{code} and pu_id != #{id}
+    select count(1) from purchase where pu_code = #{code} and pu_id != #{id} and companyId =#{companyId}
   </select>
   <select id="selectCodeById" resultType="string" parameterType="long">
-    select pu_code from pu_id=#{id}
+    select pu_code from purchase where pu_id=#{id}
   </select>
 </mapper>

+ 9 - 1
applications/sale/sale-dto/pom.xml

@@ -19,6 +19,14 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-dto</artifactId>
+        </dependency>
     </dependencies>
-
 </project>

+ 91 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdIODetailDTO.java

@@ -0,0 +1,91 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import com.usoftchina.saas.document.dto.ProductDTO;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdIODetailDTO extends CommonBaseEntity implements Serializable {
+
+    private Long pd_piid;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private Integer pd_pdno;
+
+    private String pd_ordercode;
+
+    private Integer pd_orderdetno;
+
+    private Long pd_prodid;
+
+    private String pd_prodcode;
+
+    private String pd_unit;
+
+    private Double pd_inqty;
+
+    private Double pd_outqty;
+
+    private Double pd_orderprice;
+
+    private Double pd_sendprice;
+
+    private Double pd_price;
+
+    private Double pd_total;
+
+    private Double pd_taxrate;
+
+    private Double pd_netprice;
+
+    private Double pd_nettotal;
+
+    private Integer pd_whid;
+
+    private String pd_whcode;
+
+    private String pd_whname;
+
+    private Integer pd_inwhid;
+
+    private String pd_inwhcode;
+
+    private String pd_inwhname;
+
+    private Long pd_orderid;
+
+    private Integer pd_sdid;
+
+    private Integer pd_status;
+
+    private String pd_text1;
+
+    private String pd_text2;
+
+    private String pd_text3;
+
+    private String pd_text4;
+
+    private String pd_text5;
+
+    private Integer pd_ym;
+
+    private Double pd_yqty;
+
+    private String pd_remark;
+
+    private Long pd_ioid;
+
+    private ProductDTO product;
+
+}

+ 73 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutDTO.java

@@ -0,0 +1,73 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutDTO extends CommonBaseEntity implements Serializable {
+
+    private String pi_inoutno;
+
+    private String pi_class;
+
+    private Date pi_date;
+
+    private Integer pi_vendid;
+
+    private String pi_vendcode;
+
+    private String pi_vendname;
+
+    private Integer pi_custid;
+
+    private String pi_custcode;
+
+    private String pi_custname;
+
+    private Integer pi_puid;
+
+    private String pi_pucode;
+
+    private Long pi_said;
+
+    private String pi_sacode;
+
+    private Double pi_total;
+
+    private Integer pi_recordmanid;
+
+    private String pi_recordman;
+
+    private Date pi_recorddate;
+
+    private String pi_status;
+
+    private String pi_statuscode;
+
+    private String pi_printstatus;
+
+    private String pi_printstatuscode;
+
+    private String pi_text1;
+
+    private String pi_text2;
+
+    private String pi_text3;
+
+    private String pi_text4;
+
+    private String pi_text5;
+
+    private String pi_address;
+
+
+
+}

+ 18 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutFormDTO.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.sale.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutFormDTO implements Serializable {
+
+    private ProdInOutDTO main;
+    private List<ProdIODetailDTO> items;
+
+}

+ 140 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutListDTO.java

@@ -0,0 +1,140 @@
+package com.usoftchina.saas.sale.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutListDTO extends CommonBaseEntity implements Serializable {
+
+    private String pi_inoutno;
+
+    private String pi_class;
+
+    private Date pi_date;
+
+    private Integer pi_vendid;
+
+    private String pi_vendcode;
+
+    private String pi_vendname;
+
+    private Integer pi_custid;
+
+    private String pi_custcode;
+
+    private String pi_custname;
+
+    private Integer pi_puid;
+
+    private String pi_pucode;
+
+    private Integer pi_said;
+
+    private String pi_sacode;
+
+    private Double pi_total;
+
+    private Integer pi_recordmanid;
+
+    private String pi_recordman;
+
+    private Date pi_recorddate;
+
+    private String pi_status;
+
+    private String pi_statuscode;
+
+    private String pi_printstatus;
+
+    private String pi_printstatuscode;
+
+    private String pi_text1;
+
+    private String pi_text2;
+
+    private String pi_text3;
+
+    private String pi_text4;
+
+    private String pi_text5;
+
+    private String pi_address;
+
+    private Long pd_piid;
+
+    private String pd_inoutno;
+
+    private String pd_piclass;
+
+    private Integer pd_pdno;
+
+    private String pd_ordercode;
+
+    private Integer pd_orderdetno;
+
+    private Integer pd_prodid;
+
+    private String pd_prodcode;
+
+    private String pd_unit;
+
+    private Double pd_inqty;
+
+    private Double pd_outqty;
+
+    private Double pd_orderprice;
+
+    private Double pd_sendprice;
+
+    private Double pd_price;
+
+    private Double pd_total;
+
+    private Double pd_taxrate;
+
+    private Double pd_netprice;
+
+    private Double pd_nettotal;
+
+    private Integer pd_whid;
+
+    private String pd_whcode;
+
+    private String pd_whname;
+
+    private Integer pd_inwhid;
+
+    private String pd_inwhcode;
+
+    private String pd_inwhname;
+
+    private Integer pd_orderid;
+
+    private Integer pd_sdid;
+
+    private Integer pd_status;
+
+    private String pd_text1;
+
+    private String pd_text2;
+
+    private String pd_text3;
+
+    private String pd_text4;
+
+    private String pd_text5;
+
+    private Integer pd_ym;
+
+    private Integer pd_yqty;
+
+    private String pd_remark;
+
+}

+ 28 - 0
applications/sale/sale-dto/src/main/java/com/usoftchina/saas/sale/dto/ProdInOutReqDTO.java

@@ -0,0 +1,28 @@
+package com.usoftchina.saas.sale.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by wyx
+ * 2018-10-23
+ */
+@Data
+public class ProdInOutReqDTO implements Serializable {
+    /**
+     * 开始日期
+     */
+    private Date begin;
+    /**
+     * 截止日期
+     */
+    private Date end;
+    private String status;
+    private String keyword;
+    //区分是否为关联列表
+    private String mode;
+
+
+}

+ 1 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/SaleApplication.java

@@ -14,13 +14,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
 @SpringBootApplication
 @MapperScan("com.usoftchina.saas.sale.mapper")
 @EnableEurekaClient
-public class SaleApplication extends WebMvcConfigurerAdapter {
+public class SaleApplication extends WebMvcConfigurerAdapter{
     public static void main(String[] args) {
         SpringApplication.run(SaleApplication.class, args);
     }
     @Override
     public void addCorsMappings(CorsRegistry registry) {
-
         registry.addMapping("/**")
                 .allowCredentials(true)
                 .allowedHeaders("*")

+ 161 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/ProdInOutController.java

@@ -0,0 +1,161 @@
+package com.usoftchina.saas.sale.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.service.ProdInOutService;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+@CrossOrigin
+@RestController
+@RequestMapping("/prodinout")
+public class ProdInOutController {
+
+
+    @Autowired
+    ProdInOutService prodInOutService;
+
+
+    /**
+     * 出入库订单列表
+     *
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<PageInfo<ProdInOutList>> getListData(PageRequest page, ListReqDTO req) {
+        PageInfo<ProdInOutList> listData = prodInOutService.getListData(page,req);
+        return Result.success(listData);
+    }
+
+    /**
+     * 获取出入库单表单
+     *
+     * @return
+     */
+    @GetMapping("/read/{id}")
+    public Result<ProdInOutFormDTO> getFormData(@PathVariable("id") Long id) {
+        ProdInOutFormDTO data = prodInOutService.getFormData(id);
+        return Result.success(data);
+    }
+
+    /**
+     * 出入库单表单保存
+     *
+     * @param
+     * @return
+     */
+    @PostMapping("/save")
+    public Result<DocSavedDTO> saveFormData(@RequestBody ProdInOutFormDTO data) {
+        DocSavedDTO savedDTO = prodInOutService.saveFormData(data,false);
+        return Result.success(savedDTO);
+    }
+
+    /**
+     * 出入库单删除
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id) {
+        prodInOutService.delete(id);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单明细删除
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/deleteItem/{id}")
+    public Result deleteItem(@PathVariable("id") Long id) {
+        prodInOutService.deleteItem(id);
+        return Result.success();
+    }
+
+
+    /**
+     * 出入库单审批
+     *
+     * @param formData
+     * @return
+     */
+    @PostMapping("/audit")
+    public Result audit(@RequestBody ProdInOutFormDTO formData) {
+        DocSavedDTO audit = prodInOutService.audit(formData);
+        return Result.success(audit);
+    }
+
+    /**
+     * 出入库单审批
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/unAudit/{id}")
+    public Result unAudit(@PathVariable("id") Long id) {
+        prodInOutService.unAudit(id);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单批量审核/反审核
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchAudit")
+    public Result batchAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchAudit(baseDTOs);
+        return Result.success();
+    }
+
+    /**
+     * 出入库单批量反审核
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchUnAudit")
+    public Result batchUnAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchAudit(baseDTOs);
+        return Result.success();
+    }
+
+
+    /**
+     * 出入库单批量删除
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchDelete")
+    public Result batchDelete(@RequestBody BatchDealBaseDTO baseDTOs) {
+        prodInOutService.batchDelete(baseDTOs);
+        return Result.success();
+    }
+
+    @GetMapping("/turnProdIn/{id}")
+    public Result turnProdin(@PathVariable("id") Long id){
+        prodInOutService.turnProdin(id);
+        return Result.success();
+    };
+
+
+
+
+}

+ 4 - 4
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java

@@ -67,7 +67,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/delete/{id}")
+    @PostMapping("/delete/{id}")
     public Result delete(@PathVariable("id") Long id) {
         saleService.delete(id);
         return Result.success();
@@ -79,7 +79,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/deleteDetail/{id}")
+    @PostMapping("/deleteDetail/{id}")
     public Result deleteDetail(@PathVariable("id") Long id) {
         saleService.deleteDetail(id);
         return Result.success();
@@ -103,7 +103,7 @@ public class SaleController {
      * @param id
      * @return
      */
-    @GetMapping("/unAudit/{id}")
+    @PostMapping("/unAudit/{id}")
     public Result unAudit(@PathVariable("id") Long id) {
         saleService.unAudit(id);
         return Result.success();
@@ -157,7 +157,7 @@ public class SaleController {
         return Result.success();
     }
 
-    @GetMapping("/turnProdOut/{id}")
+    @PostMapping("/turnProdOut/{id}")
     public Result turnOut(@PathVariable("id") Long id) {
         saleService.turnOut(id);
         return Result.success();

+ 18 - 7
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java

@@ -1,30 +1,41 @@
 package com.usoftchina.saas.sale.mapper;
 
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdIODetailExample;
+
 
 import java.util.List;
 
-public interface ProdIODetailMapper  {
+public interface ProdIODetailMapper extends CommonBaseMapper<ProdIODetail> {
+
 
-    int deleteByPrimaryKey(Long pd_id);
+    int deleteByExample(ProdIODetailExample example);
 
     int insert(ProdIODetail record);
 
     int insertSelective(ProdIODetail record);
 
-    ProdIODetail selectByPrimaryKey(Integer pd_id);
-
     int updateByPrimaryKeySelective(ProdIODetail record);
 
-    int updateByPrimaryKeyWithBLOBs(ProdIODetail record);
-
     int updateByPrimaryKey(ProdIODetail record);
 
+    int deleteByPrimaryKey(Long id);
+
+    void deleteByForeignKey(Long id);
+
     void batchInsert(List<ProdIODetail> list);
 
     void batchUpdate(List<ProdIODetail> list);
 
-    void updatePurchaseYqty(Integer id);
+    void updateSaleOutYqty(Long id);
 
     List<ProdIODetail> selectByFK(Long id);
+    //销售入库更新计算明细其它字段
+    void updatePDSaleIN(Long id);
+    //销售出库更新计算明细其它字段
+    void updatePDSaleOut(Long id);
+    //更新销售订单已转数
+    void updateSaleYqty(Long id);
+
 }

+ 20 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutListMapper.java

@@ -0,0 +1,20 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+public interface ProdInOutListMapper {
+
+    List<ProdInOutList> selectProdInOutListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    List<ProdInOutList> selectProdInOutBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+
+}

+ 32 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java

@@ -1,10 +1,19 @@
 package com.usoftchina.saas.sale.mapper;
 
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutExample;
+import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
 
+public interface ProdInOutMapper extends CommonBaseMapper<ProdInOut> {
+    long countByExample(ProdInOutExample example);
 
-public interface ProdInOutMapper {
+    int deleteByExample(ProdInOutExample example);
 
     int deleteByPrimaryKey(Long pi_id);
 
@@ -12,11 +21,33 @@ public interface ProdInOutMapper {
 
     int insertSelective(ProdInOut record);
 
+    List<ProdInOut> selectByExampleWithBLOBs(ProdInOutExample example);
+
+    List<ProdInOut> selectByExample(ProdInOutExample example);
+
     ProdInOut selectByPrimaryKey(Long pi_id);
 
+    int updateByExampleSelective(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
+    int updateByExampleWithBLOBs(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
+    int updateByExample(@Param("record") ProdInOut record, @Param("example") ProdInOutExample example);
+
     int updateByPrimaryKeySelective(ProdInOut record);
 
     int updateByPrimaryKeyWithBLOBs(ProdInOut record);
 
     int updateByPrimaryKey(ProdInOut record);
+
+    String selectCodeById(Long pi_id);
+
+    int validateCodeWhenInsert(@Param("code") String code,@Param("pi_class") String pi_class );
+
+    int validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id );
+
+    String validateUnAudit(Long id);
+
+    String validateAudit(List<DocBaseDTO> baseDTOs);
+
+    String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 }

+ 2 - 2
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaleMapper.java

@@ -20,7 +20,7 @@ public interface SaleMapper {
 
     int updateByPrimaryKey(Sale record);
 
-    Integer validateCodeWhenInsert(String code);
+    Integer validateCodeWhenInsert(@Param("code") String code, @Param("companyId") Long companyId);
 
     String selectCodeById(Long id);
 
@@ -30,7 +30,7 @@ public interface SaleMapper {
 
     String validateAudit(List<DocBaseDTO> baseDTOs);
 
-    Integer validateCodeWhenUpdate(@Param("code") String code,@Param("id") Long id);
+    Integer validateCodeWhenUpdate(@Param("code") String code, @Param("id") Long id, @Param("companyId") Long companyId);
 
     void updateTotal(Long id);
 }

+ 76 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/ProdInOutService.java

@@ -0,0 +1,76 @@
+package com.usoftchina.saas.sale.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.page.PageRequest;
+
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.mapper.ProdInOutMapper;
+import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+
+
+/**
+ * Created by wyx
+ * 2018-10-23.
+ */
+public interface ProdInOutService extends CommonBaseService<ProdInOutMapper, ProdInOut>  {
+
+
+    /**
+     * 获取出入单表单
+     *
+     * @param id
+     * @return
+     */
+    ProdInOutFormDTO getFormData(Long id);
+
+    /**
+     * 保存出入库单
+     *
+     * @param formdata
+     * @return
+     */
+    DocBaseDTO saveFormData(ProdInOutFormDTO formdata);
+
+    /**
+     * 删除出入库单
+     * @param id
+     */
+    void delete(Long id);
+
+    /**
+     * 审核出入库单
+     * @param formData
+     * @return
+     */
+    DocBaseDTO audit(ProdInOutFormDTO formData);
+
+    /**
+     * 反审核出入库单
+     * @param id
+     */
+    Result unAudit(Long id);
+
+    void batchAudit(BatchDealBaseDTO baseDTOs);
+
+    Integer deleteItem(Long id);
+
+    void batchDelete(BatchDealBaseDTO baseDTOs);
+
+    PageInfo<ProdInOutList> getListData(PageRequest page, ListReqDTO req);
+
+    Result turnProdin(Long id);
+
+    void batchUnAudit(BatchDealBaseDTO baseDTOs);
+
+    void open(Long id);
+
+    void close(Long id);
+}

+ 584 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/ProdInOutServiceImpl.java

@@ -0,0 +1,584 @@
+package com.usoftchina.saas.sale.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
+import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.DocSavedDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
+import com.usoftchina.saas.commons.po.Maxnumbers;
+import com.usoftchina.saas.commons.po.Status;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.api.WarehouseApi;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.exception.ExceptionCode;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.sale.dto.ProdIODetailDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutFormDTO;
+import com.usoftchina.saas.sale.dto.ProdInOutReqDTO;
+import com.usoftchina.saas.sale.mapper.*;
+import com.usoftchina.saas.sale.service.ProdInOutService;
+import com.usoftchina.saas.storage.po.ProdIODetail;
+import com.usoftchina.saas.storage.po.ProdInOut;
+import com.usoftchina.saas.storage.po.ProdInOutList;
+import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.*;
+@Service
+public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper, ProdInOut> implements ProdInOutService{
+
+    @Autowired
+    private MaxnumberService maxnumberService;
+
+    @Autowired
+    private ProdInOutListMapper prodInOutListMapper;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+    @Autowired
+    private WarehouseApi warehouseApi;
+
+    @Override
+    public ProdInOutFormDTO getFormData(Long id) {
+        ProdInOutFormDTO prodInOutFormDTO = new ProdInOutFormDTO();
+        //查询主表
+        ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+        //将prodInOut实体对象转化为传输对象
+        ProdInOutDTO main = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+        //查询从表
+
+        List<ProdIODetail> prodIODetails = prodIODetailMapper.selectByFK(id);
+        List<ProdIODetailDTO> items = BeanMapper.mapList(prodIODetails,ProdIODetailDTO.class);
+        prodInOutFormDTO.setMain(main);
+        prodInOutFormDTO.setItems(items);
+        return prodInOutFormDTO;
+    }
+
+    @Override
+    @Transactional
+    public DocBaseDTO saveFormData(ProdInOutFormDTO formdata) {
+
+        if (null == formdata || null == formdata.getMain()){
+            throw new BizException(500, "数据为空,请填写后再保存");
+        }
+        //公司ID
+        Long companyId = BaseContextHolder.getCompanyId();
+        //人员Id
+        Long userId = BaseContextHolder.getUserId();
+        //获取主表信息
+        ProdInOutDTO main = formdata.getMain();
+        List<ProdIODetailDTO> items = formdata.getItems();
+        //插入从表数据
+        List<ProdIODetail> insertDetails = new ArrayList<>();
+        //更新从表数据
+        List<ProdIODetail> updateDetails = new ArrayList<>();
+        //返回对象
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        Long pi_id = main.getId();
+        String pi_inoutno = main.getPi_inoutno();
+        String pi_class = main.getPi_class();
+        ProdInOut prodInOut = BeanMapper.map(main,ProdInOut.class);
+        prodInOut.setCompanyId(companyId);
+        prodInOut.setCreatorId(userId);
+        prodInOut.setCreateTime(new Date());
+        prodInOut.setPi_date(new Date());
+
+        //编号获取
+        pi_inoutno = pushMaxnubmer(pi_inoutno, pi_id,pi_class);
+        prodInOut.setPi_inoutno(pi_inoutno);
+
+        prodInOut.setPi_class(main.getPi_class());
+        prodInOut.setPi_said(main.getPi_said());
+        prodInOut.setPi_sacode(main.getPi_sacode());
+
+        //判断更新与保存动作
+        if (StringUtils.isEmpty(pi_id) || "0".equals(pi_id.toString())){
+            //插入操作
+            prodInOutMapper.insertSelective(prodInOut);
+            pi_id = prodInOut.getId();
+            //添加从表传输对象
+            for (ProdIODetailDTO item : items) {
+                ProdIODetail detail = BeanMapper.map(item,ProdIODetail.class);
+                detail.setPd_piid(pi_id);
+                detail.setPd_inoutno(pi_inoutno);
+                detail.setPd_piclass(pi_class);
+                detail.setPd_yqty(0.0);
+                insertDetails.add(detail);
+            }
+
+            //插入从表
+            if (insertDetails.size()>0) {
+                prodIODetailMapper.batchInsert(insertDetails);
+            }
+            baseDTO = getBaseDTOById(pi_id,pi_class);
+            //更新明细金额
+            getTotal(pi_id,pi_class);
+            //日志记录
+            messageLogService.save(baseDTO);
+            return baseDTO;
+        }
+        //更新操作
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        //添加从表传输对象
+        for (ProdIODetailDTO item : items) {
+            ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
+            detail.setPd_piid(pi_id);
+            detail.setPd_inoutno(pi_inoutno);
+            detail.setPd_piclass(prodInOut.getPi_class());
+            if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
+                insertDetails.add(detail);
+            } else {
+                updateDetails.add(detail);
+            }
+        }
+        //插入从表
+        if (insertDetails.size()>0) {
+            prodIODetailMapper.batchInsert(insertDetails);
+        }
+        //更新从表
+        if (updateDetails.size()>0) {
+            prodIODetailMapper.batchUpdate(updateDetails);
+        }
+        baseDTO = getBaseDTOById(pi_id,pi_class);
+        //更新已转数
+        updateYqty(prodInOut);
+        return baseDTO;
+
+    }
+
+    @Override
+    @Transactional
+    public void delete(Long id) {
+        singleDelete(id);
+    }
+    private void singleDelete(Long id) {
+        ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
+        //从表删除
+        prodIODetailMapper.deleteByForeignKey(id);
+        //主表删除
+        prodInOutMapper.deleteByPrimaryKey(id);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //更新已转数
+        updateYqty(prodInOut);
+        //日志
+        messageLogService.deleteDetail(docBaseDTO);
+    }
+    @Override
+    @Transactional
+    public DocBaseDTO audit(ProdInOutFormDTO formData) {
+        Long id = null;
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        if (null != formData) {
+            id = formData.getMain().getId();
+            if (StringUtils.isEmpty(id)) {
+                baseDTO = saveFormData(formData);
+                id = baseDTO.getId();
+            }
+            String res = singleAudit(formData.getMain());
+            if(res!=null){
+                new BizException(501,res);
+            }
+        }
+        baseDTO.setId(id);
+        return baseDTO;
+    }
+    private String singleAudit(ProdInOutDTO prodInOutDTO) {
+        String pi_class= prodInOutDTO.getPi_class();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
+        map.put("class", pi_class);
+        map.put("commitid",BaseContextHolder.getUserId());
+        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("result","");
+        warehouseApi.post(map);
+        Object result =  map.get("result");
+        if(result!=null){
+            return result.toString();
+        }else{
+            //记录日志
+            DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class);
+            //日志
+            messageLogService.audit(docBaseDTO);
+            return "";
+        }
+    }
+    @Override
+    public Result unAudit(Long id) {
+        if (null == id) {
+            return Result.error(BizExceptionCode.SALE_NULL_BILL);
+        }
+        String code = prodInOutMapper.validateUnAudit(id);
+        if (null != code) {
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
+        }
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+        ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut, ProdInOutDTO.class);
+        String res =  singleUnAudit(prodInOutDTO);
+        if(res!=null){
+            return Result.error(res);
+        }else{
+            return Result.success();
+        }
+    }
+    private String singleUnAudit(ProdInOutDTO prodInOutDTO) {
+        String pi_class= prodInOutDTO.getPi_class();
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("inoutNo",prodInOutDTO.getPi_inoutno() );
+        map.put("class", pi_class);
+        map.put("commitid",BaseContextHolder.getUserId());
+        map.put("companyid",BaseContextHolder.getCompanyId());
+        map.put("result","");
+        warehouseApi.unPost(map);
+        Object result =  map.get("result");
+        if(result!=null){
+            return result.toString();
+        }else{
+            //记录日志
+            DocBaseDTO docBaseDTO = getBaseDTOById(prodInOutDTO.getId(),pi_class);
+            //日志
+            messageLogService.unAudit(docBaseDTO);
+            return "";
+        }
+    }
+    @Override
+    public void batchAudit(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        String validate = prodInOutMapper.validateAudit(baseDTOs.getBaseDTOs());
+        if (!StringUtils.isEmpty(validate)) {
+            throw new BizException(500, "存在已审核单据,单据编号:" + validate);
+        }
+        String error = null;
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            Long id =  base.getId();
+            ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+            error+=singleAudit(prodInOutDTO);
+        }
+        if(error!=null&&!error.equals("")){
+            new BizException(501,error);
+        }
+    }
+
+    @Override
+    public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+
+        String msg = prodInOutMapper.validateBatchUnAudit(baseDTOs.getBaseDTOs());
+        if (null != msg) {
+            throw new BizException(500, "存在未审核单据,单据编号:" + msg);
+        }
+        String error = null;
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            Long id =  base.getId();
+            ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+            ProdInOutDTO prodInOutDTO = BeanMapper.map(prodInOut,ProdInOutDTO.class);
+            error+=singleUnAudit(prodInOutDTO);
+        }
+        if(error!=null&&!error.equals("")){
+            new BizException(501,error);
+        }
+    }
+
+    @Override
+    public Integer deleteItem(Long id) {
+        ProdIODetail prodIODetail = prodIODetailMapper.selectByPrimaryKey(id);
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(prodIODetail.getPd_piid());
+        Integer num = prodIODetailMapper.deleteByPrimaryKey(id);
+        //更新已转数
+        updateYqty(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //日志
+        messageLogService.deleteDetail(docBaseDTO);
+        return num;
+    }
+    @Override
+    public void batchDelete(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0) {
+            return;
+        }
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            singleDelete(base.getId());
+        }
+    }
+
+    @Override
+    public PageInfo<ProdInOutList> getListData(PageRequest page, ListReqDTO req) {
+        //设置默认分页
+        if (null == page || page.getSize() == 0 || page.getNumber() == 0) {
+            page = new PageRequest();
+            page.setNumber(1);
+            page.setSize(10);
+        }
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        //查询数据
+        List<ProdInOutList> lists = getListByMode(req);
+        //取分页信息
+        PageInfo<ProdInOutList> pageInfo = new PageInfo<ProdInOutList>(lists);
+        return pageInfo;
+    }
+    private List<ProdInOutList> getListByMode(ListReqDTO req) {
+        List<ProdInOutList> list = null;
+        Long companyId = BaseContextHolder.getCompanyId();
+        String con = req.getFinalCondition();
+        if (null == con) {
+            con = "1=1";
+        }
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+            list = prodInOutListMapper.selectProdInOutListByCondition(con, companyId);
+        } else {
+            list = prodInOutListMapper.selectProdInOutBycondition(con, companyId);
+        }
+        return list;
+    }
+    @Override
+    public Result turnProdin(Long id) {
+        Integer count=0;
+        double pdOutqty=0;
+        double pdYqty=0;
+        ProdInOut sourcePi = prodInOutMapper.selectByPrimaryKey(id);
+        List<ProdIODetail> sourceDetails =prodIODetailMapper.selectByFK(id);
+        if (null == sourcePi || StringUtils.isEmpty(sourcePi.getPi_inoutno()) || sourceDetails.size() == 0) {
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
+        }
+
+        //检查转单状态
+        String statuscode = sourcePi.getPi_statuscode();
+        if(!Status.UNAUDITED.name().equals(statuscode)){
+            throw new BizException(BizExceptionCode.SALEOUT_POSTSTATUS_ERROR);
+        }
+
+        //检查从表
+        for (ProdIODetail prodIODetail : sourceDetails) {
+            pdOutqty = prodIODetail.getPd_outqty()==null?0.0:prodIODetail.getPd_outqty();
+            pdYqty = prodIODetail.getPd_yqty()==null?0.0:prodIODetail.getPd_yqty();
+            if (pdOutqty-pdYqty>0){
+                count++;
+            }
+        }
+        //判断可转数
+        if (count==0) {
+            return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
+        }
+        //插入销售退货单主表
+        ProdInOut targetPi = new ProdInOut();
+        //生成单号
+        String piInoutno =  maxnumberService.getMaxnumber(BillCodeSeq.SALEIN.getCaller(),true).getData();
+        targetPi.setPi_inoutno(piInoutno);
+        targetPi.setPi_class(BillCodeSeq.SALEIN.getName());
+        targetPi.setPi_date(new Date());
+        targetPi.setPi_recorddate(new Date());
+        targetPi.setPi_status(Status.UNAUDITED.getDisplay());
+        targetPi.setPi_statuscode(Status.UNAUDITED.name());
+        //客户信息
+        targetPi.setPi_custid(sourcePi.getPi_custid());
+        targetPi.setPi_custcode(sourcePi.getPi_custcode());
+        targetPi.setPi_custname(sourcePi.getPi_custname());
+        targetPi.setPi_said(sourcePi.getPi_said());
+        targetPi.setPi_sacode(sourcePi.getPi_sacode());
+
+        //设置公司id
+        targetPi.setCompanyId(sourcePi.getCompanyId());
+        //保存数据
+        getMapper().insertSelective(targetPi);
+        //插入销售退货单从表
+        long pi_id = targetPi.getId();
+        for (int i = 0;i<sourceDetails.size();i++){
+            ProdIODetail sourcePid = sourceDetails.get(i);
+            ProdIODetail targetPid = new ProdIODetail();
+            pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
+            pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
+            if(pdOutqty-pdYqty>0){
+                targetPid.setPd_piid(pi_id);
+                targetPid.setPd_inoutno(piInoutno);
+                targetPid.setPd_piclass(BillCodeSeq.SALEIN.getName());
+                targetPid.setPd_pdno(i);
+                targetPid.setPd_orderid(sourcePid.getPd_orderid());
+                targetPid.setPd_ordercode(sourcePid.getPd_ordercode());
+                targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
+
+                targetPid.setPd_sdid(sourcePid.getPd_sdid());
+                targetPid.setPd_sendprice(sourcePid.getPd_sendprice());
+
+
+                targetPid.setPd_prodid(sourcePid.getPd_prodid());
+                targetPid.setPd_prodcode(sourcePid.getPd_prodcode());
+                targetPid.setPd_unit(sourcePid.getPd_unit());
+                targetPid.setPd_ioid(sourcePid.getId());
+                targetPid.setPd_status(0);
+                //公司id
+                targetPid.setCompanyId(sourcePid.getCompanyId());
+                //本次转单数
+                targetPid.setPd_inqty(pdOutqty-pdYqty);
+                prodIODetailMapper.insertSelective(targetPid);
+                //更新已转数
+                sourcePid.setPd_yqty(pdOutqty);
+                prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
+            }
+        }
+        return Result.success();
+
+    }
+
+    @Override
+    @Transactional
+    public void close(Long id) {
+        if(id == null || id <= 0) {
+            throw new BizException(BizExceptionCode.ILLEGAL_ID);
+        }
+        ProdInOut prodInOut =  prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
+        if(Status.CLOSE.name().equals(prodInOut.getPi_status())){
+            throw new BizException(BizExceptionCode.BIZ_CLOSE);
+        }
+        prodInOut.setPi_status(Status.CLOSE.getDisplay());
+        prodInOut.setPi_statuscode(Status.CLOSE.name());
+
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //日志
+        messageLogService.close(docBaseDTO);
+    }
+
+    @Override
+    @Transactional
+    public void open(Long id){
+        ProdInOut prodInOut = prodInOutMapper.selectByPrimaryKey(id);
+        if(prodInOut==null){
+            throw new BizException(BizExceptionCode.NO_DATA);
+        }
+        List<ProdIODetail> prodIODetailList = prodIODetailMapper.selectByFK(id);
+        //部分入库、全部入库
+        int partTurnCount = 0,turnCount = 0;
+        Double yqty=0.0,qty=0.0;
+        Boolean isIn = false;
+        if(BillCodeSeq.SALEIN.getName().equals(prodInOut.getPi_class())){
+            isIn=true;
+        }
+        if(prodIODetailList!=null&&prodIODetailList.size()>0){
+            for (ProdIODetail prodiodetail :prodIODetailList){
+                yqty = prodiodetail.getPd_yqty() ==null?0.0:prodiodetail.getPd_yqty();
+                if(isIn){
+                    qty = prodiodetail.getPd_inqty() ==null?0.0:prodiodetail.getPd_yqty();
+                }else{
+                    qty = prodiodetail.getPd_outqty() ==null?0.0:prodiodetail.getPd_outqty();
+                }
+                if(yqty >= qty){
+                    turnCount++;
+                }else if(yqty>0&&yqty<qty){
+                    partTurnCount++;
+                }
+            }
+        }
+        if(partTurnCount>0){
+            if(isIn){
+                prodInOut.setPi_status(Status.PART2IN.getDisplay());
+                prodInOut.setPi_statuscode(Status.PART2IN.name());
+            }else {
+                prodInOut.setPi_status(Status.PARTOUT.getDisplay());
+                prodInOut.setPi_statuscode(Status.PARTOUT.name());
+            }
+        }else if(turnCount == prodIODetailList.size()){
+            if(isIn){
+                prodInOut.setPi_status(Status.TURNIN.getDisplay());
+                prodInOut.setPi_statuscode(Status.TURNIN.name());
+            }else {
+                prodInOut.setPi_status(Status.TURNOUT.getDisplay());
+                prodInOut.setPi_statuscode(Status.TURNOUT.name());
+            }
+        }else{
+            prodInOut.setPi_status(Status.AUDITED.getDisplay());
+            prodInOut.setPi_statuscode(Status.AUDITED.getDisplay());
+        }
+        prodInOutMapper.updateByPrimaryKeySelective(prodInOut);
+        DocBaseDTO docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class());
+        //记录日志
+        messageLogService.open(docBaseDTO);
+    }
+    /**
+     * @Description: 检验获取并更新单号
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: guq
+     * @Date: 2018/10/19
+     */
+    private String pushMaxnubmer(String code, Long id,String pi_class) {
+        if (null == code) {
+            throw new BizException(BizExceptionCode.NULL_CODE);
+        }
+        Integer count = "0".equals(String.valueOf(id)) ? prodInOutMapper.validateCodeWhenInsert(code,pi_class) :
+                prodInOutMapper.validateCodeWhenUpdate(code, id);
+        String caller ="";
+        if(pi_class.equals("销售出货单")){
+            caller = BillCodeSeq.SALEOUT.getCaller();
+        }else {//销售退货单
+            caller = BillCodeSeq.SALEIN.getCaller();
+        }
+        return maxnumberService.pushMaxnubmer(count, code, caller).getData();
+    }
+    /**
+     * @Description: 更新已转数
+     * @Param: [code, id]
+     * @return: java.lang.String
+     * @Author: wuyx
+     * @Date: 2018/10/23
+     */
+    private void updateYqty(ProdInOut prodInOut) {
+        //更新已转数
+        if ("销售出货单".equals(prodInOut.getPi_class())){
+            prodIODetailMapper.updateSaleYqty(prodInOut.getPi_said());
+        }else if ("销售退货单".equals(prodInOut.getPi_class())){
+            prodIODetailMapper.updateSaleOutYqty(prodInOut.getPi_said());
+        }
+    }
+
+    /**
+     * @Description
+     * @Param: [id]
+     * @return: com.usoftchina.saas.commons.dto.DocBaseDTO
+     * @Author: wuyx
+     * @Date: 2018/10/25
+     */
+    private DocBaseDTO getBaseDTOById(Long id,String pi_class) {
+        if (null == id) {
+            return null;
+        }
+        String caller = BillCodeSeq.SALEIN.getName().equals(pi_class)?BillCodeSeq.SALEIN.getCaller():BillCodeSeq.SALEOUT.getCaller();
+        String code = prodInOutMapper.selectCodeById(id);
+        DocBaseDTO baseDTO = new DocBaseDTO();
+        baseDTO.setId(id);
+        baseDTO.setCode(code);
+        baseDTO.setName(caller);
+        return baseDTO;
+    }
+    //更新最新明细总额
+    private void getTotal(Long id,String pi_class) {
+        if(BillCodeSeq.SALEOUT.getName().equals(pi_class)){
+            prodIODetailMapper.updatePDSaleOut(id);
+        }else{
+            prodIODetailMapper.updatePDSaleIN(id);
+        }
+    }
+}

+ 23 - 21
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -2,10 +2,13 @@ package com.usoftchina.saas.sale.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.api.MaxnumberService;
+import com.usoftchina.saas.commons.api.MessageLogService;
 import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.commons.exception.BizExceptionCode;
+import com.usoftchina.saas.commons.po.BillCodeSeq;
 import com.usoftchina.saas.commons.po.Status;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.exception.BizException;
@@ -43,10 +46,10 @@ public class SaleServiceImpl implements SaleService{
     private SaleMapper saleMapper;
     @Autowired
     private SaledetailMapper saledetailMapper;
-   /* @Autowired
+    @Autowired
     private MessageLogService messageLogService;
     @Autowired
-    private MaxnumberService maxnumberService;*/
+    private MaxnumberService maxnumberService;
     @Autowired
     private ProdInOutMapper prodInOutMapper;
     @Autowired
@@ -113,7 +116,7 @@ public class SaleServiceImpl implements SaleService{
         sale.setCreateTime(new Date());
 
         //编号校验
-        //sa_code = pushMaxnubmer(sa_code, sa_id);
+        sa_code = pushMaxnubmer(sa_code, sa_id);
         //单号赋值
         sale.setSa_code(sa_code);
         //判断更新与保存动作
@@ -136,7 +139,7 @@ public class SaleServiceImpl implements SaleService{
             //更新销售金额
             getTotal(sa_id);
             //日志记录
-            //messageLogService.save(baseDTO);
+            messageLogService.save(baseDTO);
             return baseDTO;
         }
         //更新操作
@@ -164,7 +167,7 @@ public class SaleServiceImpl implements SaleService{
         //更新销售金额
         getTotal(sa_id);
         //日志
-        //messageLogService.save(baseDTO);
+        messageLogService.update(baseDTO);
         return baseDTO;
     }
 
@@ -179,7 +182,7 @@ public class SaleServiceImpl implements SaleService{
         Integer num = saledetailMapper.deleteByPrimaryKey(id);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.deleteDetail(docBaseDTO);
+        messageLogService.deleteDetail(docBaseDTO);
         return num;
     }
 
@@ -206,7 +209,7 @@ public class SaleServiceImpl implements SaleService{
         }
         String code = saleMapper.validateUnAudit(id);
         if (null != code) {
-            throw new BizException(500, "单据:" + code + " 未审核,无法反审核");
+            throw new BizException(BizExceptionCode.SALE_NULL_BILL);
         }
         singleUnAudit(id);
     }
@@ -252,7 +255,7 @@ public class SaleServiceImpl implements SaleService{
 
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.audit(docBaseDTO);
+        messageLogService.audit(docBaseDTO);
     }
 
     private void singleDelete(Long id) {
@@ -263,7 +266,7 @@ public class SaleServiceImpl implements SaleService{
             saleMapper.deleteByPrimaryKey(id);
             DocBaseDTO docBaseDTO = getBaseDTOById(id);
             //日志
-            //messageLogService.delete(docBaseDTO);
+            messageLogService.delete(docBaseDTO);
         }
     }
 
@@ -290,14 +293,15 @@ public class SaleServiceImpl implements SaleService{
      * @Author: guq
      * @Date: 2018/10/19
      */
-   /* private String pushMaxnubmer(String code, Long id) {
+    private String pushMaxnubmer(String code, Long id) {
         if (null == code) {
             throw new BizException(BizExceptionCode.NULL_CODE);
         }
-        Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code) :
-                saleMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
-    }*/
+        Long companyId = BaseContextHolder.getCompanyId();
+        Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code, companyId) :
+                saleMapper.validateCodeWhenUpdate(code, id, companyId);
+        return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller()).getData();
+    }
 
     /**
      * @Description
@@ -343,7 +347,7 @@ public class SaleServiceImpl implements SaleService{
         saleMapper.updateByPrimaryKeySelective(sale);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.close(docBaseDTO);
+        messageLogService.close(docBaseDTO);
     }
 
     @Override
@@ -379,7 +383,7 @@ public class SaleServiceImpl implements SaleService{
             saleMapper.updateByPrimaryKeySelective(sale);
             DocBaseDTO docBaseDTO = getBaseDTOById(id);
             //日志
-            //messageLogService.open(docBaseDTO);
+            messageLogService.open(docBaseDTO);
         }
     }
 
@@ -419,10 +423,8 @@ public class SaleServiceImpl implements SaleService{
         //插入验收单主表
         ProdInOut prodInOut = new ProdInOut();
         //生成单号
-        //String pi_inoutno = maxnumberService.getMaxnumber("Sale", true).getData();
-       // Object data =
-        String pi_inoutno = "xxxxx" + (int)(Math.random()*100)+1;;
-
+        String pi_inoutno = maxnumberService.getMaxnumber(BillCodeSeq.SALEOUT.getCaller(),
+                true).getData();
         prodInOut.setPi_inoutno(pi_inoutno);
         prodInOut.setPi_class("出货单");
         prodInOut.setPi_date(new Date());
@@ -483,7 +485,7 @@ public class SaleServiceImpl implements SaleService{
         saleMapper.updateByPrimaryKeySelective(sale);
         DocBaseDTO docBaseDTO = getBaseDTOById(id);
         //日志
-        //messageLogService.unAudit(docBaseDTO);
+        messageLogService.unAudit(docBaseDTO);
     }
 
     //更新最新销售总额

+ 297 - 25
applications/sale/sale-server/src/main/resources/mapper/ProdIODetailMapper.xml

@@ -143,6 +143,33 @@
   <sql id="Blob_Column_List">
     pd_remark
   </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultMap="ResultMapWithBLOBs">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from prodiodetail
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultMap="BaseResultMap">
+    select
+        *
+    from prodiodetail a left join product b on a.pd_prodid = b.pr_id and a.companyid = b.companyid
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
     select 
     <include refid="Base_Column_List" />
@@ -151,11 +178,19 @@
     from prodiodetail
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+    delete from prodiodetail where pd_id = #{pd_id}
+  </delete>
+  <delete id="deleteByForeignKey" parameterType="java.lang.Long">
+    delete from prodiodetail where pd_piid = #{pd_id}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample">
     delete from prodiodetail
-    where pd_id = #{pd_id,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
   </delete>
-  <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     insert into prodiodetail (pd_id, pd_piid, pd_inoutno, 
       pd_piclass, pd_pdno, pd_ordercode, 
       pd_orderdetno, pd_prodid, pd_prodcode, 
@@ -186,7 +221,7 @@
       #{pd_ioid,jdbcType=INTEGER}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     <selectKey resultType="java.lang.Long" keyProperty="id">
       SELECT LAST_INSERT_ID() AS ID
     </selectKey>
@@ -430,7 +465,233 @@
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <select id="countByExample" parameterType="com.usoftchina.saas.storage.po.ProdIODetailExample" resultType="java.lang.Long">
+    select count(*) from prodiodetail
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update prodiodetail
+    <set>
+      <if test="record.pd_id != null">
+        pd_id = #{record.pd_id,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_piid != null">
+        pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_inoutno != null">
+        pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_piclass != null">
+        pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_pdno != null">
+        pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_ordercode != null">
+        pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_orderdetno != null">
+        pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_prodid != null">
+        pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_prodcode != null">
+        pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_unit != null">
+        pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inqty != null">
+        pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_outqty != null">
+        pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_orderprice != null">
+        pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_sendprice != null">
+        pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_price != null">
+        pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_total != null">
+        pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_taxrate != null">
+        pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_netprice != null">
+        pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_nettotal != null">
+        pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pd_whid != null">
+        pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_whcode != null">
+        pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_whname != null">
+        pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inwhid != null">
+        pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_inwhcode != null">
+        pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_inwhname != null">
+        pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_orderid != null">
+        pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_sdid != null">
+        pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_status != null">
+        pd_status = #{record.pd_status,jdbcType=INTEGER},
+      </if>
+      <if test="record.companyid != null">
+        companyid = #{record.companyid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updaterid != null">
+        updaterid = #{record.updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updatetime != null">
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pd_text1 != null">
+        pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text2 != null">
+        pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text3 != null">
+        pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text4 != null">
+        pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_text5 != null">
+        pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pd_ym != null">
+        pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_yqty != null">
+        pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      </if>
+      <if test="record.pd_remark != null">
+        pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
+      </if>
+      <if test="record.pd_ioid != null">
+        pd_ioid = #{record.pd_ioid,jdbcType=INTEGER},
+      </if>
+
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    update prodiodetail
+    set pd_id = #{record.pd_id,jdbcType=INTEGER},
+      pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      pd_status = #{record.pd_status,jdbcType=INTEGER},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update prodiodetail
+    set pd_id = #{record.pd_id,jdbcType=INTEGER},
+      pd_piid = #{record.pd_piid,jdbcType=INTEGER},
+      pd_inoutno = #{record.pd_inoutno,jdbcType=VARCHAR},
+      pd_piclass = #{record.pd_piclass,jdbcType=VARCHAR},
+      pd_pdno = #{record.pd_pdno,jdbcType=INTEGER},
+      pd_ordercode = #{record.pd_ordercode,jdbcType=VARCHAR},
+      pd_orderdetno = #{record.pd_orderdetno,jdbcType=INTEGER},
+      pd_prodid = #{record.pd_prodid,jdbcType=INTEGER},
+      pd_prodcode = #{record.pd_prodcode,jdbcType=VARCHAR},
+      pd_unit = #{record.pd_unit,jdbcType=VARCHAR},
+      pd_inqty = #{record.pd_inqty,jdbcType=INTEGER},
+      pd_outqty = #{record.pd_outqty,jdbcType=INTEGER},
+      pd_orderprice = #{record.pd_orderprice,jdbcType=DOUBLE},
+      pd_sendprice = #{record.pd_sendprice,jdbcType=DOUBLE},
+      pd_price = #{record.pd_price,jdbcType=DOUBLE},
+      pd_total = #{record.pd_total,jdbcType=DOUBLE},
+      pd_taxrate = #{record.pd_taxrate,jdbcType=DOUBLE},
+      pd_netprice = #{record.pd_netprice,jdbcType=DOUBLE},
+      pd_nettotal = #{record.pd_nettotal,jdbcType=DOUBLE},
+      pd_whid = #{record.pd_whid,jdbcType=INTEGER},
+      pd_whcode = #{record.pd_whcode,jdbcType=VARCHAR},
+      pd_whname = #{record.pd_whname,jdbcType=VARCHAR},
+      pd_inwhid = #{record.pd_inwhid,jdbcType=INTEGER},
+      pd_inwhcode = #{record.pd_inwhcode,jdbcType=VARCHAR},
+      pd_inwhname = #{record.pd_inwhname,jdbcType=VARCHAR},
+      pd_orderid = #{record.pd_orderid,jdbcType=INTEGER},
+      pd_sdid = #{record.pd_sdid,jdbcType=INTEGER},
+      pd_status = #{record.pd_status,jdbcType=INTEGER},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pd_text1 = #{record.pd_text1,jdbcType=VARCHAR},
+      pd_text2 = #{record.pd_text2,jdbcType=VARCHAR},
+      pd_text3 = #{record.pd_text3,jdbcType=VARCHAR},
+      pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
+      pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
+      pd_ym = #{record.pd_ym,jdbcType=INTEGER},
+      pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
+      pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     <set>
       <if test="pd_piid != null">
@@ -553,7 +814,7 @@
     </set>
     where pd_id = #{id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     set pd_piid = #{pd_piid,jdbcType=INTEGER},
       pd_inoutno = #{pd_inoutno,jdbcType=VARCHAR},
@@ -596,7 +857,7 @@
       pd_ioid = #{pd_ioid,jdbcType=INTEGER}
     where pd_id = #{pd_id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.storage.po.ProdIODetail">
     update prodiodetail
     set pd_piid = #{pd_piid,jdbcType=INTEGER},
       pd_inoutno = #{pd_inoutno,jdbcType=VARCHAR},
@@ -911,15 +1172,7 @@
     </foreach>
   </insert>
 
-
-
-
-
-
-
-
-
-  <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.ProdInOut" >
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.storage.po.ProdIODetail" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update prodiodetail <set>
       <if test="item.pd_piid !=null">
@@ -1031,20 +1284,39 @@
     </foreach>
   </update>
 
-  <update id="updatePurchaseYqty" parameterType="java.lang.Integer">
-
-update prodiodetail a
-set a.pd_yqty =ifnull((select  b.pd_outqty  from  (select pd_ioid,sum(pd_outqty) pd_outqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
-and pi_puid=#{id,jdbcType=INTEGER}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
-where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
+  <update id="updateSaleOutYqty" parameterType="long">
+update prodiodetail
+  set a.pd_yqty =ifnull((select  b.pd_inqty  from  (select pi_said,sum(pd_inqty) pd_inqty from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售退货单'
+and pi_said=#{id}  GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
+where a.pd_piid = (select pi_id from prodinout where pi_said=#{id} and pi_class='销售出货单')
+  </update>
+  <update id="updateSaleYqty" parameterType="long">
+    update saledtail
+    set a.sd_yqty =ifnull((
+    select  b.pd_ounqty  from  (select pi_said,sum(pd_outqty) pd_outqty
+      from  prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售出货单'
+      and pi_said=#{id}  GROUP BY pi_said) b where ifnull(b.pd_ioid ,0)= a.pd_id
+      ),0)
+    where a.sd_said = #{id}
   </update>
-
 
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
     select * from prodiodetail a left join product b on b.pr_id= a.pd_prodid and a.companyid = b.companyid
     where pd_piid=#{id} order by pd_pdno
   </select>
 
-
-
+  <update id="updatePDSaleIN" parameterType="long">
+   update prodiodetail set
+   pd_total=ifnull(pd_inqty,0)*ifnull(pd_orderprice,0),
+   pd_netprice = ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100),
+   pd_nettotal = (ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100))*ifnull(pd_inqty)
+   where pd_piid=#{id}
+  </update>
+  <update id="updatePDSaleOut" parameterType="long">
+    update prodiodetail set
+    pd_total=ifnull(pd_outqty,0)*ifnull(pd_orderprice,0),
+    pd_netprice = ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100),
+    pd_nettotal = (ifnull(pd_sendprice,0)/(1+ifnull(pd_taxrate,0)/100))*ifnull(pd_outqty)
+    where pd_piid=#{id}
+  </update>
 </mapper>

+ 100 - 0
applications/sale/sale-server/src/main/resources/mapper/ProdInOutListMapper.xml

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usoftchina.saas.sale.mapper.ProdInOutListMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.storage.po.ProdInOutList">
+    <id column="pi_id" jdbcType="INTEGER" property="id" />
+    <result column="pi_inoutno" jdbcType="VARCHAR" property="pi_inoutno" />
+    <result column="pi_class" jdbcType="VARCHAR" property="pi_class" />
+    <result column="pi_date" jdbcType="TIMESTAMP" property="pi_date" />
+    <result column="pi_vendid" jdbcType="INTEGER" property="pi_vendid" />
+    <result column="pi_vendcode" jdbcType="VARCHAR" property="pi_vendcode" />
+    <result column="pi_vendname" jdbcType="VARCHAR" property="pi_vendname" />
+    <result column="pi_custid" jdbcType="INTEGER" property="pi_custid" />
+    <result column="pi_custcode" jdbcType="VARCHAR" property="pi_custcode" />
+    <result column="pi_custname" jdbcType="VARCHAR" property="pi_custname" />
+    <result column="pi_puid" jdbcType="INTEGER" property="pi_puid" />
+    <result column="pi_pucode" jdbcType="VARCHAR" property="pi_pucode" />
+    <result column="pi_said" jdbcType="INTEGER" property="pi_said" />
+    <result column="pi_sacode" jdbcType="VARCHAR" property="pi_sacode" />
+    <result column="pi_total" jdbcType="DOUBLE" property="pi_total" />
+    <result column="pi_recordmanid" jdbcType="INTEGER" property="pi_recordmanid" />
+    <result column="pi_recordman" jdbcType="VARCHAR" property="pi_recordman" />
+    <result column="pi_recorddate" jdbcType="TIMESTAMP" property="pi_recorddate" />
+    <result column="pi_status" jdbcType="VARCHAR" property="pi_status" />
+    <result column="pi_statuscode" jdbcType="VARCHAR" property="pi_statuscode" />
+    <result column="pi_printstatus" jdbcType="VARCHAR" property="pi_printstatus" />
+    <result column="pi_printstatuscode" jdbcType="VARCHAR" property="pi_printstatuscode" />
+    <result column="pi_text1" jdbcType="VARCHAR" property="pi_text1" />
+    <result column="pi_text2" jdbcType="VARCHAR" property="pi_text2" />
+    <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
+    <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
+    <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+    <result column="pi_address" jdbcType="VARCHAR" property="pi_address" />
+    <result column="pd_piid" jdbcType="INTEGER" property="pd_piid" />
+    <result column="pd_inoutno" jdbcType="VARCHAR" property="pd_inoutno" />
+    <result column="pd_piclass" jdbcType="VARCHAR" property="pd_piclass" />
+    <result column="pd_pdno" jdbcType="INTEGER" property="pd_pdno" />
+    <result column="pd_ordercode" jdbcType="VARCHAR" property="pd_ordercode" />
+    <result column="pd_orderdetno" jdbcType="INTEGER" property="pd_orderdetno" />
+    <result column="pd_prodid" jdbcType="INTEGER" property="pd_prodid" />
+    <result column="pd_prodcode" jdbcType="VARCHAR" property="pd_prodcode" />
+    <result column="pd_unit" jdbcType="VARCHAR" property="pd_unit" />
+    <result column="pd_inqty" jdbcType="INTEGER" property="pd_inqty" />
+    <result column="pd_outqty" jdbcType="INTEGER" property="pd_outqty" />
+    <result column="pd_orderprice" jdbcType="DOUBLE" property="pd_orderprice" />
+    <result column="pd_sendprice" jdbcType="DOUBLE" property="pd_sendprice" />
+    <result column="pd_price" jdbcType="DOUBLE" property="pd_price" />
+    <result column="pd_total" jdbcType="DOUBLE" property="pd_total" />
+    <result column="pd_taxrate" jdbcType="DOUBLE" property="pd_taxrate" />
+    <result column="pd_netprice" jdbcType="DOUBLE" property="pd_netprice" />
+    <result column="pd_nettotal" jdbcType="DOUBLE" property="pd_nettotal" />
+    <result column="pd_whid" jdbcType="INTEGER" property="pd_whid" />
+    <result column="pd_whcode" jdbcType="VARCHAR" property="pd_whcode" />
+    <result column="pd_whname" jdbcType="VARCHAR" property="pd_whname" />
+    <result column="pd_inwhid" jdbcType="INTEGER" property="pd_inwhid" />
+    <result column="pd_inwhcode" jdbcType="VARCHAR" property="pd_inwhcode" />
+    <result column="pd_inwhname" jdbcType="VARCHAR" property="pd_inwhname" />
+    <result column="pd_orderid" jdbcType="INTEGER" property="pd_orderid" />
+    <result column="pd_sdid" jdbcType="INTEGER" property="pd_sdid" />
+    <result column="pd_status" jdbcType="INTEGER" property="pd_status" />
+    <result column="companyid" jdbcType="INTEGER" property="companyId" />
+    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="pd_text1" jdbcType="VARCHAR" property="pd_text1" />
+    <result column="pd_text2" jdbcType="VARCHAR" property="pd_text2" />
+    <result column="pd_text3" jdbcType="VARCHAR" property="pd_text3" />
+    <result column="pd_text4" jdbcType="VARCHAR" property="pd_text4" />
+    <result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
+    <result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
+    <result column="pd_yqty" jdbcType="INTEGER" property="pd_yqty" />
+    <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
+
+  </resultMap>
+
+
+  <select id="selectProdInOutListByCondition" resultMap="BaseResultMap">
+    select  *  from prodinout left join prodiodetail on pi_id = pd_piid
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   prodinout.companyId = #{companyId}
+      </if> order by pi_date desc,pi_id desc,pd_pdno
+    </where>
+  </select>
+
+  <select id="selectProdInOutBycondition"  resultMap="BaseResultMap">
+    select  *  from prodinout
+      <where>
+        <if test="con != null">
+          ${con}
+        </if>
+        <if test="companyId != null">
+          and  companyId = #{companyId}
+        </if>
+      </where>
+      order by pi_id
+  </select>
+
+</mapper>

+ 252 - 5
applications/sale/sale-server/src/main/resources/mapper/ProdInOutMapper.xml

@@ -32,6 +32,9 @@
     <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
     <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
     <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
+
+
+
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.storage.po.ProdInOut">
     <result column="pi_address" jdbcType="LONGVARCHAR" property="pi_address" />
@@ -103,6 +106,36 @@
   <sql id="Blob_Column_List">
     pi_address
   </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultMap="ResultMapWithBLOBs">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
     select 
     <include refid="Base_Column_List" />
@@ -115,6 +148,12 @@
     delete from prodinout
     where pi_id = #{pi_id,jdbcType=INTEGER}
   </delete>
+  <delete id="deleteByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample">
+    delete from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
   <insert id="insert" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
     insert into prodinout (pi_id, pi_inoutno, pi_class, 
       pi_date, pi_vendid, pi_vendcode, 
@@ -131,7 +170,7 @@
       #{pi_date,jdbcType=TIMESTAMP}, #{pi_vendid,jdbcType=INTEGER}, #{pi_vendcode,jdbcType=VARCHAR}, 
       #{pi_vendname,jdbcType=VARCHAR}, #{pi_custid,jdbcType=INTEGER}, #{pi_custcode,jdbcType=VARCHAR}, 
       #{pi_custname,jdbcType=VARCHAR}, #{pi_puid,jdbcType=INTEGER}, #{pi_pucode,jdbcType=VARCHAR}, 
-      #{pi_said,jdbcType=INTEGER}, #{pi_sacode,jdbcType=VARCHAR}, #{pi_total,jdbcType=DOUBLE},
+      #{pi_said}, #{pi_sacode,jdbcType=VARCHAR}, #{pi_total,jdbcType=DOUBLE},
       #{pi_recordmanid,jdbcType=INTEGER}, #{pi_recordman,jdbcType=VARCHAR}, #{pi_recorddate,jdbcType=TIMESTAMP}, 
       #{pi_status,jdbcType=VARCHAR}, #{pi_statuscode,jdbcType=VARCHAR}, #{pi_printstatus,jdbcType=VARCHAR}, 
       #{pi_printstatuscode,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
@@ -273,7 +312,7 @@
         #{pi_pucode,jdbcType=VARCHAR},
       </if>
       <if test="pi_said != null">
-        #{pi_said,jdbcType=INTEGER},
+        #{pi_said},
       </if>
       <if test="pi_sacode != null">
         #{pi_sacode,jdbcType=VARCHAR},
@@ -331,7 +370,188 @@
       </if>
     </trim>
   </insert>
+  <select id="countByExample" parameterType="com.usoftchina.saas.storage.po.ProdInOutExample" resultType="java.lang.Long">
+    select count(*) from prodinout
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    update prodinout
+    <set>
+      <if test="record.pi_id != null">
+        pi_id = #{record.pi_id,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_inoutno != null">
+        pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_class != null">
+        pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_date != null">
+        pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_vendid != null">
+        pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_vendcode != null">
+        pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_vendname != null">
+        pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_custid != null">
+        pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_custcode != null">
+        pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_custname != null">
+        pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_puid != null">
+        pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_pucode != null">
+        pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_said != null">
+        pi_said = #{record.pi_said},
+      </if>
+      <if test="record.pi_sacode != null">
+        pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_total != null">
+        pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      </if>
+      <if test="record.pi_recordmanid != null">
+        pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      </if>
+      <if test="record.pi_recordman != null">
+        pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_recorddate != null">
+        pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_status != null">
+        pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_statuscode != null">
+        pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_printstatus != null">
+        pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_printstatuscode != null">
+        pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.companyid != null">
+        companyid = #{record.companyid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updaterid != null">
+        updaterid = #{record.updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="record.updatetime != null">
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.pi_text1 != null">
+        pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text2 != null">
+        pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text3 != null">
+        pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text4 != null">
+        pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_text5 != null">
+        pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="record.pi_address != null">
+        pi_address = #{record.pi_address,jdbcType=LONGVARCHAR},
+      </if>
 
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    update prodinout
+    set pi_id = #{record.pi_id,jdbcType=INTEGER},
+      pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      pi_said = #{record.pi_said},
+      pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR},
+      pi_address = #{record.pi_address,jdbcType=LONGVARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    update prodinout
+    set pi_id = #{record.pi_id,jdbcType=INTEGER},
+      pi_inoutno = #{record.pi_inoutno,jdbcType=VARCHAR},
+      pi_class = #{record.pi_class,jdbcType=VARCHAR},
+      pi_date = #{record.pi_date,jdbcType=TIMESTAMP},
+      pi_vendid = #{record.pi_vendid,jdbcType=INTEGER},
+      pi_vendcode = #{record.pi_vendcode,jdbcType=VARCHAR},
+      pi_vendname = #{record.pi_vendname,jdbcType=VARCHAR},
+      pi_custid = #{record.pi_custid,jdbcType=INTEGER},
+      pi_custcode = #{record.pi_custcode,jdbcType=VARCHAR},
+      pi_custname = #{record.pi_custname,jdbcType=VARCHAR},
+      pi_puid = #{record.pi_puid,jdbcType=INTEGER},
+      pi_pucode = #{record.pi_pucode,jdbcType=VARCHAR},
+      pi_said = #{record.pi_said},
+      pi_sacode = #{record.pi_sacode,jdbcType=VARCHAR},
+      pi_total = #{record.pi_total,jdbcType=DOUBLE},
+      pi_recordmanid = #{record.pi_recordmanid,jdbcType=INTEGER},
+      pi_recordman = #{record.pi_recordman,jdbcType=VARCHAR},
+      pi_recorddate = #{record.pi_recorddate,jdbcType=TIMESTAMP},
+      pi_status = #{record.pi_status,jdbcType=VARCHAR},
+      pi_statuscode = #{record.pi_statuscode,jdbcType=VARCHAR},
+      pi_printstatus = #{record.pi_printstatus,jdbcType=VARCHAR},
+      pi_printstatuscode = #{record.pi_printstatuscode,jdbcType=VARCHAR},
+      companyid = #{record.companyid,jdbcType=INTEGER},
+      updaterid = #{record.updaterid,jdbcType=INTEGER},
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
+      pi_text1 = #{record.pi_text1,jdbcType=VARCHAR},
+      pi_text2 = #{record.pi_text2,jdbcType=VARCHAR},
+      pi_text3 = #{record.pi_text3,jdbcType=VARCHAR},
+      pi_text4 = #{record.pi_text4,jdbcType=VARCHAR},
+      pi_text5 = #{record.pi_text5,jdbcType=VARCHAR}
+
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.storage.po.ProdInOut">
     update prodinout
     <set>
@@ -369,7 +589,7 @@
         pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
       </if>
       <if test="pi_said != null">
-        pi_said = #{pi_said,jdbcType=INTEGER},
+        pi_said = #{pi_said},
       </if>
       <if test="pi_sacode != null">
         pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
@@ -442,7 +662,7 @@
       pi_custname = #{pi_custname,jdbcType=VARCHAR},
       pi_puid = #{pi_puid,jdbcType=INTEGER},
       pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
-      pi_said = #{pi_said,jdbcType=INTEGER},
+      pi_said = #{pi_said},
       pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
       pi_total = #{pi_total,jdbcType=DOUBLE},
       pi_recordmanid = #{pi_recordmanid,jdbcType=INTEGER},
@@ -477,7 +697,7 @@
       pi_custname = #{pi_custname,jdbcType=VARCHAR},
       pi_puid = #{pi_puid,jdbcType=INTEGER},
       pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
-      pi_said = #{pi_said,jdbcType=INTEGER},
+      pi_said = #{pi_said},
       pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
       pi_total = #{pi_total,jdbcType=DOUBLE},
       pi_recordmanid = #{pi_recordmanid,jdbcType=INTEGER},
@@ -497,4 +717,31 @@
       pi_text5 = #{pi_text5,jdbcType=VARCHAR}
     where pi_id = #{id,jdbcType=INTEGER}
   </update>
+  <select id="selectCodeById" resultType="string" parameterType="long">
+    select pi_inoutno from prodinout where pi_id=#{id}
+  </select>
+  <select id="validateCodeWhenInsert"  resultType="int">
+    select count(1) from prodinout where pi_inoutno = #{code} and pi_class = #{pi_class}
+  </select>
+  <select id="validateCodeWhenUpdate" resultType="int" >
+    select count(1) from prodinout where pi_inoutno = #{code} and pi_id != #{id}
+  </select>
+  <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
+    select pi_inoutno from prodinout where pi_id = #{id} and IFNULL(pi_statuscode,'UNAUDITED')!='AUDITED'
+  </select>
+  <select id="validateAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(pi_inoutno) from prodinout where pi_statuscode='AUDITED' and pi_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
+
+  <select id="validateBatchUnAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(pi_inoutno) from prodinout where pi_statuscode='UNAUDITED' and pi_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
+
+
 </mapper>

+ 3 - 3
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -336,11 +336,11 @@
     where sa_id = #{id,jdbcType=INTEGER}
   </update>
 
-  <select id="validateCodeWhenInsert" resultType="int" parameterType="string" >
-    select count(1) from sale where sa_code = #{code}
+  <select id="validateCodeWhenInsert" resultType="int">
+    select count(1) from sale where sa_code = #{code} and companyid = #{companyId}
   </select>
   <select id="validateCodeWhenUpdate" resultType="int" >
-    select count(1) from sale where sa_code = #{code} and sa_id != #{id}
+    select count(1) from sale where sa_code = #{code} and sa_id != #{id} and companyid = #{companyId}
   </select>
   <select id="selectCodeById" resultType="string" parameterType="long">
     select sa_code from sale where sa_id=#{id}

+ 1 - 1
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/po/ProdIODetail.java

@@ -59,7 +59,7 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private Long pd_orderid;
 
-    private Integer pd_sdid;
+    private Long pd_sdid;
 
     private Integer pd_status;
 

+ 3 - 1
frontend/saas-web/app/util/BaseUtil.js

@@ -29,13 +29,15 @@ Ext.define('saas.util.BaseUtil', {
                     if(res.success) {
                         return resolve(response);
                     }else {
+                        Ext.toast(res.message || '请求错误');
                         console.error('server request failure with code ' + res.code + '.');
                         console.error('failure message: ' + res.message);
                         return reject(response);
                     }
                 },
                 failure: function (response, opts) {
-                    console.error('server-side failure with status code ' + response.status);
+                    Ext.toast('请求错误');
+                    console.error('server-side failure with status code ' + response);
                     return reject(response);
                 }
             });

+ 88 - 0
frontend/saas-web/app/view/core/query/MoreQueryWin.js

@@ -0,0 +1,88 @@
+/**
+ * Created by zhouy on 2018/10/25.
+ */
+Ext.define('saas.view.core.query.MoreQueryWin', {
+    extend: 'Ext.window.Window',
+    xtype: 'core-query-morequeryform',
+    modal: true,
+    height: '50%',
+    width: '50%',
+    title: '更多查询',
+    scrollable: true,
+    bodyPadding: 10,
+    constrain: true,
+    closable: true,
+    layout: 'fit',
+    items: [{
+        xtype: 'form',
+        layout: 'column',
+        autoScroll: true,
+        buttonAlign : 'center',
+        bodyPadding: 5,
+        //frame:true,
+        defaults: {
+            xtype:'textfield',
+            margin: '0 5 5 0',
+            labelAlign: 'right',
+            labelWidth: 90,
+            columnWidth: 0.5,
+            blankText: '该字段不能为空'
+        },
+        // items:me.queryItems,
+        buttons: [{
+           text:'重置',
+           handler:'onReSetClick'
+        },'->',{
+            text: '查询',
+            handler:'onMoreQuery'
+        }, {
+            text: '关闭',
+            handler:'onCloseClick'
+        }]
+    }],
+    initComponent:function(){
+        var me=this;
+        me.setFormItems();
+        me.callParent();
+    },
+    setFormItems:function() {
+        var me = this,
+        queryViewModel = me.queryViewModel,
+        form = me.items[0],
+        items = me.queryItems;
+
+        Ext.Array.each(items, function(item) {
+            var bind = item.bind,
+            name = item.name,
+            ignore = item.ignore,
+            defaultValue = item.defaultValue;
+            
+            // 设置model绑定
+            if(!ignore) {
+                if(bind) {
+                    if(!Ext.isString(bind)) {
+                        bind = name;
+                        Ext.apply(bind, {
+                            value: '{moreForm.' + bind + '}'
+                        });
+                    }else {
+                        bind = name;
+                        item.bind = '{moreForm.' + bind + '}';
+                    }
+                }else {
+                    bind = name;
+                    item.bind = '{moreForm.' + bind + '}';
+                }
+                // 设置默认值
+                if(defaultValue) {
+                    queryViewModel.set('moreForm.' + bind, defaultValue);
+                }
+            }
+        });
+
+        Ext.apply(form, {
+            items: items
+        });
+    }
+
+});

+ 12 - 3
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -52,7 +52,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 listeners: {
                     beforeload: function (store, op) {
                         var queryPanel = me.up('core-query-querypanel'),
-                        condition = queryPanel.getConditions(),
+                        viewModel = queryPanel.getViewModel(),
+                        moreQuery = viewModel.get('moreQuery'),
+                        condition = queryPanel.getConditions(moreQuery),
                         defaultCondition = me.defaultCondition,
                         mode = queryPanel.getQueryMode();
 
@@ -70,8 +72,15 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                         });
     
                     },
-                    requestexception: function() {
-                        debugger;
+                    load: function(store, records, successful, operation, eOpts) {
+                        var queryPanel = me.up('core-query-querypanel'),
+                        mode = queryPanel.getQueryMode();
+                        
+                        if(mode=="MAIN"){
+                            me.reconfigure(store, me.baseColumn);
+                        }else{
+                            me.reconfigure(store, me.relativeColumn);
+                        }
                     }
                 }
             }),

+ 65 - 33
frontend/saas-web/app/view/core/query/QueryPanel.js

@@ -57,10 +57,6 @@ Ext.define('saas.view.core.query.QueryPanel', {
             ignore = item.ignore,
             defaultValue = item.defaultValue;
 
-            if(!item.columnWidth){
-                item.columnWidth = 0.25;
-            }
-
             // 设置model绑定
             if(!ignore) {
                 if(bind) {
@@ -97,46 +93,83 @@ Ext.define('saas.view.core.query.QueryPanel', {
     /**
      * 获得过滤条件
      */
-    getConditions: function() {
+    getConditions: function(moreQuery) {
         var me = this,
         formItems = me.queryFormItems,
+        moreQueryFormItems = me.moreQueryFormItems,
         viewModel = me.getViewModel(),
         viewModelData = viewModel.getData(),
         bindItems = viewModelData['form'],
+        moreItems = viewModelData['moreForm'],
         condition,
         conditions = [];
 
-        for(k in bindItems) {
-            var item = Ext.Array.findBy(formItems, function(i) {
-                return i.name == k;
-            });
-            var field = item.name,
-            func = item.getCondition,
-            value = bindItems[k],
-            condition;
-
-            if(typeof func == 'function') {
-                condition = {
-                    type: 'condition',
-                    value: func(value)
-                }
-            }else {
-                var xtype = item.xtype || 'textfield',
-                type = item.fieldType || me.getDefaultFieldType(xtype),
-                operation = item.operation || me.getDefaultFieldOperation(xtype),
-                conditionValue = me.getConditionValue(xtype, value);
+        if(moreQuery) {
+            for(k in moreItems) {
+                var item = Ext.Array.findBy(moreQueryFormItems, function(i) {
+                    return i.name == k;
+                });
+                var field = item.name,
+                func = item.getCondition,
+                value = moreItems[k],
+                condition;
     
-                if(!conditionValue) {
-                    continue;
+                if(typeof func == 'function') {
+                    condition = {
+                        type: 'condition',
+                        value: func(value)
+                    }
+                }else {
+                    var xtype = item.xtype || 'textfield',
+                    type = item.fieldType || me.getDefaultFieldType(xtype),
+                    operation = item.operation || me.getDefaultFieldOperation(xtype),
+                    conditionValue = me.getConditionValue(xtype, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
                 }
-                condition = {
-                    type: type,
-                    field: field,
-                    operation: operation,
-                    value: conditionValue
+                conditions.push(condition);
+            }
+        }else {
+            for(k in bindItems) {
+                var item = Ext.Array.findBy(formItems, function(i) {
+                    return i.name == k;
+                });
+                var field = item.name,
+                func = item.getCondition,
+                value = bindItems[k],
+                condition;
+    
+                if(typeof func == 'function') {
+                    condition = {
+                        type: 'condition',
+                        value: func(value)
+                    }
+                }else {
+                    var xtype = item.xtype || 'textfield',
+                    type = item.fieldType || me.getDefaultFieldType(xtype),
+                    operation = item.operation || me.getDefaultFieldOperation(xtype),
+                    conditionValue = me.getConditionValue(xtype, value);
+        
+                    if(!conditionValue) {
+                        continue;
+                    }
+                    condition = {
+                        type: type,
+                        field: field,
+                        operation: operation,
+                        value: conditionValue
+                    }
                 }
+                conditions.push(condition);
             }
-            conditions.push(condition);
         }
 
         return conditions;
@@ -242,5 +275,4 @@ Ext.define('saas.view.core.query.QueryPanel', {
 
         return detailModel ? 'DETAIL' : 'MAIN';
     }
-
 });

+ 28 - 23
frontend/saas-web/app/view/core/query/QueryPanelController.js

@@ -1,36 +1,41 @@
 Ext.define('saas.view.core.query.QueryPanelController', {
     extend: 'Ext.app.ViewController',
     alias: 'controller.core-query-querypanel',
-
     moreQuery: function (btn) {
-        var me = this;
-        var panel = me.getView();
-        var win = Ext.getCmp('queryMoreWin');
-        if (!win) {
-            win = Ext.create('Ext.window.Window', {
-                modal: true,
-                height: '50%',
-                width: '50%',
-                title: '更多查询',
-                scrollable: true,
-                bodyPadding: 10,
-                constrain: true,
-                closable: true,
-                layout: 'fit',
-                renderTo: Ext.getCmp('main-tab-panel').getActiveTab().getEl(),
-                items: [{
-                    xtype: 'core-query-morequeryformpanel',
-                    items: panel.moreQueryFormItems
-                }]
-            });
-        };
-        win.show();
+        var me = this,view= me.getView(),
+        viewModel = me.getViewModel();
+        this.queryWin = view.add({
+            xtype:'core-query-morequeryform',
+            queryItems: view.moreQueryFormItems,
+            queryController: me,
+            queryPanel: view,
+            queryViewModel: viewModel
+        });
+        this.queryWin.show();
     },
     onQuery: function (btn) {
         var me = this,
         queryPanel = me.getView(),
+        viewModel = me.getViewModel(),
         queryGrid = queryPanel.down('core-query-querygridpanel');
 
+        viewModel.set('moreQuery', false);
         queryGrid.store.loadPage(1);
+    },
+    onMoreQuery: function() {
+        var me = this,
+        queryPanel = me.getView(),
+        viewModel = me.getViewModel(),
+        queryGrid = queryPanel.down('core-query-querygridpanel');
+
+        me.queryWin.hide();
+        viewModel.set('moreQuery', true);
+        queryGrid.store.loadPage(1);
+    },
+    onReSetClick:function(btn){
+        btn.ownerCt.ownerCt.reset();
+    },
+    onCloseClick:function(btn){
+        this.queryWin = Ext.destroy(this.queryWin);
     }
 });

+ 7 - 4
frontend/saas-web/app/view/money/recBalance/FormPanel.js

@@ -30,26 +30,29 @@ Ext.define('saas.view.money.recBalance.FormPanel', {
         fieldLabel: 'id'
     }, {
         xtype: 'hidden',
-        name: 'custid',
+        name: 'rb_custid',
         fieldLabel: '客户ID'
     }, {
         xtype: 'hidden',
-        name: 'custcode',
+        name: 'rb_custcode',
         fieldLabel: '客户编号'
     }, {
         xtype: "dbfindtrigger",
         name: "rb_custname",
-        fieldLabel: "客户名称"
+        fieldLabel: "客户名称",
+        dataUrl: '',
     }, {
         xtype: "numberfield",
         name: "rb_rbdamount",
+        readOnly: true,
+        editable: false,
         fieldLabel: "总欠款"
     }, {
         xtype: "datefield",
         name: "rb_date",
         fieldLabel: "日期"
     }, {
-        xtype: "dbfindtrigger",
+        xtype: "textfield",
         name: "rb_manname",
         fieldLabel: "收款人"
     }, {

+ 20 - 61
frontend/saas-web/app/view/money/recBalance/FormPanelController.js

@@ -5,29 +5,37 @@ Ext.define('saas.view.money.recBalance.FormPanelController', {
     init: function (form) {
         var me = this;
         this.control({
-            /**放大镜新增demo*/
-            "field[name=combo]":{
-                beforerender:function(f){
-                    f.addHandler=me.addCombo;
-                }
-            },
-            //放大镜赋值关系 以及 tpl模板
-            'dbfindtrigger[name=pu_vendcode]':{
+            'dbfindtrigger[name=rb_custname]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
+                        //数据接口
+                        dataUrl: 'http://192.168.253.41:9480/vendor/getVendorsByCondition',
+                        //赋值 
                         dbfinds:[{
-                            from:'ve_code',to:'pu_vendcode'
+                            from: 've_id', to: 'rb_custid'
+                        }, {
+                            from:'ve_code', to:'rb_custcode'
                         },{
-                            from:'ve_name',to:'pu_vendname'
+                            from:'ve_name', to:'rb_custname'
                         }],
+                        //联想设置
                         dbtpls:[{
                             field:'ve_code',width:100
                         },{
                             field:'ve_name',width:100
                         }],
+                        //联想查询条件
+                        dbCondition:"CONCAT(ve_code, ve_name) like '{0}%'",
+                        //放大镜窗口字段
+                        dbSearchFields:[{
+                            xtype : "textfield", 
+                            name : "ve_name", 
+                            conditionExpression:"ve_name like '{0}%'",//传入后台条件  替换占位符
+                            fieldLabel : "供应商名称", 
+                            columnWidth : 0.25
+                        }],
+                        //放大镜窗口列表
                         dbColumns:[{
-                            conditionCode:'ve_id',
                             "text": "供应商ID",
                             "flex": 0,
                             "dataIndex": "ve_id",
@@ -35,7 +43,6 @@ Ext.define('saas.view.money.recBalance.FormPanelController', {
                             "xtype": "",
                             "items": null
                         },{
-                            conditionCode:'ve_code',
                             "text": "供应商编号",
                             "flex": 1,
                             "dataIndex": "ve_code",
@@ -43,14 +50,12 @@ Ext.define('saas.view.money.recBalance.FormPanelController', {
                             "xtype": "",
                             "items": null
                         }, {
-                            conditionCode:'ve_name',
                             "text": "供应商名称",
                             "flex": 1,
                             "dataIndex": "ve_name",
                             "xtype": "",
                             "items": null
                         }, {
-                            conditionCode:'ve_type',
                             "text": "供应商类型",
                             "flex": 0,
                             "dataIndex": "ve_type",
@@ -62,52 +67,6 @@ Ext.define('saas.view.money.recBalance.FormPanelController', {
 
                 }
             },
-            //放大镜赋值关系 以及 tpl模板
-            'dbfindtrigger[name=pd_prodcode]':{
-                beforerender:function(f){
-                    Ext.apply(f,{
-                        conditionCode:'pr_code',
-                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
-                        dbfinds:[{
-                            from:'pr_code',to:'pd_prodcode'
-                        }],
-                        dbtpls:[{
-                            field:'pr_code',width:100
-                        },{
-                            field:'pr_detail',width:100
-                        }],
-                        dbColumns:[{
-                            "text": "物料ID",
-                            "flex": 0,
-                            "dataIndex": "pr_id",
-                            "width": 0,
-                            "xtype": "",
-                            "items": null
-                        },{
-                            "text": "物料编号",
-                            "flex": 1,
-                            "dataIndex": "pr_code",
-                            "width": 100,
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            "text": "物料名称",
-                            "flex": 1,
-                            "dataIndex": "pr_detail",
-                            "xtype": "",
-                            "items": null
-                        }, {
-                            "text": "物料规格",
-                            "flex": 0,
-                            "dataIndex": "pr_spec",
-                            "width": 200,
-                            "xtype": "",
-                            "items": null
-                        }]
-                    }) ;   
-
-                }
-            }
         });
 
     },

+ 9 - 30
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -14,8 +14,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
      _codeField: 'pu_code',
      _statusField: 'pu_status',
      _statusCodeField: 'pu_statuscode',
-     
      _relationColumn: 'pd_puid',
+
      _readUrl:basePath+'purchase/purchase/read/',
      _saveUrl:basePath+'purchase/purchase/save',
      _auditUrl:basePath+'purchase/purchase/audit',
@@ -33,45 +33,24 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
     defaultItems: [{
         xtype: 'hidden',
         name: 'id',
-        bind: '{id}',
         fieldLabel: 'id',
-        allowBlank: true,
         columnWidth: 0
-    }, {
-        xtype : "textfield", 
-        name : "pu_code", 
-        bind : "{pu_code}", 
-        fieldLabel : "采购单号", 
-        allowBlank : true, 
-        columnWidth : 0.25
     }, {
         xtype : "hidden", 
         name : "pu_vendid", 
-        bind : "{pu_vendid}", 
-        fieldLabel : "供应商ID", 
-        allowBlank : true, 
-        columnWidth : 0.0
+        fieldLabel : "供应商ID"
     }, {
-        xtype : "dbfindtrigger", 
+        xtype : "hidden", 
         name : "pu_vendcode", 
-        bind : "{pu_vendcode}", 
-        fieldLabel : "供应商编号", 
-        allowBlank : true, 
-        columnWidth : 0.25, 
+        fieldLabel : "供应商编号"
     }, {
-        xtype : "textfield", 
+        xtype : "dbfindtrigger", 
         name : "pu_vendname", 
-        bind : "{pu_vendname}", 
-        fieldLabel : "供应商名称", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        fieldLabel : "供应商名称"
     },{
-        xtype : "datefield", 
-        name : "pu_date", 
-        bind : "{pu_date}", 
-        fieldLabel : "采购日期", 
-        allowBlank : false, 
-        columnWidth : 0.25
+        xtype : "hidden", 
+        name : "pu_delivery", 
+        fieldLabel : "交货日期"
     }, {
         xtype : "hidden", 
         name : "pu_buyerid", 

+ 3 - 3
frontend/saas-web/app/view/purchase/purchase/FormPanelController.js

@@ -9,7 +9,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/vendor/getVendorsByCondition',
+                        dataUrl:basePath+'document/vendor/getVendorsByCondition',
                         //赋值 
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
@@ -70,7 +70,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/product/getProductsByCondition',
+                        dataUrl:basePath+'document/product/getProductsByCondition',
                         //放大镜赋值设置
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'
@@ -132,7 +132,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         //数据接口
-                        dataUrl:'http://192.168.253.41:9480/product/getProductsByCondition',
+                        dataUrl:'http://192.168.253.31:9480/product/getProductsByCondition',
                         //放大镜赋值设置
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'

+ 0 - 11
frontend/saas-web/app/view/purchase/purchase/QueryPanel.js

@@ -87,17 +87,14 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
     moreQueryFormItems: [{
         xtype: 'textfield',
         name: 'pu_buyername',
-        bind: '{pu_buyername}',
         fieldLabel: '采购员'
     }, {
         xtype: 'textfield',
         name: 'pu_total',
-        bind: '{pu_total}',
         fieldLabel: '金额'
     }, {
         xtype: 'condatefield',
         name: 'pu_delivery',
-        bind: '{pu_delivery}',
         fieldLabel: '交货日期',
         columnWidth: 1
     }],
@@ -109,10 +106,6 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
         defaultCondition:'',
         baseVastUrl: basePath+'purchase/purchase/',
         baseColumn: [{
-            text: '序号',
-            width: 80,
-            xtype: 'rownumberer'
-        }, {
             text: 'id',
             dataIndex: 'pu_id',
             width: 100,
@@ -147,10 +140,6 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
             flex: 1
         }],
         relativeColumn: [{
-            text: '序号',
-            width: 80,
-            xtype: 'rownumberer'
-        }, {
             text: 'id',
             dataIndex: 'pu_id',
             width: 100,