Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
cms-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
cms-ci-test
Commits
3dc73409
提交
3dc73409
authored
5月 27, 2023
作者:
zhenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信调用、用户相关接口
上级
2df3064a
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
124 行增加
和
75 行删除
+124
-75
ResultEnum.java
...-util/src/main/java/com/mmc/iuav/response/ResultEnum.java
+1
-0
UserAccountController.java
...a/com/mmc/iuav/user/controller/UserAccountController.java
+9
-4
WxController.java
.../main/java/com/mmc/iuav/user/controller/WxController.java
+12
-5
UserAccountDO.java
...src/main/java/com/mmc/iuav/user/entity/UserAccountDO.java
+5
-1
UserAccountService.java
...in/java/com/mmc/iuav/user/service/UserAccountService.java
+8
-0
WxService.java
...er/src/main/java/com/mmc/iuav/user/service/WxService.java
+15
-1
UserAccountServiceImpl.java
...om/mmc/iuav/user/service/impl/UserAccountServiceImpl.java
+22
-3
WxServiceImpl.java
...in/java/com/mmc/iuav/user/service/impl/WxServiceImpl.java
+28
-5
application-dev.yml
...e/cms-service-user/src/main/resources/application-dev.yml
+0
-16
application-local.yml
...cms-service-user/src/main/resources/application-local.yml
+0
-16
application-prod.yml
.../cms-service-user/src/main/resources/application-prod.yml
+0
-16
application.yml
...rvice/cms-service-user/src/main/resources/application.yml
+16
-0
UserServiceDao.xml
...service-user/src/main/resources/mapper/UserServiceDao.xml
+8
-8
没有找到文件。
cms-common/cms-common-util/src/main/java/com/mmc/iuav/response/ResultEnum.java
浏览文件 @
3dc73409
...
@@ -22,6 +22,7 @@ public enum ResultEnum implements BaseErrorInfoInterface{
...
@@ -22,6 +22,7 @@ public enum ResultEnum implements BaseErrorInfoInterface{
PASSWORD_INCONSISTENT
(
"5026"
,
"新密码与确认密码不一致,请确认一致"
),
PASSWORD_INCONSISTENT
(
"5026"
,
"新密码与确认密码不一致,请确认一致"
),
WX_ACCESS_TOKEN_ERROR
(
"5027"
,
"获取微信AccessToken失败"
),
WX_ACCESS_TOKEN_ERROR
(
"5027"
,
"获取微信AccessToken失败"
),
APPLET_QR_CODE_CREATE_ERROR
(
"5030"
,
"生成小程序码错误:"
),
APPLET_QR_CODE_CREATE_ERROR
(
"5030"
,
"生成小程序码错误:"
),
AUTH_PHONE_NUMBER_ERROR
(
"5031"
,
"授权手机号失败"
),
PWD_CREATE_ERROR
(
"6001"
,
"创建密码失败"
),
PWD_CREATE_ERROR
(
"6001"
,
"创建密码失败"
),
PWD_CONPARED_ERROR
(
"6002"
,
"密码错误"
),
PWD_ALERT_ERROR
(
"6003"
,
"密码不一致"
),
PWD_CONPARED_ERROR
(
"6002"
,
"密码错误"
),
PWD_ALERT_ERROR
(
"6003"
,
"密码不一致"
),
...
...
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/UserAccountController.java
浏览文件 @
3dc73409
...
@@ -5,10 +5,7 @@ import com.mmc.iuav.response.ResultBody;
...
@@ -5,10 +5,7 @@ import com.mmc.iuav.response.ResultBody;
import
com.mmc.iuav.user.model.dto.UserAccountSimpleDTO
;
import
com.mmc.iuav.user.model.dto.UserAccountSimpleDTO
;
import
com.mmc.iuav.user.model.vo.UserAccountVO
;
import
com.mmc.iuav.user.model.vo.UserAccountVO
;
import
com.mmc.iuav.user.service.UserAccountService
;
import
com.mmc.iuav.user.service.UserAccountService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -56,4 +53,12 @@ public class UserAccountController extends BaseController{
...
@@ -56,4 +53,12 @@ public class UserAccountController extends BaseController{
return
userAccountService
.
feignListUserAccountIds
(
provinceCode
,
cityCode
,
districtCode
);
return
userAccountService
.
feignListUserAccountIds
(
provinceCode
,
cityCode
,
districtCode
);
}
}
@ApiOperation
(
value
=
"授权手机号"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
Integer
.
class
)
})
@GetMapping
(
"getUserPhoneNumber"
)
public
ResultBody
getUserPhoneNumber
(
HttpServletRequest
request
,
@ApiParam
(
value
=
"授权手机号code"
,
required
=
true
)
@RequestParam
String
code
)
{
return
userAccountService
.
getUserPhoneNumber
(
this
.
getUserLoginInfo
(
request
).
getId
(),
code
);
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/controller/WxController.java
浏览文件 @
3dc73409
...
@@ -18,7 +18,7 @@ import java.io.PrintWriter;
...
@@ -18,7 +18,7 @@ import java.io.PrintWriter;
@Api
(
tags
=
"微信相关接口"
)
@Api
(
tags
=
"微信相关接口"
)
@RequestMapping
(
"/wx/"
)
@RequestMapping
(
"/wx/"
)
@RestController
@RestController
public
class
WxController
{
public
class
WxController
extends
BaseController
{
@Autowired
@Autowired
private
WxService
wxService
;
private
WxService
wxService
;
...
@@ -26,15 +26,15 @@ public class WxController {
...
@@ -26,15 +26,15 @@ public class WxController {
@ApiOperation
(
value
=
"小程序-获取当前用户的小程序推荐码"
)
@ApiOperation
(
value
=
"小程序-获取当前用户的小程序推荐码"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
String
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
String
.
class
)
})
@PostMapping
(
"getAppletRcdCode"
)
@PostMapping
(
"getAppletRcdCode"
)
public
ResultBody
getAppletRcdCode
(
HttpServletRequest
request
)
{
public
ResultBody
getAppletRcdCode
(
HttpServletRequest
request
,
@ApiParam
(
value
=
"小程序路径"
,
example
=
"pages/welcome/index"
)
@RequestParam
String
page
)
{
return
null
;
return
wxService
.
getUnLimitedQRCode
(
page
,
"currentUserAccountId="
+
this
.
getUserLoginInfo
(
request
).
getId
())
;
}
}
@ApiOperation
(
value
=
"小程序-测试专用"
)
@ApiOperation
(
value
=
"小程序-测试专用"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@PostMapping
(
"testDemo"
)
@PostMapping
(
"testDemo"
)
public
ResultBody
testDemo
()
{
public
ResultBody
testDemo
()
{
return
ResultBody
.
success
(
"app:"
+
wxService
.
getAccessToken
()
+
"sub: "
+
wxService
.
getSubAccessToken
());
return
ResultBody
.
success
(
"app:"
+
"wxService.getAccessToken()"
+
"sub: "
+
wxService
.
getSubAccessToken
());
}
}
/**
/**
...
@@ -54,7 +54,7 @@ public class WxController {
...
@@ -54,7 +54,7 @@ public class WxController {
return
ResultBody
.
success
(
wxService
.
createUrlLink
(
path
,
query
));
return
ResultBody
.
success
(
wxService
.
createUrlLink
(
path
,
query
));
}
}
@ApiOperation
(
value
=
"监控微信公众号的事件变化通知"
)
@ApiOperation
(
value
=
"监控微信公众号的事件变化通知"
,
hidden
=
true
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
String
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
String
.
class
)
})
@PostMapping
(
"wxSendMessage"
)
@PostMapping
(
"wxSendMessage"
)
public
void
wxSendMessage
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
IOException
{
public
void
wxSendMessage
(
HttpServletRequest
req
,
HttpServletResponse
resp
)
throws
IOException
{
...
@@ -65,4 +65,11 @@ public class WxController {
...
@@ -65,4 +65,11 @@ public class WxController {
String
msg
=
wxService
.
receiveSubAccountEvents
(
req
);
String
msg
=
wxService
.
receiveSubAccountEvents
(
req
);
out
.
println
(
msg
);
out
.
println
(
msg
);
}
}
@ApiOperation
(
value
=
"生成小程序码"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@GetMapping
(
"getAppletQRCode"
)
public
ResultBody
getAppletQRCode
(
@ApiParam
(
value
=
"小程序路径"
,
example
=
"pages/welcome/index"
)
@RequestParam
String
page
,
@ApiParam
(
value
=
"参数"
,
example
=
"name=123&sex=456"
)
@RequestParam
String
scene
)
{
return
wxService
.
getUnLimitedQRCode
(
page
,
scene
);
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/entity/UserAccountDO.java
浏览文件 @
3dc73409
...
@@ -44,6 +44,9 @@ public class UserAccountDO implements Serializable {
...
@@ -44,6 +44,9 @@ public class UserAccountDO implements Serializable {
private
Integer
cityCode
;
private
Integer
cityCode
;
private
Integer
districtCode
;
private
Integer
districtCode
;
private
Integer
cooperationTagId
;
private
Integer
companyAuthStatus
;
public
UserAccountDO
(
UserAccountVO
userAccountVO
)
{
public
UserAccountDO
(
UserAccountVO
userAccountVO
)
{
this
.
id
=
userAccountVO
.
getId
();
this
.
id
=
userAccountVO
.
getId
();
this
.
phoneNum
=
userAccountVO
.
getPhoneNum
();
this
.
phoneNum
=
userAccountVO
.
getPhoneNum
();
...
@@ -73,12 +76,13 @@ public class UserAccountDO implements Serializable {
...
@@ -73,12 +76,13 @@ public class UserAccountDO implements Serializable {
public
UserAccountVO
buildUserAccountVO
()
{
public
UserAccountVO
buildUserAccountVO
()
{
return
UserAccountVO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
uid
).
accountNo
(
this
.
accountNo
).
accountType
(
this
.
accountType
).
phoneNum
(
this
.
phoneNum
).
userName
(
this
.
userName
).
nickName
(
this
.
nickName
)
return
UserAccountVO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
uid
).
accountNo
(
this
.
accountNo
).
accountType
(
this
.
accountType
).
phoneNum
(
this
.
phoneNum
).
userName
(
this
.
userName
).
nickName
(
this
.
nickName
)
.
userImg
(
this
.
userImg
).
userSex
(
this
.
userSex
).
email
(
this
.
email
).
source
(
this
.
source
).
accountStatus
(
this
.
accountStatus
).
remark
(
this
.
remark
).
portType
(
this
.
portType
)
.
userImg
(
this
.
userImg
).
userSex
(
this
.
userSex
).
email
(
this
.
email
).
source
(
this
.
source
).
accountStatus
(
this
.
accountStatus
).
remark
(
this
.
remark
).
portType
(
this
.
portType
)
.
createTime
(
this
.
createTime
).
build
();
.
createTime
(
this
.
createTime
).
companyAuthStatus
(
this
.
companyAuthStatus
).
cooperationTagId
(
this
.
cooperationTagId
).
build
();
}
}
public
UserAccountSimpleDTO
buildUserAccountSimpleDTO
()
{
public
UserAccountSimpleDTO
buildUserAccountSimpleDTO
()
{
return
UserAccountSimpleDTO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
uid
).
accountNo
(
this
.
accountNo
).
accountType
(
this
.
accountType
).
phoneNum
(
this
.
phoneNum
).
userName
(
this
.
userName
).
nickName
(
this
.
nickName
)
return
UserAccountSimpleDTO
.
builder
().
id
(
this
.
id
).
uid
(
this
.
uid
).
accountNo
(
this
.
accountNo
).
accountType
(
this
.
accountType
).
phoneNum
(
this
.
phoneNum
).
userName
(
this
.
userName
).
nickName
(
this
.
nickName
)
.
userImg
(
this
.
userImg
).
userSex
(
this
.
userSex
).
email
(
this
.
email
).
source
(
this
.
source
).
accountStatus
(
this
.
accountStatus
).
portType
(
this
.
portType
)
.
userImg
(
this
.
userImg
).
userSex
(
this
.
userSex
).
email
(
this
.
email
).
source
(
this
.
source
).
accountStatus
(
this
.
accountStatus
).
portType
(
this
.
portType
)
.
companyAuthStatus
(
this
.
companyAuthStatus
==
null
||
this
.
companyAuthStatus
!=
1
?
0
:
1
).
cooperationTagId
(
this
.
cooperationTagId
)
.
build
();
.
build
();
}
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/UserAccountService.java
浏览文件 @
3dc73409
...
@@ -115,4 +115,12 @@ public interface UserAccountService {
...
@@ -115,4 +115,12 @@ public interface UserAccountService {
* @return
* @return
*/
*/
ResultBody
feignAuthUserPwd
(
Integer
id
,
String
authPwd
);
ResultBody
feignAuthUserPwd
(
Integer
id
,
String
authPwd
);
/**
* 授权手机号
* @param id
* @param code
* @return
*/
ResultBody
getUserPhoneNumber
(
Integer
id
,
String
code
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/WxService.java
浏览文件 @
3dc73409
...
@@ -6,7 +6,6 @@ import com.mmc.iuav.user.model.vo.WxLoginVO;
...
@@ -6,7 +6,6 @@ import com.mmc.iuav.user.model.vo.WxLoginVO;
import
com.mmc.iuav.user.model.vo.WxMsgVO
;
import
com.mmc.iuav.user.model.vo.WxMsgVO
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
/**
* @author: zj
* @author: zj
...
@@ -64,5 +63,20 @@ public interface WxService {
...
@@ -64,5 +63,20 @@ public interface WxService {
*/
*/
ResultBody
sendAppletMsg
(
AppletMsgVO
appletMsgVO
);
ResultBody
sendAppletMsg
(
AppletMsgVO
appletMsgVO
);
/**
* 生成小程序链接
* @param path
* @param query
* @return
*/
String
createUrlLink
(
String
path
,
String
query
);
String
createUrlLink
(
String
path
,
String
query
);
/**
* 获取用户授权手机号
*
* @param id
* @param code
* @return
*/
String
getUserPhoneNumber
(
Integer
id
,
String
code
);
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/impl/UserAccountServiceImpl.java
浏览文件 @
3dc73409
package
com
.
mmc
.
iuav
.
user
.
service
.
impl
;
package
com
.
mmc
.
iuav
.
user
.
service
.
impl
;
import
com.mmc.iuav.auth.JwtConstant
;
import
com.mmc.iuav.general.CodeUtil
;
import
com.mmc.iuav.general.CodeUtil
;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.page.PageResult
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.response.ResultBody
;
import
com.mmc.iuav.response.ResultEnum
;
import
com.mmc.iuav.response.ResultEnum
;
import
com.mmc.iuav.user.auth.PwdUtil
;
import
com.mmc.iuav.user.auth.PwdUtil
;
import
com.mmc.iuav.user.constant.UserSystemConstant
;
import
com.mmc.iuav.user.dao.CooperationDao
;
import
com.mmc.iuav.user.dao.CooperationDao
;
import
com.mmc.iuav.user.dao.UserServiceDao
;
import
com.mmc.iuav.user.dao.UserServiceDao
;
import
com.mmc.iuav.user.entity.UserAccountDO
;
import
com.mmc.iuav.user.entity.UserAccountDO
;
...
@@ -18,9 +16,10 @@ import com.mmc.iuav.user.model.vo.CompanyAuthVO;
...
@@ -18,9 +16,10 @@ import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import
com.mmc.iuav.user.model.vo.UserAccountVO
;
import
com.mmc.iuav.user.model.vo.UserAccountVO
;
import
com.mmc.iuav.user.service.CompanyAuthService
;
import
com.mmc.iuav.user.service.CompanyAuthService
;
import
com.mmc.iuav.user.service.UserAccountService
;
import
com.mmc.iuav.user.service.UserAccountService
;
import
com.mmc.iuav.user.service.WxService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.List
;
import
java.util.List
;
...
@@ -42,6 +41,9 @@ public class UserAccountServiceImpl implements UserAccountService {
...
@@ -42,6 +41,9 @@ public class UserAccountServiceImpl implements UserAccountService {
@Autowired
@Autowired
private
CooperationDao
cooperationDao
;
private
CooperationDao
cooperationDao
;
@Autowired
private
WxService
wxService
;
@Override
@Override
public
UserAccountVO
getUserAccountInfoByUnionId
(
String
unionId
)
{
public
UserAccountVO
getUserAccountInfoByUnionId
(
String
unionId
)
{
UserAccountDO
userAccountDO
=
userServiceDao
.
getUserAccountInfoByUnionId
(
unionId
);
UserAccountDO
userAccountDO
=
userServiceDao
.
getUserAccountInfoByUnionId
(
unionId
);
...
@@ -162,6 +164,9 @@ public class UserAccountServiceImpl implements UserAccountService {
...
@@ -162,6 +164,9 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
@Override
public
List
<
UserAccountSimpleDTO
>
feignListBAccountPage
(
BUserAccountQO
bUserAccountQO
)
{
public
List
<
UserAccountSimpleDTO
>
feignListBAccountPage
(
BUserAccountQO
bUserAccountQO
)
{
List
<
UserAccountDO
>
list
=
userServiceDao
.
feignListBAccountPage
(
bUserAccountQO
);
List
<
UserAccountDO
>
list
=
userServiceDao
.
feignListBAccountPage
(
bUserAccountQO
);
if
(
list
==
null
)
{
return
null
;
}
List
<
UserAccountSimpleDTO
>
accountSimpleDTOS
=
list
.
stream
().
map
(
UserAccountDO:
:
buildUserAccountSimpleDTO
).
collect
(
Collectors
.
toList
());
List
<
UserAccountSimpleDTO
>
accountSimpleDTOS
=
list
.
stream
().
map
(
UserAccountDO:
:
buildUserAccountSimpleDTO
).
collect
(
Collectors
.
toList
());
return
accountSimpleDTOS
;
return
accountSimpleDTOS
;
}
}
...
@@ -214,4 +219,18 @@ public class UserAccountServiceImpl implements UserAccountService {
...
@@ -214,4 +219,18 @@ public class UserAccountServiceImpl implements UserAccountService {
}
}
return
ResultBody
.
success
();
return
ResultBody
.
success
();
}
}
@Override
public
ResultBody
getUserPhoneNumber
(
Integer
id
,
String
code
)
{
String
userPhoneNumber
=
wxService
.
getUserPhoneNumber
(
id
,
code
);
if
(
StringUtils
.
isBlank
(
userPhoneNumber
)){
return
ResultBody
.
error
(
ResultEnum
.
AUTH_PHONE_NUMBER_ERROR
);
}
System
.
out
.
println
(
"userPhoneNumber:"
+
userPhoneNumber
);
UserAccountDO
userAccount
=
new
UserAccountDO
();
userAccount
.
setId
(
id
);
userAccount
.
setPhoneNum
(
userPhoneNumber
);
userServiceDao
.
update
(
userAccount
);
return
ResultBody
.
success
();
}
}
}
csm-service/cms-service-user/src/main/java/com/mmc/iuav/user/service/impl/WxServiceImpl.java
浏览文件 @
3dc73409
...
@@ -64,11 +64,11 @@ public class WxServiceImpl implements WxService {
...
@@ -64,11 +64,11 @@ public class WxServiceImpl implements WxService {
String
accessToken
=
stringRedisTemplate
.
opsForValue
().
get
(
WxConstant
.
IUAV_MINI_PROGRAM_ACCESS_TOKEN
);
String
accessToken
=
stringRedisTemplate
.
opsForValue
().
get
(
WxConstant
.
IUAV_MINI_PROGRAM_ACCESS_TOKEN
);
if
(
StringUtils
.
isBlank
(
accessToken
)){
if
(
StringUtils
.
isBlank
(
accessToken
)){
String
getAccessTokenUrl
=
"https://api.weixin.qq.com/cgi-bin/token"
+
"?grant_type=client_credential"
+
"&appid="
+
String
getAccessTokenUrl
=
"https://api.weixin.qq.com/cgi-bin/token"
+
"?grant_type=client_credential"
+
"&appid="
+
userSystemConstant
.
getWxAppId
()
+
"&secret"
+
userSystemConstant
.
getWxAppSecret
();
userSystemConstant
.
getWxAppId
()
+
"&secret
=
"
+
userSystemConstant
.
getWxAppSecret
();
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
System
.
out
.
println
(
"获取
用户信息有误:access_token请求失败
:"
+
tokenResult
);
System
.
out
.
println
(
"获取
小程序access_token有误
:"
+
tokenResult
);
return
null
;
return
null
;
}
}
accessToken
=
tokenResult
.
getString
(
"access_token"
);
accessToken
=
tokenResult
.
getString
(
"access_token"
);
...
@@ -86,11 +86,11 @@ public class WxServiceImpl implements WxService {
...
@@ -86,11 +86,11 @@ public class WxServiceImpl implements WxService {
String
accessToken
=
stringRedisTemplate
.
opsForValue
().
get
(
WxConstant
.
SHARE_FLY_SUB_ACCESS_TOKEN
);
String
accessToken
=
stringRedisTemplate
.
opsForValue
().
get
(
WxConstant
.
SHARE_FLY_SUB_ACCESS_TOKEN
);
if
(
StringUtils
.
isBlank
(
accessToken
)){
if
(
StringUtils
.
isBlank
(
accessToken
)){
String
getAccessTokenUrl
=
"https://api.weixin.qq.com/cgi-bin/token"
+
"?grant_type=client_credential"
+
"&appid="
+
String
getAccessTokenUrl
=
"https://api.weixin.qq.com/cgi-bin/token"
+
"?grant_type=client_credential"
+
"&appid="
+
userSystemConstant
.
getWxSubAppId
()
+
"&secret"
+
userSystemConstant
.
getWxSubSecret
();
userSystemConstant
.
getWxSubAppId
()
+
"&secret
=
"
+
userSystemConstant
.
getWxSubSecret
();
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
String
accessTokenMsg
=
HttpsRequestUtil
.
httpsGet
(
getAccessTokenUrl
,
null
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
JSONObject
tokenResult
=
JSONObject
.
parseObject
(
accessTokenMsg
);
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
if
(
accessTokenMsg
.
indexOf
(
"access_token"
)
==
-
1
)
{
System
.
out
.
println
(
"获取
用户信息有误:access_token请求失败
:"
+
tokenResult
);
System
.
out
.
println
(
"获取
公众号access_token有误
:"
+
tokenResult
);
return
null
;
return
null
;
}
}
accessToken
=
tokenResult
.
getString
(
"access_token"
);
accessToken
=
tokenResult
.
getString
(
"access_token"
);
...
@@ -218,9 +218,11 @@ public class WxServiceImpl implements WxService {
...
@@ -218,9 +218,11 @@ public class WxServiceImpl implements WxService {
param
.
put
(
"scene"
,
scene
);
param
.
put
(
"scene"
,
scene
);
param
.
put
(
"page"
,
path
);
param
.
put
(
"page"
,
path
);
param
.
put
(
"width"
,
430
);
param
.
put
(
"width"
,
430
);
param
.
put
(
"check_path"
,
false
);
param
.
put
(
"env_version"
,
userSystemConstant
.
getEnvVersion
());
param
.
put
(
"env_version"
,
userSystemConstant
.
getEnvVersion
());
String
url
=
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="
+
accessToken
;
String
url
=
"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="
+
accessToken
;
base64
=
HttpHelper
.
httpPost
(
url
,
param
.
toJSONString
());
//base64 = HttpHelper.httpPost(url, param.toJSONString());
base64
=
HttpsRequestUtil
.
getACodeBase64
(
url
,
"POST"
,
null
,
param
.
toJSONString
());
return
ResultBody
.
success
(
base64
);
return
ResultBody
.
success
(
base64
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
ResultBody
.
error
(
ResultEnum
.
APPLET_QR_CODE_CREATE_ERROR
);
return
ResultBody
.
error
(
ResultEnum
.
APPLET_QR_CODE_CREATE_ERROR
);
...
@@ -268,4 +270,25 @@ public class WxServiceImpl implements WxService {
...
@@ -268,4 +270,25 @@ public class WxServiceImpl implements WxService {
}
}
return
null
;
return
null
;
}
}
@Override
public
String
getUserPhoneNumber
(
Integer
id
,
String
code
)
{
try
{
String
accessToken
=
this
.
getAccessToken
();
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"code"
,
code
);
String
url
=
"https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="
+
accessToken
;
String
res
=
HttpHelper
.
httpPost
(
url
,
param
.
toString
());
JSONObject
result
=
JSONObject
.
parseObject
(
res
);
System
.
out
.
println
(
"用户授权手机号:"
+
res
);
if
(
result
.
getString
(
"errcode"
).
equals
(
"0"
))
{
String
phone_info
=
result
.
getString
(
"phone_info"
);
JSONObject
phoneInfoObject
=
JSONObject
.
parseObject
(
phone_info
);
return
phoneInfoObject
.
getString
(
"purePhoneNumber"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
}
csm-service/cms-service-user/src/main/resources/application-dev.yml
浏览文件 @
3dc73409
server
:
port
:
35150
servlet
:
context-path
:
/userapp
#spring
#spring
spring
:
spring
:
application
:
name
:
userapp
#Database
#Database
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
...
@@ -42,22 +36,12 @@ spring:
...
@@ -42,22 +36,12 @@ spring:
# enabled: true
# enabled: true
# login-username: druid
# login-username: druid
# login-password: druid
# login-password: druid
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
redis
:
redis
:
database
:
1
database
:
1
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
password
:
MMC@2022&REDIS
password
:
MMC@2022&REDIS
port
:
6379
port
:
6379
#mybatis
mybatis
:
executor-type
:
simple
mapper-locations
:
classpath:mapper/**/*.xml
type-aliases-package
:
com.mmc.iuav.user.entity
configuration
:
map-underscore-to-camel-case
:
true
wx
:
wx
:
sub
:
sub
:
appid
:
wx5c6a105a0ddca4c5
appid
:
wx5c6a105a0ddca4c5
...
...
csm-service/cms-service-user/src/main/resources/application-local.yml
浏览文件 @
3dc73409
server
:
port
:
35150
servlet
:
context-path
:
/userapp
#spring
#spring
spring
:
spring
:
application
:
name
:
userapp
#Database
#Database
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
...
@@ -19,16 +13,6 @@ spring:
...
@@ -19,16 +13,6 @@ spring:
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
password
:
MMC@2022&REDIS
password
:
MMC@2022&REDIS
port
:
6379
port
:
6379
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
#mybatis
mybatis
:
executor-type
:
simple
mapper-locations
:
classpath:mapper/**/*.xml
type-aliases-package
:
com.mmc.iuav.user
configuration
:
map-underscore-to-camel-case
:
true
wx
:
wx
:
sub
:
sub
:
...
...
csm-service/cms-service-user/src/main/resources/application-prod.yml
浏览文件 @
3dc73409
server
:
port
:
35150
servlet
:
context-path
:
/userapp
#spring
#spring
spring
:
spring
:
application
:
name
:
userapp
#Database
#Database
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
...
@@ -42,22 +36,12 @@ spring:
...
@@ -42,22 +36,12 @@ spring:
# enabled: true
# enabled: true
# login-username: druid
# login-username: druid
# login-password: druid
# login-password: druid
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
redis
:
redis
:
database
:
1
database
:
1
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
password
:
MMC@2022&REDIS
password
:
MMC@2022&REDIS
port
:
6379
port
:
6379
#mybatis
mybatis
:
executor-type
:
simple
mapper-locations
:
classpath:mapper/**/*.xml
type-aliases-package
:
com.mmc.iuav.user
configuration
:
map-underscore-to-camel-case
:
true
wx
:
wx
:
sub
:
sub
:
appid
:
wx5c6a105a0ddca4c5
appid
:
wx5c6a105a0ddca4c5
...
...
csm-service/cms-service-user/src/main/resources/application.yml
浏览文件 @
3dc73409
server
:
port
:
35150
servlet
:
context-path
:
/userapp
spring
:
spring
:
profiles
:
profiles
:
active
:
local
active
:
local
application
:
name
:
userapp
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
#mybatis
mybatis
:
executor-type
:
simple
mapper-locations
:
classpath:mapper/**/*.xml
type-aliases-package
:
com.mmc.iuav.user
configuration
:
map-underscore-to-camel-case
:
true
---
---
spring
:
spring
:
...
...
csm-service/cms-service-user/src/main/resources/mapper/UserServiceDao.xml
浏览文件 @
3dc73409
...
@@ -130,23 +130,23 @@
...
@@ -130,23 +130,23 @@
</select>
</select>
<select
id=
"feignListBAccountPage"
resultType=
"com.mmc.iuav.user.entity.UserAccountDO"
parameterType=
"com.mmc.iuav.user.model.qo.BUserAccountQO"
>
<select
id=
"feignListBAccountPage"
resultType=
"com.mmc.iuav.user.entity.UserAccountDO"
parameterType=
"com.mmc.iuav.user.model.qo.BUserAccountQO"
>
select
id, account_type, account_no, uid, phone_num, user_name, nick_name, user_img, open_id, union_id, user_sex, email, source, account_status,
remark,
select
ua.id, ua.account_type, ua.account_no, ua.uid, ua.phone_num, ua.user_name, ua.nick_name, ua.user_img, ua.open_id, ua.union_id, ua.user_sex, ua.email, ua.source, ua.account_status, ua.
remark,
port_type, is_deleted as deleted, create_time, update_time
ua.port_type, ua.is_deleted as deleted, ua.create_time, ua.update_time, ut.cooperation_tag_id, ca.auth_status as companyAuthStatus
from user_account
from user_account
ua left join user_tag ut on ua.id = ut.user_account_id left join company_auth ca on ua.id = ca.user_account_id
where
is_deleted = 0 and port_type
= 0
where
ua.is_deleted
= 0
<if
test=
" userIds != null "
>
<if
test=
" userIds != null "
>
<foreach
collection=
"userIds"
item=
"id"
open=
"and id in ("
close=
")"
separator=
","
>
<foreach
collection=
"userIds"
item=
"id"
open=
"and
ua.
id in ("
close=
")"
separator=
","
>
#{id}
#{id}
</foreach>
</foreach>
</if>
</if>
<if
test=
"provinceCode != null"
>
<if
test=
"provinceCode != null"
>
and province_code = #{provinceCode}
and
ua.
province_code = #{provinceCode}
</if>
</if>
<if
test=
"cityCode != null"
>
<if
test=
"cityCode != null"
>
and city_code = #{cityCode}
and
ua.
city_code = #{cityCode}
</if>
</if>
<if
test=
"districtCode != null"
>
<if
test=
"districtCode != null"
>
and district_code = #{districtCode}
and
ua.
district_code = #{districtCode}
</if>
</if>
</select>
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论