Sfoglia il codice sorgente

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

chenw 7 anni fa
parent
commit
bcdc5c4c7d
100 ha cambiato i file con 3928 aggiunte e 408 eliminazioni
  1. 3 2
      README.md
  2. 4 4
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MaxnumberService.java
  3. 8 8
      applications/commons/commons-api/src/main/java/com/usoftchina/saas/commons/api/MessageLogService.java
  4. 3 1
      applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java
  5. 0 19
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonsController.java
  6. 4 9
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java
  7. 2 0
      applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java
  8. 2 2
      applications/commons/commons-server/src/main/resources/application.yml
  9. 4 0
      applications/document/document-dto/pom.xml
  10. 64 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerDTO.java
  11. 19 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerFormDTO.java
  12. 33 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomeraddressDTO.java
  13. 33 0
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomercontactDTO.java
  14. 61 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java
  15. 112 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/CustomerList.java
  16. 32 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customeraddress.java
  17. 32 0
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customercontact.java
  18. 0 2
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/AddressController.java
  19. 75 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java
  20. 11 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerListMapper.java
  21. 18 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerMapper.java
  22. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomeraddressMapper.java
  23. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomercontactMapper.java
  24. 25 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java
  25. 111 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java
  26. 5 6
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/ProductbrandServiceImpl.java
  27. 55 0
      applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml
  28. 377 0
      applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml
  29. 245 0
      applications/document/document-server/src/main/resources/mapper/CustomeraddressMapper.xml
  30. 222 0
      applications/document/document-server/src/main/resources/mapper/CustomercontactMapper.xml
  31. 0 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseListMapper.java
  32. 2 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdIODetail.java
  33. 3 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  34. 1 1
      applications/purchase/purchase-server/src/main/resources/application.yml
  35. 0 82
      applications/sale/pom.xml
  36. 10 1
      applications/sale/sale-dto/pom.xml
  37. 85 2
      applications/sale/sale-server/pom.xml
  38. 1 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/controller/SaleController.java
  39. 32 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java
  40. 24 0
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java
  41. 1 20
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaledetailMapper.java
  42. 3 1
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleDetail.java
  43. 79 75
      applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java
  44. 3 3
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/entities/ProdIODetail.java
  45. 1 1
      applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/entities/ProdInOut.java
  46. 11 1
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyDTO.java
  47. 65 0
      base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyRegDTO.java
  48. 41 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java
  49. 18 5
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/CompanyController.java
  50. 16 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountMapper.java
  51. 9 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Account.java
  52. 14 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/AccountService.java
  53. 16 0
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java
  54. 1 1
      base-servers/account/account-server/src/main/resources/mapper/AccountCompanyMapper.xml
  55. 17 4
      base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml
  56. 118 0
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/AccountControllerTest.java
  57. 75 0
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/CompanyControllerTest.java
  58. 8 8
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/AccountServiceTest.java
  59. 4 6
      base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/CompanyServiceTest.java
  60. 22 0
      framework/core/src/main/java/com/usoftchina/saas/base/Result.java
  61. 1 0
      framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java
  62. 12 0
      framework/core/src/main/java/com/usoftchina/saas/utils/JsonUtils.java
  63. 17 1
      framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java
  64. 22 0
      framework/test-starter/pom.xml
  65. 118 0
      framework/test-starter/src/main/java/com.usoftchina.saas.test/BaseControllerTest.java
  66. 16 0
      framework/test-starter/src/main/java/com.usoftchina.saas.test/TestConstant.java
  67. 3 3
      framework/test-starter/src/main/java/com.usoftchina.saas.test/TestContextListener.java
  68. 1 1
      framework/test-starter/src/main/resources/META-INF/spring.factories
  69. 27 33
      frontend/saas-web/app/util/FormUtil.js
  70. 47 0
      frontend/saas-web/app/view/core/baseform/FormPanel.js
  71. 168 0
      frontend/saas-web/app/view/core/baseform/FormPanelController.js
  72. 4 0
      frontend/saas-web/app/view/core/baseform/FormPanelModel.js
  73. 145 0
      frontend/saas-web/app/view/core/baseform/GridPanel.js
  74. 1 3
      frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js
  75. 1 2
      frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js
  76. 31 23
      frontend/saas-web/app/view/core/form/FormPanel.js
  77. 58 23
      frontend/saas-web/app/view/core/form/FormPanelController.js
  78. 4 2
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  79. 7 9
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  80. 7 1
      frontend/saas-web/app/view/core/query/QueryGridPanel.js
  81. 7 3
      frontend/saas-web/app/view/core/tab/Controller.js
  82. 124 0
      frontend/saas-web/app/view/document/customer/FormPanel.js
  83. 11 0
      frontend/saas-web/app/view/document/customer/FormPanelController.js
  84. 4 0
      frontend/saas-web/app/view/document/customer/FormPanelModel.js
  85. 3 3
      frontend/saas-web/app/view/document/kind/ChildForm.js
  86. 5 12
      frontend/saas-web/app/view/document/kind/Kind.js
  87. 8 5
      frontend/saas-web/app/view/document/kind/KindModel.js
  88. 124 0
      frontend/saas-web/app/view/document/vendor/FormPanel.js
  89. 11 0
      frontend/saas-web/app/view/document/vendor/FormPanelController.js
  90. 4 0
      frontend/saas-web/app/view/document/vendor/FormPanelModel.js
  91. 153 0
      frontend/saas-web/app/view/money/payBalance/FormPanel.js
  92. 158 0
      frontend/saas-web/app/view/money/payBalance/FormPanelController.js
  93. 5 0
      frontend/saas-web/app/view/money/payBalance/FormPanelModel.js
  94. 196 0
      frontend/saas-web/app/view/money/payBalance/QueryPanel.js
  95. 117 0
      frontend/saas-web/app/view/money/payBalance/QueryPanelController.js
  96. 5 0
      frontend/saas-web/app/view/money/payBalance/QueryPanelModel.js
  97. 8 7
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  98. 2 2
      frontend/saas-web/app/view/purchase/purchase/FormPanelController.js
  99. 1 1
      frontend/saas-web/app/view/purchase/purchase/QueryPanel.js
  100. 2 2
      frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js

+ 3 - 2
README.md

@@ -1,4 +1,4 @@
-# 项目结构:
+# 项目结构
 
 ```
 ├─saas-platform
@@ -66,7 +66,7 @@
 │  │
 ```
 
-# 开发环境
+# 开发环境
 
 > 数据库
 
@@ -82,6 +82,7 @@
 | 类型 | 地址 | 账号 | 密码 | 说明 |
 | ---- | :----: | :----: | :----: | ---- |
 | rabbitmq | 192.168.0.176:5672 | saas | select123*** | 消息中间件 [控制台](http://192.168.0.176:15672)|
+| redis | 192.168.253.12:6379 | | | 内存数据库 |
 
 
 > 服务器

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

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

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

@@ -13,27 +13,27 @@ import org.springframework.web.bind.annotation.RequestMapping;
 @FeignClient("commons-server")
 public interface MessageLogService {
 
-    @RequestMapping("/save")
+    @RequestMapping("/api/commons/messagelog/save")
     public void save(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/update")
+    @RequestMapping("/api/commons/messagelog/update")
     public void update(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/delete")
+    @RequestMapping("/api/commons/messagelog/delete")
     public void delete(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/deleteDetail")
+    @RequestMapping("/api/commons/messagelog/deleteDetail")
     public void deleteDetail(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/audit")
+    @RequestMapping("/api/commons/messagelog/audit")
     public void audit(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/unAudit")
+    @RequestMapping("/api/commons/messagelog/unAudit")
     public void unAudit(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/close")
+    @RequestMapping("/api/commons/messagelog/close")
     public void close(@RequestBody DocBaseDTO baseDTO);
 
-    @RequestMapping("/open")
+    @RequestMapping("/api/commons/messagelog/open")
     public void open(@RequestBody DocBaseDTO baseDTO);
 }

+ 3 - 1
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/exception/BizExceptionCode.java

@@ -26,7 +26,9 @@ public enum BizExceptionCode implements BaseExceptionCode {
     //采购
 
     //销售
-
+    SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),
+    SALE_CLOSE(72001, "单据已关闭,无法进行操作"),
+    SALE_YQTYBEYONDQTY(72001, "明细行已转数量大于数量");
     //资金
 
     //库存

+ 0 - 19
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/CommonsController.java

@@ -1,19 +0,0 @@
-package com.usoftchina.saas.commons.controller;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author: guq
- * @create: 2018-10-18 15:53
- **/
-@RestController
-@RequestMapping("/commons")
-public class CommonsController {
-
-    @RequestMapping("/test")
-    public String test() {
-        return "TEST";
-    }
-
-}

+ 4 - 9
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MaxnumberController.java

@@ -10,9 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @author: guq
  * @create: 2018-10-18 17:40
@@ -25,15 +22,13 @@ public class MaxnumberController {
     private MaxnumberService maxnumberService;
 
     @PostMapping("/getMaxnumber")
-    public Result getMaxnumber(String caller, boolean update) {
-        Map<String, Object> code = new HashMap<>();
-        code.put("code",  maxnumberService.getMaxnumner(caller, update));
-        return Result.success(code);
+    public Result<String> getMaxnumber(String caller, boolean update) {
+        return Result.success(maxnumberService.getMaxnumner(caller, update));
     }
 
     @PostMapping("/pushMaxnubmer")
-    public String pushMaxnubmer(@RequestParam("count") Integer count, @RequestParam("code") String code,
+    public Result<String> pushMaxnubmer(@RequestParam("count") Integer count, @RequestParam("code") String code,
                                 @RequestParam("caller") String caller) {
-        return maxnumberService.pushMaxnubmer(count, code, caller);
+        return Result.success(maxnumberService.pushMaxnubmer(count, code, caller));
     }
 }

+ 2 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/MessageLogController.java

@@ -5,12 +5,14 @@ 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.RestController;
 
 /**
  * @author: guq
  * @create: 2018-10-20 11:46
  **/
 @RequestMapping("/messagelog")
+@RestController
 public class MessageLogController {
 
     @Autowired

+ 2 - 2
applications/commons/commons-server/src/main/resources/application.yml

@@ -23,8 +23,8 @@ spring:
     host: 192.168.0.176
     port: 5672
     virtual-host: dev
-    password: saas
-    username: select123***
+    username: saas
+    password: select123***
   zipkin:
     sender:
       type: rabbit

+ 4 - 0
applications/document/document-dto/pom.xml

@@ -22,6 +22,10 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 64 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerDTO.java

@@ -0,0 +1,64 @@
+package com.usoftchina.saas.document.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Created by zdw
+ * 2018-10-23 17:21.
+ */
+@Data
+public class CustomerDTO extends CommonBaseEntity implements Serializable {
+    private String cu_code;
+
+    private String cu_name;
+
+    private String cu_uu;
+
+    private String cu_type;
+
+    private Date cu_begindate;
+
+    private Double cu_beginaramount;
+
+    private Double cu_beginprerecamount;
+
+    private Double cu_promisedays;
+
+    private Double cu_taxrate;
+
+    private Integer cu_sellerid;
+
+    private String cu_sellercode;
+
+    private String cu_sellername;
+
+    private Double cu_credit;
+
+    private String cu_status;
+
+    private String cu_statuscode;
+
+    private Integer cu_recordmanid;
+
+    private String cu_recordman;
+
+    private Date cu_recorddate;
+
+    private String cu_text1;
+
+    private String cu_text2;
+
+    private String cu_text3;
+
+    private String cu_text4;
+
+    private String cu_text5;
+
+    private Double cu_leftamount;
+
+    private Double cu_recamount;
+}

+ 19 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomerFormDTO.java

@@ -0,0 +1,19 @@
+package com.usoftchina.saas.document.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by zdw
+ * 2018-10-23 17:26.
+ */
+@Data
+public class CustomerFormDTO implements Serializable {
+
+    private CustomerDTO main;
+    private List<CustomercontactDTO> items1;
+    private List<CustomeraddressDTO> items2;
+
+}

+ 33 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomeraddressDTO.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.document.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CustomeraddressDTO extends CommonBaseEntity implements Serializable {
+
+    private Long ca_cuid;
+
+    private Integer ca_detno;
+
+    private String ca_person;
+
+    private Integer ca_phone;
+
+    private Integer ca_default;
+
+    private String ca_text1;
+
+    private String ca_text2;
+
+    private String ca_text3;
+
+    private String ca_text4;
+
+    private String ca_text5;
+
+    private String ca_address;
+
+}

+ 33 - 0
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CustomercontactDTO.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.document.dto;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class CustomercontactDTO extends CommonBaseEntity implements Serializable {
+
+    private Long cc_cuid;
+
+    private Integer cc_detno;
+
+    private String cc_name;
+
+    private Integer cc_tel;
+
+    private String cc_qq;
+
+    private String cc_email;
+
+    private String cc_text1;
+
+    private String cc_text2;
+
+    private String cc_text3;
+
+    private String cc_text4;
+
+    private String cc_text5;
+
+}

+ 61 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customer.java

@@ -0,0 +1,61 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+@Data
+public class Customer extends CommonBaseEntity implements Serializable {
+
+    private String cu_code;
+
+    private String cu_name;
+
+    private String cu_uu;
+
+    private String cu_type;
+
+    private Date cu_begindate;
+
+    private Double cu_beginaramount;
+
+    private Double cu_beginprerecamount;
+
+    private Double cu_promisedays;
+
+    private Double cu_taxrate;
+
+    private Integer cu_sellerid;
+
+    private String cu_sellercode;
+
+    private String cu_sellername;
+
+    private Double cu_credit;
+
+    private String cu_status;
+
+    private String cu_statuscode;
+
+    private Integer cu_recordmanid;
+
+    private String cu_recordman;
+
+    private Date cu_recorddate;
+
+    private String cu_text1;
+
+    private String cu_text2;
+
+    private String cu_text3;
+
+    private String cu_text4;
+
+    private String cu_text5;
+
+    private Double cu_leftamount;
+
+    private Double cu_recamount;
+
+}

+ 112 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/CustomerList.java

@@ -0,0 +1,112 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Created by zdw
+ * 2018-10-23 15:35.
+ */
+
+@Data
+public class CustomerList extends CommonBaseEntity{
+//customer
+    private String cu_code;
+
+    private String cu_name;
+
+    private String cu_uu;
+
+    private String cu_type;
+
+    private Date cu_begindate;
+
+    private Double cu_beginaramount;
+
+    private Double cu_beginprerecamount;
+
+    private Double cu_promisedays;
+
+    private Double cu_taxrate;
+
+    private Integer cu_sellerid;
+
+    private String cu_sellercode;
+
+    private String cu_sellername;
+
+    private Double cu_credit;
+
+    private String cu_status;
+
+    private String cu_statuscode;
+
+    private Integer cu_recordmanid;
+
+    private String cu_recordman;
+
+    private Date cu_recorddate;
+
+    private String cu_text1;
+
+    private String cu_text2;
+
+    private String cu_text3;
+
+    private String cu_text4;
+
+    private String cu_text5;
+
+    private Double cu_leftamount;
+
+    private Double cu_recamount;
+//customeraddress
+
+    private Long ca_cuid;
+
+    private Integer ca_detno;
+
+    private String ca_person;
+
+    private Integer ca_phone;
+
+    private Integer ca_default;
+
+    private String ca_text1;
+
+    private String ca_text2;
+
+    private String ca_text3;
+
+    private String ca_text4;
+
+    private String ca_text5;
+
+    private String ca_address;
+//    CustomercontactDTO
+
+    private Long cc_cuid;
+
+    private Integer cc_detno;
+
+    private String cc_name;
+
+    private Integer cc_tel;
+
+    private String cc_qq;
+
+    private String cc_email;
+
+    private String cc_text1;
+
+    private String cc_text2;
+
+    private String cc_text3;
+
+    private String cc_text4;
+
+    private String cc_text5;
+
+}

+ 32 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customeraddress.java

@@ -0,0 +1,32 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+@Data
+public class Customeraddress extends CommonBaseEntity implements Serializable {
+
+    private Long ca_cuid;
+
+    private Integer ca_detno;
+
+    private String ca_person;
+
+    private Integer ca_phone;
+
+    private Integer ca_default;
+
+    private String ca_text1;
+
+    private String ca_text2;
+
+    private String ca_text3;
+
+    private String ca_text4;
+
+    private String ca_text5;
+
+    private String ca_address;
+
+}

+ 32 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Customercontact.java

@@ -0,0 +1,32 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+@Data
+public class Customercontact extends CommonBaseEntity implements Serializable {
+
+    private Long cc_cuid;
+
+    private Integer cc_detno;
+
+    private String cc_name;
+
+    private Integer cc_tel;
+
+    private String cc_qq;
+
+    private String cc_email;
+
+    private String cc_text1;
+
+    private String cc_text2;
+
+    private String cc_text3;
+
+    private String cc_text4;
+
+    private String cc_text5;
+
+}

+ 0 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/AddressController.java

@@ -1,7 +1,5 @@
 package com.usoftchina.saas.document.controller;
 
-
-import com.sun.org.apache.regexp.internal.RE;
 import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.document.entities.Address;
 import com.usoftchina.saas.document.service.AddressService;

+ 75 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CustomerController.java

@@ -1,9 +1,84 @@
 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.ListReqDTO;
+import com.usoftchina.saas.document.dto.CustomerFormDTO;
+import com.usoftchina.saas.document.entities.CustomerList;
+import com.usoftchina.saas.document.service.CustomerService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
 /**
  * Created by zdw
  * 2018-10-23 11:39.
  */
 
+@RestController
+@RequestMapping("/customer")
 public class CustomerController {
+
+    @Autowired
+    private CustomerService customerService;
+
+    /**
+     * 客户资料列表
+     *
+     * @param page
+     * @param req
+     * @return
+     */
+    @GetMapping("/list")
+    public Result<PageInfo<CustomerList>> getListData(PageRequest page, ListReqDTO req) {
+        PageInfo<CustomerList> listData = customerService.getListData(page, req);
+        return Result.success(listData);
+    }
+
+    /**
+     * 获取客户资料表单
+     *
+     * @return
+     */
+    @GetMapping("/read/{id}")
+    public Result<CustomerFormDTO> getFormData(@PathVariable("id") Long id) {
+        CustomerFormDTO data = customerService.getFormData(id);
+        return Result.success(data);
+    }
+
+    /**
+     * 客户资料表单保存
+     *
+     * @param
+     * @return
+     */
+    @PostMapping("/save")
+    public Result<DocBaseDTO> saveFormData(@RequestBody CustomerFormDTO data) {
+        DocBaseDTO save = customerService.saveFormData(data);
+        return Result.success(save);
+    }
+
+    /**
+     * 客户资料删除
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/delete/{id}")
+    public Result delete(@PathVariable("id") Long id) {
+        customerService.delete(id);
+        return Result.success();
+    }
+
+
+
+
+
+
+
+
+
+
+
 }

+ 11 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerListMapper.java

@@ -0,0 +1,11 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.document.entities.CustomerList;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CustomerListMapper {
+    List<CustomerList> selectCustomerListByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+    List<CustomerList> selectCustomerBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+}

+ 18 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomerMapper.java

@@ -0,0 +1,18 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Customer;
+
+public interface CustomerMapper extends CommonBaseMapper<Customer> {
+    int deleteByPrimaryKey(Integer cu_id);
+
+    int insert(Customer record);
+
+    int insertSelective(Customer record);
+
+    Customer selectByPrimaryKey(Long cu_id);
+
+    int updateByPrimaryKeySelective(Customer record);
+
+    int updateByPrimaryKey(Customer record);
+}

+ 25 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomeraddressMapper.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Customer;
+import com.usoftchina.saas.document.entities.Customeraddress;
+
+import java.util.List;
+
+public interface CustomeraddressMapper extends CommonBaseMapper<Customer> {
+    int deleteByPrimaryKey(Integer ca_id);
+
+    int insert(Customeraddress record);
+
+    int insertSelective(Customeraddress record);
+
+    Customeraddress selectByPrimaryKey(Integer ca_id);
+
+    int updateByPrimaryKeySelective(Customeraddress record);
+
+    int updateByPrimaryKeyWithBLOBs(Customeraddress record);
+
+    int updateByPrimaryKey(Customeraddress record);
+
+    List<Customeraddress> selectByFK(Long fk_i);
+}

+ 25 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CustomercontactMapper.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.document.mapper;
+
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Customercontact;
+
+import java.util.List;
+
+public interface CustomercontactMapper extends CommonBaseMapper<Customercontact> {
+    int deleteByPrimaryKey(Integer cc_id);
+
+    int insert(Customercontact record);
+
+    int insertSelective(Customercontact record);
+
+    Customercontact selectByPrimaryKey(Integer cc_id);
+
+    int updateByPrimaryKeySelective(Customercontact record);
+
+    int updateByPrimaryKey(Customercontact record);
+
+    List<Customercontact> selectByFK(Long fk_i);
+
+
+}

+ 25 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CustomerService.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.document.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.document.dto.CustomerFormDTO;
+import com.usoftchina.saas.document.entities.Customer;
+import com.usoftchina.saas.document.entities.CustomerList;
+import com.usoftchina.saas.document.mapper.CustomerMapper;
+import com.usoftchina.saas.page.PageRequest;
+
+/**
+ * Created by zdw
+ * 2018-10-23 15:26.
+ */
+public interface CustomerService extends CommonBaseService<CustomerMapper, Customer> {
+    PageInfo<CustomerList> getListData(PageRequest page, ListReqDTO req);
+
+    CustomerFormDTO getFormData(Long id);
+
+    DocBaseDTO saveFormData(CustomerFormDTO data);
+
+    void delete(Long id);
+}

+ 111 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -0,0 +1,111 @@
+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.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.document.dto.CustomerDTO;
+import com.usoftchina.saas.document.dto.CustomerFormDTO;
+import com.usoftchina.saas.document.dto.CustomeraddressDTO;
+import com.usoftchina.saas.document.dto.CustomercontactDTO;
+import com.usoftchina.saas.document.entities.Customer;
+import com.usoftchina.saas.document.entities.CustomerList;
+import com.usoftchina.saas.document.entities.Customeraddress;
+import com.usoftchina.saas.document.entities.Customercontact;
+import com.usoftchina.saas.document.mapper.CustomerListMapper;
+import com.usoftchina.saas.document.mapper.CustomerMapper;
+import com.usoftchina.saas.document.mapper.CustomeraddressMapper;
+import com.usoftchina.saas.document.mapper.CustomercontactMapper;
+import com.usoftchina.saas.document.service.CustomerService;
+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 org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * Created by zdw
+ * 2018-10-23 15:29.
+ */
+@Service
+public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, Customer> implements CustomerService {
+
+    @Autowired
+    private CustomerListMapper customerListMapper;
+
+    @Autowired
+    private CustomercontactMapper customercontactMapper;
+
+    @Autowired
+    private CustomeraddressMapper customeraddressMapper;
+
+
+
+
+    @Override
+    public PageInfo<CustomerList> 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<CustomerList> lists = getListByMode(req);
+        //取分页信息
+        PageInfo<CustomerList> pageInfo = new PageInfo<CustomerList>(lists);
+        return pageInfo;
+    }
+
+    @Override
+    public CustomerFormDTO getFormData(Long id) {
+        if (null == id || "0".equals(id)) {
+            return null;
+        }
+        CustomerFormDTO customerFormDTO = new CustomerFormDTO();
+        //查询主表信息
+        Customer customer = getMapper().selectByPrimaryKey(id);
+
+        //将Customer实体对象转化成传输对象
+        CustomerDTO main = BeanMapper.map(customer, CustomerDTO.class);
+        //查询从表
+        List<Customercontact> customercontacts = customercontactMapper.selectByFK(id);
+        List<CustomercontactDTO> items1 = BeanMapper.mapList(customercontacts, CustomercontactDTO.class);
+        List<Customeraddress> customeraddresses = customeraddressMapper.selectByFK(id);
+        List<CustomeraddressDTO> items2 = BeanMapper.mapList(customeraddresses, CustomeraddressDTO.class);
+        customerFormDTO.setMain(main);
+        customerFormDTO.setItems1(items1);
+        customerFormDTO.setItems2(items2);
+        return customerFormDTO;
+    }
+
+    @Override
+    public DocBaseDTO saveFormData(CustomerFormDTO data) {
+        return null;
+    }
+
+    @Override
+    public void delete(Long id) {
+
+    }
+
+    private List<CustomerList> getListByMode(ListReqDTO req) {
+        List<CustomerList> 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 = customerListMapper.selectCustomerListByCondition(con, companyId);
+        } else {
+            list = customerListMapper.selectCustomerBycondition(con, companyId);
+        }
+        return list;
+    }
+}

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

@@ -1,7 +1,6 @@
 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;
@@ -15,8 +14,8 @@ public class ProductbrandServiceImpl extends CommonBaseServiceImpl<ProductbrandM
 
     @Autowired
     private ProductbrandMapper productbrandMapper;
-    @Autowired
-    private MessageLogService messageLogService;
+//    @Autowired
+//    private MessageLogService messageLogService;
 
     private final String LOG_NAME = "物料品牌";
 
@@ -27,12 +26,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;
     }
@@ -42,7 +41,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;
     }
 

+ 55 - 0
applications/document/document-server/src/main/resources/mapper/CustomerListMapper.xml

@@ -0,0 +1,55 @@
+<?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.document.mapper.CustomerListMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.CustomerList">
+    <id column="cc_id" jdbcType="INTEGER" property="id" />
+    <result column="cc_cuid" jdbcType="INTEGER" property="cc_cuid" />
+    <result column="cc_detno" jdbcType="INTEGER" property="cc_detno" />
+    <result column="cc_name" jdbcType="VARCHAR" property="cc_name" />
+    <result column="cc_tel" jdbcType="INTEGER" property="cc_tel" />
+    <result column="cc_qq" jdbcType="VARCHAR" property="cc_qq" />
+    <result column="cc_email" jdbcType="VARCHAR" property="cc_email" />
+    <result column="ca_cuid" jdbcType="INTEGER" property="ca_cuid" />
+    <result column="ca_detno" jdbcType="INTEGER" property="ca_detno" />
+    <result column="ca_person" jdbcType="VARCHAR" property="ca_person" />
+    <result column="ca_phone" jdbcType="INTEGER" property="ca_phone" />
+    <result column="ca_default" jdbcType="INTEGER" property="ca_default" />
+    <result column="cc_cuid" jdbcType="INTEGER" property="cc_cuid" />
+    <result column="cc_detno" jdbcType="INTEGER" property="cc_detno" />
+    <result column="cc_name" jdbcType="VARCHAR" property="cc_name" />
+    <result column="cc_tel" jdbcType="INTEGER" property="cc_tel" />
+    <result column="cc_qq" jdbcType="VARCHAR" property="cc_qq" />
+    <result column="cc_email" jdbcType="VARCHAR" property="cc_email" />
+
+  </resultMap>
+
+
+  <select id="selectCustomerListByCondition"  resultMap="BaseResultMap">
+    select  *  from customer left join customeraddress on cu_id=ca_cuid left join customercontact on cu_id = cc_cuid
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   companyid = #{companyId}
+      </if>
+    </where>  order by cu_id
+  </select>
+
+  <select id="selectCustomerBycondition"  resultMap="BaseResultMap">
+    select  *  from customer
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyid = #{companyId}
+      </if>
+    </where>
+    order by cu_id
+  </select>
+
+
+
+
+</mapper>

+ 377 - 0
applications/document/document-server/src/main/resources/mapper/CustomerMapper.xml

@@ -0,0 +1,377 @@
+<?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.document.mapper.CustomerMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Customer">
+    <id column="cu_id" jdbcType="INTEGER" property="id" />
+    <result column="cu_code" jdbcType="VARCHAR" property="cu_code" />
+    <result column="cu_name" jdbcType="VARCHAR" property="cu_name" />
+    <result column="cu_uu" jdbcType="VARCHAR" property="cu_uu" />
+    <result column="cu_type" jdbcType="VARCHAR" property="cu_type" />
+    <result column="cu_begindate" jdbcType="TIMESTAMP" property="cu_begindate" />
+    <result column="cu_beginaramount" jdbcType="DOUBLE" property="cu_beginaramount" />
+    <result column="cu_beginprerecamount" jdbcType="DOUBLE" property="cu_beginprerecamount" />
+    <result column="cu_promisedays" jdbcType="DOUBLE" property="cu_promisedays" />
+    <result column="cu_taxrate" jdbcType="DOUBLE" property="cu_taxrate" />
+    <result column="cu_sellerid" jdbcType="INTEGER" property="cu_sellerid" />
+    <result column="cu_sellercode" jdbcType="VARCHAR" property="cu_sellercode" />
+    <result column="cu_sellername" jdbcType="VARCHAR" property="cu_sellername" />
+    <result column="cu_credit" jdbcType="DOUBLE" property="cu_credit" />
+    <result column="cu_status" jdbcType="VARCHAR" property="cu_status" />
+    <result column="cu_statuscode" jdbcType="VARCHAR" property="cu_statuscode" />
+    <result column="cu_recordmanid" jdbcType="INTEGER" property="cu_recordmanid" />
+    <result column="cu_recordman" jdbcType="VARCHAR" property="cu_recordman" />
+    <result column="cu_recorddate" jdbcType="TIMESTAMP" property="cu_recorddate" />
+    <result column="companyid" jdbcType="INTEGER" property="companyId" />
+    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="cu_text1" jdbcType="VARCHAR" property="cu_text1" />
+    <result column="cu_text2" jdbcType="VARCHAR" property="cu_text2" />
+    <result column="cu_text3" jdbcType="VARCHAR" property="cu_text3" />
+    <result column="cu_text4" jdbcType="VARCHAR" property="cu_text4" />
+    <result column="cu_text5" jdbcType="VARCHAR" property="cu_text5" />
+    <result column="cu_leftamount" jdbcType="DOUBLE" property="cu_leftamount" />
+    <result column="cu_recamount" jdbcType="DOUBLE" property="cu_recamount" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    cu_id, cu_code, cu_name, cu_uu, cu_type, cu_begindate, cu_beginaramount, cu_beginprerecamount, 
+    cu_promisedays, cu_taxrate, cu_sellerid, cu_sellercode, cu_sellername, cu_credit, 
+    cu_status, cu_statuscode, cu_recordmanid, cu_recordman, cu_recorddate, companyid, 
+    updaterid, updatetime, cu_text1, cu_text2, cu_text3, cu_text4, cu_text5, cu_leftamount, 
+    cu_recamount
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from customer
+    where cu_id = #{cu_id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from customer
+    where cu_id = #{cu_id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Customer">
+    insert into customer (cu_id, cu_code, cu_name, 
+      cu_uu, cu_type, cu_begindate, 
+      cu_beginaramount, cu_beginprerecamount, cu_promisedays, 
+      cu_taxrate, cu_sellerid, cu_sellercode, 
+      cu_sellername, cu_credit, cu_status, 
+      cu_statuscode, cu_recordmanid, cu_recordman, 
+      cu_recorddate, companyid, updaterid, 
+      updatetime, cu_text1, cu_text2, 
+      cu_text3, cu_text4, cu_text5, 
+      cu_leftamount, cu_recamount)
+    values (#{cu_id,jdbcType=INTEGER}, #{cu_code,jdbcType=VARCHAR}, #{cu_name,jdbcType=VARCHAR}, 
+      #{cu_uu,jdbcType=VARCHAR}, #{cu_type,jdbcType=VARCHAR}, #{cu_begindate,jdbcType=TIMESTAMP}, 
+      #{cu_beginaramount,jdbcType=DOUBLE}, #{cu_beginprerecamount,jdbcType=DOUBLE}, #{cu_promisedays,jdbcType=DOUBLE}, 
+      #{cu_taxrate,jdbcType=DOUBLE}, #{cu_sellerid,jdbcType=INTEGER}, #{cu_sellercode,jdbcType=VARCHAR}, 
+      #{cu_sellername,jdbcType=VARCHAR}, #{cu_credit,jdbcType=DOUBLE}, #{cu_status,jdbcType=VARCHAR}, 
+      #{cu_statuscode,jdbcType=VARCHAR}, #{cu_recordmanid,jdbcType=INTEGER}, #{cu_recordman,jdbcType=VARCHAR}, 
+      #{cu_recorddate,jdbcType=TIMESTAMP}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
+      #{updatetime,jdbcType=TIMESTAMP}, #{cu_text1,jdbcType=VARCHAR}, #{cu_text2,jdbcType=VARCHAR}, 
+      #{cu_text3,jdbcType=VARCHAR}, #{cu_text4,jdbcType=VARCHAR}, #{cu_text5,jdbcType=VARCHAR}, 
+      #{cu_leftamount,jdbcType=DOUBLE}, #{cu_recamount,jdbcType=DOUBLE})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Customer">
+    insert into customer
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="cu_id != null">
+        cu_id,
+      </if>
+      <if test="cu_code != null">
+        cu_code,
+      </if>
+      <if test="cu_name != null">
+        cu_name,
+      </if>
+      <if test="cu_uu != null">
+        cu_uu,
+      </if>
+      <if test="cu_type != null">
+        cu_type,
+      </if>
+      <if test="cu_begindate != null">
+        cu_begindate,
+      </if>
+      <if test="cu_beginaramount != null">
+        cu_beginaramount,
+      </if>
+      <if test="cu_beginprerecamount != null">
+        cu_beginprerecamount,
+      </if>
+      <if test="cu_promisedays != null">
+        cu_promisedays,
+      </if>
+      <if test="cu_taxrate != null">
+        cu_taxrate,
+      </if>
+      <if test="cu_sellerid != null">
+        cu_sellerid,
+      </if>
+      <if test="cu_sellercode != null">
+        cu_sellercode,
+      </if>
+      <if test="cu_sellername != null">
+        cu_sellername,
+      </if>
+      <if test="cu_credit != null">
+        cu_credit,
+      </if>
+      <if test="cu_status != null">
+        cu_status,
+      </if>
+      <if test="cu_statuscode != null">
+        cu_statuscode,
+      </if>
+      <if test="cu_recordmanid != null">
+        cu_recordmanid,
+      </if>
+      <if test="cu_recordman != null">
+        cu_recordman,
+      </if>
+      <if test="cu_recorddate != null">
+        cu_recorddate,
+      </if>
+      <if test="companyid != null">
+        companyid,
+      </if>
+      <if test="updaterid != null">
+        updaterid,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+      <if test="cu_text1 != null">
+        cu_text1,
+      </if>
+      <if test="cu_text2 != null">
+        cu_text2,
+      </if>
+      <if test="cu_text3 != null">
+        cu_text3,
+      </if>
+      <if test="cu_text4 != null">
+        cu_text4,
+      </if>
+      <if test="cu_text5 != null">
+        cu_text5,
+      </if>
+      <if test="cu_leftamount != null">
+        cu_leftamount,
+      </if>
+      <if test="cu_recamount != null">
+        cu_recamount,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="cu_id != null">
+        #{cu_id,jdbcType=INTEGER},
+      </if>
+      <if test="cu_code != null">
+        #{cu_code,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_name != null">
+        #{cu_name,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_uu != null">
+        #{cu_uu,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_type != null">
+        #{cu_type,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_begindate != null">
+        #{cu_begindate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cu_beginaramount != null">
+        #{cu_beginaramount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_beginprerecamount != null">
+        #{cu_beginprerecamount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_promisedays != null">
+        #{cu_promisedays,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_taxrate != null">
+        #{cu_taxrate,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_sellerid != null">
+        #{cu_sellerid,jdbcType=INTEGER},
+      </if>
+      <if test="cu_sellercode != null">
+        #{cu_sellercode,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_sellername != null">
+        #{cu_sellername,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_credit != null">
+        #{cu_credit,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_status != null">
+        #{cu_status,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_statuscode != null">
+        #{cu_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_recordmanid != null">
+        #{cu_recordmanid,jdbcType=INTEGER},
+      </if>
+      <if test="cu_recordman != null">
+        #{cu_recordman,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_recorddate != null">
+        #{cu_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyid != null">
+        #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cu_text1 != null">
+        #{cu_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text2 != null">
+        #{cu_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text3 != null">
+        #{cu_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text4 != null">
+        #{cu_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text5 != null">
+        #{cu_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_leftamount != null">
+        #{cu_leftamount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_recamount != null">
+        #{cu_recamount,jdbcType=DOUBLE},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customer">
+    update customer
+    <set>
+      <if test="cu_code != null">
+        cu_code = #{cu_code,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_name != null">
+        cu_name = #{cu_name,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_uu != null">
+        cu_uu = #{cu_uu,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_type != null">
+        cu_type = #{cu_type,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_begindate != null">
+        cu_begindate = #{cu_begindate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cu_beginaramount != null">
+        cu_beginaramount = #{cu_beginaramount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_beginprerecamount != null">
+        cu_beginprerecamount = #{cu_beginprerecamount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_promisedays != null">
+        cu_promisedays = #{cu_promisedays,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_taxrate != null">
+        cu_taxrate = #{cu_taxrate,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_sellerid != null">
+        cu_sellerid = #{cu_sellerid,jdbcType=INTEGER},
+      </if>
+      <if test="cu_sellercode != null">
+        cu_sellercode = #{cu_sellercode,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_sellername != null">
+        cu_sellername = #{cu_sellername,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_credit != null">
+        cu_credit = #{cu_credit,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_status != null">
+        cu_status = #{cu_status,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_statuscode != null">
+        cu_statuscode = #{cu_statuscode,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_recordmanid != null">
+        cu_recordmanid = #{cu_recordmanid,jdbcType=INTEGER},
+      </if>
+      <if test="cu_recordman != null">
+        cu_recordman = #{cu_recordman,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_recorddate != null">
+        cu_recorddate = #{cu_recorddate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="companyid != null">
+        companyid = #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        updaterid = #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cu_text1 != null">
+        cu_text1 = #{cu_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text2 != null">
+        cu_text2 = #{cu_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text3 != null">
+        cu_text3 = #{cu_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text4 != null">
+        cu_text4 = #{cu_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_text5 != null">
+        cu_text5 = #{cu_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="cu_leftamount != null">
+        cu_leftamount = #{cu_leftamount,jdbcType=DOUBLE},
+      </if>
+      <if test="cu_recamount != null">
+        cu_recamount = #{cu_recamount,jdbcType=DOUBLE},
+      </if>
+    </set>
+    where cu_id = #{cu_id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Customer">
+    update customer
+    set cu_code = #{cu_code,jdbcType=VARCHAR},
+      cu_name = #{cu_name,jdbcType=VARCHAR},
+      cu_uu = #{cu_uu,jdbcType=VARCHAR},
+      cu_type = #{cu_type,jdbcType=VARCHAR},
+      cu_begindate = #{cu_begindate,jdbcType=TIMESTAMP},
+      cu_beginaramount = #{cu_beginaramount,jdbcType=DOUBLE},
+      cu_beginprerecamount = #{cu_beginprerecamount,jdbcType=DOUBLE},
+      cu_promisedays = #{cu_promisedays,jdbcType=DOUBLE},
+      cu_taxrate = #{cu_taxrate,jdbcType=DOUBLE},
+      cu_sellerid = #{cu_sellerid,jdbcType=INTEGER},
+      cu_sellercode = #{cu_sellercode,jdbcType=VARCHAR},
+      cu_sellername = #{cu_sellername,jdbcType=VARCHAR},
+      cu_credit = #{cu_credit,jdbcType=DOUBLE},
+      cu_status = #{cu_status,jdbcType=VARCHAR},
+      cu_statuscode = #{cu_statuscode,jdbcType=VARCHAR},
+      cu_recordmanid = #{cu_recordmanid,jdbcType=INTEGER},
+      cu_recordman = #{cu_recordman,jdbcType=VARCHAR},
+      cu_recorddate = #{cu_recorddate,jdbcType=TIMESTAMP},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterid = #{updaterid,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      cu_text1 = #{cu_text1,jdbcType=VARCHAR},
+      cu_text2 = #{cu_text2,jdbcType=VARCHAR},
+      cu_text3 = #{cu_text3,jdbcType=VARCHAR},
+      cu_text4 = #{cu_text4,jdbcType=VARCHAR},
+      cu_text5 = #{cu_text5,jdbcType=VARCHAR},
+      cu_leftamount = #{cu_leftamount,jdbcType=DOUBLE},
+      cu_recamount = #{cu_recamount,jdbcType=DOUBLE}
+    where cu_id = #{cu_id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 245 - 0
applications/document/document-server/src/main/resources/mapper/CustomeraddressMapper.xml

@@ -0,0 +1,245 @@
+<?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.document.mapper.CustomeraddressMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Customeraddress">
+    <id column="ca_id" jdbcType="INTEGER" property="id" />
+    <result column="ca_cuid" jdbcType="INTEGER" property="ca_cuid" />
+    <result column="ca_detno" jdbcType="INTEGER" property="ca_detno" />
+    <result column="ca_person" jdbcType="VARCHAR" property="ca_person" />
+    <result column="ca_phone" jdbcType="INTEGER" property="ca_phone" />
+    <result column="ca_default" jdbcType="INTEGER" property="ca_default" />
+    <result column="companyid" jdbcType="INTEGER" property="companyId" />
+    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="ca_text1" jdbcType="VARCHAR" property="ca_text1" />
+    <result column="ca_text2" jdbcType="VARCHAR" property="ca_text2" />
+    <result column="ca_text3" jdbcType="VARCHAR" property="ca_text3" />
+    <result column="ca_text4" jdbcType="VARCHAR" property="ca_text4" />
+    <result column="ca_text5" jdbcType="VARCHAR" property="ca_text5" />
+  </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Customeraddress">
+    <result column="ca_address" jdbcType="LONGVARCHAR" property="ca_address" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    ca_id, ca_cuid, ca_detno, ca_person, ca_phone, ca_default, companyid, updaterid, 
+    updatetime, ca_text1, ca_text2, ca_text3, ca_text4, ca_text5
+  </sql>
+  <sql id="Blob_Column_List">
+    ca_address
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
+    select 
+   *
+    from customeraddress
+    where ca_id = #{ca_id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from customeraddress
+    where ca_id = #{ca_id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Customeraddress">
+    insert into customeraddress (ca_id, ca_cuid, ca_detno, 
+      ca_person, ca_phone, ca_default, 
+      companyid, updaterid, updatetime, 
+      ca_text1, ca_text2, ca_text3, 
+      ca_text4, ca_text5, ca_address
+      )
+    values (#{ca_id,jdbcType=INTEGER}, #{ca_cuid,jdbcType=INTEGER}, #{ca_detno,jdbcType=INTEGER}, 
+      #{ca_person,jdbcType=VARCHAR}, #{ca_phone,jdbcType=INTEGER}, #{ca_default,jdbcType=INTEGER}, 
+      #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, #{updatetime,jdbcType=TIMESTAMP}, 
+      #{ca_text1,jdbcType=VARCHAR}, #{ca_text2,jdbcType=VARCHAR}, #{ca_text3,jdbcType=VARCHAR}, 
+      #{ca_text4,jdbcType=VARCHAR}, #{ca_text5,jdbcType=VARCHAR}, #{ca_address,jdbcType=LONGVARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Customeraddress">
+    insert into customeraddress
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="ca_id != null">
+        ca_id,
+      </if>
+      <if test="ca_cuid != null">
+        ca_cuid,
+      </if>
+      <if test="ca_detno != null">
+        ca_detno,
+      </if>
+      <if test="ca_person != null">
+        ca_person,
+      </if>
+      <if test="ca_phone != null">
+        ca_phone,
+      </if>
+      <if test="ca_default != null">
+        ca_default,
+      </if>
+      <if test="companyid != null">
+        companyid,
+      </if>
+      <if test="updaterid != null">
+        updaterid,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+      <if test="ca_text1 != null">
+        ca_text1,
+      </if>
+      <if test="ca_text2 != null">
+        ca_text2,
+      </if>
+      <if test="ca_text3 != null">
+        ca_text3,
+      </if>
+      <if test="ca_text4 != null">
+        ca_text4,
+      </if>
+      <if test="ca_text5 != null">
+        ca_text5,
+      </if>
+      <if test="ca_address != null">
+        ca_address,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="ca_id != null">
+        #{ca_id,jdbcType=INTEGER},
+      </if>
+      <if test="ca_cuid != null">
+        #{ca_cuid,jdbcType=INTEGER},
+      </if>
+      <if test="ca_detno != null">
+        #{ca_detno,jdbcType=INTEGER},
+      </if>
+      <if test="ca_person != null">
+        #{ca_person,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_phone != null">
+        #{ca_phone,jdbcType=INTEGER},
+      </if>
+      <if test="ca_default != null">
+        #{ca_default,jdbcType=INTEGER},
+      </if>
+      <if test="companyid != null">
+        #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ca_text1 != null">
+        #{ca_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text2 != null">
+        #{ca_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text3 != null">
+        #{ca_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text4 != null">
+        #{ca_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text5 != null">
+        #{ca_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_address != null">
+        #{ca_address,jdbcType=LONGVARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customeraddress">
+    update customeraddress
+    <set>
+      <if test="ca_cuid != null">
+        ca_cuid = #{ca_cuid,jdbcType=INTEGER},
+      </if>
+      <if test="ca_detno != null">
+        ca_detno = #{ca_detno,jdbcType=INTEGER},
+      </if>
+      <if test="ca_person != null">
+        ca_person = #{ca_person,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_phone != null">
+        ca_phone = #{ca_phone,jdbcType=INTEGER},
+      </if>
+      <if test="ca_default != null">
+        ca_default = #{ca_default,jdbcType=INTEGER},
+      </if>
+      <if test="companyid != null">
+        companyid = #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        updaterid = #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="ca_text1 != null">
+        ca_text1 = #{ca_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text2 != null">
+        ca_text2 = #{ca_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text3 != null">
+        ca_text3 = #{ca_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text4 != null">
+        ca_text4 = #{ca_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_text5 != null">
+        ca_text5 = #{ca_text5,jdbcType=VARCHAR},
+      </if>
+      <if test="ca_address != null">
+        ca_address = #{ca_address,jdbcType=LONGVARCHAR},
+      </if>
+    </set>
+    where ca_id = #{ca_id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.document.entities.Customeraddress">
+    update customeraddress
+    set ca_cuid = #{ca_cuid,jdbcType=INTEGER},
+      ca_detno = #{ca_detno,jdbcType=INTEGER},
+      ca_person = #{ca_person,jdbcType=VARCHAR},
+      ca_phone = #{ca_phone,jdbcType=INTEGER},
+      ca_default = #{ca_default,jdbcType=INTEGER},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterid = #{updaterid,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      ca_text1 = #{ca_text1,jdbcType=VARCHAR},
+      ca_text2 = #{ca_text2,jdbcType=VARCHAR},
+      ca_text3 = #{ca_text3,jdbcType=VARCHAR},
+      ca_text4 = #{ca_text4,jdbcType=VARCHAR},
+      ca_text5 = #{ca_text5,jdbcType=VARCHAR},
+      ca_address = #{ca_address,jdbcType=LONGVARCHAR}
+    where ca_id = #{ca_id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Customeraddress">
+    update customeraddress
+    set ca_cuid = #{ca_cuid,jdbcType=INTEGER},
+      ca_detno = #{ca_detno,jdbcType=INTEGER},
+      ca_person = #{ca_person,jdbcType=VARCHAR},
+      ca_phone = #{ca_phone,jdbcType=INTEGER},
+      ca_default = #{ca_default,jdbcType=INTEGER},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterid = #{updaterid,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      ca_text1 = #{ca_text1,jdbcType=VARCHAR},
+      ca_text2 = #{ca_text2,jdbcType=VARCHAR},
+      ca_text3 = #{ca_text3,jdbcType=VARCHAR},
+      ca_text4 = #{ca_text4,jdbcType=VARCHAR},
+      ca_text5 = #{ca_text5,jdbcType=VARCHAR}
+    where ca_id = #{ca_id,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectByFK" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
+    select
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from customeraddress
+    where ca_cuid = #{fk_i,jdbcType=INTEGER}
+  </select>
+
+
+</mapper>

+ 222 - 0
applications/document/document-server/src/main/resources/mapper/CustomercontactMapper.xml

@@ -0,0 +1,222 @@
+<?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.document.mapper.CustomercontactMapper">
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Customercontact">
+    <id column="cc_id" jdbcType="INTEGER" property="id" />
+    <result column="cc_cuid" jdbcType="INTEGER" property="cc_cuid" />
+    <result column="cc_detno" jdbcType="INTEGER" property="cc_detno" />
+    <result column="cc_name" jdbcType="VARCHAR" property="cc_name" />
+    <result column="cc_tel" jdbcType="INTEGER" property="cc_tel" />
+    <result column="cc_qq" jdbcType="VARCHAR" property="cc_qq" />
+    <result column="cc_email" jdbcType="VARCHAR" property="cc_email" />
+    <result column="companyid" jdbcType="INTEGER" property="companyId" />
+    <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="cc_text1" jdbcType="VARCHAR" property="cc_text1" />
+    <result column="cc_text2" jdbcType="VARCHAR" property="cc_text2" />
+    <result column="cc_text3" jdbcType="VARCHAR" property="cc_text3" />
+    <result column="cc_text4" jdbcType="VARCHAR" property="cc_text4" />
+    <result column="cc_text5" jdbcType="VARCHAR" property="cc_text5" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    cc_id, cc_cuid, cc_detno, cc_name, cc_tel, cc_qq, cc_email, companyid, updaterid, 
+    updatetime, cc_text1, cc_text2, cc_text3, cc_text4, cc_text5
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from customercontact
+    where cc_id = #{cc_id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from customercontact
+    where cc_id = #{cc_id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Customercontact">
+    insert into customercontact (cc_id, cc_cuid, cc_detno, 
+      cc_name, cc_tel, cc_qq, 
+      cc_email, companyid, updaterid, 
+      updatetime, cc_text1, cc_text2, 
+      cc_text3, cc_text4, cc_text5
+      )
+    values (#{cc_id,jdbcType=INTEGER}, #{cc_cuid,jdbcType=INTEGER}, #{cc_detno,jdbcType=INTEGER}, 
+      #{cc_name,jdbcType=VARCHAR}, #{cc_tel,jdbcType=INTEGER}, #{cc_qq,jdbcType=VARCHAR}, 
+      #{cc_email,jdbcType=VARCHAR}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER}, 
+      #{updatetime,jdbcType=TIMESTAMP}, #{cc_text1,jdbcType=VARCHAR}, #{cc_text2,jdbcType=VARCHAR}, 
+      #{cc_text3,jdbcType=VARCHAR}, #{cc_text4,jdbcType=VARCHAR}, #{cc_text5,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Customercontact">
+    insert into customercontact
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="cc_id != null">
+        cc_id,
+      </if>
+      <if test="cc_cuid != null">
+        cc_cuid,
+      </if>
+      <if test="cc_detno != null">
+        cc_detno,
+      </if>
+      <if test="cc_name != null">
+        cc_name,
+      </if>
+      <if test="cc_tel != null">
+        cc_tel,
+      </if>
+      <if test="cc_qq != null">
+        cc_qq,
+      </if>
+      <if test="cc_email != null">
+        cc_email,
+      </if>
+      <if test="companyid != null">
+        companyid,
+      </if>
+      <if test="updaterid != null">
+        updaterid,
+      </if>
+      <if test="updatetime != null">
+        updatetime,
+      </if>
+      <if test="cc_text1 != null">
+        cc_text1,
+      </if>
+      <if test="cc_text2 != null">
+        cc_text2,
+      </if>
+      <if test="cc_text3 != null">
+        cc_text3,
+      </if>
+      <if test="cc_text4 != null">
+        cc_text4,
+      </if>
+      <if test="cc_text5 != null">
+        cc_text5,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="cc_id != null">
+        #{cc_id,jdbcType=INTEGER},
+      </if>
+      <if test="cc_cuid != null">
+        #{cc_cuid,jdbcType=INTEGER},
+      </if>
+      <if test="cc_detno != null">
+        #{cc_detno,jdbcType=INTEGER},
+      </if>
+      <if test="cc_name != null">
+        #{cc_name,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_tel != null">
+        #{cc_tel,jdbcType=INTEGER},
+      </if>
+      <if test="cc_qq != null">
+        #{cc_qq,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_email != null">
+        #{cc_email,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null">
+        #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cc_text1 != null">
+        #{cc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text2 != null">
+        #{cc_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text3 != null">
+        #{cc_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text4 != null">
+        #{cc_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text5 != null">
+        #{cc_text5,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customercontact">
+    update customercontact
+    <set>
+      <if test="cc_cuid != null">
+        cc_cuid = #{cc_cuid,jdbcType=INTEGER},
+      </if>
+      <if test="cc_detno != null">
+        cc_detno = #{cc_detno,jdbcType=INTEGER},
+      </if>
+      <if test="cc_name != null">
+        cc_name = #{cc_name,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_tel != null">
+        cc_tel = #{cc_tel,jdbcType=INTEGER},
+      </if>
+      <if test="cc_qq != null">
+        cc_qq = #{cc_qq,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_email != null">
+        cc_email = #{cc_email,jdbcType=VARCHAR},
+      </if>
+      <if test="companyid != null">
+        companyid = #{companyid,jdbcType=INTEGER},
+      </if>
+      <if test="updaterid != null">
+        updaterid = #{updaterid,jdbcType=INTEGER},
+      </if>
+      <if test="updatetime != null">
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="cc_text1 != null">
+        cc_text1 = #{cc_text1,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text2 != null">
+        cc_text2 = #{cc_text2,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text3 != null">
+        cc_text3 = #{cc_text3,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text4 != null">
+        cc_text4 = #{cc_text4,jdbcType=VARCHAR},
+      </if>
+      <if test="cc_text5 != null">
+        cc_text5 = #{cc_text5,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where cc_id = #{cc_id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Customercontact">
+    update customercontact
+    set cc_cuid = #{cc_cuid,jdbcType=INTEGER},
+      cc_detno = #{cc_detno,jdbcType=INTEGER},
+      cc_name = #{cc_name,jdbcType=VARCHAR},
+      cc_tel = #{cc_tel,jdbcType=INTEGER},
+      cc_qq = #{cc_qq,jdbcType=VARCHAR},
+      cc_email = #{cc_email,jdbcType=VARCHAR},
+      companyid = #{companyid,jdbcType=INTEGER},
+      updaterid = #{updaterid,jdbcType=INTEGER},
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
+      cc_text1 = #{cc_text1,jdbcType=VARCHAR},
+      cc_text2 = #{cc_text2,jdbcType=VARCHAR},
+      cc_text3 = #{cc_text3,jdbcType=VARCHAR},
+      cc_text4 = #{cc_text4,jdbcType=VARCHAR},
+      cc_text5 = #{cc_text5,jdbcType=VARCHAR}
+    where cc_id = #{cc_id,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectByFK" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from customercontact
+    where cc_cuid = #{fk_i,jdbcType=INTEGER}
+  </select>
+
+
+
+</mapper>

+ 0 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseListMapper.java

@@ -1,7 +1,5 @@
 package com.usoftchina.saas.purchase.mapper;
 
-import com.usoftchina.saas.commons.dto.ListReqDTO;
-import com.usoftchina.saas.purchase.dto.PurchaseReqDTO;
 import com.usoftchina.saas.purchase.po.PurchaseList;
 import org.apache.ibatis.annotations.Param;
 

+ 2 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/ProdIODetail.java

@@ -26,9 +26,9 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private String pd_unit;
 
-    private Integer pd_inqty;
+    private Double pd_inqty;
 
-    private Integer pd_outqty;
+    private Double pd_outqty;
 
     private Double pd_orderprice;
 

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

@@ -282,9 +282,9 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 //入库数大于等于采购数
                 if(purchaseDetail.getPd_acceptqty() >= purchaseDetail.getPd_qty()){
                     turnCount++;
+                }else if(purchaseDetail.getPd_acceptqty() > 0 && purchaseDetail.getPd_acceptqty() < purchaseDetail.getPd_qty()){
                     //     0 < 入库数 < 采购数
                     partTurnCount++;
-                }else if(purchaseDetail.getPd_acceptqty() > 0 && purchaseDetail.getPd_acceptqty() < purchaseDetail.getPd_qty()){
                 }
             }
             //构造更新对象
@@ -378,7 +378,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
                 //公司id
                 prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
                 //本次转单数
-                prodIODetail.setPd_inqty((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
+                prodIODetail.setPd_inqty((purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
                 prodIODetailMapper.insertSelective(prodIODetail);
                 //更新已转数
                 purchaseDetail.setPd_yqty(purchaseDetail.getPd_qty());
@@ -465,7 +465,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         }
         Integer count = "0".equals(String.valueOf(id)) ? purchaseMapper.validateCodeWhenInsert(code) :
                 purchaseMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase");
+        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
     }
     
     /** 

+ 1 - 1
applications/purchase/purchase-server/src/main/resources/application.yml

@@ -47,7 +47,7 @@ eureka:
   client:
     registryFetchIntervalSeconds: 5
     serviceUrl:
-      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8500/eureka/
+      defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@192.168.0.181:8510/eureka/
 server:
   port: 8800
   tomcat:

+ 0 - 82
applications/sale/pom.xml

@@ -17,86 +17,4 @@
         <module>sale-dto</module>
     </modules>
 
-    <dependencies>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>sale-dto</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>document-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>auth-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>server-starter</artifactId>
-        </dependency>
-
-        <!--test-->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-        </dependency>
-
-        <!-- db -->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.mybatis.spring.boot</groupId>
-            <artifactId>mybatis-spring-boot-starter</artifactId>
-        </dependency>
-        <!-- sleuth -->
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-zipkin</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.amqp</groupId>
-            <artifactId>spring-rabbit</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>net.logstash.logback</groupId>
-            <artifactId>logstash-logback-encoder</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.github.pagehelper</groupId>
-            <artifactId>pagehelper-spring-boot-starter</artifactId>
-        </dependency>
-        <!-- feign -->
-        <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-openfeign</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>commons-dto</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>commons-api</artifactId>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>com.spotify</groupId>
-                <artifactId>docker-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
 </project>

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

@@ -10,6 +10,15 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>sale-dto</artifactId>
-
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+    </dependencies>
 
 </project>

+ 85 - 2
applications/sale/sale-server/pom.xml

@@ -10,13 +10,96 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>sale-server</artifactId>
+    
     <dependencies>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>sale-dto</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
-    </dependencies>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>storage-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>purchase-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>auth-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>server-starter</artifactId>
+        </dependency>
+
+        <!--test-->
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>test-starter</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- db -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <!-- sleuth -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-zipkin</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.amqp</groupId>
+            <artifactId>spring-rabbit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.logstash.logback</groupId>
+            <artifactId>logstash-logback-encoder</artifactId>
+        </dependency>
 
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+        </dependency>
+        <!-- feign -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>commons-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>commons-api</artifactId>
+        </dependency>
+    </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>com.spotify</groupId>
+                <artifactId>docker-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
 </project>

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

@@ -157,7 +157,7 @@ public class SaleController {
         return Result.success();
     }
 
-    @PostMapping("/turnOut/{id}")
+    @PostMapping("/turnProdOut/{id}")
     public Result turnOut(@PathVariable("id") Long id) {
         saleService.turnOut(id);
         return Result.success();

+ 32 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdIODetailMapper.java

@@ -0,0 +1,32 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.storage.entities.ProdIODetail;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ProdIODetailMapper  {
+
+    int deleteByPrimaryKey(Long pd_id);
+
+    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);
+
+    void batchInsert(List<ProdIODetail> list);
+
+    void batchUpdate(List<ProdIODetail> list);
+
+    void updatePurchaseYqty(Integer id);
+
+    List<ProdIODetail> selectByFK(Long id);
+}

+ 24 - 0
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/ProdInOutMapper.java

@@ -0,0 +1,24 @@
+package com.usoftchina.saas.sale.mapper;
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.storage.entities.ProdInOut;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ProdInOutMapper {
+
+    int deleteByPrimaryKey(Long pi_id);
+
+    int insert(ProdInOut record);
+
+    int insertSelective(ProdInOut record);
+
+    ProdInOut selectByPrimaryKey(Long pi_id);
+
+    int updateByPrimaryKeySelective(ProdInOut record);
+
+    int updateByPrimaryKeyWithBLOBs(ProdInOut record);
+
+    int updateByPrimaryKey(ProdInOut record);
+}

+ 1 - 20
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/mapper/SaledetailMapper.java

@@ -16,25 +16,6 @@ public interface SaledetailMapper {
     void deleteByForeignKey(Long id);
 
     Integer deleteByPrimaryKey(Long id);
-   /* int countByExample(SaledetailExample example);
 
-    int deleteByExample(SaledetailExample example);
-
-    int deleteByPrimaryKey(Integer sd_id);
-
-    int insert(Saledetail record);
-
-    int insertSelective(Saledetail record);
-
-    List<Saledetail> selectByExample(SaledetailExample example);
-
-    Saledetail selectByPrimaryKey(Integer sd_id);
-
-    int updateByExampleSelective(@Param("record") Saledetail record, @Param("example") SaledetailExample example);
-
-    int updateByExample(@Param("record") Saledetail record, @Param("example") SaledetailExample example);
-
-    int updateByPrimaryKeySelective(Saledetail record);
-
-    int updateByPrimaryKey(Saledetail record);*/
+    void updateByPrimaryKeySelective(SaleDetail saleDetail);
 }

+ 3 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/po/SaleDetail.java

@@ -17,7 +17,7 @@ public class SaleDetail extends CommonBaseEntity{
 
     private String sd_code;
 
-    private Integer sd_prodid;
+    private Long sd_prodid;
 
     private String sd_prodcode;
 
@@ -39,6 +39,8 @@ public class SaleDetail extends CommonBaseEntity{
 
     private Double sd_pdqty;
 
+    private Double sd_yqty;
+
     private String sd_remark;
 
     private String sd_text1;

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

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.sale.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.netflix.discovery.converters.Auto;
@@ -18,13 +19,13 @@ import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.sale.dto.SaleDTO;
 import com.usoftchina.saas.sale.dto.SaleDetailDTO;
 import com.usoftchina.saas.sale.dto.SaleFormDTO;
-import com.usoftchina.saas.sale.mapper.SaleListMapper;
-import com.usoftchina.saas.sale.mapper.SaleMapper;
-import com.usoftchina.saas.sale.mapper.SaledetailMapper;
+import com.usoftchina.saas.sale.mapper.*;
 import com.usoftchina.saas.sale.po.Sale;
 import com.usoftchina.saas.sale.po.SaleDetail;
 import com.usoftchina.saas.sale.po.SaleList;
 import com.usoftchina.saas.sale.service.SaleService;
+import com.usoftchina.saas.storage.entities.ProdIODetail;
+import com.usoftchina.saas.storage.entities.ProdInOut;
 import com.usoftchina.saas.utils.BeanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,6 +53,10 @@ public class SaleServiceImpl implements SaleService{
     private MessageLogService messageLogService;
     @Autowired
     private MaxnumberService maxnumberService;
+    @Autowired
+    private ProdInOutMapper prodInOutMapper;
+    @Autowired
+    private ProdIODetailMapper prodIODetailMapper;
 
     @Override
     public PageInfo<SaleList> getListData(PageRequest page, ListReqDTO req) {
@@ -285,7 +290,7 @@ public class SaleServiceImpl implements SaleService{
         }
         Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code) :
                 saleMapper.validateCodeWhenUpdate(code, id);
-        return maxnumberService.pushMaxnubmer(count, code, "Purchase");
+        return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
     }
 
     /**
@@ -338,126 +343,125 @@ public class SaleServiceImpl implements SaleService{
     @Override
     public void open(long id) {
         List<SaleDetail> saleDetailList = saledetailMapper.selectByFK(id);
-       /* //部分入库、全部入库
+        //部分入库、全部入库
         int partTurnCount = 0,turnCount = 0;
         if(saleDetailList != null && saleDetailList.size() > 0){
             for(SaleDetail saleDetail : saleDetailList){
-                //入库数大于等于采购数
-                if(purchaseDetail.getPd_acceptqty() >= purchaseDetail.getPd_qty()){
+                //
+                if(saleDetail.getSd_yqty() >= saleDetail.getSd_qty()){
                     turnCount++;
+
+                }else if(saleDetail.getSd_yqty() > 0 && saleDetail.getSd_yqty() < saleDetail.getSd_qty()){
                     //     0 < 入库数 < 采购数
                     partTurnCount++;
-                }else if(purchaseDetail.getPd_acceptqty() > 0 && purchaseDetail.getPd_acceptqty() < purchaseDetail.getPd_qty()){
                 }
             }
             //构造更新对象
-            Purchase purchase = new Purchase();
-            purchase.setId(id);
-            purchase.setPu_acceptstatuscode("UNTURNIN");
-            purchase.setPu_acceptstatus("未入库");
+            Sale sale = new Sale();
+            sale.setId(id);
+            sale.setSa_sendstatus(Status.UNTURNOUT.getDisplay());
+            sale.setSa_sendstatuscode(Status.UNTURNOUT.name());
             if(partTurnCount > 0){
-                purchase.setPu_acceptstatuscode("PART2IN");
-                purchase.setPu_acceptstatus("部分入库");
+                sale.setSa_sendstatus(Status.PARTOUT.getDisplay());
+                sale.setSa_sendstatuscode(Status.PARTOUT.name());
             }
-            if(turnCount == purchaseDetailList.size()){
-                purchase.setPu_acceptstatus("已入库");
-                purchase.setPu_acceptstatuscode("TURNIN");
+            if(turnCount == saleDetailList.size()){
+                sale.setSa_sendstatus(Status.TURNOUT.getDisplay());
+                sale.setSa_sendstatuscode(Status.TURNOUT.name());
             }
-            purchaseMapper.updateByPrimaryKeySelective(purchase);
+            saleMapper.updateByPrimaryKeySelective(sale);
             DocBaseDTO docBaseDTO = getBaseDTOById(id);
             //日志
             messageLogService.open(docBaseDTO);
-        }*/
+        }
     }
 
     @Override
     public void turnOut(Long id) {
-
-    }/*{
         if (null == id) {
             return;
         }
+        Integer count = 0;
+        double pdQty = 0;
+        double pdYqty = 0;
         Sale sale = saleMapper.selectByPrimaryKey(id);
-        Integer count=0;
-        double pdQty=0, pdYqty=0;
+        List<SaleDetail> details = saledetailMapper.selectByFK(id);
         //检查转单状态
-       // String acceptstatus = sale.getPu_acceptstatuscode();
-
-        if ("TURNIN".equals(acceptstatus)){
-            return Result.error(ExceptionCode.TURNIN_EXIST);
+        String statuscode = sale.getSa_sendstatuscode();
+        if (Status.TURNOUT.name().equals(statuscode)){
+            throw new BizException(BizExceptionCode.SALE_ALL_TURNOUT);
         }
-        if ("CLOSED".equals(acceptstatus)){
-            return Result.error(ExceptionCode.CLOSED_EXIST);
+        if (Status.CLOSE.name().equals(statuscode)){
+            throw new BizException(BizExceptionCode.SALE_CLOSE);
         }
 
-        List<PurchaseDetail> purchaseDetails = purchasedetailMapper.selectByFK(id);
-
         //检查从表
-        for (PurchaseDetail purchaseDetail : purchaseDetails) {
-            pdQty = purchaseDetail.getPd_qty();
-            pdYqty = purchaseDetail.getPd_yqty();
-            if (pdQty-pdYqty>0){
+        for (SaleDetail detail : details) {
+            pdQty = detail.getSd_qty();
+            pdYqty = detail.getSd_yqty();
+            if (pdQty - pdYqty > 0){
                 count++;
             }
         }
         //判断可转数
         if (count==0){
-            return Result.error(ExceptionCode.TURNINNUM_NOT_EXIST);
+            throw new BizException(BizExceptionCode.SALE_YQTYBEYONDQTY);
         }
+
         //插入验收单主表
         ProdInOut prodInOut = new ProdInOut();
         //生成单号
-        String piInoutno ="YS0001";
+        Object data = maxnumberService.getMaxnumber("Sale", true).getData();
+        JSONObject parse = (JSONObject)JSONObject.parse(data.toString());
+        String pi_inoutno = String.valueOf(parse.get("code"));
 
-        prodInOut.setPi_inoutno(piInoutno);
-        prodInOut.setPi_class("采购验收单");
+        prodInOut.setPi_inoutno(pi_inoutno);
+        prodInOut.setPi_class("出货单");
         prodInOut.setPi_date(new Date());
-        prodInOut.setPi_status("未审核");
-        prodInOut.setPi_statuscode("UNAUDITED");
+        prodInOut.setPi_status(Status.UNAUDITED.getDisplay());
+        prodInOut.setPi_statuscode(Status.UNAUDITED.name());
         prodInOut.setPi_recorddate(new Date());
-        prodInOut.setPi_vendid(purchase.getPu_vendid());
-        prodInOut.setPi_vendcode(purchase.getPu_vendcode());
-        prodInOut.setPi_vendname(purchase.getPu_vendname());
-        prodInOut.setPi_puid(purchase.getId().intValue());
-        prodInOut.setPi_pucode(purchase.getPu_code());
+        prodInOut.setPi_custid(sale.getSa_custid());
+        prodInOut.setPi_custcode(sale.getSa_custcode());
+        prodInOut.setPi_custname(sale.getSa_custname());
+        prodInOut.setPi_said(sale.getId());
+        prodInOut.setPi_sacode(sale.getSa_code());
         //设置公司id
-        prodInOut.setCompanyId(purchase.getCompanyId());
+        prodInOut.setCompanyId(sale.getCompanyId());
 
         prodInOutMapper.insertSelective(prodInOut);
-
-        //插入验收单从表
+        //插入出货单从表
         long pi_id = prodInOut.getId();
 
-        for (int i=0;i<purchaseDetails.size();i++){
-            PurchaseDetail purchaseDetail =purchaseDetails.get(i);
+        for (int i=0;i<details.size();i++){
+            SaleDetail saleDetail =details.get(i);
             ProdIODetail prodIODetail = new ProdIODetail();
-            if ((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty())>0){
-                prodIODetail.setPd_piid(pi_id);
-                prodIODetail.setPd_inoutno(piInoutno);
-                prodIODetail.setPd_piclass("采购验收单");
-                prodIODetail.setPd_pdno(i);
-                prodIODetail.setPd_orderid(purchaseDetail.getId().intValue());
-                prodIODetail.setPd_ordercode(purchase.getPu_code());
-                prodIODetail.setPd_orderdetno(purchaseDetail.getPd_detno());
-                prodIODetail.setPd_orderprice(purchaseDetail.getPd_price());
-                prodIODetail.setPd_prodid(purchaseDetail.getPd_prodid());
-                prodIODetail.setPd_prodcode(purchaseDetail.getPd_prodcode());
-                //公司id
-                prodIODetail.setCompanyId(purchaseDetail.getCompanyId());
-                //本次转单数
-                prodIODetail.setPd_inqty((int) (purchaseDetail.getPd_qty()-purchaseDetail.getPd_yqty()));
-                prodIODetailMapper.insertSelective(prodIODetail);
-                //更新已转数
-                purchaseDetail.setPd_yqty(purchaseDetail.getPd_qty());
-                purchasedetailMapper.updateByPrimaryKeySelective(purchaseDetail);
-            }
+            prodIODetail.setPd_piid(pi_id);
+            prodIODetail.setPd_inoutno(pi_inoutno);
+            prodIODetail.setPd_piclass("出货单");
+            prodIODetail.setPd_pdno(i);
+            prodIODetail.setPd_orderid(sale.getId());
+            prodIODetail.setPd_ordercode(sale.getSa_code());
+            prodIODetail.setPd_orderdetno(saleDetail.getSd_detno());
+            prodIODetail.setPd_orderprice(saleDetail.getSd_price());
+            prodIODetail.setPd_prodid(saleDetail.getSd_prodid());
+            prodIODetail.setPd_prodcode(saleDetail.getSd_prodcode());
+            //公司id
+            prodIODetail.setCompanyId(saleDetail.getCompanyId());
+            //本次转单数
+            prodIODetail.setPd_inqty((saleDetail.getSd_qty()-saleDetail.getSd_yqty()));
+            prodIODetailMapper.insertSelective(prodIODetail);
+            //更新已转数
+            saleDetail.setSd_yqty(saleDetail.getSd_qty());
+            saledetailMapper.updateByPrimaryKeySelective(saleDetail);
+
         }
         //更新主表入库状态
-        purchase.setPu_acceptstatus("已入库");
-        purchase.setPu_acceptstatuscode("TURNIN");
+        sale.setSa_sendstatus(Status.TURNOUT.getDisplay());
+        sale.setSa_sendstatuscode(Status.TURNOUT.name());
         //更新存在字段
-        int affect = getMapper().updateByPrimaryKeySelective(purchase);
-    }*/
+         saleMapper.updateByPrimaryKeySelective(sale);
+    }
 
     private void singleUnAudit(Long id) {
         Sale sale = new Sale();

+ 3 - 3
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/entities/ProdIODetail.java

@@ -26,9 +26,9 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private String pd_unit;
 
-    private Integer pd_inqty;
+    private Double pd_inqty;
 
-    private Integer pd_outqty;
+    private Double pd_outqty;
 
     private Double pd_orderprice;
 
@@ -56,7 +56,7 @@ public class ProdIODetail extends CommonBaseEntity implements Serializable {
 
     private String pd_inwhname;
 
-    private Integer pd_orderid;
+    private Long pd_orderid;
 
     private Integer pd_sdid;
 

+ 1 - 1
applications/storage/storage-dto/src/main/java/com/usoftchina/saas/storage/entities/ProdInOut.java

@@ -31,7 +31,7 @@ public class ProdInOut extends CommonBaseEntity implements Serializable {
 
     private String pi_pucode;
 
-    private Integer pi_said;
+    private Long pi_said;
 
     private String pi_sacode;
 

+ 11 - 1
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyDTO.java

@@ -10,6 +10,7 @@ import java.io.Serializable;
  */
 @ApiModel(value = "Company", description = "公司信息")
 public class CompanyDTO implements Serializable{
+    private Long id;
     /**
      * 唯一名称
      */
@@ -21,6 +22,14 @@ public class CompanyDTO implements Serializable{
     private String address;
     private String logoUrl;
 
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
     public String getName() {
         return name;
     }
@@ -56,7 +65,8 @@ public class CompanyDTO implements Serializable{
     @Override
     public String toString() {
         return "CompanyDTO{" +
-                "name='" + name + '\'' +
+                "id=" + id +
+                ", name='" + name + '\'' +
                 ", businessCode='" + businessCode + '\'' +
                 ", address='" + address + '\'' +
                 ", logoUrl='" + logoUrl + '\'' +

+ 65 - 0
base-servers/account/account-dto/src/main/java/com/usoftchina/saas/account/dto/CompanyRegDTO.java

@@ -0,0 +1,65 @@
+package com.usoftchina.saas.account.dto;
+
+import io.swagger.annotations.ApiModel;
+
+import java.io.Serializable;
+
+/**
+ * @author yingp
+ * @date 2018/10/2
+ */
+@ApiModel(value = "CompanyReg", description = "公司注册信息")
+public class CompanyRegDTO implements Serializable{
+    /**
+     * 唯一名称
+     */
+    private String name;
+    /**
+     * 商业登记证号
+     */
+    private String businessCode;
+    private String address;
+    private String logoUrl;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getLogoUrl() {
+        return logoUrl;
+    }
+
+    public void setLogoUrl(String logoUrl) {
+        this.logoUrl = logoUrl;
+    }
+
+    @Override
+    public String toString() {
+        return "CompanyRegDTO{" +
+                "name='" + name + '\'' +
+                ", businessCode='" + businessCode + '\'' +
+                ", address='" + address + '\'' +
+                ", logoUrl='" + logoUrl + '\'' +
+                '}';
+    }
+}

+ 41 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/AccountController.java

@@ -53,6 +53,7 @@ public class AccountController {
         }
 
         account = BeanMapper.map(accountRegDTO, Account.class);
+        account.setEnabled(true);
         account.setSalt(account.getMobile());
         account.setPassword(accountService.getEncryptedPassword(account.getPassword(), account.getSalt()));
         accountService.save(account);
@@ -74,6 +75,10 @@ public class AccountController {
             return Result.error(ExceptionCode.USER_NOT_EXIST);
         }
 
+        if (!account.isEnabled()) {
+            return Result.error(ExceptionCode.USER_NOT_ENABLE);
+        }
+
         boolean checked = accountService.checkPwd(account, password);
         if (!checked) {
             return Result.error(ExceptionCode.USER_PWD_ERROR);
@@ -171,4 +176,40 @@ public class AccountController {
         accountService.unbindRole(accountId, roleId);
         return Result.success();
     }
+
+    /**
+     * 账户禁用
+     *
+     * @param accountId
+     * @return
+     */
+    @PostMapping("/disable")
+    public Result disableAccount(@RequestParam long accountId) {
+        accountService.disable(accountId);
+        return Result.success();
+    }
+
+    /**
+     * 账户启用
+     *
+     * @param accountId
+     * @return
+     */
+    @PostMapping("/enable")
+    public Result enableAccount(@RequestParam long accountId) {
+        accountService.enable(accountId);
+        return Result.success();
+    }
+
+    /**
+     * 账户删除
+     *
+     * @param accountId
+     * @return
+     */
+    @PostMapping("/delete")
+    public Result deleteAccount(@RequestParam long accountId) {
+        accountService.removeByPrimaryKey(accountId);
+        return Result.success();
+    }
 }

+ 18 - 5
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/controller/CompanyController.java

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.account.controller;
 
 import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.account.dto.CompanyRegDTO;
 import com.usoftchina.saas.account.po.Company;
 import com.usoftchina.saas.account.service.CompanyService;
 import com.usoftchina.saas.base.Result;
@@ -23,22 +24,22 @@ public class CompanyController {
     /**
      * 注册
      *
-     * @param companyDTO
+     * @param companyRegDTO
      * @return
      */
     @PostMapping("/register")
-    public Result register(@RequestBody CompanyDTO companyDTO) {
+    public Result register(@RequestBody CompanyRegDTO companyRegDTO) {
         // 判断是否已注册
-        Company company = companyService.findByName(companyDTO.getName());
+        Company company = companyService.findByName(companyRegDTO.getName());
         if (null != company) {
             return Result.error(ExceptionCode.COMPANY_NAME_EXIST);
         }
-        company = companyService.findByBusinessCode(companyDTO.getBusinessCode());
+        company = companyService.findByBusinessCode(companyRegDTO.getBusinessCode());
         if (null != company) {
             return Result.error(ExceptionCode.COMPANY_CODE_EXIST);
         }
 
-        company = BeanMapper.map(companyDTO, Company.class);
+        company = BeanMapper.map(companyRegDTO, Company.class);
         companyService.save(company);
 
         return Result.success();
@@ -75,4 +76,16 @@ public class CompanyController {
         }
         return Result.error(ExceptionCode.COMPANY_NOT_EXIST);
     }
+
+    /**
+     * 删除
+     *
+     * @param companyId
+     * @return
+     */
+    @PostMapping("/delete")
+    public Result delete(@RequestParam Long companyId) {
+        companyService.removeByPrimaryKey(companyId);
+        return Result.success();
+    }
 }

+ 16 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountMapper.java

@@ -24,6 +24,14 @@ public interface AccountMapper {
      */
     int insertSelective(Account account);
 
+    /**
+     * 按ID查找
+     *
+     * @param id
+     * @return
+     */
+    Account selectByPrimaryKey(@Param("id") Long id);
+
     /**
      * 按用户名查找
      *
@@ -55,4 +63,12 @@ public interface AccountMapper {
      * @return
      */
     int deleteByPrimaryKey(@Param("id") Long id);
+
+    /**
+     * 更新启用状态
+     *
+     * @param id
+     * @param enabled
+     */
+    void updateEnabled(@Param("id") Long id, @Param("enabled") Boolean enabled);
 }

+ 9 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/Account.java

@@ -21,6 +21,7 @@ public class Account implements Serializable {
      * 账号类型 0 - 管理员
      */
     private Integer type;
+    private boolean enabled;
     protected Date createTime;
     protected long creatorId;
     protected Date updateTime;
@@ -82,6 +83,14 @@ public class Account implements Serializable {
         this.type = type;
     }
 
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
     public Long getId() {
         return id;
     }

+ 14 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/AccountService.java

@@ -97,4 +97,18 @@ public interface AccountService {
      */
     boolean removeByPrimaryKey(Long id);
 
+    /**
+     * 禁用
+     *
+     * @param accountId
+     */
+    void disable(Long accountId);
+
+    /**
+     * 启用
+     *
+     * @param accountId
+     */
+    void enable(Long accountId);
+
 }

+ 16 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java

@@ -88,4 +88,20 @@ public class AccountServiceImpl implements AccountService {
         accountCompanyMapper.deleteByAccountId(id);
         return accountMapper.deleteByPrimaryKey(id) > 0;
     }
+
+    @Override
+    public void enable(Long accountId) {
+        Account account = accountMapper.selectByPrimaryKey(accountId);
+        if (null != account && !account.isEnabled()) {
+            accountMapper.updateEnabled(accountId, true);
+        }
+    }
+
+    @Override
+    public void disable(Long accountId) {
+        Account account = accountMapper.selectByPrimaryKey(accountId);
+        if (null != account && account.isEnabled()) {
+            accountMapper.updateEnabled(accountId, false);
+        }
+    }
 }

+ 1 - 1
base-servers/account/account-server/src/main/resources/mapper/AccountCompanyMapper.xml

@@ -5,7 +5,7 @@
         insert into ac_account_company(account_id,company_id) values (#{accountId}, #{companyId})
     </insert>
     <delete id="delete">
-        delete from ac_account_company where account_id=#{accountId} and companyId=#{companyId}
+        delete from ac_account_company where account_id=#{accountId} and company_id=#{companyId}
     </delete>
     <delete id="deleteByAccountId" parameterType="java.lang.Long">
         delete from ac_account_company where account_id=#{accountId}

+ 17 - 4
base-servers/account/account-server/src/main/resources/mapper/AccountMapper.xml

@@ -10,18 +10,19 @@
         <result column="email" jdbcType="VARCHAR" property="email"/>
         <result column="mobile" jdbcType="VARCHAR" property="mobile"/>
         <result column="type" jdbcType="INTEGER" property="type"/>
+        <result column="enabled" jdbcType="BOOLEAN" property="enabled"/>
         <result column="creator_id" jdbcType="BIGINT" property="creatorId"/>
         <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="updater_id" jdbcType="BIGINT" property="updaterId"/>
         <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
     </resultMap>
     <sql id="baseColumns">
-        id,username,password,salt,realname,email,mobile,type,creator_id,create_time,updater_id,update_time
+        id,username,password,salt,realname,email,mobile,type,enabled,creator_id,create_time,updater_id,update_time
     </sql>
     <insert id="insert" parameterType="com.usoftchina.saas.account.po.Account">
-        insert into ac_account(username,password,salt,realname,email,mobile,type,creator_id,create_time,updater_id,update_time)
+        insert into ac_account(username,password,salt,realname,email,mobile,type,enabled,creator_id,create_time,updater_id,update_time)
         values (#{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
-        #{realname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
+        #{realname,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{enabled,jdbcType=BOOLEAN},
         #{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP})
     </insert>
     <insert id="insertSelective" parameterType="com.usoftchina.saas.account.po.Account">
@@ -48,6 +49,9 @@
             <if test="type != null">
                 type,
             </if>
+            <if test="enabled != null">
+                enabled,
+            </if>
             <if test="creatorId != null">
                 creator_id,
             </if>
@@ -81,7 +85,10 @@
                 #{mobile,jdbcType=VARCHAR},
             </if>
             <if test="type != null">
-                #{type,jdbcType=INT},
+                #{type,jdbcType=INTEGER},
+            </if>
+            <if test="enabled != null">
+                #{enabled,jdbcType=BOOLEAN},
             </if>
             <if test="creatorId != null">
                 #{creatorId,jdbcType=BIGINT},
@@ -97,6 +104,9 @@
             </if>
         </trim>
     </insert>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select <include refid="baseColumns"/> from ac_account where id=#{id}
+    </select>
     <select id="selectByUsername" parameterType="java.lang.String" resultMap="BaseResultMap">
         select <include refid="baseColumns"/> from ac_account where username=#{username}
     </select>
@@ -109,4 +119,7 @@
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from ac_account where id=#{id}
     </delete>
+    <update id="updateEnabled">
+        update ac_account set enabled=#{enabled,jdbcType=BOOLEAN} where id=#{id,jdbcType=BIGINT}
+    </update>
 </mapper>

+ 118 - 0
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/AccountControllerTest.java

@@ -0,0 +1,118 @@
+package com.usoftchina.saas.account.controller;
+
+import com.usoftchina.saas.account.constant.AccountType;
+import com.usoftchina.saas.account.dto.AccountDTO;
+import com.usoftchina.saas.account.dto.AccountRegDTO;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.test.BaseControllerTest;
+import com.usoftchina.saas.test.TestConstant;
+import org.junit.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MvcResult;
+//import org.springframework.transaction.annotation.Transactional;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+//@Transactional
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class AccountControllerTest extends BaseControllerTest {
+
+    private final String mobile = "13500000000";
+
+    private final String password = "select111***";
+
+    @Test
+    public void testA_register() throws Exception {
+        AccountRegDTO accountRegDTO = new AccountRegDTO();
+        accountRegDTO.setUsername(mobile);
+        accountRegDTO.setMobile(mobile);
+        accountRegDTO.setEmail("jack-ma@mxhichina.com");
+        accountRegDTO.setRealname("Jack Ma");
+        accountRegDTO.setPassword(password);
+        accountRegDTO.setType(AccountType.ADMIN.getType());
+
+        mockMvc.perform(requestBody("/account/register", accountRegDTO))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testB_validByUsernameAndPwd() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/account/pwd/check")
+                .param("username", mobile)
+                .param("password", password))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<AccountDTO> result = result(mvcResult, AccountDTO.class);
+        System.out.println(result.getData());
+        Assert.assertEquals(result.getData().getMobile(), mobile);
+    }
+
+    @Test
+    public void testC_validByUsernameAndErrorPwd() throws Exception {
+        mockMvc.perform(get("/account/pwd/check")
+                .param("username", mobile)
+                .param("password", "1"))
+                .andExpect(isFail());
+    }
+
+    @Test
+    public void testD_getAccount() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        Assert.assertEquals(accountDTO.getMobile(), mobile);
+    }
+
+    private AccountDTO getAccountDTO() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/account")
+                .param("username", mobile))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<AccountDTO> result = result(mvcResult, AccountDTO.class);
+        System.out.println(result.getData());
+        return result.getData();
+    }
+
+    @Test
+    public void testE_bindCompany() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        mockMvc.perform(post("/account/bind/company")
+                .param("accountId", String.valueOf(accountDTO.getId()))
+                .param("companyId", String.valueOf(TestConstant.DEFAULT_COMPANY_ID)))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testF_unbindCompany() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        mockMvc.perform(post("/account/unbind/company")
+                .param("accountId", String.valueOf(accountDTO.getId()))
+                .param("companyId", String.valueOf(TestConstant.DEFAULT_COMPANY_ID)))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testG_disableAccount() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        mockMvc.perform(post("/account/disable")
+                .param("accountId", String.valueOf(accountDTO.getId())))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testH_enableAccount() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        mockMvc.perform(post("/account/enable")
+                .param("accountId", String.valueOf(accountDTO.getId())))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testI_deleteAccount() throws Exception {
+        AccountDTO accountDTO = getAccountDTO();
+        mockMvc.perform(post("/account/delete")
+                .param("accountId", String.valueOf(accountDTO.getId())))
+                .andExpect(isSuccess());
+    }
+}

+ 75 - 0
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/controller/CompanyControllerTest.java

@@ -0,0 +1,75 @@
+package com.usoftchina.saas.account.controller;
+
+import com.usoftchina.saas.account.dto.CompanyDTO;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.test.BaseControllerTest;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.MethodSorters;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MvcResult;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CompanyControllerTest extends BaseControllerTest {
+
+    private final String name = "spring.test";
+    private final String businessCode = "T00000000000000000";
+
+    @Test
+    public void testA_register() throws Exception {
+        CompanyDTO companyDTO = new CompanyDTO();
+        companyDTO.setName(name);
+        companyDTO.setBusinessCode(businessCode);
+        companyDTO.setAddress("深圳市南山区粤海街道高新技术产业园科技南五路英唐大厦六楼");
+        companyDTO.setLogoUrl("https://co-image.qichacha.com/CompanyImage/104eb3c232bbac93393a5e204d6a47d1.jpg?x-oss-process=style/qcc_cmp");
+
+        mockMvc.perform(requestBody("/company/register", companyDTO))
+                .andExpect(isSuccess());
+    }
+
+    @Test
+    public void testB_getByName() throws Exception {
+        CompanyDTO companyDTO = getByName();
+        Assert.assertEquals(companyDTO.getBusinessCode(), businessCode);
+    }
+
+    private CompanyDTO getByName() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/company")
+                .param("name", name))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<CompanyDTO> result = result(mvcResult, CompanyDTO.class);
+        System.out.println(result.getData());
+        return result.getData();
+    }
+
+    private CompanyDTO getByBusinessCode() throws Exception {
+        MvcResult mvcResult = mockMvc.perform(get("/company")
+                .param("businessCode", businessCode))
+                .andExpect(isSuccess())
+                .andReturn();
+        Result<CompanyDTO> result = result(mvcResult, CompanyDTO.class);
+        System.out.println(result.getData());
+        return result.getData();
+    }
+
+    @Test
+    public void testC_getByBusinessCode() throws Exception {
+        CompanyDTO companyDTO = getByBusinessCode();
+        Assert.assertEquals(companyDTO.getName(), name);
+    }
+
+    @Test
+    public void testD_delete() throws Exception {
+        CompanyDTO companyDTO = getByName();
+        mockMvc.perform(post("/company/delete")
+                .param("companyId", String.valueOf(companyDTO.getId())))
+                .andExpect(isSuccess());
+    }
+
+}

+ 8 - 8
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/AccountServiceTest.java

@@ -2,18 +2,18 @@ package com.usoftchina.saas.account.service;
 
 import com.usoftchina.saas.account.constant.AccountType;
 import com.usoftchina.saas.account.po.Account;
-import org.junit.Assert;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
+import org.junit.*;
 import org.junit.runner.RunWith;
 import org.junit.runners.MethodSorters;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
+//import org.springframework.transaction.annotation.Transactional;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
-@FixMethodOrder(MethodSorters.JVM)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+//@Transactional
 public class AccountServiceTest {
 
     @Autowired
@@ -24,12 +24,12 @@ public class AccountServiceTest {
     private final String password = "select111***";
 
     @Test
-    public void save() throws Exception {
+    public void testA_save() throws Exception {
         Account account = new Account();
         account.setMobile(mobile);
         account.setUsername(mobile);
         account.setSalt(mobile);
-        account.setEmail("mayun@mxhichina.com");
+        account.setEmail("jack-ma@mxhichina.com");
         account.setPassword(accountService.getEncryptedPassword(password, account.getSalt()));
         account.setRealname("Jack Ma");
         account.setType(AccountType.ADMIN.getType());
@@ -39,7 +39,7 @@ public class AccountServiceTest {
     }
 
     @Test
-    public void checkPwd() throws Exception {
+    public void testB_checkPwd() throws Exception {
         Account account = accountService.findByMobile(mobile);
         Assert.assertNotNull(account);
         boolean checked = accountService.checkPwd(account, password);
@@ -47,7 +47,7 @@ public class AccountServiceTest {
     }
 
     @Test
-    public void removeByPrimaryKey() throws Exception {
+    public void testC_removeByPrimaryKey() throws Exception {
         Account account = accountService.findByMobile(mobile);
         Assert.assertNotNull(account);
         boolean removed = accountService.removeByPrimaryKey(account.getId());

+ 4 - 6
base-servers/account/account-server/src/test/java/com/usoftchina/saas/account/service/CompanyServiceTest.java

@@ -1,9 +1,7 @@
 package com.usoftchina.saas.account.service;
 
 import com.usoftchina.saas.account.po.Company;
-import org.junit.Assert;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
+import org.junit.*;
 import org.junit.runner.RunWith;
 import org.junit.runners.MethodSorters;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,7 +14,7 @@ import org.springframework.test.context.junit4.SpringRunner;
  */
 @RunWith(SpringRunner.class)
 @SpringBootTest
-@FixMethodOrder(MethodSorters.JVM)
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class CompanyServiceTest {
 
     @Autowired
@@ -25,7 +23,7 @@ public class CompanyServiceTest {
     private final String name = "spring.test";
 
     @Test
-    public void save() {
+    public void testA_save() {
         Company company = new Company();
         company.setName(name);
         company.setBusinessCode("T00000000000000000");
@@ -37,7 +35,7 @@ public class CompanyServiceTest {
     }
 
     @Test
-    public void removeByPrimaryKey() {
+    public void testB_removeByPrimaryKey() {
         Company company = companyService.findByName(name);
         Assert.assertNotNull(company);
         boolean removed = companyService.removeByPrimaryKey(company.getId());

+ 22 - 0
framework/core/src/main/java/com/usoftchina/saas/base/Result.java

@@ -1,9 +1,13 @@
 package com.usoftchina.saas.base;
 
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.usoftchina.saas.exception.BaseException;
 import com.usoftchina.saas.exception.BaseExceptionCode;
+import com.usoftchina.saas.utils.JsonUtils;
+import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
 
 import java.io.Serializable;
+import java.lang.reflect.Type;
 
 /**
  * 结果
@@ -122,4 +126,22 @@ public class Result<T> implements Serializable {
         result.setMessage(e.getMessage());
         return result;
     }
+
+    /**
+     * json字符串转换Result对象
+     *
+     * @param jsonString
+     * @param <T>
+     * @return
+     */
+    public static <T> Result<T> fromJsonString(String jsonString, Class<T> targetCls) {
+        Type[] types = new Type[]{targetCls};
+        final ParameterizedTypeImpl type = ParameterizedTypeImpl.make(Result.class, types, Result.class.getDeclaringClass());
+        return JsonUtils.fromJsonString(jsonString, new TypeReference<Result<T>>() {
+            @Override
+            public Type getType() {
+                return type;
+            }
+        });
+    }
 }

+ 1 - 0
framework/core/src/main/java/com/usoftchina/saas/exception/ExceptionCode.java

@@ -32,6 +32,7 @@ public enum ExceptionCode implements BaseExceptionCode {
     USER_PWD_ERROR(53003, "密码错误"),
     USER_PWD_NOT_EQUALS(53004, "密码与确认密码不一致"),
     USER_NOT_EXIST(53005, "用户不存在"),
+    USER_NOT_ENABLE(53006, "用户禁止使用"),
 
     // 文件相关
     FOLDER_NULL(55000, "文件夹为空"),

+ 12 - 0
framework/core/src/main/java/com/usoftchina/saas/utils/JsonUtils.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.utils;
 
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.springframework.util.StringUtils;
 
@@ -29,4 +30,15 @@ public class JsonUtils {
             return null;
         }
     }
+
+    public static <T> T fromJsonString(String json, TypeReference valueTypeRef) {
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+        try {
+            return mapper.readValue(json, valueTypeRef);
+        } catch (Exception e) {
+            return null;
+        }
+    }
 }

+ 17 - 1
framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java

@@ -1,14 +1,20 @@
 package com.usoftchina.saas.server;
 
+import com.usoftchina.saas.server.error.ServletErrorUtils;
+import com.usoftchina.saas.server.error.UnCaughtErrorFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.lang.Nullable;
 import org.springframework.web.servlet.HandlerExceptionResolver;
 import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.util.NestedServletException;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 
 /**
  * @author yingp
@@ -18,13 +24,23 @@ import javax.servlet.http.HttpServletResponse;
 @ComponentScan(basePackages = {"com.usoftchina.saas.server"})
 public class ServerAutoConfiguration {
 
+    private Logger logger = LoggerFactory.getLogger(UnCaughtErrorFilter.class);
+
     @Bean
     public HandlerExceptionResolver handlerExceptionResolver() {
         return new HandlerExceptionResolver(){
             @Nullable
             @Override
             public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object o, Exception e) {
-                System.err.println("############" + request.getRequestURI() + "#" + response.getStatus());
+                Throwable cause = e;
+                if (e instanceof NestedServletException) {
+                    cause = ((NestedServletException) e).getRootCause();
+                }
+                logger.error(ServletErrorUtils.buildMessage(request, cause), cause);
+                try {
+                    ServletErrorUtils.writerErrorResult(response, cause);
+                } catch (IOException ex) {
+                }
                 return null;
             }
         };

+ 22 - 0
framework/test-starter/pom.xml

@@ -21,5 +21,27 @@
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <scope>compile</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>compile</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>

+ 118 - 0
framework/test-starter/src/main/java/com.usoftchina.saas.test/BaseControllerTest.java

@@ -0,0 +1,118 @@
+package com.usoftchina.saas.test;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.junit.Before;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.ResultMatcher;
+import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*;
+
+/**
+ * @author yingp
+ * @date 2018/10/23
+ */
+public abstract class BaseControllerTest {
+    @Autowired
+    protected WebApplicationContext context;
+
+    protected MockMvc mockMvc;
+
+    @Before
+    public void setup() {
+        this.mockMvc = MockMvcBuilders.webAppContextSetup(context)
+                .alwaysDo(print())
+                .alwaysExpect(isOk())
+                .alwaysExpect(isJson())
+                .build();
+    }
+
+    /**
+     * GET请求
+     *
+     * @param urlTemplate
+     * @return
+     */
+    public static MockHttpServletRequestBuilder get(String urlTemplate) {
+        return MockMvcRequestBuilders.get(urlTemplate);
+    }
+
+    /**
+     * POST form方式请求
+     *
+     * @param urlTemplate
+     * @return
+     */
+    public static MockHttpServletRequestBuilder post(String urlTemplate) {
+        return MockMvcRequestBuilders.post(urlTemplate);
+    }
+
+    /**
+     * POST Payload方式请求,使用@RequestBody注解情况下
+     *
+     * @param object
+     * @return
+     */
+    public static MockHttpServletRequestBuilder requestBody(String urlTemplate, Object object) {
+        return post(urlTemplate).contentType(MediaType.APPLICATION_JSON_UTF8)
+                .content(JsonUtils.toJsonString(object));
+    }
+
+    /**
+     * 是否返回 http status: 200
+     *
+     * @return
+     */
+    public static ResultMatcher isOk() {
+        return status().isOk();
+    }
+
+    /**
+     * 是否返回json格式
+     *
+     * @return
+     */
+    public static ResultMatcher isJson() {
+        return content().contentType(MediaType.APPLICATION_JSON_UTF8);
+    }
+
+    /**
+     * 是否执行成功 {"success": true}
+     *
+     * @return
+     */
+    public static ResultMatcher isSuccess() {
+        return jsonPath("success").value(true);
+    }
+
+    /**
+     * 是否执行失败 {"success": false}
+     *
+     * @return
+     */
+    public static ResultMatcher isFail() {
+        return jsonPath("success").value(false);
+    }
+
+    /**
+     * Result转换
+     *
+     * @param mvcResult
+     * @param <T>
+     * @return
+     * @throws Exception
+     */
+    public static <T> Result<T> result(MvcResult mvcResult, Class<T> targetCls) throws Exception {
+        String content = mvcResult.getResponse().getContentAsString();
+        return Result.fromJsonString(content, targetCls);
+    }
+
+}

+ 16 - 0
framework/test-starter/src/main/java/com.usoftchina.saas.test/TestConstant.java

@@ -0,0 +1,16 @@
+package com.usoftchina.saas.test;
+
+/**
+ * @author yingp
+ * @date 2018/10/22
+ */
+public class TestConstant {
+    /**
+     * 默认企业ID
+     */
+    public static final long DEFAULT_COMPANY_ID = 1;
+    /**
+     * 默认账户ID
+     */
+    public static final long DEFAULT_ACCOUNT_ID = 1;
+}

+ 3 - 3
framework/test-starter/src/main/java/com.usoftchina.saas.test/DefaultContextHolderListener.java → framework/test-starter/src/main/java/com.usoftchina.saas.test/TestContextListener.java

@@ -8,11 +8,11 @@ import org.springframework.test.context.support.AbstractTestExecutionListener;
  * @author yingp
  * @date 2018/10/22
  */
-public class DefaultContextHolderListener extends AbstractTestExecutionListener {
+public class TestContextListener extends AbstractTestExecutionListener {
     @Override
     public void beforeTestClass(TestContext testContext) throws Exception {
         // 设置测试环境默认用户
-        BaseContextHolder.setCompanyId(1);
-        BaseContextHolder.setUserId(1);
+        BaseContextHolder.setCompanyId(TestConstant.DEFAULT_COMPANY_ID);
+        BaseContextHolder.setUserId(TestConstant.DEFAULT_ACCOUNT_ID);
     }
 }

+ 1 - 1
framework/test-starter/src/main/resources/META-INF/spring.factories

@@ -1,3 +1,3 @@
 # Test Execution Listeners
 org.springframework.test.context.TestExecutionListener=\
-com.usoftchina.saas.test.DefaultContextHolderListener
+com.usoftchina.saas.test.TestContextListener

+ 27 - 33
frontend/saas-web/app/util/FormUtil.js

@@ -36,22 +36,6 @@ Ext.define('saas.util.FormUtil', {
                         Ext.apply(item, cusItem);
                     });
                     Ext.Array.each(items, function(item) {
-                        var bind = item.bind,
-                        bindName = bind,
-                        defaultValue = item.defaultValue;
-                        
-                        if(bindName && !Ext.isString(bindName)) {
-                            bindName = bindName.value;
-                        }
-                        if(bindName) {
-                            bindName = bindName.replace(/[{|}]/g, '');
-                        }
-
-                        // 设置初始值
-                        if(defaultValue) {
-                            formModel.set(bindName, defaultValue);
-                        }
-
                         // 设置必填
                         if(item.allowBlank==false){
                             // TODO 需要判断类型
@@ -60,20 +44,24 @@ Ext.define('saas.util.FormUtil', {
 
                         // 如果是从表为其绑定store
                         if(item.xtype == 'detailGridField') {
+                            var index = form.detailCount;
                             var columns = item.columns,
                             cnames = columns.filter(function(c) {
                                 return c.dataIndex && !c.ignore;
                             }).map(function(c) {
                                 return c.dataIndex
                             });
-                            formModel.set('detailBindFields', cnames);
+
+                            formModel.set('detail' + index + '.detailBindFields', cnames);
                             item.bind = {
-                                store: '{detailStore}'
+                                store: '{detail' + index + '.detailStore}'
                             };     
-                            formModel.set('detailStore', Ext.create('Ext.data.Store', {
+                            formModel.set('detail' + index + '.detailStore', Ext.create('Ext.data.Store', {
                                 model:item.storeModel,
                                 data: []
                             }));
+
+                            form.detailCount++;
                         }
                     });
                 }
@@ -104,10 +92,20 @@ Ext.define('saas.util.FormUtil', {
                 form.setLoading(false);
                 var res = Ext.decode(response.responseText);
                 if(res.success) {
-                    form.setFormData({
-                        main: res.data.main,
-                        detail: res.data.items
-                    });
+                    var d = res.data;
+                    var o = {
+                        main: d.main
+                    };
+                    if(d.items) {
+                        o.detail0 = d.items;
+                    }else {
+                        var idx = 1;
+                        while(d['item' + idx]) {
+                            o['detail' + (idx - 1)] = d['item' + idx];
+                            idx++;
+                        }
+                    }
+                    form.setFormData(o);
                 }
             })
             .catch(function(response) {
@@ -117,7 +115,7 @@ Ext.define('saas.util.FormUtil', {
         }else{
             //取后台编号
             me.BaseUtil.request({
-                url: 'http://192.168.253.58:8900/number/getMaxnumber',
+                url: 'http://192.168.253.228:8900/number/getMaxnumber',
                 params: {
                     caller:form.caller
                 },
@@ -128,15 +126,11 @@ Ext.define('saas.util.FormUtil', {
                 if(res.success){
                     var code = res.data.code;
                     var viewModel = form.getViewModel();
-                    var detailStore = viewModel.get('_detailStore');
-                    var detno = 0,datas=[];
-                    Ext.Array.each(new Array(10), function() {
-                        detno += 1;
-                        var data = {};
-                        data[form._detnoColumn] = detno;
-                        datas.push(data);
-                    })
-                    detailStore.loadData(datas);
+                    var detailGrids = form.query('detailGridField');
+
+                    Ext.Array.each(detailGrids, function(grid) {
+                        grid.add10EmptyRow();
+                    });
                     if(code){
                         viewModel.set(form._codeField,code);
                     }

+ 47 - 0
frontend/saas-web/app/view/core/baseform/FormPanel.js

@@ -0,0 +1,47 @@
+Ext.define('saas.view.core.baseform.FormPanel', {
+    extend: 'Ext.form.Panel',
+    xtype: 'core-baseform-formpanel',
+    controller: 'core-baseform-formpanel',
+    viewModel: 'core-baseform-formpanel',
+
+    //工具类
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+
+    //基础属性
+    layout: 'column',
+    autoScroll: true,
+    border: 1,
+    bodyPadding: 5,
+    searchField:[],
+
+    fieldDefaults: {
+        margin: '0 5 5 0',
+        labelAlign: 'right',
+        labelWidth: 90,
+        columnWidth: 0.25,
+        blankText: '该字段不能为空'
+    },
+
+    initComponent: function() {
+
+        var me = this;
+
+        Ext.apply(me, {
+            dockedItems: [{
+                xtype: 'toolbar',
+                dock: 'top',
+                style: {
+                    'border-bottom': '1px solid #35baf6 !important'
+                },
+                items: me.searchField.concat([{
+                    cls:'x-formpanel-btn-orange',
+                    xtype: 'button',
+                    text: '查询',
+                    handler: 'query'
+                }])
+            }]
+        });
+        me.callParent(arguments);
+    }
+});

+ 168 - 0
frontend/saas-web/app/view/core/baseform/FormPanelController.js

@@ -0,0 +1,168 @@
+Ext.define('saas.view.core.baseform.FormPanelController', {
+    extend: 'Ext.app.ViewController',
+    alias: 'controller.core-baseform-formpanel',
+
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+    FormUtil: Ext.create('saas.util.FormUtil'),
+
+    auditBtnClick: function() {
+        var me = this,
+        form = me.getView(),
+        statusCodeField = form._statusCodeField,
+        viewModel = me.getViewModel(),
+        status = viewModel.get(statusCodeField);
+
+        status == 'AUDITED' ? me.unAudit() : me.audit();
+    },
+
+    add: function(){
+        var form = this.getView();
+        var id = form.xtype + '_add';
+        openTab(form.xtype,'新增' + form._title,id);
+    },
+    
+    delete: function(){
+        var me = this;
+        var form = this.getView();
+        var id = form.getForm().findField(form._idField);
+        var code = form.getForm().findField(form._codeField);
+        if(id&&id.value!=0){
+            me.BaseUtil.request({
+                url: form._deleteUrl+id.value,
+                method: 'GET',
+            })
+            .then(function(res) {
+                var localJson = new Ext.decode(res.responseText);
+                if(localJson.success){
+                    var mainTab = Ext.getCmp('main-tab-panel');
+                    mainTab.getActiveTab().close();
+                    //解析参数
+                    Ext.Msg.alert('提示','删除成功');
+                }
+            })
+            .catch(function() {
+                Ext.Msg.alert('提示','删除失败');
+            });
+        }
+    },
+
+    onSave: function() {
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel(),
+        modelData = viewModel.getData(),
+        detailBindFields = modelData._detailBindFields;
+
+        if(form.getForm().wasDirty==false){
+            Ext.Msg.alert('提示','未修改数据,请修改后保存');
+            return false;
+        }
+        if(form.getForm().wasValid==false){
+            Ext.Msg.alert('提示','表单校验有误,请检查');
+            return false;
+        }
+        //form里面数据
+        var formData = form.getFormData();
+        
+        me.save(formData);
+    },
+
+    save:function(formData){
+        var me = this,
+        form = this.getView(),
+        viewModel = me.getViewModel(),
+        modelData = viewModel.getData(),
+        detailBindFields = modelData._detailBindFields;
+
+        var gridData = formData.detail?formData.detail:[];
+        var dirtyGridData = [];
+        if(gridData.length>0){
+            Ext.each(gridData, function(item,index){
+                var d = Object.assign({}, item.data),
+                dirty = item.dirty;
+                if(dirty){
+                    if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
+                        d.id = 0;
+                    }
+                    for(k in d) {
+                        if(!Ext.Array.contains(detailBindFields, k)) {
+                            delete d[k];
+                        }
+                    }
+                    dirtyGridData.push(d);
+                }
+            });
+        }
+        var params = {
+            main:formData.main,
+            items:dirtyGridData
+        }
+        me.BaseUtil.request({
+            url: form._saveUrl,
+            params: JSON.stringify(params),
+            method: 'POST',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','保存成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','保存失败');
+        });
+    },
+
+    audit: function(){
+        var me = this;
+        var form = this.getView();
+        if(form.getForm().wasDirty==false){
+            Ext.Msg.alert('提示','未修改数据,请修改后保存');
+            return false;
+        }
+        if(form.getForm().wasValid==false){
+            Ext.Msg.alert('提示','表单校验有误,请检查');
+            return false;
+        }
+        //form里面数据
+        var formData = form.getFormData();
+        var gridData = formData.detail?formData.detail:[];
+        var dirtyGridData = [];
+        if(gridData.length>0){
+            Ext.each(gridData, function(item,index){
+                if(item.dirty){
+                    if((typeof item.data.id) != "number" && item.data.id.indexOf('extMode')>-1){
+                        item.data.id = 0;
+                    }
+                    dirtyGridData.push(item.data)
+                }
+            });
+        }   
+        var params = {
+            main:formData.main,
+            items:dirtyGridData
+        }
+        me.BaseUtil.request({
+            url: form._auditUrl,
+            params: JSON.stringify(params),
+            method: 'POST',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','审核成功');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','审核失败');
+        });
+    },
+    unAudit: function() {
+        console.log('反审核');
+        return;
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/core/baseform/FormPanelModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.core.baseform.FormPanelModel', {
+    extend: 'Ext.app.ViewModel',
+    alias: 'viewmodel.core-baseform-formpanel',
+});

+ 145 - 0
frontend/saas-web/app/view/core/baseform/GridPanel.js

@@ -0,0 +1,145 @@
+Ext.define('saas.view.core.baseform.GridPanel', {
+    extend: 'Ext.grid.Panel',
+    xtype: 'core-baseform-gridpanel',
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+    dataUrl: '',
+    dbSearchFields: [],
+    condition:'',
+    frame:true,
+
+    initComponent: function() {
+        var me = this;
+        if(me.columns){
+            var fields = me.columns.map(column => column.dataIndex);
+            me.store = Ext.create('Ext.data.Store',{
+                fields:fields,
+                autoLoad: true,
+                pageSize: 6,
+                data: [],
+                proxy: {
+                    type: 'ajax',
+                    url: me.dataUrl,
+                    actionMethods: {
+                        read: 'GET'
+                    },
+                    reader: {
+                        type: 'json',
+                        rootProperty: 'data.list',
+                        totalProperty: 'data.total',
+                    }
+                },
+                listeners: {
+                    beforeload: function (store, op) {
+                        var condition = me.condition;
+                        if (Ext.isEmpty(condition)) {
+                            condition = " 1=1 ";
+                        }
+                        Ext.apply(store.proxy.extraParams, {
+                            number: op._page,
+                            size: store.pageSize,
+                            keyword: condition
+                        });
+                    }
+                }
+            });
+
+            Ext.apply(me, {
+                dockedItems:[{
+                    xtype:'toolbar',
+                    dock:'top',
+                    items:['->',{
+                        xtype:'button',
+                        text:'新增',
+                        handler:function(b){
+                        }
+                    }, {
+                        text: '导入',
+                        handler: me.onImport,
+                        menu: {
+                            width: 80,
+                            items: [{
+                                text:'导出',
+                                handler:function(){
+                                    me.onExport(this)
+                                }
+                            }],
+                            listeners: {
+                                'mouseleave':function(enu){
+                                    this.hide();
+                                } 
+                            }
+                        }
+                    },{
+                        text: '禁用',
+                        handler: me.onCloseOrder,
+                        menu: {
+                            width: 80,
+                            items: [{
+                                text:'启用',
+                                handler:function(){
+                                    me.onOpenOrder(this)
+                                }
+                            }],
+                            listeners: {
+                                'mouseleave':function(enu){
+                                    this.hide();
+                                } 
+                            }
+                        }
+                    }, {
+                        text: '删除',
+                        handler: me.onDelete
+                    }, {
+                        text: '刷新',
+                        handler: me.onLoad
+                    }]
+                },{
+                    xtype: 'pagingtoolbar',
+                    dock: 'bottom',
+                    displayInfo: true,
+                    emptyMsg: "暂无数据",
+                    store: me.store,
+                    displayMsg: '显示{0}到{1}条数据,共有{2}条',
+                    beforePageText: "当前第",
+                    afterPageText: "页,共{0}页"
+                }]
+            });
+        }
+        me.callParent(arguments);
+    },
+
+    loadData: function(grid, url) {
+        this.BaseUtil.request({url})
+        .then(function(response) {
+            var data = Ext.decode(response.responseText);
+                grid.getStore().loadData(data.data);
+                grid.fireEvent('afterLoadData', grid, data.data);
+                grid.setLoading(false);
+        })
+        .catch(function(response) {
+            // something...
+        });
+    },
+
+    listeners:{
+        afterrender:function(grid){
+            if(grid.dataUrl){
+                grid.setLoading(true);
+                grid.loadData(grid, grid.dataUrl);
+            }
+        }
+    },
+
+    getCondition: function(f,conditionExpression){
+        var condition = '';
+        if((f.xtype == 'checkbox' || f.xtype == 'radio')&&f.logic){
+            
+        }else if(f.xtype=='textfield'&&f.value!=''){
+            condition=conditionExpression.replace(new RegExp("\\{0}","g"), f.value);
+        }
+        if(condition.length>0){
+            condition+= ' AND ';
+        }
+        return condition;
+    }
+});

+ 1 - 3
frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js

@@ -17,6 +17,7 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
                 data: [],
                 proxy: {
                     type: 'ajax',
+                    timeout:8000,
                     url: me.dataUrl,
                     actionMethods: {
                         read: 'GET'
@@ -88,7 +89,6 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
             var data = Ext.decode(response.responseText);
                 grid.getStore().loadData(data.data);
                 grid.fireEvent('afterLoadData', grid, data.data);
-                grid.setLoading(false);
         })
         .catch(function(response) {
             // something...
@@ -98,13 +98,11 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
     listeners:{
         afterrender:function(grid){
             if(grid.dataUrl){
-                grid.setLoading(true);
                 grid.loadData(grid, grid.dataUrl);
             }
         },
         itemClick: function(view,record) {
             var me = this;
-            debugger;
             var dbfinds = me.dbfinds;
             if(dbfinds&&dbfinds.length>0){
                 if(me.belong=='grid'){

+ 1 - 2
frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js

@@ -47,6 +47,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                 proxy: {
                     type: 'ajax',
                     url: me.dataUrl,
+                    timeout:8000,
                     actionMethods: {
                         read: 'GET'
                     },
@@ -260,7 +261,6 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
             var data = Ext.decode(response.responseText);
                 grid.getStore().loadData(data.data);
                 grid.fireEvent('afterLoadData', grid, data.data);
-                grid.setLoading(false);
         })
         .catch(function(response) {
             // something...
@@ -270,7 +270,6 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
     listeners:{
         afterrender:function(grid){
             if(grid.dataUrl){
-                grid.setLoading(true);
                 grid.loadData(grid, grid.dataUrl);
             }
         }//,

+ 31 - 23
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -12,6 +12,7 @@ Ext.define('saas.view.core.form.FormPanel', {
     _codeField: '',
     _statusField: '',
     _idField: '',
+    detailCount: 0,
 
     //基础属性
     initId: 0,
@@ -90,22 +91,22 @@ Ext.define('saas.view.core.form.FormPanel', {
         
         var o = {};
         o[statusField] = {
-            bind: '{' + statusCodeField + '}',
+            bind: '{form.' + statusCodeField + '}',
             get: function(value) {
                 return value == 'AUDITED' ? '已审核' : '未审核'
             }
         };
         o['auditBtnText'] = {
-            bind: '{' + statusCodeField + '}',
+            bind: '{form.' + statusCodeField + '}',
             get: function(value) {
                 return value == 'AUDITED' ? '反审核' : '审核'
             }
         };
         viewModel.setFormulas(o);
 
-        viewModel.set('createTime', new Date());
-        viewModel.set('updateTime', new Date());
-        statusCodeField ? viewModel.set(statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
+        viewModel.set('form.createTime', new Date());
+        viewModel.set('form.updateTime', new Date());
+        statusCodeField ? viewModel.set('form.' + statusCodeField, "UNAUDITED") : viewModel.set('auditBtnText', "审核");
     },
 
     addItems: function(items) {
@@ -122,24 +123,37 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel(),
         allData = viewModel.getData(),
         formData = allData['form'],
-        detailStore = allData['detailStore'],
+        detailCount = me.detailCount,
         data = {
             main: formData,
-            detail: detailStore.getData().items
         };
 
+        for(var i = 0; i < detailCount; i++) {
+            var detail = allData['detail' + i],
+            store = detail.detailStore;
+
+            data['detail' + i] = store.getData().items;
+        }
+
         return data;
     },
 
     setFormData: function(formData) {
         var me = this,
         main = formData.main,
-        detail = formData.detail,
+        detailCount = me.detailCount,
         viewModel = me.getViewModel(),
-        detailStore = viewModel.get('detailStore');
+        viewData = viewModel.getData();
+
+        viewModel.set('form', main);
 
-        viewModel.setData(main);
-        detailStore.loadData(detail);
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i],
+            detail = viewData['detail' + i],
+            store = detail.detailStore;
+
+            store.loadData(detailData);
+        }
     },
 
     /**
@@ -150,11 +164,16 @@ Ext.define('saas.view.core.form.FormPanel', {
         viewModel = me.getViewModel();
 
         Ext.Array.each(items, function(item) {
-            var bind = item.bind,
+            var xtype = item.xtype,
+            bind = item.bind,
             name = item.name,
             ignore = item.ignore,
             defaultValue = item.defaultValue;
 
+            if(xtype == 'detailGridField') {
+                return;
+            }
+
             // 设置model绑定
             if(!ignore) {
                 if(bind) {
@@ -179,15 +198,4 @@ Ext.define('saas.view.core.form.FormPanel', {
 
         });
     },
-
-    initFormData: function(formData) {
-        var me = this,
-        main = formData.main,
-        detail = formData.detail,
-        viewModel = me.getViewModel();
-
-        viewModel.setData(main);
-        // viewModel.set('detailGridField');
-    }
-    
 });

+ 58 - 23
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -67,16 +67,24 @@ Ext.define('saas.view.core.form.FormPanelController', {
     save:function(formData){
         var me = this,
         form = this.getView(),
+        detailCount = form.detailCount,
         viewModel = me.getViewModel(),
-        modelData = viewModel.getData(),
-        detailBindFields = modelData.detailBindFields;
+        modelData = viewModel.getData();
 
-        var gridData = formData.detail?formData.detail:[];
-        var dirtyGridData = [];
-        if(gridData.length>0){
-            Ext.each(gridData, function(item,index){
+        var params = {
+            main:formData.main
+        };
+
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i];
+            var modelDetail = modelData['detail' + i];
+            var dirtyGridData = [];
+            var detailBindFields = modelDetail.detailBindFields;
+
+            Ext.Array.each(detailData, function(item){
                 var d = Object.assign({}, item.data),
                 dirty = item.dirty;
+
                 if(dirty){
                     if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
                         d.id = 0;
@@ -89,11 +97,15 @@ Ext.define('saas.view.core.form.FormPanelController', {
                     dirtyGridData.push(d);
                 }
             });
+            params['item' + ( i + 1)] = dirtyGridData;
         }
-        var params = {
-            main:formData.main,
-            items:dirtyGridData
+
+        // 只有一个从表时从表字段改为items
+        if(detailCount == 1) {
+            params.items = params.item1;
+            delete params.item1;
         }
+
         me.BaseUtil.request({
             url: form._saveUrl,
             params: JSON.stringify(params),
@@ -113,8 +125,12 @@ Ext.define('saas.view.core.form.FormPanelController', {
     },
 
     audit: function(){
-        var me = this;
-        var form = this.getView();
+        var me = this,
+        form = this.getView(),
+        detailCount = form.detailCount,
+        viewModel = me.getViewModel(),
+        modelData = viewModel.getData();
+        
         if(form.getForm().wasDirty==false){
             Ext.Msg.alert('提示','未修改数据,请修改后保存');
             return false;
@@ -125,22 +141,41 @@ Ext.define('saas.view.core.form.FormPanelController', {
         }
         //form里面数据
         var formData = form.getFormData();
-        var gridData = formData.detail?formData.detail:[];
-        var dirtyGridData = [];
-        if(gridData.length>0){
-            Ext.each(gridData, function(item,index){
-                if(item.dirty){
-                    if((typeof item.data.id) != "number" && item.data.id.indexOf('extMode')>-1){
-                        item.data.id = 0;
+        var params = {
+            main: formData.main
+        };
+
+        for(var i = 0; i < detailCount; i++) {
+            var detailData = formData['detail' + i];
+            var modelDetail = modelData['detail' + i];
+            var dirtyGridData = [];
+            var detailBindFields = modelDetail.detailBindFields;
+
+            Ext.Array.each(detailData, function(item){
+                var d = Object.assign({}, item.data),
+                dirty = item.dirty;
+
+                if(dirty){
+                    if((typeof d.id) != "number" && d.id.indexOf('-')>-1){
+                        d.id = 0;
+                    }
+                    for(k in d) {
+                        if(!Ext.Array.contains(detailBindFields, k)) {
+                            delete d[k];
+                        }
                     }
-                    dirtyGridData.push(item.data)
+                    dirtyGridData.push(d);
                 }
             });
-        }   
-        var params = {
-            main:formData.main,
-            items:dirtyGridData
+            params['item' + ( i + 1)] = dirtyGridData;
+        }
+
+        // 只有一个从表时从表字段改为items
+        if(detailCount == 1) {
+            params.items = params.item1;
+            delete params.item1;
         }
+
         me.BaseUtil.request({
             url: form._auditUrl,
             params: JSON.stringify(params),

+ 4 - 2
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -3,14 +3,16 @@ Ext.define('saas.view.core.form.FormPanelModel', {
     alias: 'viewmodel.core-form-formpanel',
 
     data: {
-        id:0,
+        form: {
+            id: 0
+        },
         detailBindeFields: [], // 从表绑定列
         detailStore: null, // 从表store
     },
 
     formulas:{
         deleteHidden:{
-            bind:'{id}',
+            bind:'{form.id}',
             get:function(value){
                 return !value;
             }

+ 7 - 9
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -92,14 +92,13 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     add10EmptyRow: function() {
         var me = this,
-        form = me.ownerCt,
-        detnoColumn = form._detnoColumn,
+        detnoColumn = me._detnoColumn,
         store = me.getStore(),
         selectedRecord = me.selModel.lastSelected,
         datas = [];
 
         //当前行后序号全部加1
-        var detno = selectedRecord.data[form._detnoColumn];
+        var detno = selectedRecord ? selectedRecord.data[detnoColumn] : 0;
         Ext.Array.each(new Array(10), function() {
             detno += 1;
             var data = {};
@@ -111,15 +110,14 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     addDetail: function() {
         var me = this,
-            form = me.ownerCt,
-            detnoColumn = form._detnoColumn,
+            detnoColumn = me._detnoColumn,
             store = me.getStore(),
             selectedRecord = me.selModel.lastSelected,
             detno = 0;
 
         //当前行后序号全部加1
         if(selectedRecord){
-            detno = selectedRecord.data[form._detnoColumn];
+            detno = selectedRecord.data[detnoColumn];
             var store = me.store;
             store.each(function(item){
                 d = item.data[detnoColumn];
@@ -183,14 +181,13 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
 
     swap: function(from, index, dir) {
         var me = this,
-        form = me.ownerCt,
         store = me.getStore(),
         to = store.getAt(index + dir);
 
         if(from && to) {
             var keys = me.getColumns().map(function(c) {
                 //剔除序号字段
-                if(c.dataIndex!=form._detnoColumn){
+                if(c.dataIndex!=me._detnoColumn){
                     return c.dataIndex 
                 }
             }),
@@ -205,5 +202,6 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
             //聚焦目标行
             me.selModel.select(to);
         }
-    }
+    },
+
 });

+ 7 - 1
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -39,6 +39,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                 proxy: {
                     type: 'ajax',
                     url: me.baseVastUrl+'list',
+                    timeout: 8000,
                     actionMethods: {
                         read: 'GET'
                     },
@@ -68,6 +69,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                             condition: JSON.stringify(condition)
                         });
     
+                    },
+                    requestexception: function() {
+                        debugger;
                     }
                 }
             }),
@@ -185,7 +189,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             idValue = record.get(grid.idField),
             codeValue = record.get(grid.codeField),
             id = grid.xtype + idValue;
-            openTab(grid.addXtype,grid.addTitle+"("+codeValue+")",id);
+            openTab(grid.addXtype,grid.addTitle+"("+codeValue+")",id, {
+                initId: idValue
+            });
         }
     },
     getFields: function() {

+ 7 - 3
frontend/saas-web/app/view/core/tab/Controller.js

@@ -5,11 +5,15 @@ Ext.define('saas.view.core.tab.Controller', {
     init: function() {
         var me = this,
         tab = me.getView(),
-        viewType = tab.viewType;
+        viewType = tab.viewType,
+        viewConfig = tab.viewConfig;
 
-        tab.add({
+        var view = {
             xtype: viewType
-        });
+        };
+        Ext.apply(view, viewConfig);
+
+        tab.add(view);
     },
 
 });

+ 124 - 0
frontend/saas-web/app/view/document/customer/FormPanel.js

@@ -0,0 +1,124 @@
+Ext.define('saas.view.document.customer.FormPanel', {
+    extend: 'saas.view.core.baseform.FormPanel',
+    xtype: 'document-customer-formpanel',
+    controller: 'document-customer-formpanel',
+    viewModel: 'document-customer-formpanel',
+
+    //工具类
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+
+    //基础属性
+    layout: 'fit',
+    autoScroll: true,
+    border: 1,
+    bodyPadding: 5,
+
+    fieldDefaults: {
+        margin: '0 5 5 0',
+        labelAlign: 'right',
+        labelWidth: 90,
+        blankText: '该字段不能为空'
+    },
+
+    //字段属性
+    _title:'客户管理',
+    _dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+    _saveUrl:'http://192.168.253.228:8800/api/document/vendor/save',
+    _deleteUrl:'http://192.168.253.228:8800/api/document/vendor/delete',
+
+    initComponent: function () {
+        var me = this;
+        Ext.apply(me, {
+            items: [{
+                name : "vendorGrid", 
+                xtype : "core-baseform-gridpanel", 
+                layout:'fit',
+                dataUrl:me._dataUrl,
+                columns : [
+                    {
+                        text : "序号", 
+                        dataIndex : "pd_detno", 
+                        width : 100, 
+                        xtype : "numbercolumn",
+                        align : 'center',
+                        format:'0',
+                        summaryType: 'count',
+                        summaryRenderer: function(value, summaryData, dataIndex) {
+                            return Ext.String.format('合计: {0}条', value);
+                        },
+                    }, 
+                    {
+                        editor : {
+                            displayField : "display", 
+                            editable : true, 
+                            format : "", 
+                            hideTrigger : false, 
+                            maxLength : 100.0, 
+                            minValue : null, 
+                            positiveNum : false, 
+                            queryMode : "local", 
+                            store : null, 
+                            valueField : "value", 
+                            xtype : "multidbfindtrigger"
+                        }, 
+                        text : "物料编号", 
+                        width : 200.0, 
+                        dataIndex : "pd_prodcode", 
+                        xtype : "", 
+                        items : null
+                    }, 
+                    {
+                        text : "单位", 
+                        editor : {
+                            xtype : "textfield"
+                        },
+                        dataIndex : "pd_unit", 
+                        width : 120.0, 
+                        xtype : "", 
+                        items : null
+                    }, 
+                    {
+                        text : "数量", 
+                        dataIndex : "pd_yqty", 
+                        editor : {
+                            xtype : "numberfield"
+                        },
+                        width : 120.0, 
+                        xtype : "numbercolumn", 
+                        format:'0',
+                        items : null,
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "单价", 
+                        editor : {
+                            xtype : "numberfield"
+                        },
+                        format:'0,000.00',
+                        dataIndex : "pd_price", 
+                        width : 120.0, 
+                        xtype : "numbercolumn",
+                        items : null,
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "总额", 
+                        dataIndex : "pd_total", 
+                        width : 120.0, 
+                        xtype : "numbercolumn",
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "税额", 
+                        dataIndex : "pd_taxtotal", 
+                        flex : 1.0, 
+                        xtype : "numbercolumn",
+                        summaryType: 'sum'
+                    }
+                ]
+            }]
+        });
+        me.callParent(arguments);
+    }
+});

+ 11 - 0
frontend/saas-web/app/view/document/customer/FormPanelController.js

@@ -0,0 +1,11 @@
+Ext.define('saas.view.document.customer.FormPanelController', {
+    extend: 'saas.view.core.baseform.FormPanelController',
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    alias: 'controller.document-customer-formpanel',
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/document/customer/FormPanelModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.document.customer.FormPanelModel', {
+    extend: 'saas.view.core.baseform.FormPanelModel',
+    alias: 'viewmodel.document-customer-formpanel'
+});

+ 3 - 3
frontend/saas-web/app/view/document/kind/ChildForm.js

@@ -30,14 +30,14 @@ Ext.define('KitchenSink.view.binding.ChildForm', {
         customerkind:{
             items:[{
                 xtype:'hidden',
-                name:'ck_id'
+                name:'id'
             },{
                 xtype:'textfield',
-                name:'ck_kind',
+                name:'ck_name',
                 allowBlank:false,
                 fieldLabel:'类型'
             }],
-            keyField:'ck_id',
+            keyField:'id',
             saveUrl:''
         },
         vendorkind:{

+ 5 - 12
frontend/saas-web/app/view/document/kind/Kind.js

@@ -62,20 +62,13 @@ Ext.define('saas.view.document.kind.Kind', {
         customerkind:{
             columns: [{
                 text: '客户类型',
-                dataIndex: 'ck_kind',
+                dataIndex: 'ck_name',
                 flex: 1
             }],
-            formItems:[{
-               xtype:'hidden',
-               name:'ck_id'
-            },{
-                xtype:'textfield',
-                name:'ck_kind',
-                allowBlank:false,
-                fieldLabel:'类型'
-            }],
-            keyField:'ck_id',
-            reqUrl:''
+            keyField:'id',
+            dataField:'ck_name',
+            reqUrl:'http://192.168.253.41:9480/customerkind/save',
+            delUrl:'http://192.168.253.41:9480/customerkind/delete'
         },
         vendorkind:{
             columns: [{

+ 8 - 5
frontend/saas-web/app/view/document/kind/KindModel.js

@@ -10,19 +10,22 @@ Ext.define('saas.view.document.kind.KindModel', {
     stores: {
         customerkind: {
             fields:[
-                {name: 'ck_id', type: 'int'},
-                {name: 'ck_kind',  type: 'string'}
+                {name: 'id', type: 'int'},
+                {name: 'ck_name',  type: 'string'}
             ],
             proxy: {
                 type: 'ajax',
-                url: 'resources/json/customer.json',
+                url: 'http://192.168.253.41:9480/customerkind/getAll',
+                actionMethods: {
+                    read: 'GET'
+                },
                 reader: {
-                    type: 'json'
+                    type: 'json',
+                    rootProperty: 'data'
                 }
             },
             pageSize: null,
             autoLoad: true
-
         },
         vendorkind:{
             fields:[

+ 124 - 0
frontend/saas-web/app/view/document/vendor/FormPanel.js

@@ -0,0 +1,124 @@
+Ext.define('saas.view.document.vendor.FormPanel', {
+    extend: 'saas.view.core.baseform.FormPanel',
+    xtype: 'document-vendor-formpanel',
+    controller: 'document-vendor-formpanel',
+    viewModel: 'document-vendor-formpanel',
+
+    //工具类
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+
+    //基础属性
+    layout: 'fit',
+    autoScroll: true,
+    border: 1,
+    bodyPadding: 5,
+
+    fieldDefaults: {
+        margin: '0 5 5 0',
+        labelAlign: 'right',
+        labelWidth: 90,
+        blankText: '该字段不能为空'
+    },
+
+    //字段属性
+    _title:'供应商管理',
+    _dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+    _saveUrl:'http://192.168.253.228:8800/api/document/vendor/save',
+    _deleteUrl:'http://192.168.253.228:8800/api/document/vendor/delete',
+
+    initComponent: function () {
+        var me = this;
+        Ext.apply(me, {
+            items: [{
+                name : "vendorGrid", 
+                xtype : "core-baseform-gridpanel", 
+                layout:'fit',
+                dataUrl:me._dataUrl,
+                columns : [
+                    {
+                        text : "序号", 
+                        dataIndex : "pd_detno", 
+                        width : 100, 
+                        xtype : "numbercolumn",
+                        align : 'center',
+                        format:'0',
+                        summaryType: 'count',
+                        summaryRenderer: function(value, summaryData, dataIndex) {
+                            return Ext.String.format('合计: {0}条', value);
+                        },
+                    }, 
+                    {
+                        editor : {
+                            displayField : "display", 
+                            editable : true, 
+                            format : "", 
+                            hideTrigger : false, 
+                            maxLength : 100.0, 
+                            minValue : null, 
+                            positiveNum : false, 
+                            queryMode : "local", 
+                            store : null, 
+                            valueField : "value", 
+                            xtype : "multidbfindtrigger"
+                        }, 
+                        text : "物料编号", 
+                        width : 200.0, 
+                        dataIndex : "pd_prodcode", 
+                        xtype : "", 
+                        items : null
+                    }, 
+                    {
+                        text : "单位", 
+                        editor : {
+                            xtype : "textfield"
+                        },
+                        dataIndex : "pd_unit", 
+                        width : 120.0, 
+                        xtype : "", 
+                        items : null
+                    }, 
+                    {
+                        text : "数量", 
+                        dataIndex : "pd_yqty", 
+                        editor : {
+                            xtype : "numberfield"
+                        },
+                        width : 120.0, 
+                        xtype : "numbercolumn", 
+                        format:'0',
+                        items : null,
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "单价", 
+                        editor : {
+                            xtype : "numberfield"
+                        },
+                        format:'0,000.00',
+                        dataIndex : "pd_price", 
+                        width : 120.0, 
+                        xtype : "numbercolumn",
+                        items : null,
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "总额", 
+                        dataIndex : "pd_total", 
+                        width : 120.0, 
+                        xtype : "numbercolumn",
+                        summaryType: 'sum'
+                    }, 
+                    {
+                        text : "税额", 
+                        dataIndex : "pd_taxtotal", 
+                        flex : 1.0, 
+                        xtype : "numbercolumn",
+                        summaryType: 'sum'
+                    }
+                ]
+            }]
+        });
+        me.callParent(arguments);
+    }
+});

+ 11 - 0
frontend/saas-web/app/view/document/vendor/FormPanelController.js

@@ -0,0 +1,11 @@
+Ext.define('saas.view.document.vendor.FormPanelController', {
+    extend: 'saas.view.core.baseform.FormPanelController',
+    BaseUtil: Ext.create('saas.util.BaseUtil'),
+    FormUtil: Ext.create('saas.util.FormUtil'),
+    alias: 'controller.document-vendor-formpanel',
+    init: function (form) {
+        var me = this;
+        this.control({
+        });
+    }
+});

+ 4 - 0
frontend/saas-web/app/view/document/vendor/FormPanelModel.js

@@ -0,0 +1,4 @@
+Ext.define('saas.view.document.vendor.FormPanelModel', {
+    extend: 'saas.view.core.baseform.FormPanelModel',
+    alias: 'viewmodel.document-vendor-formpanel'
+});

+ 153 - 0
frontend/saas-web/app/view/money/payBalance/FormPanel.js

@@ -0,0 +1,153 @@
+Ext.define('saas.view.money.payBalance.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'money-paybalance-formpanel',
+
+    controller: 'money-paybalance-formpanel',
+    viewModel: 'money-paybalance-formpanel',
+
+    viewName: 'money-paybalance-formpanel',
+
+    caller: 'Purchase',
+
+    //字段属性
+    _title: '付款单',
+    _idField: 'id',
+    _codeField: 'pu_code',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
+    
+    _relationColumn: 'pd_puid',
+    _readUrl: 'http://192.168.0.181:8560/api/purchase/purchase/read/',
+    _saveUrl: 'http://192.168.0.181:8560/api/purchase/purchase/save',
+    _auditUrl: 'http://192.168.0.181:8560/api/purchase/purchase/audit',
+    _deleteUrl: 'http://192.168.0.181:8560/api/purchase/purchase/delete/',
+    _deleteDetailUrl: 'http://192.168.0.181:8560/api/purchase/purchase/deleteItem/',
+    _turnInUrl: 'http://192.168.253.228:8800/purchase/turnProdin/',
+    initId: 0,
+
+    // toolBtns: [{
+    //     xtype: 'button',
+    //     text: '转采购验收单',
+    //     handler: 'turnIn'
+    // }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        fieldLabel: 'id'
+    }, {
+        xtype: "textfield",
+        name: "pb_code",
+        fieldLabel: "付款单号"
+    }, {
+        xtype: "hidden",
+        name: "pb_vendid",
+        bind: "{pb_vendid}",
+        fieldLabel: "供应商ID"
+    }, {
+        xtype: "hidden",
+        name: "pb_vendcode",
+        fieldLabel: "供应商编号"
+    }, {
+        xtype: "dbfindtrigger",
+        name: "pb_vendname",
+        fieldLabel: "供应商名称"
+    }, {
+        xtype: 'numberfield',
+        name: 'pb_pdamount',
+        fieldLabel: '总欠款'
+    }, {
+        xtype: "datefield",
+        name: "pb_date",
+        fieldLabel: "日期"
+    }, {
+        xtype: "detailGridField",
+        storeModel: 'saas.model.purchase.purchasedetail',
+        _detnoColumn: 'pd_detno',
+        columns: [{
+            text: "序号",
+            dataIndex: "pd_detno",
+            width: 100,
+            xtype: "numbercolumn",
+            align: 'center',
+            format: '0',
+            summaryType: 'count',
+            summaryRenderer: function (value, summaryData, dataIndex) {
+                return Ext.String.format('合计: {0}条', value);
+            },
+        }, {
+            text: '资金账户',
+            dataIndex: 'pd_bankname'
+        }, {
+            text: "付款金额",
+            dataIndex: "pd_amount",
+        }, {
+            text: "结算方式",
+            dataIndex: "pd_paymethod"
+        }, {
+            text: "结算号",
+            dataIndex: "pd_paycode"
+        }, {
+            text: "备注",
+            dataIndex: "pd_remark"
+        }]
+    }, {
+        xtype: "detailGridField",
+        storeModel: 'saas.model.purchase.purchasedetail',
+        _detnoColumn: 'pbd_detno',
+        columns: [{
+            text: "序号",
+            dataIndex: "pbd_detno",
+            width: 100,
+            xtype: "numbercolumn",
+            align: 'center',
+            format: '0',
+            summaryType: 'count',
+            summaryRenderer: function (value, summaryData, dataIndex) {
+                return Ext.String.format('合计: {0}条', value);
+            },
+        }, {
+            text: '来源单号',
+            dataIndex: 'pbd_slcode'
+        }, {
+            text: "业务类型",
+            dataIndex: "pbd_slkind",
+        }, {
+            text: "单据日期",
+            dataIndex: "pbd_sldate"
+        }, {
+            text: "单据金额",
+            dataIndex: "pbd_amount"
+        }, {
+            text: "已核销金额",
+            dataIndex: "pd_remark"
+        }, {
+            text: "未核销金额",
+            dataIndex: "pd_remark"
+        }, {
+            text: "本次核销金额",
+            dataIndex: "pbd_nowbalance"
+        }]
+    }, {
+        format: "Y-m-d",
+        xtype: "datefield",
+        name: "createTime",
+        fieldLabel: "创建时间"
+    }, {
+        xtype: "datefield",
+        name: "updateTime",
+        fieldLabel: "更新时间"
+    }, {
+        xtype: "textfield",
+        readOnly: true,
+        editable: false,
+        name: "pd_status",
+        fieldLabel: "单据状态"
+    }, {
+        xtype: "hidden",
+        readOnly: true,
+        editable: false,
+        name: "pd_statuscode",
+        fieldLabel: "单据状态码"
+    }]
+});

+ 158 - 0
frontend/saas-web/app/view/money/payBalance/FormPanelController.js

@@ -0,0 +1,158 @@
+Ext.define('saas.view.money.paybalance.FormPanelController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.money-paybalance-formpanel',
+
+    init: function (form) {
+        var me = this;
+        this.control({
+            /**放大镜新增demo*/
+            "field[name=combo]":{
+                beforerender:function(f){
+                    f.addHandler=me.addCombo;
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 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
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    },
+    addCombo:function(){
+        var combo=this.ownerCmp;
+        Ext.create('Ext.window.Window',{
+            layout:'vbox',
+            bodyPadding: 15,
+            width:500,
+            items:[{
+                fieldLabel:'实际值',
+                xtype:'textfield'
+            },{
+                fieldLabel:'显示值',
+                xtype:'textfield'
+            }],
+            buttons:[{
+                text:'确认',
+                handler:function(b){
+                    combo.setValue('ok');
+                    b.up('window').close();
+                }
+            }],
+            renderTo:this.ownerCmp.ownerCt.getEl()
+        }).show();
+
+    },
+
+    turnIn: function() {
+        var me = this,
+        form = me.getView(),
+        id = form.getForm().findField(form._idField);
+        form.BaseUtil.request({
+            url: form._turnInUrl+id.value,
+            method: 'GET',
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
+                Ext.Msg.alert('提示','转单成功');
+              
+            }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','转单失败');
+        });
+     }
+});

+ 5 - 0
frontend/saas-web/app/view/money/payBalance/FormPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.money.paybalance.FormPanelModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.money-paybalance-formpanel',
+
+});

+ 196 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanel.js

@@ -0,0 +1,196 @@
+Ext.define('saas.view.money.paybalance.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'money-paybalance-querypanel',
+
+    controller: 'money-paybalance-querypanel',
+    viewModel: 'money-paybalance-querypanel',
+
+    viewName: 'money-paybalance-querypanel',
+    
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'pu_id',
+        bind: '{pu_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        getCondition: function(value) {
+            return 'pu_id=' + value;
+        }
+    }, {
+        xtype: 'textfield',
+        name: 'pu_code',
+        bind: '{pu_code}',
+        fieldLabel: '单据编号'
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_date',
+        bind: '{pu_date}',
+        fieldLabel: '采购日期',
+        columnWidth: 0.5,
+        operation: 'between'
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_vendcode',
+        bind: '{pu_vendcode}',
+        fieldLabel: '供应商编号'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_vendname',
+        bind: '{pu_vendname}',
+        fieldLabel: '供应商名称'
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        showDetail: true
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        showDetail: true
+    }, {
+        xtype: 'combobox',
+        name: 'pu_statuscode',
+       // bind: '{pu_statuscode}',
+        fieldLabel: '审核状态',
+        queryMode: 'local',
+        displayField: 'pu_status',
+        valueField: 'pu_statuscode',
+        editable:false,
+        store: Ext.create('Ext.data.ArrayStore', {
+        fields: ['pu_statuscode', 'pu_status'],
+        data: [
+            ["$ALL", "全部"],
+            ["AUDITED", "已审核"],
+            ["UNAUDITED", "未审核"]
+        ]
+        })
+    }, {
+        xtype: 'multicombo',
+        name: 'pu_acceptstatuscode',
+        bind: '{pu_acceptstatuscode}',
+        fieldLabel: '入库状态',
+        datas: [
+            ["TURNIN", "已入库"],
+            ["UNTURNIN", "未入库"],
+            ["PARTIN", "部分入库"]
+        ]
+    }],
+    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
+    }],
+    queryGridConfig: {
+        idField: 'pu_id',
+        codeField: 'pu_code',
+        addTitle: '采购单',
+        addXtype: 'purchase-purchase-formpanel',
+        defaultCondition:'',
+        baseVastUrl: 'http://192.168.253.58:8800/purchase/',
+        baseColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        }, {
+            text: '含税金额',
+            dataIndex: 'pu_taxtotal',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '金额',
+            dataIndex: 'pu_total',
+            xtype: 'numbercolumn',
+            width: 120,
+            flex: 1
+        }],
+        relativeColumn: [{
+            text: '序号',
+            width: 80,
+            xtype: 'rownumberer'
+        }, {
+            text: 'id',
+            dataIndex: 'pu_id',
+            width: 100,
+            xtype: 'numbercolumn'
+        }, {
+            text: '单据编号',
+            dataIndex: 'pu_code',
+            width: 120
+        }, {
+            text: '单据状态',
+            dataIndex: 'pu_status',
+            width: 120
+        }, {
+            text: '下单日期',
+            dataIndex: 'pu_indate',
+            xtype: 'datecolumn',
+            width: 200
+        }, {
+            text: '供应商名称',
+            dataIndex: 'pu_vendname',
+            width: 120
+        }, {
+            text: '采购序号',
+            dataIndex: 'pd_detno',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '物料编号',
+            dataIndex: 'pd_prodcode',
+            width: 120
+        }, {
+            text: '数量',
+            dataIndex: 'pd_qty',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '单价',
+            dataIndex: 'pd_price',
+            xtype: 'numbercolumn',
+            width: 120
+        }, {
+            text: '已转数',
+            dataIndex: 'pd_ytqy',
+            xtype: 'numbercolumn',
+            width: 120,
+            flex: 1
+        }]
+    }
+});

+ 117 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanelController.js

@@ -0,0 +1,117 @@
+Ext.define('saas.view.money.paybalance.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.money-paybalance-querypanel',
+    
+    init: function (form) {
+        var me = this;
+        this.control({
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pu_vendname]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dbfinds:[{
+                            from:'ve_code',to:'pu_vendcode'
+                        },{
+                            from:'ve_name',to:'pu_vendname'
+                        }],
+                        dbtpls:[{
+                            field:'ve_code',width:100
+                        },{
+                            field:'ve_name',width:100
+                        }],
+                        dbColumns:[{
+                            conditionCode:'ve_id',
+                            "text": "供应商ID",
+                            "flex": 0,
+                            "dataIndex": "ve_id",
+                            "width": 0,
+                            "xtype": "",
+                            "items": null
+                        },{
+                            conditionCode:'ve_code',
+                            "text": "供应商编号",
+                            "flex": 1,
+                            "dataIndex": "ve_code",
+                            "width": 100,
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_name',
+                            "text": "供应商名称",
+                            "flex": 1,
+                            "dataIndex": "ve_name",
+                            "xtype": "",
+                            "items": null
+                        }, {
+                            conditionCode:'ve_type',
+                            "text": "供应商类型",
+                            "flex": 0,
+                            "dataIndex": "ve_type",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            },
+            //放大镜赋值关系 以及 tpl模板
+            'dbfindtrigger[name=pd_prodcode]':{
+                beforerender:function(f){
+                    Ext.apply(f,{
+                        conditionCode:'pr_code',
+                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dbfinds:[{
+                            from:'pr_code',to:'pd_prodcode',
+                        }, {
+                            from:'pr_detail',to:'pr_detail'
+                        }],
+                        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
+                        }, {
+                            "text": "物料单位",
+                            "flex": 0,
+                            "dataIndex": "pr_unit",
+                            "width": 200,
+                            "xtype": "",
+                            "items": null
+                        }]
+                    }) ;   
+
+                }
+            }
+        });
+
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/money/payBalance/QueryPanelModel.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.money.paybalance.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.money-paybalance-querypanel'
+
+});

+ 8 - 7
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -15,14 +15,14 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
      _codeField: 'pu_code',
      _statusField: 'pu_status',
      _statusCodeField: 'pu_statuscode',
-     _detnoColumn:  'pd_detno',
+     
      _relationColumn: 'pd_puid',
-     _readUrl:'http://192.168.0.181:8560/api/purchase/purchase/read/',
-     _saveUrl:'http://192.168.0.181:8560/api/purchase/purchase/save',
-     _auditUrl:'http://192.168.0.181:8560/api/purchase/purchase/audit',
-     _deleteUrl:'http://192.168.0.181:8560/api/purchase/purchase/delete/',
-     _deleteDetailUrl:'http://192.168.0.181:8560/api/purchase/purchase/deleteItem/',
-     _turnInUrl:'http://192.168.253.228:8800/purchase/turnProdin/',
+     _readUrl:basePath+'purchase/purchase/read/',
+     _saveUrl:basePath+'purchase/purchase/save',
+     _auditUrl:basePath+'purchase/purchase/audit',
+     _deleteUrl:basePath+'purchase/purchase/delete/',
+     _deleteDetailUrl:basePath+'purchase/purchase/deleteItem/',
+     _turnInUrl:basePath+'purchase/prodinout/turnProdin/',
      initId:0,
  
      toolBtns: [{
@@ -114,6 +114,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
         name : "detailGridField", 
         xtype : "detailGridField", 
         storeModel:'saas.model.purchase.purchasedetail',
+        _detnoColumn:  'pd_detno',
         columns : [
             {
                 text : "序号", 

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

@@ -14,7 +14,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
             'dbfindtrigger[name=pu_vendcode]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.0.181:8570/api/document/vendor/getVendorsByCondition',
+                        dataUrl:basePath+'document/vendor/getVendorsByCondition',
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
                         },{
@@ -66,7 +66,7 @@ Ext.define('saas.view.purchase.purchase.FormPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         conditionCode:'pr_code',
-                        dataUrl:'http://192.168.0.181:8570/api/document/product/getProductsByCondition',
+                        dataUrl:basePath+'document/product/getProductsByCondition',
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode'
                         }],

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

@@ -101,7 +101,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
         addTitle: '采购单',
         addXtype: 'purchase-purchase-formpanel',
         defaultCondition:'',
-        baseVastUrl: 'http://192.168.253.58:8800/purchase/',
+        baseVastUrl: basePath+'/purchase/purchase/',
         baseColumn: [{
             text: '序号',
             width: 80,

+ 2 - 2
frontend/saas-web/app/view/purchase/purchase/QueryPanelController.js

@@ -9,7 +9,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanelController', {
             'dbfindtrigger[name=pu_vendname]':{
                 beforerender:function(f){
                     Ext.apply(f,{
-                        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+                        dataUrl:basePath+'document/vendor/getVendorsByCondition',
                         dbfinds:[{
                             from:'ve_code',to:'pu_vendcode'
                         },{
@@ -61,7 +61,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanelController', {
                 beforerender:function(f){
                     Ext.apply(f,{
                         conditionCode:'pr_code',
-                        dataUrl:'http://192.168.253.41:9480/api/document/product/getProductsByCondition',
+                        dataUrl:basePath+'document/product/getProductsByCondition',
                         dbfinds:[{
                             from:'pr_code',to:'pd_prodcode',
                         }, {

Some files were not shown because too many files changed in this diff