Browse Source

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

rainco 7 years ago
parent
commit
26923628fe
66 changed files with 590 additions and 239 deletions
  1. 4 1
      README.md
  2. 6 0
      applications/commons/pom.xml
  3. 4 0
      applications/document/document-dto/pom.xml
  4. 9 7
      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. 5 0
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/ProductController.java
  11. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/ProductMapper.java
  12. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/VendorMapper.java
  13. 1 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/WarehouseMapper.java
  14. 9 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/ProductServiceImpl.java
  15. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/VendorServiceImpl.java
  16. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/Impl/WarehouseServiceImpl.java
  17. 4 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/ProductService.java
  18. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/VendorService.java
  19. 2 1
      applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/WarehouseService.java
  20. 14 0
      applications/document/document-server/src/main/resources/application.yml
  21. 8 4
      applications/document/document-server/src/main/resources/mapper/ProductMapper.xml
  22. 3 3
      applications/document/document-server/src/main/resources/mapper/VendorMapper.xml
  23. 2 2
      applications/document/document-server/src/main/resources/mapper/WarehouseMapper.xml
  24. 0 2
      applications/document/document-server/src/test/java/com/usoftchina/saas/document/service/VendorTest.java
  25. 5 1
      applications/purchase/purchase-dto/pom.xml
  26. 3 0
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseItemDTO.java
  27. 0 1
      applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java
  28. 0 3
      applications/purchase/purchase-server/pom.xml
  29. 4 2
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/po/PurchaseItem.java
  30. 4 7
      applications/purchase/purchase-server/src/main/java/com/usoftchina/saas/purchase/service/impl/PurchaseServiceImpl.java
  31. 14 0
      applications/purchase/purchase-server/src/main/resources/application.yml
  32. 1 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchaseMapper.xml
  33. 32 1
      applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml
  34. 18 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/RoleResourceMapper.java
  35. 1 3
      base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/po/RoleResource.java
  36. 6 0
      base-servers/account/account-server/src/main/resources/mapper/RoleResourceMapper.xml
  37. 16 12
      base-servers/gateway-server/pom.xml
  38. 24 0
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionAdvice.java
  39. 6 3
      base-servers/gateway-server/src/main/java/com/usoftchina/saas/gateway/error/MyExceptionHandler.java
  40. 5 8
      base-servers/gateway-server/src/main/resources/application.yml
  41. 0 0
      base-servers/gateway-server/src/main/resources/banner.txt
  42. 3 3
      base-servers/ui-server/pom.xml
  43. 1 4
      base-servers/ui-server/src/main/java/com/usoftchina/saas/ui/controller/co/CoViewController.java
  44. 5 4
      base-servers/ui-server/src/main/resources/application.yml
  45. 1 1
      base-servers/ui-server/src/test/java/com/usoftchina/saas/ui/test/ViewServiceTest.java
  46. 5 0
      base-servers/zipkin-server/pom.xml
  47. 2 2
      base-servers/zipkin-server/src/main/java/com/usoftchina/saas/zipkin/ZipkinApplication.java
  48. 2 0
      base-servers/zipkin-server/src/main/resources/application.yml
  49. 0 3
      base-servers/zipkin-server/src/main/resources/config/application-docker.yml
  50. 4 0
      framework/core/src/main/java/com/usoftchina/saas/base/Result.java
  51. 19 1
      framework/server-starter/src/main/java/com/usoftchina/saas/server/ServerAutoConfiguration.java
  52. 25 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ErrorConfig.java
  53. 53 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/GlobalExceptionHandler.java
  54. 0 41
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/MyErrorController.java
  55. 52 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/ServletErrorUtils.java
  56. 36 0
      framework/server-starter/src/main/java/com/usoftchina/saas/server/error/UnCaughtErrorFilter.java
  57. 31 8
      frontend/saas-web/app/util/FormUtil.js
  58. 68 23
      frontend/saas-web/app/view/core/form/FormPanel.js
  59. 0 6
      frontend/saas-web/app/view/core/form/FormPanelController.js
  60. 6 1
      frontend/saas-web/app/view/core/form/FormPanelModel.js
  61. 7 6
      frontend/saas-web/app/view/core/form/field/DetailGridField.js
  62. 1 3
      frontend/saas-web/app/view/main/MainController.js
  63. 7 9
      frontend/saas-web/app/view/test/order/FormPanel.js
  64. 10 0
      frontend/saas-web/app/view/test/query/QueryPanelModel.js
  65. 12 2
      pom.xml
  66. 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>

+ 9 - 7
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/ProductDTO.java

@@ -4,21 +4,23 @@ 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;
 
-    public long getPr_id() {
-        return pr_id;
+    public long getId() {
+        return id;
     }
 
-    public void setPr_id(long pr_id) {
-        this.pr_id = pr_id;
+    public void setId(long id) {
+        this.id = id;
     }
 
+    private String pr_brand;
+
+
     public String getPr_code() {
         return pr_code;
     }
@@ -62,7 +64,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" ]

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

@@ -5,6 +5,7 @@ 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;
@@ -38,5 +39,9 @@ public class ProductController {
         productService.updateLatestPurchasePrice(pu_id);
     };
 
+    @RequestMapping("/getProductsByPK")
+    public Product getProductsByPK(@RequestParam(value = "pr_id") Long id) {
+        return productService.getProductsByPK(id);
+    };
 
 }

+ 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>

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

@@ -1,5 +1,6 @@
 package com.usoftchina.saas.purchase.dto;
 
+import com.usoftchina.saas.document.entities.Product;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -69,4 +70,6 @@ public class PurchaseItemDTO implements Serializable{
 
     private Double pd_yqty;
 
+    private Product product;
+
 }

+ 0 - 1
applications/purchase/purchase-dto/src/main/java/com/usoftchina/saas/purchase/dto/PurchaseListDTO.java

@@ -3,7 +3,6 @@ package com.usoftchina.saas.purchase.dto;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.math.BigDecimal;
 import java.util.Date;
 
 /**

+ 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>
 

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

@@ -1,6 +1,8 @@
 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;
@@ -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;
 }

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

@@ -19,6 +19,7 @@ import com.usoftchina.saas.purchase.service.PurchaseService;
 import com.usoftchina.saas.utils.BeanMapper;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
@@ -64,15 +65,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<PurchaseItem> purchaseItems = purchasedetailMapper.selectByFK(id);
+        List<PurchaseItemDTO> items = BeanMapper.mapList(purchaseItems, PurchaseItemDTO.class);
         purchaseFormDTO.setMain(main);
         purchaseFormDTO.setItems(items);
         return  purchaseFormDTO;

+ 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

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

@@ -391,7 +391,7 @@
       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}

+ 32 - 1
applications/purchase/purchase-server/src/main/resources/mapper/PurchasedetailMapper.xml

@@ -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,
@@ -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}
   </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);
+        }
+    }
+}

+ 31 - 8
frontend/saas-web/app/util/FormUtil.js

@@ -36,19 +36,22 @@ Ext.define('saas.util.FormUtil', {
                         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 +63,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 +73,23 @@ Ext.define('saas.util.FormUtil', {
     },
 
     loadData: function(form) {
-
+        var me = this;
+        
+        if(form.initId && form.initId!=0) {
+            var url = form._dataModelUrl + form.initId,async=false;
+            me.BaseUtil.request({url,async })
+            .then(function(response) {
+                var res = Ext.decode(response.responseText);
+                if(res.success) {
+                    var viewModel = form.getViewModel();
+                    viewModel.setData(res.data.main);
+                    var detailStore = viewModel.get('_detailStore');
+                    detailStore.loadData(res.data.items);
+                }
+            })
+            .catch(function(response) {
+                console.error(response);
+            });
+        }
     }
 });

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

@@ -36,31 +36,9 @@ 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.FormUtil.setItems(me);
 
         Ext.apply(me, {
-            items:me.defaultItems,
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'top',
@@ -94,7 +72,74 @@ Ext.define('saas.view.core.form.FormPanel', {
     },
 
     addItems: function(items) {
+        var me = this;
+        me.setBindFields(items);
         return this.add(items);
+    },
+
+    /**
+     * 获取form数据
+     */
+    getFormData: function() {
+        var me = this,
+        viewModel = me.getViewModel(),
+        allData = viewModel.getData(),
+        bindFields = allData.bindFields,
+        formData = {
+            main: {},
+            detail: []
+        };
+
+        for(k in allData) {
+            var d = allData[k];
+            // 主表数据
+            if(bindFields.indexOf(k) != -1) {
+                formData.main[k] = d;
+            }
+            // 从表数据
+            if(k == '_detailStore') {
+                storeData = d.getData().items;
+                formData.detail = storeData;
+            }
+        }
+        
+        return formData;
+    },
+
+    /**
+     * 设置需要绑定的字段
+     */
+    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');
     }
     
 });

+ 0 - 6
frontend/saas-web/app/view/core/form/FormPanelController.js

@@ -155,10 +155,4 @@ Ext.define('saas.view.core.form.FormPanelController', {
             }
         });
     },
-    /**
-     * 获取form数据
-     */
-    getFormData: function() {
-        
-    }
 });

+ 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
+    }
 });

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

@@ -55,6 +55,7 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
                     text: 'Debugger',
                     handler: function() {
                         var detailGrid = me;
+                        var form = detailGrid.up('form');
                         debugger;
                     }
                 }]
@@ -64,12 +65,12 @@ Ext.define('saas.view.core.form.field.DetailGridField', {
     },
 
     listeners: {
-        // afterrender:function(grid){
-        //     var count = grid.store.getCount();
-        //     if(count==0){
-        //         grid.add10EmptyRow();
-        //     }
-        // },
+        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,

+ 1 - 3
frontend/saas-web/app/view/main/MainController.js

@@ -68,9 +68,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);

+ 7 - 9
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',
@@ -120,11 +123,6 @@ Ext.define('saas.view.test.order.FormPanel', {
     }, {
         name : "detailGridField", 
         xtype : "detailGridField", 
-        bind: {
-            store:{
-                data:'{detailGridField}'
-            }
-        },
         columns : [
             {
                 text : "序号", 

+ 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');
+            }
+        }
     }
 });

+ 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