Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fileServe
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
vanke
fileServe
Commits
c2e9be08
Commit
c2e9be08
authored
Jul 10, 2020
by
XiaHou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
万科文档下载
parent
dc23bfcc
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
206 additions
and
125 deletions
+206
-125
UmsAdminController.java
...in/java/com/macro/mall/controller/UmsAdminController.java
+3
-2
UmsRoleServiceImpl.java
.../java/com/macro/mall/service/impl/UmsRoleServiceImpl.java
+2
-19
UmsAdminDto.java
...src/main/java/com/macro/mall/model/vanke/UmsAdminDto.java
+13
-0
UmsMemberController.java
...ro/mall/portal/controller/member/UmsMemberController.java
+3
-71
VankeFileController.java
...cro/mall/portal/controller/vanke/VankeFileController.java
+4
-0
VankeFileTypeController.java
...mall/portal/controller/vanke/VankeFileTypeController.java
+33
-0
application.yml
mall-portal/src/main/resources/application.yml
+2
-1
MallPortalApplicationTests.java
...ava/com/macro/mall/portal/MallPortalApplicationTests.java
+11
-7
UmsMemberService.java
.../java/com/macro/mall/service/member/UmsMemberService.java
+2
-2
UmsMemberServiceImpl.java
.../macro/mall/service/member/impl/UmsMemberServiceImpl.java
+8
-14
UmsAdminService.java
...n/java/com/macro/mall/service/system/UmsAdminService.java
+3
-2
UmsAdminServiceImpl.java
...m/macro/mall/service/system/impl/UmsAdminServiceImpl.java
+30
-7
IADService.java
...rc/main/java/com/macro/mall/service/vanke/IADService.java
+15
-0
ADServiceImpl.java
...java/com/macro/mall/service/vanke/impl/ADServiceImpl.java
+71
-0
VankeFileDao.xml
.../main/resources/com/macro/mall/dao/vanke/VankeFileDao.xml
+6
-0
No files found.
mall-admin/src/main/java/com/macro/mall/controller/UmsAdminController.java
View file @
c2e9be08
...
@@ -9,6 +9,7 @@ import com.macro.mall.dto.UmsAdminLoginParam;
...
@@ -9,6 +9,7 @@ import com.macro.mall.dto.UmsAdminLoginParam;
import
com.macro.mall.domain.dto.UmsAdminParam
;
import
com.macro.mall.domain.dto.UmsAdminParam
;
import
com.macro.mall.model.*
;
import
com.macro.mall.model.*
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.vanke.UmsAdminDto
;
import
com.macro.mall.service.UmsRoleService
;
import
com.macro.mall.service.UmsRoleService
;
import
com.macro.mall.service.system.UmsAdminService
;
import
com.macro.mall.service.system.UmsAdminService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -206,9 +207,9 @@ public class UmsAdminController {
...
@@ -206,9 +207,9 @@ public class UmsAdminController {
@ApiOperation
(
"万科后台_新增管理员"
)
@ApiOperation
(
"万科后台_新增管理员"
)
@RequestMapping
(
value
=
"/insertAdmin"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/insertAdmin"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
CommonResult
insertAdmin
(
@ApiParam
(
value
=
"会员对象"
)
@RequestBody
UmsAdmin
umsAdmin
public
CommonResult
insertAdmin
(
@ApiParam
(
value
=
"会员对象"
)
@RequestBody
UmsAdmin
Dto
umsAdminDto
)
{
)
{
ResultMsg
res
=
this
.
adminService
.
insertAdmin
(
umsAdmin
);
ResultMsg
res
=
this
.
adminService
.
insertAdmin
(
umsAdmin
Dto
);
if
(
res
.
isFlag
()){
if
(
res
.
isFlag
()){
return
CommonResult
.
success
(
null
,
res
.
getMsg
());
return
CommonResult
.
success
(
null
,
res
.
getMsg
());
}
}
...
...
mall-admin/src/main/java/com/macro/mall/service/impl/UmsRoleServiceImpl.java
View file @
c2e9be08
...
@@ -103,19 +103,6 @@ public class UmsRoleServiceImpl implements UmsRoleService {
...
@@ -103,19 +103,6 @@ public class UmsRoleServiceImpl implements UmsRoleService {
public
List
<
UmsRole
>
list
()
{
public
List
<
UmsRole
>
list
()
{
UmsRoleExample
example
=
new
UmsRoleExample
();
UmsRoleExample
example
=
new
UmsRoleExample
();
UmsRoleExample
.
Criteria
criteria
=
example
.
createCriteria
();
UmsRoleExample
.
Criteria
criteria
=
example
.
createCriteria
();
UmsAdmin
admin
=
DgbSecurityUserHelper
.
getCurrentUser
();
Integer
type
=
admin
.
getType
();
Long
parentId
=
admin
.
getParentId
();
Long
mark
=
new
Long
(
1
);
if
(
type
.
equals
(
1
))
{
criteria
.
andMarkEqualTo
(
mark
);
}
else
{
if
(
parentId
!=
null
)
{
criteria
.
andMarkEqualTo
(
parentId
);
}
else
{
criteria
.
andMarkEqualTo
(
admin
.
getId
());
}
}
criteria
.
andDeleteStatusEqualTo
(
0
);
criteria
.
andDeleteStatusEqualTo
(
0
);
return
roleMapper
.
selectByExample
(
example
);
return
roleMapper
.
selectByExample
(
example
);
}
}
...
@@ -125,15 +112,11 @@ public class UmsRoleServiceImpl implements UmsRoleService {
...
@@ -125,15 +112,11 @@ public class UmsRoleServiceImpl implements UmsRoleService {
public
List
<
UmsRole
>
list
(
String
keyword
,
Long
adminId
,
Integer
pageSize
,
Integer
pageNum
)
{
public
List
<
UmsRole
>
list
(
String
keyword
,
Long
adminId
,
Integer
pageSize
,
Integer
pageNum
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
UmsRoleExample
example
=
new
UmsRoleExample
();
UmsRoleExample
example
=
new
UmsRoleExample
();
UmsRoleExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andDeleteStatusEqualTo
(
0
);
//查询未删除的
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
example
.
createCriteria
().
andNameLike
(
"%"
+
keyword
+
"%"
).
andDeleteStatusEqualTo
(
0
);
example
.
createCriteria
().
andNameLike
(
"%"
+
keyword
+
"%"
).
andDeleteStatusEqualTo
(
0
);
}
}
if
(
adminId
!=
null
)
{
example
.
createCriteria
().
andMarkEqualTo
(
adminId
);
}
else
{
example
.
createCriteria
().
andMarkEqualTo
(
1L
);
}
return
roleMapper
.
selectByExample
(
example
);
return
roleMapper
.
selectByExample
(
example
);
}
}
...
...
mall-mbg/src/main/java/com/macro/mall/model/vanke/UmsAdminDto.java
0 → 100644
View file @
c2e9be08
package
com
.
macro
.
mall
.
model
.
vanke
;
import
com.macro.mall.model.UmsAdmin
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
UmsAdminDto
extends
UmsAdmin
{
@ApiModelProperty
(
value
=
"角色id"
)
private
Long
roleId
;
}
mall-portal/src/main/java/com/macro/mall/portal/controller/member/UmsMemberController.java
View file @
c2e9be08
...
@@ -36,80 +36,13 @@ public class UmsMemberController {
...
@@ -36,80 +36,13 @@ public class UmsMemberController {
private
UmsMemberPhoneReviewService
memberPhoneReviewService
;
private
UmsMemberPhoneReviewService
memberPhoneReviewService
;
@ApiOperation
(
"文档下载前台_
会员根据手机号
登录"
)
@ApiOperation
(
"文档下载前台_
通过AD域账户密码
登录"
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
CommonResult
login
(
@RequestParam
String
phon
e
,
public
CommonResult
login
(
@RequestParam
String
usernam
e
,
@RequestParam
String
password
)
{
@RequestParam
String
password
)
{
return
memberService
.
login
(
phon
e
,
password
);
return
memberService
.
login
(
usernam
e
,
password
);
}
}
@ApiOperation
(
"文档下载前台_用户修改密码"
)
@RequestMapping
(
value
=
"/updatePassword"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
updatePassword
(
@RequestBody
UmsMemberRequestParam
umsMemberRequestParam
)
{
ResultMsg
res
=
memberService
.
updatePassword
(
umsMemberRequestParam
);
if
(
res
.
isFlag
()){
return
CommonResult
.
success
(
null
,
res
.
getMsg
());
}
return
CommonResult
.
failed
(
res
.
getMsg
());
}
@ApiOperation
(
"文档下载前台_用户修改手机号"
)
@RequestMapping
(
value
=
"/updatePhone"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
updatePhone
(
@RequestBody
UmsMemberRequestParam
umsMemberRequestParam
)
{
ResultMsg
res
=
memberService
.
updatePhone
(
umsMemberRequestParam
);
if
(
res
.
isFlag
()){
return
CommonResult
.
success
(
null
,
res
.
getMsg
());
}
return
CommonResult
.
failed
(
res
.
getMsg
());
}
@ApiOperation
(
"文档下载前台_根据会员id修改一条会员数据"
)
@RequestMapping
(
value
=
"/updateOneById"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
updateOneById
(
@ApiParam
(
"会员对象,传入Id,以及对应的要修改的值.例如帐号启用状态:0->禁用;1->启用 禁用账号在对应的字段传入0"
)
@RequestBody
UmsMember
umsMember
){
ResultMsg
res
=
this
.
memberService
.
updateOtherById
(
umsMember
);
if
(
res
.
isFlag
()){
return
CommonResult
.
success
(
null
,
res
.
getMsg
());
}
return
CommonResult
.
failed
(
res
.
getMsg
());
}
@ApiOperation
(
value
=
"刷新token"
)
@RequestMapping
(
value
=
"/refreshToken"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
CommonResult
refreshToken
(
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
tokenHeader
);
String
refreshToken
=
memberService
.
refreshToken
(
token
);
if
(
refreshToken
==
null
)
{
return
CommonResult
.
failed
(
"token已经过期!"
);
}
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
tokenMap
.
put
(
"token"
,
refreshToken
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
return
CommonResult
.
success
(
tokenMap
);
}
@ApiOperation
(
"获取当前登录用户信息"
)
@RequestMapping
(
value
=
"/info"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
CommonResult
<
UmsMember
>
info
()
{
UmsMember
currentMember
=
memberService
.
getCurrentMember
();
return
CommonResult
.
success
(
currentMember
);
}
@ApiOperation
(
"会员手机验证码登录"
)
@RequestMapping
(
value
=
"/loginPhone"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
CommonResult
loginPhone
(
@RequestParam
String
telephone
,
@RequestParam
String
authCode
)
{
return
memberService
.
loginPhone
(
telephone
,
authCode
);
}
}
}
\ No newline at end of file
mall-portal/src/main/java/com/macro/mall/portal/controller/vanke/VankeFileController.java
View file @
c2e9be08
...
@@ -31,6 +31,8 @@ public class VankeFileController {
...
@@ -31,6 +31,8 @@ public class VankeFileController {
public
CommonResult
<
CommonPage
<
VankeFileDto
>>
list
(
@ApiParam
(
value
=
"分页大小"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
)
Integer
pageSize
,
public
CommonResult
<
CommonPage
<
VankeFileDto
>>
list
(
@ApiParam
(
value
=
"分页大小"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
)
Integer
pageSize
,
@ApiParam
(
value
=
"分页页数"
)
@RequestParam
(
value
=
"pageNum"
,
required
=
false
)
Integer
pageNum
,
@ApiParam
(
value
=
"分页页数"
)
@RequestParam
(
value
=
"pageNum"
,
required
=
false
)
Integer
pageNum
,
@ApiParam
(
value
=
"文档名称搜索"
)
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@ApiParam
(
value
=
"文档名称搜索"
)
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@ApiParam
(
value
=
"创建人名称"
)
@RequestParam
(
value
=
"adminName"
,
required
=
false
)
String
adminName
,
@ApiParam
(
value
=
"搜索时间"
)
@RequestParam
(
value
=
"queryTime"
,
required
=
false
)
String
queryTime
,
@ApiParam
(
value
=
"文档类型id"
)
@RequestParam
(
value
=
"typeId"
,
required
=
false
)
Long
typeId
,
@ApiParam
(
value
=
"文档类型id"
)
@RequestParam
(
value
=
"typeId"
,
required
=
false
)
Long
typeId
,
@ApiParam
(
value
=
"如果根据时间倒序查询 传入1"
)
@RequestParam
(
value
=
"isByTime"
,
required
=
false
)
Integer
isByTime
,
@ApiParam
(
value
=
"如果根据时间倒序查询 传入1"
)
@RequestParam
(
value
=
"isByTime"
,
required
=
false
)
Integer
isByTime
,
@ApiParam
(
value
=
"如果根据下载排行倒序查询 传入1"
)
@RequestParam
(
value
=
"isByDownloadTimes"
,
required
=
false
)
Integer
isByDownloadTimes
@ApiParam
(
value
=
"如果根据下载排行倒序查询 传入1"
)
@RequestParam
(
value
=
"isByDownloadTimes"
,
required
=
false
)
Integer
isByDownloadTimes
...
@@ -40,6 +42,8 @@ public class VankeFileController {
...
@@ -40,6 +42,8 @@ public class VankeFileController {
vankeFileDto
.
setIsByTime
(
isByTime
);
vankeFileDto
.
setIsByTime
(
isByTime
);
vankeFileDto
.
setIsByDownloadTimes
(
isByDownloadTimes
);
vankeFileDto
.
setIsByDownloadTimes
(
isByDownloadTimes
);
vankeFileDto
.
setTypeId
(
typeId
);
vankeFileDto
.
setTypeId
(
typeId
);
vankeFileDto
.
setAdminName
(
adminName
);
vankeFileDto
.
setQueryTime
(
queryTime
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
this
.
vankeFileService
.
getPageList
(
pageNum
,
pageSize
,
vankeFileDto
)));
return
CommonResult
.
success
(
CommonPage
.
restPage
(
this
.
vankeFileService
.
getPageList
(
pageNum
,
pageSize
,
vankeFileDto
)));
}
}
...
...
mall-portal/src/main/java/com/macro/mall/portal/controller/vanke/VankeFileTypeController.java
0 → 100644
View file @
c2e9be08
package
com
.
macro
.
mall
.
portal
.
controller
.
vanke
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.VankeFileType
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.service.vanke.IVankeFileTypeService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
@Api
(
tags
=
"万科文档_文档分类相关接口"
,
description
=
"文档分类控制器"
)
@Controller
@RequestMapping
(
"/vankeFileType"
)
public
class
VankeFileTypeController
{
@Autowired
private
IVankeFileTypeService
vankeFileTypeService
;
@ApiOperation
(
"万科前台_文件类型分页操作"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
CommonResult
<
CommonPage
<
VankeFileType
>>
list
(
@ApiParam
(
value
=
"分页大小"
)
@RequestParam
(
value
=
"pageSize"
,
required
=
false
)
Integer
pageSize
,
@ApiParam
(
value
=
"分页页数"
)
@RequestParam
(
value
=
"pageNum"
,
required
=
false
)
Integer
pageNum
)
{
return
CommonResult
.
success
(
CommonPage
.
restPage
(
this
.
vankeFileTypeService
.
getPageList
(
pageNum
,
pageSize
)));
}
}
mall-portal/src/main/resources/application.yml
View file @
c2e9be08
...
@@ -2,7 +2,7 @@ server:
...
@@ -2,7 +2,7 @@ server:
port
:
8086
port
:
8086
spring
:
spring
:
datasource
:
datasource
:
url
:
jdbc:mysql://115.29.198.90:3306/
quanxing
?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://115.29.198.90:3306/
vanke_download
?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username
:
root
username
:
root
password
:
root
password
:
root
druid
:
druid
:
...
@@ -122,6 +122,7 @@ aliyun:
...
@@ -122,6 +122,7 @@ aliyun:
bucketName
:
haihaigo
# oss的存储空间
bucketName
:
haihaigo
# oss的存储空间
filepath
:
D:/files/
#本地文件存储路径
filepath
:
D:/files/
#本地文件存储路径
fileUrl
:
192.168.31.127:8401/mall-admin/files/
#本地访问上传文件 如果部署到线上需要通过nginx去配置
fileUrl
:
192.168.31.127:8401/mall-admin/files/
#本地访问上传文件 如果部署到线上需要通过nginx去配置
policy
:
policy
:
expire
:
300
# 签名有效期(S)
expire
:
300
# 签名有效期(S)
maxSize
:
1024
# 上传文件大小(M)
maxSize
:
1024
# 上传文件大小(M)
...
...
mall-portal/src/test/java/com/macro/mall/portal/MallPortalApplicationTests.java
View file @
c2e9be08
...
@@ -16,8 +16,10 @@ import javax.naming.directory.SearchResult;
...
@@ -16,8 +16,10 @@ import javax.naming.directory.SearchResult;
import
javax.naming.ldap.InitialLdapContext
;
import
javax.naming.ldap.InitialLdapContext
;
import
javax.naming.ldap.LdapContext
;
import
javax.naming.ldap.LdapContext
;
import
cn.hutool.log.Log
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.quartz.JobExecutionException
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.junit4.SpringRunner
;
...
@@ -27,10 +29,10 @@ public class MallPortalApplicationTests {
...
@@ -27,10 +29,10 @@ public class MallPortalApplicationTests {
@Test
@Test
public
void
ADLogin1
()
{
public
void
ADLogin1
()
{
String
userName
=
"
xiexy
"
;
//AD域认证,用户的登录UserName
String
userName
=
"
admin
"
;
//AD域认证,用户的登录UserName
String
password
=
"
Xie04-21
"
;
//AD域认证,用户的登录PassWord
String
password
=
"
root123!!
"
;
//AD域认证,用户的登录PassWord
String
host
=
"1
0.0.1.1
"
;
//AD域IP,必须填写正确
String
host
=
"1
82.61.50.234
"
;
//AD域IP,必须填写正确
String
domain
=
"@
vanke.com
"
;
//域名后缀,例.@noker.cn.com
String
domain
=
"@
tengfeikeji.club
"
;
//域名后缀,例.@noker.cn.com
String
port
=
"389"
;
//端口,一般默认389
String
port
=
"389"
;
//端口,一般默认389
String
url
=
new
String
(
"ldap://"
+
host
+
":"
+
port
);
//固定写法
String
url
=
new
String
(
"ldap://"
+
host
+
":"
+
port
);
//固定写法
String
user
=
userName
.
indexOf
(
domain
)
>
0
?
userName
:
userName
String
user
=
userName
.
indexOf
(
domain
)
>
0
?
userName
:
userName
...
@@ -111,9 +113,9 @@ public class MallPortalApplicationTests {
...
@@ -111,9 +113,9 @@ public class MallPortalApplicationTests {
@Test
@Test
public
void
test1
(){
public
void
test1
(){
Properties
env
=
new
Properties
();
Properties
env
=
new
Properties
();
String
adminName
=
"admin
istrator@2003.com
"
;
//username@domain
String
adminName
=
"admin
@tengfeikeji.club
"
;
//username@domain
String
adminPassword
=
"
admin
"
;
//password
String
adminPassword
=
"
root123!!
"
;
//password
String
ldapURL
=
"LDAP://
192.168.31.127
:389"
;
//ip:port
String
ldapURL
=
"LDAP://
182.61.50.234
:389"
;
//ip:port
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
env
.
put
(
Context
.
SECURITY_AUTHENTICATION
,
"simple"
);
//"none","simple","strong"
env
.
put
(
Context
.
SECURITY_AUTHENTICATION
,
"simple"
);
//"none","simple","strong"
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
adminName
);
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
adminName
);
...
@@ -183,6 +185,8 @@ public class MallPortalApplicationTests {
...
@@ -183,6 +185,8 @@ public class MallPortalApplicationTests {
}
}
}
}
...
...
mall-service/src/main/java/com/macro/mall/service/member/UmsMemberService.java
View file @
c2e9be08
...
@@ -87,9 +87,9 @@ public interface UmsMemberService {
...
@@ -87,9 +87,9 @@ public interface UmsMemberService {
UserDetails
loadUserByPhone
(
String
phone
);
UserDetails
loadUserByPhone
(
String
phone
);
/**
/**
*
登录
后获取token
*
通过AD域登录
后获取token
*/
*/
CommonResult
login
(
String
phon
e
,
String
password
);
CommonResult
login
(
String
usernam
e
,
String
password
);
/**
/**
* 刷新token
* 刷新token
...
...
mall-service/src/main/java/com/macro/mall/service/member/impl/UmsMemberServiceImpl.java
View file @
c2e9be08
...
@@ -28,6 +28,7 @@ import com.macro.mall.security.util.JwtTokenUtil;
...
@@ -28,6 +28,7 @@ import com.macro.mall.security.util.JwtTokenUtil;
import
com.macro.mall.service.quanxing.IPmsSupplierAuditService
;
import
com.macro.mall.service.quanxing.IPmsSupplierAuditService
;
import
com.macro.mall.service.system.RedisService
;
import
com.macro.mall.service.system.RedisService
;
import
com.macro.mall.service.system.UmsAdminService
;
import
com.macro.mall.service.system.UmsAdminService
;
import
com.macro.mall.service.vanke.IADService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -83,6 +84,8 @@ public class UmsMemberServiceImpl implements UmsMemberService {
...
@@ -83,6 +84,8 @@ public class UmsMemberServiceImpl implements UmsMemberService {
private
IPmsSupplierAuditService
pmsSupplierAuditService
;
private
IPmsSupplierAuditService
pmsSupplierAuditService
;
@Resource
@Resource
private
PmsSupplierAuditDao
pmsSupplierAuditDao
;
private
PmsSupplierAuditDao
pmsSupplierAuditDao
;
@Autowired
private
IADService
adService
;
@Value
(
"${redis.key.prefix.authCode}"
)
@Value
(
"${redis.key.prefix.authCode}"
)
private
String
REDIS_KEY_PREFIX_AUTH_CODE
;
private
String
REDIS_KEY_PREFIX_AUTH_CODE
;
...
@@ -339,27 +342,18 @@ public class UmsMemberServiceImpl implements UmsMemberService {
...
@@ -339,27 +342,18 @@ public class UmsMemberServiceImpl implements UmsMemberService {
}
}
@Override
@Override
public
CommonResult
login
(
String
phon
e
,
String
password
)
{
public
CommonResult
login
(
String
usernam
e
,
String
password
)
{
String
token
=
null
;
String
token
=
null
;
//密码需要客户端加密后传递
//密码需要客户端加密后传递
try
{
try
{
UmsMember
member
=
getByPhone
(
phone
);
ResultMsg
res
=
this
.
adService
.
loginAd
(
username
,
password
);
if
(
member
==
null
)
{
if
(!
res
.
isFlag
())
{
return
CommonResult
.
failed
(
"手机号不存在"
);
return
CommonResult
.
failed
(
res
.
getMsg
());
}
UserDetails
userDetails
=
loadUserByPhone
(
phone
);
if
(!
passwordEncoder
.
matches
(
password
,
userDetails
.
getPassword
()))
{
return
CommonResult
.
failed
(
"手机号不存在或密码错误,请重新登录"
);
}
Integer
status
=
member
.
getStatus
();
if
(
status
.
equals
(
0
))
{
return
CommonResult
.
failed
(
"用户被禁用"
);
}
}
UserDetails
userDetails
=
this
.
loadUserByUsername
(
"admin"
);
//ad域校验通过后 模拟一个账户登录
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
token
=
jwtTokenUtil
.
generateToken
(
userDetails
);
token
=
jwtTokenUtil
.
generateToken
(
userDetails
);
member
.
setLoginTime
(
new
Date
());
umsMemberMapper
.
updateByPrimaryKeySelective
(
member
);
}
catch
(
AuthenticationException
e
)
{
}
catch
(
AuthenticationException
e
)
{
LOGGER
.
warn
(
"登录异常:{}"
,
e
.
getMessage
());
LOGGER
.
warn
(
"登录异常:{}"
,
e
.
getMessage
());
}
}
...
...
mall-service/src/main/java/com/macro/mall/service/system/UmsAdminService.java
View file @
c2e9be08
...
@@ -10,6 +10,7 @@ import com.macro.mall.model.UmsPermission;
...
@@ -10,6 +10,7 @@ import com.macro.mall.model.UmsPermission;
import
com.macro.mall.model.UmsResource
;
import
com.macro.mall.model.UmsResource
;
import
com.macro.mall.model.UmsRole
;
import
com.macro.mall.model.UmsRole
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.vanke.UmsAdminDto
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -197,10 +198,10 @@ public interface UmsAdminService {
...
@@ -197,10 +198,10 @@ public interface UmsAdminService {
/**
/**
* 新增一个管理员
* 新增一个管理员
* @param umsAdmin
* @param umsAdmin
Dto
* @return
* @return
*/
*/
ResultMsg
insertAdmin
(
UmsAdmin
umsAdmin
);
ResultMsg
insertAdmin
(
UmsAdmin
Dto
umsAdminDto
);
/**
/**
* 根据id修改一条数据
* 根据id修改一条数据
...
...
mall-service/src/main/java/com/macro/mall/service/system/impl/UmsAdminServiceImpl.java
View file @
c2e9be08
...
@@ -13,6 +13,7 @@ import com.macro.mall.domain.dto.UmsAdminQueryParam;
...
@@ -13,6 +13,7 @@ import com.macro.mall.domain.dto.UmsAdminQueryParam;
import
com.macro.mall.mapper.*
;
import
com.macro.mall.mapper.*
;
import
com.macro.mall.model.*
;
import
com.macro.mall.model.*
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.model.vanke.UmsAdminDto
;
import
com.macro.mall.security.admin.AdminUserDetails
;
import
com.macro.mall.security.admin.AdminUserDetails
;
import
com.macro.mall.security.admin.DgbSecurityUserHelper
;
import
com.macro.mall.security.admin.DgbSecurityUserHelper
;
import
com.macro.mall.security.util.JwtTokenUtil
;
import
com.macro.mall.security.util.JwtTokenUtil
;
...
@@ -682,17 +683,36 @@ public class UmsAdminServiceImpl implements UmsAdminService {
...
@@ -682,17 +683,36 @@ public class UmsAdminServiceImpl implements UmsAdminService {
/**
/**
* 新增一个管理员
* 新增一个管理员
* @param umsAdmin
* @param umsAdmin
Dto
* @return
* @return
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResultMsg
insertAdmin
(
UmsAdmin
umsAdmin
){
public
ResultMsg
insertAdmin
(
UmsAdminDto
umsAdminDto
){
ResultMsg
res
=
this
.
checkUmsAdmin
(
umsAdmin
);
UmsAdmin
ua
=
getAdminByUsername
(
umsAdminDto
.
getUsername
());
if
(!
res
.
isFlag
()){
if
(
ua
!=
null
){
return
new
ResultMsg
(
false
,
res
.
getMsg
());
return
new
ResultMsg
(
false
,
"已存在此账号!"
);
}
}
this
.
adminMapper
.
insertSelective
(
umsAdmin
);
//初始化前端会员
UmsMember
umsMember
=
new
UmsMember
();
//插入到ums_admin 这张表内
UmsAdmin
umsAdmin
=
new
UmsAdmin
();
umsAdmin
.
setCreateTime
(
new
Date
());
umsAdmin
.
setUpdateDate
(
new
Date
());
umsAdmin
.
setCreateDate
(
new
Date
());
umsAdmin
.
setIcon
(
umsAdminDto
.
getIcon
());
umsAdmin
.
setPhone
(
umsAdminDto
.
getPhone
());
umsAdmin
.
setUsername
(
umsAdminDto
.
getUsername
());
umsAdmin
.
setPassword
(
passwordEncoder
.
encode
(
umsAdminDto
.
getPassword
()));
umsAdmin
.
setName
(
umsAdminDto
.
getName
());
this
.
adminMapper
.
insertSelective
(
umsAdmin
);
//绑定角色关系
UmsAdminRoleRelation
umsAdminRoleRelation
=
new
UmsAdminRoleRelation
();
umsAdminRoleRelation
.
setAdminId
(
umsAdmin
.
getId
());
umsAdminRoleRelation
.
setRoleId
(
umsAdminDto
.
getRoleId
());
umsAdminRoleRelation
.
setCreateDate
(
new
Date
());
umsAdminRoleRelation
.
setUpdateDate
(
new
Date
());
this
.
adminRoleRelationMapper
.
insertSelective
(
umsAdminRoleRelation
);
return
new
ResultMsg
(
true
,
"操作成功"
);
return
new
ResultMsg
(
true
,
"操作成功"
);
}
}
...
@@ -707,6 +727,9 @@ public class UmsAdminServiceImpl implements UmsAdminService {
...
@@ -707,6 +727,9 @@ public class UmsAdminServiceImpl implements UmsAdminService {
if
(
umsAdmin
.
getId
()
==
null
){
if
(
umsAdmin
.
getId
()
==
null
){
return
new
ResultMsg
(
false
,
"传入id为空"
);
return
new
ResultMsg
(
false
,
"传入id为空"
);
}
}
if
(
umsAdmin
.
getPassword
()
!=
null
&&
!
""
.
equals
(
umsAdmin
.
getPassword
())){
umsAdmin
.
setPassword
(
passwordEncoder
.
encode
(
umsAdmin
.
getPassword
()));
}
this
.
adminMapper
.
updateByPrimaryKeySelective
(
umsAdmin
);
this
.
adminMapper
.
updateByPrimaryKeySelective
(
umsAdmin
);
return
new
ResultMsg
(
true
,
"修改成功"
);
return
new
ResultMsg
(
true
,
"修改成功"
);
}
}
...
...
mall-service/src/main/java/com/macro/mall/service/vanke/IADService.java
0 → 100644
View file @
c2e9be08
package
com
.
macro
.
mall
.
service
.
vanke
;
import
com.macro.mall.model.common.ResultMsg
;
public
interface
IADService
{
/**
* 登录ad域
* @param username
* @param password
* @return
*/
ResultMsg
loginAd
(
String
username
,
String
password
);
}
mall-service/src/main/java/com/macro/mall/service/vanke/impl/ADServiceImpl.java
0 → 100644
View file @
c2e9be08
package
com
.
macro
.
mall
.
service
.
vanke
.
impl
;
import
com.macro.mall.model.common.ResultMsg
;
import
com.macro.mall.service.vanke.IADService
;
import
org.junit.Test
;
import
org.springframework.stereotype.Service
;
import
javax.naming.AuthenticationException
;
import
javax.naming.Context
;
import
javax.naming.directory.DirContext
;
import
javax.naming.directory.InitialDirContext
;
import
java.util.Hashtable
;
@Service
public
class
ADServiceImpl
implements
IADService
{
private
static
String
host
=
"182.61.50.234"
;
//AD域IP,必须填写正确
private
static
String
domain
=
"@tengfeikeji.club"
;
//域名后缀,例.@noker.cn.com
private
static
String
port
=
"389"
;
//端口,一般默认389
/**
* 登录ad域
* @param username
* @param password
* @return
*/
@Override
public
ResultMsg
loginAd
(
String
username
,
String
password
){
String
url
=
new
String
(
"ldap://"
+
host
+
":"
+
port
);
//固定写法
String
user
=
username
.
indexOf
(
domain
)
>
0
?
username
:
username
+
domain
;
//网上有别的方法,但是在我这儿都不好使,建议这么使用
Hashtable
env
=
new
Hashtable
();
//实例化一个Env
DirContext
ctx
=
null
;
env
.
put
(
Context
.
SECURITY_AUTHENTICATION
,
"simple"
);
//LDAP访问安全级别(none,simple,strong),一种模式,这么写就行
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
user
);
//用户名
env
.
put
(
Context
.
SECURITY_CREDENTIALS
,
password
);
//密码
env
.
put
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
// LDAP工厂类
env
.
put
(
Context
.
PROVIDER_URL
,
url
);
//Url
try
{
ctx
=
new
InitialDirContext
(
env
);
// 初始化上下文
return
new
ResultMsg
(
true
,
"登录验证成功!"
);
}
catch
(
AuthenticationException
e
)
{
e
.
printStackTrace
();
return
new
ResultMsg
(
false
,
"登录验证失败!账户或密码有误!"
);
}
catch
(
javax
.
naming
.
CommunicationException
e
)
{
e
.
printStackTrace
();
return
new
ResultMsg
(
false
,
"AD域连接失败!请检查IP与端口正确性,是否能连上!"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
new
ResultMsg
(
false
,
"身份验证未知异常!"
);
}
finally
{
if
(
null
!=
ctx
){
try
{
ctx
.
close
();
ctx
=
null
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
@Test
public
void
test
(){
ResultMsg
res
=
this
.
loginAd
(
"admin"
,
"root123!!"
);
System
.
out
.
println
(
res
.
getMsg
());
}
}
mall-service/src/main/resources/com/macro/mall/dao/vanke/VankeFileDao.xml
View file @
c2e9be08
...
@@ -17,6 +17,12 @@
...
@@ -17,6 +17,12 @@
<if
test=
"typeId != null"
>
<if
test=
"typeId != null"
>
and a.type_id = #{typeId}
and a.type_id = #{typeId}
</if>
</if>
<if
test=
" queryTime != null and queryTime != ''"
>
and #{queryTime} = date_format( createtime, '%Y-%m-%d' )
</if>
<if
test=
" adminName != null and adminName != ''"
>
and b.name like CONCAT(#{adminName},'%')
</if>
<if
test=
"isByTime!= null and isByTime == 1"
>
<if
test=
"isByTime!= null and isByTime == 1"
>
order by a.createtime desc
order by a.createtime desc
</if>
</if>
...
...
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