Commit b6f402c7 authored by 张大伟's avatar 张大伟

添加新功能

parent 44fe55af
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
<root url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/lib" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/lib" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.adc:adc-da-base:2.0.0" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-util:2.2.41" level="project" />
<orderEntry type="library" name="Maven: eu.bitwalker:UserAgentUtils:1.20" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: net.sf.dozer:dozer:5.4.0" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.5" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: commons-configuration:commons-configuration:1.10" level="project" />
<orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:4.1.0" level="project" />
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.0" level="project" />
<orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk14:1.58" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-sys:2.2.1" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-swagger:2.0.0" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger2:2.6.1" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.10" level="project" />
<orderEntry type="library" name="Maven: io.swagger:swagger-models:1.5.10" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spi:2.6.1" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-core:2.6.1" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-schema:2.6.1" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-common:2.6.1" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-spring-web:2.6.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mapstruct:mapstruct:1.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: io.springfox:springfox-swagger-ui:2.6.1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.0" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.4.0-RC2" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-file:2.2.0" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-gen:2.0.0" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2" level="project" />
<orderEntry type="library" name="Maven: com.adc:adc-da-druid:2.0.0" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.1.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:1.5.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:2.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.10.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.21" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.5.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.1.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.8" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jetty:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlets:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-continuation:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-webapp:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-xml:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-server:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-servlet:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:javax-websocket-server-impl:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-annotations:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-plus:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.1" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-commons:5.0.1" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-tree:5.0.1" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:javax-websocket-client-impl:9.2.24.v20180105" level="project" />
<orderEntry type="library" name="Maven: javax.websocket:javax.websocket-api:1.0" level="project" />
<orderEntry type="library" name="Maven: org.mortbay.jasper:apache-el:8.0.33" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.0" level="project" />
<orderEntry type="library" name="Maven: net.sourceforge.javacsv:javacsv:2.0" level="project" />
<orderEntry type="library" name="Maven: net.sf.opencsv:opencsv:2.3" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.9" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:19.0" level="project" />
<orderEntry type="library" name="Maven: com.mashape.unirest:unirest-java:1.4.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.6" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20140107" level="project" />
<orderEntry type="library" name="Maven: com.oracle:ojdbc7:12.1.0.1" level="project" />
<orderEntry type="library" name="Maven: net.sf.json-lib:json-lib:jdk15:2.4" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.1" level="project" />
<orderEntry type="library" name="Maven: io.dropwizard.metrics:metrics-core:3.1.5" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.21" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.5" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.46" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.16" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.16" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
<orderEntry type="module-library">
<library name="Maven: com.adc:cvdecs-service:1.0.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/src/main/lib/cvde-service.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: com.adc:cvdecs-part:1.0.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/src/main/lib/cvdecs-part-1.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: com.adc:cvdecs-setvec:1.0.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/src/main/lib/cvdecs-setvec-1.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.jvnet.hudson:ganymed-ssh2:build210-hudson-1" level="project" />
<orderEntry type="library" name="Maven: org.apache.camel:camel-ftp:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.camel:camel-core:2.13.2" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.6" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.50" level="project" />
<orderEntry type="library" name="Maven: commons-net:commons-net:3.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.11.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.7" level="project" />
<orderEntry type="library" name="Maven: com.github.ulisesbocchio:jasypt-spring-boot-starter:1.18" level="project" />
<orderEntry type="library" name="Maven: com.github.ulisesbocchio:jasypt-spring-boot:1.18" level="project" />
<orderEntry type="library" name="Maven: org.jasypt:jasypt:1.9.2" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.22.Final" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -214,7 +214,6 @@
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
......@@ -226,29 +225,6 @@
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>cvdecs-service</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/cvde-service.jar</systemPath>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>cvdecs-part</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/cvdecs-part-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>cvdecs-setvec</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/lib/cvdecs-setvec-1.0.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.jvnet.hudson</groupId>
<artifactId>ganymed-ssh2</artifactId>
......
package com.adc.da.znks.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.znks.entity.Gateway;
import com.adc.da.znks.entity.ResponseEntity;
import com.adc.da.znks.service.GatewayService;
import com.adc.da.znks.util.GenResponse;
import io.swagger.annotations.Api;
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.RestController;
/**
* @author David
*/
@RestController
@RequestMapping("/api/gateway")
@Api(description = "| Gateway |")
public class GatewayController extends BaseController<Gateway> {
@Autowired
private GatewayService gatewayService;
@PostMapping("")
public ResponseEntity addGateway(Gateway gateway) {
return GenResponse.success();
}
}
package com.adc.da.znks.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.util.http.PageInfo;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.adc.da.znks.entity.ResponseEntity;
import com.adc.da.znks.entity.User;
import com.adc.da.znks.page.UserPage;
import com.adc.da.znks.service.UserService;
import com.adc.da.znks.util.GenResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
......@@ -16,9 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/entity/users")
@Api(description = "|User|")
......@@ -30,54 +24,34 @@ public class UserController extends BaseController<User> {
private static final Logger log = LoggerFactory.getLogger(UserController.class);
// @ApiOperation(value = "|User|分页查询")
// @GetMapping("/page")
// public ResponseMessage<PageInfo<User>> page(UserPage page) throws Exception {
// List<User> rows = userService.queryByPage(page);
// return Result.success(getPageInfo(page.getPager(), rows));
// }
//
// @ApiOperation(value = "|User|查询")
// @GetMapping("")
// public ResponseMessage<List<User>> list(UserPage page) throws Exception {
// return Result.success(userService.queryByList(page));
// }
// @ApiOperation(value = "|User|详情")
// @GetMapping("/user/{id}")
// public ResponseMessage<User> find(@PathVariable Integer id) throws Exception {
// return Result.success(userService.selectByPrimaryKey(id));
// }
@ApiOperation(value = "|User|登录或者注册用户")
@PostMapping(value = {"/loginOrRegisterUser"})
public ResponseMessage<String> loginOrRegisterUser(@RequestBody User user) throws Exception {
public ResponseEntity<String> loginOrRegisterUser(@RequestBody User user) throws Exception {
log.info("user: {}", user);
String id = userService.loginOrRegister(user.getTemphone(), user.getPlainPassword());
if (id != null) {
return Result.success(String.valueOf(HttpStatus.OK.value()), "登录或者注册用户成功", id);
return GenResponse.success(String.valueOf(HttpStatus.OK.value()), "登录或者注册用户成功", id);
} else {
return Result.error(String.valueOf(HttpStatus.OK.value()), "登录或者注册用户失败", id);
return GenResponse.fail("登录或者注册用户失败");
}
}
@ApiOperation(value = "|User|登录或者注册用户")
@GetMapping(value = {"/isRegister"})
public ResponseEntity<Boolean> isRegister(String phoneNumber) {
boolean flag = userService.getUserByPhoneNumber(phoneNumber);
return GenResponse.success(String.valueOf(HttpStatus.OK.value()), "登录或者注册用户成功", flag);
}
@ApiOperation(value = "|User|更新密码")
@PostMapping("/updatePassword")
public ResponseMessage<String> update(@RequestBody User user) throws Exception {
public ResponseEntity<String> update(@RequestBody User user) throws Exception {
String id = userService.updatePassword(user);
if (id != null) {
return Result.success(String.valueOf(HttpStatus.OK.value()), "更新密码成功", id);
return GenResponse.success(String.valueOf(HttpStatus.OK.value()), "更新密码成功", id);
} else {
return Result.error(String.valueOf(HttpStatus.OK.value()), "更新密码失败", id);
return GenResponse.fail("更新密码失败");
}
}
// @ApiOperation(value = "|User|删除")
// @DeleteMapping("/user/{id}")
// public ResponseMessage delete(@PathVariable Integer id) throws Exception {
// userService.deleteByPrimaryKey(id);
// log.info("delete from tb_user where id = {}", id);
// return Result.success();
// }
}
package com.adc.da.znks.dao;
import com.adc.da.base.dao.BaseDao;
import com.adc.da.znks.entity.Gateway;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GatewayDao extends BaseDao<Gateway> {
/**
* 根据手机号查询网关相关信息
* @param phoneNumber
* @return
*/
Gateway getByPhoneNumber(String phoneNumber);
}
......@@ -4,6 +4,8 @@ package com.adc.da.znks.dao;
import com.adc.da.base.dao.BaseDao;
import com.adc.da.znks.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
*
......@@ -13,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserDao extends BaseDao<User> {
@Select("SELECT * FROM tb_user WHERE tempphone = #{phoneNumber}")
User getUserByPhoneNumber(@Param("phoneNumber") String phoneNumber);
}
package com.adc.da.znks.entity;
import com.adc.da.base.entity.BaseEntity;
/**
* @author David
*/
public class Gateway extends BaseEntity {
private int id;
private String macAddress;
private String ip;
private int userId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
}
package com.adc.da.znks.entity;
/**
* <pre>
* author : David
* e-mail : 990860210@qq.com
* time : 2018/08/14
* desc :
* version: 1.0
* </pre>
*/
public class ResponseEntity<T> {
private String respCode;
private T data;
private boolean ok;
private String message;
public String getRespCode() {
return respCode;
}
public void setRespCode(String respCode) {
this.respCode = respCode;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public boolean isOk() {
return ok;
}
public void setOk(boolean ok) {
this.ok = ok;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "ResponseEntity{" +
"respCode='" + respCode + '\'' +
", data=" + data +
", ok=" + ok +
", message='" + message + '\'' +
'}';
}
}
package com.adc.da.znks.service;
import com.adc.da.base.dao.BaseDao;
import com.adc.da.base.service.BaseService;
import com.adc.da.znks.dao.GatewayDao;
import com.adc.da.znks.entity.Gateway;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* @author David
*/
@Service("userService")
@Transactional(value = "transactionManager", propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class GatewayService extends BaseService<Gateway, Integer> {
private static final Logger logger = LoggerFactory.getLogger(GatewayService.class);
@Autowired(required = false)
private GatewayDao dao;
@Override
public BaseDao<Gateway> getDao() {
return dao;
}
}
......@@ -35,10 +35,20 @@ public class UserService extends BaseService<User, String> {
@Autowired(required = false)
private UserDao dao;
@Override
public UserDao getDao() {
return dao;
}
public Boolean getUserByPhoneNumber(String phoneNumber) {
Boolean flag = false;
User user = dao.getUserByPhoneNumber(phoneNumber);
if(user != null) {
flag = true;
}
return flag;
}
/**
* update password
**/
......
package com.adc.da.znks.util;
import com.adc.da.znks.entity.ResponseEntity;
public class GenResponse {
public static <T> ResponseEntity<T> success(String respCode, String messgae, T data) {
ResponseEntity responseEntity = new ResponseEntity();
responseEntity.setData(data);
responseEntity.setOk(true);
responseEntity.setMessage(messgae);
responseEntity.setRespCode(respCode);
return responseEntity;
}
public static <T> ResponseEntity<T> success() {
ResponseEntity responseEntity = new ResponseEntity();
responseEntity.setOk(true);
return responseEntity;
}
public static ResponseEntity fail(String messgae) {
ResponseEntity responseEntity = new ResponseEntity();
responseEntity.setOk(false);
responseEntity.setMessage(messgae);
return responseEntity;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.znks.dao.GatewayDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.znks.entity.Gateway">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="mac_address" property="macAddress"/>
<result column="ip" property="ip"/>
</resultMap>
<!-- tb_position table all fields -->
<sql id="Base_Column_List">
id, user_id, mac_address, ip
</sql>
<select id="getByPhoneNumber" resultType="com.adc.da.znks.entity.Gateway">
select * from tb_gateway,tb_user
where tb_gateway.user_id = tb_user.id
and tb_user.temphone = #{phoneNumber}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment