贾强-公司PC 5 years ago
commit
07a87c9e72
100 changed files with 9357 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 1 0
      README.md
  3. 242 0
      pom.xml
  4. 166 0
      wjj-api/pom.xml
  5. 64 0
      wjj-api/src/main/java/com/demo/wjj/controller/AgentController.java
  6. 122 0
      wjj-api/src/main/java/com/demo/wjj/controller/AuthenticationController.java
  7. 51 0
      wjj-api/src/main/java/com/demo/wjj/controller/BrandController.java
  8. 40 0
      wjj-api/src/main/java/com/demo/wjj/controller/DemoController.java
  9. 96 0
      wjj-api/src/main/java/com/demo/wjj/controller/DictionaryController.java
  10. 89 0
      wjj-api/src/main/java/com/demo/wjj/controller/DiggerAgentController.java
  11. 260 0
      wjj-api/src/main/java/com/demo/wjj/controller/DiggerAgentDisplaceController.java
  12. 283 0
      wjj-api/src/main/java/com/demo/wjj/controller/DisplaceController.java
  13. 77 0
      wjj-api/src/main/java/com/demo/wjj/controller/DisplaceOfferUserController.java
  14. 67 0
      wjj-api/src/main/java/com/demo/wjj/controller/ImgListController.java
  15. 72 0
      wjj-api/src/main/java/com/demo/wjj/controller/IntegralRecordController.java
  16. 145 0
      wjj-api/src/main/java/com/demo/wjj/controller/OfferController.java
  17. 114 0
      wjj-api/src/main/java/com/demo/wjj/controller/OpenIdController.java
  18. 262 0
      wjj-api/src/main/java/com/demo/wjj/controller/PayController.java
  19. 235 0
      wjj-api/src/main/java/com/demo/wjj/controller/PayforController.java
  20. 315 0
      wjj-api/src/main/java/com/demo/wjj/controller/PayforPresentController.java
  21. 190 0
      wjj-api/src/main/java/com/demo/wjj/controller/PresentController.java
  22. 83 0
      wjj-api/src/main/java/com/demo/wjj/controller/QiNiuController.java
  23. 48 0
      wjj-api/src/main/java/com/demo/wjj/controller/QuoteProtocolController.java
  24. 100 0
      wjj-api/src/main/java/com/demo/wjj/controller/RegionController.java
  25. 69 0
      wjj-api/src/main/java/com/demo/wjj/controller/ResourceController.java
  26. 51 0
      wjj-api/src/main/java/com/demo/wjj/controller/SmsController.java
  27. 59 0
      wjj-api/src/main/java/com/demo/wjj/controller/TicketController.java
  28. 175 0
      wjj-api/src/main/java/com/demo/wjj/controller/UserController.java
  29. 412 0
      wjj-api/src/main/java/com/demo/wjj/controller/WeChatController.java
  30. 16 0
      wjj-api/src/main/java/com/demo/wjj/converter/BaseConverter.java
  31. 27 0
      wjj-api/src/main/java/com/demo/wjj/converter/SaveDiggerOfferConverter.java
  32. 58 0
      wjj-api/src/main/java/com/demo/wjj/converter/SaveDisplaceConverter.java
  33. 34 0
      wjj-api/src/main/java/com/demo/wjj/converter/SaveOfferUserConverter.java
  34. 44 0
      wjj-api/src/main/java/com/demo/wjj/converter/UserRegisterConverter.java
  35. 44 0
      wjj-api/src/main/java/com/demo/wjj/filter/LogFilter.java
  36. 75 0
      wjj-api/src/main/java/com/demo/wjj/qo/SaveDiggerOfferQo.java
  37. 264 0
      wjj-api/src/main/java/com/demo/wjj/qo/SaveDisplaceQo.java
  38. 77 0
      wjj-api/src/main/java/com/demo/wjj/qo/SaveOfferUserQo.java
  39. 169 0
      wjj-api/src/main/java/com/demo/wjj/qo/UserRegisterQo.java
  40. 17 0
      wjj-api/src/main/java/com/demo/wjj/service/ResourceService.java
  41. 112 0
      wjj-api/src/main/java/com/demo/wjj/service/impl/ResourceServiceImpl.java
  42. 75 0
      wjj-api/src/main/java/com/demo/wjj/validator/SaveDiggerOfferValidator.java
  43. 140 0
      wjj-api/src/main/java/com/demo/wjj/validator/SaveDisplaceQoValidator.java
  44. 71 0
      wjj-api/src/main/java/com/demo/wjj/validator/SaveOfferUserValidator.java
  45. 124 0
      wjj-api/src/main/java/com/demo/wjj/validator/UserRegisterQoValidator.java
  46. 57 0
      wjj-api/src/main/resources/META-INF/spring/applicationContext.xml
  47. 23 0
      wjj-api/src/main/resources/META-INF/spring/dispatcher.xml
  48. 37 0
      wjj-api/src/main/resources/META-INF/spring/mybatis-beans.xml
  49. 33 0
      wjj-api/src/main/resources/application.properties
  50. 10 0
      wjj-api/src/main/resources/jdbc.properties
  51. 25 0
      wjj-api/src/main/resources/logback.xml
  52. 30 0
      wjj-api/src/test/java/com/demo/wjj/controller/AgentControllerTest.java
  53. 31 0
      wjj-api/src/test/java/com/demo/wjj/controller/BaseTest.java
  54. 23 0
      wjj-api/src/test/java/com/demo/wjj/controller/BrandControllerTest.java
  55. 24 0
      wjj-api/src/test/java/com/demo/wjj/controller/DemoControllerTest.java
  56. 44 0
      wjj-api/src/test/java/com/demo/wjj/controller/DictionaryControllerTest.java
  57. 57 0
      wjj-api/src/test/java/com/demo/wjj/controller/DiggerAgentDisplaceControllerTest.java
  58. 76 0
      wjj-api/src/test/java/com/demo/wjj/controller/DisplaceControllerTest.java
  59. 25 0
      wjj-api/src/test/java/com/demo/wjj/controller/DisplaceOfferUserControllerTest.java
  60. 22 0
      wjj-api/src/test/java/com/demo/wjj/controller/ImgListControllerTest.java
  61. 35 0
      wjj-api/src/test/java/com/demo/wjj/controller/OfferControllerTest.java
  62. 20 0
      wjj-api/src/test/java/com/demo/wjj/controller/OpenIdControllerTest.java
  63. 42 0
      wjj-api/src/test/java/com/demo/wjj/controller/PayControllerTest.java
  64. 104 0
      wjj-api/src/test/java/com/demo/wjj/controller/QiNiuControllerTest.java
  65. 52 0
      wjj-api/src/test/java/com/demo/wjj/controller/RegionControllerTest.java
  66. 20 0
      wjj-api/src/test/java/com/demo/wjj/controller/SmsControllerTest.java
  67. 22 0
      wjj-api/src/test/java/com/demo/wjj/controller/TicketControllerTest.java
  68. 75 0
      wjj-api/src/test/java/com/demo/wjj/controller/UserControllerTest.java
  69. 28 0
      wjj-api/src/test/java/com/demo/wjj/service/ResourceServiceTest.java
  70. 59 0
      wjj-api/web/WEB-INF/web.xml
  71. 8 0
      wjj-api/web/index.html
  72. 130 0
      wjj-core/pom.xml
  73. 173 0
      wjj-core/src/main/java/com/demo/wjj/bo/ApplyRefundParameter.java
  74. 108 0
      wjj-core/src/main/java/com/demo/wjj/bo/ApplyRefundResponse.java
  75. 48 0
      wjj-core/src/main/java/com/demo/wjj/bo/AuthorizationUrlBo.java
  76. 69 0
      wjj-core/src/main/java/com/demo/wjj/bo/CallbackTicketBo.java
  77. 101 0
      wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderBo.java
  78. 257 0
      wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderParameter.java
  79. 122 0
      wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderResult.java
  80. 86 0
      wjj-core/src/main/java/com/demo/wjj/bo/DiggerOfferBo.java
  81. 75 0
      wjj-core/src/main/java/com/demo/wjj/bo/DiggerOfferSaveBo.java
  82. 505 0
      wjj-core/src/main/java/com/demo/wjj/bo/DisplaceDetailBo.java
  83. 244 0
      wjj-core/src/main/java/com/demo/wjj/bo/DisplaceListBo.java
  84. 26 0
      wjj-core/src/main/java/com/demo/wjj/bo/DisplaceListNumBo.java
  85. 57 0
      wjj-core/src/main/java/com/demo/wjj/bo/ImgListBo.java
  86. 109 0
      wjj-core/src/main/java/com/demo/wjj/bo/JsSdkResult.java
  87. 47 0
      wjj-core/src/main/java/com/demo/wjj/bo/PayParameterJson.java
  88. 35 0
      wjj-core/src/main/java/com/demo/wjj/bo/QiNiuUploadResult.java
  89. 323 0
      wjj-core/src/main/java/com/demo/wjj/bo/SaveDisplaceBo.java
  90. 67 0
      wjj-core/src/main/java/com/demo/wjj/bo/SaveOfferUserBo.java
  91. 42 0
      wjj-core/src/main/java/com/demo/wjj/bo/SmsSendBo.java
  92. 66 0
      wjj-core/src/main/java/com/demo/wjj/bo/TbQuoteProtocolBo.java
  93. 169 0
      wjj-core/src/main/java/com/demo/wjj/bo/UserRegisterBo.java
  94. 69 0
      wjj-core/src/main/java/com/demo/wjj/bo/WeiXinParameter.java
  95. 48 0
      wjj-core/src/main/java/com/demo/wjj/bo/WeiXinUserBo.java
  96. 65 0
      wjj-core/src/main/java/com/demo/wjj/mapper/AgentMapper.java
  97. 35 0
      wjj-core/src/main/java/com/demo/wjj/mapper/AttrContentMapper.java
  98. 38 0
      wjj-core/src/main/java/com/demo/wjj/mapper/AuthenticationMapper.java
  99. 22 0
      wjj-core/src/main/java/com/demo/wjj/mapper/BrandMapper.java
  100. 0 0
      wjj-core/src/main/java/com/demo/wjj/mapper/CreditsExchangeMapper.java

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+*.iml
+.idea/*
+rebel.xml
+target/*

+ 1 - 0
README.md

@@ -0,0 +1 @@
+readme.md

+ 242 - 0
pom.xml

@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.demo</groupId>
+    <artifactId>wjjjava</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>wjj-core</module>
+        <module>wjj-api</module>
+    </modules>
+
+    <!--version-->
+    <properties>
+        <slf4j.version>1.7.25</slf4j.version>
+        <logback.version>1.2.3</logback.version>
+        <spring.version>4.3.20.RELEASE</spring.version>
+        <mybatis.version>3.4.6</mybatis.version>
+        <mybatis.spring.version>1.3.2</mybatis.spring.version>
+        <mysql.jdbc.version>5.1.47</mysql.jdbc.version>
+        <dbcp2.version>2.1.1</dbcp2.version>
+        <commons.lang3.version>3.7</commons.lang3.version>
+        <commons.collection4.version>4.2</commons.collection4.version>
+        <fastjson.version>1.2.51</fastjson.version>
+        <httpclient.version>4.5.6</httpclient.version>
+        <validation-api.version>1.1.0.Final</validation-api.version>
+        <dom4j.version>1.6.1</dom4j.version>
+
+        <servlet-api.version>3.1.0</servlet-api.version>
+
+        <plugin.compiler.version>3.7.0</plugin.compiler.version>
+    </properties>
+
+    <!--依赖-->
+    <dependencies>
+        <!--log component begin-->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>${slf4j.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>${logback.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>${logback.version}</version>
+        </dependency>
+        <!--log component end-->
+
+        <!--test begin-->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+        <!--test end-->
+
+    </dependencies>
+
+    <!--依赖管理-->
+    <dependencyManagement>
+        <dependencies>
+
+            <!--spring begin-->
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-context-support</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-jdbc</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-webmvc</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-test</artifactId>
+                <version>${spring.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <!--spring end-->
+
+            <!--mybatis begin-->
+            <dependency>
+                <groupId>org.mybatis</groupId>
+                <artifactId>mybatis</artifactId>
+                <version>${mybatis.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.mybatis</groupId>
+                <artifactId>mybatis-spring</artifactId>
+                <version>${mybatis.spring.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.github.pagehelper</groupId>
+                <artifactId>pagehelper</artifactId>
+                <version>5.1.8</version>
+            </dependency>
+            <!--mybatis end-->
+
+            <!--jdbc && datasource begin-->
+            <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${mysql.jdbc.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-dbcp2</artifactId>
+                <version>${dbcp2.version}</version>
+            </dependency>
+            <!--jdbc && datasource end-->
+
+            <!--utils begin-->
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-lang3</artifactId>
+                <version>${commons.lang3.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-collections4</artifactId>
+                <version>${commons.collection4.version}</version>
+            </dependency>
+            <!--utils end-->
+
+            <!--json begin-->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
+            <!--json end-->
+
+            <!--web component begin-->
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>javax.servlet-api</artifactId>
+                <version>${servlet-api.version}</version>
+                <scope>provided</scope>
+            </dependency>
+            <!--web component end-->
+
+            <!--http component begin-->
+            <dependency>
+                <groupId>org.apache.httpcomponents</groupId>
+                <artifactId>httpclient</artifactId>
+                <version>${httpclient.version}</version>
+            </dependency>
+            <!--http component end-->
+
+            <dependency>
+                <groupId>javax.validation</groupId>
+                <artifactId>validation-api</artifactId>
+                <version>${validation-api.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>dom4j</groupId>
+                <artifactId>dom4j</artifactId>
+                <version>${dom4j.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+                <version>1.10</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.qiniu</groupId>
+                <artifactId>qiniu-java-sdk</artifactId>
+                <version>7.2.11</version>
+                <scope>compile</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.squareup.okhttp3</groupId>
+                <artifactId>okhttp</artifactId>
+                <version>3.3.1</version>
+                <scope>compile</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.google.code.gson</groupId>
+                <artifactId>gson</artifactId>
+                <version>2.6.2</version>
+                <scope>compile</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.qiniu</groupId>
+                <artifactId>happy-dns-java</artifactId>
+                <version>0.1.4</version>
+                <scope>compile</scope>
+            </dependency>
+
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+        <plugins>
+            <!--plugin compiler begin-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>${plugin.compiler.version}</version>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                    <encoding>UTF-8</encoding>
+                    <compilerArguments>
+                        <verbose />
+                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
+                    </compilerArguments>
+                </configuration>
+            </plugin>
+            <!--plugin compiler end-->
+
+        </plugins>
+    </build>
+</project>

+ 166 - 0
wjj-api/pom.xml

@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>wjj-api</artifactId>
+    <packaging>war</packaging>
+
+    <parent>
+        <groupId>com.demo</groupId>
+        <artifactId>wjjjava</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <!--依赖-->
+    <dependencies>
+        <!--modules begin-->
+        <dependency>
+            <groupId>com.demo</groupId>
+            <artifactId>wjj-core</artifactId>
+            <version>${project.parent.version}</version>
+        </dependency>
+        <!--modules end-->
+
+        <!--spring begin-->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jdbc</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
+        <!--spring end-->
+
+        <!--mybatis begin-->
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis-spring</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper</artifactId>
+        </dependency>
+        <!--mybatis end-->
+
+        <!--jdbc && datasource begin-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-dbcp2</artifactId>
+        </dependency>
+        <!--jdbc && datasource end-->
+
+        <!--utils begin-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+        </dependency>
+        <!--utils end-->
+
+        <!--json begin-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.jayway.jsonpath</groupId>
+            <artifactId>json-path</artifactId>
+            <version>2.4.0</version>
+            <scope>test</scope>
+        </dependency>
+        <!--json end-->
+
+        <!--web component begin-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <!--web component end-->
+
+        <!--http component begin-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <!--http component end-->
+
+        <!--<dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+        </dependency>-->
+
+        <dependency>
+            <groupId>javax.validation</groupId>
+            <artifactId>validation-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>qiniu-java-sdk</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>happy-dns-java</artifactId>
+        </dependency>
+
+    </dependencies>
+
+    <!--插件-->
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.2.0</version>
+                <configuration>
+                    <warSourceDirectory>web</warSourceDirectory>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 64 - 0
wjj-api/src/main/java/com/demo/wjj/controller/AgentController.java

@@ -0,0 +1,64 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Agent;
+import com.demo.wjj.service.AgentService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.HashMap;
+import java.util.Map;
+
+/**
+ *
+ * 商家
+ * @author wangqing
+ * @date 2018.11.17
+ */
+@RequestMapping("/agent")
+@RestController
+public class AgentController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private AgentService agentService;
+
+    /**
+     *  获取商家信息
+     * @param agentId 商家id
+     * @return apiResult
+     */
+    @GetMapping("/getAgent")
+    public ApiResult getAgent(@RequestParam(required = false) String agentId) {
+        LOG.info("调用获取信息(/agent/getAgent)接口, agentId:{}", agentId);
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            Agent agent = agentService.getAgent(agentId);
+            Map<String, Object> data = new HashMap<>();
+            if (agent != null) {
+                data.put("appId", agent.getAppId());
+                data.put("mchAppId", agent.getMchAppId());
+                data.put("shareTitle", agent.getShareTitle());
+                data.put("shareContent", agent.getShareContent());
+                data.put("logo", agent.getAgentLogo());
+            }
+            ApiResult<Map<String, Object>> apiResult = ApiResult.createSuccess(data);
+            LOG.info("调用获取商家信息(/agent/getAgent)接口成功, apiResult: {}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取商家信息(/agent/getAgent)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 122 - 0
wjj-api/src/main/java/com/demo/wjj/controller/AuthenticationController.java

@@ -0,0 +1,122 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Authentication;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.service.AuthenticationService;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.service.QiNiuService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * 车商用户认证
+ * @author wangyandeng
+ * @date 2019.06.10
+ */
+@SuppressWarnings("all")
+@RequestMapping("/diggerDisplace")
+@RestController
+public class AuthenticationController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private DiggerAgentService diggerAgentService;
+
+    @Autowired
+    private AuthenticationService authenticationService;
+    /**
+     * 保存车商审核信息
+     *
+     */
+    @Autowired
+    private QiNiuService qiNiuService;
+    @PostMapping ("/save")
+    public ApiResult save( Authentication authentication,
+                          String openId,
+                          String agentId
+
+    ){
+        LOG.info("调用保存车商审核信息(/authentication/save)接口,authentication:{}",authentication);
+
+        try{
+            Map map = new HashMap();
+            String daId = diggerAgentService.getDiggerAgent(agentId,openId).getDaId();
+            Authentication authenticationOld = authenticationService.selectByUserId(daId);
+
+            if(authenticationOld!=null){
+                authenticationService.delete(daId);
+            }
+            authentication.setUserId(daId);
+            //authenticationService.selectOne(daId)
+            authentication.setIsCheck(1);
+            final boolean saveResult = authenticationService.save(authentication);
+            ApiResult apiResult = saveResult ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            diggerAgentService.updateState(daId);
+
+            LOG.info("调用保存车商审核信息(/authentication/save)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        }catch (Exception e){
+            LOG.error("调用保存车商审核信息(/authentication/save)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+    @GetMapping("/getOne")
+    public ApiResult getOne(String id){
+        try{
+            Authentication authentication = authenticationService.selectOne(id);
+            authentication.setIdCardImaPo(qiNiuService.getUrl(authentication.getIdCardImaPo()));
+            authentication.setIdCardImaSi(qiNiuService.getUrl(authentication.getIdCardImaSi()));
+            authentication.setHeadPortrait(qiNiuService.getUrl(authentication.getHeadPortrait()));
+            LOG.info("调用查询报价用户信息(/authentication/save)接口成功,authentication :{}", authentication);
+            return ApiResult.createSuccess(authentication);
+        }catch (Exception e){
+            LOG.error("调用查询报价用户信息(/authentication/save)接口异常",e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     *查询车商已审核信息
+     * @param agentId 商家id
+     * @param openId 公众号id
+     * @return
+     */
+    @GetMapping("/getAuthtication")
+    public ApiResult getAuthtication(String agentId,String openId){
+        try{
+            LOG.info("调用查询车商已审核信息(/diggerDisplace/getAuthtication)接口, agentId:{}, openId:{}", agentId, openId);
+            String daId = diggerAgentService.getDiggerAgent(agentId,openId).getDaId();
+            Authentication authentication = authenticationService.selectByUserId(daId);
+            Map map = new HashMap();
+            map.put("status","0");
+            Integer isCheck;
+            if(authentication!=null){
+                isCheck = authentication.getIsCheck();
+                if(isCheck==3){
+                    map.put("status","1");
+                }else if(isCheck==2){
+                    map.put("status","2");
+                }
+                map.put("authentication",authentication);
+
+            }
+            LOG.info("调用获取待开始的置换列表(/diggerDisplace/getAuthtication)接口成功");
+            return ApiResult.createSuccess(map);
+
+
+        }catch (Exception e){
+            LOG.info("调用查询车商已审核信息(/diggerDisplace/getAuthtication)接口异常, e:{}", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+
+}

+ 51 - 0
wjj-api/src/main/java/com/demo/wjj/controller/BrandController.java

@@ -0,0 +1,51 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Brand;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.service.BrandService;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.List;
+
+/**
+ * 品牌
+ * @author wangqing
+ * @date 2018.11.10
+ */
+@RequestMapping("/brand")
+@RestController
+public class BrandController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private BrandService brandService;
+
+    /**
+     * 获取品牌
+     * @return apiResult
+     */
+    @GetMapping("/getBrands")
+    public ApiResult getBrands() {
+        LOG.info("调用获取品牌(/brand/getBrands)接口");
+        try {
+            List<Brand> brands = brandService.queryBrandList();
+            ApiResult<List<Brand>> apiResult = ApiResult.createSuccess(brands);
+            LOG.info("调用获取品牌(/brand/getBrands)接口成功");
+            LOG.debug("获取品牌(/brand/getBrands), apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取品牌(/brands/getBrands)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+}

+ 40 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DemoController.java

@@ -0,0 +1,40 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Demo;
+import com.demo.wjj.service.DemoService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * demo
+ * @author wangqing
+ * @date 2018.11.07
+ */
+@RestController
+@RequestMapping("/demo")
+public class DemoController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DemoService demoService;
+
+    @GetMapping("/get/{id}")
+    public ApiResult<Demo> getDemo(@PathVariable String id) {
+        LOG.info("调用获取demo接口, id:{}", id);
+        try {
+            final Demo demo = demoService.get(Integer.parseInt(id));
+            ApiResult<Demo> apiResult = ApiResult.createSuccess(demo);
+            LOG.info("调用获取demo接口end, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取demo接口异常", e);
+            ApiResult apiResult = ApiResult.createFailure();
+            LOG.info("调用获取demo接口end, apiResult:{}", apiResult);
+            return apiResult;
+        }
+    }
+}

+ 96 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DictionaryController.java

@@ -0,0 +1,96 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Dictionary;
+import com.demo.wjj.po.ImgList;
+import com.demo.wjj.po.TbImgItem;
+import com.demo.wjj.service.DictionaryService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 数据字典
+ * @author wangqing
+ * @date 2018.11.11
+ */
+@RequestMapping("/dic")
+@RestController
+public class DictionaryController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DictionaryService dictionaryService;
+
+    /**
+     * 获取设备类型
+     * @return apiResult
+     */
+    @GetMapping("/getDeviceType")
+    public ApiResult queryDeviceType() {
+        LOG.info("调用获取设备类型(/dic/getDeviceType)接口");
+        try {
+            List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.DEVICE_TYPE);
+            LOG.info("调用获取设备类型(/dic/getDeviceType)接口成功");
+            return ApiResult.createSuccess(dictionaries);
+        } catch (Exception e) {
+            LOG.error("调用获取设备类型(/dic/getDeviceType)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取配置说明
+     * @return apiResult
+     */
+    @GetMapping("/getConfigInstructions")
+    public ApiResult queryConfigInstructions() {
+        LOG.info("调用获取配置说明(/dic/getDeviceType)接口");
+        try {
+            List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.CONFIG_INSTRUCTIONS);
+            LOG.info("调用获取配置说明(/dic/getDeviceType)接口成功");
+            return ApiResult.createSuccess(dictionaries);
+        } catch (Exception e) {
+            LOG.error("调用获取配置说明(/dic/getDeviceType)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取作业履历
+     * @return apiResult
+     */
+    @GetMapping("/getJobResume")
+    public ApiResult queryJobResume() {
+        LOG.info("调用获取作业履历(/dic/getJobResume)接口");
+        try {
+            List<Dictionary> dictionaries = dictionaryService.queryDictionaryList(DictionaryService.JOB_RESUME);
+            LOG.info("调用获取作业履历(/dic/getJobResume)接口成功");
+            return ApiResult.createSuccess(dictionaries);
+        } catch (Exception e) {
+            LOG.error("调用获取作业履历(/dic/getJobResume)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取细节分类
+     * @return apiResult
+     */
+    @PostMapping("/queryImgItemListByType")
+    public ApiResult queryImgItemListByType(Integer type, Integer bqId) {
+        LOG.info("获取细节分类(/dic/getQueryImgItemList)接口");
+        try {
+            List<TbImgItem> ImgItemList = dictionaryService.queryImgItemListByType(type, bqId);
+            LOG.info("获取细节分类(/dic/getQueryImgItemList)接口成功 ImgItemList{}",ImgItemList);
+            return ApiResult.createSuccess(ImgItemList);
+        } catch (Exception e) {
+            LOG.error("获取细节分类(/dic/getQueryImgItemList)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 89 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DiggerAgentController.java

@@ -0,0 +1,89 @@
+package com.demo.wjj.controller;
+
+
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.service.AgentService;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+@SuppressWarnings("all")
+@RestController
+@RequestMapping("/diggerAgent")
+public class DiggerAgentController {
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private DiggerAgentService diggerAgentService;
+    @Autowired
+    private AgentService agentService;
+
+    /**
+     * 获取车商数据
+     * @param agentId 商家id
+     * @param openId 公众号id
+     * @return
+     */
+    @GetMapping ("/get")
+    public ApiResult getDiggerAgent(String agentId,String openId){
+        LOG.info("调用获取getDiggerAgent接口,agentId:{},openId",agentId,openId);
+        try {
+            Integer integ = agentService.selectInteg(agentId).getInteg();
+            Map map = new HashMap();
+            if(integ==0){
+                map.put("status","0");
+                return ApiResult.createSuccess(map);
+            }
+            DiggerAgent diggerAgentOld = diggerAgentService.getDiggerAgent(agentId, openId);
+            String daId = diggerAgentOld.getDaId();
+            final DiggerAgent diggerAgent = diggerAgentService.getOne(daId);
+            ApiResult<DiggerAgent> apiResult = ApiResult.createSuccess(diggerAgent);
+            LOG.info("调用获取车商(/diggerAgent/get)接口成功");
+            LOG.debug("获取车商(/diggerAgent/get), apiResult:{}", apiResult);
+            return apiResult;
+        }catch (Exception e){
+            LOG.error("调用获取车商(/diggerAgent/get)接口异常",e);
+            return ApiResult.createFailure();
+        }
+
+
+
+
+    }
+
+    /**
+     * 获取支付固定保证金状态
+     * @param agentId 代理商id
+     * @param openId 公众号id
+     * @return
+     */
+    @GetMapping("/getStatus")
+    public ApiResult getStatus(@RequestParam(required = false) String agentId,
+                              @RequestParam(required = false) String openId){
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+        Map map = new HashMap();
+        String daId = diggerAgentService.getDiggerAgent(agentId,openId).getDaId();
+        Integer memberLevel = diggerAgentService.getOne(daId).getMemberLevel();
+        if(memberLevel>=2){
+            map.put("status","0");
+        }else {
+            map.put("status","1");
+        }
+        return ApiResult.createSuccess(map);
+    }
+}

+ 260 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DiggerAgentDisplaceController.java

@@ -0,0 +1,260 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.DisplaceDetailBo;
+import com.demo.wjj.bo.DisplaceListBo;
+import com.demo.wjj.po.Authentication;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.service.*;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.PageBean;
+import com.github.pagehelper.PageInfo;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+
+
+/**
+ * 车商置换
+ * @author wangqing
+ * @date 2018.11.18
+ */
+@SuppressWarnings("all")
+@RestController
+@RequestMapping("/diggerDisplace")
+public class DiggerAgentDisplaceController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DiggerAgentDisplaceManageService diggerAgentDisplaceManageService;
+    @Autowired
+    private DisplaceAuditService displaceAuditService;
+    @Autowired
+    private AgentService agentService;
+
+    /**
+     * 获取待开始的置换列表
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/queryWait")
+    public ApiResult queryWait(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
+        LOG.info("调用获取待开始的置换列表(/diggerDisplace/queryWait)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (!checkQueryParameter(agentId, openId)) {return ApiResult.createFailure();}
+
+        try {
+            PageInfo<DisplaceListBo> pageInfo = diggerAgentDisplaceManageService.queryWaitingList(agentId, openId, PageBean.create(request));
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.debug("待开始置换列表, apiResult:{}", apiResult);
+            LOG.info("调用获取待开始的置换列表(/diggerDisplace/queryWait)接口成功");
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取待开始的置换列表(/diggerDisplace/queryWait)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取进行中的置换列表
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/queryDoing")
+    public ApiResult queryDoing(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
+        LOG.info("调用获取进行中的置换列表(/diggerDisplace/queryDoing)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (!checkQueryParameter(agentId, openId)) {return ApiResult.createFailure();}
+
+        try {
+            PageInfo<DisplaceListBo> pageInfo = diggerAgentDisplaceManageService.queryDoingList(agentId, openId, PageBean.create(request));
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.debug("进行中置换列表, apiResult:{}", apiResult);
+            LOG.info("调用获取进行中的置换列表(/diggerDisplace/queryDoing)接口成功");
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取进行中的置换列表(/diggerDisplace/queryDoing)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取已结束的置换列表
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/queryEnding")
+    public ApiResult queryEnding(@RequestParam(required = false) String agentId,
+                                 @RequestParam(required = false) String openId,
+                                 @RequestParam(required = false)String date,
+                                 HttpServletRequest request) {
+        LOG.info("调用获取已结束的置换列表(/diggerDisplace/queryEnding)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (!checkQueryParameter(agentId, openId)) {return ApiResult.createFailure();}
+
+        try {
+            PageBean pageBean = PageBean.create(request);
+            PageInfo<DisplaceListBo> pageInfo = diggerAgentDisplaceManageService.queryEndList(date,agentId, openId,pageBean );
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.debug("已结束置换列表, apiResult:{}", apiResult);
+            LOG.info("调用获取已结束的置换列表(/diggerDisplace/queryEnding)接口成功");
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取已结束的置换列表(/diggerDisplace/queryEnding)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取我的报价的置换列表
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/queryMy")
+    public ApiResult queryMy(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
+        LOG.info("调用获取我的报价的置换列表(/diggerDisplace/queryMy)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (!checkQueryParameter(agentId, openId)) {return ApiResult.createFailure();}
+
+        try {
+            PageInfo<DisplaceListBo> pageInfo = diggerAgentDisplaceManageService.queryMyList(agentId, openId, PageBean.create(request));
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.debug("我的报价置换列表, apiResult:{}", apiResult);
+            LOG.info("调用获取我的报价的置换列表(/diggerDisplace/queryMy)接口成功");
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取我的报价的置换列表(/diggerDisplace/queryMy)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 检查查询参数
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return 检查是否成功
+     */
+    private boolean checkQueryParameter(String agentId, String openId) {
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return false;
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 查询置换详情
+     * @param id 置换id
+     * @return apiResult
+     */
+    @GetMapping("/getDetails")
+    public ApiResult queryDetails(@RequestParam(required = false) String id) {
+        LOG.info("调用查询车商置换详情(/diggerDisplace/queryDetails)接口, id:{}", id);
+
+        if (StringUtils.isBlank(id)) {
+            LOG.info("id为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            DisplaceDetailBo displaceDetailBo = diggerAgentDisplaceManageService.queryDetails(id);
+            String groupName = agentService.getAgent(displaceDetailBo.getAgentId()).getGroupName();
+            displaceDetailBo.setGroupName(groupName);
+            ApiResult<DisplaceDetailBo> apiResult = ApiResult.createSuccess(displaceDetailBo);
+            LOG.info("调用查询车商置换详情(/diggerDisplace/queryDetails)接口成功, displaceDetailBo:{}", displaceDetailBo);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询车商置换详情(/diggerDisplace/queryDetails)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 查询置换报价详情
+     * @param id 置换业务id
+     * @param openId openId
+     * @return apiResult
+     */
+    @GetMapping("/getOfferDetails")
+    public ApiResult queryOfferDetails(@RequestParam(required = false) String id, @RequestParam(required = false) String agentId, @RequestParam(required = false) String openId) {
+        LOG.info("调用查询置换报价详情(/diggerDisplace/getOfferDetails)接口, id:{}, agentId:{}, openId:{}", id, agentId, openId);
+
+        if (StringUtils.isBlank(id)) {
+            LOG.info("置换业务id为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+
+        try {
+            DisplaceDetailBo displaceDetailBo = diggerAgentDisplaceManageService.queryOfferDetails(id, agentId, openId);
+            String groupName = agentService.getAgent(displaceDetailBo.getAgentId()).getGroupName();
+            displaceDetailBo.setGroupName(groupName);
+            if (displaceDetailBo.getIsKxc()==null){
+                displaceDetailBo.setIsKxc(0);
+            }
+            ApiResult<DisplaceDetailBo> apiResult = ApiResult.createSuccess(displaceDetailBo);
+            LOG.info("调用查询置换报价详情(/diggerDisplace/getOfferDetails)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询置换报价详情(/diggerDisplace/getOfferDetails)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 围观
+     * @param displaceId 置换业务id
+     * @param openId openId
+     * @return apiResult
+     */
+    @PostMapping("/lookTimes")
+    public ApiResult lookTimes(@RequestParam(required = false) String displaceId, @RequestParam(required = false) String openId) {
+        LOG.info("调用围观(/diggerDisplace/lookTimes)接口, displaceId:{}, openId:{}", displaceId, openId);
+
+        if (StringUtils.isBlank(displaceId)) {
+            LOG.info("displaceId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            boolean result = diggerAgentDisplaceManageService.incrementLookTimes(displaceId);
+            ApiResult apiResult = result ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用围观(/diggerDisplace/lookTimes)接口成功, apiResult: {}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用围观(/diggerDisplace/lookTimes)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+}

+ 283 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DisplaceController.java

@@ -0,0 +1,283 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.DisplaceDetailBo;
+import com.demo.wjj.bo.DisplaceListBo;
+import com.demo.wjj.bo.ImgListBo;
+import com.demo.wjj.bo.SaveDisplaceBo;
+import com.demo.wjj.converter.SaveDisplaceConverter;
+import com.demo.wjj.po.TbImgItem;
+import com.demo.wjj.qo.SaveDisplaceQo;
+import com.demo.wjj.service.DisplaceAuditService;
+import com.demo.wjj.service.DisplaceManage;
+import com.demo.wjj.service.TbImgItemService;
+import com.demo.wjj.service.TbImgListService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.PageBean;
+import com.demo.wjj.utils.Result;
+import com.demo.wjj.validator.SaveDisplaceQoValidator;
+import com.github.pagehelper.PageInfo;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 置换
+ *
+ * @author wangqing
+ * @date 2018.11.13
+ */
+@RequestMapping("/displace")
+@RestController
+public class DisplaceController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private SaveDisplaceQoValidator saveDisplaceQoValidator;
+    @Autowired
+    private SaveDisplaceConverter saveDisplaceConverter;
+
+    @Autowired
+    private DisplaceManage displaceManage;
+
+    @Autowired
+    private DisplaceAuditService displaceAuditService;
+
+    @Autowired
+    private TbImgItemService tbImgItemService;
+
+    @Autowired
+    private TbImgListService tbImgListService;
+
+    @InitBinder
+    protected void initBinder(WebDataBinder binder) {
+        Object target = binder.getTarget();
+        if (target == null) {
+            return;
+        }
+        if (saveDisplaceQoValidator.supports(target.getClass())) {
+            binder.addValidators(saveDisplaceQoValidator);
+        }
+
+    }
+
+    /**
+     * 保存置换
+     *
+     * @param saveDisplaceQo 置换参数
+     * @return apiResult
+     */
+    @PostMapping("/save")
+    public ApiResult save(@Valid SaveDisplaceQo saveDisplaceQo, BindingResult bindingResult) {
+        LOG.info("调用保存置换(/displace/save)接口, saveDisplaceQo:{}", saveDisplaceQo);
+
+        if (CollectionUtils.isNotEmpty(bindingResult.getAllErrors())) {
+            LOG.warn("请求参数错误");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            SaveDisplaceBo convert = saveDisplaceConverter.convert(saveDisplaceQo);
+
+            //获取图片列表
+            List<SaveDisplaceBo.DisplaceImageList> displaceImageLists = convert.getPicture();
+
+            //便利图片数组 给予分类存储
+            for (SaveDisplaceBo.DisplaceImageList displaceImage : displaceImageLists) {
+                //获取细节分类id
+                Integer detailId = displaceImage.getDetailId();
+                //detail袭击目录不等于空
+                if (detailId != null) {
+                    //通过细节分类id查询二级分类
+                    TbImgItem tbImgItem = tbImgItemService.findOne(detailId);
+                    //查询二级目录
+                    List<ImgListBo> imgListBos = tbImgListService.findAll();
+                    //细节分类
+                    if (tbImgItem != null) {
+                        //从数据库中获取二级分类id
+                        Integer imgBqId = tbImgItem.getImgBqId();
+                        //组装二级识别码
+                        String imgBqIdStr = "IMG_"+imgBqId;
+                        //遍历每个二级分类 查询当前图片分类是否有匹配的
+                        for (ImgListBo imgListBo : imgListBos) {
+                            //查看图片分类是否属于二级分类
+                            if (imgListBo.getListCode().equals(imgBqIdStr)) {
+                                displaceImage.setCode(imgListBo.getListCode());
+                            }
+                        }
+                   /*     switch (imgBqId){
+                            case 1 : displaceImage.setCode("IMG_1"); break;
+                            case 2 : displaceImage.setCode("IMG_2"); break;
+                            case 3 : displaceImage.setCode("IMG_3"); break;
+                            case 4 : displaceImage.setCode("IMG_4"); break;
+                            case 5 : displaceImage.setCode("IMG_5"); break;
+                            case 6 : displaceImage.setCode("IMG_6"); break;
+                            case 7 : displaceImage.setCode("IMG_7"); break;
+                            default: displaceImage.setCode(""); break;
+                        }*/
+                    }
+                }
+            }
+
+            LOG.info("gg组装的图片集合 displaceImageLists{}",displaceImageLists);
+            //把修改好的图片放入集合中
+            convert.setPicture(displaceImageLists);
+
+            ExecuteResult<Boolean> executeResult = displaceManage.save(convert);
+            ApiResult apiResult;
+            if (executeResult.isExecuteResult()) {
+                apiResult = executeResult.getData() ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            } else {
+                Result result = executeResult.getResult();
+                if (result != null) {
+                    apiResult = new ApiResult(result);
+                } else {
+                    apiResult = ApiResult.createFailure();
+                }
+            }
+            LOG.info("调用保存置换(/displaceManage/save)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用保存置换(/displaceManage/save)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取未审核置换列表
+     *
+     * @param agentId 商家id
+     * @param openId  微信openId
+     * @param request request
+     * @return apiResult
+     */
+    @GetMapping("/queryUndoList")
+    public ApiResult queryUndoList(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
+        LOG.info("调用获取未审核置换列表(/displace/queryUndoList)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("微信openId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            PageInfo<DisplaceListBo> pageInfo = displaceAuditService.queryUndoDisplaceList(agentId, openId, PageBean.create(request));
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.info("调用获取未审核置换列表(/displace/queryUndoList)接口成功");
+            LOG.debug("未审核置换列表, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取未审核置换列表(/displace/queryUndoList)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取已审核置换列表
+     *
+     * @param agentId 商家id
+     * @param openId  微信openId
+     * @param request request
+     * @return apiResult
+     */
+    @GetMapping("/queryDoneList")
+    public ApiResult queryDoneList(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId, HttpServletRequest request) {
+        LOG.info("调用获取已审核置换列表(/displace/queryDoneList)接口, agentId:{}, openId:{}", agentId, openId);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("微信openId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            PageInfo<DisplaceListBo> pageInfo = displaceAuditService.queryDoneDisplaceList(agentId, openId, PageBean.create(request));
+            ApiResult<PageInfo<DisplaceListBo>> apiResult = ApiResult.createSuccess(pageInfo);
+            LOG.info("调用获取已审核置换列表(/displace/queryDoneList)接口成功");
+            LOG.debug("未审核置换列表, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取已审核置换列表(/displace/queryDoneList)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 查询被驳回的置换设备数量
+     *
+     * @param agentId
+     * @param openId
+     * @return
+     */
+    @GetMapping("/queryRejectedCount")
+    public ApiResult queryRejectedCount(@RequestParam(required = false) String agentId, @RequestParam(required = false) String openId) {
+        LOG.info("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口, agentId:{}, openId:{}", agentId, openId);
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final int rejectedDisplaceCount = displaceAuditService.getRejectedDisplaceCount(agentId, openId);
+            Map<String, Integer> data = new HashMap<>();
+            data.put("count", rejectedDisplaceCount);
+            final ApiResult<Map<String, Integer>> apiResult = ApiResult.createSuccess(data);
+            LOG.info("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询被驳回的置换设备数量(/displace/queryRejectedCount)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取置换详情
+     *
+     * @param id 置换id
+     * @return apiResult
+     */
+    @GetMapping("/getDetails")
+    public ApiResult getDetails(@RequestParam(required = false) String id) {
+        LOG.info("调用获取置换详情(/displace/getDetails)接口, id:{}", id);
+        if (StringUtils.isBlank(id)) {
+            LOG.info("id为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            DisplaceDetailBo displaceDetail = displaceAuditService.getDisplaceDetail(id);
+            ApiResult<DisplaceDetailBo> apiResult = ApiResult.createSuccess(displaceDetail);
+            LOG.info("调用获取置换详情(/displace/getDetails)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取置换详情(/displace/getDetails)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 77 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DisplaceOfferUserController.java

@@ -0,0 +1,77 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.converter.SaveOfferUserConverter;
+import com.demo.wjj.qo.SaveOfferUserQo;
+import com.demo.wjj.service.DisplaceOfferUserService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.validator.SaveOfferUserValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+@RestController
+@RequestMapping("/displaceOfferUser")
+public class DisplaceOfferUserController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private DisplaceOfferUserService displaceOfferUserService;
+
+    @Autowired
+    private SaveOfferUserConverter saveOfferUserConverter;
+    @Autowired
+    private SaveOfferUserValidator saveOfferUserValidator;
+
+
+    @InitBinder
+    protected void initBinder(WebDataBinder binder) {
+        final Object target = binder.getTarget();
+        if (target == null) {
+            return;
+        }
+
+        if (saveOfferUserValidator.supports(target.getClass())) {
+            binder.addValidators(saveOfferUserValidator);
+        }
+    }
+
+    /**
+     * 保存报价用户信息
+     *
+     * @param saveOfferUserQo 报价用户信息
+     * @param bindingResult   参数绑定结果
+     * @return apiResult
+     */
+    @PostMapping("/save")
+    public ApiResult save(@Valid SaveOfferUserQo saveOfferUserQo, BindingResult bindingResult) {
+        LOG.info("调用保存报价用户信息(/displaceOfferUser/save)接口, saveOfferUserQo:{}", saveOfferUserQo);
+
+        if (bindingResult.hasErrors()) {
+            LOG.info("请求参数错误");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final boolean saveResult = displaceOfferUserService.save(saveOfferUserConverter.convert(saveOfferUserQo));
+            ApiResult apiResult = saveResult ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用保存报价用户信息(/displaceOfferUser/save)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用保存报价用户信息(/displaceOfferUser/save)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 67 - 0
wjj-api/src/main/java/com/demo/wjj/controller/ImgListController.java

@@ -0,0 +1,67 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.ImgListBo;
+import com.demo.wjj.po.ImgList;
+import com.demo.wjj.service.ImgListService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.RestController;
+
+import java.util.List;
+
+/**
+ * 图片目录
+ * @author wangqing
+ * @date 2018.11.12
+ */
+@RestController
+@RequestMapping("/imglist")
+public class ImgListController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ImgListService imgListService;
+
+    /**
+     * 获取手机端置换图片列表
+     * @return apiResult
+     */
+    @GetMapping("/getDisplaceList")
+    public ApiResult getMobileDisplaceList() {
+        LOG.info("调用获取手机端置换图片列表(/imglist/getDisplaceList)接口");
+        try {
+            List<ImgList> imgLists = imgListService.queryMobileDisplaceList();
+            LOG.info("调用获取手机端置换图片列表(/imglist/getDisplaceList)接口成功");
+            ApiResult<List<ImgList>> apiResult = ApiResult.createSuccess(imgLists);
+            LOG.debug("手机端置换图片列表:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取手机端置换图片列表(/imglist/getDisplaceList)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取个大分类的小分类
+     */
+
+    @GetMapping("/getMobileImgList")
+    public ApiResult getMobileImgList(Integer listOrder) {
+        LOG.info("调用获取手机端置换图片小分类列表(/imglist/getMobileImgList)接口");
+        try {
+            List<ImgListBo> ImgListBos = imgListService.getMobileImgList(listOrder);
+            LOG.info("调用获取手机端置换图片小分类列表(/imglist/getMobileImgList)接口成功");
+            ApiResult<List<ImgListBo>> apiResult = ApiResult.createSuccess(ImgListBos);
+            LOG.debug("手机端置换图片小分类列表:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取手机端置换图片小分类列表(/imglist/getMobileImgList)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 72 - 0
wjj-api/src/main/java/com/demo/wjj/controller/IntegralRecordController.java

@@ -0,0 +1,72 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.IntegralRecord;
+import com.demo.wjj.service.DiggerAgentAddressService;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.service.IntegralRecordService;
+import com.demo.wjj.service.QiNiuService;
+import com.demo.wjj.utils.ApiResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.Arrays;
+import java.util.List;
+
+@RestController
+@RequestMapping("/integralRecord")
+public class IntegralRecordController {
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+    @Autowired
+    private IntegralRecordService integralRecordService;
+    @Autowired
+    private DiggerAgentService diggerAgentService;
+    @Autowired
+    private DiggerAgentAddressService diggerAgentAddressService;
+    @Autowired
+    private QiNiuService qiNiuService;
+
+    /**
+     * 获取兑换记录列表
+     * @param agentId
+     * @param openId
+     * @return
+     */
+    @GetMapping("/getIntegralRecord")
+    public ApiResult getIntegralRecord(@RequestParam(required = false)String agentId,
+                                       @RequestParam(required = false)String openId){
+        LOG.info("调用获取兑换记录列表(/integralRecord/getIntegralRecord)接口, agentId:{}, openId:{}", agentId, openId);
+        try {
+            String daId = diggerAgentService.getDiggerAgent(agentId,openId).getDaId();
+            List<IntegralRecord> integralRecords = integralRecordService.select(daId);
+            if(integralRecords!=null){
+                for (int i = 0; i < integralRecords.size(); i++) {
+                    IntegralRecord integralRecord = integralRecords.get(i);
+                    List<String> list = Arrays.asList(integralRecord.getImageUrl().split("#"));
+                    String imageUrl = qiNiuService.getUrl(list.get(1));
+                    integralRecords.get(i).setImageUrl(imageUrl);
+
+                }
+            }
+
+            ApiResult<List<IntegralRecord>> apiResult = ApiResult.createSuccess(integralRecords);
+            LOG.info("调用获取兑换记录列表(/integralRecord/getIntegralRecord)接口成功");
+            LOG.debug("获取品牌(/integralRecord/getIntegralRecord), apiResult:{}", apiResult);
+            return apiResult;
+        }catch (Exception e){
+            LOG.error("调用获取兑换记录列表(/integralRecord/getIntegralRecord)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+
+    }
+    @GetMapping("/delete")
+    public ApiResult delete(String userId){
+        boolean result = diggerAgentAddressService.delete(userId);
+        return ApiResult.createSuccess(result);
+    }
+}

+ 145 - 0
wjj-api/src/main/java/com/demo/wjj/controller/OfferController.java

@@ -0,0 +1,145 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.DiggerOfferBo;
+import com.demo.wjj.bo.DiggerOfferSaveBo;
+import com.demo.wjj.converter.SaveDiggerOfferConverter;
+import com.demo.wjj.po.CreditsExchange;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.po.Offer;
+import com.demo.wjj.qo.SaveDiggerOfferQo;
+import com.demo.wjj.service.CreditsExchangeService;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.service.DisplaceAuditService;
+import com.demo.wjj.service.OfferService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.Result;
+import com.demo.wjj.validator.SaveDiggerOfferValidator;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 保证金
+ * @author wangqing
+ * @date 2018.11.18
+ */
+@RequestMapping("/offer")
+@RestController
+public class OfferController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private OfferService offerService;
+    @Autowired
+    private SaveDiggerOfferValidator saveDiggerOfferValidator;
+    @Autowired
+    private SaveDiggerOfferConverter saveDiggerOfferConverter;
+
+    @InitBinder
+    protected void initBinder(WebDataBinder binder) {
+        Object target = binder.getTarget();
+        if (target == null) {
+            return;
+        }
+
+        if (saveDiggerOfferValidator.supports(target.getClass())) {
+            binder.addValidators(saveDiggerOfferValidator);
+        }
+    }
+
+    /**
+     * 查询车商置换保证金
+     * @param agentId 商家id
+     * @param openId openId
+     * @param displaceId 置换id
+     * @return apiResult
+     */
+    @GetMapping("/getDiggerOffer")
+    public ApiResult queryDiggerOffer(@RequestParam(required = false) String agentId,
+                                      @RequestParam(required = false) String openId,
+                                      @RequestParam(required = false) String displaceId) {
+        LOG.info("调用查询车商置换保证金(/offer/getDiggerOffer)接口, agentId:{}, openId:{}, displaceId:{}", agentId, openId, displaceId);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(displaceId)) {
+            LOG.info("displaceId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            ExecuteResult<DiggerOfferBo> executeResult = offerService.queryDiggerPayOffer(agentId, openId, displaceId);
+            ApiResult apiResult;
+            if (executeResult.isExecuteResult()) {
+                apiResult = ApiResult.createSuccess(executeResult.getData());
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                apiResult = new ApiResult(result);
+            }
+            LOG.info("调用查询车商置换保证金(/offer/getDiggerOffer)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询车商置换保证金(/offer/getDiggerOffer)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 保存车商报价
+     * @param saveDiggerOfferQo 保存车商
+     * @return apiResult
+     */
+    @PostMapping("/save")
+    public ApiResult save(@Valid SaveDiggerOfferQo saveDiggerOfferQo) {
+        LOG.info("调用保存车商报价(/offer/save)接口, saveDiggerOfferQo:{}", saveDiggerOfferQo);
+        try {
+            ExecuteResult<Boolean> saveResult = offerService.save(saveDiggerOfferConverter.convert(saveDiggerOfferQo));
+            ApiResult apiResult;
+            if (saveResult.isExecuteResult()) {
+                apiResult = saveResult.getData() ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            } else {
+                Result result = saveResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                apiResult = new ApiResult(result);
+            }
+
+
+
+
+
+
+
+            LOG.info("调用保存车商报价(/offer/save)接口成功, apiResult: {}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用保存车商报价(/offer/save)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+    @GetMapping("/select")
+    public ApiResult select(String displaceId){
+        Offer offer = offerService.selectOne(displaceId);
+        return ApiResult.createSuccess(offer);
+
+    }
+}

+ 114 - 0
wjj-api/src/main/java/com/demo/wjj/controller/OpenIdController.java

@@ -0,0 +1,114 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.WeiXinUserBo;
+import com.demo.wjj.service.OpenIdService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangqing
+ * @date 2018.11.16
+ */
+@RequestMapping("/open")
+@RestController
+public class OpenIdController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private OpenIdService openIdService;
+
+    /**
+     * 查询微信openId
+     * @param agentId 商家id
+     * @param code 授权code
+     * @return apiResult
+     */
+    @GetMapping("/getId")
+    public ApiResult getId(@RequestParam(required = false) String agentId, @RequestParam(required = false) String code) {
+        LOG.info("调用获取微信openId(/open/getId)接口, agentId:{}, code:{}", agentId, code);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(code)) {
+            LOG.info("code为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            ExecuteResult<WeiXinUserBo> executeResult = openIdService.getOpenId(agentId, code);
+            if (executeResult.isExecuteResult()) {
+                WeiXinUserBo weiXinUserBo = executeResult.getData();
+
+                ApiResult apiResult = StringUtils.isBlank(weiXinUserBo.getOpenId()) || StringUtils.isBlank(weiXinUserBo.getNickname()) ?
+                        ApiResult.createFailure() : ApiResult.createSuccess(weiXinUserBo);
+                LOG.info("调用获取微信openId(/open/getId)接口成功, apiResult:{}", apiResult);
+                return apiResult;
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                return new ApiResult(result);
+            }
+        } catch (Exception e) {
+            LOG.error("调用获取微信openId(/open/getId)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 查询商家支付openId
+     * @param agentId 商家id
+     * @param code 授权code
+     * @return apiResult
+     */
+    @GetMapping("/getPayId")
+    public ApiResult getPayId(@RequestParam(required = false) String agentId, @RequestParam(required = false) String code) {
+        LOG.info("调用获取商家支付openId(/open/getPayId)接口, agentId:{}, code:{}", agentId, code);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(code)) {
+            LOG.info("code为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            ExecuteResult<WeiXinUserBo> executeResult = openIdService.getPayOpenId(agentId, code);
+            if (executeResult.isExecuteResult()) {
+
+                ApiResult apiResult = StringUtils.isBlank(executeResult.getData().getOpenId()) ? ApiResult.createFailure() : ApiResult.createSuccess(executeResult.getData());
+                LOG.info("调用获取商家支付openId(/open/getPayId)接口成功, apiResult:{}", apiResult);
+                return apiResult;
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                return new ApiResult(result);
+            }
+        } catch (Exception e) {
+            LOG.error("调用获取商家支付openId(/open/getPayId)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 262 - 0
wjj-api/src/main/java/com/demo/wjj/controller/PayController.java

@@ -0,0 +1,262 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.CreateOrderBo;
+import com.demo.wjj.bo.CreateOrderResult;
+import com.demo.wjj.po.CreditsExchange;
+import com.demo.wjj.po.WeiXinPay;
+import com.demo.wjj.service.CreditsExchangeService;
+import com.demo.wjj.service.PayService;
+import com.demo.wjj.service.WeiXinPayService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.IpUtils;
+import com.demo.wjj.utils.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangqing
+ * @date 2018.11.15
+ */
+@SuppressWarnings("all")
+@RequestMapping("/pay")
+@RestController
+public class PayController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private PayService payService;
+
+    @Autowired
+    private WeiXinPayService weiXinPayService;
+
+
+    /**
+     * 创建微信支付订单
+     * @param productId 产品id
+     * @param agentId 商家id
+     * @param openId openId
+     * @param name 联系人姓名
+     * @param mobile 联系人手机
+     * @param tp 是否通票
+     * @return
+     */
+    @PostMapping("/createOrder")
+    public ApiResult createOrder(@RequestParam(required = false) String productId,
+                                 @RequestParam(required = false) String agentId,
+                                 @RequestParam(required = false) String openId,
+                                 @RequestParam(required = false) String name,
+                                 @RequestParam(required = false) String mobile,
+                                 @RequestParam(required = false) String tp,
+                                 HttpServletRequest request) {
+        LOG.info("调用创建保证金微信支付订单(/pay/createOrder)接口, productId:{}, agentId:{}, openId:{}", productId, agentId, openId);
+
+        if (StringUtils.isBlank(productId)) {
+            LOG.info("productId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(name)) {
+            LOG.info("name为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(mobile)) {
+            LOG.info("mobile为空");
+            return ApiResult.createFailure();
+        }
+
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        if (StringUtils.isBlank(tp)) {
+            tp = "0";
+        }
+
+
+        final String[] tps = {"1", "0"};
+        if (!ArrayUtils.contains(tps, tp)) {
+            LOG.info("tp值非法, tp:{}", tp);
+            return ApiResult.createFailure();
+        }
+        */
+        CreateOrderBo createOrderBo = new CreateOrderBo();
+        createOrderBo.setProductId(productId);
+        createOrderBo.setAgentId(agentId);
+        createOrderBo.setOpenId(openId);
+        createOrderBo.setName(name);
+        createOrderBo.setMobile(mobile);
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        createOrderBo.setTp(Integer.parseInt(tp));
+        */
+        createOrderBo.setClientIp(IpUtils.getIp(request));
+        try {
+            ExecuteResult<CreateOrderResult> executeResult = payService.createOrder(createOrderBo);
+            if (executeResult.isExecuteResult()) {
+                ApiResult<CreateOrderResult> apiResult = ApiResult.createSuccess(executeResult.getData());
+                LOG.info("调用创建保证金微信支付订单(/pay/createOrder)接口成功, apiResult:{}", apiResult);
+                return apiResult;
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                return new ApiResult(result);
+            }
+
+        } catch (Exception e) {
+            LOG.error("调用创建保证金微信支付订单(/pay/createOrder)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+
+    /**
+     * 查询订单支付状态
+     * @param orderNo 订单编号
+     * @return
+     */
+    @GetMapping("/getOrderStatus")
+    public ApiResult queryOrderStatus(@RequestParam(required = false) String orderNo) {
+        LOG.info("调用获取订单支付状态(/pay/getOrderStatus)接口, orderNo:{}", orderNo);
+
+        if (StringUtils.isBlank(orderNo)) {
+            LOG.info("orderNo为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            WeiXinPay weiXinPay = weiXinPayService.get(orderNo);
+            if (weiXinPay == null) {
+                LOG.info("未查找到微信支付订单, orderNo:{}", orderNo);
+                return ApiResult.createFailure();
+            }
+
+            Map<String, Integer> data = new HashMap<>();
+            data.put("success", WeiXinPay.ORDER_STATUS_SUCCESS == weiXinPay.getOrderStatus() ? 1 : 0);
+            ApiResult<Map<String, Integer>> apiResult = ApiResult.createSuccess(data);
+            LOG.info("调用获取订单支付状态(/pay/getOrderStatus)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.info("调用获取订单支付状态(/pay/getOrderStatus)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+
+    /**
+     * 微信支付回调
+     * @param request request
+     * @return 响应内容
+     */
+    @RequestMapping(value = "/callback")
+    public String callback(HttpServletRequest request) {
+        LOG.info("调用微信支付订单回调(/pay/callback)接口");
+        ServletInputStream inputStream;
+
+        try {
+            inputStream = request.getInputStream();
+        } catch (IOException e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口, 获取请求流异常", e);
+            return "";
+        }
+
+        int b;
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        try {
+            while ((b = inputStream.read()) != -1) {
+                outputStream.write(b);
+            }
+        } catch (Exception e) {
+            LOG.error("调用微信支付订单回调(/pay/callback)接口, 读取请求流内容异常", e);
+            return "";
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                LOG.error("", e);
+            }
+        }
+
+        try {
+            String result = payService.payCallback(new String(outputStream.toByteArray(), StandardCharsets.UTF_8).trim());
+            LOG.info("调用微信支付订单回调(/pay/callback)接口成功, result => {}", result);
+            return result;
+        } catch (Exception e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口异常", e);
+            return "";
+        }
+    }
+
+    @PostMapping("/applyRefund")
+    public ApiResult applyRefund(@RequestParam String id) {
+        LOG.info("调用微信申请退款(/pay/applyRefund)接口, id:{}", id);
+        if (StringUtils.isBlank(id)) {
+            LOG.info("id为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final ExecuteResult<String> executeResult = payService.refund(id);
+            ApiResult apiResult;
+            if (executeResult.isExecuteResult()) {
+                apiResult = ApiResult.createSuccess(null);
+            } else {
+                apiResult = ApiResult.createFailure();
+                apiResult.setMessage(executeResult.getData());
+            }
+            LOG.info("调用微信申请退款(/pay/applyRefund)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用微信申请退款(/pay/applyRefund)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @RequestMapping("/refund/{depositId}/callback/integral")
+    public String refundCallbackIntegral(@PathVariable String depositId, @RequestBody String xml) {
+        LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口, depositId:{}, xml:{}", depositId, xml);
+
+        final String responseXml = "<xml><return_code>${result}</return_code><return_msg></return_msg></xml>";
+
+        if (StringUtils.isBlank(depositId)) {
+            LOG.info("depositId为空");
+            return responseXml.replace("${result}", "FAIL");
+        }
+
+        if (StringUtils.isBlank(xml)) {
+            LOG.info("xml为空");
+            return responseXml.replace("${result}", "FAIL");
+        }
+
+        try {
+            final String result = responseXml.replace("${result}", payService.refundCallback(depositId, xml));
+            LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口成功, result:{}", result);
+            return result;
+        } catch (Exception e) {
+            LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口异常", e);
+            return responseXml.replace("${result}", "FAIL");
+        }
+    }
+
+}

+ 235 - 0
wjj-api/src/main/java/com/demo/wjj/controller/PayforController.java

@@ -0,0 +1,235 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.CreateOrderBo;
+import com.demo.wjj.bo.CreateOrderResult;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.service.*;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.IpUtils;
+import com.demo.wjj.utils.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.Map;
+
+@SuppressWarnings("all")
+@RestController
+@RequestMapping("/diggerDisplace/payfor")
+public class PayforController {
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private PayforService payforService;
+
+    @Autowired
+    private WeiXinPayService weiXinPayService;
+
+    @Autowired
+    private CreditsExchangeService creditsExchangeService;
+
+    @Autowired
+    private DiggerAgentService diggerAgentService;
+
+    /**
+     * 创建微信支付订单
+     *
+     * @param productId 产品id
+     * @param agentId   商家id
+     * @param openId    openId
+     * @param name      联系人姓名
+     * @param mobile    联系人手机
+     * @param tp        是否通票
+     * @return
+     */
+    @PostMapping("/createOrder")
+    public ApiResult createOrder(@RequestParam(required = false) String productId,
+                                 @RequestParam(required = false) String agentId,
+                                 @RequestParam(required = false) String openId,
+                                 @RequestParam(required = false) String name,
+                                 @RequestParam(required = false) String mobile,
+                                 @RequestParam(required = false) String tp,
+                                 HttpServletRequest request) {
+        LOG.info("调用创建保证金微信支付订单(/pay/createOrder)接口, productId:{}, agentId:{}, openId:{}", productId, agentId, openId);
+
+       /* if (StringUtils.isBlank(productId)) {
+            LOG.info("productId为空");
+            return ApiResult.createFailure();
+        }
+*/
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+      /*  if (StringUtils.isBlank(name)) {
+            LOG.info("name为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(mobile)) {
+            LOG.info("mobile为空");
+            return ApiResult.createFailure();
+        }*/
+
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        if (StringUtils.isBlank(tp)) {
+            tp = "0";
+        }
+
+
+        final String[] tps = {"1", "0"};
+        if (!ArrayUtils.contains(tps, tp)) {
+            LOG.info("tp值非法, tp:{}", tp);
+            return ApiResult.createFailure();
+        }
+        */
+
+
+        CreateOrderBo createOrderBo = new CreateOrderBo();
+        createOrderBo.setProductId(productId);
+        createOrderBo.setAgentId(agentId);
+        createOrderBo.setOpenId(openId);
+        createOrderBo.setName(name);
+        createOrderBo.setMobile(mobile);
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        createOrderBo.setTp(Integer.parseInt(tp));
+        */
+        createOrderBo.setClientIp(IpUtils.getIp(request));
+        try {
+            ExecuteResult<CreateOrderResult> executeResult = payforService.createOrder(createOrderBo);
+            if (executeResult.isExecuteResult()) {
+                ApiResult<CreateOrderResult> apiResult = ApiResult.createSuccess(executeResult.getData());
+                LOG.info("调用创建保证金微信支付订单(/pay/createOrder)接口成功, apiResult:{}", apiResult);
+
+                return apiResult;
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                return new ApiResult(result);
+            }
+
+        } catch (Exception e) {
+            LOG.error("调用创建保证金微信支付订单(/pay/createOrder)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+    /**
+     * 微信支付回调
+     * @param request request
+     * @return 响应内容
+     */
+    @RequestMapping(value = "/callback")
+    public String callback(HttpServletRequest request) {
+        LOG.info("调用微信支付订单回调(/pay/callback)接口");
+        ServletInputStream inputStream;
+
+        try {
+            inputStream = request.getInputStream();
+        } catch (IOException e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口, 获取请求流异常", e);
+            return "";
+        }
+
+        int b;
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        try {
+            while ((b = inputStream.read()) != -1) {
+                outputStream.write(b);
+            }
+        } catch (Exception e) {
+            LOG.error("调用微信支付订单回调(/pay/callback)接口, 读取请求流内容异常", e);
+            return "";
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                LOG.error("", e);
+            }
+        }
+
+        try {
+            String result = payforService.payCallback(new String(outputStream.toByteArray(), StandardCharsets.UTF_8).trim());
+            LOG.info("调用微信支付订单回调(/pay/callback)接口成功, result => {}", result);
+            return result;
+        } catch (Exception e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口异常", e);
+            return "";
+        }
+    }
+
+    @PostMapping("/applyRefund")
+    public ApiResult applyRefund(@RequestParam String id) {
+        LOG.info("调用微信申请退款(/pay/applyRefund)接口, id:{}", id);
+        if (StringUtils.isBlank(id)) {
+            LOG.info("id为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final ExecuteResult<String> executeResult = payforService.refund(id);
+            ApiResult apiResult;
+            if (executeResult.isExecuteResult()) {
+                apiResult = ApiResult.createSuccess(null);
+            } else {
+                apiResult = ApiResult.createFailure();
+                apiResult.setMessage(executeResult.getData());
+            }
+            LOG.info("调用微信申请退款(/pay/applyRefund)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用微信申请退款(/pay/applyRefund)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @RequestMapping("/refund/{depositId}/callback")
+    public String refundCallback(@PathVariable String depositId, @RequestBody String xml) {
+        LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口, depositId:{}, xml:{}", depositId, xml);
+
+        final String responseXml = "<xml><return_code>${result}</return_code><return_msg></return_msg></xml>";
+
+        if (StringUtils.isBlank(depositId)) {
+            LOG.info("depositId为空");
+            return responseXml.replace("${result}", "FAIL");
+        }
+
+        if (StringUtils.isBlank(xml)) {
+            LOG.info("xml为空");
+            return responseXml.replace("${result}", "FAIL");
+        }
+
+        try {
+            final String result = responseXml.replace("${result}", payforService.refundCallback(depositId, xml));
+            LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口成功, result:{}", result);
+            return result;
+        } catch (Exception e) {
+            LOG.info("调用微信退款回调(/refund/{appId}/{depositId}/callback)接口异常", e);
+            return responseXml.replace("${result}", "FAIL");
+        }
+    }
+    @PostMapping("/update")
+    public ApiResult update(@RequestParam String agentId,
+                            @RequestParam String openId){
+        DiggerAgent diggerAgent = diggerAgentService.getDiggerAgent(agentId, openId);
+        boolean result = diggerAgentService.updateIntegral(diggerAgent.getDaId(), 2);
+        return ApiResult.createSuccess(result);
+    }
+}

+ 315 - 0
wjj-api/src/main/java/com/demo/wjj/controller/PayforPresentController.java

@@ -0,0 +1,315 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.CreateOrderBo;
+import com.demo.wjj.bo.CreateOrderResult;
+import com.demo.wjj.po.DiggerAgent;
+import com.demo.wjj.po.DiggerAgentAddress;
+import com.demo.wjj.po.IntegralRecord;
+import com.demo.wjj.service.*;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.IpUtils;
+import com.demo.wjj.utils.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@SuppressWarnings("all")
+@RestController
+@RequestMapping("/diggerDisplace/payforPrensent")
+public class PayforPresentController {
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private PayforPrensentService payforPrensentService;
+
+    @Autowired
+    private WeiXinPayService weiXinPayService;
+
+    @Autowired
+    private CreditsExchangeService creditsExchangeService;
+
+    @Autowired
+    private DiggerAgentService diggerAgentService;
+
+    @Autowired
+    private IntegralRecordService integralRecordService;
+
+    @Autowired
+    private DiggerAgentAddressService diggerAgentAddressService;
+
+    @Autowired
+    private PresentService presentService;
+    @Autowired
+    private AgentService agentService;
+
+    /**
+     * 创建礼品支付订单
+     *
+     * @param productId   产品id
+     * @param agentId     商家id
+     * @param openId      openId
+     * @param name        联系人姓名
+     * @param mobile      联系人手机
+     * @param tp          是否通票
+     * @param integral    兑换礼品所需积分
+     * @param code        兑换礼品所需金钱
+     * @param presentName 礼品名称
+     * @param address     车商收货人地址
+     * @param province    省
+     * @param city        市
+     * @return
+     */
+    @PostMapping("/createOrder")
+    public ApiResult createOrder(@RequestParam(required = false) String productId,
+                                 @RequestParam(required = false) String agentId,
+                                 @RequestParam(required = false) String openId,
+                                 @RequestParam(required = false) String name,
+                                 @RequestParam(required = false) String mobile,
+                                 @RequestParam(required = false) String tp,
+                                 @RequestParam(required = false) String integral,
+                                 @RequestParam(required = false) String code,
+                                 @RequestParam(required = false) String presentName,
+                                 @RequestParam(required = false) String address,
+                                 @RequestParam(required = false) String province,
+                                 @RequestParam(required = false) String city,
+                                 @RequestParam(required = false) String district,
+                                 HttpServletRequest request) {
+
+        LOG.info("调用创建礼品微信支付订单(/pay/createOrder)接口, productId:{}, agentId:{}, openId:{}", productId, agentId, openId);
+
+        if (StringUtils.isBlank(productId)) {
+            LOG.info("productId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(name)) {
+            LOG.info("name为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(mobile)) {
+            LOG.info("mobile为空");
+            return ApiResult.createFailure();
+        }
+        if (StringUtils.isBlank(integral)) {
+            LOG.info("integral为空");
+            return ApiResult.createFailure();
+        }
+        if (StringUtils.isBlank(code)) {
+            LOG.info("code为空");
+            return ApiResult.createFailure();
+        }
+
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        if (StringUtils.isBlank(tp)) {
+            tp = "0";
+        }
+
+
+        final String[] tps = {"1", "0"};
+        if (!ArrayUtils.contains(tps, tp)) {
+            LOG.info("tp值非法, tp:{}", tp);
+            return ApiResult.createFailure();
+        }*/
+        Integer codeNew = Integer.parseInt(code);
+        String addressNew = province + city + district + address;
+
+        if (codeNew == 0) {
+            DiggerAgent diggerAgent = diggerAgentService.getDiggerAgent(agentId, openId);
+            Integer integralOld = diggerAgentService.getOne(diggerAgent.getDaId()).getIntegral();
+            String userId = diggerAgent.getDaId();
+            Integer integralAnd = Integer.parseInt(integral);
+            Integer integralNew = integralOld - integralAnd;
+            //更新车商积分
+            diggerAgentService.updateIntegral(userId, integralNew);
+            IntegralRecord integralRecord = new IntegralRecord();
+            integralRecord.setPresentName(presentName);
+            integralRecord.setUserName(diggerAgent.getDaName());
+            integralRecord.setMemberLevel(diggerAgentService.getOne(diggerAgent.getDaId()).getMemberLevel());
+            integralRecord.setPhone(mobile);
+            integralRecord.setAddress(addressNew);
+            Date date = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String time = sdf.format(date);
+            integralRecord.setExchangeTime(time);
+            integralRecord.setUserId(userId);
+            integralRecord.setIntegral(integralAnd);
+            integralRecord.setPrice(codeNew);
+            integralRecord.setAddId(agentId);
+            integralRecord.setAgentName(agentService.selectInteg(agentId).getAgentName());
+            integralRecord.setImageUrl(presentService.selectPresent(Integer.parseInt(productId)).getImageUrl());
+            integralRecord.setPresentId(Integer.parseInt(productId));
+            integralRecordService.save(integralRecord);
+            Integer presentId = Integer.parseInt(productId);
+            int storeNew;
+            Integer store = (presentService.selectPresent(presentId).getStore()) - 1;
+            if (store > 0) {
+                storeNew = store;
+            } else {
+                storeNew = 0;
+            }
+            presentService.updateStore(presentId, storeNew);
+            Map map = new HashMap();
+            map.put("status", "0");
+            return ApiResult.createSuccess(map);
+
+
+        }
+        DiggerAgent diggerAgent = diggerAgentService.getDiggerAgent(agentId, openId);
+        String diggerAgentId = diggerAgent.getDaId();
+        List userList = new ArrayList();
+        List<DiggerAgentAddress> list = diggerAgentAddressService.select();
+        if (list != null) {
+            for (int i = 0; i < list.size(); i++) {
+                userList.add(list.get(i).getUserId());
+
+            }
+        }
+        if (userList != null) {
+            if (userList.contains(diggerAgentId)) {
+                diggerAgentAddressService.delete(diggerAgentId);
+            }
+
+
+        }
+        DiggerAgentAddress diggerAgentAddress = new DiggerAgentAddress();
+        diggerAgentAddress.setAddress(addressNew);
+        diggerAgentAddress.setUserId(diggerAgentId);
+        diggerAgentAddress.setUserName(diggerAgent.getDaName());
+        diggerAgentAddress.setPhone(mobile);
+        diggerAgentAddressService.save(diggerAgentAddress);
+
+
+        CreateOrderBo createOrderBo = new CreateOrderBo();
+        createOrderBo.setProductId(productId);
+        createOrderBo.setAgentId(agentId);
+        createOrderBo.setOpenId(openId);
+        createOrderBo.setName(name);
+        createOrderBo.setMobile(mobile);
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        createOrderBo.setTp(Integer.parseInt(tp));
+        */
+        createOrderBo.setClientIp(IpUtils.getIp(request));
+        try {
+            ExecuteResult<CreateOrderResult> executeResult = payforPrensentService.createOrder(createOrderBo, code);
+            if (executeResult.isExecuteResult()) {
+                ApiResult<CreateOrderResult> apiResult = ApiResult.createSuccess(executeResult.getData());
+                LOG.info("调用创建保证金微信支付订单(/pay/createOrder)接口成功, apiResult:{}", apiResult);
+
+                return apiResult;
+            } else {
+                Result result = executeResult.getResult();
+                if (result == null) {
+                    result = Result.Failure;
+                }
+                return new ApiResult(result);
+            }
+
+        } catch (Exception e) {
+            LOG.error("调用创建保证金微信支付订单(/pay/createOrder)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+
+    /**
+     * 礼品微信支付回调
+     *
+     * @param request request
+     * @return 响应内容
+     */
+    @RequestMapping(value = "/callback")
+    public String callback(HttpServletRequest request) {
+        LOG.info("调用微信支付订单回调(/pay/callback)接口");
+        ServletInputStream inputStream;
+
+        try {
+            inputStream = request.getInputStream();
+        } catch (IOException e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口, 获取请求流异常", e);
+            return "";
+        }
+
+        int b;
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        try {
+            while ((b = inputStream.read()) != -1) {
+                outputStream.write(b);
+            }
+        } catch (Exception e) {
+            LOG.error("调用微信支付订单回调(/pay/callback)接口, 读取请求流内容异常", e);
+            return "";
+        } finally {
+            try {
+                outputStream.close();
+            } catch (IOException e) {
+                LOG.error("", e);
+            }
+        }
+
+        try {
+            String result = payforPrensentService.payCallback(new String(outputStream.toByteArray(), StandardCharsets.UTF_8).trim());
+            LOG.info("调用微信支付订单回调(/pay/callback)接口成功, result => {}", result);
+            return result;
+        } catch (Exception e) {
+            LOG.info("调用微信支付订单回调(/pay/callback)接口异常", e);
+            return "";
+        }
+    }
+
+    @PostMapping("/update")
+    public ApiResult update(@RequestParam(required = false) String agentId,
+                            @RequestParam(required = false) String openId,
+                            @RequestParam(required = false) String name,
+                            @RequestParam(required = false) String mobile,
+                            @RequestParam(required = false) String integral,
+                            @RequestParam(required = false) String code,
+                            @RequestParam(required = false) String presentName,
+                            @RequestParam(required = false) String address) {
+        LOG.info("调用修改礼品兑换表接口/payfor/update");
+        DiggerAgent diggerAgent = diggerAgentService.getDiggerAgent(agentId, openId);
+        String userId = diggerAgent.getDaId();
+        Integer integralNew = Integer.parseInt(integral);
+        Integer codeNew = Integer.parseInt(code);
+        diggerAgentService.updateIntegral(userId, 0);
+        IntegralRecord integralRecord = new IntegralRecord();
+        integralRecord.setPresentName(presentName);
+        integralRecord.setUserName(name);
+        integralRecord.setMemberLevel(diggerAgent.getMemberLevel());
+        integralRecord.setPhone(mobile);
+        integralRecord.setAddress(address);
+        Date date = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String time = sdf.format(date);
+        integralRecord.setExchangeTime(time);
+        integralRecord.setUserId(userId);
+        integralRecord.setIntegral(integralNew);
+        integralRecord.setPrice(codeNew);
+        integralRecordService.save(integralRecord);
+
+        return ApiResult.createSuccess("修改表格成功");
+    }
+
+
+}

+ 190 - 0
wjj-api/src/main/java/com/demo/wjj/controller/PresentController.java

@@ -0,0 +1,190 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.IntegralRecord;
+import com.demo.wjj.po.PresentAndMoney;
+import com.demo.wjj.po.Present;
+import com.demo.wjj.service.DiggerAgentService;
+import com.demo.wjj.service.IntegralRecordService;
+import com.demo.wjj.service.PresentService;
+import com.demo.wjj.service.QiNiuService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.*;
+
+@RestController
+@RequestMapping("/diggerDisplace")
+public class PresentController {
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+    @Autowired
+    PresentService presentService;
+    @Autowired
+    DiggerAgentService diggerAgentService;
+    @Autowired
+    IntegralRecordService integralRecordService;
+    @Autowired
+    QiNiuService qiNiuService;
+
+    /**
+     * 获取礼品所有信息
+     * @return
+     */
+    @GetMapping("/getAllPresent")
+    public ApiResult getAllPresent(String userId){
+        LOG.info("调用获取礼品表所有信息(/pre/getAllPresent)接口");
+        try {
+            List<Present> presents = presentService.selectPresentList(userId);
+            if(presents!=null){
+                for (int i = 0; i < presents.size(); i++) {
+                    List list = Arrays.asList(presents.get(i).getImageUrl().split("#"));
+                    List arrList = new ArrayList(list);
+                    arrList.remove(0);
+                    List imageList = new ArrayList();
+                    for (int j = 0; j < arrList.size(); j++) {
+                        String url = qiNiuService.getUrl(arrList.get(j).toString());
+                        imageList.add(url);
+                    }
+                    String imageUrl = "";
+                    for (int o = 0; o < imageList.size(); o++) {
+                        imageUrl += "##" + imageList.get(o);
+                    }
+                    presents.get(i).setImageUrl(imageUrl);
+
+
+                }
+            }
+            LOG.info("调用获取礼品表所有信息(/pre/getAllPresent)接口成功");
+            return ApiResult.createSuccess(presents);
+        }catch (Exception e){
+            LOG.error("调用获取礼品表所有信息(/pre/getAllPresent)接口异常",e);
+            return ApiResult.createFailure();
+        }
+    }
+    @GetMapping("/getPresent")
+    public ApiResult getPresent(@RequestParam(required = false) String id,
+                                @RequestParam(required = false) String integral,
+                                @RequestParam(required = false) String agentId,
+                                @RequestParam(required = false) String openId){
+        LOG.info("调用获取礼品表信息(/pre/getPresent)接口,id:{},integral",id,integral);
+        try{
+            Map map = new HashMap();
+            // String name = presentService.selectPresent(Integer.parseInt(id)).getName();
+            String daId = diggerAgentService.getDiggerAgent(agentId, openId).getDaId();
+    /*        List<IntegralRecord> list = integralRecordService.select(daId);
+            Map map = new HashMap();
+            if(list!=null){
+                for (int i = 0; i < list.size(); i++) {
+                    if(list.get(i).getPresentName().equals(name)){
+                        map.put("status","0");
+                        return ApiResult.createSuccess(map);
+                    }
+                }
+            }*/
+
+
+            Integer pid = Integer.parseInt(id);
+            Present present = presentService.selectPresent(pid);
+            Integer amount = present.getAmount();
+            int counts = integralRecordService.selectCounts(daId, id);
+            if(counts>=amount){
+                map.put("status","0");
+                return ApiResult.createSuccess(map);
+            }
+            String str = present.getImageUrl();
+            List list1 = Arrays.asList(str.split("#"));
+            List arrList = new ArrayList(list1);
+            arrList.remove(0);
+            List imageList = new ArrayList();
+            for (int j = 0; j < arrList.size(); j++) {
+                String url = qiNiuService.getUrl(arrList.get(j).toString());
+                imageList.add(url);
+            }
+            String imageUrl = "";
+            for (int o = 0; o < imageList.size(); o++) {
+                imageUrl += "##" + imageList.get(o);
+            }
+            present.setImageUrl(imageUrl);
+
+            Integer integralNeed = present.getIntegral();
+            Integer IntegerHave = Integer.parseInt(integral);
+            Integer money;
+
+
+            if(IntegerHave-integralNeed>=0){
+                money =0;
+            }else {
+                double moneyOld =(double) (integralNeed-IntegerHave)/Integer.parseInt(present.getProportion());
+                if(moneyOld<1){
+                    money =1;
+                }else {
+                    money = (integralNeed-IntegerHave)/Integer.parseInt(present.getProportion());
+                }
+
+            }
+            PresentAndMoney presentAndMoney = new PresentAndMoney();
+            presentAndMoney.setMoney(money);
+            presentAndMoney.setPresent(present);
+
+
+
+            LOG.info("调用获取礼品表所有信息(/pre/getPresent)接口成功");
+            return ApiResult.createSuccess(presentAndMoney);
+
+        }catch (Exception e){
+            LOG.error("调用获取礼品表所有信息(/pre/getPresent)接口异常",e);
+            return ApiResult.createFailure();
+
+        }
+
+    }
+    @GetMapping("/commodityDetails")
+    public ApiResult getCommodityDetails(@RequestParam(required = false) String id,
+                                         @RequestParam(required = false) String userId){
+        LOG.info("调用礼品详情(/pre/commodityDetails)接口,id:{},userId:{}",id,userId);
+        if(StringUtils.isBlank(id)){
+            LOG.info("id为空");
+            return ApiResult.createFailure();
+        }
+        if (StringUtils.isBlank(userId)){
+            LOG.info("userId为空");
+            return ApiResult.createFailure();
+        }
+        try {
+            Map map = new HashMap();
+            Integer integralAll = diggerAgentService.getOne(userId).getIntegral();
+            Integer pid = Integer.parseInt(id);
+            Present present = presentService.selectPresent(pid);
+            map.put("present",present);
+            map.put("integralAll",integralAll);
+            Integer integralNeed = present.getIntegral();
+            String proportion = present.getProportion();
+            Integer spread = integralAll - integralNeed;
+            if(spread<0){
+                Integer integralSpread = -spread;
+                Integer number = Integer.parseInt(proportion.split(":")[1]);
+                int cash = integralSpread/number;
+                map.put("cash",cash);
+                LOG.info("调用礼品详情(/pre/commodityDetails)接口成功");
+                return ApiResult.createSuccess(map);
+            }else {
+
+               map.put("cash",0);
+                LOG.info("调用礼品详情(/pre/commodityDetails)接口成功");
+               return ApiResult.createSuccess(map);
+            }
+
+        }catch (Exception e){
+            LOG.info("调用礼品详情(/pre/commodityDetails)接口异常",e);
+            return ApiResult.createFailure();
+
+        }
+    }
+
+}

+ 83 - 0
wjj-api/src/main/java/com/demo/wjj/controller/QiNiuController.java

@@ -0,0 +1,83 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.service.QiNiuService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.sql.Blob;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author wangqing
+ * @date 2018.11.14
+ */
+@RequestMapping("/seven")
+@RestController
+public class QiNiuController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private QiNiuService qiNiuService;
+
+    @GetMapping("/getToken")
+    public ApiResult getToken() {
+        LOG.info("调用获取七牛token(/seven/getToken)接口");
+        try {
+            String token = qiNiuService.getToken();
+            Map<String, String> data = new HashMap<>(16);
+            data.put("token", token);
+            ApiResult<String> apiResult = ApiResult.createSuccess(token);
+            LOG.info("调用获取七牛token(/seven/getToken)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取七牛token(/seven/getToken)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @GetMapping("/getQiNiuUrl")
+    public ApiResult getQiNiuUrl(String name) {
+        LOG.info("调用获取七牛路径(/seven/getQiNiuUrl)接口");
+        try {
+            String imgUrl = qiNiuService.getUrl(name);
+            Map<String, String> data = new HashMap<>(16);
+            data.put("imgUrl", imgUrl);
+            ApiResult<String> apiResult = ApiResult.createSuccess(imgUrl);
+            LOG.info("调用获取七牛路径(/seven/getQiNiuUrl)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取七牛路径(/seven/getQiNiuUrl)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+
+   @PostMapping("/getInputStream")
+    public  byte[] getInputStream(String url,String token) {
+        LOG.info("调用获取七牛视频下载流(/seven/getInputStream)接口");
+        try {
+            String destUrl = url+"&token="+token;
+            byte[] blob = qiNiuService.getInputStream(destUrl);
+            LOG.info("调用获取七牛token(/seven/getInputStream)接口成功, stream:{}", blob);
+
+            return blob;
+        } catch (Exception e) {
+            LOG.error("调用获取七牛token(/seven/getInputStream)接口异常", e);
+        }
+       return null;
+   }
+
+}

+ 48 - 0
wjj-api/src/main/java/com/demo/wjj/controller/QuoteProtocolController.java

@@ -0,0 +1,48 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.DisplaceDetailBo;
+import com.demo.wjj.bo.TbQuoteProtocolBo;
+import com.demo.wjj.po.Brand;
+import com.demo.wjj.service.BrandService;
+import com.demo.wjj.service.QuoteProtocolService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.Result;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.List;
+
+/**
+ * 协议
+ * @author wangqing
+ * @date 2018.11.10
+ */
+@RequestMapping("/quoteProtocol")
+@RestController
+public class QuoteProtocolController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private QuoteProtocolService quoteProtocolService;
+
+    /**
+     * 置换协议
+     * @return apiResult
+     */
+    @GetMapping("/findQuoteProtocol")
+    public ApiResult findQuoteProtocol(@RequestParam(required = false) Integer type) {
+        LOG.info("调用保存报价协议(quoteProtocol/saveQuoteProtocol)接口, type:{}", type);
+        TbQuoteProtocolBo quoteProtocolBo = quoteProtocolService.findQuoteProtocolByType(type);
+        ApiResult<TbQuoteProtocolBo> apiResult = ApiResult.createSuccess(quoteProtocolBo);
+        LOG.info("调用保存报价协议(quoteProtocol/saveQuoteProtocol)接口成功, apiResult:{}", quoteProtocolBo);
+        return apiResult;
+
+    }
+
+}

+ 100 - 0
wjj-api/src/main/java/com/demo/wjj/controller/RegionController.java

@@ -0,0 +1,100 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.po.Region;
+import com.demo.wjj.service.RegionService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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 java.util.List;
+
+/**
+ * 区域
+ * @author wangqing
+ * @date 2018.11.08
+ */
+@RequestMapping("/region")
+@RestController
+public class RegionController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private RegionService regionService;
+
+    /**
+     * 获取省份
+     * @return apiResult
+     */
+    @GetMapping("/getProvince")
+    public ApiResult<List<Region>> getProvince() {
+        LOG.info("调用获取省份(/region/getProvince)接口");
+        try {
+            List<Region> regions = regionService.queryProvinceList();
+            ApiResult<List<Region>> apiResult = ApiResult.createSuccess(regions);
+            LOG.info("退出获取省份(/region/getProvince)接口");
+            LOG.debug("获取省份, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取省份(/region/getProvince)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取地市
+     * @param provinceId 省份id
+     * @return apiResult
+     */
+    @GetMapping("/getCity")
+    public ApiResult<List<Region>> getCity(@RequestParam(required = false) String provinceId) {
+        LOG.info("调用获取地市(/region/getCity)接口, provinceId:{}", provinceId);
+        if (StringUtils.isBlank(provinceId) || !NumberUtils.isDigits(provinceId)) {
+            LOG.warn("provinceId非法. provinceId:{}", provinceId);
+            return ApiResult.createFailure();
+        }
+
+        try {
+            List<Region> regions = regionService.queryCityList(Integer.parseInt(provinceId));
+            ApiResult<List<Region>> apiResult = ApiResult.createSuccess(regions);
+            LOG.info("退出获取地市(/region/getCity)接口");
+            LOG.debug("获取地市, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取地市(/region/getCity)接口异常, provinceId:{}", provinceId, e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取区县
+     * @param cityId 地市id
+     * @return apiResult
+     */
+    @GetMapping("/getCounty")
+    public ApiResult<List<Region>> getCounty(@RequestParam(required = false) String cityId) {
+        LOG.info("调用获取区县(/region/getCounty)接口, cityId:{}", cityId);
+        if (StringUtils.isBlank(cityId) || !NumberUtils.isDigits(cityId)) {
+            LOG.warn("cityId非法. cityId:{}", cityId);
+            return ApiResult.createFailure();
+        }
+
+        try {
+            List<Region> regions = regionService.queryCountyList(Integer.parseInt(cityId));
+            ApiResult<List<Region>> apiResult = ApiResult.createSuccess(regions);
+            LOG.info("退出获取区县(/region/getCounty)接口");
+            LOG.debug("获取区县, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取区县(/region/getCounty)接口异常, cityId:{}", cityId, e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 69 - 0
wjj-api/src/main/java/com/demo/wjj/controller/ResourceController.java

@@ -0,0 +1,69 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.service.ResourceService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangqing
+ * @date 2018.12.20
+ */
+@RequestMapping("/resource")
+@RestController
+public class ResourceController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ResourceService resourceService;
+
+    @PostMapping("/upload")
+    public ApiResult upload(@RequestParam(required = false) String agentId,
+                            @RequestParam(required = false) String serverId,
+                            @RequestParam(required = false) String openId) {
+        LOG.info("调用上传微信资源(/resource/upload)接口, agentId:{}, openId:{}, serverId:{}", agentId, openId, serverId);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(serverId)) {
+            LOG.info("serverId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final String resourceKey = resourceService.upload(agentId, openId, serverId);
+
+            ApiResult apiResult;
+            if (StringUtils.isBlank(resourceKey)) {
+                apiResult = ApiResult.createFailure();
+            } else {
+                Map<String, String> data = new HashMap<>();
+                data.put("key", resourceKey);
+                apiResult = ApiResult.createSuccess(data);
+            }
+            LOG.info("调用上传微信资源(/resource/upload)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用上传微信资源(/resource/upload)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 51 - 0
wjj-api/src/main/java/com/demo/wjj/controller/SmsController.java

@@ -0,0 +1,51 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.service.ValidateCodeService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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;
+
+/**
+ * 短信
+ * @author wangqing
+ * @date 2018.11.09
+ */
+@RequestMapping("/sms")
+@RestController
+public class SmsController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private ValidateCodeService validateCodeService;
+
+    /**
+     * 注册短信验证码
+     * @param mobile 手机号
+     * @return apiResult
+     */
+    @GetMapping("/register")
+    public ApiResult register(@RequestParam(required = false) String mobile) {
+        LOG.info("调用注册短信发送(/sms/register)接口, mobile:{}", mobile);
+        if (StringUtils.isBlank(mobile)) {
+            LOG.warn("mobile为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            boolean sendResult = validateCodeService.send(mobile);
+            ApiResult apiResult = sendResult ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用注册短信发送(/sms/register)接口, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用注册短信发送(/sms/register)接口异常, mobile:{}", mobile, e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 59 - 0
wjj-api/src/main/java/com/demo/wjj/controller/TicketController.java

@@ -0,0 +1,59 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.JsSdkResult;
+import com.demo.wjj.service.JsSdkService;
+import com.demo.wjj.utils.ApiResult;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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;
+
+/**
+ * @author wangqing
+ * @date 2018.12.02
+ */
+@RequestMapping("/ticket")
+@RestController
+public class TicketController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private JsSdkService jsSdkService;
+
+    /**
+     * 获取ticket
+     * @param agentId 商家id
+     * @param url url
+     * @return js-api 结果
+     */
+    @GetMapping("/getTicket")
+    public ApiResult getTicket(@RequestParam(required = false) String agentId, @RequestParam(required = false) String url) {
+        LOG.info("调用获取微信ticket(/ticket/getTicket)接口, agentId:{}, url:{}", agentId, url);
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(url)) {
+            LOG.info("url为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final JsSdkResult jsSdkResult = jsSdkService.getJsSdkResult(agentId, url);
+            ApiResult apiResult = jsSdkResult == null ? ApiResult.createFailure() : ApiResult.createSuccess(jsSdkResult);
+            LOG.info("调用获取微信ticket(/ticket/getTicket)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取微信ticket(/ticket/getTicket)接口异常", e);
+            return ApiResult.createFailure();
+        }
+
+    }
+}

+ 175 - 0
wjj-api/src/main/java/com/demo/wjj/controller/UserController.java

@@ -0,0 +1,175 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.converter.UserRegisterConverter;
+import com.demo.wjj.qo.UserRegisterQo;
+import com.demo.wjj.service.UserService;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.ExecuteResult;
+import com.demo.wjj.utils.Result;
+import com.demo.wjj.validator.UserRegisterQoValidator;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.ObjectError;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 用户
+ * @author wangqing
+ * @date 2018.11.10
+ */
+@RestController
+@RequestMapping("/user")
+public class UserController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private UserService userService;
+
+    @Autowired
+    private UserRegisterQoValidator userRegisterQoValidator;
+    @Autowired
+    private UserRegisterConverter userRegisterConverter;
+
+    @InitBinder
+    protected void initBinder(WebDataBinder binder) {
+        Object target = binder.getTarget();
+        if (target == null) {
+            return;
+        }
+        if (userRegisterQoValidator.supports(target.getClass())) {
+            binder.addValidators(userRegisterQoValidator);
+        }
+    }
+
+    /**
+     * 用户注册
+     * @param userRegisterQo 注册参数
+     * @param bindingResult 绑定结果
+     * @return apiResult
+     */
+    @PostMapping("/register")
+    public ApiResult register(@Valid UserRegisterQo userRegisterQo, BindingResult bindingResult) {
+        LOG.info("调用用户注册(/user/register)接口, userRegisterQo:{}", userRegisterQo);
+
+        List<ObjectError> errors = bindingResult.getAllErrors();
+        if (CollectionUtils.isNotEmpty(errors)) {
+            LOG.info("调用用户注册(/user/register)接口, 请求参数错误");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            ApiResult<Boolean> apiResult;
+            ExecuteResult<Boolean> executeResult = userService.register(userRegisterConverter.convert(userRegisterQo));
+            if (!executeResult.isExecuteResult()) {
+                Result result = executeResult.getResult();
+                if (result != null) {
+                    apiResult = new ApiResult<>(result);
+                } else {
+                    apiResult = ApiResult.createFailure();
+                }
+            } else {
+                apiResult = executeResult.getData() ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            }
+            LOG.info("调用用户注册(/user/register)接口成功, apiResult => {}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用用户注册(/user/register)接口异常, userRegisterQo:{}", userRegisterQo, e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 查询微信号是否已注册销售员
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/querySale")
+    public ApiResult querySale(String agentId, String openId) {
+        LOG.info("调用查询微信号是否已注册销售员(/user/querySale)接口, agentId:{}, openId:{}", agentId, openId);
+        try {
+            boolean exists = userService.querySale(agentId, openId);
+            Map<String, Integer> result = new HashMap<>();
+            result.put("register", exists ? 1 : 0);
+            ApiResult<Map<String, Integer>> apiResult = ApiResult.createSuccess(result);
+            LOG.info("调用查询微信号是否已注册销售员(/user/querySale)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询微信号是否已注册销售员(/user/querySale)接口异常, agentId:{}, openId:{}", agentId, openId, e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 查询微信号是否已注册车商
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @return apiResult
+     */
+    @GetMapping("/queryDiggerAgent")
+    public ApiResult queryDiggerAgent(String agentId, String openId) {
+        LOG.info("调用查询微信号是否已注册车商(/user/queryDiggerAgent)接口, agentId:{}, openId:{}", agentId, openId);
+        try {
+            boolean exists = userService.queryDiggerAgent(agentId, openId);
+            Map<String, Integer> result = new HashMap<>();
+            result.put("register", exists ? 1 : 0);
+            ApiResult<Map<String, Integer>> apiResult = ApiResult.createSuccess(result);
+            LOG.info("调用查询微信号是否已注册车商(/user/queryDiggerAgent)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用查询微信号是否已注册车商(/user/queryDiggerAgent)接口异常, agentId:{}, openId:{}", agentId, openId, e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 解绑
+     * @param agentId 商家id
+     * @param openId 微信openId
+     * @param unbindFlag 解绑标识 1:解绑销售员; 2: 解绑车商; 3:解绑销售员和车商
+     * @return
+     */
+    @PostMapping("/unbind")
+    public ApiResult unbind(@RequestParam(required = false) String agentId,
+                            @RequestParam(required = false) String openId,
+                            @RequestParam(required = false) String unbindFlag) {
+        LOG.info("调用解绑用户(/user/unbind)接口, agentId:{}, openId:{}, unbindFlag:{}", agentId, openId, unbindFlag);
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return ApiResult.createFailure();
+        }
+
+        final String[] unbindFlags = {"1", "2", "3"};
+        if (StringUtils.isBlank(unbindFlag) || !ArrayUtils.contains(unbindFlags, unbindFlag)) {
+            LOG.info("unbindFlag值非法, unbindFloag:{}", unbindFlag);
+            return ApiResult.createFailure();
+        }
+
+        try {
+            boolean unbindResult = userService.unbindUser(agentId, openId, unbindFlag);
+            ApiResult apiResult = unbindResult ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用绑定用户(/user/unbind)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用解绑用户(/user/unbind)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 412 - 0
wjj-api/src/main/java/com/demo/wjj/controller/WeChatController.java

@@ -0,0 +1,412 @@
+package com.demo.wjj.controller;
+
+import com.demo.wjj.bo.AuthorizationUrlBo;
+import com.demo.wjj.bo.CallbackTicketBo;
+import com.demo.wjj.bo.DisplaceDetailBo;
+import com.demo.wjj.bo.SaveDisplaceBo;
+import com.demo.wjj.po.Agent;
+import com.demo.wjj.po.Sale;
+import com.demo.wjj.service.*;
+import com.demo.wjj.utils.ApiResult;
+import com.demo.wjj.utils.wechat.AesException;
+import org.apache.commons.lang3.StringUtils;
+import org.dom4j.DocumentException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 微信api
+ * @author wangqing
+ * @date 2019.01.30
+ */
+@RestController
+@RequestMapping("/wechat")
+public class WeChatController {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private WeChatService weChatService;
+
+    @Autowired
+    private WeiXinMessageService weiXinMessageService;
+
+    @Autowired
+    private AgentService agentService;
+
+    @Autowired
+    private SaleService saleService;
+
+    @Autowired
+    private DiggerAgentDisplaceManageService diggerAgentDisplaceManageService;
+
+    private String appId = "wx94660c86d38f6bc3";
+
+    @RequestMapping("/auth/callback")
+    public String ticketCallback(@RequestBody String xml, @RequestParam(name = "msg_signature", required = false) String msgSignature,
+                                 @RequestParam(name = "timestamp", required = false) String timestamp,
+                                 @RequestParam(name = "nonce", required = false) String nonce) {
+        LOG.info("调用第三方平台授权票据回调(/wechat/auth/callback)接口, xml:{}, msgSignature:{}, timestamp:{}, nonce:{}", xml, msgSignature, timestamp, nonce);
+
+        if (StringUtils.isBlank(xml)) {
+            LOG.info("第三方平台授权票据回调xml为空");
+            return "error";
+        }
+
+        if (StringUtils.isBlank(msgSignature)) {
+            LOG.info("第三方平台授权票据回调msg_signature为空");
+            return "error";
+        }
+
+        if (StringUtils.isBlank(timestamp)) {
+            LOG.info("第三方平台授权票据回调timestamp为空");
+            return "error";
+        }
+
+        if (StringUtils.isBlank(nonce)) {
+            LOG.info("第三方平台授权票据回调nonce为空");
+            return "error";
+        }
+
+        CallbackTicketBo callbackTicketBo = new CallbackTicketBo();
+        callbackTicketBo.setMsgSignature(msgSignature);
+        callbackTicketBo.setTimestamp(timestamp);
+        callbackTicketBo.setNonce(nonce);
+        callbackTicketBo.setPostdata(xml);
+
+        try {
+            final boolean parseResult = weChatService.parseCallbackTicket(callbackTicketBo);
+            LOG.info("解析第三方平台授权回调票据结果:{}", parseResult);
+            return parseResult ? "success" : "error";
+        } catch (AesException e) {
+            LOG.error("解密第三方平台授权回调票据异常", e);
+            return "error";
+        } catch (DocumentException e) {
+            LOG.error("解析第三方平台授权回调票据异常", e);
+            return "error";
+        }
+    }
+
+    @RequestMapping("/event/{appId}/callback")
+    public String eventCallback(@PathVariable String appId) {
+        return "success";
+    }
+
+    @RequestMapping("/createAuthorizationUrl")
+    public ApiResult createAuthorizationUrl(@RequestParam String authType) {
+        LOG.info("调用创建微信第三方平台授权url(/wechat/createAuthorizationUrl)接口, autuType:{}", authType);
+        final AuthorizationUrlBo authorizationUrlBo = new AuthorizationUrlBo();
+        authorizationUrlBo.setAuthType(authType);
+        try {
+            final String url = weChatService.generateAuthorizationUrl(authorizationUrlBo);
+            final ApiResult apiResult = ApiResult.createSuccess(url);
+            LOG.info("调用创建微信第三方平台授权url(/wechat/createAuthorizationUrl)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用创建微信第三方平台授权url(/wechat/createAuthorizationUrl)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @RequestMapping(value = "/authorization/code/callback", produces = "application/json;charset=utf-8")
+    public String codeCallback(@RequestParam(name = "auth_code") String authCode, @RequestParam String id) {
+        LOG.info("调用第三方平台授权回调(/authorization/code/callback)接口, authCode:{}", authCode);
+        try {
+            final boolean result = weChatService.resolveCallbackAuthorization(authCode, id, "1");
+            LOG.info("调用第三方平台授权回调(/authorization/code/callback)接口成功, result:{}", result);
+            return result ? "授权成功" : "授权失败";
+        } catch (Exception e) {
+            LOG.error("调用第三方平台授权回调(/authorization/code/callback)接口异常");
+            return "授权失败";
+        }
+    }
+
+    @RequestMapping(value = "/authorization/code/xcx/callback", produces = "application/json;charset=utf-8")
+    public String xcxCodeCallback(@RequestParam(name = "auth_code") String authCode, @RequestParam String id) {
+        LOG.info("调用第三方平台小程序授权回调(/authorization/code/callback)接口, authCode:{}", authCode);
+        try {
+            final boolean result = weChatService.resolveCallbackAuthorization(authCode, id, "2");
+            LOG.info("调用第三方平台小程序授权回调(/authorization/code/callback)接口成功, result:{}", result);
+            return result ? "授权成功" : "授权失败";
+        } catch (Exception e) {
+            LOG.error("调用第三方平台小程序授权回调(/authorization/code/callback)接口异常");
+            return "授权失败";
+        }
+    }
+
+    @RequestMapping("/getMenus")
+    public ApiResult getMenus(@RequestParam String authorizationAppId) {
+        LOG.info("调用获取公众号菜单(/wechat/getMenus)接口, authorizationAppId:{}", authorizationAppId);
+
+        if (StringUtils.isBlank(authorizationAppId)) {
+            LOG.info("授权方appId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final String menus = weChatService.getMenus(authorizationAppId);
+            ApiResult apiResult;
+            if (StringUtils.isBlank(menus)) {
+                apiResult = ApiResult.createFailure();
+            } else {
+                apiResult = ApiResult.createSuccess(menus);
+            }
+            LOG.info("调用获取公众号菜单(/wechat/getMenus)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取公众号菜单(/wechat/getMenus)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/deleteMenus")
+    public ApiResult deleteMenus(@RequestParam String authorizationAppId) {
+        LOG.info("调用删除公众号菜单(/wechat/deleteMenus)接口, authorizationAppId:{}", authorizationAppId);
+
+        if (StringUtils.isBlank(authorizationAppId)) {
+            LOG.info("授权方appId为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final String menus = weChatService.deleteMenus(authorizationAppId);
+            ApiResult apiResult;
+            if (menus == null) {
+                apiResult = ApiResult.createFailure();
+            } else {
+                apiResult = ApiResult.createSuccess(menus);
+            }
+            LOG.info("调用删除公众号菜单(/wechat/deleteMenus)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用删除公众号菜单(/wechat/deleteMenus)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/createMenus")
+    public ApiResult createMenus(@RequestParam String authorizationAppId, @RequestParam String menusJson) {
+        LOG.info("调用创建公众号菜单(/wechat/createMenus)接口, authorizationAppId:{}, menusJson:{}", authorizationAppId, menusJson);
+
+        if (StringUtils.isBlank(authorizationAppId)) {
+            LOG.info("授权方appId为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(menusJson)) {
+            LOG.info("菜单内容为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final String menus = weChatService.createMenus(authorizationAppId, menusJson);
+            ApiResult apiResult;
+            if (menus == null) {
+                apiResult = ApiResult.createFailure();
+            } else {
+                apiResult = ApiResult.createSuccess(menus);
+            }
+            LOG.info("调用创建公众号菜单(/wechat/createMenus)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用创建公众号菜单(/wechat/createMenus)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/pushDisplaceAuditMessage")
+    public ApiResult pushDisplaceAuditMessage(String agentId, String saleId, String displaceId) {
+        LOG.info("调用发送置换设备审核推送消息(/wechat/pushDisplaceAuditMessage)接口, agentId:{}, saleId:{}, displaceId:{}", agentId, saleId, displaceId);
+        final Agent agent = agentService.getAgent(agentId);
+        if (agent == null) {
+            final ApiResult apiResult = ApiResult.createFailure();
+            apiResult.setMessage("未查询到商家信息");
+            return apiResult;
+        }
+
+        final Sale sale = saleService.getSale(saleId);
+        if (sale == null) {
+            final ApiResult apiResult = ApiResult.createFailure();
+            apiResult.setMessage("未查询到销售员信息");
+            return apiResult;
+        }
+
+        final DisplaceDetailBo displaceDetailBo = diggerAgentDisplaceManageService.queryDetails(displaceId);
+        if (displaceDetailBo == null) {
+            final ApiResult apiResult = ApiResult.createFailure();
+            apiResult.setMessage("未查询到置换设备信息");
+            return apiResult;
+        }
+
+        SaveDisplaceBo saveDisplaceBo = new SaveDisplaceBo();
+        saveDisplaceBo.setBrand(displaceDetailBo.getBrand());
+        saveDisplaceBo.setModel(displaceDetailBo.getModel());
+        saveDisplaceBo.setDeviceType(displaceDetailBo.getDeviceType());
+        try {
+            final boolean result = weiXinMessageService.send(agent, sale, saveDisplaceBo);
+            final ApiResult apiResult = result ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用发送置换设备审核推送消息(/wechat/pushDisplaceAuditMessage)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用发送置换设备审核推送消息(/wechat/pushDisplaceAuditMessage)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 推送待上架审核消息
+     * @param id 置换id
+     * @return
+     */
+    @PostMapping("/pushWaitShelvesMessage")
+    public ApiResult pushWaitShelvesMessage(@RequestParam String id, @RequestParam String displaceId) {
+        LOG.info("调用发送待上架微信消息(/pushWaitShelvesMessage)接口, id:{}, displaceId:{}", id, displaceId);
+
+        if (StringUtils.isBlank(id)) {
+            LOG.info("置换id为空");
+            return ApiResult.createFailure();
+        }
+
+        if (StringUtils.isBlank(displaceId)) {
+            LOG.info("置换id为空");
+            return ApiResult.createFailure();
+        }
+
+        try {
+            final boolean result = weChatService.pushWaitShelvesMessage(id, displaceId);
+            final ApiResult apiResult = result ? ApiResult.createSuccess(null) : ApiResult.createFailure();
+            LOG.info("调用发送待上架微信消息(/pushWaitShelvesMessage)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用发送待上架微信消息(/pushWaitShelvesMessage)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    /**
+     * 获取微信公共模板id
+     * @param id
+     * @param templateName
+     * @return
+     */
+    @RequestMapping(value = "/getTemplateId", method = RequestMethod.POST)
+    public ApiResult getTemplateId(@RequestParam String id, @RequestParam String templateName) {
+        LOG.info("调用获取微信推送模板(/wechat/getTemplateId)接口, id:{}, templateName:{}", id, templateName);
+        try {
+            final Map<String, String> template = weChatService.getTemplate(id, templateName);
+            ApiResult apiResult;
+            if (template == null) {
+                apiResult = ApiResult.createFailure();
+            } else {
+                apiResult = ApiResult.createSuccess(template);
+            }
+            LOG.info("调用获取微信推送模板(/wechat/getTemplateId)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.info("调用获取微信推送模板(/wechat/getTemplateId)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/uploadCode")
+    public ApiResult uploadCode(@RequestParam String authorizationAppId) {
+        LOG.info("调用上传小程序代码(/wechat/uploadCode)接口, authorizationAppId:{}", authorizationAppId);
+
+        try {
+            final String content = weChatService.uploadCode(authorizationAppId);
+            final ApiResult<String> apiResult = ApiResult.createSuccess(content);
+            LOG.info("调用上传小程序代码(/wechat/uploadCode)成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用上传小程序代码(/wechat/uploadCode)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/getCategory")
+    public ApiResult getCategory(@RequestParam String authorizationAppId) {
+        LOG.info("调用获取小程序已设置类目(/wechat/getCategory)接口, authorizationAppId:{}", authorizationAppId);
+
+        try {
+            final String category = weChatService.getCategory(authorizationAppId);
+            ApiResult apiResult = ApiResult.createSuccess(category);
+            LOG.info("调用获取小程序已设置类目(/wechat/getCategory)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取小程序已设置类目(/wechat/getCategory)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/getPages")
+    public ApiResult getPages(@RequestParam String authorizationAppId) {
+        LOG.info("调用获取小程序pages(/wechat/getPages)接口, authorizationAppId:{}", authorizationAppId);
+        try {
+            final String pages = weChatService.getPages(authorizationAppId);
+            final ApiResult<String> apiResult = ApiResult.createSuccess(pages);
+            LOG.info("调用获取小程序pages(/wechat/getPages)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取小程序pages(/wechat/getPages)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/submitAudit")
+    public ApiResult submitAudit(@RequestParam String authorizationAppId, @RequestParam String json) {
+        LOG.info("调用获取小程序提交审核(/wechat/submitAudit)接口, authorizationAppId:{}, json:{}", authorizationAppId, json);
+
+        try {
+            final String submitAudit = weChatService.submitAudit(authorizationAppId, json);
+            final ApiResult<String> apiResult = ApiResult.createSuccess(submitAudit);
+            LOG.info("调用获取小程序提交审核(/wechat/submitAudit)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取小程序提交审核(/wechat/submitAudit)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/publishCode")
+    public ApiResult submitAudit(@RequestParam String authorizationAppId) {
+        LOG.info("调用发布小程序(/wechat/publishCode)接口, authorizationAppId:{}", authorizationAppId);
+
+        try {
+            final String submitAudit = weChatService.publishCode(authorizationAppId);
+            final ApiResult<String> apiResult = ApiResult.createSuccess(submitAudit);
+            LOG.info("调用调用发布小程序(/wechat/publishCode)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用发布小程序(/wechat/publishCode)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
+    @PostMapping("/getToken")
+    public ApiResult getToken() {
+        LOG.info("调用获取第三方平台token(/wechat/getToken)接口, appId:{}", appId);
+        Map<String, String> tokenMap = new HashMap<>();
+        try {
+            final String token = weChatService.getToken(appId);
+            ApiResult apiResult;
+            if (token == null) {
+                LOG.info("调用获取第三方平台token,缓存中的token为空");
+                apiResult = ApiResult.createFailure();
+            } else {
+                tokenMap.put("appId", appId);
+                tokenMap.put("token", token);
+                apiResult = ApiResult.createSuccess(tokenMap);
+            }
+            LOG.info("调用获取第三方平台token(/wechat/getToken)接口成功, apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取第三方平台token(/wechat/getToken)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+}

+ 16 - 0
wjj-api/src/main/java/com/demo/wjj/converter/BaseConverter.java

@@ -0,0 +1,16 @@
+package com.demo.wjj.converter;
+
+/**
+ * 转换器
+ * @author wangqing
+ * @date 2018.11.10
+ */
+public interface BaseConverter<T, K> {
+
+    /**
+     * 转换
+     * @param source 源对象
+     * @return 目标对象
+     */
+    K convert(T source);
+}

+ 27 - 0
wjj-api/src/main/java/com/demo/wjj/converter/SaveDiggerOfferConverter.java

@@ -0,0 +1,27 @@
+package com.demo.wjj.converter;
+
+import com.demo.wjj.bo.DiggerOfferSaveBo;
+import com.demo.wjj.qo.SaveDiggerOfferQo;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangqing
+ * @date 2018.11.20
+ */
+@Component
+public class SaveDiggerOfferConverter implements BaseConverter<SaveDiggerOfferQo, DiggerOfferSaveBo> {
+
+    @Override
+    public DiggerOfferSaveBo convert(SaveDiggerOfferQo source) {
+        DiggerOfferSaveBo diggerOfferSaveBo = new DiggerOfferSaveBo();
+
+        diggerOfferSaveBo.setAgentId(source.getAgentId());
+        diggerOfferSaveBo.setOpenId(source.getOpenId());
+        diggerOfferSaveBo.setDisplaceId(source.getDisplaceId());
+        diggerOfferSaveBo.setOrderNo(source.getOrderNo());
+        diggerOfferSaveBo.setPrice(Double.parseDouble(source.getPrice()));
+        diggerOfferSaveBo.setWatchLocate(source.getWatchLocate());
+
+        return diggerOfferSaveBo;
+    }
+}

+ 58 - 0
wjj-api/src/main/java/com/demo/wjj/converter/SaveDisplaceConverter.java

@@ -0,0 +1,58 @@
+package com.demo.wjj.converter;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import com.demo.wjj.bo.SaveDisplaceBo;
+import com.demo.wjj.mapper.TbImgItemMapper;
+import com.demo.wjj.po.TbImgItem;
+import com.demo.wjj.qo.SaveDisplaceQo;
+import com.demo.wjj.utils.IntegerUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author wangqing
+ * @date 2018.11.13
+ */
+@Component
+public class SaveDisplaceConverter implements BaseConverter<SaveDisplaceQo, SaveDisplaceBo> {
+
+
+    @Autowired
+    private TbImgItemMapper tbImgItemMapper;
+
+    @Override
+    public SaveDisplaceBo convert(SaveDisplaceQo source) {
+        SaveDisplaceBo saveDisplaceBo = new SaveDisplaceBo();
+
+        saveDisplaceBo.setDisplaceId(source.getDisplaceId());
+        saveDisplaceBo.setAgentId(source.getAgentId());
+        saveDisplaceBo.setOpenId(source.getOpenId());
+        saveDisplaceBo.setBrand(source.getBrand());
+        saveDisplaceBo.setModel(source.getModel());
+        saveDisplaceBo.setHours(source.getHours());
+        saveDisplaceBo.setYearMonth(source.getYearMonth());
+        saveDisplaceBo.setProvinceId(IntegerUtils.toInt(source.getProvinceId()));
+        saveDisplaceBo.setCityId(IntegerUtils.toInt(source.getCityId()));
+        saveDisplaceBo.setCountyId(IntegerUtils.toInt(source.getCountyId()));
+        saveDisplaceBo.setDeviceType(source.getDeviceType());
+        saveDisplaceBo.setConfig(source.getConfig());
+        saveDisplaceBo.setJobResume(source.getJobResume());
+        saveDisplaceBo.setTicket(source.getTicket());
+        /* 取消手机号和姓名
+        saveDisplaceBo.setMobile(source.getMobile());
+        saveDisplaceBo.setUsername(source.getName());
+        */
+        saveDisplaceBo.setOther(source.getOther());
+        saveDisplaceBo.setPrice(source.getPrice());
+        //图片解析存储
+        List<SaveDisplaceBo.DisplaceImageList> displaceImageLists = JSON.parseObject(source.getPicture(), new TypeReference<List<SaveDisplaceBo.DisplaceImageList>>() {
+        });
+        saveDisplaceBo.setPicture(displaceImageLists);
+        return saveDisplaceBo;
+    }
+}

+ 34 - 0
wjj-api/src/main/java/com/demo/wjj/converter/SaveOfferUserConverter.java

@@ -0,0 +1,34 @@
+package com.demo.wjj.converter;
+
+import com.demo.wjj.bo.SaveOfferUserBo;
+import com.demo.wjj.qo.SaveOfferUserQo;
+import com.demo.wjj.utils.IntegerUtils;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+@Component
+public class SaveOfferUserConverter implements BaseConverter<SaveOfferUserQo, SaveOfferUserBo> {
+
+    @Override
+    public SaveOfferUserBo convert(SaveOfferUserQo source) {
+
+        SaveOfferUserBo saveOfferUserBo = new SaveOfferUserBo();
+
+        if (source == null) {
+            return saveOfferUserBo;
+        }
+
+        saveOfferUserBo.setAgentId(source.getAgentId());
+        saveOfferUserBo.setDisplaceId(source.getDisplaceId());
+        saveOfferUserBo.setMobile(source.getMobile());
+        saveOfferUserBo.setName(source.getName());
+        saveOfferUserBo.setOpenId(source.getOpenId());
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        saveOfferUserBo.setTp(IntegerUtils.toInt(source.getTp()));
+        */
+        return saveOfferUserBo;
+    }
+}

+ 44 - 0
wjj-api/src/main/java/com/demo/wjj/converter/UserRegisterConverter.java

@@ -0,0 +1,44 @@
+package com.demo.wjj.converter;
+
+import com.demo.wjj.bo.UserRegisterBo;
+import com.demo.wjj.qo.UserRegisterQo;
+import com.demo.wjj.utils.IntegerUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangqing
+ * @date 2018.11.10
+ */
+@Component
+public class UserRegisterConverter implements BaseConverter<UserRegisterQo, UserRegisterBo> {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public UserRegisterBo convert(UserRegisterQo source) {
+        LOG.debug("进入转换, source:{}", source);
+        if (source == null) {
+            LOG.debug("源对象为空");
+            return null;
+        }
+
+        UserRegisterBo userRegisterBo = new UserRegisterBo();
+        userRegisterBo.setMobile(source.getMobile());
+        userRegisterBo.setName(source.getName());
+        userRegisterBo.setRole(Integer.parseInt(source.getRole()));
+        userRegisterBo.setBrandId(source.getBrandId());
+        if ((UserRegisterQo.ROLE_SALE + "").equals(source.getRole())) {
+            userRegisterBo.setProvinceId(IntegerUtils.toInt(source.getProvinceId()));
+            userRegisterBo.setCityId(IntegerUtils.toInt(source.getCityId()));
+            userRegisterBo.setCountyId(IntegerUtils.toInt(source.getCountyId()));
+        }
+        userRegisterBo.setCode(source.getCode());
+        userRegisterBo.setOpenId(source.getOpenId());
+        userRegisterBo.setAgentId(source.getAgentId());
+        userRegisterBo.setNickname(source.getNickname());
+
+        return userRegisterBo;
+    }
+}

+ 44 - 0
wjj-api/src/main/java/com/demo/wjj/filter/LogFilter.java

@@ -0,0 +1,44 @@
+package com.demo.wjj.filter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+import javax.servlet.*;
+import java.io.IOException;
+import java.util.UUID;
+
+/**
+ * 日志filter
+ * @author wangqing
+ * @date 2018.11.07
+ */
+public class LogFilter implements Filter {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public void init(FilterConfig filterConfig) {
+        LOG.info("log filter init.");
+    }
+
+    @Override
+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
+        final String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+
+        final String uniqueKey = "uk";
+        try {
+            int uuidLength = uuid.length();
+            MDC.put(uniqueKey, uuid.substring(uuidLength - 8, uuidLength));
+
+            filterChain.doFilter(servletRequest, servletResponse);
+        } finally {
+            MDC.remove(uniqueKey);
+        }
+    }
+
+    @Override
+    public void destroy() {
+        LOG.info("log filter destroy.");
+    }
+}

+ 75 - 0
wjj-api/src/main/java/com/demo/wjj/qo/SaveDiggerOfferQo.java

@@ -0,0 +1,75 @@
+package com.demo.wjj.qo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * @author wangqing
+ * @date 2018.11.20
+ */
+public class SaveDiggerOfferQo {
+
+    private String agentId;
+
+    private String openId;
+
+    private String displaceId;
+
+    private String orderNo;
+
+    private String price;
+
+    private String watchLocate;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getPrice() {
+        return price;
+    }
+
+    public void setPrice(String price) {
+        this.price = price;
+    }
+
+    public String getWatchLocate() {
+        return watchLocate;
+    }
+
+    public void setWatchLocate(String watchLocate) {
+        this.watchLocate = watchLocate;
+    }
+}

+ 264 - 0
wjj-api/src/main/java/com/demo/wjj/qo/SaveDisplaceQo.java

@@ -0,0 +1,264 @@
+package com.demo.wjj.qo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 保存置换
+ * @author wangqing
+ * @date 2018.11.12
+ */
+public class SaveDisplaceQo {
+
+    /**
+     * 置换id
+     */
+    private String displaceId;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 微信openId
+     */
+    private String openId;
+
+    /**
+     * 品牌
+     */
+    private String brand;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 小时数
+     */
+    private String hours;
+
+    /**
+     * 出厂年份
+     */
+    private String yearMonth;
+
+    /**
+     * 省份id
+     */
+    private String provinceId;
+
+    /**
+     * 地市id
+     */
+    private String cityId;
+
+    /**
+     * 区县id
+     */
+    private String countyId;
+
+    /**
+     * 设备类型
+     */
+    private String deviceType;
+
+    /**
+     * 配置说明
+     */
+    private String config;
+
+    /**
+     * 作业履历
+     */
+    private String jobResume;
+
+    /**
+     * 票证说明
+     */
+    private String ticket;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 其他说明
+     */
+    private String other;
+
+    /**
+     * 理想价位
+     */
+    private String price;
+
+    /**
+     * 置换图片
+     * <p>[{"code": "xxx", "id":"xx" , "pic": []}, {"code": "yyy", "id":"yy" ,"pic": []}]</p>
+     */
+    private String picture;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getHours() {
+        return hours;
+    }
+
+    public void setHours(String hours) {
+        this.hours = hours;
+    }
+
+    public String getYearMonth() {
+        return yearMonth;
+    }
+
+    public void setYearMonth(String yearMonth) {
+        this.yearMonth = yearMonth;
+    }
+
+    public String getProvinceId() {
+        return provinceId;
+    }
+
+    public void setProvinceId(String provinceId) {
+        this.provinceId = provinceId;
+    }
+
+    public String getCityId() {
+        return cityId;
+    }
+
+    public void setCityId(String cityId) {
+        this.cityId = cityId;
+    }
+
+    public String getCountyId() {
+        return countyId;
+    }
+
+    public void setCountyId(String countyId) {
+        this.countyId = countyId;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getConfig() {
+        return config;
+    }
+
+    public void setConfig(String config) {
+        this.config = config;
+    }
+
+    public String getJobResume() {
+        return jobResume;
+    }
+
+    public void setJobResume(String jobResume) {
+        this.jobResume = jobResume;
+    }
+
+    public String getTicket() {
+        return ticket;
+    }
+
+    public void setTicket(String ticket) {
+        this.ticket = ticket;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOther() {
+        return other;
+    }
+
+    public void setOther(String other) {
+        this.other = other;
+    }
+
+    public String getPrice() {
+        return price;
+    }
+
+    public void setPrice(String price) {
+        this.price = price;
+    }
+
+    public String getPicture() {
+        return picture;
+    }
+
+    public void setPicture(String picture) {
+        this.picture = picture;
+    }
+}

+ 77 - 0
wjj-api/src/main/java/com/demo/wjj/qo/SaveOfferUserQo.java

@@ -0,0 +1,77 @@
+package com.demo.wjj.qo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+public class SaveOfferUserQo {
+
+    private String displaceId;
+
+    private String openId;
+
+    private String agentId;
+
+    private String mobile;
+
+    private String name;
+
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    private String tp;
+    */
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    public String getTp() {
+        return tp;
+    }
+
+    public void setTp(String tp) {
+        this.tp = tp;
+    }*/
+}

+ 169 - 0
wjj-api/src/main/java/com/demo/wjj/qo/UserRegisterQo.java

@@ -0,0 +1,169 @@
+package com.demo.wjj.qo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 用户注册
+ * @author wangqing
+ * @date 2018.11.10
+ */
+public class UserRegisterQo {
+
+    /**
+     * 角色 - 销售员
+     */
+    public static final int ROLE_SALE = 1;
+
+    /**
+     * 角色 - 车商
+     */
+    public static final int ROLE_DIGGER_AGENT = 2;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 角色
+     */
+    private String role;
+
+    /**
+     * 品牌id,多个用逗号隔开
+     */
+    private String brandId;
+
+    /**
+     * 省份id
+     */
+    private String provinceId;
+
+    /**
+     * 地市id
+     */
+    private String cityId;
+
+    /**
+     * 区县id
+     */
+    private String countyId;
+
+    /**
+     * 短信验证码
+     */
+    private String code;
+
+    /**
+     * 微信openId
+     */
+    private String openId;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 微信用户昵称
+     */
+    private String nickname;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getRole() {
+        return role;
+    }
+
+    public void setRole(String role) {
+        this.role = role;
+    }
+
+    public String getBrandId() {
+        return brandId;
+    }
+
+    public void setBrandId(String brandId) {
+        this.brandId = brandId;
+    }
+
+    public String getProvinceId() {
+        return provinceId;
+    }
+
+    public void setProvinceId(String provinceId) {
+        this.provinceId = provinceId;
+    }
+
+    public String getCityId() {
+        return cityId;
+    }
+
+    public void setCityId(String cityId) {
+        this.cityId = cityId;
+    }
+
+    public String getCountyId() {
+        return countyId;
+    }
+
+    public void setCountyId(String countyId) {
+        this.countyId = countyId;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+}

+ 17 - 0
wjj-api/src/main/java/com/demo/wjj/service/ResourceService.java

@@ -0,0 +1,17 @@
+package com.demo.wjj.service;
+
+/**
+ * @author wangqing
+ * @date 2018.12.20
+ */
+public interface ResourceService {
+
+    /**
+     * 上传资源
+     * @param agentId 商家id
+     * @param openId openId
+     * @param serverId serverId
+     * @return 上传后的资源key
+     */
+    String upload(String agentId, String openId, String serverId);
+}

+ 112 - 0
wjj-api/src/main/java/com/demo/wjj/service/impl/ResourceServiceImpl.java

@@ -0,0 +1,112 @@
+package com.demo.wjj.service.impl;
+
+import com.demo.wjj.bo.QiNiuUploadResult;
+import com.demo.wjj.po.Agent;
+import com.demo.wjj.service.*;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author wangqing
+ * @date 2018.12.20
+ */
+@Service
+public class ResourceServiceImpl implements ResourceService {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private WeiXinResourceService weiXinResourceService;
+
+    @Autowired
+    private QiNiuService qiNiuService;
+
+    @Autowired
+    private AgentService agentService;
+
+    @Autowired
+    private SaleService saleService;
+
+    @Override
+    public String upload(String agentId, String openId, String serverId) {
+        LOG.info("进入上传资源, agentId:{}, openId:{}, serverId:{}");
+
+        if (StringUtils.isBlank(agentId)) {
+            LOG.info("agentId为空");
+            return null;
+        }
+
+        if (StringUtils.isBlank(openId)) {
+            LOG.info("openId为空");
+            return null;
+        }
+
+        if (StringUtils.isBlank(serverId)) {
+            LOG.info("serverId为空");
+            return null;
+        }
+
+        final Agent agent = agentService.getAgent(agentId);
+        if (agent == null) {
+            LOG.info("未查找到商家信息, agentId:{}", agentId);
+            return null;
+        }
+
+        final boolean existsOpenId = saleService.existsOpenId(agentId, openId);
+        if (!existsOpenId) {
+            LOG.info("未查找到销售员, agentId:{}, openId:{}", agentId, openId);
+            return null;
+        }
+
+        final String appId = agent.getAppId();
+        if (StringUtils.isBlank(appId)) {
+            LOG.info("商家appId为空");
+            return null;
+        }
+
+        final String appSecret = agent.getAppSecret();
+        /*
+        if (StringUtils.isBlank(appSecret)) {
+            LOG.info("商家appSecret为空");
+            return null;
+        }
+         */
+
+        final byte[] resource = weiXinResourceService.getResource(serverId, appId, appSecret);
+        if (ArrayUtils.isEmpty(resource)) {
+            LOG.info("请求微信获取资源失败");
+            return null;
+        }
+
+        InputStream inputStream = new ByteArrayInputStream(resource);
+        final QiNiuUploadResult uploadResult;
+        try {
+            uploadResult = qiNiuService.upload(inputStream);
+        } catch (Exception e) {
+            LOG.error("上传资源至七牛异常", e);
+            return null;
+        } finally {
+            try {
+                inputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        if (uploadResult == null) {
+            LOG.info("上传资源至七牛失败");
+            return null;
+        }
+
+        final String key = uploadResult.getKey();
+        LOG.info("退出上传资源, 资源key:{}", key);
+        return key;
+    }
+}

+ 75 - 0
wjj-api/src/main/java/com/demo/wjj/validator/SaveDiggerOfferValidator.java

@@ -0,0 +1,75 @@
+package com.demo.wjj.validator;
+
+import com.demo.wjj.qo.SaveDiggerOfferQo;
+import com.demo.wjj.qo.SaveDisplaceQo;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.Errors;
+import org.springframework.validation.ObjectError;
+import org.springframework.validation.Validator;
+
+import java.util.List;
+
+/**
+ * @author wangqing
+ * @date 2018.11.20
+ */
+@Component
+public class SaveDiggerOfferValidator implements Validator {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return SaveDisplaceQo.class == aClass;
+    }
+
+    @Override
+    public void validate(Object o, Errors errors) {
+        List<ObjectError> allErrors = errors.getAllErrors();
+        if (CollectionUtils.isNotEmpty(allErrors)) {
+            for (ObjectError error : allErrors) {
+                LOG.warn("{}:{}", error.getObjectName(), error.getDefaultMessage());
+                return;
+            }
+        }
+
+        SaveDiggerOfferQo query = (SaveDiggerOfferQo) o;
+
+        if (StringUtils.isBlank(query.getAgentId())) {
+            LOG.info("agentId为空");
+            errors.rejectValue("agentId", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getOpenId())) {
+            LOG.info("openId为空");
+            errors.rejectValue("openId", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getDisplaceId())) {
+            LOG.info("displaceId为空");
+            errors.rejectValue("displaceId", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getPrice()) || !NumberUtils.isCreatable(query.getPrice())) {
+            LOG.info("price值非法, price:{}", query.getPrice());
+            errors.rejectValue("price", "值非法");
+            return;
+        }
+
+        final String[] locates = {"1", "0"};
+        if (!ArrayUtils.contains(locates, query.getWatchLocate())) {
+            LOG.info("watchLocate值非法, watchLocate:{}", query.getWatchLocate());
+            errors.rejectValue("watchLocate", "值非法");
+            return;
+        }
+    }
+}

+ 140 - 0
wjj-api/src/main/java/com/demo/wjj/validator/SaveDisplaceQoValidator.java

@@ -0,0 +1,140 @@
+package com.demo.wjj.validator;
+
+import com.demo.wjj.qo.SaveDisplaceQo;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.Errors;
+import org.springframework.validation.ObjectError;
+import org.springframework.validation.Validator;
+
+import java.util.List;
+
+/**
+ * @author wangqing
+ * @date 2018.11.13
+ */
+@Component
+public class SaveDisplaceQoValidator implements Validator {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return SaveDisplaceQo.class == aClass;
+    }
+
+    @Override
+    public void validate(Object o, Errors errors) {
+
+        List<ObjectError> allErrors = errors.getAllErrors();
+        if (CollectionUtils.isNotEmpty(allErrors)) {
+            for (ObjectError error : allErrors) {
+                LOG.warn("{}:{}", error.getObjectName(), error.getDefaultMessage());
+                return;
+            }
+        }
+
+        SaveDisplaceQo query = (SaveDisplaceQo) o;
+
+        if (StringUtils.isBlank(query.getAgentId())) {
+            LOG.debug("商家id为空");
+            errors.rejectValue("brand", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getOpenId())) {
+            LOG.debug("微信openId为空");
+            errors.rejectValue("openId", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getBrand())) {
+            LOG.debug("品牌为空");
+            errors.rejectValue("brand", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getModel())) {
+            LOG.debug("型号为空");
+            errors.rejectValue("model", "值为空");
+            return;
+        }
+
+        final String hours = query.getHours();
+        if (StringUtils.isBlank(hours) || !NumberUtils.isCreatable(hours)) {
+            LOG.debug("小时数值非法, hours:{}", hours);
+            errors.rejectValue("hours", "值非法");
+            return;
+        }
+
+        String yearMonth = query.getYearMonth();
+        if (StringUtils.isBlank(yearMonth)) {
+            LOG.debug("出厂年份为空");
+            errors.rejectValue("yearMonth", "值为空");
+            return;
+        }
+
+        String provinceId = query.getProvinceId();
+        if (StringUtils.isBlank(provinceId) || !NumberUtils.isDigits(provinceId)) {
+            LOG.debug("省份id值非法");
+            errors.rejectValue("provinceId", "值非法");
+            return;
+        }
+
+        String cityId = query.getCityId();
+        if (StringUtils.isNotBlank(cityId) && !NumberUtils.isDigits(cityId)) {
+            LOG.debug("地市id值非法");
+            errors.rejectValue("cityId", "值非法");
+            return;
+        }
+        /* 区县非必填项
+        String countyId = query.getCountyId();
+        if (StringUtils.isBlank(countyId) || !NumberUtils.isDigits(countyId)) {
+            LOG.debug("区县id值非法");
+            errors.rejectValue("countyId", "值非法");
+            return;
+        }
+        */
+
+        if (StringUtils.isBlank(query.getDeviceType())) {
+            LOG.debug("设备类型为空");
+            errors.rejectValue("deviceType", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getConfig())) {
+            LOG.debug("配置说明为空");
+            errors.rejectValue("config", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getJobResume())) {
+            LOG.debug("作业履历为空");
+            errors.rejectValue("jobResult", "值为空");
+            return;
+        }
+        /** 取消手机号和姓名
+        if (StringUtils.isBlank(query.getMobile())) {
+            LOG.debug("手机号码为空");
+            errors.rejectValue("mobile", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getName())) {
+            LOG.debug("用户姓名为空");
+            errors.rejectValue("name", "值为空");
+            return;
+        }
+         */
+
+        if (StringUtils.isBlank(query.getPicture())) {
+            LOG.debug("置换图片为空");
+            errors.rejectValue("picture", "值为空");
+            return;
+        }
+    }
+}

+ 71 - 0
wjj-api/src/main/java/com/demo/wjj/validator/SaveOfferUserValidator.java

@@ -0,0 +1,71 @@
+package com.demo.wjj.validator;
+
+import com.demo.wjj.qo.SaveOfferUserQo;
+import com.demo.wjj.utils.PatternUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.Errors;
+import org.springframework.validation.Validator;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+@Component
+public class SaveOfferUserValidator implements Validator {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return SaveOfferUserQo.class == aClass;
+    }
+
+    @Override
+    public void validate(Object o, Errors errors) {
+        final SaveOfferUserQo query = (SaveOfferUserQo) o;
+
+        if (StringUtils.isBlank(query.getAgentId())) {
+            LOG.info("agentId为空");
+            errors.rejectValue("agentId", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getDisplaceId())) {
+            LOG.info("displaceId为空");
+            errors.rejectValue("displaceId", "值为空");
+            return;
+        }
+
+        final String mobile = query.getMobile();
+        if (!PatternUtils.isMobile(mobile)) {
+            LOG.info("mobile值非法, mobile:{}", mobile);
+            errors.rejectValue("mobile", "值非法");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getName())) {
+            LOG.info("name为空");
+            errors.rejectValue("name", "值为空");
+            return;
+        }
+
+        if (StringUtils.isBlank(query.getOpenId())) {
+            LOG.info("openId为空");
+            errors.rejectValue("openId", "值为空");
+            return;
+        }
+        /* 手机端用户不能设置通票 wangqing 201811302208
+        final String tp = query.getTp();
+        final String[] tps = {"1", "0"};
+        if (!ArrayUtils.contains(tps, tp)) {
+            LOG.info("tp值非法, tp:{}", tp);
+            errors.rejectValue("tp", "值非法");
+            return;
+        }*/
+
+    }
+}

+ 124 - 0
wjj-api/src/main/java/com/demo/wjj/validator/UserRegisterQoValidator.java

@@ -0,0 +1,124 @@
+package com.demo.wjj.validator;
+
+import com.demo.wjj.qo.UserRegisterQo;
+import com.demo.wjj.utils.PatternUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.Errors;
+import org.springframework.validation.ObjectError;
+import org.springframework.validation.Validator;
+
+import java.util.List;
+
+/**
+ * 用户注册验证器
+ * @author wangqing
+ * @date 2018.11.10
+ */
+@Component
+public class UserRegisterQoValidator implements Validator {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    private final String[] ROLES = {UserRegisterQo.ROLE_SALE + "", UserRegisterQo.ROLE_DIGGER_AGENT + ""};
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return aClass == UserRegisterQo.class;
+    }
+
+    @Override
+    public void validate(Object o, Errors errors) {
+        List<ObjectError> allErrors = errors.getAllErrors();
+        if (CollectionUtils.isNotEmpty(allErrors)) {
+            for (ObjectError error : allErrors) {
+                LOG.debug("{}:{}", error.getObjectName(), error.getDefaultMessage());
+            }
+        }
+
+        final UserRegisterQo query = (UserRegisterQo) o;
+        String mobile = query.getMobile();
+        if (StringUtils.isBlank(mobile) || !PatternUtils.isMobile(mobile)) {
+            LOG.debug("mobile值非法, mobile:{}", mobile);
+            errors.rejectValue("mobile", "值非法");
+            return;
+        }
+
+        String name = query.getName();
+        if (StringUtils.isBlank(name)) {
+            LOG.debug("name值为空");
+            errors.rejectValue("name", "值为空");
+            return;
+        }
+
+        String role = query.getRole();
+        if (!ArrayUtils.contains(ROLES, role)) {
+            LOG.debug("role值非法, role:{}", role);
+            errors.rejectValue("role", "值非法");
+            return;
+        }
+
+        String brandId = query.getBrandId();
+        if (StringUtils.isBlank(brandId)) {
+            LOG.debug("brandId值为空");
+            errors.rejectValue("brandId", "值为空");
+            return;
+        }
+
+        if ((UserRegisterQo.ROLE_SALE + "").equals(role)) {
+            String provinceId = query.getProvinceId();
+            if (StringUtils.isBlank(provinceId) || !NumberUtils.isDigits(provinceId)) {
+                LOG.debug("provinceId值非法, provinceId:{}", provinceId);
+                errors.rejectValue("provinceId", "值非法");
+                return;
+            }
+
+            String cityId = query.getCityId();
+            if (StringUtils.isNotBlank(cityId) && !NumberUtils.isDigits(cityId)) {
+                LOG.debug("cityId值非法, cityId:{}", cityId);
+                errors.rejectValue("cityId", "值非法");
+                return;
+            }
+
+            String countyId = query.getCountyId();
+            if (StringUtils.isNoneBlank(countyId) && !NumberUtils.isDigits(countyId)) {
+                LOG.debug("countyId值非法, countyId:{}", countyId);
+                errors.rejectValue("countyId", "值非法");
+                return;
+            }
+        }
+
+        String code = query.getCode();
+        if (StringUtils.isBlank(code)) {
+            LOG.debug("code值为空");
+            errors.rejectValue("code", "值为空");
+            return;
+        }
+
+        String openId = query.getOpenId();
+        if (StringUtils.isBlank(openId)) {
+            LOG.debug("openId值为空");
+            errors.rejectValue("openId", "值为空");
+            return;
+        }
+
+        String agentId = query.getAgentId();
+        if (StringUtils.isBlank(agentId)) {
+            LOG.debug("agentId值为空");
+            errors.rejectValue("agentId", "值为空");
+            return;
+        }
+
+        String nickname = query.getNickname();
+        if (StringUtils.isBlank(nickname)) {
+            LOG.debug("nickname值为空");
+            errors.rejectValue("nickname", "值为空");
+            return;
+        }
+    }
+}

+ 57 - 0
wjj-api/src/main/resources/META-INF/spring/applicationContext.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:c="http://www.springframework.org/schema/context"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:task="http://www.springframework.org/schema/task"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
+
+
+    <!--扫描组件-->
+    <c:component-scan base-package="com.demo.wjj.service"/>
+
+    <!--配置文件-->
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="locations">
+            <list>
+                <value>classpath:application.properties</value>
+                <value>classpath:jdbc.properties</value>
+            </list>
+        </property>
+    </bean>
+
+    <!--数据源-->
+    <bean id="datasource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
+        <property name="driverClassName" value="${jdbc.driverName}"/>
+        <property name="url" value="${jdbc.url}"/>
+        <property name="username" value="${jdbc.username}"/>
+        <property name="password" value="${jdbc.password}"/>
+    </bean>
+
+    <!--事务管理-->
+    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+        <property name="dataSource" ref="datasource"/>
+    </bean>
+
+    <tx:annotation-driven/>
+
+    <import resource="mybatis-beans.xml"/>
+
+    <!--短信发送服务-->
+    <bean id="smsSendService" class="com.demo.wjj.service.impl.SmsSendServiceImpl">
+        <property name="url" value="${sms.url}"/>
+        <property name="name" value="${sms.username}"/>
+        <property name="pwd" value="${sms.password}"/>
+        <property name="sign" value="${sms.code.sign}"/>
+    </bean>
+
+    <bean class="com.demo.wjj.service.impl.ValidateCodeServiceImpl">
+        <property name="smsSendService" ref="smsSendService"/>
+        <property name="template" value="${sms.code.template}"/>
+    </bean>
+
+    <!-- 定时任务 -->
+    <task:annotation-driven scheduler="qbScheduler" mode="proxy"/>
+    <task:scheduler id="qbScheduler" />
+
+</beans>

+ 23 - 0
wjj-api/src/main/resources/META-INF/spring/dispatcher.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+
+    <!--扫描组件-->
+    <context:component-scan base-package="com.demo.wjj.controller"/>
+    <context:component-scan base-package="com.demo.wjj.validator"/>
+    <context:component-scan base-package="com.demo.wjj.converter"/>
+
+    <mvc:annotation-driven>
+        <mvc:message-converters>
+            <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
+                <property name="supportedMediaTypes" value="application/json;charset=utf-8"/>
+            </bean>
+        </mvc:message-converters>
+    </mvc:annotation-driven>
+
+    <mvc:default-servlet-handler/>
+
+</beans>

+ 37 - 0
wjj-api/src/main/resources/META-INF/spring/mybatis-beans.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+
+    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
+        <property name="dataSource" ref="datasource" />
+        <property name="mapperLocations" value="classpath*:mybatis/*.xml" />
+        <property name="configurationProperties">
+            <props>
+                <prop key="cacheEnabled">false</prop>
+            </props>
+        </property>
+        <property name="plugins">
+            <array>
+                <bean class="com.github.pagehelper.PageInterceptor">
+                    <property name="properties">
+                        <value>helperDialect=mysql</value>
+                    </property>
+                </bean>
+            </array>
+        </property>
+    </bean>
+
+    <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
+        <constructor-arg index="0" ref="sqlSessionFactory" />
+    </bean>
+
+    <mvc:cors>
+        <mvc:mapping path="/**" allowed-origins="*" allow-credentials="true" max-age="1800"
+                     allowed-methods="GET,POST,PUT,DELETE,PATCH,OPTIONS"/>
+    </mvc:cors>
+
+    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
+        <property name="basePackage" value="com.demo.wjj.mapper" />
+    </bean>
+</beans>

+ 33 - 0
wjj-api/src/main/resources/application.properties

@@ -0,0 +1,33 @@
+sms.url=http://web.cr6868.com/asmx/smsservice.aspx
+sms.username=\u5fae\u5de5\u7a0b
+sms.password=CF7B4E72FF77F4FD3AEC67BF0E4C
+sms.code.template=\u3010\u65b0\u673a\u7f18\u3011\u9a8c\u8bc1\u7801\u007b\u0030\u007d\u662f\u60a8\u7684\u672c\u6b21\u5b89\u5168\u6821\u9a8c\u7801\uff0c\u6b22\u8fce\u60a8\u7684\u53c2\u4e0e\u3002
+sms.code.sign=\u65b0\u673a\u7f18
+
+weixin.pay.domain=https://www.xxinjiyuan.com/wjj-api
+weixin.pay.apiAddress=https://api.mch.weixin.qq.com/pay/unifiedorder
+
+qiniu.accessKey=CNbazhRMgyg91V_X9bqBtd42CSof0Cd6rGKPOzfp
+qiniu.secretKey=GGgIuGmnTRMJgWYJZz6SeX_vjRs9GNU0aU_4vNPo
+qiniu.bucket=weigongcheng
+qiniu.bucket.domain=http://tp.weigongcheng.net
+qiniu.expire=3600
+
+#置换审核域名
+displaceAuditHost=https://www.xxinjiyuan.com/agentPlat
+#等待审核通知
+displaceAuditTemplateName=\u7b49\u5f85\u5ba1\u6838\u901a\u77e5
+
+#平台可见agentId
+platformAgentId=XJY00
+
+platform.appId=wx94660c86d38f6bc3
+platform.appSecret=8fc0ecbbd87857cb08105c4183e84af4
+platform.token=BensF7xcrZBFnHOnSuAN
+platform.encodingAESKeying=U2LKKXBKNCeaWJURvo3z2Yh23HiwuE16BQLOYASKFdR
+
+#微信小程序所属公众号appId
+weixin.appId=wx0cb0cbc34027621f
+
+#第三方授权模板id
+weixin.templateId=2

+ 10 - 0
wjj-api/src/main/resources/jdbc.properties

@@ -0,0 +1,10 @@
+jdbc.driverName=com.mysql.jdbc.Driver
+#外网
+jdbc.url=jdbc:mysql://47.99.39.89:3306/agent_xinjiyuan?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
+jdbc.username=root
+jdbc.password=AgentWgc
+
+##测试环境
+#jdbc.url=jdbc:mysql://47.99.39.89:3306/agentNew?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
+#jdbc.username=root
+#jdbc.password=AgentWgc

+ 25 - 0
wjj-api/src/main/resources/logback.xml

@@ -0,0 +1,25 @@
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level uk:%X{uk} %logger{35} - %msg %n</pattern>
+        </encoder>
+    </appender>
+
+
+    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>/root/logs/wjj-api.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>50</maxHistory>
+                 </rollingPolicy>
+             
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level uk:%X{uk} %logger{35} - %msg %n</pattern>
+                 </encoder>
+    </appender>
+
+    <root level="DEBUG">
+        <appender-ref ref="FILE" />
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>

+ 30 - 0
wjj-api/src/test/java/com/demo/wjj/controller/AgentControllerTest.java

@@ -0,0 +1,30 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.17
+ */
+public class AgentControllerTest extends BaseTest {
+
+    @Test
+    public void getAgent() throws Exception {
+        mockMvc.perform(get("/agent/getAgent")
+                .param("agentId", "aaabbb"))
+                .andExpect(status().isOk());
+    }
+    @Test
+    public void sout(){
+        String str = "#123232#2323232#243434#2324";
+        List list = Arrays.asList(str.split("#"));
+        System.out.println(list.get(1));
+    }
+}

+ 31 - 0
wjj-api/src/test/java/com/demo/wjj/controller/BaseTest.java

@@ -0,0 +1,31 @@
+package com.demo.wjj.controller;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+/**
+ * @author wangqing
+ * @date 2018.11.08
+ */
+@RunWith(SpringRunner.class)
+@ContextConfiguration(locations = {"classpath:META-INF/spring/applicationContext.xml", "classpath:META-INF/spring/dispatcher.xml"})
+@WebAppConfiguration
+public class BaseTest {
+
+    @Autowired
+    protected WebApplicationContext context;
+
+    protected MockMvc mockMvc;
+
+    @Before
+    public void setup() {
+        this.mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
+    }
+}

+ 23 - 0
wjj-api/src/test/java/com/demo/wjj/controller/BrandControllerTest.java

@@ -0,0 +1,23 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.10
+ */
+public class BrandControllerTest extends BaseTest {
+
+    @Test
+    public void getBrands() throws Exception {
+        this.mockMvc.perform(get("/brand/getBrands"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(5))
+                .andExpect(jsonPath("$.data[0].name").value("斗山"))
+                .andExpect(jsonPath("$.data[0].id").value(1))
+                .andExpect(jsonPath("$.data[1].name").value("小松"));
+    }
+}

+ 24 - 0
wjj-api/src/test/java/com/demo/wjj/controller/DemoControllerTest.java

@@ -0,0 +1,24 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+import org.springframework.http.MediaType;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.08
+ */
+public class DemoControllerTest extends BaseTest {
+
+    @Test
+    public void testGet() throws Exception {
+        mockMvc.perform(get("/demo/get/1").accept(MediaType.APPLICATION_JSON_UTF8_VALUE))
+                .andExpect(status().isOk())
+                .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
+                .andExpect(jsonPath("$.code").value(1))
+                .andExpect(jsonPath("$.data.id").value(1));
+    }
+
+}

+ 44 - 0
wjj-api/src/test/java/com/demo/wjj/controller/DictionaryControllerTest.java

@@ -0,0 +1,44 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.11
+ */
+public class DictionaryControllerTest extends BaseTest {
+
+    @Test
+    public void queryDeviceType() throws Exception {
+        this.mockMvc.perform(get("/dic/getDeviceType"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(1))
+                .andExpect(jsonPath("$.data[0].code").value("DT01"))
+                .andExpect(jsonPath("$.data[0].name").value("挖掘机"));
+    }
+
+    @Test
+    public void queryConfigInstructions() throws Exception {
+        this.mockMvc.perform(get("/dic/getConfigInstructions"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(2))
+                .andExpect(jsonPath("$.data[0].code").value("CI01"))
+                .andExpect(jsonPath("$.data[0].name").value("铲斗"))
+                .andExpect(jsonPath("$.data[1].code").value("CI02"))
+                .andExpect(jsonPath("$.data[1].name").value("破碎锤"));
+    }
+
+    @Test
+    public void queryJobResume() throws Exception {
+        this.mockMvc.perform(get("/dic/getJobResume"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(2))
+                .andExpect(jsonPath("$.data[0].code").value("JR01"))
+                .andExpect(jsonPath("$.data[0].name").value("挖掘作业"))
+                .andExpect(jsonPath("$.data[1].code").value("JR02"))
+                .andExpect(jsonPath("$.data[1].name").value("破碎作业"));
+    }
+}

+ 57 - 0
wjj-api/src/test/java/com/demo/wjj/controller/DiggerAgentDisplaceControllerTest.java

@@ -0,0 +1,57 @@
+package com.demo.wjj.controller;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/**
+ * @author wangqing
+ * @date 2018.11.18
+ */
+public class DiggerAgentDisplaceControllerTest extends BaseTest {
+
+    private String agentId = "aaabbb";
+
+    private String openId = "opeonId";
+
+    @Ignore
+    @Test
+    public void queryWait() throws Exception {
+        mockMvc.perform(get("/diggerDisplace/queryWait")
+                .param("agentId", agentId)
+                .param("openId", openId))
+                .andExpect(status().isOk());
+    }
+
+    @Ignore
+    @Test
+    public void queryDoing() {
+    }
+
+    @Ignore
+    @Test
+    public void queryEnding() {
+    }
+
+    @Ignore
+    @Test
+    public void queryMy() {
+    }
+
+    @Ignore
+    @Test
+    public void queryDetails() throws Exception {
+        mockMvc.perform(get("/diggerDisplace/getDetails")
+                .param("id", "4553694c247a464f85db9ee82a519fdf"))
+                .andExpect(status().isOk());
+    }
+
+    @Test
+    public void queryOfferDetails() throws Exception {
+        mockMvc.perform(get("/diggerDisplace/getOfferDetails")
+                .param("id", "4553694c247a464f85db9ee82a519fdf")
+                .param("openId", "testOpenId"))
+                .andExpect(status().isOk());
+    }
+}

+ 76 - 0
wjj-api/src/test/java/com/demo/wjj/controller/DisplaceControllerTest.java

@@ -0,0 +1,76 @@
+package com.demo.wjj.controller;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.13
+ */
+public class DisplaceControllerTest extends BaseTest {
+
+    @Ignore
+    @Test
+    public void save() throws Exception {
+        this.mockMvc.perform(post("/displace/save")
+//                .param("displaceId", "232f3f9f226944a391ebf47e418b7025")
+                .param("agentId", "aaabbb")
+                .param("openId", "wxopenid")
+                .param("brand", "小松")
+                .param("model", "M-101")
+                .param("hours", "500")
+                .param("yearMonth", "2013年5月")
+                .param("provinceId", "1")
+                .param("cityId", "3")
+                .param("countyId", "8")
+                .param("deviceType", "DT01")
+                .param("config", "CI02")
+                .param("jobResume", "JR01")
+                .param("ticket", "1,2")
+                .param("mobile", "13695604981")
+                .param("name", "martin")
+                .param("other", "不包邮")
+                .param("picture", "[{'code': 'mechanical_nameplate', 'pic': ['http://www.baidu.com/1.jpg']}, {'code': 'machine_picture_side', 'pic': ['http://www.baidu.com/2.jpg']}]")
+        )
+            .andExpect(status().isOk())
+            .andExpect(jsonPath("$.code").value("1"));
+    }
+
+    @Ignore
+    @Test
+    public void queryUndoList() throws Exception {
+        mockMvc.perform(get("/displace/queryUndoList")
+                .param("agentId", "aaabbb")
+                .param("openId", "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"))
+                .andExpect(status().isOk());
+    }
+
+    @Ignore
+    @Test
+    public void queryDoneList() throws Exception {
+        mockMvc.perform(get("/displace/queryDoneList")
+                .param("agentId", "aaabbb")
+                .param("openId", "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"))
+                .andExpect(status().isOk());
+    }
+
+    @Ignore
+    @Test
+    public void getDetails() throws Exception {
+        mockMvc.perform(get("/displace/getDetails")
+                .param("id", "4553694c247a464f85db9ee82a519fdf"))
+                .andExpect(status().isOk());
+    }
+
+    @Ignore
+    @Test
+    public void queryRejectedCount() throws Exception {
+        mockMvc.perform(get("/displace/queryRejectedCount")
+                .param("agentId", "aaa")
+                .param("openId", "aaa"))
+                .andExpect(status().isOk());
+    }
+}

+ 25 - 0
wjj-api/src/test/java/com/demo/wjj/controller/DisplaceOfferUserControllerTest.java

@@ -0,0 +1,25 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+public class DisplaceOfferUserControllerTest extends BaseTest {
+
+    @Test
+    public void save() throws Exception {
+        mockMvc.perform(post("/displaceOfferUser/save")
+                .param("agentId", "zh520")
+                .param("openId", "11")
+                .param("displaceId", "ZH1000")
+                .param("mobile", "13695604981")
+                .param("name", "martin"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value("1"));
+    }
+}

+ 22 - 0
wjj-api/src/test/java/com/demo/wjj/controller/ImgListControllerTest.java

@@ -0,0 +1,22 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.12
+ */
+public class ImgListControllerTest extends BaseTest {
+
+    @Test
+    public void getMobileDisplaceList() throws Exception {
+        this.mockMvc.perform(get("/imglist/getDisplaceList"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(5))
+                .andExpect(jsonPath("$.data[2].listCode").value("big_small_connection"))
+                .andExpect(jsonPath("$.data[2].listName").value("大小臂连接+小臂油缸全景"));
+    }
+}

+ 35 - 0
wjj-api/src/test/java/com/demo/wjj/controller/OfferControllerTest.java

@@ -0,0 +1,35 @@
+package com.demo.wjj.controller;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/**
+ * @author wangqing
+ * @date 2018.11.18
+ */
+public class OfferControllerTest extends BaseTest {
+
+    @Ignore
+    @Test
+    public void queryDiggerOffer() throws Exception {
+        mockMvc.perform(get("/offer/getDiggerOffer")
+                .param("agentId", "aaabbb")
+                .param("openId", "oEftX0oFlyEvoP6AR0JbjSm_LQCc")
+                .param("displaceId", "ZH0003"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value("1"));
+    }
+
+    @Test
+    public void save() throws Exception {
+        mockMvc.perform(post("/offer/save")
+                .param("agentId", "aaabbb")
+                .param("openId", "testOpenId")
+                .param("displaceId", "ZH0003")
+                .param("price", "50")
+                .param("watchLocate", "1"))
+                .andExpect(status().isOk());
+    }
+}

+ 20 - 0
wjj-api/src/test/java/com/demo/wjj/controller/OpenIdControllerTest.java

@@ -0,0 +1,20 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/**
+ * @author wangqing
+ * @date 2018.11.16
+ */
+public class OpenIdControllerTest extends BaseTest{
+
+    @Test
+    public void getId() throws Exception {
+        mockMvc.perform(get("/open/getId")
+                .param("agent", "")
+                .param("code", "testCode"))
+                .andExpect(status().isOk());
+    }
+}

+ 42 - 0
wjj-api/src/test/java/com/demo/wjj/controller/PayControllerTest.java

@@ -0,0 +1,42 @@
+package com.demo.wjj.controller;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.15
+ */
+public class PayControllerTest extends BaseTest {
+
+    @Ignore
+    @Test
+    public void createOrder() throws Exception {
+        mockMvc.perform(post("/pay/createOrder")
+                .param("productId", "testProductId")
+                .param("agentId", "aaabbb")
+                .param("openId", "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value("1"));
+    }
+
+    @Ignore
+    @Test
+    public void getOrderStatus() throws Exception {
+        mockMvc.perform(get("/pay/getOrderStatus").param("orderNo", "aaabbb20181118152123CS00370662"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.success").value("1"));
+
+
+    }
+
+    @Test
+    public void refundCallback() throws Exception {
+        mockMvc.perform(post("/pay/refund/11111/callback").content("<xml>"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.success").value("1"));
+    }
+}

+ 104 - 0
wjj-api/src/test/java/com/demo/wjj/controller/QiNiuControllerTest.java

@@ -0,0 +1,104 @@
+package com.demo.wjj.controller;
+
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.UUID;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/**
+ * @author wangqing
+ * @date 2018.11.14
+ */
+public class QiNiuControllerTest extends BaseTest {
+
+    @Test
+    public void getToken() throws Exception {
+        mockMvc.perform(get("/seven/getToken"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value(1));
+    }
+
+    @Test
+    public void httpDownload() {
+//         download("http://tp.weigongcheng.net/1555646699872.mp4?e=1555659323","CNbazhRMgyg91V_X9bqBtd42CSof0Cd6rGKPOzfp:y6QO59pwH-qJCkA1ho8C1u3LgDs=");
+//
+
+    }
+
+    public InputStream getInputStream(String destUrl) {
+        InputStream inputStream = null;
+        URLConnection urlConnection = null;
+        URL url = null;
+        try {
+            url = new URL(destUrl);
+            urlConnection = url.openConnection();
+            inputStream = urlConnection.getInputStream();
+            byte[] bys = new byte[1024];
+            int len = 0;
+            System.out.println("-----------------");
+            while ((len = inputStream.read(bys)) != -1) {
+                System.out.print(new String(bys, 0, len));
+            }
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return inputStream;
+    }
+
+
+    public String download(String url, String token,HttpServletRequest request, HttpServletResponse response){
+
+        String destUrl = url+"&token="+token;
+        File fileurl = new File(destUrl);
+        //浏览器下载后的文件名称showValue,从url中截取到源文件名称以及,以及文件类型,如board.docx;
+        String showValue = UUID.randomUUID().toString()+".mp4";
+        System.out.println(showValue);
+        try{
+            //根据条件得到文件路径
+            System.out.println("===========文件路径==========="+fileurl);
+            //将文件读入文件流
+            InputStream inStream = new FileInputStream(fileurl);
+            //获得浏览器代理信息
+            final String userAgent = request.getHeader("USER-AGENT");
+            //判断浏览器代理并分别设置响应给浏览器的编码格式
+            String finalFileName = null;
+            if(StringUtils.contains(userAgent, "MSIE")||StringUtils.contains(userAgent,"Trident")){//IE浏览器
+                finalFileName = URLEncoder.encode(showValue,"UTF8");
+                System.out.println("IE浏览器");
+            }else if(StringUtils.contains(userAgent, "Mozilla")){//google,火狐浏览器
+                finalFileName = new String(showValue.getBytes(), "ISO8859-1");
+            }else{
+                finalFileName = URLEncoder.encode(showValue,"UTF8");//其他浏览器
+            }
+            //设置HTTP响应头
+            response.reset();//重置 响应头
+            response.setContentType("application/x-download");//告知浏览器下载文件,而不是直接打开,浏览器默认为打开
+            response.addHeader("Content-Disposition" ,"attachment;filename=\"" +finalFileName+ "\"");//下载文件的名称
+
+            // 循环取出流中的数据
+            byte[] b = new byte[1024];
+            int len;
+            while ((len = inStream.read(b)) > 0){
+                response.getOutputStream().write(b, 0, len);
+            }
+            inStream.close();
+            response.getOutputStream().close();
+        }catch(Exception e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+}

+ 52 - 0
wjj-api/src/test/java/com/demo/wjj/controller/RegionControllerTest.java

@@ -0,0 +1,52 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+/**
+ * @author wangqing
+ * @date 2018.11.09
+ */
+public class RegionControllerTest extends BaseTest {
+
+    @Test
+    public void getProvince() throws Exception {
+        this.mockMvc.perform(get("/region/getProvince"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(2))
+                .andExpect(jsonPath("$.data[0].id").value(1))
+                .andExpect(jsonPath("$.data[0].name").value("安徽省"))
+                .andExpect(jsonPath("$.data[1].id").value(2))
+                .andExpect(jsonPath("$.data[1].name").value("江苏省"));
+    }
+
+    @Test
+    public void getCity() throws Exception {
+        final String provinceId = "1";
+        this.mockMvc.perform(get("/region/getCity").param("provinceId", provinceId))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(3))
+                .andExpect(jsonPath("$.data[0].id").value(3))
+                .andExpect(jsonPath("$.data[0].name").value("合肥市"))
+                .andExpect(jsonPath("$.data[1].id").value(4))
+                .andExpect(jsonPath("$.data[1].name").value("六安市"))
+                .andExpect(jsonPath("$.data[2].id").value(5))
+                .andExpect(jsonPath("$.data[2].name").value("阜阳市"));
+    }
+
+
+    @Test
+    public void getCounty() throws Exception {
+        final String cityId = "3";
+        this.mockMvc.perform(get("/region/getCounty").param("cityId", cityId))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.length()").value(2))
+                .andExpect(jsonPath("$.data[0].id").value(8))
+                .andExpect(jsonPath("$.data[0].name").value("肥东县"))
+                .andExpect(jsonPath("$.data[1].id").value(9))
+                .andExpect(jsonPath("$.data[1].name").value("肥西县"));
+    }
+}

+ 20 - 0
wjj-api/src/test/java/com/demo/wjj/controller/SmsControllerTest.java

@@ -0,0 +1,20 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+/**
+ * @author wangqing
+ * @date 2018.11.09
+ */
+public class SmsControllerTest extends BaseTest {
+
+    @Test
+    public void register() throws Exception {
+        final String mobile = "13695604981";
+        this.mockMvc.perform(get("/sms/register").param("mobile", mobile))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value(1));
+    }
+}

+ 22 - 0
wjj-api/src/test/java/com/demo/wjj/controller/TicketControllerTest.java

@@ -0,0 +1,22 @@
+package com.demo.wjj.controller;
+
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.12.02
+ */
+public class TicketControllerTest extends BaseTest{
+
+    @Test
+    public void getTicket() throws Exception {
+        mockMvc.perform(get("/ticket/getTicket")
+                .param("agentId", "jm123")
+                .param("url", "http://www.betsthtml5.com"))
+                .andExpect(jsonPath("$.code").value("1"));
+
+    }
+}

+ 75 - 0
wjj-api/src/test/java/com/demo/wjj/controller/UserControllerTest.java

@@ -0,0 +1,75 @@
+package com.demo.wjj.controller;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+/**
+ * @author wangqing
+ * @date 2018.11.11
+ */
+public class UserControllerTest extends BaseTest {
+
+    @Ignore
+    @Test
+    public void register() throws Exception {
+        this.mockMvc.perform(post("/user/register")
+                .param("mobile", "13695604981")
+                .param("name", "martin")
+                .param("role", "1")
+                .param("brandId", "1,2,3")
+                .param("provinceId", "1")
+                .param("cityId", "3")
+                .param("countyId", "8")
+                .param("code", "1234")
+                .param("openId", "wxopenid")
+                .param("agentId", "54e9a557d1d64ee6bab236069c4feba3")
+        ).andExpect(status().isOk())
+        .andExpect(jsonPath("$.code").value("1"));
+    }
+
+    @Ignore
+    @Test
+    public void querySale() throws Exception {
+        this.mockMvc.perform(get("/user/querySale")
+                .param("agentId", "54e9a557d1d64ee6bab236069c4feba3")
+                .param("openId", "wxopenid")
+        ).andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.register").value(1));
+
+        this.mockMvc.perform(get("/user/querySale")
+                .param("agentId", "54e9a557d1d64ee6bab236069c4feba3")
+                .param("openId", "wxopenid1")
+        ).andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.register").value(0));
+    }
+
+    @Ignore
+    @Test
+    public void queryDiggerAgent() throws Exception {
+        this.mockMvc.perform(get("/user/queryDiggerAgent")
+                .param("agentId", "54e9a557d1d64ee6bab236069c4feba3")
+                .param("openId", "wxopenid")
+        ).andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.register").value(1));
+
+        this.mockMvc.perform(get("/user/querySale")
+                .param("agentId", "54e9a557d1d64ee6bab236069c4feba3")
+                .param("openId", "wxopenid1")
+        ).andExpect(status().isOk())
+                .andExpect(jsonPath("$.data.register").value(0));
+    }
+
+    @Test
+    public void unbind() throws Exception {
+        mockMvc.perform(post("/user/unbind")
+                .param("agentId", "aaabbb")
+                .param("openId", "oFw8d06WB9MZUm_jSGRmlaXYh8XQ")
+                .param("unbindFlag", "2"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value("1"));
+
+    }
+}

+ 28 - 0
wjj-api/src/test/java/com/demo/wjj/service/ResourceServiceTest.java

@@ -0,0 +1,28 @@
+package com.demo.wjj.service;
+
+import com.demo.wjj.controller.BaseTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author wangqing
+ * @date 2018.12.20
+ */
+public class ResourceServiceTest extends BaseTest {
+
+    @Autowired
+    private ResourceService resourceService;
+
+    @Test
+    public void testUpload() {
+        final String agentId = "GZNJ00";
+        final String openId = "oEftX0hlol56oW-tqF2jwdGCBOpo";
+        final String serverId = "mR4Brdty6BbZkS5DbATLm_YnKkCm6TS-UJt6Amvu3mx-98TUVXxLjZB3U1RwNPWn";
+
+        final String resourceKey = resourceService.upload(agentId, openId, serverId);
+        System.out.println(resourceKey);
+    }
+
+}

+ 59 - 0
wjj-api/web/WEB-INF/web.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
+         version="4.0">
+
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>classpath:META-INF/spring/applicationContext.xml</param-value>
+    </context-param>
+
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+
+    <filter>
+        <filter-name>logFilter</filter-name>
+        <filter-class>com.demo.wjj.filter.LogFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>logFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <filter>
+        <filter-name>characterEncodingFilter</filter-name>
+        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+        <init-param>
+            <param-name>encoding</param-name>
+            <param-value>UTF-8</param-value>
+        </init-param>
+        <init-param>
+            <param-name>forceRequestEncoding</param-name>
+            <param-value>true</param-value>
+        </init-param>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>characterEncodingFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <servlet>
+        <servlet-name>dispatcher</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <init-param>
+            <param-name>contextConfigLocation</param-name>
+            <param-value>classpath:META-INF/spring/dispatcher.xml</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    
+    <servlet-mapping>
+        <servlet-name>dispatcher</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+
+</web-app>

+ 8 - 0
wjj-api/web/index.html

@@ -0,0 +1,8 @@
+<html>
+<head>
+    <title>index</title>
+</head>
+<body>
+    Hello, Server started!
+</body>
+</html>

+ 130 - 0
wjj-core/pom.xml

@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>wjj-core</artifactId>
+
+    <parent>
+        <groupId>com.demo</groupId>
+        <artifactId>wjjjava</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <dependencies>
+        <!--spring begin-->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jdbc</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
+        <!--spring end-->
+
+        <!--mybatis begin-->
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis-spring</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper</artifactId>
+        </dependency>
+        <!--mybatis end-->
+
+        <!--jdbc && datasource begin-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-dbcp2</artifactId>
+        </dependency>
+        <!--jdbc && datasource end-->
+
+        <!--utils begin-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+        </dependency>
+        <!--utils end-->
+
+        <!--json begin-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+        <!--json end-->
+
+        <!--web component begin-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
+        <!--web component end-->
+
+        <!--http component begin-->
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <!--http component end-->
+
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>qiniu-java-sdk</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.qiniu</groupId>
+            <artifactId>happy-dns-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <version>RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+
+    </dependencies>
+</project>

+ 173 - 0
wjj-core/src/main/java/com/demo/wjj/bo/ApplyRefundParameter.java

@@ -0,0 +1,173 @@
+package com.demo.wjj.bo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 微信退款请求参数
+ * <p>
+ *
+ * @author wangqing
+ * @date 2019/02/10
+ */
+public class ApplyRefundParameter extends WeiXinParameter {
+
+    private Map<String, String> attributes = new HashMap<>();
+
+    /**
+     * 公众账号ID
+     */
+    private String appId;
+
+    /**
+     * 商户号
+     */
+    private String mchId;
+
+    /**
+     * 随机串
+     */
+    private String nonceStr;
+
+    /**
+     * 签名类型
+     */
+    private String signType = "MD5";
+
+    /**
+     * 微信订单号
+     */
+    private String transactionId;
+
+    /**
+     * 商户退款单号
+     */
+    private String outRefundNo;
+
+    /**
+     * 订单金额(分)
+     */
+    private Integer totalFee;
+
+    /**
+     * 退款金额(分)
+     */
+    private Integer refundFee;
+
+    private String sign;
+
+    /**
+     * 回调地址
+     */
+    private String notifyUrl;
+
+    public ApplyRefundParameter() {
+        initAttributes();
+    }
+
+    private void initAttributes() {
+        attributes.put("appId", "appid");
+        attributes.put("mchId", "mch_id");
+        attributes.put("nonceStr", "nonce_str");
+        attributes.put("signType", "sign_type");
+        attributes.put("transactionId", "transaction_id");
+        attributes.put("outRefundNo", "out_refund_no");
+        attributes.put("totalFee", "total_fee");
+        attributes.put("refundFee", "refund_fee");
+        attributes.put("notifyUrl", "notify_url");
+        attributes.put("sign", "sign");
+    }
+
+    public Map<String, String> getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, String> attributes) {
+        this.attributes = attributes;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getMchId() {
+        return mchId;
+    }
+
+    public void setMchId(String mchId) {
+        this.mchId = mchId;
+    }
+
+    public String getNonceStr() {
+        return nonceStr;
+    }
+
+    public void setNonceStr(String nonceStr) {
+        this.nonceStr = nonceStr;
+    }
+
+    public String getSignType() {
+        return signType;
+    }
+
+    public void setSignType(String signType) {
+        this.signType = signType;
+    }
+
+    public String getTransactionId() {
+        return transactionId;
+    }
+
+    public void setTransactionId(String transactionId) {
+        this.transactionId = transactionId;
+    }
+
+    public String getOutRefundNo() {
+        return outRefundNo;
+    }
+
+    public void setOutRefundNo(String outRefundNo) {
+        this.outRefundNo = outRefundNo;
+    }
+
+    public Integer getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(Integer totalFee) {
+        this.totalFee = totalFee;
+    }
+
+    public Integer getRefundFee() {
+        return refundFee;
+    }
+
+    public void setRefundFee(Integer refundFee) {
+        this.refundFee = refundFee;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    @Override
+    protected Map<String, String> getAttributeMap() {
+        return attributes;
+    }
+}

+ 108 - 0
wjj-core/src/main/java/com/demo/wjj/bo/ApplyRefundResponse.java

@@ -0,0 +1,108 @@
+package com.demo.wjj.bo;
+
+import org.apache.commons.lang3.StringUtils;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+
+import java.io.ByteArrayInputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ *
+ * @author wangqing
+ * @date 2019/02/10
+ */
+public class ApplyRefundResponse {
+
+    private final Logger LOG = LoggerFactory.getLogger(getClass());
+
+    private Map<String, String> attributes = new HashMap<>();
+
+    private String returnCode;
+
+    private String returnMsg;
+
+    private String resultCode;
+
+    private String errCode;
+
+    private String errCodeDes;
+
+    public ApplyRefundResponse() {
+        attributes.put("return_code", "returnCode");
+        attributes.put("return_msg", "returnMsg");
+        attributes.put("result_code", "resultCode");
+        attributes.put("err_code", "errCode");
+        attributes.put("err_code_des", "errCodeDes");
+    }
+
+    public void parseResponse(String xml) throws DocumentException {
+        if (StringUtils.isBlank(xml)) {
+            LOG.info("xml内容为空");
+            return;
+        }
+
+        SAXReader reader = new SAXReader();
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8));
+        final Document document = reader.read(inputStream);
+        final Element rootElement = document.getRootElement();
+        final List<Element> elements = rootElement.elements();
+        BeanWrapper bean = new BeanWrapperImpl(this);
+        for (Element element : elements) {
+            final String name = element.getName();
+            if (attributes.containsKey(name)) {
+                bean.setPropertyValue(attributes.get(name), element.getStringValue());
+            }
+        }
+    }
+
+    public String getReturnCode() {
+        return returnCode;
+    }
+
+    public void setReturnCode(String returnCode) {
+        this.returnCode = returnCode;
+    }
+
+    public String getReturnMsg() {
+        return returnMsg;
+    }
+
+    public void setReturnMsg(String returnMsg) {
+        this.returnMsg = returnMsg;
+    }
+
+    public String getResultCode() {
+        return resultCode;
+    }
+
+    public void setResultCode(String resultCode) {
+        this.resultCode = resultCode;
+    }
+
+    public String getErrCode() {
+        return errCode;
+    }
+
+    public void setErrCode(String errCode) {
+        this.errCode = errCode;
+    }
+
+    public String getErrCodeDes() {
+        return errCodeDes;
+    }
+
+    public void setErrCodeDes(String errCodeDes) {
+        this.errCodeDes = errCodeDes;
+    }
+}

+ 48 - 0
wjj-core/src/main/java/com/demo/wjj/bo/AuthorizationUrlBo.java

@@ -0,0 +1,48 @@
+package com.demo.wjj.bo;
+
+/**
+ * 授权url
+ * @author wangqing
+ * @date 2019.01.30
+ */
+public class AuthorizationUrlBo {
+
+    /**
+     * 第三方平台appId
+     */
+    private String appId;
+
+    /**
+     * 授权类型
+     */
+    private String authType;
+
+    /**
+     * 小程序或公众号id
+     */
+    private String bizAppId;
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAuthType() {
+        return authType;
+    }
+
+    public void setAuthType(String authType) {
+        this.authType = authType;
+    }
+
+    public String getBizAppId() {
+        return bizAppId;
+    }
+
+    public void setBizAppId(String bizAppId) {
+        this.bizAppId = bizAppId;
+    }
+}

+ 69 - 0
wjj-core/src/main/java/com/demo/wjj/bo/CallbackTicketBo.java

@@ -0,0 +1,69 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * <p>
+ *
+ * @author wangqing
+ * @date 2019/02/03
+ */
+public class CallbackTicketBo {
+
+    /**
+     * 消息签名
+     */
+    private String msgSignature;
+
+    /**
+     * 时间戳
+     */
+    private String timestamp;
+
+    /**
+     * 随机串
+     */
+    private String nonce;
+
+    /**
+     * 数据包
+     */
+    private String postdata;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getMsgSignature() {
+        return msgSignature;
+    }
+
+    public void setMsgSignature(String msgSignature) {
+        this.msgSignature = msgSignature;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getNonce() {
+        return nonce;
+    }
+
+    public void setNonce(String nonce) {
+        this.nonce = nonce;
+    }
+
+    public String getPostdata() {
+        return postdata;
+    }
+
+    public void setPostdata(String postdata) {
+        this.postdata = postdata;
+    }
+}

+ 101 - 0
wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderBo.java

@@ -0,0 +1,101 @@
+package com.demo.wjj.bo;
+
+/**
+ * 创建订单
+ * @author wangqing
+ * @date 2018.11.13
+ */
+public class CreateOrderBo {
+
+    /**
+     * 产品id
+     */
+    private String productId;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 微信openId
+     */
+    private String openId;
+
+    /**
+     * 客户端ip
+     */
+    private String clientIp;
+
+    /**
+     * 联系人姓名
+     */
+    private String name;
+
+    /**
+     * 联系人手机
+     */
+    private String mobile;
+
+    /**
+     * 是否通票
+     */
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    private int tp;
+    */
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getClientIp() {
+        return clientIp;
+    }
+
+    public void setClientIp(String clientIp) {
+        this.clientIp = clientIp;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    public void setTp(int tp) {
+        this.tp = tp;
+    }
+
+    public int getTp() {
+        return tp;
+    }*/
+}

+ 257 - 0
wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderParameter.java

@@ -0,0 +1,257 @@
+package com.demo.wjj.bo;
+
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+import org.springframework.context.annotation.Bean;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * 微信创建订单参数
+ *
+ * @author wangqing
+ * @date 2018.11.13
+ */
+public class CreateOrderParameter extends WeiXinParameter {
+
+    /**
+     * 公众号id
+     */
+    private String appId;
+
+    /**
+     * 商户号
+     */
+    private String mchId;
+
+    /**
+     * 设备号
+     */
+    private String deviceInfo;
+
+    /**
+     * 随机字符串
+     */
+    private String nonceStr;
+
+    /**
+     * 签名
+     */
+    private String sign;
+
+    /**
+     * 商品描述
+     */
+    private String body;
+
+    /**
+     * 商品详情
+     */
+    private String detail;
+
+    /**
+     * 商户订单号
+     */
+    private String outTradeNo;
+
+    /**
+     * 标价金额(分)
+     */
+    private Integer totalFee;
+
+    /**
+     * 终端ip
+     */
+    private String spbillCreateIp;
+
+    /**
+     * 交易起始时间
+     */
+    private String timeStart;
+
+    /**
+     * 交易结束时间
+     */
+    private String timeExpire;
+
+    /**
+     * 通知地址
+     */
+    private String notifyUrl;
+
+    /**
+     * 交易类型
+     */
+    private String tradeType = "JSAPI";
+
+    /**
+     * 微信
+     */
+    private String openId;
+
+    /**
+     * 附加数据
+     */
+    private String attach;
+
+    public CreateOrderParameter() {
+        initAttributeMap();
+    }
+
+    private final Map<String, String> attributeMap = new HashMap<>();
+
+    private void initAttributeMap() {
+        attributeMap.put("appId", "appid");
+        attributeMap.put("mchId", "mch_id");
+        attributeMap.put("deviceInfo", "device_info");
+        attributeMap.put("nonceStr", "nonce_str");
+        attributeMap.put("sign", "sign");
+        attributeMap.put("body", "body");
+        attributeMap.put("detail", "detail");
+        attributeMap.put("outTradeNo", "out_trade_no");
+        attributeMap.put("totalFee", "total_fee");
+        attributeMap.put("spbillCreateIp", "spbill_create_ip");
+        attributeMap.put("timeStart", "time_start");
+        attributeMap.put("timeExpire", "time_expire");
+        attributeMap.put("notifyUrl", "notify_url");
+        attributeMap.put("tradeType", "trade_type");
+        attributeMap.put("openId", "openid");
+        attributeMap.put("attach", "attach");
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getMchId() {
+        return mchId;
+    }
+
+    public void setMchId(String mchId) {
+        this.mchId = mchId;
+    }
+
+    public String getDeviceInfo() {
+        return deviceInfo;
+    }
+
+    public void setDeviceInfo(String deviceInfo) {
+        this.deviceInfo = deviceInfo;
+    }
+
+    public String getNonceStr() {
+        return nonceStr;
+    }
+
+    public void setNonceStr(String nonceStr) {
+        this.nonceStr = nonceStr;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public String getBody() {
+        return body;
+    }
+
+    public void setBody(String body) {
+        this.body = body;
+    }
+
+    public String getDetail() {
+        return detail;
+    }
+
+    public void setDetail(String detail) {
+        this.detail = detail;
+    }
+
+    public String getOutTradeNo() {
+        return outTradeNo;
+    }
+
+    public void setOutTradeNo(String outTradeNo) {
+        this.outTradeNo = outTradeNo;
+    }
+
+    public Integer getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(Integer totalFee) {
+        this.totalFee = totalFee;
+    }
+
+    public String getSpbillCreateIp() {
+        return spbillCreateIp;
+    }
+
+    public void setSpbillCreateIp(String spbillCreateIp) {
+        this.spbillCreateIp = spbillCreateIp;
+    }
+
+    public String getTimeStart() {
+        return timeStart;
+    }
+
+    public void setTimeStart(String timeStart) {
+        this.timeStart = timeStart;
+    }
+
+    public String getTimeExpire() {
+        return timeExpire;
+    }
+
+    public void setTimeExpire(String timeExpire) {
+        this.timeExpire = timeExpire;
+    }
+
+    public String getNotifyUrl() {
+        return notifyUrl;
+    }
+
+    public void setNotifyUrl(String notifyUrl) {
+        this.notifyUrl = notifyUrl;
+    }
+
+    public String getTradeType() {
+        return tradeType;
+    }
+
+    public void setTradeType(String tradeType) {
+        this.tradeType = tradeType;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public void setAttach(String attach) {
+        this.attach = attach;
+    }
+
+    public String getAttach() {
+        return attach;
+    }
+
+    @Override
+    protected Map<String, String> getAttributeMap() {
+        return attributeMap;
+    }
+}

+ 122 - 0
wjj-core/src/main/java/com/demo/wjj/bo/CreateOrderResult.java

@@ -0,0 +1,122 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+import com.qiniu.util.Json;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 创建订单结果
+ *
+ * @author wangqing
+ * @date 2018.11.13
+ */
+public class CreateOrderResult {
+
+    /**
+     * 公众号id
+     */
+    private String appId;
+
+    /**
+     * 时间戳
+     */
+    private String timeStamp;
+
+    /**
+     * 随机字符串
+     */
+    private String nonceStr;
+
+    /**
+     * 订单详情扩展字符串
+     */
+    private String packageStr;
+
+    /**
+     * 签名类型
+     */
+    private String signType;
+
+    /**
+     * 签名
+     */
+    private String paySign;
+
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+    public Map<String, String> createRequestParameter() {
+        Map<String, String> parameter = new HashMap<>();
+        parameter.put("appId", appId);
+        parameter.put("timeStamp", timeStamp);
+        parameter.put("nonceStr", nonceStr);
+        parameter.put("package", packageStr);
+        parameter.put("signType", signType);
+        return parameter;
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getTimeStamp() {
+        return timeStamp;
+    }
+
+    public void setTimeStamp(String timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
+    public String getNonceStr() {
+        return nonceStr;
+    }
+
+    public void setNonceStr(String nonceStr) {
+        this.nonceStr = nonceStr;
+    }
+
+    public String getPackageStr() {
+        return packageStr;
+    }
+
+    public void setPackageStr(String packageStr) {
+        this.packageStr = "prepay_id=" + packageStr;
+    }
+
+    public String getSignType() {
+        return signType;
+    }
+
+    public void setSignType(String signType) {
+        this.signType = signType;
+    }
+
+    public String getPaySign() {
+        return paySign;
+    }
+
+    public void setPaySign(String paySign) {
+        this.paySign = paySign;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+}

+ 86 - 0
wjj-core/src/main/java/com/demo/wjj/bo/DiggerOfferBo.java

@@ -0,0 +1,86 @@
+package com.demo.wjj.bo;
+
+/**
+ * @author wangqing
+ * @date 2018.11.18
+ */
+public class DiggerOfferBo {
+
+    /**
+     * 是否需要支付保证金, 1:是; 0:否
+     */
+    private Integer payOffer;
+
+    /**
+     * 保证金金额
+     */
+    private Integer money;
+
+    /**
+     * 是否已参与
+     */
+    private Integer isJoin;
+
+    /**
+     * 车商手机号
+     */
+    private String mobile;
+
+    /**
+     * 车商姓名
+     */
+    private String name;
+
+    /**
+     * 车商id
+     */
+    private String diggerAgentId;
+
+    public Integer getPayOffer() {
+        return payOffer;
+    }
+
+    public void setPayOffer(Integer payOffer) {
+        this.payOffer = payOffer;
+    }
+
+    public Integer getMoney() {
+        return money;
+    }
+
+    public void setMoney(Integer money) {
+        this.money = money;
+    }
+
+    public Integer getIsJoin() {
+        return isJoin;
+    }
+
+    public void setIsJoin(Integer isJoin) {
+        this.isJoin = isJoin;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDiggerAgentId() {
+        return diggerAgentId;
+    }
+
+    public void setDiggerAgentId(String diggerAgentId) {
+        this.diggerAgentId = diggerAgentId;
+    }
+}

+ 75 - 0
wjj-core/src/main/java/com/demo/wjj/bo/DiggerOfferSaveBo.java

@@ -0,0 +1,75 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * @author wangqing
+ * @date 2018.11.19
+ */
+public class DiggerOfferSaveBo {
+
+    private String agentId;
+
+    private String openId;
+
+    private String displaceId;
+
+    private String orderNo;
+
+    private Double price;
+
+    private String watchLocate;
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public String getWatchLocate() {
+        return watchLocate;
+    }
+
+    public void setWatchLocate(String watchLocate) {
+        this.watchLocate = watchLocate;
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+}

+ 505 - 0
wjj-core/src/main/java/com/demo/wjj/bo/DisplaceDetailBo.java

@@ -0,0 +1,505 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+import com.demo.wjj.po.OfferDetail;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 置换详情
+ * @author wangqing
+ * @date 2018.11.16
+ */
+public class DisplaceDetailBo {
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 置换id
+     */
+    private String displaceId;
+
+    /**
+     * 品牌
+     */
+    private String brand;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 小时数
+     */
+    private String hours;
+
+    /**
+     * 出厂年份
+     */
+    private String yearMonth;
+
+    /**
+     * 所在地
+     */
+    private String location;
+
+    /**
+     * 设备类型
+     */
+    private String deviceType;
+
+    /**
+     * 配置说明
+     */
+    private String config;
+
+    /**
+     * 作业履历
+     */
+    private String jobResume;
+
+    /**
+     * 票证说明
+     */
+    private String ticket;
+
+    /**
+     * 姓名
+     */
+    private String username;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 图片
+     */
+    private List<PictureItem> pictureItems;
+
+    /**
+     * 围观次数
+     */
+    private Integer lookTimes;
+
+    /**
+     * 报价次数
+     */
+    private Integer offerTimes;
+
+    /**
+     * 理想报价
+     */
+    private String ideaPrice;
+
+    /**
+     * 结束时长
+     */
+    private Long endTimeLength;
+
+    /**
+     * 质保说明
+     */
+    private String warrantyDesc;
+
+    private Date startTime;
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    /**
+     * 报价结束时间
+     */
+    private Date endTime;
+
+    /**
+     * 报价状态, 1:未开始;2:进行中;3:已结束
+     */
+    private Integer offerStatus;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 最高报价
+     */
+    private double maxPrice;
+
+    /**
+     * 自己最高报价
+     */
+    private double maxMyPrice;
+
+    /**
+     * 报价列表
+     */
+    private List<OfferDetail> priceList;
+
+    /**
+     * 报价幅度
+     */
+    private String moneyRange;
+
+    /**
+     * 起拍价
+     */
+    private String minMoney;
+
+    /**
+     * 联系人姓名
+     */
+    private String joumalistName;
+
+    /**
+     * 联系人手机
+     */
+    private String joumalistTel;
+
+    /**
+     * 其他说明
+     */
+    private String othersDesc;
+
+    /*
+    *
+    * 协议类型
+    *
+    * */
+    private String upType;
+
+    /*
+    * 是否看现场
+    *
+    * */
+    private Integer isKxc;
+    /**
+     * 代理商名称
+     */
+    private String agentName;
+    /**
+     * 集团名称
+     */
+    private String groupName;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+
+    public String getUpType() {
+        return upType;
+    }
+
+    public void setUpType(String upType) {
+        this.upType = upType;
+    }
+
+    public Integer getIsKxc() {
+        return isKxc;
+    }
+    public void setIsKxc(Integer isKxc) {
+        this.isKxc = isKxc;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getHours() {
+        return hours;
+    }
+
+    public void setHours(String hours) {
+        this.hours = hours;
+    }
+
+    public String getYearMonth() {
+        return yearMonth;
+    }
+
+    public void setYearMonth(String yearMonth) {
+        this.yearMonth = yearMonth;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getConfig() {
+        return config;
+    }
+
+    public void setConfig(String config) {
+        this.config = config;
+    }
+
+    public String getJobResume() {
+        return jobResume;
+    }
+
+    public void setJobResume(String jobResume) {
+        this.jobResume = jobResume;
+    }
+
+    public String getTicket() {
+        return ticket;
+    }
+
+    public void setTicket(String ticket) {
+        this.ticket = ticket;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public List<PictureItem> getPictureItems() {
+        return pictureItems;
+    }
+
+    public void setPictureItems(List<PictureItem> pictureItems) {
+        this.pictureItems = pictureItems;
+    }
+
+    public Integer getLookTimes() {
+        return lookTimes;
+    }
+
+    public void setLookTimes(Integer lookTimes) {
+        this.lookTimes = lookTimes;
+    }
+
+    public Integer getOfferTimes() {
+        return offerTimes;
+    }
+
+    public void setOfferTimes(Integer offerTimes) {
+        this.offerTimes = offerTimes;
+    }
+
+    public String getIdeaPrice() {
+        return ideaPrice;
+    }
+
+    public void setIdeaPrice(String ideaPrice) {
+        this.ideaPrice = ideaPrice;
+    }
+
+    public Long getEndTimeLength() {
+        return endTimeLength;
+    }
+
+    public void setEndTimeLength(Long endTimeLength) {
+        this.endTimeLength = endTimeLength;
+    }
+
+    public String getWarrantyDesc() {
+        return warrantyDesc;
+    }
+
+    public void setWarrantyDesc(String warrantyDesc) {
+        this.warrantyDesc = warrantyDesc;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Integer getOfferStatus() {
+        return offerStatus;
+    }
+
+    public void setOfferStatus(Integer offerStatus) {
+        this.offerStatus = offerStatus;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public void setMaxPrice(double maxPrice) {
+        this.maxPrice = maxPrice;
+    }
+
+    public double getMaxPrice() {
+        return maxPrice;
+    }
+
+    public void setMaxMyPrice(double maxMyPrice) {
+        this.maxMyPrice = maxMyPrice;
+    }
+
+    public double getMaxMyPrice() {
+        return maxMyPrice;
+    }
+
+    public void setPriceList(List<OfferDetail> priceList) {
+        this.priceList = priceList;
+    }
+
+    public List<OfferDetail> getPriceList() {
+        return priceList;
+    }
+
+    public String getMoneyRange() {
+        return moneyRange;
+    }
+
+    public void setMoneyRange(String moneyRange) {
+        this.moneyRange = moneyRange;
+    }
+
+    public String getMinMoney() {
+        return minMoney;
+    }
+
+    public void setMinMoney(String minMoney) {
+        this.minMoney = minMoney;
+    }
+
+    public void setJoumalistName(String joumalistName) {
+        this.joumalistName = joumalistName;
+    }
+
+    public String getJoumalistName() {
+        return joumalistName;
+    }
+
+    public void setJoumalistTel(String joumalistTel) {
+        this.joumalistTel = joumalistTel;
+    }
+
+    public String getJoumalistTel() {
+        return joumalistTel;
+    }
+
+    public void setOthersDesc(String othersDesc) {
+        this.othersDesc = othersDesc;
+    }
+
+    public String getOthersDesc() {
+        return othersDesc;
+    }
+
+    public String getAgentName() {
+        return agentName;
+    }
+
+    public void setAgentName(String agentName) {
+        this.agentName = agentName;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public static class PictureItem {
+        private String listCode;
+
+        private String listName;
+
+        private String url;
+
+        public String getListCode() {
+            return listCode;
+        }
+
+        public void setListCode(String listCode) {
+            this.listCode = listCode;
+        }
+
+        public String getListName() {
+            return listName;
+        }
+
+        public void setListName(String listName) {
+            this.listName = listName;
+        }
+
+        public String getUrl() {
+            return url;
+        }
+
+        public void setUrl(String url) {
+            this.url = url;
+        }
+    }
+}

+ 244 - 0
wjj-core/src/main/java/com/demo/wjj/bo/DisplaceListBo.java

@@ -0,0 +1,244 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+import java.util.Date;
+
+/**
+ * 置换列表
+ * @author wangqing
+ * @date 2018.11.15
+ */
+public class DisplaceListBo {
+
+    /**
+     * 品牌
+     */
+    private String brand;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 设备类型
+     */
+    private String deviceType;
+
+    /**
+     * 出厂年份
+     */
+    private String yearMonth;
+
+    /**
+     * 使用小时数
+     */
+    private String hours;
+
+    /**
+     * 置换id
+     */
+    private String displaceId;
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 围观次数
+     */
+    private String lookTimes;
+
+    /**
+     * 报价次数
+     */
+    private String offerTimes;
+
+    /**
+     * 审核状态
+     */
+    private String auditStatus;
+
+    /**
+     * 图片地址
+     */
+    private String picUrl;
+
+    /**
+     * 当前价格(最高报价或起拍价)
+     */
+    private String currentPrice;
+
+    /*
+     *
+     * 协议类型
+     *
+     * */
+    private String upType;
+
+    /*
+     * 是否看现场
+     *
+     * */
+    private Integer isKxc;
+
+    /*
+    报价开始时间
+     */
+    private Date startTime;
+
+    /*
+    报价结束时间
+     */
+    private Date endTime;
+
+    /*
+    * 报价/总数
+    * */
+    private DisplaceListNumBo displaceListNumBo;
+
+
+    public DisplaceListNumBo getDisplaceListNumBo() {
+        return displaceListNumBo;
+    }
+
+    public void setDisplaceListNumBo(DisplaceListNumBo displaceListNumBo) {
+        this.displaceListNumBo = displaceListNumBo;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getUpType() {
+        return upType;
+    }
+
+    public void setUpType(String upType) {
+        this.upType = upType;
+    }
+
+    public Integer getIsKxc() {
+        return isKxc;
+    }
+
+    public void setIsKxc(Integer isKxc) {
+        this.isKxc = isKxc;
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getYearMonth() {
+        return yearMonth;
+    }
+
+    public void setYearMonth(String yearMonth) {
+        this.yearMonth = yearMonth;
+    }
+
+    public String getHours() {
+        return hours;
+    }
+
+    public void setHours(String hours) {
+        this.hours = hours;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getLookTimes() {
+        return lookTimes;
+    }
+
+    public void setLookTimes(String lookTimes) {
+        this.lookTimes = lookTimes;
+    }
+
+    public String getOfferTimes() {
+        return offerTimes;
+    }
+
+    public void setOfferTimes(String offerTimes) {
+        this.offerTimes = offerTimes;
+    }
+
+    public String getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(String auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    public String getPicUrl() {
+        return picUrl;
+    }
+
+    public void setPicUrl(String picUrl) {
+        this.picUrl = picUrl;
+    }
+
+    public String getCurrentPrice() {
+        return currentPrice;
+    }
+
+    public void setCurrentPrice(String currentPrice) {
+        this.currentPrice = currentPrice;
+    }
+
+}

+ 26 - 0
wjj-core/src/main/java/com/demo/wjj/bo/DisplaceListNumBo.java

@@ -0,0 +1,26 @@
+package com.demo.wjj.bo;
+
+public class DisplaceListNumBo {
+    //已结束有报价设备数
+    private Integer endOfferNum;
+
+    //已结束设备总数
+    private Integer endTotalNum;
+
+
+    public Integer getEndOfferNum() {
+        return endOfferNum;
+    }
+
+    public void setEndOfferNum(Integer endOfferNum) {
+        this.endOfferNum = endOfferNum;
+    }
+
+    public Integer getEndTotalNum() {
+        return endTotalNum;
+    }
+
+    public void setEndTotalNum(Integer endTotalNum) {
+        this.endTotalNum = endTotalNum;
+    }
+}

+ 57 - 0
wjj-core/src/main/java/com/demo/wjj/bo/ImgListBo.java

@@ -0,0 +1,57 @@
+package com.demo.wjj.bo;
+
+import java.io.Serializable;
+
+public class ImgListBo implements Serializable {
+
+    //目录编码
+    private String ListCode;
+    //大分类名
+    private String ListName;
+    //大分类编号
+    private Integer listOrder;
+    //是否可用, 1:是; 0:否
+    private Integer canEnable;
+    //小分类名
+    private String imgItem;
+
+    public String getListCode() {
+        return ListCode;
+    }
+
+    public void setListCode(String listCode) {
+        ListCode = listCode;
+    }
+
+    public String getListName() {
+        return ListName;
+    }
+
+    public void setListName(String listName) {
+        ListName = listName;
+    }
+
+    public Integer getListOrder() {
+        return listOrder;
+    }
+
+    public void setListOrder(Integer listOrder) {
+        this.listOrder = listOrder;
+    }
+
+    public Integer getCanEnable() {
+        return canEnable;
+    }
+
+    public void setCanEnable(Integer canEnable) {
+        this.canEnable = canEnable;
+    }
+
+    public String getImgItem() {
+        return imgItem;
+    }
+
+    public void setImgItem(String imgItem) {
+        this.imgItem = imgItem;
+    }
+}

+ 109 - 0
wjj-core/src/main/java/com/demo/wjj/bo/JsSdkResult.java

@@ -0,0 +1,109 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author wangqing
+ * @date 2018.12.01
+ */
+public class JsSdkResult {
+
+    /**
+     * appId
+     */
+    private String appId;
+
+    /**
+     * 时间戳(秒)
+     */
+    private String timestamp;
+
+    /**
+     * 随机数
+     */
+    private String nonceStr;
+
+    /**
+     * 签名
+     */
+    private String signature;
+
+    /**
+     * 票据
+     */
+    private String ticket;
+
+    /**
+     * 请求url
+     */
+    private String url;
+
+    /**
+     * 获取请求参数
+     * @return 请求参数
+     */
+    public Map<String, String> createRequestParameters() {
+        Map<String, String> parameters = new HashMap<>();
+        parameters.put("timestamp", timestamp);
+        parameters.put("noncestr", nonceStr);
+        parameters.put("jsapi_ticket", ticket);
+        parameters.put("url", url);
+        return parameters;
+    }
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public void setAppId(String appId) {
+        this.appId = appId;
+    }
+
+    public String getAppId() {
+        return appId;
+    }
+
+    public void setTimestamp(String timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getTimestamp() {
+        return timestamp;
+    }
+
+    public void setNonceStr(String nonceStr) {
+        this.nonceStr = nonceStr;
+    }
+
+    public String getNonceStr() {
+        return nonceStr;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public String getTicket() {
+        return ticket;
+    }
+
+    public void setTicket(String ticket) {
+        this.ticket = ticket;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+}

+ 47 - 0
wjj-core/src/main/java/com/demo/wjj/bo/PayParameterJson.java

@@ -0,0 +1,47 @@
+package com.demo.wjj.bo;
+
+/**
+ * @author wangqing
+ * @date 2018.11.18
+ */
+public class PayParameterJson {
+
+    /**
+     * 联系人手机
+     */
+    private String mobile;
+
+    /**
+     * 联系人姓名
+     */
+    private String name;
+
+    /**
+     * 是否通票
+     */
+    private Integer tp;
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getTp() {
+        return tp;
+    }
+
+    public void setTp(Integer tp) {
+        this.tp = tp;
+    }
+}

+ 35 - 0
wjj-core/src/main/java/com/demo/wjj/bo/QiNiuUploadResult.java

@@ -0,0 +1,35 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * @author wangqing
+ * @date 2018.12.19
+ */
+public class QiNiuUploadResult {
+
+    private String key;
+
+    private String hash;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setHash(String hash) {
+        this.hash = hash;
+    }
+
+    public String getHash() {
+        return hash;
+    }
+}

+ 323 - 0
wjj-core/src/main/java/com/demo/wjj/bo/SaveDisplaceBo.java

@@ -0,0 +1,323 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+import java.util.List;
+
+/**
+ * 保存置换
+ * @author wangqing
+ * @date 2018.11.12
+ */
+public class SaveDisplaceBo {
+
+    /**
+     * 置换id
+     */
+    private String displaceId;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 微信openId
+     */
+    private String openId;
+
+    /**
+     * 品牌
+     */
+    private String brand;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 小时数
+     */
+    private String hours;
+
+    /**
+     * 出厂年份
+     */
+    private String yearMonth;
+
+    /**
+     * 省份id
+     */
+    private Integer provinceId;
+
+    /**
+     * 地市id
+     */
+    private Integer cityId;
+
+    /**
+     * 区县id
+     */
+    private Integer countyId;
+
+    /**
+     * 设备类型
+     */
+    private String deviceType;
+
+    /**
+     * 配置说明
+     */
+    private String config;
+
+    /**
+     * 作业履历
+     */
+    private String jobResume;
+
+    /**
+     * 票证说明
+     */
+    private String ticket;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 姓名
+     */
+    private String username;
+
+    /**
+     * 其他说明
+     */
+    private String other;
+
+    /**
+     * 理想价位
+     */
+    private String price;
+
+    /**
+     * 置换图片
+     */
+    private List<DisplaceImageList> picture;
+
+    /**
+     * 组装后的区域名称
+     */
+    private String location;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    /**
+     * 置换图片列表
+     */
+    public static class DisplaceImageList {
+
+        /**
+         * 置换图片编码
+         */
+        private String code;
+
+        /**
+         * 第三级目录id(细节分类id)
+         */
+        private Integer detailId;
+
+        /**
+         * 置换图片地址
+         */
+        private List<String> pic;
+
+        public String getCode() {
+            return code;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public List<String> getPic() {
+            return pic;
+        }
+
+        public void setPic(List<String> pic) {
+            this.pic = pic;
+        }
+
+        public Integer getDetailId() {
+            return detailId;
+        }
+
+        public void setDetailId(Integer detailId) {
+            this.detailId = detailId;
+        }
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getHours() {
+        return hours;
+    }
+
+    public void setHours(String hours) {
+        this.hours = hours;
+    }
+
+    public String getYearMonth() {
+        return yearMonth;
+    }
+
+    public void setYearMonth(String yearMonth) {
+        this.yearMonth = yearMonth;
+    }
+
+    public Integer getProvinceId() {
+        return provinceId;
+    }
+
+    public void setProvinceId(Integer provinceId) {
+        this.provinceId = provinceId;
+    }
+
+    public Integer getCityId() {
+        return cityId;
+    }
+
+    public void setCityId(Integer cityId) {
+        this.cityId = cityId;
+    }
+
+    public Integer getCountyId() {
+        return countyId;
+    }
+
+    public void setCountyId(Integer countyId) {
+        this.countyId = countyId;
+    }
+
+    public String getDeviceType() {
+        return deviceType;
+    }
+
+    public void setDeviceType(String deviceType) {
+        this.deviceType = deviceType;
+    }
+
+    public String getConfig() {
+        return config;
+    }
+
+    public void setConfig(String config) {
+        this.config = config;
+    }
+
+    public String getJobResume() {
+        return jobResume;
+    }
+
+    public void setJobResume(String jobResume) {
+        this.jobResume = jobResume;
+    }
+
+    public String getTicket() {
+        return ticket;
+    }
+
+    public void setTicket(String ticket) {
+        this.ticket = ticket;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getOther() {
+        return other;
+    }
+
+    public void setOther(String other) {
+        this.other = other;
+    }
+
+    public String getPrice() {
+        return price;
+    }
+
+    public void setPrice(String price) {
+        this.price = price;
+    }
+
+    public List<DisplaceImageList> getPicture() {
+        return picture;
+    }
+
+    public void setPicture(List<DisplaceImageList> picture) {
+        this.picture = picture;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+}

+ 67 - 0
wjj-core/src/main/java/com/demo/wjj/bo/SaveOfferUserBo.java

@@ -0,0 +1,67 @@
+package com.demo.wjj.bo;
+
+/**
+ * @author wangqing
+ * @date 2018.11.26
+ */
+public class SaveOfferUserBo {
+
+    private String agentId;
+
+    private String openId;
+
+    private String mobile;
+
+    private String name;
+    private String displaceId;
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    private Integer tp;
+    */
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDisplaceId() {
+        return displaceId;
+    }
+
+    public void setDisplaceId(String displaceId) {
+        this.displaceId = displaceId;
+    }
+    /* 手机端用户不能设置通票 wangqing 201811302208
+    public void setTp(Integer tp) {
+        this.tp = tp;
+    }
+
+    public Integer getTp() {
+        return tp;
+    }*/
+}

+ 42 - 0
wjj-core/src/main/java/com/demo/wjj/bo/SmsSendBo.java

@@ -0,0 +1,42 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 短信发送
+ * @author wangqing
+ * @date 2018.11.09
+ */
+public class SmsSendBo {
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 短信内容
+     */
+    private String content;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+}

+ 66 - 0
wjj-core/src/main/java/com/demo/wjj/bo/TbQuoteProtocolBo.java

@@ -0,0 +1,66 @@
+package com.demo.wjj.bo;
+import java.io.Serializable;
+import java.util.Date;
+
+public class TbQuoteProtocolBo implements Serializable {
+
+  private Integer id;
+  //文件内容
+  private String content;
+  //创建时间
+  private Date createTime;
+  //修改人
+  private String modifyId;
+  //修改时间
+  private Date modifyTime;
+  //类型 0 保价协议  1 网络竞销协议
+  private Integer type;
+
+  public Integer getId() {
+    return id;
+  }
+
+  public void setId(Integer id) {
+    this.id = id;
+  }
+
+  public String getContent() {
+    return content;
+  }
+
+  public void setContent(String content) {
+    this.content = content;
+  }
+
+  public Date getCreateTime() {
+    return createTime;
+  }
+
+  public void setCreateTime(Date createTime) {
+    this.createTime = createTime;
+  }
+
+  public String getModifyId() {
+    return modifyId;
+  }
+
+  public void setModifyId(String modifyId) {
+    this.modifyId = modifyId;
+  }
+
+  public Date getModifyTime() {
+    return modifyTime;
+  }
+
+  public void setModifyTime(Date modifyTime) {
+    this.modifyTime = modifyTime;
+  }
+
+  public Integer getType() {
+    return type;
+  }
+
+  public void setType(Integer type) {
+    this.type = type;
+  }
+}

+ 169 - 0
wjj-core/src/main/java/com/demo/wjj/bo/UserRegisterBo.java

@@ -0,0 +1,169 @@
+package com.demo.wjj.bo;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * 用户注册
+ * @author wangqing
+ * @date 2018.11.10
+ */
+public class UserRegisterBo {
+
+    /**
+     * 角色 - 销售员
+     */
+    public static final int ROLE_SALE = 1;
+
+    /**
+     * 角色 - 车商
+     */
+    public static final int ROLE_DIGGER_AGENT = 2;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 角色
+     */
+    private Integer role;
+
+    /**
+     * 品牌id,多个用逗号隔开
+     */
+    private String brandId;
+
+    /**
+     * 省份id
+     */
+    private Integer provinceId;
+
+    /**
+     * 地市id
+     */
+    private Integer cityId;
+
+    /**
+     * 区县id
+     */
+    private Integer countyId;
+
+    /**
+     * 短信验证码
+     */
+    private String code;
+
+    /**
+     * 微信openId
+     */
+    private String openId;
+
+    /**
+     * 商家id
+     */
+    private String agentId;
+
+    /**
+     * 微信用户昵称
+     */
+    private String nickname;
+
+    @Override
+    public String toString() {
+        return JSON.toJSONString(this);
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getRole() {
+        return role;
+    }
+
+    public void setRole(Integer role) {
+        this.role = role;
+    }
+
+    public String getBrandId() {
+        return brandId;
+    }
+
+    public void setBrandId(String brandId) {
+        this.brandId = brandId;
+    }
+
+    public Integer getProvinceId() {
+        return provinceId;
+    }
+
+    public void setProvinceId(Integer provinceId) {
+        this.provinceId = provinceId;
+    }
+
+    public Integer getCityId() {
+        return cityId;
+    }
+
+    public void setCityId(Integer cityId) {
+        this.cityId = cityId;
+    }
+
+    public Integer getCountyId() {
+        return countyId;
+    }
+
+    public void setCountyId(Integer countyId) {
+        this.countyId = countyId;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+}

+ 69 - 0
wjj-core/src/main/java/com/demo/wjj/bo/WeiXinParameter.java

@@ -0,0 +1,69 @@
+package com.demo.wjj.bo;
+
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * <p>
+ *
+ * @author wangqing
+ * @date 2019/02/10
+ */
+public abstract class WeiXinParameter {
+
+    /**
+     * 获取属性集合
+     * @return 属性集合
+     */
+    protected abstract Map<String, String> getAttributeMap();
+
+    /**
+     * 创建请求参数
+     * @return 请求参数
+     */
+    public Map<String, String> createRequestParameter() {
+        final Map<String, String> attributeMap = getAttributeMap();
+        Iterator<String> iterator = attributeMap.keySet().iterator();
+
+        Map<String, String> parameter = new HashMap<>();
+        String attribute;
+        String name;
+        Object valueObj;
+        BeanWrapper bean = new BeanWrapperImpl(this);
+        while (iterator.hasNext()) {
+            attribute = iterator.next();
+            name = attributeMap.get(attribute);
+            valueObj = bean.getPropertyValue(attribute);
+            if (valueObj != null) {
+                parameter.put(name, valueObj.toString());
+            }
+        }
+        return parameter;
+    }
+
+    @Override
+    public String toString() {
+        final Map<String, String> attributeMap = getAttributeMap();
+        Iterator<String> iterator = attributeMap.keySet().iterator();
+        String attribute;
+        StringBuilder xmlStr = new StringBuilder("<xml>");
+        String tag;
+        BeanWrapper bean = new BeanWrapperImpl(this);
+        while (iterator.hasNext()) {
+            attribute = iterator.next();
+            Object valueObj = bean.getPropertyValue(attribute);
+            if (valueObj != null) {
+                tag = attributeMap.get(attribute);
+                xmlStr.append("<").append(tag).append(">")
+                        .append(valueObj.toString())
+                        .append("</").append(tag).append(">");
+            }
+        }
+        xmlStr.append("</xml>");
+        return xmlStr.toString();
+    }
+}

+ 48 - 0
wjj-core/src/main/java/com/demo/wjj/bo/WeiXinUserBo.java

@@ -0,0 +1,48 @@
+package com.demo.wjj.bo;
+
+/**
+ * 微信用户信息
+ * @author wangqing
+ * @date 2018.11.23
+ */
+public class WeiXinUserBo {
+
+    /**
+     * openId
+     */
+    private String openId;
+
+    /**
+     * accessToken
+     */
+    private String accessToken;
+
+    /**
+     * 昵称
+     */
+    private String nickname;
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    public void setAccessToken(String accessToken) {
+        this.accessToken = accessToken;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+}

+ 65 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/AgentMapper.java

@@ -0,0 +1,65 @@
+package com.demo.wjj.mapper;
+
+import com.demo.wjj.po.Agent;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 商家
+ * @author wangqing
+ * @date 2018.11.11
+ */
+public interface AgentMapper {
+
+    /**
+     * 查询商家
+     * @param id 商家id
+     * @return 商家
+     */
+    Agent selectAgent(String id);
+
+    /**
+     * 查询商家
+     * @param id 商家id
+     * @return 商家
+     */
+    Agent selectAgentOfId(String id);
+
+    /**
+     * 查询商家
+     * @param appId appId
+     * @return
+     */
+    Agent selectAgentOfAppId(String appId);
+
+    /**
+     * 更新商家信息
+     * @param id 商家id
+     * @param authorizerAppId 公众号id
+     * @param name 公众号名称
+     * @return 影响记录数
+     */
+    int updateAgentInfo(@Param("id") String id,@Param("authorizerAppId") String authorizerAppId, @Param("name") String name);
+
+    /**
+     * 更新商家小程序appId
+     * @param id id
+     * @param authorizerAppId appId
+     * @return 影响记录数
+     */
+    int updateXcxAppId(@Param("id") String id,@Param("authorizerAppId") String authorizerAppId);
+
+    /**
+     * 检查当前的商户限制销售员数
+     * @param agentId
+     * @return
+     */
+    Integer checkSaleNum(String agentId);
+
+    /**
+     * 查询积分系统状态
+     * @param agentId
+     * @return
+     */
+    Agent selectInteg(String agentId);
+
+}

+ 35 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/AttrContentMapper.java

@@ -0,0 +1,35 @@
+package com.demo.wjj.mapper;
+
+import com.demo.wjj.po.AttrContent;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 属性内容
+ * @author wangqing
+ * @date 2018.11.11
+ */
+public interface AttrContentMapper {
+
+    /**
+     * 插入属性内容
+     * @param attrContentList 属性内容集合
+     * @return 影响记录数
+     */
+    int insertList(@Param("attrContentList") List<AttrContent> attrContentList);
+
+    /**
+     * 更新属性内容为删除
+     * @param displaceId 置换id
+     * @return 影响记录数
+     */
+    int updateAttrContentsDelete(String displaceId);
+
+    /**
+     * 查询属性内容集合
+     * @param displaceIdList 置换id
+     * @return 属性内容集合
+     */
+    List<AttrContent> selectAttrContentList(@Param("displaceIdList") List<String> displaceIdList);
+}

+ 38 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/AuthenticationMapper.java

@@ -0,0 +1,38 @@
+package com.demo.wjj.mapper;
+
+import com.demo.wjj.po.Authentication;
+import org.apache.ibatis.annotations.Param;
+
+
+public interface AuthenticationMapper {
+    /**
+     * 插入车商认证信息
+     * @param authentication
+     * @return
+     */
+    boolean insert(Authentication authentication);
+
+
+
+    /**
+     * 查询审核列表
+     * @param id 标识符
+     * @return
+     */
+    Authentication selectById(String id);
+
+    /**
+     * 查询审核列表
+     * @param userId
+     * @return
+     */
+    Authentication selectByUserId(String userId);
+
+    /**
+     * 删除审核列表
+     * @param userId
+     * @return
+     */
+    int delete(String userId);
+
+}

+ 22 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/BrandMapper.java

@@ -0,0 +1,22 @@
+package com.demo.wjj.mapper;
+
+import com.demo.wjj.po.Brand;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 品牌
+ * @author wangqing
+ * @date 2018.11.10
+ */
+public interface BrandMapper {
+
+    /**
+     * 查询品牌
+     * @param ids id
+     * @return 品牌集合
+     */
+    List<Brand> selectBrandList(@Param("ids") List<Integer> ids);
+
+}

+ 0 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/CreditsExchangeMapper.java


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