Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
f7d128e4
Commit
f7d128e4
authored
Apr 02, 2022
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1006901] 外链拓展
parent
d6416d3f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
7 deletions
+47
-7
AppletRecordBizImpl.java
.../com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
+46
-6
ResourcePageBizImpl.java
...a/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
+0
-0
ThreadPoolUtils.java
...ain/java/com/pcloud/book/util/common/ThreadPoolUtils.java
+1
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletRecordBizImpl.java
View file @
f7d128e4
...
...
@@ -43,6 +43,7 @@ import com.pcloud.book.consumer.app.AppConsr;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.copyright.biz.BookAuthServeBiz
;
import
com.pcloud.book.group.biz.WeworkTeacherBiz
;
import
com.pcloud.book.group.dto.WxWorkTeacherDTO
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
...
...
@@ -53,9 +54,10 @@ import com.pcloud.book.applet.dto.GroupActivity4AppletDTO;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.base.constants.MessageFromTypeEnum
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.constant.LinkServeConstant
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.enums.AppTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -139,6 +141,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
private
ReaderConsr
readerConsr
;
@Autowired
private
BookProps
bookProps
;
@Autowired
private
BookAuthServeBiz
bookAuthServeBiz
;
@Override
@ParamLog
(
"通过ID查询单条数据"
)
...
...
@@ -582,7 +586,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO
.
setCoverImg
(
Optional
.
ofNullable
(
bookDtoMap
.
get
(
appletRecordDTO
.
getBookId
())).
map
(
BookDto:
:
getCoverImg
).
orElse
(
""
));
}
//填充作品信息
fillProduct4Record
(
productDtoMap
,
productDtoMapFuture
,
appletRecordDTO
);
fillProduct4Record
(
productDtoMap
,
productDtoMapFuture
,
appletRecordDTO
,
wechatUserId
);
}
else
if
(
Objects
.
equals
(
AppletRecordTypeEnum
.
APP
.
value
,
appletRecordDTO
.
getRecordType
()))
{
if
(
"ANSWER"
.
equals
(
appletRecordDTO
.
getTypeCode
()))
{
appletRecordDTO
.
setBookName
(
Optional
.
ofNullable
(
bookDtoMap
.
get
(
appletRecordDTO
.
getBookId
())).
map
(
BookDto:
:
getBookName
).
orElse
(
""
));
...
...
@@ -767,7 +771,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletAppOrProductDTO
.
setServeType
(
AppAndProductTypeEnum
.
APP
.
value
);
appletAppOrProductDTO
.
setServeId
(
appletRecordDTO
.
getFromId
());
//优化跳转
if
(
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
appletAppOrProductDTO
.
getServeTypeCode
()))
{
try
{
if
(
LinkServeConstant
.
APPLINK
.
contains
(
appletAppOrProductDTO
.
getServeTypeCode
()))
{
if
(
appDto
!=
null
&&
!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
()))
{
if
(
appDto
.
getTurnUrl
().
contains
(
"5rs.me/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysgo.com/"
)
||
appDto
.
getTurnUrl
().
contains
(
"raysyun.com/"
)
||
null
==
wechatUserId
)
{
...
...
@@ -775,20 +780,26 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
else
{
Long
sceneId
=
CommonUtils
.
getSceneId
(
appletAppOrProductDTO
.
getResultUrl
());
if
(
null
!=
sceneId
)
{
// 判断版权保护
Map
<
String
,
Boolean
>
bookAuthMap
=
bookAuthServeBiz
.
listIsOpen4ServeIdsAndQrcode
(
sceneId
,
Lists
.
newArrayList
(
appDto
.
getAppId
()));
if
(
CollUtil
.
isEmpty
(
bookAuthMap
)
||
null
==
bookAuthMap
.
get
(
MessageFromTypeEnum
.
APP
.
value
+
appDto
.
getAppId
())
||
false
==
bookAuthMap
.
get
(
MessageFromTypeEnum
.
APP
.
value
+
appDto
.
getAppId
()))
{
//外链跳转到指定中间页
String
jumpUrl
=
BookProps
.
getProductDomain
()
+
"transfer?offId"
+
accountSettingDto
.
getAccountSettingId
()
+
"&appId="
+
appDto
.
getAppId
()
+
"&url="
+
URLEncoder
.
encode
(
appDto
.
getTurnUrl
())
+
"&sceneId="
+
sceneId
+
"&wechatUserId="
+
wechatUserId
;
appletAppOrProductDTO
.
setResultUrl
(
jumpUrl
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"填充外链失败:{}"
,
e
.
getMessage
());
}
appletRecordDTO
.
setAppletAppOrProductDTO
(
appletAppOrProductDTO
);
}
private
void
fillProduct4Record
(
Map
<
Long
,
ProductDto
>
productDtoMap
,
Future
<
Map
<
Long
,
ProductDto
>>
productDtoMapFuture
,
AppletRecordDTO
appletRecordDTO
)
{
private
void
fillProduct4Record
(
Map
<
Long
,
ProductDto
>
productDtoMap
,
Future
<
Map
<
Long
,
ProductDto
>>
productDtoMapFuture
,
AppletRecordDTO
appletRecordDTO
,
Long
wechatUserId
)
{
try
{
productDtoMap
=
productDtoMapFuture
.
get
();
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
...
...
@@ -798,7 +809,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO
.
setSourceDelete
(
YesOrNoNumEnum
.
YES
.
getValue
());
return
;
}
AccountSettingDto
accountSettingDto
;
AccountSettingDto
accountSettingDto
=
null
;
ProductDto
productDto
=
productDtoMap
.
get
(
appletRecordDTO
.
getFromId
());
AppletAppOrProductDTO
appletAppOrProductDTO
=
new
AppletAppOrProductDTO
();
if
(
productDto
==
null
||
YesOrNoNumEnum
.
YES
.
getValue
().
equals
(
productDto
.
getIsDelete
()))
{
...
...
@@ -843,6 +854,35 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
}
appletAppOrProductDTO
.
setServeType
(
AppAndProductTypeEnum
.
PRODUCT
.
value
);
appletAppOrProductDTO
.
setServeId
(
appletRecordDTO
.
getFromId
());
//优化跳转
try
{
if
(
LinkServeConstant
.
PRODUCTLINK
.
contains
(
appletAppOrProductDTO
.
getServeTypeCode
()))
{
if
(
productDto
!=
null
&&
!
StringUtil
.
isEmpty
(
productDto
.
getSkipUrl
())
&&
null
!=
accountSettingDto
)
{
Double
adviserPrice
=
CollUtil
.
isNotEmpty
(
productDto
.
getSpecification
())
?
productDto
.
getSpecification
().
get
(
0
).
getAdvisePrice
():
0
D
;
//原存在逻辑不处理
if
(
productDto
.
getSkipUrl
().
contains
(
"5rs.me/"
)
||
productDto
.
getSkipUrl
().
contains
(
"raysgo.com/"
)
||
productDto
.
getSkipUrl
().
contains
(
"raysyun.com/"
))
{
appletAppOrProductDTO
.
setResultUrl
(
productDto
.
getSkipUrl
());
}
else
if
(
null
!=
wechatUserId
&&
adviserPrice
.
equals
(
0
D
)){
Long
sceneId
=
CommonUtils
.
getSceneId
(
appletAppOrProductDTO
.
getResultUrl
());
if
(
null
!=
sceneId
)
{
// 判断版权保护
Map
<
String
,
Boolean
>
bookAuthMap
=
bookAuthServeBiz
.
listIsOpen4ServeIdsAndQrcode
(
sceneId
,
Lists
.
newArrayList
(
productDto
.
getProductId
()));
if
(
CollUtil
.
isEmpty
(
bookAuthMap
)
||
null
==
bookAuthMap
.
get
(
MessageFromTypeEnum
.
PRODUCT
.
value
+
productDto
.
getProductId
())
||
false
==
bookAuthMap
.
get
(
MessageFromTypeEnum
.
PRODUCT
.
value
+
productDto
.
getProductId
()))
{
//外链跳转到指定中间页
String
jumpUrl
=
BookProps
.
getProductDomain
()
+
"transfer?offId"
+
accountSettingDto
.
getAccountSettingId
()
+
"&url="
+
URLEncoder
.
encode
(
productDto
.
getSkipUrl
())
+
"&sceneId="
+
sceneId
+
"&wechatUserId="
+
wechatUserId
+
"&productId="
+
productDto
.
getProductId
()
;
appletAppOrProductDTO
.
setResultUrl
(
jumpUrl
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"填充外链失败:{}"
,
e
.
getMessage
());
}
appletRecordDTO
.
setAppletAppOrProductDTO
(
appletAppOrProductDTO
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
f7d128e4
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/util/common/ThreadPoolUtils.java
View file @
f7d128e4
...
...
@@ -63,7 +63,7 @@ public class ThreadPoolUtils {
new
LinkedBlockingQueue
<>(),
new
ThreadFactoryBuilder
().
setNameFormat
(
"send-notify-pool-%d"
).
build
(),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
public
static
final
ExecutorService
FILL_APPLET_RECORD
=
new
ThreadPoolExecutor
(
8
,
8
,
0L
,
TimeUnit
.
SECONDS
,
public
static
final
ExecutorService
FILL_APPLET_RECORD
=
new
ThreadPoolExecutor
(
16
,
64
,
0L
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
new
ThreadFactoryBuilder
().
setNameFormat
(
"fill-applet-record-%d"
).
build
(),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
...
...
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