Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
znks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王夏晖
znks
Commits
b6f402c7
Commit
b6f402c7
authored
Sep 06, 2018
by
张大伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加新功能
parent
44fe55af
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
273 additions
and
279 deletions
+273
-279
adc-da-main.iml
adc-da-main/adc-da-main.iml
+0
-214
pom.xml
adc-da-main/pom.xml
+0
-24
GatewayController.java
...in/java/com/adc/da/znks/controller/GatewayController.java
+31
-0
UserController.java
.../main/java/com/adc/da/znks/controller/UserController.java
+15
-41
GatewayDao.java
...da-main/src/main/java/com/adc/da/znks/dao/GatewayDao.java
+17
-0
UserDao.java
adc-da-main/src/main/java/com/adc/da/znks/dao/UserDao.java
+5
-0
Gateway.java
...da-main/src/main/java/com/adc/da/znks/entity/Gateway.java
+49
-0
ResponseEntity.java
.../src/main/java/com/adc/da/znks/entity/ResponseEntity.java
+63
-0
GatewayService.java
...src/main/java/com/adc/da/znks/service/GatewayService.java
+32
-0
UserService.java
...in/src/main/java/com/adc/da/znks/service/UserService.java
+10
-0
GenResponse.java
...-main/src/main/java/com/adc/da/znks/util/GenResponse.java
+29
-0
cvde-service.jar
adc-da-main/src/main/lib/cvde-service.jar
+0
-0
cvdecs-part-1.0.0.jar
adc-da-main/src/main/lib/cvdecs-part-1.0.0.jar
+0
-0
cvdecs-setvec-1.0.0.jar
adc-da-main/src/main/lib/cvdecs-setvec-1.0.0.jar
+0
-0
GatewayMapper.xml
.../src/main/resources/mybatis/mapper/znks/GatewayMapper.xml
+22
-0
No files found.
adc-da-main/adc-da-main.iml
deleted
100644 → 0
View file @
44fe55af
This diff is collapsed.
Click to expand it.
adc-da-main/pom.xml
View file @
b6f402c7
...
@@ -214,7 +214,6 @@
...
@@ -214,7 +214,6 @@
<artifactId>
spring-boot-starter-jdbc
</artifactId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
<artifactId>
httpclient
</artifactId>
...
@@ -226,29 +225,6 @@
...
@@ -226,29 +225,6 @@
<version>
4.5.2
</version>
<version>
4.5.2
</version>
</dependency>
</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>
<dependency>
<groupId>
org.jvnet.hudson
</groupId>
<groupId>
org.jvnet.hudson
</groupId>
<artifactId>
ganymed-ssh2
</artifactId>
<artifactId>
ganymed-ssh2
</artifactId>
...
...
adc-da-main/src/main/java/com/adc/da/znks/controller/GatewayController.java
0 → 100644
View file @
b6f402c7
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
();
}
}
adc-da-main/src/main/java/com/adc/da/znks/controller/UserController.java
View file @
b6f402c7
package
com
.
adc
.
da
.
znks
.
controller
;
package
com
.
adc
.
da
.
znks
.
controller
;
import
com.adc.da.base.web.BaseController
;
import
com.adc.da.base.web.BaseController
;
import
com.adc.da.util.http.PageInfo
;
import
com.adc.da.znks.entity.ResponseEntity
;
import
com.adc.da.util.http.ResponseMessage
;
import
com.adc.da.util.http.Result
;
import
com.adc.da.znks.entity.User
;
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.service.UserService
;
import
com.adc.da.znks.util.GenResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -16,9 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,9 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/api/entity/users"
)
@RequestMapping
(
"/api/entity/users"
)
@Api
(
description
=
"|User|"
)
@Api
(
description
=
"|User|"
)
...
@@ -30,54 +24,34 @@ public class UserController extends BaseController<User> {
...
@@ -30,54 +24,34 @@ public class UserController extends BaseController<User> {
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
UserController
.
class
);
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|登录或者注册用户"
)
@ApiOperation
(
value
=
"|User|登录或者注册用户"
)
@PostMapping
(
value
=
{
"/loginOrRegisterUser"
})
@PostMapping
(
value
=
{
"/loginOrRegisterUser"
})
public
Response
Message
<
String
>
loginOrRegisterUser
(
@RequestBody
User
user
)
throws
Exception
{
public
Response
Entity
<
String
>
loginOrRegisterUser
(
@RequestBody
User
user
)
throws
Exception
{
log
.
info
(
"user: {}"
,
user
);
log
.
info
(
"user: {}"
,
user
);
String
id
=
userService
.
loginOrRegister
(
user
.
getTemphone
(),
user
.
getPlainPassword
());
String
id
=
userService
.
loginOrRegister
(
user
.
getTemphone
(),
user
.
getPlainPassword
());
if
(
id
!=
null
)
{
if
(
id
!=
null
)
{
return
Result
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"登录或者注册用户成功"
,
id
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"登录或者注册用户成功"
,
id
);
}
else
{
}
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|更新密码"
)
@ApiOperation
(
value
=
"|User|更新密码"
)
@PostMapping
(
"/updatePassword"
)
@PostMapping
(
"/updatePassword"
)
public
Response
Message
<
String
>
update
(
@RequestBody
User
user
)
throws
Exception
{
public
Response
Entity
<
String
>
update
(
@RequestBody
User
user
)
throws
Exception
{
String
id
=
userService
.
updatePassword
(
user
);
String
id
=
userService
.
updatePassword
(
user
);
if
(
id
!=
null
)
{
if
(
id
!=
null
)
{
return
Result
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"更新密码成功"
,
id
);
return
GenResponse
.
success
(
String
.
valueOf
(
HttpStatus
.
OK
.
value
()),
"更新密码成功"
,
id
);
}
else
{
}
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();
// }
}
}
adc-da-main/src/main/java/com/adc/da/znks/dao/GatewayDao.java
0 → 100644
View file @
b6f402c7
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
);
}
adc-da-main/src/main/java/com/adc/da/znks/dao/UserDao.java
View file @
b6f402c7
...
@@ -4,6 +4,8 @@ package com.adc.da.znks.dao;
...
@@ -4,6 +4,8 @@ package com.adc.da.znks.dao;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.base.dao.BaseDao
;
import
com.adc.da.znks.entity.User
;
import
com.adc.da.znks.entity.User
;
import
org.apache.ibatis.annotations.Mapper
;
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;
...
@@ -13,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
UserDao
extends
BaseDao
<
User
>
{
public
interface
UserDao
extends
BaseDao
<
User
>
{
@Select
(
"SELECT * FROM tb_user WHERE tempphone = #{phoneNumber}"
)
User
getUserByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
}
}
adc-da-main/src/main/java/com/adc/da/znks/entity/Gateway.java
0 → 100644
View file @
b6f402c7
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
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/entity/ResponseEntity.java
0 → 100644
View file @
b6f402c7
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
+
'\''
+
'}'
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/service/GatewayService.java
0 → 100644
View file @
b6f402c7
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
;
}
}
adc-da-main/src/main/java/com/adc/da/znks/service/UserService.java
View file @
b6f402c7
...
@@ -35,10 +35,20 @@ public class UserService extends BaseService<User, String> {
...
@@ -35,10 +35,20 @@ public class UserService extends BaseService<User, String> {
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
private
UserDao
dao
;
private
UserDao
dao
;
@Override
public
UserDao
getDao
()
{
public
UserDao
getDao
()
{
return
dao
;
return
dao
;
}
}
public
Boolean
getUserByPhoneNumber
(
String
phoneNumber
)
{
Boolean
flag
=
false
;
User
user
=
dao
.
getUserByPhoneNumber
(
phoneNumber
);
if
(
user
!=
null
)
{
flag
=
true
;
}
return
flag
;
}
/**
/**
* update password
* update password
**/
**/
...
...
adc-da-main/src/main/java/com/adc/da/znks/util/GenResponse.java
0 → 100644
View file @
b6f402c7
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
;
}
}
adc-da-main/src/main/lib/cvde-service.jar
deleted
100644 → 0
View file @
44fe55af
File deleted
adc-da-main/src/main/lib/cvdecs-part-1.0.0.jar
deleted
100644 → 0
View file @
44fe55af
File deleted
adc-da-main/src/main/lib/cvdecs-setvec-1.0.0.jar
deleted
100644 → 0
View file @
44fe55af
File deleted
adc-da-main/src/main/resources/mybatis/mapper/znks/GatewayMapper.xml
0 → 100644
View file @
b6f402c7
<?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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment