Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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
base_platform_enterprise
gic-platform-auth
Commits
d88a93fa
Commit
d88a93fa
authored
Sep 24, 2019
by
314581947
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加微信返回
parent
3f09634d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
14 deletions
+65
-14
AuditorDTO.java
...m-auth-api/src/main/java/com/gic/auth/dto/AuditorDTO.java
+18
-0
pom.xml
gic-platform-auth-service/pom.xml
+6
-0
AuditorApiServiceImpl.java
...om/gic/auth/service/outer/impl/AuditorApiServiceImpl.java
+37
-13
dubbo-gic-platform-auth-service.xml
...ce/src/main/resources/dubbo-gic-platform-auth-service.xml
+2
-0
AuditorController.java
...n/java/com/gic/auth/web/controller/AuditorController.java
+2
-1
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/dto/AuditorDTO.java
View file @
d88a93fa
...
...
@@ -60,6 +60,8 @@ public class AuditorDTO implements Serializable {
private
Integer
projectItemCount
;
private
Integer
auditedGroupCount
;
private
String
headUrl
;
private
String
weChatNickName
;
public
Integer
getAuditorId
()
{
return
auditorId
;
...
...
@@ -148,4 +150,20 @@ public class AuditorDTO implements Serializable {
public
void
setAuditedGroupCount
(
Integer
auditedGroupCount
)
{
this
.
auditedGroupCount
=
auditedGroupCount
;
}
public
void
setHeadUrl
(
String
headUrl
)
{
this
.
headUrl
=
headUrl
;
}
public
String
getHeadUrl
()
{
return
headUrl
;
}
public
void
setWeChatNickName
(
String
weChatNickName
)
{
this
.
weChatNickName
=
weChatNickName
;
}
public
String
getWeChatNickName
()
{
return
weChatNickName
;
}
}
gic-platform-auth-service/pom.xml
View file @
d88a93fa
...
...
@@ -25,6 +25,7 @@
<gic-bizdict-api>
4.0.0-SNAPSHOT
</gic-bizdict-api>
<gic-platform-auth-api>
4.0-SNAPSHOT
</gic-platform-auth-api>
<gic-wechat-business-api>
4.0-SNAPSHOT
</gic-wechat-business-api>
<gic-member-api>
4.0-SNAPSHOT
</gic-member-api>
</properties>
<dependencies>
...
...
@@ -129,6 +130,11 @@
<artifactId>
gic-wechat-business-api
</artifactId>
<version>
${gic-wechat-business-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-member-api
</artifactId>
<version>
${gic-member-api}
</version>
</dependency>
</dependencies>
<build>
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/AuditorApiServiceImpl.java
View file @
d88a93fa
...
...
@@ -15,6 +15,8 @@ import com.gic.enterprise.error.ErrorCode;
import
com.gic.enterprise.qo.ProjectItemQO
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
com.gic.enterprise.service.ProjectItemApiService
;
import
com.gic.member.api.dto.ServiceUserDTO
;
import
com.gic.member.api.service.ServiceUserApiService
;
import
com.gic.wechat.business.api.service.fwh.WeixinBaseFunService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -51,6 +53,10 @@ public class AuditorApiServiceImpl implements AuditorApiService {
private
AuditedGroupService
auditedGroupService
;
@Autowired
private
WeixinBaseFunService
weixinBaseFunService
;
@Autowired
private
ServiceUserApiService
serviceUserApiService
;
public
static
final
String
APPKEY
=
"wxc6fd9beaf9a9dbe9"
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -71,7 +77,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
if
(
auditedGroupIsNotExist
)
{
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
);
}
auditorDTO
.
setIsUse
(
auditorDTO
.
getUserId
()
==
null
?
0
:
1
);
auditorDTO
.
setIsUse
(
auditorDTO
.
getUserId
()
==
null
?
0
:
1
);
// 这里进来的 不会去修改openid,所以把openid设为null
auditorDTO
.
setOpenid
(
null
);
// 保存审核员信息
...
...
@@ -138,6 +144,24 @@ public class AuditorApiServiceImpl implements AuditorApiService {
List
<
Integer
>
groupIds
=
groupList
.
stream
().
map
(
TabAuditorAuditedGroupRel:
:
getAuditedGroupId
).
collect
(
Collectors
.
toList
());
auditorDTO
.
setAuditedGroupIdList
(
groupIds
);
}
// 如果没有绑定 就展示二维码, 如果绑定了 就展示微信名和头像
if
(
StringUtils
.
isBlank
(
auditor
.
getOpenid
()))
{
String
codeUrl
=
this
.
getTempQrCodeUrl
(
auditorId
);
auditorDTO
.
setHeadUrl
(
codeUrl
);
}
else
{
ServiceResponse
<
ServiceUserDTO
>
service
=
this
.
serviceUserApiService
.
getByOpenid
(
auditorDTO
.
getOpenid
());
if
(
service
.
isSuccess
())
{
ServiceUserDTO
userDTO
=
service
.
getResult
();
String
headUrl
=
userDTO
.
getHeadUrl
();
auditorDTO
.
setHeadUrl
(
headUrl
);
String
nickname
=
userDTO
.
getNickname
();
auditorDTO
.
setWeChatNickName
(
nickname
);
}
else
{
logger
.
warn
(
"调用serviceUserApiService.getByOpenid 服务失败,openid:{}, msg:{}"
,
auditorDTO
.
getOpenid
(),
service
.
getMessage
());
}
}
return
ServiceResponse
.
success
(
auditorDTO
);
}
...
...
@@ -149,7 +173,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
List
<
Integer
>
auditorIdList
=
resultPage
.
getResult
().
stream
().
map
(
AuditorDTO:
:
getAuditorId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
Integer
>
projectItemMap
=
auditorProjectItemRelService
.
getCountByAuditorIds
(
auditorIdList
);
Map
<
Integer
,
Integer
>
userCountMap
=
auditorAuditedGroupRelService
.
getUserCountByAuditorIds
(
auditorIdList
);
for
(
AuditorDTO
auditorDTO:
resultPage
.
getResult
())
{
for
(
AuditorDTO
auditorDTO
:
resultPage
.
getResult
())
{
auditorDTO
.
setProjectItemCount
(
projectItemMap
.
get
(
auditorDTO
.
getAuditorId
()));
auditorDTO
.
setAuditedGroupCount
(
userCountMap
.
get
(
auditorDTO
.
getAuditorId
()));
}
...
...
@@ -160,15 +184,15 @@ public class AuditorApiServiceImpl implements AuditorApiService {
@Override
public
ServiceResponse
<
Void
>
receiveOpenid
(
String
qrCodeParam
,
String
openid
)
{
logger
.
info
(
"二维码参数:{},openid:{}"
,
qrCodeParam
,
openid
);
if
(
StringUtils
.
isNotBlank
(
qrCodeParam
)
&&
StringUtils
.
isNotBlank
(
openid
))
{
if
(
qrCodeParam
.
startsWith
(
"auditor_"
))
{
if
(
StringUtils
.
isNotBlank
(
qrCodeParam
)
&&
StringUtils
.
isNotBlank
(
openid
))
{
if
(
qrCodeParam
.
startsWith
(
"auditor_"
))
{
String
auditorIdStr
=
qrCodeParam
.
substring
(
qrCodeParam
.
indexOf
(
"auditor_"
)
+
8
);
Integer
auditorId
=
Integer
.
valueOf
(
auditorIdStr
);
TabAuditor
auditor
=
this
.
auditorService
.
getAuditor
(
auditorId
);
if
(
auditor
!=
null
)
{
boolean
repeat
=
this
.
auditorService
.
validOpenidIsRepeat
(
auditor
.
getEnterpriseId
(),
openid
,
null
);
if
(
repeat
)
{
logger
.
info
(
"receiveOpenid失败,商户:{}下,存在重复的openid:{}"
,
auditor
.
getEnterpriseId
(),
openid
);
logger
.
warn
(
"receiveOpenid失败,商户:{}下,存在重复的openid:{}"
,
auditor
.
getEnterpriseId
(),
openid
);
}
else
{
AuditorDTO
auditorDTO
=
new
AuditorDTO
();
auditorDTO
.
setAuditorId
(
auditorId
);
...
...
@@ -187,20 +211,20 @@ public class AuditorApiServiceImpl implements AuditorApiService {
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListByJSON
(
AuditorDTO
.
class
,
list
));
}
private
String
getTempQrCodeUrl
(
Integer
auditorId
){
// String enterpriseId = GlobalVar.ctxPropertiesMap.get("data_security_enterpriseId");
// EnterpriseDTO enterpriseDTO = this.enterpriseService.getEnterpriseById(enterpriseId);
// String qrCodeUrl = this.weixinBaseFunService.getTemporaryQRcodeURL(enterpriseDTO.getAppkey(), "auditor_"+auditorId, 300);
// return qrCodeUrl;
private
String
getTempQrCodeUrl
(
Integer
auditorId
)
{
// String enterpriseId = GlobalVar.ctxPropertiesMap.get("data_security_enterpriseId");
// EnterpriseDTO enterpriseDTO = this.enterpriseService.getEnterpriseById(enterpriseId);
// String qrCodeUrl = this.weixinBaseFunService.getTemporaryQRcodeURL(enterpriseDTO.getAppkey(), "auditor_"+auditorId, 300);
// return qrCodeUrl;
logger
.
info
(
"生成临时带参二维码 auditorId:{}"
,
auditorId
);
ServiceResponse
<
String
>
serviceResponse
=
weixinBaseFunService
.
getTemporaryQRcodeURL
(
"wxc6fd9beaf9a9dbe9"
,
"auditor_"
+
auditorId
,
300
);
ServiceResponse
<
String
>
serviceResponse
=
weixinBaseFunService
.
getTemporaryQRcodeURL
(
APPKEY
,
"auditor_"
+
auditorId
,
300
);
if
(
serviceResponse
.
isSuccess
())
{
logger
.
info
(
"临时带参二维码生成成功:{}"
,
serviceResponse
.
getResult
());
return
serviceResponse
.
getResult
();
}
else
{
logger
.
info
(
"临时带参二维码生成失败:{}"
,
serviceResponse
.
getMessage
());
logger
.
warn
(
"临时带参二维码生成失败:{}"
,
serviceResponse
.
getMessage
());
return
null
;
}
// return "qrCodeUrl";
// return "qrCodeUrl";
}
}
gic-platform-auth-service/src/main/resources/dubbo-gic-platform-auth-service.xml
View file @
d88a93fa
...
...
@@ -35,4 +35,6 @@
<dubbo:reference
interface=
"com.gic.enterprise.service.ProjectItemApiService"
id=
"projectItemApiService"
timeout=
"6000"
/>
<!--微信回调-->
<dubbo:reference
interface=
"com.gic.wechat.business.api.service.fwh.WeixinBaseFunService"
id=
"weixinBaseFunService"
timeout=
"6000"
/>
<!--会员模块-->
<dubbo:reference
interface=
"com.gic.member.api.service.ServiceUserApiService"
id=
"serviceUserApiService"
timeout=
"6000"
/>
</beans>
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/AuditorController.java
View file @
d88a93fa
...
...
@@ -14,6 +14,7 @@ import com.gic.enterprise.utils.UserDetailUtils;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -38,7 +39,7 @@ public class AuditorController {
private
AuditorApiService
auditorApiService
;
@RequestMapping
(
"/save-auditor"
)
public
RestResponse
saveAuditor
(
AuditorQO
auditorQO
)
{
public
RestResponse
saveAuditor
(
@Validated
(
AuditorQO
.
SaveValid
.
class
)
AuditorQO
auditorQO
)
{
AuditorDTO
auditorDTO
=
EntityUtil
.
changeEntityByJSON
(
AuditorDTO
.
class
,
auditorQO
);
auditorDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
List
<
Integer
>
projectItemList
=
Stream
.
of
(
auditorQO
.
getProjectItems
().
split
(
GlobalInfo
.
FLAG_COMMA
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
...
...
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