Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
9a7b22d2
Commit
9a7b22d2
authored
Mar 21, 2022
by
李健华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加通过unionid批量获取关联信息
parent
266e8f0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
12 deletions
+35
-12
WeChatController.java
...quantgroup/xyqb/controller/external/WeChatController.java
+19
-4
WechatInfoRelation.java
...in/java/cn/quantgroup/xyqb/entity/WechatInfoRelation.java
+5
-8
IWeChatInfoRelationRepository.java
...tgroup/xyqb/repository/IWeChatInfoRelationRepository.java
+2
-0
IWechatFollowService.java
.../quantgroup/xyqb/service/wechat/IWechatFollowService.java
+4
-0
WechatFollowServiceImpl.java
...oup/xyqb/service/wechat/impl/WechatFollowServiceImpl.java
+5
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/WeChatController.java
View file @
9a7b22d2
...
@@ -12,8 +12,10 @@ import cn.quantgroup.xyqb.model.webchat.AccessTokenResponse;
...
@@ -12,8 +12,10 @@ import cn.quantgroup.xyqb.model.webchat.AccessTokenResponse;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.session.ISessionService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatFollowService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Joiner
;
...
@@ -24,10 +26,7 @@ import org.apache.commons.lang.StringUtils;
...
@@ -24,10 +26,7 @@ import org.apache.commons.lang.StringUtils;
import
org.apache.http.HttpStatus
;
import
org.apache.http.HttpStatus
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
@@ -39,6 +38,7 @@ import java.net.MalformedURLException;
...
@@ -39,6 +38,7 @@ import java.net.MalformedURLException;
import
java.net.URL
;
import
java.net.URL
;
import
java.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
@@ -85,6 +85,9 @@ public class WeChatController implements IBaseController {
...
@@ -85,6 +85,9 @@ public class WeChatController implements IBaseController {
*/
*/
@Value
(
"${m.https}"
)
@Value
(
"${m.https}"
)
private
String
xjdDomain
;
private
String
xjdDomain
;
@Autowired
private
IWechatFollowService
wechatFollowService
;
/**
/**
* 开发者资质认证,有必要吗?
* 开发者资质认证,有必要吗?
*
*
...
@@ -468,4 +471,16 @@ public class WeChatController implements IBaseController {
...
@@ -468,4 +471,16 @@ public class WeChatController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
"通过unionId查询的绑定微信相关信息"
,
wechatUserInfoList
);
return
JsonResult
.
buildSuccessResult
(
"通过unionId查询的绑定微信相关信息"
,
wechatUserInfoList
);
}
}
@PostMapping
(
"/getByUnionIdsToUserIds"
)
public
JsonResult
getByUnionIdsToUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
log
.
info
(
"根据unionIds获取企业绑定用户信息 {}"
,
params
);
List
<
String
>
unionIds
=
(
List
<
String
>)
params
.
get
(
"unionIds"
);
if
(
unionIds
.
size
()
>
500
)
{
unionIds
=
unionIds
.
subList
(
0
,
500
);
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"YYYYMMdd"
);
String
period
=
simpleDateFormat
.
format
(
new
Date
());
return
JsonResult
.
buildSuccessResultGeneric
(
wechatFollowService
.
findByUnionIdsToUserIds
(
unionIds
,
period
));
}
}
}
src/main/java/cn/quantgroup/xyqb/entity/WechatInfoRelation.java
View file @
9a7b22d2
...
@@ -6,6 +6,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -6,6 +6,7 @@ import org.springframework.beans.BeanUtils;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.sql.Date
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
/**
/**
...
@@ -23,14 +24,10 @@ public class WechatInfoRelation extends BaseEntity implements Serializable {
...
@@ -23,14 +24,10 @@ public class WechatInfoRelation extends BaseEntity implements Serializable {
private
String
openId
;
private
String
openId
;
@Column
(
name
=
"union_id"
)
@Column
(
name
=
"union_id"
)
private
String
unionId
;
private
String
unionId
;
@Column
(
name
=
"is_follow_wechat"
)
@Column
(
name
=
"type"
)
private
Integer
isFollowWechat
;
private
Integer
type
;
@Column
(
name
=
"is_follow_enterprise_wechat"
)
@Column
(
name
=
"task_period"
)
private
Integer
isFollowEnterpriseWechat
;
private
String
taskPeriod
;
@Column
(
name
=
"is_followed_wechat"
)
private
Integer
isFollowedWechat
;
@Column
(
name
=
"is_followed_enterprise_wechat"
)
private
Integer
isFollowedEnterpriseWechat
;
}
}
src/main/java/cn/quantgroup/xyqb/repository/IWeChatInfoRelationRepository.java
View file @
9a7b22d2
...
@@ -19,4 +19,6 @@ public interface IWeChatInfoRelationRepository extends JpaRepository<WechatInfoR
...
@@ -19,4 +19,6 @@ public interface IWeChatInfoRelationRepository extends JpaRepository<WechatInfoR
@Query
(
value
=
"update wechat_info_relation as wir set wir.is_follow_wechat = 1 where wir.open_id IN (?1)"
,
nativeQuery
=
true
)
@Query
(
value
=
"update wechat_info_relation as wir set wir.is_follow_wechat = 1 where wir.open_id IN (?1)"
,
nativeQuery
=
true
)
void
updateIsFollowWechatInOpenIdList
(
List
<
String
>
openIdList
);
void
updateIsFollowWechatInOpenIdList
(
List
<
String
>
openIdList
);
List
<
WechatInfoRelation
>
findByUnionIdInAndTaskPeriod
(
List
<
String
>
unionIdList
,
String
period
);
}
}
src/main/java/cn/quantgroup/xyqb/service/wechat/IWechatFollowService.java
View file @
9a7b22d2
...
@@ -4,10 +4,14 @@ import cn.quantgroup.xyqb.entity.WechatUserInfo;
...
@@ -4,10 +4,14 @@ import cn.quantgroup.xyqb.entity.WechatUserInfo;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.webchat.AccessTokenResponse
;
import
cn.quantgroup.xyqb.model.webchat.AccessTokenResponse
;
import
java.util.List
;
public
interface
IWechatFollowService
{
public
interface
IWechatFollowService
{
AccessTokenResponse
getToken
();
AccessTokenResponse
getToken
();
JsonResult
executeWechatFollowStatus
(
String
nextOpenId
,
String
period
);
JsonResult
executeWechatFollowStatus
(
String
nextOpenId
,
String
period
);
void
executeTask
();
void
executeTask
();
Object
findByUnionIdsToUserIds
(
List
<
String
>
unionIds
,
String
period
);
}
}
src/main/java/cn/quantgroup/xyqb/service/wechat/impl/WechatFollowServiceImpl.java
View file @
9a7b22d2
...
@@ -181,6 +181,11 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
...
@@ -181,6 +181,11 @@ public class WechatFollowServiceImpl implements IWechatFollowService {
executeEnterpriseFollowStatus
(
""
,
period
);
executeEnterpriseFollowStatus
(
""
,
period
);
}
}
@Override
public
Object
findByUnionIdsToUserIds
(
List
<
String
>
unionIds
,
String
period
)
{
return
weChatInfoRelationRepository
.
findByUnionIdInAndTaskPeriod
(
unionIds
,
period
);
}
private
JsonResult
executeEnterpriseFollowStatus
(
String
s
,
String
period
)
{
private
JsonResult
executeEnterpriseFollowStatus
(
String
s
,
String
period
)
{
try
{
try
{
...
...
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