Sfoglia il codice sorgente

修改配置文件。

zhengqiang 5 anni fa
parent
commit
71663089da

+ 6 - 53
lapi/pom.xml

@@ -27,18 +27,18 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-tx</artifactId>
+            <scope>compile</scope>
+        </dependency>
+
         <dependency>
             <groupId>com.jpsoft.smart</groupId>
             <artifactId>common</artifactId>
             <version>1.0.0</version>
         </dependency>
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
     </dependencies>
-
     <build>
         <plugins>
             <plugin>
@@ -51,51 +51,4 @@
             </plugin>
         </plugins>
     </build>
-
-    <profiles>
-        <profile>
-            <id>dev</id>
-            <dependencies>
-                <dependency>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-tomcat</artifactId>
-                </dependency>
-            </dependencies>
-            <properties>
-                <active.profile>dev</active.profile>
-            </properties>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-        </profile>
-        <profile>
-            <id>test</id>
-            <dependencies>
-                <dependency>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>javax.servlet-api</artifactId>
-                    <version>3.1.0</version>
-                    <scope>provided</scope>
-                </dependency>
-            </dependencies>
-            <properties>
-                <active.profile>test</active.profile>
-            </properties>
-        </profile>
-        <profile>
-            <id>production</id>
-            <properties>
-                <active.profile>production</active.profile>
-            </properties>
-            <dependencies>
-                <dependency>
-                    <groupId>javax.servlet</groupId>
-                    <artifactId>javax.servlet-api</artifactId>
-                    <version>3.1.0</version>
-                    <scope>provided</scope>
-                </dependency>
-            </dependencies>
-        </profile>
-    </profiles>
-
 </project>

+ 2 - 5
lapi/src/main/java/com/jpsoft/smart/lapi/LapiApplication.java

@@ -3,7 +3,6 @@ package com.jpsoft.smart.lapi;
 import com.jpsoft.smart.lapi.handler.HeartReportHandler;
 import com.jpsoft.smart.lapi.handler.ParseRequestHandler;
 import com.jpsoft.smart.lapi.handler.PersonVerificationHandler;
-import com.jpsoft.smart.lapi.handler.TextDecodeHandler;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
@@ -19,7 +18,6 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 import javax.annotation.PreDestroy;
@@ -28,7 +26,6 @@ import javax.annotation.PreDestroy;
 @SpringBootApplication
 @EnableTransactionManagement
 @MapperScan("com.jpsoft.smart.**.dao")
-@ComponentScan("com.jpsoft.smart.**")
 public class LapiApplication implements CommandLineRunner {
     public static void main(String[] args) {
         SpringApplication.run(LapiApplication.class, args);
@@ -57,10 +54,10 @@ public class LapiApplication implements CommandLineRunner {
                 .childHandler(new ChannelInitializer(){
                     @Override
                     protected void initChannel(Channel channel) throws Exception {
-				channel.pipeline().addLast(new TextDecodeHandler());
+//				channel.pipeline().addLast(new TextDecodeHandler());
 //				channel.pipeline().addLast(new HttpRequestDecoder());
                         channel.pipeline().addLast(new HttpServerCodec());
-                        channel.pipeline().addLast(new HttpObjectAggregator(2048*10000*10));
+                        channel.pipeline().addLast(new HttpObjectAggregator(2048*10000));
                         channel.pipeline().addLast(new ParseRequestHandler());
                         channel.pipeline().addLast(heartReportHandler);
                         channel.pipeline().addLast(personVerificationHandler);

+ 16 - 0
lapi/src/main/resources/application-dev.yml

@@ -0,0 +1,16 @@
+server:
+  port: 9988
+
+spring:
+  datasource:
+    url: jdbc:log4jdbc:mysql://192.168.33.20:3306/smart-community?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    username: smart
+    password: smart
+  devtools:
+    add-properties: false
+    restart:
+      enabled: true
+
+logger:
+  level: WARN
+  dir: E:\mye\WORK\wisdowHouse

+ 84 - 2
lapi/src/main/resources/application.yml

@@ -1,2 +1,84 @@
-server:
-  port: 9988
+spring:
+  datasource:
+    driver-class-name: net.sf.log4jdbc.DriverSpy
+    type: com.alibaba.druid.pool.DruidDataSource
+    druid:
+      # 连接池的配置信息
+      # 初始化大小,最小,最大
+      initial-size: 5
+      min-idle: 5
+      maxActive: 20
+      # 配置获取连接等待超时的时间
+      maxWait: 60000
+      # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      timeBetweenEvictionRunsMillis: 60000
+      # 配置一个连接在池中最小生存的时间,单位是毫秒
+      minEvictableIdleTimeMillis: 300000
+      validationQuery: SELECT 1
+      testWhileIdle: true
+      testOnBorrow: false
+      testOnReturn: false
+      # 打开PSCache,并且指定每个连接上PSCache的大小
+      poolPreparedStatements: true
+      maxPoolPreparedStatementPerConnectionSize: 20
+      # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+      filters: stat,wall
+      # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
+      connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
+      # 配置DruidStatFilter
+      web-stat-filter:
+        enabled: true
+        url-pattern: "/*"
+        exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+      # 配置DruidStatViewServlet
+      stat-view-servlet:
+        url-pattern: "/druid/*"
+        # IP白名单(没有配置或者为空,则允许所有访问)
+        allow:
+        # IP黑名单 (存在共同时,deny优先于allow)
+        deny:
+        #  禁用HTML页面上的“Reset All”功能
+        reset-enable: false
+        # 登录名
+        login-username: admin
+        # 登录密码
+        login-password: jpsoft
+  devtools:
+    restart:
+      enabled: true
+  profiles:
+    active: dev
+  redis:
+    # Redis数据库索引(默认为0)
+    database: 1
+    # Redis服务器地址
+    host: 192.168.33.21
+    #host: 127.0.0.1
+    # Redis服务器连接端口
+    port: 6379
+    # Redis服务器连接密码(默认为空)
+    password:
+    #password: 123456
+    # 连接池最大连接数(使用负值表示没有限制)
+    pool:
+      max-active: 8
+      # 连接池最大阻塞等待时间(使用负值表示没有限制)
+      max-wait: -1
+      # 连接池中的最大空闲连接
+      max-idle: 8
+      # 连接池中的最小空闲连接
+      min-idle: 0
+      # 连接超时时间(毫秒)
+      timeout: 0
+
+mybatis:
+  typeAliasesPackage: com.jpsoft.smart.**.entity
+  mapperLocations: classpath*:mapper/**/*.xml
+  configuration:
+    default-statement-timeout: 60
+
+pagehelper:
+  helperDialect: mysql
+  reasonable: true
+  supportMethodsArguments: true
+  params: count=countSql

+ 2 - 1
web/src/main/java/com/jpsoft/smart/config/WebMvcConfig.java

@@ -58,6 +58,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/base/informationInfo/addMobile")
 				.excludePathPatterns("/base/employeeInfo/mobile/**")
 				.excludePathPatterns("/base/companyInfo/list")
-				.excludePathPatterns("/wechat/**");
+				.excludePathPatterns("/wechat/**")
+				.excludePathPatterns("/mobile/**");
 	}
 }

+ 9 - 4
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonInfoApiController.java

@@ -46,14 +46,15 @@ public class PersonInfoApiController {
             @ApiImplicitParam(name="name",value = "照片名称",required = true,paramType = "form"),
             @ApiImplicitParam(name = "phone",value = "电话号码", required = true,paramType="form")
     })
-    public MessageResult<PersonInfo> findByNameAndPhone(String name,String phone){
-        MessageResult<PersonInfo> messageResult = new MessageResult<>();
+    public MessageResult<Long> findByNameAndPhone(String name,String phone){
+        MessageResult<Long> messageResult = new MessageResult<>();
 
         try {
             PersonInfo personInfo = personInfoService.findByNameAndPhone(name, phone);
 
-            messageResult.setData(personInfo);
+            messageResult.setData(personInfo.getId());
             messageResult.setResult(true);
+            messageResult.setCode(200);
         }
         catch (Exception ex){
             messageResult.setResult(false);
@@ -76,6 +77,7 @@ public class PersonInfoApiController {
 
             messageResult.setData(personInfo);
             messageResult.setResult(true);
+            messageResult.setCode(200);
         }
         catch (Exception ex){
             messageResult.setResult(false);
@@ -114,6 +116,9 @@ public class PersonInfoApiController {
                 //设置当前用户的验证码,60秒后过期
                 valueOperations.set(key, verifyCode, 60000, TimeUnit.SECONDS);
             }
+
+            messageResult.setResult(true);
+            messageResult.setCode(200);
         }
         catch (Exception ex){
             messageResult.setResult(false);
@@ -123,7 +128,7 @@ public class PersonInfoApiController {
         return messageResult;
     }
 
-    @PostMapping("mobile/upload")
+    @PostMapping("upload")
     @ApiOperation(value="人员照片上传")
     @ApiImplicitParams({
             @ApiImplicitParam(name="photoName",value = "照片名称",required = true,paramType = "form"),