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
d02d0aaa
Commit
d02d0aaa
authored
Dec 17, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改客户管理
parent
a6192428
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
21 deletions
+50
-21
AppStaffUser.java
...om/github/wxiaoqi/security/admin/entity/AppStaffUser.java
+4
-0
AppStaffUserBiz.java
...om/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
+45
-18
AppStaffUserController.java
...b/wxiaoqi/security/admin/rest/AppStaffUserController.java
+1
-3
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppStaffUser.java
View file @
d02d0aaa
...
@@ -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/src/main/java/com/github/wxiaoqi/security/admin/biz/AppStaffUserBiz.java
View file @
d02d0aaa
...
@@ -4,9 +4,11 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -4,9 +4,11 @@ import cn.hutool.core.collection.CollectionUtil;
import
com.alibaba.druid.sql.visitor.functions.If
;
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.AppStaffUserVo
;
import
com.github.wxiaoqi.security.admin.entity.AppStaffUserVo
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
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,16 +22,18 @@ import java.util.List;
...
@@ -20,16 +22,18 @@ 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
);
}
}
@Override
@Override
...
@@ -39,7 +43,6 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -39,7 +43,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 +50,21 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -47,21 +50,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 +79,41 @@ public class AppStaffUserBiz extends BaseBiz<AppStaffUserMapper, AppStaffUser> {
...
@@ -76,17 +79,41 @@ 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
);
}
public
void
add
(
AppStaffUser
appStaffUser
){
Integer
positionId
=
null
;
try
{
AppUserLogin
userByUsername
=
appUserLoginBiz
.
getUserByUsername
(
appStaffUser
.
getPhone
());
positionId
=
appUserDetailBiz
.
getUserInfoById
(
userByUsername
.
getId
()).
getPositionId
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
POSITION_ID
.
equals
(
positionId
))
{
throw
new
BaseException
(
"绑定的是员工"
);
}
if
(
select
(
appStaffUser
))
{
insertSelective
(
appStaffUser
);
}
else
{
updateByPhone
(
appStaffUser
);
}
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppStaffUserController.java
View file @
d02d0aaa
...
@@ -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
;
...
@@ -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