Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cneeds-server
Overview
Overview
Details
Activity
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
zhangzr
cneeds-server
Commits
475bb004
Commit
475bb004
authored
Mar 26, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.fix设备模块 生产配置
2.个人信息
parent
b242d937
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
394 additions
and
73 deletions
+394
-73
workspace.xml
.idea/workspace.xml
+0
-0
cneeds_server.sql
cneeds-common-data/db/cneeds_server.sql
+1
-1
SysUserEntity.java
.../main/java/com/mx/cneeds/server/entity/SysUserEntity.java
+4
-2
SysUserDao.xml
cneeds-common-data/src/main/resources/mapper/SysUserDao.xml
+1
-1
pom.xml
cneeds-common-pojo/pom.xml
+16
-3
DeviceInfoDto.java
...src/main/java/com/mx/cneeds/common/dto/DeviceInfoDto.java
+80
-0
UserDto.java
...-pojo/src/main/java/com/mx/cneeds/common/dto/UserDto.java
+18
-4
UserVo.java
...on-pojo/src/main/java/com/mx/cneeds/common/vo/UserVo.java
+6
-4
pom.xml
cneeds-common-utils/pom.xml
+5
-0
build.sh
cneeds-server-authorization/build.sh
+5
-5
pom.xml
cneeds-server-authorization/pom.xml
+4
-1
application.yml
...s-server-authorization/src/main/resources/application.yml
+1
-1
PasswordEncode.java
...ver-authorization/src/test/java/utils/PasswordEncode.java
+1
-1
pom.xml
cneeds-server-datashow/pom.xml
+15
-1
DeviceClient.java
...va/com/mx/cneeds/server/datashow/client/DeviceClient.java
+6
-0
OAuth2ResourceServer.java
...x/cneeds/server/datashow/config/OAuth2ResourceServer.java
+7
-0
DeviceController.java
...x/cneeds/server/datashow/web/device/DeviceController.java
+3
-2
SystemController.java
...x/cneeds/server/datashow/web/system/SystemController.java
+9
-1
UserController.java
.../mx/cneeds/server/datashow/web/system/UserController.java
+18
-2
application.yml
cneeds-server-datashow/src/main/resources/application.yml
+1
-1
pom.xml
cneeds-server-device/pom.xml
+4
-0
DeviceInfoService.java
...om/mx/cneeds/server/device/service/DeviceInfoService.java
+2
-0
DeviceInfoServiceImpl.java
...eds/server/device/service/impl/DeviceInfoServiceImpl.java
+7
-0
DeviceInfoController.java
...com/mx/cneeds/server/device/web/DeviceInfoController.java
+13
-0
application.yml
cneeds-server-device/src/main/resources/application.yml
+1
-1
pom.xml
cneeds-server-eureka/pom.xml
+0
-6
application-prod.yml
cneeds-server-eureka/src/main/resources/application-prod.yml
+2
-1
application.yml
cneeds-server-eureka/src/main/resources/application.yml
+1
-1
application-dev.yml
...s-server-logupload/src/main/resources/application-dev.yml
+57
-0
application.yml
cneeds-server-logupload/src/main/resources/application.yml
+33
-0
pom.xml
cneeds-server-user/pom.xml
+4
-0
SysFuncService.java
...ava/com/mx/cneeds/server/user/service/SysFuncService.java
+4
-0
SysUserFuncService.java
...com/mx/cneeds/server/user/service/SysUserFuncService.java
+1
-1
SysUserService.java
...ava/com/mx/cneeds/server/user/service/SysUserService.java
+2
-0
SysFuncServiceImpl.java
...x/cneeds/server/user/service/impl/SysFuncServiceImpl.java
+9
-1
SysUserServiceImpl.java
...x/cneeds/server/user/service/impl/SysUserServiceImpl.java
+46
-5
SysUserController.java
...java/com/mx/cneeds/server/user/web/SysUserController.java
+5
-4
application-dev.yml
cneeds-server-user/src/main/resources/application-dev.yml
+1
-1
application.yml
cneeds-server-user/src/main/resources/application.yml
+1
-1
pom.xml
pom.xml
+0
-21
No files found.
.idea/workspace.xml
View file @
475bb004
This diff is collapsed.
Click to expand it.
cneeds-common-data/db/cneeds_server.sql
View file @
475bb004
...
...
@@ -231,8 +231,8 @@ CREATE TABLE `sys_user` (
`user_id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'用户id'
,
`username`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'用户名'
,
`password`
varchar
(
100
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'密码'
,
`salt`
varchar
(
20
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'加密盐'
,
`email`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'邮箱'
,
`remark`
varchar
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'简介'
,
`mobile`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'手机'
,
`status`
int
(
11
)
DEFAULT
NULL
COMMENT
'账户状态 0:禁用 1:正常'
,
`create_time`
date
DEFAULT
NULL
COMMENT
'创建时间'
,
...
...
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysUserEntity.java
View file @
475bb004
...
...
@@ -32,10 +32,12 @@ public class SysUserEntity implements Serializable {
* 密码
*/
private
String
password
;
/**
*
加密盐
*
简介
*/
private
String
salt
;
private
String
remark
;
/**
* 邮箱
*/
...
...
cneeds-common-data/src/main/resources/mapper/SysUserDao.xml
View file @
475bb004
...
...
@@ -8,7 +8,7 @@
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"username"
column=
"username"
/>
<result
property=
"password"
column=
"password"
/>
<result
property=
"
salt"
column=
"salt
"
/>
<result
property=
"
remark"
column=
"remark
"
/>
<result
property=
"email"
column=
"email"
/>
<result
property=
"mobile"
column=
"mobile"
/>
<result
property=
"status"
column=
"status"
/>
...
...
cneeds-common-pojo/pom.xml
View file @
475bb004
...
...
@@ -15,12 +15,24 @@
<artifactId>
cneeds-common-pojo
</artifactId>
<
!--<
dependencies>
<dependency>
<dependencies>
<
!--<
dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<scope>
compile
</scope>
</dependency>
</dependencies>-->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceInfoDto.java
0 → 100644
View file @
475bb004
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @ClassName DeviceDto
* @Author zzrdark
* @Date 2020-03-25 18:51
* @Description TODO
**/
@Data
public
class
DeviceInfoDto
{
/**
* 设备id
*/
private
Long
deviceId
;
/**
*
*/
private
Long
deptId
;
/**
* imei
*/
private
String
imei
;
/**
* iccid
*/
private
String
iccid
;
/**
* 状态0未激活,1已激活
*/
private
String
status
;
/**
* 设备版本
*/
private
String
deviceVersion
;
/**
* 产品系列
*/
private
Long
seriesId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 激活时间
*/
private
Date
activeTime
;
/**
* 渠道号
*/
private
String
channelNums
;
/**
* 渠道号提示信息
*/
private
String
channelNumsMessage
;
/**
* 0:黑名单,1:白名单
*/
private
Integer
channelRules
;
/**
* 产品系列号
*/
private
String
seriesNum
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/UserDto.java
View file @
475bb004
...
...
@@ -26,10 +26,12 @@ public class UserDto implements Serializable {
* 密码
*/
private
String
password
;
/**
*
加密盐
*
简介
*/
private
String
salt
;
private
String
remark
;
/**
* 邮箱
*/
...
...
@@ -52,9 +54,21 @@ public class UserDto implements Serializable {
*/
private
Date
createTime
;
private
List
<
Long
>
funcIdList
;
/**
* 用户模块Id
*/
private
List
<
Long
>
userFuncIdList
;
/**
* 用户部门Id
*/
private
List
<
Long
>
userDeptIdList
;
/**
* 模块权限名
*/
private
List
<
String
>
funcPerms
;
private
List
<
Long
>
deptIdList
;
private
Long
roleId
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/UserVo.java
View file @
475bb004
...
...
@@ -27,10 +27,12 @@ public class UserVo implements Serializable {
* 密码
*/
private
String
password
;
/**
*
加密盐
*
简介
*/
private
String
salt
;
private
String
remark
;
/**
* 邮箱
*/
...
...
@@ -55,9 +57,9 @@ public class UserVo implements Serializable {
private
Date
createTime
;
private
List
<
Long
>
f
uncIdList
;
private
List
<
Long
>
userF
uncIdList
;
private
List
<
Long
>
d
eptIdList
;
private
List
<
Long
>
userD
eptIdList
;
private
Long
roleId
;
}
cneeds-common-utils/pom.xml
View file @
475bb004
...
...
@@ -43,6 +43,11 @@
<artifactId>
commons-io
</artifactId>
<version>
${commons.io.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
16.0
</version>
</dependency>
<dependency>
<groupId>
com.mx.cneeds
</groupId>
...
...
cneeds-server-authorization/build.sh
View file @
475bb004
...
...
@@ -7,9 +7,9 @@ mvn clean package -Dmaven.test.skip=true -U
#docker push hub.c.163.com/springcloud/eureka
docker build
-t
zzrdark/eureka
.
docker push zzrdark/eureka
#
docker build -t zzrdark/eureka .
#
docker push zzrdark/eureka
# docker build -t 192.168.2.244:5000/eureka
.
docker build
-t
192.168.2.244:5000/springcloud_authorization
.
# docker push 192.168.2.244:5000/eureka
\ No newline at end of file
docker push 192.168.2.244:5000/springcloud_authorization
\ No newline at end of file
cneeds-server-authorization/pom.xml
View file @
475bb004
...
...
@@ -16,7 +16,10 @@
<mysql.version>
8.0.16
</mysql.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<!-- eureka-client -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
...
...
cneeds-server-authorization/src/main/resources/application.yml
View file @
475bb004
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-authorization
server
:
...
...
cneeds-server-authorization/src/test/java/utils/PasswordEncode.java
View file @
475bb004
...
...
@@ -10,7 +10,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
**/
public
class
PasswordEncode
{
public
static
void
main
(
String
[]
args
)
{
String
password
=
"
admin
"
;
String
password
=
"
123456
"
;
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
();
String
enPassword1
=
encoder
.
encode
(
password
);
String
enPassword2
=
encoder
.
encode
(
password
);
...
...
cneeds-server-datashow/pom.xml
View file @
475bb004
...
...
@@ -14,7 +14,10 @@
<version>
1.0-SNAPSHOT
</version>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
...
...
@@ -53,6 +56,17 @@
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
</dependencies>
<build>
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/DeviceClient.java
View file @
475bb004
package
com
.
mx
.
cneeds
.
server
.
datashow
.
client
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.DevicesDto
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.dto.SeriesDto
;
...
...
@@ -38,12 +39,17 @@ public interface DeviceClient {
void
deleteSeries
(
@RequestBody
List
<
Long
>
ids
);
@PostMapping
(
"device/info/list"
)
PageDto
deviceList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
@RequestParam
(
"sidx"
)
String
orderField
,
@RequestParam
(
"order"
)
String
order
);
@PostMapping
(
"/device/info/infoByImei"
)
DeviceInfoDto
queryDeviceByImei
(
@RequestParam
String
imei
);
@PostMapping
(
"/device/info/importDevice"
)
void
importDevice
(
@RequestBody
DevicesDto
dto
);
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/config/OAuth2ResourceServer.java
View file @
475bb004
...
...
@@ -3,6 +3,7 @@ package com.mx.cneeds.server.datashow.config;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer
;
import
org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
;
import
org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer
;
...
...
@@ -49,4 +50,9 @@ public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
converter
.
setSigningKey
(
"imooc"
);
return
converter
;
}
@Bean
public
BCryptPasswordEncoder
bCryptPasswordEncoder
(){
return
new
BCryptPasswordEncoder
();
}
}
\ No newline at end of file
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/DeviceController.java
View file @
475bb004
...
...
@@ -34,8 +34,9 @@ public class DeviceController {
@GetMapping
(
"/device/getChannel"
)
public
R
getChannel_nums
(
String
imei
){
DeviceChannelVo
channelVo
=
new
DeviceChannelVo
(
"123456,112233,654321"
,
"提示的信息"
,
0
);
DeviceChannelVo
channelVo
=
new
DeviceChannelVo
();
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
imei
);
BeanUtils
.
copyProperties
(
deviceInfoDto
,
channelVo
);
return
new
R
().
put
(
"data"
,
channelVo
);
}
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/system/SystemController.java
View file @
475bb004
...
...
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
...
...
@@ -31,6 +32,9 @@ public class SystemController {
@Autowired
private
UserClient
userClient
;
@Autowired
private
BCryptPasswordEncoder
bCryptPasswordEncoder
;
@PostMapping
(
"/module/list"
)
public
R
funcList
(
@RequestParam
(
required
=
false
)
Integer
page
,
@RequestParam
(
required
=
false
)
Integer
pageSize
,
...
...
@@ -348,7 +352,6 @@ public class SystemController {
}
PageDto
pageDto
=
userClient
.
userList
(
page
,
pageSize
,
orderField
,
order
);
return
new
R
().
put
(
"data"
,
pageDto
);
}
...
...
@@ -361,6 +364,7 @@ public class SystemController {
@RequestMapping
(
"/user/add"
)
public
R
addUser
(
UserVo
vo
){
UserDto
dto
=
new
UserDto
();
vo
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
vo
.
getPassword
()));
BeanUtils
.
copyProperties
(
vo
,
dto
);
userClient
.
addUser
(
dto
);
return
R
.
ok
();
...
...
@@ -369,6 +373,10 @@ public class SystemController {
@PostMapping
(
"/user/update"
)
public
R
editUser
(
UserVo
vo
){
UserDto
dto
=
new
UserDto
();
if
(
StringUtils
.
isNotEmpty
(
vo
.
getPassword
())
&&
StringUtils
.
isNotBlank
(
vo
.
getPassword
().
trim
()))
{
vo
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
vo
.
getPassword
()));
}
BeanUtils
.
copyProperties
(
vo
,
dto
);
userClient
.
updateUser
(
dto
);
return
R
.
ok
();
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/system/UserController.java
View file @
475bb004
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
system
;
import
com.mx.cneeds.common.UserUtils
;
import
com.mx.cneeds.common.dto.UserDto
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.UserInfoVo
;
import
com.mx.cneeds.server.datashow.client.AuthorizationClient
;
...
...
@@ -49,10 +51,24 @@ public class UserController {
@RequestMapping
(
"/info"
)
public
R
getInfo
(){
UserDto
userDto
=
userClient
.
userInfo
(
UserUtils
.
getUserName
());
UserInfoVo
userInfoVo
=
new
UserInfoVo
();
userInfoVo
.
setName
(
"admin"
);
if
(
userDto
.
getUserId
()==
1
){
userInfoVo
.
setRoles
(
"admin"
);
}
else
{
StringBuffer
sb
=
new
StringBuffer
();
userDto
.
getFuncPerms
().
forEach
(
perms
->
{
sb
.
append
(
perms
+
","
);
});
sb
.
substring
(
0
,
sb
.
length
()-
2
);
userInfoVo
.
setRoles
(
sb
.
toString
());
}
userInfoVo
.
setName
(
userDto
.
getUsername
());
userInfoVo
.
setIntroduction
(
"manager"
);
userInfoVo
.
setRoles
(
"book:editor,admin"
);
userInfoVo
.
setAvatar
(
"avatar"
);
return
new
R
().
put
(
"data"
,
userInfoVo
);
}
...
...
cneeds-server-datashow/src/main/resources/application.yml
View file @
475bb004
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-datashow
...
...
cneeds-server-device/pom.xml
View file @
475bb004
...
...
@@ -15,6 +15,10 @@
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
...
...
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceInfoService.java
View file @
475bb004
...
...
@@ -19,5 +19,7 @@ public interface DeviceInfoService extends IService<DeviceInfoEntity> {
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
void
updateBatchByImei
(
List
<
DeviceInfoEntity
>
deviceInfoEntityList
);
DeviceInfoEntity
queryDeviceByImei
(
String
imei
);
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceInfoServiceImpl.java
View file @
475bb004
...
...
@@ -60,4 +60,11 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoDao, DeviceInfo
});
}
@Override
public
DeviceInfoEntity
queryDeviceByImei
(
String
imei
){
DeviceInfoEntity
deviceInfoEntity
=
getBaseMapper
().
selectOne
(
new
QueryWrapper
<
DeviceInfoEntity
>()
.
eq
(
"imei"
,
imei
));
return
deviceInfoEntity
;
}
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceInfoController.java
View file @
475bb004
...
...
@@ -2,12 +2,14 @@ package com.mx.cneeds.server.device.web;
import
java.util.*
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.DevicesDto
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.validator.ValidatorUtils
;
import
com.mx.cneeds.server.device.service.DeviceInfoService
;
import
com.mx.cneeds.server.entity.DeviceInfoEntity
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -52,6 +54,17 @@ public class DeviceInfoController {
}
/**
* 信息
*/
@RequestMapping
(
"/infoByImei"
)
public
DeviceInfoDto
infoByimei
(
String
imei
){
DeviceInfoEntity
deviceInfoEntity
=
deviceInfoService
.
queryDeviceByImei
(
imei
);
DeviceInfoDto
deviceInfoDto
=
new
DeviceInfoDto
();
BeanUtils
.
copyProperties
(
deviceInfoEntity
,
deviceInfoDto
);
return
deviceInfoDto
;
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
...
...
cneeds-server-device/src/main/resources/application.yml
View file @
475bb004
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-device
...
...
cneeds-server-eureka/pom.xml
View file @
475bb004
...
...
@@ -19,12 +19,6 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-server
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
cneeds-server-eureka/src/main/resources/application-prod.yml
View file @
475bb004
...
...
@@ -6,7 +6,8 @@ eureka:
## 单机的时候开启
register-with-eureka
:
false
fetch-registry
:
'
false'
# server:
server
:
use-read-only-response-cache
:
false
# enable-self-preservation: false
instance
:
prefer-ip-address
:
true
cneeds-server-eureka/src/main/resources/application.yml
View file @
475bb004
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-eureka
server
:
...
...
cneeds-server-logupload/src/main/resources/application-dev.yml
0 → 100644
View file @
475bb004
spring
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.2.244:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
password
:
cneeds!QAZ1qaz
username
:
root
# hikari:
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://192.168.2.244:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# username: root
# password: cneeds!QAZ1qaz
# datasource:
# type: com.alibaba.druid.pool.DruidDataSource
# druid:
# driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://192.168.2.244:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# username: root
# password: cneeds!QAZ1qaz
# initial-size: 10
# max-active: 100
# min-idle: 10
# max-wait: 60000
# pool-prepared-statements: true
# max-pool-prepared-statement-per-connection-size: 20
# time-between-eviction-runs-millis: 60000
# min-evictable-idle-time-millis: 300000
# #Oracle需要打开注释
# #validation-query: SELECT 1 FROM DUAL
# test-while-idle: true
# test-on-borrow: false
# test-on-return: false
# stat-view-servlet:
# enabled: true
# url-pattern: /druid/*
# #login-username: admin
# #login-password: admin
# filter:
# stat:
# log-slow-sql: true
# slow-sql-millis: 1000
# merge-sql: false
# wall:
# config:
# multi-statement-allow: true
eureka
:
client
:
service-url
:
defaultZone
:
http://192.168.2.244:8761/eureka/
instance
:
prefer-ip-address
:
true
ip-address
:
192.168.2.244
cneeds-server-logupload/src/main/resources/application.yml
0 → 100644
View file @
475bb004
spring
:
profiles
:
active
:
dev
application
:
name
:
cneeds-server-logupload
server
:
port
:
9003
servlet
:
context-path
:
/
mybatis-plus
:
mapper-locations
:
classpath:mapper/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage
:
com.mx.cneeds.server.entity
global-config
:
#数据库相关配置
db-config
:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type
:
AUTO
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy
:
NOT_NULL
#驼峰下划线转换
column-underline
:
true
logic-delete-value
:
-1
logic-not-delete-value
:
0
banner
:
false
#原生配置
configuration
:
map-underscore-to-camel-case
:
true
cache-enabled
:
false
call-setters-on-nulls
:
true
jdbc-type-for-null
:
'
null'
cneeds-server-user/pom.xml
View file @
475bb004
...
...
@@ -18,6 +18,10 @@
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysFuncService.java
View file @
475bb004
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.server.entity.SysFuncEntity
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -16,5 +18,7 @@ import java.util.Map;
public
interface
SysFuncService
extends
IService
<
SysFuncEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
List
<
SysFuncEntity
>
queryFuncByIds
(
Collection
<
Long
>
funcId
);
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysUserFuncService.java
View file @
475bb004
...
...
@@ -23,6 +23,6 @@ public interface SysUserFuncService extends IService<SysUserFuncEntity> {
void
saveOrUpdate
(
Long
userId
,
List
<
Long
>
menuIdList
);
List
<
Long
>
queryFuncIdList
(
Long
user
);
List
<
Long
>
queryFuncIdList
(
Long
user
Id
);
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysUserService.java
View file @
475bb004
...
...
@@ -29,6 +29,8 @@ public interface SysUserService extends IService<SysUserEntity> {
void
update
(
SysUserEntity
user
,
List
<
Long
>
funcIdList
,
List
<
Long
>
deptIdList
);
List
<
String
>
getUserPerms
(
String
username
);
String
genDataFilter
(
DataFilterDto
dataFilterDto
);
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysFuncServiceImpl.java
View file @
475bb004
...
...
@@ -6,6 +6,9 @@ import com.mx.cneeds.server.dao.SysFuncDao;
import
com.mx.cneeds.server.entity.SysFuncEntity
;
import
com.mx.cneeds.server.user.service.SysFuncService
;
import
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -22,8 +25,13 @@ public class SysFuncServiceImpl extends ServiceImpl<SysFuncDao, SysFuncEntity> i
new
Query
<
SysFuncEntity
>().
getPage
(
params
),
new
QueryWrapper
<
SysFuncEntity
>()
);
return
new
PageUtils
(
page
);
}
@Override
public
List
<
SysFuncEntity
>
queryFuncByIds
(
Collection
<
Long
>
funcId
){
List
<
SysFuncEntity
>
sysFuncEntities
=
getBaseMapper
().
selectBatchIds
(
funcId
);
return
sysFuncEntities
;
}
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysUserServiceImpl.java
View file @
475bb004
...
...
@@ -5,6 +5,7 @@ import com.mx.cneeds.common.dto.DataFilterDto;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.pager.Query
;
import
com.mx.cneeds.server.dao.SysUserDao
;
import
com.mx.cneeds.server.entity.SysFuncEntity
;
import
com.mx.cneeds.server.entity.SysUserEntity
;
import
com.mx.cneeds.server.user.service.*
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -37,6 +38,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
@Autowired
private
SysRoleDeptService
sysRoleDeptService
;
@Autowired
private
SysRoleFuncService
sysRoleFuncService
;
@Autowired
private
SysFuncService
sysFuncService
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
...
...
@@ -79,7 +86,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
//保存用户与角色关系
sysUserRoleService
.
saveOrUpdate
(
user
.
getUserId
(),
roleId
);
//保存角色与菜单关系
sysUserFuncService
.
saveOrUpdate
(
user
.
getUserId
(),
funcIdList
);
...
...
@@ -91,12 +97,47 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
SysUserEntity
user
,
List
<
Long
>
funcIdList
,
List
<
Long
>
deptIdList
)
{
this
.
updateById
(
user
);
if
(
funcIdList
!=
null
&&
funcIdList
.
size
()!=
0
){
//更新用户与菜单关系
sysUserFuncService
.
saveOrUpdate
(
user
.
getUserId
(),
funcIdList
);
}
//更新用户与菜单关系
sysUserFuncService
.
saveOrUpdate
(
user
.
getUserId
(),
funcIdList
);
if
(
deptIdList
!=
null
&&
deptIdList
.
size
()!=
0
){
//保存用户与部门关系
sysUserDeptService
.
saveOrUpdate
(
user
.
getUserId
(),
deptIdList
);
}
}
@Override
public
List
<
String
>
getUserPerms
(
String
username
){
SysUserEntity
sysUserEntity
=
queryUserByUsername
(
username
);
// 模块Id
Set
<
Long
>
funcIdList
=
new
HashSet
<>();
// 模块权限字段
List
<
String
>
funcPermsList
=
new
ArrayList
<>();
//用户角色对应的模块区权限
Long
roleId
=
sysUserRoleService
.
queryRoleId
(
sysUserEntity
.
getUserId
());
List
<
Long
>
funcList
=
sysRoleFuncService
.
queryFuncId
(
roleId
);
funcIdList
.
addAll
(
funcList
);
List
<
Long
>
userFuncList
=
sysUserFuncService
.
queryFuncIdList
(
sysUserEntity
.
getUserId
());
userFuncList
.
forEach
(
funcId
->
{
funcIdList
.
add
(
funcId
);
});
if
(
funcIdList
.
size
()
!=
0
){
List
<
SysFuncEntity
>
sysFuncEntities
=
sysFuncService
.
queryFuncByIds
(
funcIdList
);
sysFuncEntities
.
forEach
(
entity
->
{
funcPermsList
.
add
(
entity
.
getPerms
());
});
return
funcPermsList
;
}
else
{
return
null
;
}
//保存用户与部门关系
sysUserDeptService
.
saveOrUpdate
(
user
.
getUserId
(),
deptIdList
);
}
@Override
...
...
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysUserController.java
View file @
475bb004
...
...
@@ -75,8 +75,9 @@ public class SysUserController {
UserDto
userDto
=
new
UserDto
();
BeanUtils
.
copyProperties
(
sysUser
,
userDto
);
userDto
.
setRoleId
(
roleId
);
userDto
.
setDeptIdList
(
sysUserDeptService
.
queryDeptIdList
(
sysUser
.
getUserId
()));
userDto
.
setFuncIdList
(
sysUserFuncService
.
queryFuncIdList
(
sysUser
.
getUserId
()));
userDto
.
setUserDeptIdList
(
sysUserDeptService
.
queryDeptIdList
(
sysUser
.
getUserId
()));
userDto
.
setUserFuncIdList
(
sysUserFuncService
.
queryFuncIdList
(
sysUser
.
getUserId
()));
userDto
.
setFuncPerms
(
sysUserService
.
getUserPerms
(
userDto
.
getUsername
()));
return
userDto
;
}
...
...
@@ -90,7 +91,7 @@ public class SysUserController {
BeanUtils
.
copyProperties
(
dto
,
sysUser
);
sysUserService
.
saveUser
(
sysUser
,
dto
.
get
FuncIdList
(),
dto
.
get
DeptIdList
(),
dto
.
getRoleId
());
sysUserService
.
saveUser
(
sysUser
,
dto
.
get
UserFuncIdList
(),
dto
.
getUser
DeptIdList
(),
dto
.
getRoleId
());
return
R
.
ok
();
}
...
...
@@ -103,7 +104,7 @@ public class SysUserController {
BeanUtils
.
copyProperties
(
dto
,
sysUser
);
ValidatorUtils
.
validateEntity
(
sysUser
);
sysUserService
.
update
(
sysUser
,
dto
.
get
FuncIdList
(),
dto
.
get
DeptIdList
());
sysUserService
.
update
(
sysUser
,
dto
.
get
UserFuncIdList
(),
dto
.
getUser
DeptIdList
());
return
R
.
ok
();
}
...
...
cneeds-server-user/src/main/resources/application-dev.yml
View file @
475bb004
...
...
@@ -50,7 +50,7 @@ eureka:
defaultZone
:
http://192.168.2.244:8761/eureka/
instance
:
prefer-ip-address
:
true
ip-address
:
192.168.2.244
#
ip-address: 192.168.2.244
...
...
cneeds-server-user/src/main/resources/application.yml
View file @
475bb004
spring
:
profiles
:
active
:
prod
active
:
dev
application
:
name
:
cneeds-server-user
...
...
pom.xml
View file @
475bb004
...
...
@@ -57,27 +57,6 @@
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
</dependencies>
...
...
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