Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
b937e843
Commit
b937e843
authored
Dec 17, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-customer-management' into dev
parents
41c6b254
d1589229
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
23 deletions
+87
-23
AppStaffUser.java
...om/github/wxiaoqi/security/admin/entity/AppStaffUser.java
+4
-0
AppStaffUserDTO.java
...github/wxiaoqi/security/admin/entity/AppStaffUserDTO.java
+34
-0
AppStaffUserBiz.java
...om/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
+47
-19
AppStaffUserController.java
...b/wxiaoqi/security/admin/rest/AppStaffUserController.java
+2
-4
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppStaffUser.java
View file @
b937e843
...
@@ -22,6 +22,9 @@ public class AppStaffUser {
...
@@ -22,6 +22,9 @@ public class AppStaffUser {
@Column
(
name
=
"su_id"
)
@Column
(
name
=
"su_id"
)
@ApiModelProperty
(
"员工app账号id"
)
@ApiModelProperty
(
"员工app账号id"
)
private
Integer
suId
;
private
Integer
suId
;
@Column
(
name
=
"su_id"
)
@ApiModelProperty
(
"员工手机号"
)
private
String
suPhone
;
@Column
(
name
=
"u_name"
)
@Column
(
name
=
"u_name"
)
@ApiModelProperty
(
"客户姓名"
)
@ApiModelProperty
(
"客户姓名"
)
private
String
uName
;
private
String
uName
;
...
@@ -40,4 +43,5 @@ public class AppStaffUser {
...
@@ -40,4 +43,5 @@ public class AppStaffUser {
@Column
(
name
=
"is_del"
)
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
"状态:0-未删除 1-已删除"
)
@ApiModelProperty
(
"状态:0-未删除 1-已删除"
)
private
Integer
isDel
;
private
Integer
isDel
;
private
Integer
status
;
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppStaffUserDTO.java
0 → 100644
View file @
b937e843
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
lombok.Data
;
/**
* @Auther: Administrator
* @Date: 2019/12/17 15:35
* @Description:
*/
@Data
public
class
AppStaffUserDTO
{
/**
* 员工id
*/
private
Integer
suId
;
/**
* 员工手机号
*/
private
String
suPhone
;
/**
* 下级客户姓名
*/
private
String
uName
;
/**
* 下级客户手机号
*/
private
String
phone
;
/**
* 下级身份
*/
private
String
positionId
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
View file @
b937e843
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.druid.sql.visitor.functions.If
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUser
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUser
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUserDTO
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUserVo
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUserVo
;
import
com.github.wxiaoqi.security.admin.mapper.AppStaffUserMapper
;
import
com.github.wxiaoqi.security.admin.mapper.AppStaffUserMapper
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -20,14 +21,16 @@ import java.util.List;
...
@@ -20,14 +21,16 @@ import java.util.List;
* @author Administrator
* @author Administrator
*/
*/
@Service
@Service
@RequiredArgsConstructor
(
onConstructor_
=
{
@Autowired
})
@RequiredArgsConstructor
(
onConstructor_
=
{
@Autowired
})
public
class
AppStaffUserBiz
extends
BaseBiz
<
AppStaffUserMapper
,
AppStaffUser
>
{
public
class
AppStaffUserBiz
extends
BaseBiz
<
AppStaffUserMapper
,
AppStaffUser
>
{
private
final
AppUserDetailBiz
appUserDetailBiz
;
private
final
AppUserDetailBiz
appUserDetailBiz
;
private
final
Integer
POSITION_ID
=
4
;
private
final
AppUserLoginBiz
appUserLoginBiz
;
public
List
<
AppStaffUser
>
getAll
(
Integer
id
)
{
public
List
<
AppStaffUser
>
getAll
(
Integer
id
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
Example
example
=
new
Example
(
AppStaffUser
.
class
);
example
.
createCriteria
().
andEqualTo
(
"suId"
,
id
).
andEqualTo
(
"isDel"
,
0
);
example
.
createCriteria
().
andEqualTo
(
"suId"
,
id
).
andEqualTo
(
"isDel"
,
0
);
example
.
orderBy
(
"crtTime"
).
desc
();
example
.
orderBy
(
"crtTime"
).
desc
();
return
selectByExample
(
example
);
return
selectByExample
(
example
);
}
}
...
@@ -39,7 +42,6 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -39,7 +42,6 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
}
}
@Override
@Override
public
int
updateSelectiveByIdRe
(
AppStaffUser
appStaffUser
)
{
public
int
updateSelectiveByIdRe
(
AppStaffUser
appStaffUser
)
{
appStaffUser
.
setUpdTime
(
new
Date
());
appStaffUser
.
setUpdTime
(
new
Date
());
...
@@ -47,21 +49,21 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -47,21 +49,21 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
}
}
public
AppStaffUser
findOne
(
AppStaffUser
appStaffUser
)
{
public
AppStaffUser
findOne
(
AppStaffUser
appStaffUser
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
Example
example
=
new
Example
(
AppStaffUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isDel"
,
0
);
criteria
.
andEqualTo
(
"isDel"
,
0
);
if
(
appStaffUser
.
getId
()
!=
null
)
{
if
(
appStaffUser
.
getId
()
!=
null
)
{
criteria
.
andEqualTo
(
"id"
,
appStaffUser
.
getId
());
criteria
.
andEqualTo
(
"id"
,
appStaffUser
.
getId
());
return
mapper
.
selectOneByExample
(
example
);
return
mapper
.
selectOneByExample
(
example
);
}
}
if
(
appStaffUser
.
getPhone
()
!=
null
)
{
if
(
appStaffUser
.
getPhone
()
!=
null
)
{
criteria
.
andEqualTo
(
"phone"
,
appStaffUser
.
getPhone
());
criteria
.
andEqualTo
(
"phone"
,
appStaffUser
.
getPhone
());
List
<
AppStaffUser
>
appStaffUsers
=
mapper
.
selectByExample
(
example
);
List
<
AppStaffUser
>
appStaffUsers
=
mapper
.
selectByExample
(
example
);
if
(
CollectionUtil
.
isNotEmpty
(
appStaffUsers
))
{
if
(
CollectionUtil
.
isNotEmpty
(
appStaffUsers
))
{
AppStaffUser
staffUser
=
appStaffUsers
.
get
(
0
);
AppStaffUser
staffUser
=
appStaffUsers
.
get
(
0
);
AppStaffUserVo
appStaffUserVo
=
new
AppStaffUserVo
();
AppStaffUserVo
appStaffUserVo
=
new
AppStaffUserVo
();
BeanUtils
.
copyProperties
(
staffUser
,
appStaffUserVo
);
BeanUtils
.
copyProperties
(
staffUser
,
appStaffUserVo
);
Integer
suId
=
staffUser
.
getSuId
();
Integer
suId
=
staffUser
.
getSuId
();
AppUserVo
userInfoById
=
appUserDetailBiz
.
getUserInfoById
(
suId
);
AppUserVo
userInfoById
=
appUserDetailBiz
.
getUserInfoById
(
suId
);
appStaffUserVo
.
setEmployeeName
(
userInfoById
.
getRealname
());
appStaffUserVo
.
setEmployeeName
(
userInfoById
.
getRealname
());
...
@@ -76,17 +78,43 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -76,17 +78,43 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
}
}
public
boolean
select
(
AppStaffUser
appStaffUser
)
{
public
boolean
select
(
AppStaffUser
appStaffUser
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
Example
example
=
new
Example
(
AppStaffUser
.
class
);
example
.
createCriteria
().
andEqualTo
(
"uName"
,
appStaffUser
.
getUName
())
Example
.
Criteria
criteria
=
example
.
createCriteria
();
.
andEqualTo
(
"phone"
,
appStaffUser
.
getPhone
())
criteria
.
andEqualTo
(
"phone"
,
appStaffUser
.
getPhone
())
.
andEqualTo
(
"isDel"
,
0
);
.
andEqualTo
(
"isDel"
,
0
);
List
<
AppStaffUser
>
appStaffUsers
=
mapper
.
selectByExample
(
example
);
List
<
AppStaffUser
>
appStaffUsers
=
mapper
.
selectByExample
(
example
);
return
CollectionUtil
.
isEmpty
(
appStaffUsers
)
?
true
:
false
;
return
CollectionUtil
.
isEmpty
(
appStaffUsers
)
?
true
:
false
;
}
}
public
void
update
(
AppStaffUser
staffUser
,
Integer
userid
)
{
public
void
update
(
AppStaffUser
staffUser
,
Integer
userid
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
Example
example
=
new
Example
(
AppStaffUser
.
class
);
example
.
createCriteria
().
andEqualTo
(
"id"
,
staffUser
.
getId
()).
andEqualTo
(
"suId"
,
userid
);
example
.
createCriteria
().
andEqualTo
(
"id"
,
staffUser
.
getId
()).
andEqualTo
(
"suId"
,
userid
);
mapper
.
updateByExampleSelective
(
staffUser
,
example
);
mapper
.
updateByExampleSelective
(
staffUser
,
example
);
}
public
void
updateByPhone
(
AppStaffUser
staffUser
)
{
Example
example
=
new
Example
(
AppStaffUser
.
class
);
example
.
createCriteria
().
andEqualTo
(
"phone"
,
staffUser
.
getPhone
());
mapper
.
updateByExampleSelective
(
staffUser
,
example
);
}
}
/**
* 添加用户关系
* @param staffUserDTO
*/
public
void
add
(
AppStaffUserDTO
staffUserDTO
){
AppStaffUser
staffUser
=
new
AppStaffUser
();
BeanUtils
.
copyProperties
(
staffUserDTO
,
staffUser
);
staffUser
.
setStatus
(
1
);
if
(
POSITION_ID
.
equals
(
staffUserDTO
.
getPositionId
()))
{
throw
new
BaseException
(
"绑定的是员工"
);
}
if
(
select
(
staffUser
))
{
insertSelective
(
staffUser
);
}
else
{
updateByPhone
(
staffUser
);
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppStaffUserController.java
View file @
b937e843
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
...
@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
...
@@ -68,7 +69,7 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
...
@@ -68,7 +69,7 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
if
(
appStaffUser
.
getPhone
().
equals
(
infoFromToken
.
getUniqueName
())||
POSITION_ID
.
equals
(
positionId
))
{
if
(
POSITION_ID
.
equals
(
positionId
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"绑定错误"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"绑定错误"
);
}
}
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
...
@@ -120,11 +121,8 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
...
@@ -120,11 +121,8 @@ public class AppStaffUserController extends BaseController<AppStaffUserBiz, AppS
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"绑定错误"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"绑定错误"
);
}
}
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
appStaffUser
.
setSuId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
if
(
baseBiz
.
select
(
appStaffUser
))
{
baseBiz
.
updateSelectiveById
(
appStaffUser
);
baseBiz
.
updateSelectiveById
(
appStaffUser
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"客户已存在"
);
}
}
}
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