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
b6211911
Commit
b6211911
authored
Apr 01, 2020
by
huangZW
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/haoban3.0/haoban-manage3.0.git
into developer
parents
85088cf5
8fce448c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
173 additions
and
61 deletions
+173
-61
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+5
-4
EmojiFilterUtil.java
...a/com/gic/haoban/manage/service/util/EmojiFilterUtil.java
+77
-0
MemberUnionidRelatedMapper.xml
.../src/main/resources/mapper/MemberUnionidRelatedMapper.xml
+1
-0
InfoController.java
.../com/gic/haoban/manage/web/controller/InfoController.java
+89
-57
dubbo-haoban-manage-wx.xml
...ge3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
+1
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
b6211911
...
...
@@ -34,6 +34,7 @@ import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.member.api.dto.MemberDTO
;
import
com.gic.member.api.service.MemberOpenCardBusinessService
;
import
com.gic.member.api.service.MemberService
;
...
...
@@ -112,9 +113,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
StringUtils
.
isNotBlank
(
external_contact
)){
JSONObject
jt
=
JSON
.
parseObject
(
external_contact
);
unionId
=
jt
.
getString
(
"unionid"
);
name
=
MD5Utils
.
ToMD5
(
jt
.
getString
(
"name"
).
replace
(
"\\"
,
""
)
);
relaName
=
jt
.
getString
(
"name"
);
avatar
=
j
o
.
getString
(
"avatar"
);
name
=
EmojiFilterUtil
.
filterEmojiLast
(
jt
.
getString
(
"name"
),
true
);
relaName
=
EmojiFilterUtil
.
filterEmojiLast
(
jt
.
getString
(
"name"
),
true
);
avatar
=
j
t
.
getString
(
"avatar"
);
}
follow_user
=
jo
.
getString
(
"follow_user"
);
...
...
@@ -167,7 +168,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log
.
info
(
"【新增外部联系人】clerkCode={}"
,
clerkCode
);
if
(
clerk
!=
null
&&
StringUtils
.
isNotBlank
(
clerk
.
getQrcodeParam
())){
log
.
info
(
"【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}"
,
tabHaobanWxEnterpriseRelated
.
getEnterpriseId
(),
unionId
,
name
,
avatar
,
clerk
.
getQrcodeParam
());
member
=
memberOpenCardBusinessService
.
getMemberByQywxChannelParam
(
tabHaobanWxEnterpriseRelated
.
getEnterpriseId
(),
unionId
,
null
,
n
ame
,
avatar
,
clerk
.
getQrcodeParam
());
member
=
memberOpenCardBusinessService
.
getMemberByQywxChannelParam
(
tabHaobanWxEnterpriseRelated
.
getEnterpriseId
(),
unionId
,
null
,
relaN
ame
,
avatar
,
clerk
.
getQrcodeParam
());
}
log
.
info
(
"【新增外部联系人】member={},clerk={}"
,
JSON
.
toJSONString
(
member
),
JSON
.
toJSONString
(
clerk
));
if
(
member
!=
null
){
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/EmojiFilterUtil.java
0 → 100644
View file @
b6211911
package
com
.
gic
.
haoban
.
manage
.
service
.
util
;
import
com.gic.commons.util.StringUtil
;
public
class
EmojiFilterUtil
{
/**
* @param isPharse 是否是短语 若是短语则 超过20字符编程*
*/
public
static
String
filterEmojiLast
(
String
content
,
boolean
isPhrase
)
{
byte
[]
conbyte
=
content
.
getBytes
();
for
(
int
i
=
0
;
i
<
conbyte
.
length
;
i
++)
{
if
((
conbyte
[
i
]
&
0xF8
)
==
0xF0
)
{
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
conbyte
[
i
+
j
]
=
0x30
;
}
i
+=
3
;
}
}
content
=
new
String
(
conbyte
);
return
filterEmoji
(
content
.
replaceAll
(
"0000"
,
""
),
isPhrase
);
}
private
static
String
filterEmoji
(
String
source
,
boolean
isPhrase
)
{
if
(!
containsEmoji
(
source
))
{
return
source
;
// 如果不包含,直接返回
}
// 到这里铁定包含
StringBuilder
buf
=
null
;
int
len
=
source
.
length
();
if
(
len
>
20
&&
isPhrase
)
{
return
"*"
;
}
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
codePoint
=
source
.
charAt
(
i
);
if
(
isEmojiCharacter
(
codePoint
))
{
if
(
buf
==
null
)
{
buf
=
new
StringBuilder
(
source
.
length
());
}
buf
.
append
(
codePoint
);
}
}
if
(
buf
==
null
)
{
return
source
;
// 如果没有找到 emoji表情,则返回源字符串
}
else
{
if
(
buf
.
length
()
==
len
)
{
// 这里的意义在于尽可能少的toString,因为会重新生成字符串
buf
=
null
;
return
source
;
}
else
{
return
buf
.
toString
();
}
}
}
private
static
boolean
isEmojiCharacter
(
char
codePoint
)
{
return
(
codePoint
==
0x0
)
||
(
codePoint
==
0x9
)
||
(
codePoint
==
0xA
)
||
(
codePoint
==
0xD
)
||
((
codePoint
>=
0x20
)
&&
(
codePoint
<=
0xD7FF
))
||
((
codePoint
>=
0xE000
)
&&
(
codePoint
<=
0xFFFD
))
||
((
codePoint
>=
0x10000
)
&&
(
codePoint
<=
0x10FFFF
));
}
// 判断表情符
private
static
boolean
containsEmoji
(
String
source
)
{
if
(
StringUtil
.
isBlank
(
source
))
{
return
false
;
}
source
=
source
.
replaceAll
(
"[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]"
,
"*"
);
int
len
=
source
.
length
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
codePoint
=
source
.
charAt
(
i
);
if
(
isEmojiCharacter
(
codePoint
))
{
// do nothing,判断到了这里表明,确认有表情字符
return
true
;
}
}
return
false
;
}
}
haoban-manage3-service/src/main/resources/mapper/MemberUnionidRelatedMapper.xml
View file @
b6211911
...
...
@@ -180,6 +180,7 @@
where wx_user_id = #{wxUserId}
and status_flag = 1
and unionid = #{unionid}
limit 1
</select>
<update
id=
"deleteByUnionidAndUserId"
parameterType=
"com.gic.haoban.manage.service.entity.MemberUnionidRelated"
>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/InfoController.java
View file @
b6211911
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.UserLoginLogDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.interceptor.WebInterceptor
;
import
com.gic.haoban.manage.web.vo.AppStaffVo
;
import
com.gic.haoban.manage.web.vo.InfoVo
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.service.qywx.QywxCorpApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
public
class
InfoController
extends
WebBaseController
{
...
...
@@ -42,49 +35,88 @@ public class InfoController extends WebBaseController{
private
StaffApiService
staffApiService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
InfoController
.
class
);
@Autowired
private
Config
config
;
@RequestMapping
(
"get-info-by-code"
)
public
HaobanResponse
getInfoByCode
(
String
code
)
{
String
userDTOJson
=
qywxCorpApiService
.
getCodeSession
(
config
.
getWxSuiteid
(),
code
);
logger
.
info
(
"userDTOJson=============>{}"
,
userDTOJson
);
UserDTO
user
=
JSON
.
parseObject
(
userDTOJson
,
UserDTO
.
class
);
if
(
user
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
String
userId
=
user
.
getUserid
();
String
corpId
=
user
.
getCorpid
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
StaffDTO
loginStaff
=
null
;
if
(
enterprise
!=
null
){
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
userId
,
enterprise
.
getWxEnterpriseId
());
}
if
(
loginStaff
==
null
){
if
(
enterprise
!=
null
){
staffApiService
.
wxGetAdd
(
userId
,
enterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
userId
,
enterprise
.
getWxEnterpriseId
());
}
}
if
(
loginStaff
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_600001
);
}
String
wxEnterpriseId
=
loginStaff
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
accesstoken
=
qywxCorpApiService
.
getCorpAccessToken
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
());
InfoVo
infoVo
=
new
InfoVo
();
infoVo
.
setAccessToken
(
accesstoken
);
infoVo
.
setStaffId
(
loginStaff
.
getStaffId
());
infoVo
.
setWxEnterpriseId
(
wxEnterpriseId
);
infoVo
.
setStaffName
(
loginStaff
.
getStaffName
());
infoVo
.
setPhoneNumber
(
loginStaff
.
getPhoneNumber
());
infoVo
.
setNationcode
(
loginStaff
.
getNationCode
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
infoVo
);
}
public
HaobanResponse
getInfoByCode
(
String
code
)
{
String
userDTOJson
=
qywxCorpApiService
.
getCodeSession
(
config
.
getWxSuiteid
(),
code
);
logger
.
info
(
"userDTOJson=============>{}"
,
userDTOJson
);
UserDTO
user
=
JSON
.
parseObject
(
userDTOJson
,
UserDTO
.
class
);
if
(
user
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
String
userId
=
user
.
getUserid
();
String
corpId
=
user
.
getCorpid
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
StaffDTO
loginStaff
=
null
;
if
(
enterprise
!=
null
){
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
userId
,
enterprise
.
getWxEnterpriseId
());
}
if
(
loginStaff
==
null
){
if
(
enterprise
!=
null
){
staffApiService
.
wxGetAdd
(
userId
,
enterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
userId
,
enterprise
.
getWxEnterpriseId
());
}
}
if
(
loginStaff
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_600001
);
}
String
wxEnterpriseId
=
loginStaff
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
accesstoken
=
qywxCorpApiService
.
getCorpAccessToken
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
());
InfoVo
infoVo
=
new
InfoVo
();
infoVo
.
setAccessToken
(
accesstoken
);
infoVo
.
setStaffId
(
loginStaff
.
getStaffId
());
infoVo
.
setWxEnterpriseId
(
wxEnterpriseId
);
infoVo
.
setStaffName
(
loginStaff
.
getStaffName
());
infoVo
.
setPhoneNumber
(
loginStaff
.
getPhoneNumber
());
infoVo
.
setNationcode
(
loginStaff
.
getNationCode
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
infoVo
);
}
@RequestMapping
(
"get-user-by-member-code"
)
public
HaobanResponse
getInfoByMemberCode
(
String
code
,
String
gicEnterpriseId
)
{
EnterpriseDetailDTO
enterpriseDetailDTO
=
wxEnterpriseRelatedApiService
.
getByEnterpriseId
(
gicEnterpriseId
);
if
(
enterpriseDetailDTO
==
null
)
{
logger
.
info
(
"改企业没有关系好办:{}"
,
gicEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_500001
);
}
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
enterpriseDetailDTO
.
getWxEnterpriseId
());
if
(
enterpriseDetailDTO
==
null
)
{
logger
.
info
(
"改企业不存在:{}"
,
gicEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_400002
);
}
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getWxSecretKey
(),
code
);
logger
.
info
(
"会员微信登录信息=============>{}"
,
userDTOJson
);
UserDTO
user
=
JSON
.
parseObject
(
userDTOJson
,
UserDTO
.
class
);
if
(
user
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_6
);
}
String
userId
=
user
.
getUserid
();
String
corpId
=
user
.
getCorpid
();
Map
<
String
,
String
>
ret
=
new
HashMap
<>();
ret
.
put
(
"userId"
,
userId
);
ret
.
put
(
"corpId"
,
corpId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
ret
);
}
@RequestMapping
(
"save-user-login-log"
)
public
HaobanResponse
saveUserLoginLog
(
UserLoginLogDTO
userLoginLogDTO
)
{
...
...
haoban-manage3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
View file @
b6211911
...
...
@@ -28,6 +28,7 @@
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseApiService"
id=
"wxEnterpriseApiService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreService"
id=
"storeService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxCorpApiService"
id=
"qywxCorpApiService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxUserApiService"
id=
"qywxUserApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.BindApiService"
id=
"bindApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.AuditApiService"
id=
"auditApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.AuditSettingApiService"
id=
"auditSettingApiService"
/>
...
...
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