Browse Source

代码合并,冲突解决

chenw 8 years ago
parent
commit
4888d6bf27
93 changed files with 1864 additions and 508 deletions
  1. 4 1
      README.md
  2. 6 0
      applications/commons/pom.xml
  3. 4 0
      applications/document/document-dto/pom.xml
  4. 15 6
      applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java
  5. 1 10
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Product.java
  6. 1 13
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java
  7. 1 10
      applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Warehouse.java
  8. 2 16
      applications/document/document-server/pom.xml
  9. 6 0
      applications/document/document-server/src/main/docker/Dockerfile
  10. 0 4
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/DocumentApplication.java
  11. 6 3
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  12. 1 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/VendorController.java
  13. 5 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/WarehouseController.java
  14. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  15. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  16. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  17. 9 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/ProductServiceImpl.java
  18. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/VendorServiceImpl.java
  19. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/WarehouseServiceImpl.java
  20. 4 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  21. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  22. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/WarehouseService.java
  23. 14 0
      applications/document/document-server/src/main/resources/application.yml
  24. 8 4
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  25. 3 3
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  26. 2 2
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml
  27. 0 2
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/service/VendorTest.java
  28. 5 1
      applications/purchase/purchase-dto/pom.xml
  29. 2 10
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDTO.java
  30. 5 16
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java
  31. 3 3
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseFormDTO.java
  32. 2 10
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java
  33. 0 3
      applications/purchase/purchase-server/pom.xml
  34. 29 5
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java
  35. 3 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchaseMapper.java
  36. 9 9
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasedetailMapper.java
  37. 5 3
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java
  38. 2 9
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseList.java
  39. 1 1
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/Status.java
  40. 19 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java
  41. 55 20
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  42. 14 0
      applications/purchase/purchase-server/src/main/resources/application.yml
  43. 3 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml
  44. 10 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  45. 38 7
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  46. 18 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java
  47. 1 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/RoleResource.java
  48. 6 0
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  49. 16 12
      base-servers/gateway-server/pom.xml
  50. 24 0
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionAdvice.java
  51. 6 3
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionHandler.java
  52. 5 8
      base-servers/gateway-server/src/main/resources/application.yml
  53. 0 0
      base-servers/gateway-server/src/main/resources/banner.txt
  54. 3 3
      base-servers/ui-server/pom.xml
  55. 1 4
      base-servers/ui-server/src/main/java/com/usoftchina/saas/ui/controller/co/CoViewController.java
  56. 5 4
      base-servers/ui-server/src/main/resources/application.yml
  57. 1 1
      base-servers/ui-server/src/test/java/com/usoftchina/saas/ui/test/ViewServiceTest.java
  58. 5 0
      base-servers/zipkin-server/pom.xml
  59. 2 2
      base-servers/zipkin-server/src/main/java/com/usoftchina/saas/zipkin/ZipkinApplication.java
  60. 2 0
      base-servers/zipkin-server/src/main/resources/application.yml
  61. 0 3
      base-servers/zipkin-server/src/main/resources/config/application-docker.yml
  62. 4 0
      framework/core/src/main/java/com/usoftchina/saas/base/Result.java
  63. 19 1
      framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java
  64. 25 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ErrorConfig.java
  65. 53 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/GlobalExceptionHandler.java
  66. 0 41
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/MyErrorController.java
  67. 52 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java
  68. 36 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/UnCaughtErrorFilter.java
  69. 60 9
      frontend/saas-web/app/util/FormUtil.js
  70. 10 1
      frontend/saas-web/app/util/QueryUtil.js
  71. 11 6
      frontend/saas-web/app/view/core/form/ConDateField.js
  72. 0 32
      frontend/saas-web/app/view/core/form/DateField.js
  73. 121 26
      frontend/saas-web/app/view/core/form/FormPanel.js
  74. 82 86
      frontend/saas-web/app/view/core/form/FormPanelController.js
  75. 6 1
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  76. 137 0
      frontend/saas-web/app/view/core/form/MultiCombo.js
  77. 38 12
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  78. 2 6
      frontend/saas-web/app/view/main/MainController.js
  79. 12 2
      frontend/saas-web/app/view/main/MainModel.js
  80. 6 5
      frontend/saas-web/app/view/purchase/purchase/FormPanel.js
  81. 4 11
      frontend/saas-web/app/view/purchase/purchase/QueryPanel.js
  82. 137 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormController.js
  83. 7 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormModel.js
  84. 275 0
      frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js
  85. 256 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanel.js
  86. 5 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelController.js
  87. 9 0
      frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelModel.js
  88. 1 0
      frontend/saas-web/app/view/test/order/FormModel.js
  89. 54 35
      frontend/saas-web/app/view/test/order/FormPanel.js
  90. 10 0
      frontend/saas-web/app/view/test/query/QueryPanelModel.js
  91. 6 0
      frontend/saas-web/ext/build/ext-all-rtl-debug.js
  92. 12 2
      pom.xml
  93. 11 0
      script/docker-base.yaml

+ 4 - 1
README.md

@@ -4,8 +4,11 @@
 ├─saas-platform
 │  │  
 │  ├─applications-----------------------------业务应用
-│  |  ├─common-dto----------------------------基础传输对象
+│  |  ├─commons-------------------------------业务通用
 │  |  ├─document------------------------------基础资料
+│  |  |  |─document-api-----------------------基础资料api
+│  |  |  |─document-dto-----------------------基础资料数据传输对象
+│  |  |  |─document-server--------------------基础资料服务
 │  |  ├─money---------------------------------资金
 │  |  ├─purchase------------------------------采购
 │  |  |  |─purchase-api-----------------------采购服务api

+ 6 - 0
applications/commons/pom.xml

@@ -10,6 +10,12 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>commons</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
+    </dependencies>
 
 
 </project>

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

@@ -18,6 +18,10 @@
             <artifactId>springfox-swagger2</artifactId>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 15 - 6
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java

@@ -4,19 +4,28 @@ import java.io.Serializable;
 
 public class ProductDTO implements Serializable {
 
-    private long pr_id;
+    private long id;
     private String pr_code;
     private String pr_detail;
     private String pr_spec;
     private String pr_orispeccode;
     private String pr_brand;
+    private String pr_unit;
 
-    public long getPr_id() {
-        return pr_id;
+    public String getPr_unit() {
+        return pr_unit;
     }
 
-    public void setPr_id(long pr_id) {
-        this.pr_id = pr_id;
+    public void setPr_unit(String pr_unit) {
+        this.pr_unit = pr_unit;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
     }
 
     public String getPr_code() {
@@ -62,7 +71,7 @@ public class ProductDTO implements Serializable {
     @Override
     public String toString() {
         return "ProductDTO{" +
-                "pr_id='" + pr_id + '\'' +
+                "pr_id='" + id + '\'' +
                 ", pr_code='" + pr_code + '\'' +
                 ", pr_detail='" + pr_detail + '\'' +
                 ", pr_spec='" + pr_spec + '\'' +

+ 1 - 10
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Product.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Product.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
@@ -8,7 +8,6 @@ import java.util.Date;
 
 public class Product extends CommonBaseEntity implements Serializable {
 
-    private long pr_id;
     private String pr_code;
     private String pr_detail;
     private String pr_spec;
@@ -37,14 +36,6 @@ public class Product extends CommonBaseEntity implements Serializable {
     private String pr_text3;
     private String pr_text4;
 
-    public long getPr_id() {
-        return pr_id;
-    }
-
-    public void setPr_id(long pr_id) {
-        this.pr_id = pr_id;
-    }
-
     public String getPr_code() {
         return pr_code;
     }

+ 1 - 13
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Vendor.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Vendor.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 
@@ -12,10 +12,6 @@ import java.util.Date;
  */
 public class Vendor extends CommonBaseEntity implements Serializable{
 
-    /**
-     * 供应商ID
-     */
-    private long ve_id;
     /**
      * 供应商编号
      */
@@ -105,14 +101,6 @@ public class Vendor extends CommonBaseEntity implements Serializable{
      */
     private String ve_text5;
 
-    public long getVe_id() {
-        return ve_id;
-    }
-
-    public void setVe_id(long ve_id) {
-        this.ve_id = ve_id;
-    }
-
     public String getVe_code() {
         return ve_code;
     }

+ 1 - 10
applications/document/document-server/src/main/java/com/usoftchina/saas/document/po/Warehouse.java → applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Warehouse.java

@@ -1,4 +1,4 @@
-package com.usoftchina.saas.document.po;
+package com.usoftchina.saas.document.entities;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
 
@@ -12,7 +12,6 @@ import java.util.Date;
  */
 public class Warehouse extends CommonBaseEntity implements Serializable {
 
-    private long wh_id;
     private String wh_code;
     private String wh_type;
     private String wh_description;
@@ -30,14 +29,6 @@ public class Warehouse extends CommonBaseEntity implements Serializable {
     private String wh_text4;
     private String wh_text5;
 
-    public long getWh_id() {
-        return wh_id;
-    }
-
-    public void setWh_id(long wh_id) {
-        this.wh_id = wh_id;
-    }
-
     public String getWh_code() {
         return wh_code;
     }

+ 2 - 16
applications/document/document-server/pom.xml

@@ -13,21 +13,13 @@
     <description>document server</description>
 
     <dependencies>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>core</artifactId>
-        </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>auth-client</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.springframework.cloud</groupId>
-            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>server-starter</artifactId>
         </dependency>
         <!-- db -->
         <dependency>
@@ -64,16 +56,10 @@
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>document-dto</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>common-dto</artifactId>
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>commons</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 

+ 6 - 0
applications/document/document-server/src/main/docker/Dockerfile

@@ -0,0 +1,6 @@
+FROM frolvlad/alpine-oraclejdk8:slim
+VOLUME /tmp
+ADD document-server-1.0.0-SNAPSHOT.jar app.jar
+RUN sh -c 'touch /app.jar'
+ENV JAVA_OPTS=""
+ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

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

@@ -1,14 +1,10 @@
 package com.usoftchina.saas.document;
 
-import com.usoftchina.saas.auth.client.EnableAuthClient;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
-import org.springframework.boot.SpringBootConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 @SpringBootApplication
 @EnableEurekaClient

+ 6 - 3
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java

@@ -5,12 +5,11 @@ import com.usoftchina.saas.base.Result;
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -38,5 +37,9 @@ public class ProductController {
         productService.updateLatestPurchasePrice(pu_id);
     }
 
+    @RequestMapping("/getProductsByPK")
+    public Product getProductsByPK(@RequestParam(value = "pr_id") Long id) {
+        return productService.getProductsByPK(id);
+    }
 
 }

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

@@ -6,6 +6,7 @@ import com.usoftchina.saas.document.dto.VendorDTO;
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 

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

@@ -1,10 +1,14 @@
 package com.usoftchina.saas.document.controller;
 
 import com.usoftchina.saas.base.Result;
-import com.usoftchina.saas.document.po.Warehouse;
+import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.service.WarehouseService;
 import org.springframework.beans.factory.annotation.Autowired;
+
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
 

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

@@ -3,7 +3,7 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
-import com.usoftchina.saas.document.po.Product;
+import com.usoftchina.saas.document.entities.Product;
 
 import java.util.List;
 

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

@@ -3,7 +3,7 @@ package com.usoftchina.saas.document.mapper;
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 
 import com.usoftchina.saas.common.dto.DocReqDTO;
-import com.usoftchina.saas.document.po.Vendor;
+import com.usoftchina.saas.document.entities.Vendor;
 
 import java.util.List;
 

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

@@ -1,7 +1,7 @@
 package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+import com.usoftchina.saas.document.entities.Warehouse;
 
 import java.util.Map;
 

+ 9 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/ProductServiceImpl.java

@@ -7,8 +7,8 @@ import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
-import com.usoftchina.saas.document.po.Product;
 import com.usoftchina.saas.document.service.ProductService;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.BeanMapper;
@@ -49,4 +49,12 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
     public void updateLatestPurchasePrice(Long pu_id) {
         productMapper.updateLatestPurchasePrice(pu_id);
     }
+
+    @Override
+    public Product getProductsByPK(Long id) {
+        if (null == id) {
+            return productMapper.selectByPrimaryKey(id);
+        }
+        return null;
+    }
 }

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

@@ -5,8 +5,9 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.entities.Vendor;
 import com.usoftchina.saas.document.mapper.VendorMapper;
-import com.usoftchina.saas.document.po.Vendor;
+
 import com.usoftchina.saas.document.service.VendorService;
 import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.BeanMapper;

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

@@ -1,8 +1,9 @@
 package com.usoftchina.saas.document.service.Impl;
 
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+
 import com.usoftchina.saas.document.service.WarehouseService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

+ 4 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java

@@ -5,8 +5,9 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 import com.usoftchina.saas.common.dto.ComboDTO;
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.ProductDTO;
+import com.usoftchina.saas.document.entities.Product;
 import com.usoftchina.saas.document.mapper.ProductMapper;
-import com.usoftchina.saas.document.po.Product;
+
 import com.usoftchina.saas.page.PageRequest;
 
 import java.util.List;
@@ -19,4 +20,6 @@ public interface ProductService extends CommonBaseService<ProductMapper, Product
     List<ComboDTO> getProdUnit();
 
     void updateLatestPurchasePrice(Long pu_id);
+
+    Product getProductsByPK(Long id);
 }

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

@@ -4,8 +4,9 @@ import com.usoftchina.saas.base.service.CommonBaseService;
 
 import com.usoftchina.saas.common.dto.DocReqDTO;
 import com.usoftchina.saas.document.dto.VendorDTO;
+import com.usoftchina.saas.document.entities.Vendor;
 import com.usoftchina.saas.document.mapper.VendorMapper;
-import com.usoftchina.saas.document.po.Vendor;
+
 import com.usoftchina.saas.page.PageRequest;
 
 import java.util.List;

+ 2 - 1
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/WarehouseService.java

@@ -1,8 +1,9 @@
 package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.document.entities.Warehouse;
 import com.usoftchina.saas.document.mapper.WarehouseMapper;
-import com.usoftchina.saas.document.po.Warehouse;
+
 
 import java.util.Map;
 

+ 14 - 0
applications/document/document-server/src/main/resources/application.yml

@@ -18,6 +18,20 @@ spring:
       connection-timeout: 30000
   messages:
     basename: i18n/messages
+  rabbitmq:
+    host: 192.168.0.176
+    port: 5672
+    password: guest
+    username: guest
+  zipkin:
+    sender:
+      type: rabbit
+    locator:
+      discovery:
+        enabled: true
+  sleuth:
+    sampler:
+      probability: 1.0
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10

+ 8 - 4
applications/document/document-server/src/main/resources/mapper/ProductMapper.xml

@@ -1,8 +1,8 @@
 <?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.ProductMapper">
-    <resultMap id="ProductResultMapper" type="com.usoftchina.saas.document.po.Product">
-        <id column="pr_id" property="pr_id" jdbcType="INTEGER" />
+    <resultMap id="ProductResultMapper" type="com.usoftchina.saas.document.entities.Product">
+        <id column="pr_id" property="id" jdbcType="INTEGER" />
         <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
         <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
         <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
@@ -36,7 +36,7 @@
         <result column="pr_text5" property="pr_text5" jdbcType="VARCHAR" />
     </resultMap>
     <!--查询所有物料信息-->
-    <select id="getProductsByCondition" resultMap="ProductResultMapper" parameterType="dto.DocReqDTO">
+    <select id="getProductsByCondition" resultMap="ProductResultMapper" parameterType="com.usoftchina.saas.common.dto.DocReqDTO">
         SELECT * FROM PRODUCT
         <where>
             <if test="condition!=null">
@@ -45,7 +45,11 @@
         </where>
     </select>
 
-    <select id="getProdUnit" resultType="dto.ComboDTO">
+    <select id="selectByPrimaryKey" resultMap="ProductResultMapper" parameterType="long">
+        SELECT * FROM PRODUCT where pr_id = #{pr_id}
+    </select>
+
+    <select id="getProdUnit" resultType="com.usoftchina.saas.common.dto.ComboDTO">
         SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT
     </select>
     <update id="updateLatestPurchasePrice" parameterType="long">

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

@@ -1,8 +1,8 @@
 <?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.VendorMapper">
-    <resultMap id="VendorResultMapper" type="com.usoftchina.saas.document.po.Vendor">
-        <id column="ve_id" property="ve_id" jdbcType="INTEGER" />
+    <resultMap id="VendorResultMapper" type="com.usoftchina.saas.document.entities.Vendor">
+        <id column="ve_id" property="id" jdbcType="INTEGER" />
         <result column="ve_code" property="ve_code" jdbcType="VARCHAR" />
         <result column="ve_uu" property="ve_uu" jdbcType="VARCHAR" />
         <result column="ve_name" property="ve_name" jdbcType="VARCHAR" />
@@ -29,7 +29,7 @@
         <result column="ve_text4" property="ve_text4" jdbcType="VARCHAR" />
         <result column="ve_text5" property="ve_text5" jdbcType="VARCHAR" />
     </resultMap>
-    <select id="getVendorsByCondition" resultMap="VendorResultMapper" parameterType="dto.DocReqDTO">
+    <select id="getVendorsByCondition" resultMap="VendorResultMapper" parameterType="com.usoftchina.saas.common.dto.DocReqDTO">
         SELECT * FROM VENDOR
         <where>
             <if test="condition!=null">

+ 2 - 2
applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml

@@ -1,8 +1,8 @@
 <?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.WarehouseMapper">
-    <resultMap id="WarehouseResultMapper" type="com.usoftchina.saas.document.po.Warehouse">
-        <id column="wh_id" property="wh_id" jdbcType="INTEGER" />
+    <resultMap id="WarehouseResultMapper" type="com.usoftchina.saas.document.entities.Warehouse">
+        <id column="wh_id" property="id" jdbcType="INTEGER" />
         <result column="wh_code" property="wh_code" jdbcType="VARCHAR" />
         <result column="wh_type" property="wh_type" jdbcType="VARCHAR" />
         <result column="wh_description" property="wh_description" jdbcType="VARCHAR" />

+ 0 - 2
applications/document/document-server/src/test/java/com/usoftchina/saas/document/service/VendorTest.java

@@ -3,8 +3,6 @@ package com.usoftchina.saas.document.service;
 
 import com.usoftchina.saas.document.DocumentApplication;
 import com.usoftchina.saas.document.dto.VendorDTO;
-import com.usoftchina.saas.document.po.Vendor;
-import com.usoftchina.saas.page.PageRequest;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;

+ 5 - 1
applications/purchase/purchase-dto/pom.xml

@@ -15,7 +15,7 @@
     <dependencies>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
-            <artifactId>common-dto</artifactId>
+            <artifactId>commons</artifactId>
         </dependency>
         <dependency>
             <groupId>io.springfox</groupId>
@@ -26,5 +26,9 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.usoftchina.saas</groupId>
+            <artifactId>document-dto</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 2 - 10
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDTO.java

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.purchase.dto;
 
+import com.usoftchina.saas.base.dto.CommonBaseDTO;
 import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
@@ -12,16 +13,7 @@ import java.util.Date;
  */
 @Data
 @ApiModel(value = "Purchase", description = "采购订单")
-public class PurchaseDTO implements Serializable{
-    protected Long id;
-    /**
-     * company id
-     */
-    protected long companyId;
-    protected Date createTime;
-    protected long creatorId;
-    protected Date updateTime;
-    protected long updaterId;
+public class PurchaseDTO extends CommonBaseDTO implements Serializable{
 
     private String pu_code;
 

+ 5 - 16
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseItemDTO.java → applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseDetailDTO.java

@@ -1,5 +1,7 @@
 package com.usoftchina.saas.purchase.dto;
 
+import com.usoftchina.saas.base.dto.CommonBaseDTO;
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -10,22 +12,7 @@ import java.util.Date;
  * @date 2018/10/9
  */
 @Data
-public class PurchaseItemDTO implements Serializable{
-    protected Long id;
-
-    /**
-     * company id
-
-     */
-    protected long companyId;
-
-    protected Date createTime;
-
-    protected long creatorId;
-
-    protected Date updateTime;
-
-    protected long updaterId;
+public class PurchaseDetailDTO extends CommonBaseDTO implements Serializable{
 
     private  Long pd_puid;
 
@@ -69,4 +56,6 @@ public class PurchaseItemDTO implements Serializable{
 
     private Double pd_yqty;
 
+    private Product product;
+
 }

+ 3 - 3
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseFormDTO.java

@@ -11,7 +11,7 @@ import java.util.List;
  */
 public class PurchaseFormDTO implements Serializable{
     private PurchaseDTO main;
-    private List<PurchaseItemDTO> items;
+    private List<PurchaseDetailDTO> items;
 
     public PurchaseDTO getMain() {
         return main;
@@ -21,11 +21,11 @@ public class PurchaseFormDTO implements Serializable{
         this.main = main;
     }
 
-    public List<PurchaseItemDTO> getItems() {
+    public List<PurchaseDetailDTO> getItems() {
         return items;
     }
 
-    public void setItems(List<PurchaseItemDTO> items) {
+    public void setItems(List<PurchaseDetailDTO> items) {
         this.items = items;
     }
 

+ 2 - 10
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java

@@ -1,9 +1,9 @@
 package com.usoftchina.saas.purchase.dto;
 
+import com.usoftchina.saas.base.dto.CommonBaseDTO;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -13,16 +13,8 @@ import java.util.Date;
  * @date 2018/10/9
  */
 @Data
-public class PurchaseListDTO implements Serializable {
+public class PurchaseListDTO extends CommonBaseDTO implements Serializable {
     //主表信息
-    protected long companyId;
-
-    protected Date createTime;
-
-    protected Date updateTime;
-
-    protected long updaterId;
-
     private  Integer pu_id;
 
     private String pu_code;

+ 0 - 3
applications/purchase/purchase-server/pom.xml

@@ -20,7 +20,6 @@
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>document-api</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
@@ -51,7 +50,6 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.16.10</version>
         </dependency>
         <dependency>
             <groupId>com.github.pagehelper</groupId>
@@ -65,7 +63,6 @@
         <dependency>
             <groupId>com.usoftchina.saas</groupId>
             <artifactId>commons</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 

+ 29 - 5
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/controller/PurchaseController.java

@@ -80,9 +80,9 @@ public class PurchaseController {
      * @param id
      * @return
      */
-    @GetMapping("/deleteItem/{id}")
-    public Result deleteItem(@PathVariable("id") Long id) {
-        purchaseService.deleteItem(id);
+    @GetMapping("/deleteDetail/{id}")
+    public Result deleteDetail(@PathVariable("id") Long id) {
+        purchaseService.deleteDetail(id);
         return Result.success();
     }
 
@@ -94,8 +94,20 @@ public class PurchaseController {
      */
     @PostMapping("/audit")
     public Result audit(@RequestBody PurchaseFormDTO formData) {
-        Long id = purchaseService.audit(formData);
-        return Result.success(id);
+        DocSavedDTO audit = purchaseService.audit(formData);
+        return Result.success(audit);
+    }
+
+    /**
+     * 采购订单审批
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/unAudit/{id}")
+    public Result unAudit(@PathVariable("id") Long id) {
+        purchaseService.unAudit(id);
+        return Result.success();
     }
 
     /**
@@ -122,4 +134,16 @@ public class PurchaseController {
         return Result.success();
     }
 
+    /**
+     * 采购订单批量反审核
+     *
+     * @param baseDTOs
+     * @return
+     */
+    @PostMapping("/batchUnAudit")
+    public Result batchUnAudit(@RequestBody BatchDealBaseDTO baseDTOs) {
+        purchaseService.batchUnAudit(baseDTOs);
+        return Result.success();
+    }
+
 }

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

@@ -16,5 +16,7 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
 
     String validateAudit(List<DocBaseDTO> list);
 
-    List<Purchase> selectByTest(String con);
+    String validateUnAudit(Long id);
+
+    String validateBatchUnAudit(List<DocBaseDTO> baseDTOs);
 }

+ 9 - 9
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/mapper/PurchasedetailMapper.java

@@ -2,28 +2,28 @@ package com.usoftchina.saas.purchase.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.purchase.po.Purchase;
-import com.usoftchina.saas.purchase.po.PurchaseItem;
+import com.usoftchina.saas.purchase.po.PurchaseDetail;
 import java.util.List;
 
 
 public interface PurchasedetailMapper extends CommonBaseMapper<Purchase> {
     int deleteByPrimaryKey(Integer pdId);
 
-    int insert(PurchaseItem record);
+    int insert(PurchaseDetail record);
 
-    int insertSelective(PurchaseItem record);
+    int insertSelective(PurchaseDetail record);
 
-    PurchaseItem selectByPrimaryKey(Integer pdId);
+    PurchaseDetail selectByPrimaryKey(Integer pdId);
 
-    int updateByPrimaryKeySelective(PurchaseItem record);
+    int updateByPrimaryKeySelective(PurchaseDetail record);
 
-    int updateByPrimaryKey(PurchaseItem record);
+    int updateByPrimaryKey(PurchaseDetail record);
 
-    void batchInsert(List<PurchaseItem> list);
+    void batchInsert(List<PurchaseDetail> list);
 
-    void batchUpdate(List<PurchaseItem> list);
+    void batchUpdate(List<PurchaseDetail> list);
 
     void deleteByForeignKey(Long fk_id);
 
-    List<PurchaseItem> selectByFK(Long fk_i);
+    List<PurchaseDetail> selectByFK(Long fk_i);
 }

+ 5 - 3
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseItem.java → applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseDetail.java

@@ -1,12 +1,14 @@
 package com.usoftchina.saas.purchase.po;
 
 import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
 
 @Data
-public class PurchaseItem extends CommonBaseEntity implements Serializable {
+public class PurchaseDetail extends CommonBaseEntity implements Serializable {
 
     private  Long pd_puid;
 
@@ -14,7 +16,7 @@ public class PurchaseItem extends CommonBaseEntity implements Serializable {
 
     private Integer pd_detno;
 
-    private Integer pd_prodid;
+    private Long pd_prodid;
 
     private String pd_prodcode;
 
@@ -50,5 +52,5 @@ public class PurchaseItem extends CommonBaseEntity implements Serializable {
 
     private Double pd_yqty;
 
-    //private Product product;
+    private Product product;
 }

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

@@ -1,6 +1,7 @@
 package com.usoftchina.saas.purchase.po;
 
 
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -11,17 +12,9 @@ import java.util.Date;
  * @create: 2018-10-10 16:42
  **/
 @Data
-public class PurchaseList implements Serializable {
+public class PurchaseList extends CommonBaseEntity implements Serializable {
 
     //主表信息
-    protected long companyId;
-
-    protected Date createTime;
-
-    protected Date updateTime;
-
-    protected long updaterId;
-
     private  Integer pu_id;
 
     private String pu_code;

+ 1 - 1
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/Status.java

@@ -4,7 +4,7 @@ public enum Status {
     /**
      * 在录入
      */
-    ENTERING("在录入"),
+    UNAUDITED("未审核"),
 
     /**
      * 已审核

+ 19 - 2
applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/PurchaseService.java

@@ -63,7 +63,7 @@ public interface PurchaseService extends CommonBaseService<PurchaseMapper, Purch
      * @param id
      * @return
      */
-    int deleteItem(Long id);
+    int deleteDetail(Long id);
 
     /**
      * 删除明细
@@ -71,7 +71,7 @@ public interface PurchaseService extends CommonBaseService<PurchaseMapper, Purch
      * @param formData
      * @return
      */
-    Long audit(PurchaseFormDTO formData);
+    DocSavedDTO audit(PurchaseFormDTO formData);
 
     /**
     * @Description 批量审核
@@ -90,5 +90,22 @@ public interface PurchaseService extends CommonBaseService<PurchaseMapper, Purch
     * @Date: 2018/10/15
     */
     void batchDelete(BatchDealBaseDTO baseDTOs);
+    /**
+    * @Description
+     * 反审核
+    * @Param: [id]
+    * @return: com.usoftchina.saas.common.dto.DocSavedDTO
+    * @Author: guq
+    * @Date: 2018/10/17
+    */
+    void unAudit(Long id);
 
+    /** 
+    * @Description
+    * @Param: [baseDTOs] 
+    * @return: void 
+    * @Author: guq
+    * @Date: 2018/10/17 
+    */
+    void batchUnAudit(BatchDealBaseDTO baseDTOs);
 }

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

@@ -64,15 +64,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         PurchaseFormDTO purchaseFormDTO = new PurchaseFormDTO();
         //查询主表信息
         Purchase purchase = getMapper().selectByPrimaryKey(id);
-        //查询从表
-        List<PurchaseItem> purchaseItems = purchasedetailMapper.selectByFK(id);
         //将purchase实体对象转化成传输对象
         PurchaseDTO main = BeanMapper.map(purchase, PurchaseDTO.class);
-        List<PurchaseItemDTO> items = new ArrayList<>();
-        //添加从表传输对象
-        for (PurchaseItem detail : purchaseItems) {
-            items.add(BeanMapper.map(detail, PurchaseItemDTO.class));
-        }
+        //查询从表
+        List<PurchaseDetail> purchaseDetails = purchasedetailMapper.selectByFK(id);
+        List<PurchaseDetailDTO> items = BeanMapper.mapList(purchaseDetails, PurchaseDetailDTO.class);
         purchaseFormDTO.setMain(main);
         purchaseFormDTO.setItems(items);
         return  purchaseFormDTO;
@@ -86,17 +82,17 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
 
         //获取主表信息
         PurchaseDTO main = formdata.getMain();
-        List<PurchaseItemDTO> items = formdata.getItems();
+        List<PurchaseDetailDTO> items = formdata.getItems();
         //插入从表数据
-        List<PurchaseItem> insertDetails = new ArrayList<>();
+        List<PurchaseDetail> insertDetails = new ArrayList<>();
         //更新从表数据
-        List<PurchaseItem> updateDetails = new ArrayList<>();
+        List<PurchaseDetail> updateDetails = new ArrayList<>();
         DocSavedDTO saveDTO = new DocSavedDTO();
         Long pu_id = main.getId();
         String pu_code = main.getPu_code();
         Purchase purchase = BeanMapper.map(main, Purchase.class);
 
-        //编号获取
+        //编号获取 到时候确定处理
         if (StringUtils.isEmpty(pu_code)) {
             pu_code = "PU" + Math.random() * 1000;
             purchase.setPu_code(pu_code);
@@ -105,10 +101,10 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         //判断更新与保存动作
         if (!StringUtils.isEmpty(pu_id)) {
             //更新主表
-            purchaseMapper.updateByPrimaryKey(purchase);
+            purchaseMapper.updateByPrimaryKeySelective(purchase);
             //添加从表传输对象
-            for (PurchaseItemDTO item : items) {
-                PurchaseItem detail = BeanMapper.map(item, PurchaseItem.class);
+            for (PurchaseDetailDTO item : items) {
+                PurchaseDetail detail = BeanMapper.map(item, PurchaseDetail.class);
                 detail.setPd_puid(pu_id);
                 detail.setPd_code(pu_code);
                 if (!StringUtils.isEmpty(detail.getId())) {
@@ -133,8 +129,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         purchaseMapper.insertSelective(purchase);
         pu_id = purchase.getId();
         //添加从表传输对象
-        for (PurchaseItemDTO item : items) {
-            PurchaseItem detail = BeanMapper.map(item, PurchaseItem.class);
+        for (PurchaseDetailDTO item : items) {
+            PurchaseDetail detail = BeanMapper.map(item, PurchaseDetail.class);
             detail.setPd_puid(pu_id);
             detail.setPd_code(pu_code);
             insertDetails.add(detail);
@@ -153,13 +149,14 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
     }
 
     @Override
-    public int deleteItem(Long id) {
+    public int deleteDetail(Long id) {
         return purchasedetailMapper.deleteByPrimaryKey(id);
     }
 
     @Override
-    public Long audit(PurchaseFormDTO formData) {
+    public DocSavedDTO audit(PurchaseFormDTO formData) {
         Long id = null;
+        DocSavedDTO savedDTO = new DocSavedDTO();
         if (null != formData) {
             id = formData.getMain().getId();
             if (StringUtils.isEmpty(id)) {
@@ -168,7 +165,8 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
             }
             singleAudit(id);
         }
-        return id;
+        savedDTO.setId(id);
+        return savedDTO;
     }
 
     @Override
@@ -195,6 +193,32 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         }
     }
 
+    @Override
+    public void unAudit(Long id) {
+        if (null == id) {
+            return;
+        }
+        String code = purchaseMapper.validateUnAudit(id);
+        if (null != code) {
+            throw new BizException(500, "单据:" + code + " 未审核,无法反审核");
+        }
+        singleUnAudit(id);
+    }
+
+    @Override
+    public void batchUnAudit(BatchDealBaseDTO baseDTOs) {
+        if (null == baseDTOs || null == baseDTOs.getBaseDTOs() ||
+                baseDTOs.getBaseDTOs().size() == 0)
+            return;
+        String msg = purchaseMapper.validateBatchUnAudit(baseDTOs.getBaseDTOs());
+        if (null != msg) {
+            throw new BizException(500, "存在未审核单据,单据编号:" + msg);
+        }
+        for (DocBaseDTO base : baseDTOs.getBaseDTOs()) {
+            singleUnAudit(base.getId());
+        }
+    }
+
     private void singleAudit(Long id) {
         Purchase purchase = new Purchase();
         //生成更新对象
@@ -208,6 +232,17 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
         productApi.updateLatestPurchasePrice(id);
     }
 
+    private void singleUnAudit(Long id) {
+        Purchase purchase = new Purchase();
+        //生成更新对象
+        purchase.setId(id);
+        purchase.setPu_status(Status.UNAUDITED.getDisplay());
+        purchase.setPu_statuscode(Status.UNAUDITED.name());
+        purchase.setUpdateTime(new Date());
+        //更新存在字段
+        purchaseMapper.updateByPrimaryKeySelective(purchase);
+    }
+
     private void singleDelete(Long id) {
         if (null != id) {
             //从表删除
@@ -219,7 +254,7 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
 
     private List<PurchaseList> getListByMode(PurchaseReqDTO req) {
         List<PurchaseList> list = null;
-        if (null == req || StringUtils.isEmpty(req.getMode()) || "Main".equals(req.getMode())) {
+        if (null == req || StringUtils.isEmpty(req.getMode()) || "MAIN".equals(req.getMode())) {
             list = purchaseListMapper.selectPurchaseBycondition(req);
         } else {
             list = purchaseListMapper.selectPurchaseListByCondition(req);

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

@@ -18,6 +18,20 @@ spring:
       connection-timeout: 30000
   messages:
     basename: i18n/messages
+  rabbitmq:
+    host: 192.168.0.176
+    port: 5672
+    password: guest
+    username: guest
+  zipkin:
+    sender:
+      type: rabbit
+    locator:
+      discovery:
+        enabled: true
+  sleuth:
+    sampler:
+      probability: 1.0
 eureka:
   instance:
     leaseRenewalIntervalInSeconds: 10

+ 3 - 1
applications/purchase/purchase-server/src/main/resources/mapper/PurchaseListMapper.xml

@@ -70,6 +70,7 @@
             <if test="keyword != null">
                 AND ${keyword}
             </if>
+            order by pu_id,pd_detno desc
         </where>
     </select>
 
@@ -89,6 +90,7 @@
                 AND ${keyword}
             </if>
         </where>
+        order by pu_id desc
     </select>
     <insert id="batchInsert" parameterType="java.util.List" >
         insert into purchasedetail ( PD_PUID, PD_CODE,
@@ -115,7 +117,7 @@
             )
         </foreach>
     </insert>
-    <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+    <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
         <foreach collection="list" item="item" index="index" open="" close="" separator=";">
             update purchasedetail <set>
             PD_PUID = #{item.pdPuid},

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

@@ -391,12 +391,21 @@
       pu_text5 = #{pu_text5,jdbcType=VARCHAR}
     where pu_id = #{id,jdbcType=INTEGER}
   </update>
-  <select id="validateAudit" parameterType="dto.DocBaseDTO" resultType="java.lang.String">
+  <select id="validateAudit" parameterType="com.usoftchina.saas.common.dto.DocBaseDTO" resultType="java.lang.String">
     select GROUP_CONCAT(pu_code) from purchase where pu_statuscode='AUDITED' and pu_id in
     <foreach collection="list" item="item" open="(" close=")" separator=",">
       #{item.id}
     </foreach>
   </select>
+  <select id="validateBatchUnAudit" parameterType="com.usoftchina.saas.common.dto.DocBaseDTO" resultType="java.lang.String">
+    select GROUP_CONCAT(pu_code) from purchase where pu_statuscode='UNAUDITED' and pu_id in
+    <foreach collection="list" item="item" open="(" close=")" separator=",">
+      #{item.id}
+    </foreach>
+  </select>
+  <select id="validateUnAudit" parameterType="long" resultType="java.lang.String">
+    select pu_code from purchase where pu_id = #{pu_id} and IFNULL(pu_statuscode,'UNAUDITED')='UNAUDITED'
+  </select>
   <select id="selectByTest" resultMap="BaseResultMap" parameterType="string" >
     select * from purchase <where>
     <if test="_parameter != null">

+ 38 - 7
applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml

@@ -1,7 +1,7 @@
 <?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.purchase.mapper.PurchasedetailMapper" >
-  <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     <id column="PD_ID" property="id" jdbcType="INTEGER" />
     <result column="PD_PUID" property="pd_puid" jdbcType="INTEGER" />
     <result column="PD_CODE" property="pd_code" jdbcType="VARCHAR" />
@@ -27,6 +27,36 @@
     <result column="pd_text4" property="pd_text4" jdbcType="VARCHAR" />
     <result column="pd_text5" property="pd_text5" jdbcType="VARCHAR" />
     <result column="pd_yqty" property="pd_yqty" jdbcType="DOUBLE" />
+    <association property="product" javaType="com.usoftchina.saas.document.entities.Product">
+      <id column="pr_id" property="id"/>
+      <result column="pr_code" property="pr_code"/>
+      <result column="pr_detail" property="pr_detail"/>
+      <result column="pr_spec" property="pr_spec"/>
+      <result column="pr_unit" property="pr_unit"/>
+      <result column="pr_kind" property="pr_kind"/>
+      <result column="pr_orispeccode" property="pr_orispeccode"/>
+      <result column="pr_whid" property="pr_whid"/>
+      <result column="pr_whcode" property="pr_whcode"/>
+      <result column="pr_whname" property="pr_whname"/>
+      <result column="pr_zxbzs" property="pr_zxbzs"/>
+      <result column="pr_leadtime" property="pr_leadtime"/>
+      <result column="pr_brand" property="pr_brand"/>
+      <result column="pr_standardprice" property="pr_standardprice"/>
+      <result column="pr_purcprice" property="pr_purcprice"/>
+      <result column="pr_saleprice" property="pr_saleprice"/>
+      <result column="pr_vendid" property="pr_vendid"/>
+      <result column="pr_vendname" property="pr_vendname"/>
+      <result column="pr_vendcode" property="pr_vendcode"/>
+      <result column="pr_docdate" property="pr_docdate"/>
+      <result column="pr_recordmanid" property="pr_recordmanid"/>
+      <result column="pr_recordman" property="pr_recordman"/>
+      <result column="pr_status" property="pr_status"/>
+      <result column="pr_statuscode" property="pr_statuscode"/>
+      <result column="pr_text1" property="pr_text1"/>
+      <result column="pr_text2" property="pr_text2"/>
+      <result column="pr_text3" property="pr_text3"/>
+      <result column="pr_text4" property="pr_text4"/>
+    </association>
   </resultMap>
   <sql id="Base_Column_List" >
     PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,
@@ -44,7 +74,7 @@
     delete from purchasedetail
     where PD_ID = #{id}
   </delete>
-  <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     insert into purchasedetail (PD_PUID, PD_CODE,
     PD_DETNO, PD_PRODID, PD_PRODCODE,
     PD_UNIT, PD_QTY, PD_PRICE,
@@ -64,7 +94,7 @@
     #{pdText3,jdbcType=VARCHAR}, #{pdText4,jdbcType=VARCHAR}, #{pdText5,jdbcType=VARCHAR},
     #{pdYqty,jdbcType=DOUBLE})
   </insert>
-  <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     insert into purchasedetail
     <trim prefix="(" suffix=")" suffixOverrides="," >
       <if test="pdPuid != null" >
@@ -215,7 +245,7 @@
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     update purchasedetail
     <set >
       <if test="pdPuid != null" >
@@ -293,7 +323,7 @@
     </set>
     where PD_ID = #{id,jdbcType=INTEGER}
   </update>
-  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     update purchasedetail
     set PD_PUID = #{pdPuid,jdbcType=INTEGER},
     PD_CODE = #{pdCode,jdbcType=VARCHAR},
@@ -346,7 +376,7 @@
       )
     </foreach>
   </insert>
-  <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseItem" >
+  <update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
     <foreach collection="list" item="item" index="index" open="" close="" separator=";">
       update purchasedetail <set>
       PD_PUID = #{item.pd_puid},
@@ -381,6 +411,7 @@
     delete from purchasedetail where pd_puid=#{id}
   </delete>
   <select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
-    select * from purchasedetail where pd_puid=#{pu_id}
+    select * from purchasedetail a left join product b on pr_id=pd_prodid and a.companyid = b.companyid
+      where pd_puid=#{pu_id} order by pd_detno desc
   </select>
 </mapper>

+ 18 - 3
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java

@@ -1,11 +1,26 @@
 package com.usoftchina.saas.account.mapper;
 
-import com.usoftchina.saas.account.po.RoleResource;
-import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @author yingp
  * @date 2018/10/2
  */
-public interface RoleResourceMapper extends CommonBaseMapper<RoleResource> {
+public interface RoleResourceMapper {
+    /**
+     * 新增
+     *
+     * @param roleId
+     * @param resourceId
+     * @return
+     */
+    int insert(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
+
+    /**
+     * 删除
+     *
+     * @param roleId
+     * @param resourceId
+     */
+    void delete(@Param("roleId") Long roleId, @Param("resourceId") Long resourceId);
 }

+ 1 - 3
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/RoleResource.java

@@ -1,7 +1,5 @@
 package com.usoftchina.saas.account.po;
 
-import com.usoftchina.saas.base.entity.CommonBaseEntity;
-
 import java.io.Serializable;
 
 /**
@@ -10,7 +8,7 @@ import java.io.Serializable;
  * @author yingp
  * @date 2018/10/2
  */
-public class RoleResource extends CommonBaseEntity implements Serializable {
+public class RoleResource implements Serializable {
     private long roleId;
     private long resourceId;
 

+ 6 - 0
base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml

@@ -1,4 +1,10 @@
 <?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.account.mapper.RoleResourceMapper">
+    <insert id="insert">
+        insert into ac_role_resource(role_id,resource_id) values (#{roleId}, #{resourceId})
+    </insert>
+    <delete id="delete">
+        delete from ac_role_resource where role_id=#{roleId} and resource_id=#{resourceId}
+    </delete>
 </mapper>

+ 16 - 12
base-servers/gateway-server/pom.xml

@@ -11,14 +11,23 @@
 
     <artifactId>gateway-server</artifactId>
     <description>gateway server</description>
-    <properties>
-        <ratelimit.version>2.1.0.RELEASE</ratelimit.version>
-    </properties>
 
     <dependencies>
         <dependency>
-            <groupId>com.usoftchina.saas</groupId>
-            <artifactId>server-starter</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-webflux</artifactId>
         </dependency>
         <!--<dependency>
             <groupId>org.springframework.boot</groupId>
@@ -33,24 +42,19 @@
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
         </dependency>
         <!-- rate limit -->
-        <!--<dependency>
-            <groupId>com.marcosbarbero.cloud</groupId>
-            <artifactId>spring-cloud-zuul-ratelimit</artifactId>
-            <version>${ratelimit.version}</version>
-        </dependency>-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
         <!-- sleuth -->
-        <!--<dependency>
+        <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>
         <!-- auth -->
         <dependency>
             <groupId>com.usoftchina.saas</groupId>

+ 24 - 0
base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionAdvice.java

@@ -0,0 +1,24 @@
+package com.usoftchina.saas.gateway.error;
+
+import com.usoftchina.saas.base.Result;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+/**
+ * @author yingp
+ * @date 2018/10/15
+ */
+@RestControllerAdvice
+public class MyExceptionAdvice {
+
+    @ExceptionHandler(Exception.class)
+    @ResponseStatus(HttpStatus.OK)
+    @ResponseBody
+    public Result serverExceptionHandler(Exception ex) {
+        return Result.throwable(ex);
+    }
+
+}

+ 6 - 3
base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionHandler.java

@@ -76,14 +76,17 @@ public class MyExceptionHandler extends DefaultErrorWebExceptionHandler {
     }
 
     /**
-     * 根据code获取对应的HttpStatus
+     * 获取HttpStatus
      *
      * @param errorAttributes
      */
     @Override
     protected HttpStatus getHttpStatus(Map<String, Object> errorAttributes) {
-        int statusCode = (int) errorAttributes.get("code");
-        return HttpStatus.valueOf(statusCode);
+//        // 根据code获取对应的HttpStatus
+//        int statusCode = (int) errorAttributes.get("code");
+//        return HttpStatus.valueOf(statusCode);
+        // 统一返回http status: 200
+        return HttpStatus.OK;
     }
 
     /**

+ 5 - 8
base-servers/gateway-server/src/main/resources/application.yml

@@ -17,15 +17,12 @@ spring:
   zipkin:
     sender:
       type: rabbit
-    service:
-      name: ${spring.application.name}
+    locator:
+      discovery:
+        enabled: true
   sleuth:
     sampler:
-      percentage: 1
-    integration:
-      enabled: false
-    scheduled:
-      skip-pattern: "^org.*HystrixStreamTask$"
+      probability: 1.0
   cloud:
     gateway:
       discovery:
@@ -114,7 +111,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}@127.0.0.1:8500/eureka/
 feign:
   hystrix:
     enabled: true

+ 0 - 0
applications/document/document-server/src/main/resources/banner.txt → base-servers/gateway-server/src/main/resources/banner.txt


+ 3 - 3
base-servers/ui-server/pom.xml

@@ -27,15 +27,15 @@
             <artifactId>spring-boot-starter-data-mongodb</artifactId>
         </dependency>
         <!-- sleuth -->
-        <!--<dependency>
+        <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>
+        <!-- test -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>

+ 1 - 4
base-servers/ui-server/src/main/java/com/usoftchina/saas/ui/controller/co/CoViewController.java

@@ -5,10 +5,7 @@ import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.ui.service.ViewService;
 import com.usoftchina.saas.ui.service.co.CoViewService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author yingp

+ 5 - 4
base-servers/ui-server/src/main/resources/application.yml

@@ -13,11 +13,12 @@ spring:
   zipkin:
     sender:
       type: rabbit
-    service:
-      name: ${spring.application.name}
+    locator:
+      discovery:
+        enabled: true
   sleuth:
     sampler:
-      percentage: 1.0
+      probability: 1.0
   data:
     mongodb:
       uri: mongodb://192.168.253.12:27017/saas_ui
@@ -37,7 +38,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}@127.0.0.1:8500/eureka/
 info:
   name: '@project.artifactId@'
   description: '@project.description@'

+ 1 - 1
base-servers/ui-server/src/test/java/com/usoftchina/saas/ui/test/ViewServiceTest.java

@@ -30,7 +30,7 @@ public class ViewServiceTest {
     @Autowired
     private ComponentService componentService;
 
-    private String viewName = "test.form";
+    private String viewName = "junit.test.form";
 
     @Before
     public void generateData() {

+ 5 - 0
base-servers/zipkin-server/pom.xml

@@ -46,6 +46,11 @@
             <groupId>io.zipkin.java</groupId>
             <artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.jooq</groupId>
+            <artifactId>jooq</artifactId>
+            <version>3.11.4</version>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 2
base-servers/zipkin-server/src/main/java/com/usoftchina/saas/zipkin/ZipkinApplication.java

@@ -2,7 +2,7 @@ package com.usoftchina.saas.zipkin;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
 import zipkin2.server.internal.EnableZipkinServer;
 
 /**
@@ -11,7 +11,7 @@ import zipkin2.server.internal.EnableZipkinServer;
  */
 @EnableZipkinServer
 @SpringBootApplication
-@EnableEurekaClient
+//@EnableEurekaClient
 public class ZipkinApplication {
     public static void main(String[] args) {
         SpringApplication.run(ZipkinApplication.class, args);

+ 2 - 0
base-servers/zipkin-server/src/main/resources/application.yml

@@ -14,6 +14,7 @@ eureka:
     leaseRenewalIntervalInSeconds: 10
     health-check-url-path: /actuator/health
     status-page-url-path: /actuator/info
+    prefer-ip-address: true
     metadata-map:
       user.name: ${spring.security.user.name}
       user.password: ${spring.security.user.password}
@@ -35,6 +36,7 @@ zipkin:
       password: guest
       queue: zipkin
   storage:
+    type: mysql
     mysql:
       host: 192.168.253.12
       username: root

+ 0 - 3
base-servers/zipkin-server/src/main/resources/config/application-docker.yml

@@ -1,7 +1,4 @@
 eureka:
-  instance:
-    hostname: saas-zipkin-server
-    prefer-ip-address: false
   client:
     serviceUrl:
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@saas-eureka-server:8500/eureka/

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

@@ -101,6 +101,10 @@ public class Result<T> implements Serializable {
 
     public static Result throwable(Throwable e) {
         Result result = error();
+        if (e instanceof BaseException) {
+            return error((BaseException) e);
+        }
+        result.setCode(500);
         result.setMessage(e.getMessage());
         return result;
     }

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

@@ -1,7 +1,14 @@
 package com.usoftchina.saas.server;
 
+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 javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * @author yingp
@@ -10,5 +17,16 @@ import org.springframework.context.annotation.Configuration;
 @Configuration
 @ComponentScan(basePackages = {"com.usoftchina.saas.server"})
 public class ServerAutoConfiguration {
-    
+
+    @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());
+                return null;
+            }
+        };
+    }
 }

+ 25 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ErrorConfig.java

@@ -0,0 +1,25 @@
+package com.usoftchina.saas.server.error;
+
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.Ordered;
+
+import javax.servlet.DispatcherType;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+@Configuration
+public class ErrorConfig {
+
+    @Bean
+    public FilterRegistrationBean<UnCaughtErrorFilter> unCaughtErrorFilter() {
+        UnCaughtErrorFilter filter = new UnCaughtErrorFilter();
+        FilterRegistrationBean<UnCaughtErrorFilter> registration = new FilterRegistrationBean<>(filter);
+        registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
+        registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
+        return registration;
+    }
+}

+ 53 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/GlobalExceptionHandler.java

@@ -0,0 +1,53 @@
+package com.usoftchina.saas.server.error;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.exception.BizException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+    private Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
+
+    /**
+     * 默认异常处理
+     *
+     * @param request
+     * @param e
+     * @return
+     * @throws Exception
+     */
+    @ExceptionHandler(value = Exception.class)
+    @ResponseBody
+    public Result defaultHandler(HttpServletRequest request, Exception e) throws Exception{
+        String error = ServletErrorUtils.buildMessage(request, e);
+        logger.error(error, e);
+        return Result.throwable(e);
+    }
+
+    /**
+     * 业务异常
+     *
+     * @param request
+     * @param e
+     * @return
+     * @throws Exception
+     */
+    @ExceptionHandler(value = BizException.class)
+    @ResponseBody
+    public Result bizHandler(HttpServletRequest request, BizException e) throws Exception{
+        String error = ServletErrorUtils.buildMessage(request, e);
+        logger.error(error, e);
+        return Result.error(e);
+    }
+}

+ 0 - 41
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/MyErrorController.java

@@ -1,41 +0,0 @@
-package com.usoftchina.saas.server.error;
-
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
-import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author yingp
- * @date 2018/10/13
- */
-@Controller
-public class MyErrorController extends BasicErrorController {
-
-    public MyErrorController(ServerProperties serverProperties) {
-        super(new DefaultErrorAttributes(), serverProperties.getError());
-    }
-
-    /**
-     * 覆盖默认的错误响应
-     */
-    @Override
-    public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
-        Map<String, Object> body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.ALL));
-        HttpStatus status = getStatus(request);
-        // 输出自定义格式
-        Map<String, Object> map = new HashMap<>(4);
-        map.put("success", false);
-        map.put("code", body.get("status"));
-        map.put("message", body.get("message"));
-        map.put("data", null);
-        return new ResponseEntity<>(map, status);
-    }
-}

+ 52 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java

@@ -0,0 +1,52 @@
+package com.usoftchina.saas.server.error;
+
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.utils.JsonUtils;
+import org.springframework.http.MediaType;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author yingp
+ * @date 2018/10/16
+ */
+public class ServletErrorUtils {
+    /**
+     * 构建异常信息
+     *
+     * @param request
+     * @param ex
+     * @return
+     */
+    public static String buildMessage(HttpServletRequest request, Throwable ex) {
+        StringBuilder message = new StringBuilder("Failed to handle request [");
+        message.append(request.getMethod());
+        message.append(" ");
+        message.append(request.getRequestURI());
+        message.append("]");
+        if (ex != null) {
+            message.append(": ");
+            message.append(ex.getMessage());
+        }
+        return message.toString();
+    }
+
+    /**
+     * 标准Result格式输出
+     *
+     * @param response
+     * @param e
+     * @throws IOException
+     * @throws ServletException
+     */
+    public static void writerErrorResult(HttpServletResponse response, Throwable e) throws IOException {
+        response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
+        PrintWriter writer = response.getWriter();
+        writer.print(JsonUtils.toJsonString(Result.throwable(e)));
+        writer.flush();
+    }
+}

+ 36 - 0
framework/server-starter/src/main/java/com/usoftchina/saas/server/error/UnCaughtErrorFilter.java

@@ -0,0 +1,36 @@
+package com.usoftchina.saas.server.error;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.filter.OncePerRequestFilter;
+import org.springframework.web.util.NestedServletException;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * 处理过滤器里面的异常(无法通过ControllerAdvice处理的)
+ *
+ * @author yingp
+ * @date 2018/10/16
+ */
+public class UnCaughtErrorFilter extends OncePerRequestFilter {
+
+    private Logger logger = LoggerFactory.getLogger(UnCaughtErrorFilter.class);
+
+    @Override
+    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
+        try {
+            chain.doFilter(request, response);
+        } catch (Throwable ex) {
+            Throwable cause = ex;
+            if (ex instanceof NestedServletException) {
+                cause = ((NestedServletException) ex).getRootCause();
+            }
+            logger.error(ServletErrorUtils.buildMessage(request, cause), cause);
+            ServletErrorUtils.writerErrorResult(response, cause);
+        }
+    }
+}

+ 60 - 9
frontend/saas-web/app/util/FormUtil.js

@@ -16,9 +16,12 @@ Ext.define('saas.util.FormUtil', {
         var me = this,
         viewName = form.viewName,
         defaultItems = form.defaultItems,
+        brr = [],
         formModel = form.getViewModel(),
         url = me.baseUrl.replace(me.urlRe, '$1' + viewName);
         
+        brr = brr.concat(form.defaultItems);
+
         this.BaseUtil.request({url, async: false})
         .then(function(response) {
             var res = Ext.decode(response.responseText);
@@ -33,22 +36,47 @@ 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 需要判断类型
+                            item.beforeLabelTextTpl = "<font color=\"red\" style=\"position:relative; top:2px;right:2px; font-weight: bolder;\">*</font>";
+                        }
+
+                        // 如果是从表为其绑定store
                         if(item.xtype == 'detailGridField') {
-                            var storeName = item.name || item.xtype + Ext.id();
                             item.bind = {
-                                store: {
-                                    data : '{' + storeName + '}'
-                                }
+                                store: '{_detailStore}'
                             };           
-
-                            item.store = {
+                            formModel.set('_detailStore', Ext.create('Ext.data.Store', {
                                 fields: item.columns ? item.columns.filter(function(c) {
                                     return !!c.dataIndex;
                                 }).map(function(c) {
-                                    return c.dataIndex;
+                                    var type = "string";
+                                    if(c.xtype!=""){
+                                        if(c.xtype=="numbercolumn"){
+                                            type = "float"
+                                        }
+                                    }
+                                    return {name: c.dataIndex,type:type};
                                 }) : [],
                                 data: []
-                            };
+                            }));
                         }
                     });
                 }
@@ -60,6 +88,9 @@ Ext.define('saas.util.FormUtil', {
         .then(function(items) {
             form.fireEvent('afterSetItems', form, items);
         })
+        .then(function() {
+            me.loadData(form);
+        })
         .catch(function(response) {
             console.error(response);
         });
@@ -67,6 +98,26 @@ Ext.define('saas.util.FormUtil', {
     },
 
     loadData: function(form) {
-
+        var me = this;
+        if(form.initId && form.initId!=0) {
+            var url = form._readUrl + form.initId,async=false;
+            me.BaseUtil.request({url,async })
+            .then(function(response) {
+                var res = Ext.decode(response.responseText);
+                if(res.success) {
+                    form.setFormData({
+                        main: res.data.main,
+                        detail: res.data.items
+                    });
+                }
+            })
+            .catch(function(response) {
+                console.error(response);
+            });
+        }else{
+            var viewModel = form.getViewModel();
+            var detailStore = viewModel.get('_detailStore');
+            detailStore.loadData([{},{},{},{},{},{},{},{},{},{}]);
+        }
     }
 });

+ 10 - 1
frontend/saas-web/app/util/QueryUtil.js

@@ -104,7 +104,16 @@ Ext.define('saas.util.QueryUtil', {
 						});
 						condition += _a + ')';
 					}
-				}  else {
+				} else if(f.xtype == 'multicombo' ){
+				    if(f.value){
+                        if(condition == ''){
+                            condition += f.name + " in (" + f.value+")";
+                        } else {
+                            condition += ' AND ' +  f.name + " in (" + f.value+")";
+                        }
+                    }
+
+                } else {
                     if(!Ext.isEmpty(f.value)){
                         if(me.contains(f.value.toString(), 'BETWEEN', true) && me.contains(f.value.toString(), 'AND', true)){
                             if(condition == ''){

+ 11 - 6
frontend/saas-web/app/view/core/form/ConDateField.js

@@ -77,7 +77,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
-                    me.setValue(v, from, to);
+                    me.setBindValue(v, from, to);
                 }
             }
         });
@@ -107,7 +107,7 @@ Ext.define('saas.view.core.form.ConDateField', {
                     }else {
                         me.value=null;
                     }
-                    me.setValue(v, from, to);
+                    me.setBindValue(v, from, to);
                 }
             }
         });
@@ -189,7 +189,7 @@ Ext.define('saas.view.core.form.ConDateField', {
             from.setEditable(false);
             to.setEditable(false);
         }
-        me.setValue(v, minDate, maxDate);
+        me.setBindValue(v, minDate, maxDate);
     },
     setInitValue: function(v) {
         if (v) {
@@ -197,12 +197,17 @@ Ext.define('saas.view.core.form.ConDateField', {
             this.setDateFieldValue(v);
         }
     },
-    setValue: function(v, from, to){
-        this.value = {type: v,
+    setBindValue: function(v, from, to){
+        this.value = {
+            type: v,
             from: from,
-            to: to};
+            to: to
+        };
         this.publishState('value', this.value);
     },
+    setValue: function(v) {
+        this.value = v;
+    },
     getValue: function(){
         return this.value;
     },

+ 0 - 32
frontend/saas-web/app/view/core/form/DateField.js

@@ -1,32 +0,0 @@
-Ext.define('saas.view.core.form.DateField', {
-    extend: 'Ext.form.field.Date',
-    alias: 'widget.datetimefield',
-
-    setValue: function(v) {
-        var me = this,
-            utilDate = Ext.Date,
-            rawDate;
-        me.lastValue = me.rawDateText;
-        me.lastDate = me.rawDate;
-        if (Ext.isDate(v)) {
-            rawDate = me.rawDate = v;
-            me.rawDateText = me.formatDate(v);
-        } else {
-            rawDate = me.rawDate = me.rawToValue(v);
-            me.rawDateText = me.formatDate(v);
-            if (rawDate === v) {
-                if(v&&v.indexOf('.')>-1&&v.indexOf('T')>-1){
-                     v = v.substring(0,v.indexOf('T'));
-                    rawDate = null;
-                }else{
-                    rawDate = me.rawDate = null;
-                    me.rawDateText = '';
-                }     
-            }
-        }
-        if (rawDate && !utilDate.formatContainsHourInfo(me.format)) {
-            me.rawDate = utilDate.clearTime(rawDate, true);
-        }
-        me.callParent(arguments);
-    }
-});

+ 121 - 26
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -36,31 +36,10 @@ Ext.define('saas.view.core.form.FormPanel', {
     initComponent: function() {
 
         var me = this;
-        //me.FormUtil.setItems(me);
-
-        //判断是否加载数据
-
-        if(me.initId&&me.initId!=0){
-            var url = me._dataModelUrl + me.initId,async=false;
-            me.BaseUtil.request({url,async })
-            .then(function(response) {
-                var res = Ext.decode(response.responseText);
-                if(res.success) {
-                    viewModel = me.getViewModel();
-                    viewModel.setData(res.data.main);
-                    viewModel.setData({'detailGridField':res.data.items});                   
-                }
-            })
-            .catch(function(response) {
-                console.error(response);
-            });
-        }else{
-            viewModel = me.getViewModel();
-            viewModel.setData({'detailGridField':[{},{}]});     
-        }
+        me.initViewModel();
+        me.FormUtil.setItems(me);
 
         Ext.apply(me, {
-            items:me.defaultItems,
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'top',
@@ -78,23 +57,139 @@ Ext.define('saas.view.core.form.FormPanel', {
                 }, {
                     xtype: 'button',
                     text: '保存',
-                    handler: 'save'
+                    handler: 'save',
+                    formBind: true
                 }, {
                     xtype: 'button',
                     text: '删除',
                     handler: 'delete'
                 }, {
                     xtype: 'button',
-                    text: '审核',
-                    handler: "audit"
+                    bind: {
+                        text: '{auditBtnText}'
+                    },
+                    handler: "auditBtnClick",
+                    
                 }]))
             }]
         });
         me.callParent(arguments);
     },
 
+    /**
+     * 一些初始化viewModel的方法
+     */
+    initViewModel: function() {
+        var me = this,
+        statusField = me._statusField,
+        statusCodeField = me._statusCodeField,
+        viewModel = me.getViewModel();
+        
+        var o = {};
+        o[statusField] = {
+            bind: '{' + statusCodeField + '}',
+            get: function(value) {
+                return value == 'AUDITED' ? '已审核' : '未审核'
+            }
+        };
+        o['auditBtnText'] = {
+            bind: '{' + 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', "审核");
+    },
+
     addItems: function(items) {
+        var me = this;
+        me.setBindFields(items);
         return this.add(items);
+    },
+
+    /**
+     * 获取form数据
+     */
+    getFormData: function(ignore) {
+        var me = this,
+        viewModel = me.getViewModel(),
+        allData = viewModel.getData(),
+        bindFields = allData.bindFields,
+        formData = {
+            main: {},
+            detail: []
+        };
+
+        for(k in allData) {
+            var d = allData[k];
+            // 主表数据
+            if(ignore) {
+                formData.main[k] = d;
+            }else {
+                if(bindFields.indexOf(k) != -1) {
+                    formData.main[k] = d;
+                }
+            }
+
+            // 从表数据
+            if(k == '_detailStore') {
+                storeData = d.getData().items;
+                formData.detail = storeData;
+            }
+        }
+        
+        return formData;
+    },
+
+    setFormData: function(formData) {
+        var me = this,
+        main = formData.main,
+        detail = formData.detail,
+        viewModel = me.getViewModel(),
+        detailStore = viewModel.get('_detailStore');
+
+        viewModel.setData(main);
+        detailStore.loadData(detail);
+    },
+
+    /**
+     * 设置需要绑定的字段
+     */
+    setBindFields: function(items) {
+        var me = this,
+        viewModel = me.getViewModel(),
+        bindFields = [];
+
+        Ext.Array.each(items, function(item) {
+            var ignore = item.ignore,
+            bind = item.bind;
+
+            if(!ignore && bind) {
+                if(!Ext.isString(bind)) {
+                    // 这里默认所有的fields都绑定的value,如果是其他属性则需要在加载成组件之后去获取他的defaultBind
+                    bind = bind.value;
+                }
+                if(bind) {
+                    bind = bind.replace(/[{|}]/g, '');
+                    bindFields.push(bind);
+                }
+            }
+        });
+        viewModel.set('bindFields', bindFields);
+    },
+
+    initFormData: function(formData) {
+        var me = this,
+        main = formData.main,
+        detail = formData.detail,
+        viewModel = me.getViewModel();
+
+        viewModel.setData(main);
+        // viewModel.set('detailGridField');
     }
     
 });

+ 82 - 86
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -5,17 +5,26 @@ Ext.define('saas.view.core.form.FormPanelController', {
     BaseUtil: Ext.create('saas.util.BaseUtil'),
     FormUtil: Ext.create('saas.util.FormUtil'),
 
-    add: function(btn){
-        var form = btn.ownerCt.ownerCt;
+    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 mainTab = Ext.getCmp('main-tab-panel');
-        var title = '新增' + btn.ownerCt.ownerCt._title;
+        var title = '新增' + form._title;
         var id = form.xtype + '_add';
         existingItem = mainTab.down('[id=' + id + ']');
-
         lastView = mainTab.getActiveTab();
-
         if (!existingItem) {
             var form = {
+                initId:0,
                 id,
                 title,
                 xtype:form.xtype
@@ -26,34 +35,33 @@ Ext.define('saas.view.core.form.FormPanelController', {
         }
     },
     
-    delete: function(btn){
-        var form = btn.ownerCt.ownerCt;
+    delete: function(){
+        var me = this;
+        var form = this.getView();
         var id = form.getForm().findField(form._idField);
         if(id&&id.value!=0){
-            Ext.Ajax.request({
+            me.BaseUtil.request({
                 url: form._deleteUrl+id.value,
-                params: '',
-                headers: {
-                    'Access-Control-Allow-Origin': '*',
-                    "Content-Type": 'application/json;charset=UTF-8' 
-                },
-                success: function (response, opts) {
+                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('提示','删除成功');
-                },
-                failure: function (response, opts) {
-                    //失败
-                    Ext.Msg.alert('提示','删除失败');
                 }
+            })
+            .catch(function() {
+                Ext.Msg.alert('提示','删除失败');
             });
         }
     },
 
-    save:function(btn){
+    save:function(){
         var me = this;
-        var form = btn.ownerCt.ownerCt;
+        var form = this.getView();
         if(form.getForm().wasDirty==false){
             Ext.Msg.alert('提示','未修改数据,请修改后保存');
             return false;
@@ -63,102 +71,90 @@ Ext.define('saas.view.core.form.FormPanelController', {
             return false;
         }
         //form里面数据
-        var formData = form.viewModel.data;
-        var gridData = [];
-        var newGridData = [];
-        if(formData.detailGridField){
-            gridData = formData.detailGridField;
-        }
-
-        var grid = form.query('detailGridField')[0];
-        var items = grid.store.data.items;
-        if(items.length>0){
-            Ext.each(items, function(rec){
-                if(rec.dirty==true){
-                    Ext.each(gridData, function(data,index){
-                        data[form._detnoColumn] = index + 1;
-                        if(rec.id == data.id){
-                            newGridData.push(data);
-                            return false;
-                        }else if ((typeof data.id) != 'number'&&data.id.indexOf('extMode')>-1){
-                            data.id = '';
-                            newGridData.push(data);
-                            return false;
-                        }
-                    });
+        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 = '';
+                    }
+                    dirtyGridData.push(item.data)
                 }
             });
-        }   
+        }  
+        debugger 
         var params = {
-            main:formData,
-            items:newGridData
+            main:formData.main,
+            items:dirtyGridData
         }
         me.BaseUtil.request({
             url: form._saveUrl,
             params: JSON.stringify(params),
             method: 'POST',
         })
-        .then(function() {
-            Ext.Msg.alert('提示','保存成功');
+        .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(btn){
-        var form = btn.ownerCt.ownerCt;
+
+    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.viewModel.data;
-        var gridData = [];
-        var newGridData = [];
-        if(formData.detailGridField){
-            gridData = formData.detailGridField;
-        }
-        var grid = form.query('detailGridField')[0];
-        var updRecords = grid.store.getUpdatedRecords();
-        if(updRecords.length>0){
-            Ext.each(updRecords, function(rec){
-                Ext.each(gridData, function(data,index){
-                    if(data.id==rec.id){
-                        if(data.id.indexOf('extMode')>-1){
-                            data.id = '';
-                            data[form._detnoColumn] = index + 1;
-                        }
-                        newGridData.push(data);
+        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 = '';
                     }
-                });
+                    dirtyGridData.push(item.data)
+                }
             });
         }   
         var params = {
-            main:formData,
-            items:newGridData
+            main:formData.main,
+            items:dirtyGridData
         }
-        Ext.Ajax.request({
+        me.BaseUtil.request({
             url: form._auditUrl,
             params: JSON.stringify(params),
             method: 'POST',
-            headers: {
-                'Access-Control-Allow-Origin': '*',
-                "Content-Type": 'application/json;charset=UTF-8' 
-            },
-            success: function (response, opts) {
-                //解析参数
+        })
+        .then(function(res) {
+            var localJson = new Ext.decode(res.responseText);
+            if(localJson.success){
                 Ext.Msg.alert('提示','审核成功');
-            },
-            failure: function (response, opts) {
-                //失败
-                Ext.Msg.alert('提示','审核失败');
+                form.initId = localJson.data.id;
+                form.FormUtil.loadData(form);
             }
+        })
+        .catch(function() {
+            Ext.Msg.alert('提示','审核失败');
         });
     },
-    /**
-     * 获取form数据
-     */
-    getFormData: function() {
-        
+    unAudit: function() {
+        console.log('反审核');
+        return;
     }
 });

+ 6 - 1
frontend/saas-web/app/view/core/form/FormPanelModel.js

@@ -1,4 +1,9 @@
 Ext.define('saas.view.core.form.FormPanelModel', {
     extend: 'Ext.app.ViewModel',
-    alias: 'viewmodel.core-form-formpanel'
+    alias: 'viewmodel.core-form-formpanel',
+
+    data: {
+        bindFields: [], // 请求绑定字段,绑定到formfield并且未设置ignore为true
+        _detailStore: null, // 从表store
+    },
 });

+ 137 - 0
frontend/saas-web/app/view/core/form/MultiCombo.js

@@ -0,0 +1,137 @@
+/**
+ * Created by zhouy on 2018/10/17.
+ */
+Ext.define('saas.view.core.form.MultiCombo', {
+    extend: 'Ext.form.field.Trigger',
+    alias: 'widget.multicombo',
+    editable : false,
+    matchFieldWidth: true,
+    cachedConfig: {
+        menuAlign: 'tl-bl?',
+        destroyMenu: true
+    },
+    initComponent: function() {
+        var me = this;
+        me.callParent(arguments);
+    },
+    listeners:{
+        afterrender:function(f){
+            this.mon(f.el,{
+                mouseover: this.onMouseOver,
+                mouseleave:this.onMouseLeave,
+                scope:this
+            });
+        }
+
+    },
+    onMouseOver:function(){
+       this.showMenu();
+    },
+    onMouseLeave:function(a,b,c){
+        console.log(a);
+        console.log(b);
+        console.log(c);
+        this.hideMenu(a.parentEvent?a:b);//el光标离开第二个参数为Event对象
+    },
+    onTriggerClick:function(){
+        this.showMenu();
+    },
+    getMenu: function() {
+        var me = this;
+
+        if (!me.menu) {
+
+            me.menu = Ext.create('Ext.menu.Menu',{
+                hideOnParentHide: false,
+                items: me.getMenuItems(),
+                listeners:{
+                    mouseleave:me.onMouseLeave,
+                    scope:me
+                }
+            });
+        }
+        return me.menu;
+    },
+    getMenuItems:function(){
+        var me = this,
+            i = 0,
+            item,
+            items = me.datas,
+            itemsLn = me.datas.length,
+            menuItems = [];
+        for (; i < itemsLn; i++) {
+            item = items[i];
+            menuItem = new Ext.menu.CheckItem({
+                text: item[1],
+                checked: item.checked,
+                checkValue:item[0],
+                hideOnClick: false,
+                checkHandler: this.onCheckChange,
+                scope: this
+            });
+            menuItems.push(menuItem);
+        }
+        return menuItems.length ? menuItems : null;
+    },
+    onCheckChange:function(checkItem, checked){
+        var items=this.menu.items.items,
+            checkedItems = [];
+        Ext.Array.each(items,function(item){
+            if(item.checked){
+                checkedItems.push({
+                    text: item.text,
+                    value: item.checkValue
+                });
+            }
+        });
+        this.setValue(checkedItems);
+        this.publishState('value', checkedItems);
+    },
+
+    setValue: function(items) {
+        var rawV = '';
+        rawV = items.map(function(item) {
+            return item.text
+        }).join(',');
+        this.setRawValue(rawV);
+        this.value = items;
+    },
+
+    showMenu: function (e, menu) {
+        menu = menu || this.getMenu();
+        /**
+         * menu上边框样式待处理
+         * */
+        if (menu) {
+            if (menu.isVisible()) {
+                    menu.focus();
+            } else {
+                menu.autoFocus = true;
+                if(this.matchFieldWidth){
+                    menu.setWidth(this.bodyEl.getWidth());
+                }
+                if (menu.isMenu) {
+                    menu.showBy(this.inputEl, this.getMenuAlign(),[-1, 0]);
+                } else if (menu.isViewportMenu) {
+                    menu.setDisplayed(!menu.getDisplayed());
+                } else {
+                    menu.show();
+                }
+            }
+        }
+    },
+    hideMenu: function(b) {
+        console.log(b);
+        if (this.hasVisibleMenu()) {
+            var target=b.parentEvent.relatedTarget;
+            if(!((target.className && target.className.indexOf('x-menu')!=-1) || (target.name && target.name.indexOf(this.name)!=-1))){
+                this.menu.hide();
+            }
+        }
+        return this;
+    },
+    hasVisibleMenu: function() {
+        var menu = this.menu;
+        return menu && menu.rendered && menu.isVisible();
+    }
+});

+ 38 - 12
frontend/saas-web/app/view/core/form/field/DetailGridField.js

@@ -25,6 +25,16 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     showIndex: true,
     configUrl: '',
 
+    features: [{
+        ftype : 'groupingsummary',
+        groupHeaderTpl : '{name}',
+        hideGroupedHeader : false,
+        enableGroupingMenu : false
+    }, {
+        ftype: 'summary',
+        dock: 'bottom'
+    }],
+
     initComponent: function() {
         var me = this;
         Ext.apply(me, {
@@ -55,6 +65,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     text: 'Debugger',
                     handler: function() {
                         var detailGrid = me;
+                        var form = detailGrid.up('form');
                         debugger;
                     }
                 }]
@@ -64,45 +75,60 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     listeners: {
-        // afterrender:function(grid){
-        //     var count = grid.store.getCount();
-        //     if(count==0){
-        //         grid.add10EmptyRow();
-        //     }
-        // },
         itemClick: function(tableView, record, item, index, e, eOpts) {
             var grid = tableView.up('grid'),
                 store = grid.store,
                 count = store.getCount();
 
             if(index == count - 1) {
-                //grid.add10EmptyRow();
+                grid.add10EmptyRow();
             }
         }
     },
 
     add10EmptyRow: function() {
         var me = this,
-            store = me.getStore(),
-            selectedRecord = me.selModel.lastSelected,
-            datas = [];
+        form = me.ownerCt,
+        detnoColumn = form._detnoColumn,
+        store = me.getStore(),
+        selectedRecord = me.selModel.lastSelected,
+        datas = [];
 
+        //当前行后序号全部加1
+        var detno = selectedRecord.data[form._detnoColumn];
         Ext.Array.each(new Array(10), function() {
-            datas.push({});
+            detno += 1;
+            var data = {};
+            data[detnoColumn] = detno;
+            datas.push(data);
         })
         store.insert(store.indexOf(selectedRecord) + 1, datas);
     },
 
     addDetail: function() {
         var me = this,
+            form = me.ownerCt,
+            detnoColumn = form._detnoColumn,
             store = me.getStore(),
             selectedRecord = me.selModel.lastSelected;
 
-        store.insert(store.indexOf(selectedRecord) + 1, {});
+        //当前行后序号全部加1
+        var detno = selectedRecord.data[form._detnoColumn];
+        var store = me.store;
+        store.each(function(item){
+            d = item.data[detnoColumn];
+            if(Number(d) > detno) {
+                item.set(detnoColumn, Number(d) + 1);
+            }
+        });
+        var data = {};
+        data[detnoColumn] = detno + 1;
+        store.insert(store.indexOf(selectedRecord) + 1, data);
     },
 
     deleteDetail: function() {
         var me = this,
+            form = me.ownerCt;
             store = me.getStore(),
             selectedRecord = me.selModel.lastSelected;
 

+ 2 - 6
frontend/saas-web/app/view/main/MainController.js

@@ -21,9 +21,7 @@ Ext.define('saas.view.main.MainController', {
             mainTab = refs.mainTabPanel,
             // existingItem = mainTab.child(type),
             newView,
-            id = 'maintab-' + nodeData.id 
-
-,
+            id = 'maintab-' + nodeData.id,
             title = nodeData.text;
             existingItem = mainTab.down('[id=' + id + ']'),
             lastView = mainTab.getActiveTab();
@@ -68,9 +66,7 @@ Ext.define('saas.view.main.MainController', {
             collapsing = !navigationList.getMicro(),
             new_width = collapsing ? 64 : 250;
 
-        if (Ext.isIE9m || !Ext.os.is 
-
-.Desktop) {
+        if (Ext.isIE9m || !Ext.os.is.Desktop) {
             Ext.suspendLayouts();
 
             refs.mainLogo.setWidth(new_width);

+ 12 - 2
frontend/saas-web/app/view/main/MainModel.js

@@ -32,10 +32,20 @@ Ext.define('saas.view.main.MainModel', {
                                         viewType:'purchase-purchase-formpanel',
                                         leaf: true
                                     },{
-                                        id: 'purchaseList',
-                                        text: '采购单列表',
+                                        id: 'purchaseQuery',
+                                        text: '采购单查询',
                                         viewType:'purchase-purchase-querypanel',
                                         leaf: true
+                                    },{
+                                        id: 'purchaseInOrder',
+                                        text: '采购验收单(维护界面)',
+                                        viewType:'purchase-purchaseIn-formpanel',
+                                        leaf: true
+                                    },{
+                                        id: 'purchaseInQuery',
+                                        text: '采购验收单查询',
+                                        viewType:'purchase-purchaseIn-querypanel',
+                                        leaf: true
                                     },{
                                         id: 'list1',
                                         text: '列表界面1',

+ 6 - 5
frontend/saas-web/app/view/purchase/purchase/FormPanel.js

@@ -7,7 +7,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
     
     _title:'采购单',
     _codeField: 'pu_ode',
-    _statusField: 'pu_statuscode',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
     _idField: 'id',
     _detnoColumn:  'pd_detno',
     _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
@@ -191,7 +192,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
                 xtype:'datecolumn',
                 format : "Y-m-d H:i:s", 
                 editor : {
-                    xtype : "datetimefield",
+                    xtype : "datefield",
                     editable : true, 
                     format : "Y-m-d H:i:s", 
                     hideTrigger : false
@@ -206,7 +207,7 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
         ]
     }, {
         format : "Y-m-d", 
-        xtype : "datetimefield", 
+        xtype : "datefield", 
         name : "createTime", 
         bind : "{createTime}", 
         fieldLabel : "创建时间", 
@@ -223,8 +224,8 @@ Ext.define('saas.view.purchase.purchase.FormPanel', {
         xtype : "textfield", 
         readOnly : true, 
         editable : false, 
-        name : "puStatus", 
-        bind : "{puStatus}", 
+        name : "pu_status", 
+        bind : "{pu_status}", 
         fieldLabel : "单据状态", 
         allowBlank : true, 
         columnWidth : 0.25

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

@@ -108,7 +108,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
         queryMode: 'local',
             displayField: 'pr_status',
             valueField: 'pr_statuscode',
-        store: Ext.create('Ext.data.ArrayStore', {
+            store: Ext.create('Ext.data.ArrayStore', {
             fields: ['pr_statuscode', 'pr_status'],
             data: [
                 ["$ALL", "全部"],
@@ -117,24 +117,17 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
             ]
         })
     }, {
-        xtype: 'combobox',
+        xtype: 'multicombo',
         name: 'pu_acceptstatuscode',
-        bind: '{pu_acceptstatuscode}',
+       // bind: '{pu_acceptstatuscode}',
         fieldLabel: '入库状态',
         allowBlank: true,
         columnWidth: 0.25,
-        queryMode: 'local',
-        displayField: 'pu_acceptstatus',
-        valueField: 'pu_acceptstatuscode',
-        store: Ext.create('Ext.data.ArrayStore', {
-            fields: ['pu_acceptstatuscode', 'pu_acceptstatus'],
-            data: [
-                ["$ALL", "全部"],
+        datas: [
                 ["TURNOUT", "已入库"],
                 ["NOOUT", "未入库"],
                 ["PARTOUT", "部分入库"]
             ]
-        })
     }],
     moreQueryFormItems: [{
         xtype: 'textfield',

+ 137 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormController.js

@@ -0,0 +1,137 @@
+Ext.define('saas.view.purchase.purchaseIn.FormController', {
+    extend: 'saas.view.core.form.FormPanelController',
+    alias: 'controller.purchase-purchaseIn-formcontroller',
+    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.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'
+                        }],
+                        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();
+
+    }
+});

+ 7 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormModel.js

@@ -0,0 +1,7 @@
+Ext.define('saas.view.purchase.purchaseIn.FormModel', {
+    extend: 'saas.view.core.form.FormPanelModel',
+    alias: 'viewmodel.purchase-purchaseIn-formmodel',
+    data: {
+        pi_class: '采购验收单'
+     }
+});

+ 275 - 0
frontend/saas-web/app/view/purchase/purchaseIn/FormPanel.js

@@ -0,0 +1,275 @@
+Ext.define('saas.view.purchase.purchaseIn.FormPanel', {
+    extend: 'saas.view.core.form.FormPanel',
+    xtype: 'purchase-purchaseIn-formpanel',
+
+    controller: 'purchase-purchaseIn-formcontroller',
+    viewModel: 'purchase-purchaseIn-formmodel',
+    
+    _title:'采购验收单',
+    _codeField: 'pi_inoutno',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
+    _idField: 'id',
+    _detnoColumn:  'pd_pdno',
+    _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
+    _saveUrl:'http://192.168.253.58:8800/purchase/save',
+    _auditUrl:'http://192.168.253.58:8800/purchase/audit',
+    _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
+    _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
+    initId:0,
+
+    toolBtns: [{
+        xtype: 'button',
+        text: '转单按钮',
+        handler: function() {
+            console.log('11');
+        }
+    }],
+
+    defaultItems: [{
+        xtype: 'hidden',
+        name: 'id',
+        bind: '{id}',
+        fieldLabel: 'id',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype : "textfield", 
+        name : "pi_inoutno", 
+        bind : "{pi_inoutno}", 
+        fieldLabel : "验收单号", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "textfield", 
+        name : "pi_class", 
+        bind : "{pi_class}", 
+        fieldLabel : "类型", 
+        readOnly:true,
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_vendid", 
+        bind : "{pu_vendid}", 
+        fieldLabel : "供应商ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_vendcode", 
+        bind : "{pu_vendcode}", 
+        fieldLabel : "供应商编号", 
+        hidden:true,
+        allowBlank : true, 
+        columnWidth : 0, 
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_vendname", 
+        bind : "{pu_vendname}", 
+        fieldLabel : "供应商名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    },{
+        xtype : "datefield", 
+        name : "pu_date", 
+        bind : "{pu_date}", 
+        fieldLabel : "采购日期", 
+        allowBlank : false, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        name : "pu_buyerid", 
+        bind : "{pu_buyerid}", 
+        fieldLabel : "采购员ID", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }, {
+        xtype : "textfield", 
+        name : "pu_buyercode", 
+        bind : "{pu_buyercode}", 
+        fieldLabel : "采购员编号", 
+        allowBlank : true, 
+        hidden:true,
+        columnWidth : 0
+    }, {
+        xtype : "dbfindtrigger", 
+        name : "pu_buyername", 
+        bind : "{pu_buyername}", 
+        fieldLabel : "采购员名称", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_shipaddresscode", 
+        bind : "{pu_shipaddresscode}", 
+        fieldLabel : "交货地址", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        name : "pu_total", 
+        bind : "{pu_total}", 
+        fieldLabel : "单据金额", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        name : "detailGridField", 
+        xtype : "detailGridField", 
+        bind: {
+            store:{
+                data:'{detailGridField}'
+            }
+        },
+        columns : [
+            {
+                text : "序号", 
+                dataIndex : "pd_pdno", 
+                width : 80.0, 
+                xtype : "rownumberer"
+            }, {
+                text : "id", 
+                dataIndex : "id", 
+                xtype : "numbercolumn"
+            },
+            {
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }, 
+                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_inqty", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+            {
+                text : "仓库", 
+                dataIndex : "pd_whname", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },
+            {
+                text : "单价", 
+                dataIndex : "pd_orderprice", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            }, 
+           {
+                text : "含税金额", 
+                dataIndex : "pd_total", 
+                width : 120.0, 
+                xtype : "numbercolumn"
+            }, {
+                text : "税率", 
+                dataIndex : "pd_taxrate", 
+                width : 120.0, 
+                xtype : "numbercolumn", 
+                items : null
+            },
+            {
+                text : "未税金额", 
+                dataIndex : "pd_nettotal", 
+                xtype : "numbercolumn"
+            },
+            {
+                text : "采购单号", 
+                dataIndex : "pd_ordercode", 
+                width : 120.0,
+                flex : 1.0,
+                editor : {
+                    displayField : "display", 
+                    editable : true, 
+                    format : "", 
+                    hideTrigger : false, 
+                    maxLength : 100.0, 
+                    minValue : null, 
+                    positiveNum : false, 
+                    queryMode : "local", 
+                    store : null, 
+                    valueField : "value", 
+                    xtype : "dbfindtrigger"
+                }
+            },{
+                text : "采购序号", 
+                dataIndex : "pd_orderdetno", 
+                xtype : "numbercolumn",
+                flex:1
+            }
+        ]
+    }, {
+        format : "Y-m-d", 
+        xtype : "datefield", 
+        name : "createTime", 
+        bind : "{createTime}", 
+        fieldLabel : "创建时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "datefield", 
+        name : "updateTime", 
+        bind : "{updateTime}", 
+        fieldLabel : "更新时间", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "textfield", 
+        readOnly : true, 
+        editable : false, 
+        name : "pu_status", 
+        bind : "{pu_status}", 
+        fieldLabel : "单据状态", 
+        allowBlank : true, 
+        columnWidth : 0.25
+    }, {
+        xtype : "hidden", 
+        readOnly : true, 
+        editable : false, 
+        name : "pu_statuscode", 
+        bind : "{pu_statuscode}", 
+        fieldLabel : "单据状态码", 
+        allowBlank : true, 
+        columnWidth : 0.0
+    }]
+});

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

@@ -0,0 +1,256 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanel', {
+    extend: 'saas.view.core.query.QueryPanel',
+    xtype: 'purchase-purchaseIn-querypanel',
+
+    controller: 'purchase-purchaseIn-queryformcontroller',
+    viewModel: 'purchase-purchaseIn-queryformmodel',
+    _baseVastUrl:'http://192.168.253.58:8800/purchase/',
+    _idField:'pi_id',
+    _codeField:'pi_inoutno',
+    queryFormItems: [{
+        xtype: 'hidden',
+        name: 'pi_id',
+        bind: '{pi_id}',
+        fieldLabel: 'ID',
+        allowBlank: true,
+        columnWidth: 0
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pi_inoutno',
+        bind: '{pi_inoutno}',
+        fieldLabel: '单据编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        dataUrl:'http://192.168.253.41:9480/api/document/vendor/getVendorsByCondition',
+        dbfinds:[{
+            from:'ve_code',to:'pu_code'
+        }],
+        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
+        }]
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_date',
+        bind: '{pu_date}',
+        fieldLabel: '采购日期',
+        allowBlank: true,
+        columnWidth: 0.5
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pu_vendcode',
+        bind: '{pu_vendcode}',
+        fieldLabel: '供应商编号',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pu_vendname',
+        bind: '{pu_vendname}',
+        fieldLabel: '供应商名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'dbfindtrigger',
+        name: 'pd_prodcode#pd_prodcode',
+        bind: '{pd_prodcode}',
+        fieldLabel: '物料编号',
+        fieldMode: 'DETAIL',
+        queryType:'VAG',
+        allowBlank: true,
+        columnWidth: 0.25,
+        configUrl: 'resources/json/purchase/vendorColumnsDbfind.json',
+        dataUrl: 'resources/json/purchase/vendorDataDbfind.json'
+    }, {
+        xtype: 'textfield',
+        name: 'pr_detail',
+        bind: '{pr_detail}',
+        fieldLabel: '物料名称',
+        allowBlank: true,
+        columnWidth: 0.25
+    }, {
+        xtype: 'combobox',
+        name: 'pr_statuscode',
+       // bind: '{pr_statuscode}',
+        fieldLabel: '审核状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+            displayField: 'pr_status',
+            valueField: 'pr_statuscode',
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['pr_statuscode', 'pr_status'],
+            data: [
+                ["$ALL", "全部"],
+                ["AUDITED", "已审核"],
+                ["UNAUDITED", "未审核"]
+            ]
+        })
+    }, {
+        xtype: 'combobox',
+        name: 'pu_acceptstatuscode',
+        bind: '{pu_acceptstatuscode}',
+        fieldLabel: '入库状态',
+        allowBlank: true,
+        columnWidth: 0.25,
+        queryMode: 'local',
+        displayField: 'pu_acceptstatus',
+        valueField: 'pu_acceptstatuscode',
+        store: Ext.create('Ext.data.ArrayStore', {
+            fields: ['pu_acceptstatuscode', 'pu_acceptstatus'],
+            data: [
+                ["$ALL", "全部"],
+                ["TURNOUT", "已入库"],
+                ["NOOUT", "未入库"],
+                ["PARTOUT", "部分入库"]
+            ]
+        })
+    }],
+    moreQueryFormItems: [{
+        xtype: 'textfield',
+        name: 'pu_buyername',
+        bind: '{pu_buyername}',
+        fieldLabel: '采购员',
+        allowBlank: true
+    }, {
+        xtype: 'textfield',
+        name: 'pu_total',
+        bind: '{pu_total}',
+        fieldLabel: '金额',
+        allowBlank: true
+    }, {
+        xtype: 'condatefield',
+        name: 'pu_delivery',
+        bind: '{pu_delivery}',
+        fieldLabel: '交货日期',
+        allowBlank: true,
+        columnWidth: 1
+    }],
+    queryGridConfig: {
+        _idField:'pu_id',
+        _codeField:'pu_code',
+        _title:'采购单',
+        _addXtype:'test-order-formpanel',
+        _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
+        }]
+    }
+});

+ 5 - 0
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelController.js

@@ -0,0 +1,5 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanelController', {
+    extend: 'saas.view.core.query.QueryPanelController',
+    alias: 'controller.purchase-purchaseIn-queryformcontroller',
+
+});

+ 9 - 0
frontend/saas-web/app/view/purchase/purchaseIn/QueryPanelModel.js

@@ -0,0 +1,9 @@
+Ext.define('saas.view.purchase.purchaseIn.QueryPanelModel', {
+    extend: 'saas.view.core.query.QueryPanelModel',
+    alias: 'viewmodel.purchase-purchaseIn-queryformmodel',
+
+    data: {
+       // pu_total: '3333',
+        //pu_code: '4'
+    }
+});

+ 1 - 0
frontend/saas-web/app/view/test/order/FormModel.js

@@ -2,4 +2,5 @@ Ext.define('saas.view.test.order.FormModel', {
     extend: 'saas.view.core.form.FormPanelModel',
     alias: 'viewmodel.test-order-formmodel',
 
+    
 });

+ 54 - 35
frontend/saas-web/app/view/test/order/FormPanel.js

@@ -5,17 +5,20 @@ Ext.define('saas.view.test.order.FormPanel', {
     controller: 'test-order-formcontroller',
     viewModel: 'test-order-formmodel',
     
+    //字段属性
     _title:'采购单',
-    _codeField: 'pu_ode',
-    _statusField: 'pu_statuscode',
     _idField: 'id',
+    _codeField: 'pu_code',
+    _statusField: 'pu_status',
+    _statusCodeField: 'pu_statuscode',
     _detnoColumn:  'pd_detno',
-    _dataModelUrl:'http://192.168.253.58:8800/purchase/read/',
+    _relationColumn: 'pd_puid',
+    _readUrl:'http://192.168.253.58:8800/purchase/read/',
     _saveUrl:'http://192.168.253.58:8800/purchase/save',
     _auditUrl:'http://192.168.253.58:8800/purchase/audit',
     _deleteUrl:'http://192.168.253.58:8800/purchase/delete/',
     _deleteDetailUrl:'http://192.168.253.58:8800/purchase/deleteItem/',
-    initId:0,
+    initId:11,
 
     toolBtns: [{
         xtype: 'button',
@@ -36,7 +39,7 @@ Ext.define('saas.view.test.order.FormPanel', {
         xtype : "textfield", 
         name : "pu_code", 
         bind : "{pu_code}", 
-        fieldLabel : "采购单号", 
+        fieldLabel : "采购单号",
         allowBlank : true, 
         columnWidth : 0.25
     }, {
@@ -44,8 +47,9 @@ Ext.define('saas.view.test.order.FormPanel', {
         name : "pu_date", 
         bind : "{pu_date}", 
         fieldLabel : "采购日期", 
-        allowBlank : true, 
-        columnWidth : 0.25
+        allowBlank : false, 
+        columnWidth : 0.25,
+        format:'Y-m-d'
     }, {
         xtype : "hidden", 
         name : "pu_vendid", 
@@ -120,17 +124,15 @@ Ext.define('saas.view.test.order.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
-        bind: {
-            store:{
-                data:'{detailGridField}'
-            }
-        },
         columns : [
             {
                 text : "序号", 
-                dataIndex : "pdDetno", 
+                dataIndex : "pd_detno", 
                 width : 80.0, 
-                xtype : "rownumberer"
+                xtype : "numbercolumn",
+                summaryType: 'count',
+                align : 'center',
+                format:'0',
             }, 
             {
                 editor : {
@@ -165,45 +167,52 @@ Ext.define('saas.view.test.order.FormPanel', {
             {
                 text : "数量", 
                 dataIndex : "pd_yqty", 
+                editor : {
+                    xtype : "numberfield"
+                },
                 width : 120.0, 
-                xtype : "", 
-                items : null
+                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
+                xtype : "numbercolumn",
+                items : null,
+                summaryType: 'sum'
             }, 
             {
                 text : "总额", 
                 dataIndex : "pd_total", 
                 width : 120.0, 
-                xtype : "numbercolumn"
+                xtype : "numbercolumn",
+                summaryType: 'sum'
             }, 
             {
                 text : "税额", 
                 dataIndex : "pd_taxtotal", 
                 flex : 1.0, 
-                xtype : "numbercolumn"
-            }, 
-            {
-                text : "id", 
-                dataIndex : "id", 
-                flex : 1.0, 
-                xtype : "numbercolumn"
+                xtype : "numbercolumn",
+                summaryType: 'sum'
             }
         ]
     }, {
         format : "Y-m-d", 
-        xtype : "datetimefield", 
+        xtype : "datefield", 
         name : "createTime", 
         bind : "{createTime}", 
         fieldLabel : "创建时间", 
         allowBlank : true, 
         columnWidth : 0.25
     }, {
+        format : "Y-m-d",
         xtype : "datefield", 
         name : "updateTime", 
         bind : "{updateTime}", 
@@ -214,19 +223,29 @@ Ext.define('saas.view.test.order.FormPanel', {
         xtype : "textfield", 
         readOnly : true, 
         editable : false, 
-        name : "puStatus", 
-        bind : "{puStatus}", 
+        name : "pu_status", 
+        bind : "{pu_status}", 
         fieldLabel : "单据状态", 
         allowBlank : true, 
         columnWidth : 0.25
-    }, {
-        xtype : "hidden", 
-        readOnly : true, 
-        editable : false, 
+    }, 
+    // {
+    //     xtype : "hidden", 
+    //     readOnly : true, 
+    //     editable : false, 
+    //     name : "pu_statuscode", 
+    //     bind : "{pu_statuscode}", 
+    //     fieldLabel : "单据状态码", 
+    //     allowBlank : true, 
+    //     columnWidth : 0.0
+    // },
+    {
+        xtype : "textfield", 
         name : "pu_statuscode", 
         bind : "{pu_statuscode}", 
-        fieldLabel : "单据状态码", 
+        fieldLabel : "忽略字段", 
+        ignore:true,
         allowBlank : true, 
-        columnWidth : 0.0
+        columnWidth : 0.25
     }]
 });

+ 10 - 0
frontend/saas-web/app/view/test/query/QueryPanelModel.js

@@ -5,5 +5,15 @@ Ext.define('saas.view.test.query.QueryPanelModel', {
     data: {
        // pu_total: '3333',
         //pu_code: '4'
+    },
+    formulas: {
+        queryItems1: {
+            get: function(get) {
+                var pu_code = get('pu_code'),
+                pu_date = get('pu_date');
+
+                return '单据编号:' + pu_code + ',采购日期:从' + Ext.Date.format(pu_date.from, 'Y-m-d') + '到' + Ext.Date.format(pu_date.to, 'Y-m-d');
+            }
+        }
     }
 });

+ 6 - 0
frontend/saas-web/ext/build/ext-all-rtl-debug.js

@@ -206312,6 +206312,12 @@ Ext.define('Ext.form.field.Date', {
             rawDate;
         me.lastValue = me.rawDateText;
         me.lastDate = me.rawDate;
+        //解析后台日期格式为 Y-m-d
+        if(v&&(typeof v) == "string"&&v.indexOf('.')==19&&v.indexOf('T')==10){
+            var d = new Date(v);
+            var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate(); //+ ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds(); 
+            v = times;
+        }
         if (Ext.isDate(v)) {
             rawDate = me.rawDate = v;
             me.rawDateText = me.formatDate(v);

+ 12 - 2
pom.xml

@@ -31,7 +31,7 @@
         <mybatis.spring.boot.version>1.3.1</mybatis.spring.boot.version>
         <fastjson.version>1.2.44</fastjson.version>
         <alibaba.druid.version>1.1.6</alibaba.druid.version>
-        <zipkin.version>2.11.5</zipkin.version>
+        <zipkin.version>2.11.1</zipkin.version>
         <pagehelper.starter.version>1.2.7</pagehelper.starter.version>
         <shiro.version>1.4.0</shiro.version>
         <swagger.version>2.7.0</swagger.version>
@@ -247,7 +247,7 @@
             </dependency>
             <dependency>
                 <groupId>com.usoftchina.saas</groupId>
-                <artifactId>common-dto</artifactId>
+                <artifactId>commons</artifactId>
                 <version>${project.release.version}</version>
             </dependency>
             <dependency>
@@ -260,6 +260,16 @@
                 <artifactId>purchase-dto</artifactId>
                 <version>${project.release.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.usoftchina.saas</groupId>
+                <artifactId>document-api</artifactId>
+                <version>${project.release.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.usoftchina.saas</groupId>
+                <artifactId>document-dto</artifactId>
+                <version>${project.release.version}</version>
+            </dependency>
             <!-- file upload -->
             <dependency>
                 <groupId>io.github.openfeign.form</groupId>

+ 11 - 0
script/docker-base.yaml

@@ -38,6 +38,17 @@ services:
 #    networks:
 #      - saas
 
+# Elasticsearch, Logstash, Kibana
+  elk:
+    image: sebp/elk
+    container_name: elk
+    ports:
+      - "5601:5601"
+      - "9200:9200"
+      - "5044:5044"
+    networks:
+      - saas
+
 networks:
   saas:
     driver: bridge