Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
9f473ac6
Commit
9f473ac6
authored
Apr 15, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:登录修改
parent
6af2cb73
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
183 additions
and
42 deletions
+183
-42
StaffPrivacyUseLogDTO.java
.../com/gic/haoban/manage/api/dto/StaffPrivacyUseLogDTO.java
+21
-0
WxEnterpriseApiService.java
...gic/haoban/manage/api/service/WxEnterpriseApiService.java
+5
-4
TabStaffPrivacyUseLog.java
...c/haoban/manage/service/entity/TabStaffPrivacyUseLog.java
+9
-0
StaffPrivacyUseLogBO.java
...c/haoban/manage/service/pojo/bo/StaffPrivacyUseLogBO.java
+10
-0
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+12
-4
StaffPrivacyUseLogMapper.xml
...ce/src/main/resources/mapper/StaffPrivacyUseLogMapper.xml
+47
-14
WxEnterpriseInfoController.java
...ban/manage/web/controller/WxEnterpriseInfoController.java
+69
-20
StaffLoginQO.java
.../main/java/com/gic/haoban/manage/web/qo/StaffLoginQO.java
+10
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffPrivacyUseLogDTO.java
View file @
9f473ac6
...
...
@@ -76,6 +76,11 @@ public class StaffPrivacyUseLogDTO implements Serializable {
*/
private
Date
updateTime
;
private
String
wxUserId
;
/**
* 第三方用户id
*/
private
String
wxOpenUseId
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -179,4 +184,20 @@ public class StaffPrivacyUseLogDTO implements Serializable {
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getWxUserId
()
{
return
wxUserId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/WxEnterpriseApiService.java
View file @
9f473ac6
...
...
@@ -203,11 +203,12 @@ public interface WxEnterpriseApiService {
void
agreeExternalUseridFlag
(
String
wxEnterpriseId
,
Integer
openFlag
);
/**
* 好办登录
* 好办登录
-插入隐私协议
*
* @param staff
LoginDTO 员工登录
dto
* @param staff
PrivacyUseLogDTO 员工隐私使用日志
dto
* @author mozhu
* @date 202
1-12-15 11:02:52
* @date 202
2-04-15 15:03:14
*/
void
wellDoneLogin
(
StaffLoginDTO
staffLoginDTO
);
void
wellDoneLoginAddPrivacy
(
StaffPrivacyUseLogDTO
staffPrivacyUseLogDTO
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabStaffPrivacyUseLog.java
View file @
9f473ac6
...
...
@@ -75,6 +75,7 @@ public class TabStaffPrivacyUseLog implements Serializable {
* update_time
*/
private
Date
updateTime
;
private
String
wxOpenUseId
;
public
Long
getId
()
{
return
id
;
...
...
@@ -179,4 +180,12 @@ public class TabStaffPrivacyUseLog implements Serializable {
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/bo/StaffPrivacyUseLogBO.java
View file @
9f473ac6
...
...
@@ -75,6 +75,8 @@ public class StaffPrivacyUseLogBO implements Serializable {
*/
private
Date
updateTime
;
private
String
wxOpenUseId
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -178,4 +180,12 @@ public class StaffPrivacyUseLogBO implements Serializable {
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
9f473ac6
...
...
@@ -123,7 +123,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
secretSetting
.
setSecretVal
(
permanentCode
);
secretSettingService
.
saveSecretSetting
(
secretSetting
);
}
agreeExternalUseridFlag
(
wxEnterpriseId
,
1
);
agreeExternalUseridFlag
(
wxEnterpriseId
,
1
);
log
.
info
(
"企业微信授权处理完成"
);
}
...
...
@@ -351,13 +351,21 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
@Override
public
void
wellDoneLogin
(
StaffLoginDTO
staffLogin
DTO
)
{
public
void
wellDoneLogin
AddPrivacy
(
StaffPrivacyUseLogDTO
staffPrivacyUseLog
DTO
)
{
//插入隐私协议
StaffPrivacyUseLogBO
staffPrivacyUseLogBO
=
new
StaffPrivacyUseLogBO
();
BeanUtils
.
copyProperties
(
staffLoginDTO
,
staffPrivacyUseLogBO
);
StaffPrivacyUseLogBO
privacyUseLog
=
staffPrivacyUseLogService
.
getByStaffId
(
staffLoginDTO
.
getStaffId
());
BeanUtils
.
copyProperties
(
staffPrivacyUseLogDTO
,
staffPrivacyUseLogBO
);
String
staffId
=
staffPrivacyUseLogDTO
.
getStaffId
();
if
(
StringUtils
.
isNotBlank
(
staffId
))
{
StaffPrivacyUseLogBO
privacyUseLog
=
staffPrivacyUseLogService
.
getByStaffId
(
staffId
);
if
(
privacyUseLog
==
null
)
{
staffPrivacyUseLogService
.
insert
(
staffPrivacyUseLogBO
);
}
}
else
{
StaffPrivacyUseLogBO
privacyUseLogBO
=
staffPrivacyUseLogService
.
getByUserId
(
staffPrivacyUseLogDTO
.
getWxOpenUseId
());
if
(
privacyUseLogBO
==
null
)
{
staffPrivacyUseLogService
.
insert
(
staffPrivacyUseLogBO
);
}
}
}
}
haoban-manage3-service/src/main/resources/mapper/StaffPrivacyUseLogMapper.xml
View file @
9f473ac6
...
...
@@ -17,6 +17,7 @@
<result
column=
"staff_ip"
property=
"staffIp"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"wx_open_user_id"
property=
"wxOpenUseId"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
...
...
@@ -32,7 +33,8 @@
staff_phone_version,
staff_ip,
create_time,
update_time
update_time,
wx_open_user_id
</sql>
<insert
id=
"insert"
useGeneratedKeys=
"true"
keyColumn=
"id"
keyProperty=
"id"
...
...
@@ -42,6 +44,9 @@
<if
test=
"null != staffId and '' != staffId"
>
staff_id,
</if>
<if
test=
"null != wxOpenUseId"
>
wx_open_user_id
</if>
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
wx_enterprise_id,
</if>
...
...
@@ -80,6 +85,9 @@
<if
test=
"null != staffId and '' != staffId"
>
#{staffId},
</if>
<if
test=
"null != wxOpenUseId"
>
#{wxOpenUseId},
</if>
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
#{wxEnterpriseId},
</if>
...
...
@@ -119,20 +127,45 @@
<update
id=
"update"
parameterType=
"com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog"
>
UPDATE tab_staff_privacy_use_log
<set>
<if
test=
"null != staffId and '' != staffId"
>
staff_id = #{staffId},
</if>
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if
test=
"null != privacyUseFlag"
>
privacy_use_flag = #{privacyUseFlag},
</if>
<if
test=
"null != phoneNumber and '' != phoneNumber"
>
phone_number = #{phoneNumber},
</if>
<if
test=
"null != welldoneVersion and '' != welldoneVersion"
>
welldone_version = #{welldoneVersion},
</if>
<if
test=
"null != weworkVersion and '' != weworkVersion"
>
wework_version = #{weworkVersion},
</if>
<if
test=
"null != staffPhoneBrand and '' != staffPhoneBrand"
>
staff_phone_brand = #{staffPhoneBrand},
</if>
<if
test=
"null != staffPhoneModel and '' != staffPhoneModel"
>
staff_phone_model = #{staffPhoneModel},
</if>
<if
test=
"null != staffPhoneVersion and '' != staffPhoneVersion"
>
staff_phone_version =
#{staffPhoneVersion},
<if
test=
"null != staffId and '' != staffId"
>
staff_id = #{staffId},
</if>
<if
test=
"null != wxOpenUseId"
>
wx_open_user_id = #{wxOpenUseId},
</if>
<if
test=
"null != wxEnterpriseId and '' != wxEnterpriseId"
>
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if
test=
"null != privacyUseFlag"
>
privacy_use_flag = #{privacyUseFlag},
</if>
<if
test=
"null != phoneNumber and '' != phoneNumber"
>
phone_number = #{phoneNumber},
</if>
<if
test=
"null != welldoneVersion and '' != welldoneVersion"
>
welldone_version = #{welldoneVersion},
</if>
<if
test=
"null != weworkVersion and '' != weworkVersion"
>
wework_version = #{weworkVersion},
</if>
<if
test=
"null != staffPhoneBrand and '' != staffPhoneBrand"
>
staff_phone_brand = #{staffPhoneBrand},
</if>
<if
test=
"null != staffPhoneModel and '' != staffPhoneModel"
>
staff_phone_model = #{staffPhoneModel},
</if>
<if
test=
"null != staffPhoneVersion and '' != staffPhoneVersion"
>
staff_phone_version = #{staffPhoneVersion},
</if>
<if
test=
"null != staffIp and '' != staffIp"
>
staff_ip = #{staffIp},
</if>
<if
test=
"null != createTime"
>
create_time = #{createTime},
</if>
<if
test=
"null != updateTime"
>
update_time = #{updateTime}
</if>
<if
test=
"null != staffIp and '' != staffIp"
>
staff_ip = #{staffIp},
</if>
<if
test=
"null != createTime"
>
create_time = #{createTime},
</if>
<if
test=
"null != updateTime"
>
update_time = #{updateTime}
</if>
</set>
WHERE id = #{id}
</update>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseInfoController.java
View file @
9f473ac6
...
...
@@ -195,6 +195,63 @@ public class WxEnterpriseInfoController extends WebBaseController {
@IgnoreLogin
public
RestResponse
<
String
>
welldoneLogin
(
@RequestBody
@Valid
StaffLoginQO
staffLoginQO
,
HttpServletRequest
request
)
{
String
staffId
=
staffLoginQO
.
getStaffId
();
String
wxOpenUseId
=
staffLoginQO
.
getWxOpenUseId
();
//-1 代表游客登录
if
(
"-1"
.
equals
(
staffId
))
{
return
wellDoneLoginPrivacy
(
staffLoginQO
,
request
,
staffId
,
wxOpenUseId
);
}
//用户登录
return
wellDoneLogin
(
staffLoginQO
,
request
,
staffId
);
}
/**
* 游客登录
* @param staffLoginQO
* @param request
* @param staffId
* @param wxOpenUseId
* @return
*/
private
RestResponse
<
String
>
wellDoneLoginPrivacy
(
StaffLoginQO
staffLoginQO
,
HttpServletRequest
request
,
String
staffId
,
String
wxOpenUseId
)
{
logger
.
info
(
"游客登录,wxOpenUseId:{}"
,
wxOpenUseId
);
//登录和刷新token兼容
String
headerToken
=
AuthRequestWellDoneUtil
.
getHeaderToken
();
if
(
StringUtils
.
isNotBlank
(
headerToken
))
{
return
getRefreshToken
();
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"staffId"
,
"-1"
);
map
.
put
(
"wxOpenUseId"
,
wxOpenUseId
);
String
token
=
JwtUtil
.
genToken
(
map
);
AuthRequestWellDoneUtil
.
setAppLoginUser
(
staffId
,
token
);
StaffPrivacyUseLogDTO
privacyUseLogDTO
=
new
StaffPrivacyUseLogDTO
();
BeanUtils
.
copyProperties
(
staffLoginQO
,
privacyUseLogDTO
);
privacyUseLogDTO
.
setStaffIp
(
IPAddressUtil
.
getIpAddress
(
request
));
wxEnterpriseApiService
.
wellDoneLoginAddPrivacy
(
privacyUseLogDTO
);
return
RestResponse
.
successResult
(
token
);
}
/**
* 刷新token
* @return
*/
private
RestResponse
<
String
>
getRefreshToken
()
{
String
refreshToken
=
AuthRequestWellDoneUtil
.
refreshToken
();
if
(
StringUtils
.
isBlank
(
refreshToken
))
{
return
RestResponse
.
failure
(
String
.
valueOf
(
HaoBanErrCode
.
ERR_30010
.
getCode
()),
HaoBanErrCode
.
ERR_30010
.
getMsg
());
}
return
RestResponse
.
successResult
(
refreshToken
);
}
/**
* 用户登录
* @param staffLoginQO
* @param request
* @param staffId
* @return
*/
private
RestResponse
<
String
>
wellDoneLogin
(
StaffLoginQO
staffLoginQO
,
HttpServletRequest
request
,
String
staffId
)
{
// 正常登录
String
loginPhoneNumber
=
staffLoginQO
.
getPhoneNumber
();
logger
.
info
(
"好办登录,staffId:{},loginPhoneNumber:{}"
,
staffId
,
loginPhoneNumber
);
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
staffId
);
...
...
@@ -209,11 +266,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
//登录和刷新token兼容
String
headerToken
=
AuthRequestWellDoneUtil
.
getHeaderToken
();
if
(
StringUtils
.
isNotBlank
(
headerToken
))
{
String
refreshToken
=
AuthRequestWellDoneUtil
.
refreshToken
();
if
(
StringUtils
.
isBlank
(
refreshToken
))
{
return
RestResponse
.
failure
(
String
.
valueOf
(
HaoBanErrCode
.
ERR_30010
.
getCode
()),
HaoBanErrCode
.
ERR_30010
.
getMsg
());
}
return
RestResponse
.
successResult
(
refreshToken
);
return
getRefreshToken
();
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"staffId"
,
staffId
);
...
...
@@ -221,13 +274,13 @@ public class WxEnterpriseInfoController extends WebBaseController {
map
.
put
(
"phoneNumber"
,
phoneNumber
);
String
token
=
JwtUtil
.
genToken
(
map
);
AuthRequestWellDoneUtil
.
setAppLoginUser
(
staffId
,
token
);
Staff
LoginDTO
staffLoginDTO
=
new
StaffLogin
DTO
();
BeanUtils
.
copyProperties
(
staffLoginQO
,
staffLogin
DTO
);
staffLogin
DTO
.
setStaffIp
(
IPAddressUtil
.
getIpAddress
(
request
));
staff
DTO
.
setWxEnterpriseId
(
staffDTO
.
getWxEnterpriseId
());
staff
DTO
.
setPhoneNumber
(
phoneNumber
);
staff
DTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
wxEnterpriseApiService
.
wellDoneLogin
(
staffLogin
DTO
);
Staff
PrivacyUseLogDTO
privacyUseLogDTO
=
new
StaffPrivacyUseLog
DTO
();
BeanUtils
.
copyProperties
(
staffLoginQO
,
privacyUseLog
DTO
);
privacyUseLog
DTO
.
setStaffIp
(
IPAddressUtil
.
getIpAddress
(
request
));
privacyUseLog
DTO
.
setWxEnterpriseId
(
staffDTO
.
getWxEnterpriseId
());
privacyUseLog
DTO
.
setPhoneNumber
(
phoneNumber
);
privacyUseLog
DTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
wxEnterpriseApiService
.
wellDoneLogin
AddPrivacy
(
privacyUseLog
DTO
);
return
RestResponse
.
successResult
(
token
);
}
...
...
@@ -239,12 +292,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @date 2021-12-10 18:34:12
*/
@RequestMapping
(
value
=
"welldone-token-refresh"
,
method
=
RequestMethod
.
GET
)
public
HaobanResponse
welldoneTokenRefresh
()
{
String
token
=
AuthRequestWellDoneUtil
.
refreshToken
();
if
(
StringUtils
.
isBlank
(
token
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_30010
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
token
);
public
RestResponse
<
String
>
welldoneTokenRefresh
()
{
return
getRefreshToken
();
}
/**
...
...
@@ -253,9 +302,9 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @return
*/
@RequestMapping
(
value
=
"welldone-loginout"
,
method
=
RequestMethod
.
GET
)
public
Haoban
Response
welldoneLoginOut
()
{
public
Rest
Response
welldoneLoginOut
()
{
AuthRequestWellDoneUtil
.
delToken
();
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
return
RestResponse
.
successResult
(
);
}
/**
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/StaffLoginQO.java
View file @
9f473ac6
...
...
@@ -51,6 +51,8 @@ public class StaffLoginQO implements Serializable {
* 用户手机版本
*/
private
String
staffPhoneVersion
;
@NotEmpty
(
message
=
"用户id不允许为空"
)
private
String
wxOpenUseId
;
public
String
getStaffId
()
{
return
staffId
;
...
...
@@ -139,4 +141,12 @@ public class StaffLoginQO implements Serializable {
public
void
setStaffPhoneVersion
(
String
staffPhoneVersion
)
{
this
.
staffPhoneVersion
=
staffPhoneVersion
;
}
public
String
getWxOpenUseId
()
{
return
wxOpenUseId
;
}
public
void
setWxOpenUseId
(
String
wxOpenUseId
)
{
this
.
wxOpenUseId
=
wxOpenUseId
;
}
}
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