Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SmartBox
Project
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
苗权威
SmartBox
Commits
f5bb9486
Commit
f5bb9486
authored
Jan 19, 2020
by
苗权威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.19
parent
07a5b650
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
310 additions
and
183 deletions
+310
-183
workspace.xml
.idea/workspace.xml
+0
-0
XiaoduhomeApplication.java
...in/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java
+3
-2
Config.java
...e/src/main/java/ai/qiwu/com/xiaoduhome/common/Config.java
+7
-1
Constants.java
...rc/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
+3
-3
OkHttp3Utils.java
...main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
+29
-0
Utils.java
...me/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java
+6
-2
CollectHistoryUtils.java
...iwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java
+1
-1
TempleUtils.java
...ava/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
+1
-2
LunchPojo.java
.../qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java
+5
-0
LunchUtils.java
...qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java
+52
-19
PlayUtils.java
.../ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
+4
-3
ProductInfoUtils.java
...iaoduhome/common/temple/productInfo/ProductInfoUtils.java
+2
-1
RecommendUtil.java
...com/xiaoduhome/common/temple/recommand/RecommendUtil.java
+20
-21
XiaoDuHomeController.java
.../qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
+5
-4
UserBehaviorData.java
...in/java/ai/qiwu/com/xiaoduhome/pojo/UserBehaviorData.java
+2
-0
ProjectDataResult.java
...a/ai/qiwu/com/xiaoduhome/pojo/data/ProjectDataResult.java
+18
-0
ResultData.java
...ain/java/ai/qiwu/com/xiaoduhome/pojo/data/ResultData.java
+21
-0
UpdateUserCollectData.java
.../qiwu/com/xiaoduhome/pojo/data/UpdateUserCollectData.java
+20
-0
DplBotServiceBoth.java
...ava/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java
+0
-0
DplbotServiceUtil.java
...ava/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java
+27
-42
ScheduleService.java
.../java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
+1
-61
ScheduleServiceNew.java
...va/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java
+75
-17
XiaoAiTestService.java
...qiwu/com/xiaoduhome/xiaoai/service/XiaoAiTestService.java
+2
-1
application.yml
xiaoduhome/src/main/resources/application.yml
+2
-0
firstPage.json
xiaoduhome/src/main/resources/static/json/firstPage.json
+1
-1
xiaodu.properties
xiaoduhome/src/main/resources/xiaodu.properties
+3
-2
No files found.
.idea/workspace.xml
View file @
f5bb9486
This diff is collapsed.
Click to expand it.
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java
View file @
f5bb9486
...
...
@@ -2,9 +2,8 @@ package ai.qiwu.com.xiaoduhome;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.
autoconfigure.domain.EntityScan
;
import
org.springframework.boot.
context.ApplicationPidFileWriter
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaRepositories
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
...
...
@@ -13,6 +12,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public
class
XiaoduhomeApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
application
=
new
SpringApplication
(
XiaoduhomeApplication
.
class
);
application
.
addListeners
(
new
ApplicationPidFileWriter
());
SpringApplication
.
run
(
XiaoduhomeApplication
.
class
,
args
);
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Config.java
View file @
f5bb9486
...
...
@@ -3,6 +3,8 @@ package ai.qiwu.com.xiaoduhome.common;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Properties
;
...
...
@@ -19,7 +21,11 @@ public class Config {
String
filename
=
"xiaodu.properties"
;
properties
=
new
Properties
();
try
{
properties
.
load
(
new
InputStreamReader
(
Config
.
class
.
getClassLoader
().
getResourceAsStream
(
filename
),
StandardCharsets
.
UTF_8
));
String
path
=
System
.
getProperty
(
"java.class.path"
);
path
=
path
.
substring
(
0
,
path
.
lastIndexOf
(
File
.
separator
)+
1
)
+
filename
;
log
.
warn
(
"配置文件:{}"
,
path
);
properties
.
load
(
new
InputStreamReader
(
new
FileInputStream
(
path
),
StandardCharsets
.
UTF_8
));
// properties.load(new InputStreamReader(Config.class.getClassLoader().getResourceAsStream(filename), StandardCharsets.UTF_8));
}
catch
(
Exception
e
)
{
log
.
error
(
"获取配置文件对象出错:{}"
,
e
.
toString
());
System
.
exit
(
1
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
View file @
f5bb9486
...
...
@@ -62,7 +62,7 @@ public interface Constants {
String
COLLECTED_IMG_URL
=
"https://didi-gz5.jiaoyou365.com/duai/image/collec.png"
;
String
UN_COLLECTED_IMG_URL
=
"https://didi-gz5.jiaoyou365.com/duai/image/uncollec.png"
;
String
DEFAULT_ASIDE_IMG_URL
=
"http://didi-gz
4
.jiaoyou365.com/Editor/upload/img/npc/2019/02/19174004213.png"
;
String
DEFAULT_ASIDE_IMG_URL
=
"http://didi-gz
5
.jiaoyou365.com/Editor/upload/img/npc/2019/02/19174004213.png"
;
}
interface
PRODUCT_INTRO
{
...
...
@@ -96,8 +96,8 @@ public interface Constants {
}
interface
SKILL_SECURITY
{
String
REDIRECT_URI
=
"https://xiaodu.baidu.com/saiya/auth/
15966f1c8158104bd82712f95d8a1150
"
;
String
REDIRECT_URI_TEST
=
"https://xiaodu-dbp.baidu.com/saiya/auth/
15966f1c8158104bd82712f95d8a1150
"
;
String
REDIRECT_URI
=
"https://xiaodu.baidu.com/saiya/auth/
3a0610f8af67a3c92d803a80a1c8976c
"
;
String
REDIRECT_URI_TEST
=
"https://xiaodu-dbp.baidu.com/saiya/auth/
3a0610f8af67a3c92d803a80a1c8976c
"
;
String
CLIENT_ID
=
"aiqiwucom"
;
String
CLIENT_SECRET
=
"miaoquanwei"
;
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
View file @
f5bb9486
...
...
@@ -143,6 +143,7 @@ public class OkHttp3Utils {
case
3
:
header
=
"jiaoyou-audio-child-test"
;
break
;
case
2
:
case
4
:
header
=
"jiaoyou-audio-adult-test"
;
break
;
case
6
:
header
=
"baidu-screen-jiaoyou-audio-test"
;
break
;
default
:
header
=
"jiaoyou-audio-test"
;
}
}
...
...
@@ -304,6 +305,34 @@ public class OkHttp3Utils {
}
}
public
static
void
doPutAsy
(
String
url
,
String
requestJsonStr
)
{
Request
request
=
new
Request
.
Builder
()
.
url
(
url
)
.
put
(
RequestBody
.
create
(
requestJsonStr
,
MediaType
.
parse
(
"application/json; charset=utf-8"
)))
.
build
();
client
.
newCall
(
request
).
enqueue
(
new
Callback
()
{
@Override
public
void
onFailure
(
@NotNull
Call
call
,
@NotNull
IOException
e
)
{
log
.
info
(
"天猫精灵发送无音频数据失败"
);
}
@Override
public
void
onResponse
(
@NotNull
Call
call
,
@NotNull
Response
response
)
throws
IOException
{
try
(
ResponseBody
body
=
response
.
body
()){
body
.
string
();
}
catch
(
SocketTimeoutException
e
)
{
log
.
error
(
"捕获到SocketTimeoutException:{}"
,
e
.
toString
());
client
.
dispatcher
().
cancelAll
();
client
.
connectionPool
().
evictAll
();
}
catch
(
Exception
e
)
{
log
.
error
(
ExceptionUtils
.
getStackTrace
(
e
));
}
}
});
}
public
static
String
doDelete
(
String
url
,
Map
<
String
,
String
>
headers
,
String
jsonStr
)
throws
IOException
{
Request
.
Builder
builder
=
new
Request
.
Builder
();
Request
request
=
builder
.
url
(
url
).
build
();
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java
View file @
f5bb9486
...
...
@@ -256,11 +256,15 @@ public class Utils {
List
<
String
>
list
=
Arrays
.
asList
(
s1
);
StringBuilder
num
=
new
StringBuilder
();
boolean
first
=
true
;
for
(
String
str:
numStr
.
split
(
""
))
{
String
[]
arr
=
numStr
.
split
(
""
);
for
(
String
str:
arr
)
{
int
i
;
if
(
first
)
{
first
=
false
;
if
(
str
.
equals
(
"十"
))
num
.
append
(
1
);
if
(
str
.
equals
(
"十"
))
{
if
(
arr
.
length
==
1
)
return
10
;
num
.
append
(
1
);
}
else
if
((
i
=
list
.
indexOf
(
str
))
!=
-
1
)
num
.
append
(
i
);
}
else
if
((
i
=
list
.
indexOf
(
str
))
!=
-
1
)
num
.
append
(
i
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java
View file @
f5bb9486
...
...
@@ -174,7 +174,7 @@ public class CollectHistoryUtils {
backGroundImg
.
setPosition
(
"absolute"
);
backGroundImg
.
setTop
(
"0dp"
);
backGroundImg
.
setLeft
(
"0dp"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
end
.jpg"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
New
.jpg"
);
backGroundImg
.
setHeight
(
"100%"
);
backGroundImg
.
setScaleType
(
"fitXY"
);
backGroundImg
.
setWidth
(
"100%"
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
View file @
f5bb9486
...
...
@@ -260,8 +260,7 @@ public class TempleUtils {
for
(
ProjectData
projectInfo
:
list
)
{
String
productName
=
correctName
(
projectInfo
.
getName
());
String
imageId
=
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
projectInfo
.
getName
()).
toString
();
String
src
=
new
StringBuilder
(
IMG_PREFIX
).
append
(
projectInfo
.
getBannerImgUrl
()).
toString
();
LunchBotData
data
=
new
LunchBotData
(
src
,
imageId
,
productName
);
LunchBotData
data
=
new
LunchBotData
(
projectInfo
.
getBannerImgUrl
(),
imageId
,
productName
);
data
.
setNum
(
begin
++);
dataList
.
add
(
data
);
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java
View file @
f5bb9486
...
...
@@ -25,6 +25,7 @@ public class LunchPojo {
private
String
width
;
private
String
left
;
private
String
top
;
private
String
bottom
;
private
String
right
;
private
String
src
;
private
List
<
LunchPojo
>
items
;
...
...
@@ -58,6 +59,10 @@ public class LunchPojo {
private
String
text
;
@JsonProperty
(
"font-size"
)
private
String
fontSize
;
@JsonProperty
(
"justify-content"
)
private
String
justifyContent
;
private
List
<
LunchBotData
>
data
;
private
List
<
FrameTemple
>
firstItem
;
private
String
headerImage
;
private
List
<
String
>
hints
;
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java
View file @
f5bb9486
package
ai
.
qiwu
.
com
.
xiaoduhome
.
common
.
temple
.
onLunch
;
import
ai.qiwu.com.xiaoduhome.common.temple.TempleUtils
;
import
ai.qiwu.com.xiaoduhome.common.temple.productInfo.ProductInfoPojo
;
import
ai.qiwu.com.xiaoduhome.pojo.dpl.Event
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleService
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew
;
...
...
@@ -19,9 +20,10 @@ public class LunchUtils {
private
static
final
LunchPojo
LUNCH_LIST_CATEGORY_CON
=
buildCategoryList
();
private
static
final
LunchPojo
LUNCH_HEAD
=
buildLunchHead
();
private
static
final
LunchPojo
LUNCH_BACK_IMG
=
buildLunchBackgroundImg
();
private
static
final
LunchPojo
LUNCH_LOGO_IMG
=
buildLogoImage
();
private
static
final
LunchPojo
LUNCH_HSITORY_IMG
=
buildHistoryImg
();
private
static
final
LunchPojo
LUNCH_COLLECT_IMG
=
buildCollectImg
();
private
static
final
LunchPojo
FOOTER
=
buildHomeFooter
();
// private static final LunchPojo LUNCH_LOGO_IMG = buildLogoImage();
// private static final LunchPojo LUNCH_HSITORY_IMG = buildHistoryImg();
// private static final LunchPojo LUNCH_COLLECT_IMG = buildCollectImg();
private
volatile
static
LunchDocument
lunchDocument
=
buildLunchNewDocument
();
...
...
@@ -47,7 +49,8 @@ public class LunchUtils {
LunchPojo
scroll
=
buildLunchScroll
();
scroll
.
setItems
(
list
);
mainTemplate
.
getItems
().
addAll
(
Arrays
.
asList
(
LUNCH_BACK_IMG
,
LUNCH_HEAD
,
LUNCH_LOGO_IMG
,
LUNCH_HSITORY_IMG
,
LUNCH_COLLECT_IMG
,
scroll
));
// mainTemplate.getItems().addAll(Arrays.asList(LUNCH_BACK_IMG,LUNCH_HEAD,LUNCH_LOGO_IMG,LUNCH_HSITORY_IMG,LUNCH_COLLECT_IMG,scroll));
mainTemplate
.
getItems
().
addAll
(
Arrays
.
asList
(
LUNCH_BACK_IMG
,
LUNCH_HEAD
,
scroll
,
FOOTER
));
return
document
;
}
...
...
@@ -70,7 +73,7 @@ public class LunchUtils {
LunchPojo
scroll
=
buildLunchScroll
();
// scroll.setItems(Arrays.asList(conRecommend,conRanking,conCategory));
mainTemplate
.
getItems
().
addAll
(
Arrays
.
asList
(
LUNCH_BACK_IMG
,
LUNCH_HEAD
,
LUNCH_LOGO_IMG
,
LUNCH_HSITORY_IMG
,
LUNCH_COLLECT_IMG
,
scroll
));
//
mainTemplate.getItems().addAll(Arrays.asList(LUNCH_BACK_IMG,LUNCH_HEAD,LUNCH_LOGO_IMG,LUNCH_HSITORY_IMG,LUNCH_COLLECT_IMG,scroll));
return
document
;
}
...
...
@@ -78,8 +81,10 @@ public class LunchUtils {
LunchPojo
scroll
=
new
LunchPojo
();
scroll
.
setType
(
"ScrollView"
);
scroll
.
setDirection
(
"vertical"
);
scroll
.
setMarginTop
(
"180dp"
);
scroll
.
setWidth
(
"100%"
);
scroll
.
setMarginBottom
(
"10dp"
);
scroll
.
setPaddingBottom
(
"20dp"
);
// scroll.setMarginBottom("10dp");
return
scroll
;
}
...
...
@@ -105,12 +110,13 @@ public class LunchUtils {
private
static
LunchPojo
buildLunchList
(
List
<
LunchBotData
>
data
)
{
LunchPojo
container
=
new
LunchPojo
();
container
.
setType
(
"Container"
);
container
.
setMarginBottom
(
"28dp"
);
container
.
setMarginBottom
(
"45dp"
);
container
.
setAlignItems
(
"center"
);
container
.
setWidth
(
"100%"
);
LunchPojo
list
=
new
LunchPojo
();
list
.
setType
(
"List"
);
list
.
setMarginLeft
(
"
3
0dp"
);
list
.
setMarginLeft
(
"
2
0dp"
);
// list.setMarginRight("15dp");
list
.
setDirection
(
"horizontal"
);
list
.
setData
(
data
);
...
...
@@ -137,8 +143,8 @@ public class LunchUtils {
//image
LunchPojo
image
=
new
LunchPojo
();
image
.
setType
(
"Image"
);
image
.
setWidth
(
"2
1
0dp"
);
image
.
setHeight
(
"2
1
0dp"
);
image
.
setWidth
(
"2
0
0dp"
);
image
.
setHeight
(
"2
0
0dp"
);
image
.
setMarginLeft
(
"7dp"
);
image
.
setMarginTop
(
"7dp"
);
image
.
setPosition
(
"absolute"
);
...
...
@@ -150,16 +156,17 @@ public class LunchUtils {
//frame
LunchPojo
frame
=
new
LunchPojo
();
frame
.
setType
(
"Frame"
);
frame
.
setWidth
(
"
3
5dp"
);
frame
.
setHeight
(
"
3
5dp"
);
frame
.
setBackgroundColor
(
"rgb
a(0,0,0,0.8
)"
);
frame
.
setBorderRadius
(
"
13
dp"
);
frame
.
setWidth
(
"
4
5dp"
);
frame
.
setHeight
(
"
4
5dp"
);
frame
.
setBackgroundColor
(
"rgb
(30,144,255
)"
);
frame
.
setBorderRadius
(
"
25
dp"
);
LunchPojo
frmCon
=
new
LunchPojo
();
frmCon
.
setType
(
"Container"
);
frmCon
.
setWidth
(
"100%"
);
frmCon
.
setHeight
(
"100%"
);
frmCon
.
setAlignItems
(
"center"
);
frmCon
.
setJustifyContent
(
"center"
);
LunchPojo
frmText
=
new
LunchPojo
();
frmText
.
setType
(
"Text"
);
...
...
@@ -191,7 +198,7 @@ public class LunchUtils {
backGroundImg
.
setPosition
(
"absolute"
);
backGroundImg
.
setTop
(
"0dp"
);
backGroundImg
.
setLeft
(
"0dp"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
end
.jpg"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
New
.jpg"
);
backGroundImg
.
setHeight
(
"100%"
);
backGroundImg
.
setScaleType
(
"fitXY"
);
backGroundImg
.
setWidth
(
"100%"
);
...
...
@@ -200,14 +207,40 @@ public class LunchUtils {
}
private
static
LunchPojo
buildLunchHead
()
{
// LunchPojo head = new LunchPojo();
// head.setType("Header");
// //head.setHeaderTitle("交游天下");
// head.setHasBackIcon(false);
// return head;
LunchPojo
head
=
new
LunchPojo
();
head
.
setType
(
"Header"
);
//head.setHeaderTitle("交游天下");
head
.
setHasBackIcon
(
false
);
head
.
setType
(
"Image"
);
head
.
setPosition
(
"absolute"
);
head
.
setTop
(
"0dp"
);
head
.
setLeft
(
"0dp"
);
head
.
setWidth
(
"100%"
);
head
.
setHeight
(
"100%"
);
head
.
setScaleType
(
"centerCrop"
);
head
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/heaImg.png"
);
return
head
;
}
private
static
LunchPojo
buildHomeFooter
()
{
LunchPojo
footerCon
=
new
LunchPojo
();
footerCon
.
setType
(
"Container"
);
footerCon
.
setPosition
(
"absolute"
);
footerCon
.
setWidth
(
"100%"
);
footerCon
.
setLeft
(
"0"
);
footerCon
.
setBottom
(
"0"
);
LunchPojo
footer
=
new
LunchPojo
();
footer
.
setType
(
"Footer"
);
footer
.
setHints
(
Arrays
.
asList
(
"推荐作品"
,
"打开第一个"
,
"打开排行榜"
,
"打开历史记录"
,
"打开收藏"
));
footerCon
.
setItems
(
Collections
.
singletonList
(
footer
));
return
footerCon
;
}
private
static
LunchPojo
buildLogoImage
()
{
LunchPojo
logoCon
=
new
LunchPojo
();
logoCon
.
setType
(
"Container"
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
View file @
f5bb9486
...
...
@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.pojo.ActorWithWord;
import
ai.qiwu.com.xiaoduhome.pojo.dpl.Event
;
import
ai.qiwu.com.xiaoduhome.pojo.playAside.PlayPageData
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleService
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew
;
import
java.util.*
;
...
...
@@ -18,7 +19,7 @@ public class PlayUtils {
private
static
final
PlayPojo
PLAY_FLOWER
=
buildFlower
();
private
static
final
PlayPojo
PLAY_LOGO
=
buildLogoImage
();
private
static
final
PlayPojo
PLAY_COLLECT
=
buildCollect
();
private
static
final
PlayPojo
PLAY_UN_COLLECT
=
buildUnCollect
();
//
private static final PlayPojo PLAY_UN_COLLECT = buildUnCollect();
private
static
final
PlayPojo
PLAY_LIST_ITEM
=
buildContent
();
...
...
@@ -31,7 +32,7 @@ public class PlayUtils {
List
<
PlayPageData
>
dataList
=
new
ArrayList
<>();
for
(
ActorWithWord
aw:
aws
)
{
PlayPageData
data
=
new
PlayPageData
(
aw
.
getActor
(),
ScheduleService
.
getAsideImgUrl
(
botAccount
,
aw
.
getActor
()),
PlayPageData
data
=
new
PlayPageData
(
aw
.
getActor
(),
ScheduleService
New
.
getAsideImgUrl
(
botAccount
,
aw
.
getActor
()),
aw
.
getText
().
replaceAll
(
"<br>"
,
"\n"
));
dataList
.
add
(
data
);
}
...
...
@@ -355,7 +356,7 @@ public class PlayUtils {
backGroundImg
.
setPosition
(
"absolute"
);
backGroundImg
.
setTop
(
"0dp"
);
backGroundImg
.
setLeft
(
"0dp"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
end
.jpg"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
New
.jpg"
);
backGroundImg
.
setHeight
(
"100%"
);
backGroundImg
.
setWidth
(
"100%"
);
backGroundImg
.
setScaleType
(
"fitXY"
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java
View file @
f5bb9486
...
...
@@ -119,6 +119,7 @@ public class ProductInfoUtils {
ProductInfoPojo
label
=
new
ProductInfoPojo
();
label
.
setType
(
"Text"
);
label
.
setMarginLeft
(
"5%"
);
label
.
setTextOverflow
(
"ellipsis"
);
label
.
setFontSize
(
"22dp"
);
label
.
setMaxLines
(
1
);
label
.
setText
(
labelText
);
...
...
@@ -260,7 +261,7 @@ public class ProductInfoUtils {
backGroundImg
.
setPosition
(
"absolute"
);
backGroundImg
.
setTop
(
"0dp"
);
backGroundImg
.
setLeft
(
"0dp"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
end
.jpg"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
New
.jpg"
);
backGroundImg
.
setHeight
(
"100%"
);
backGroundImg
.
setWidth
(
"100%"
);
backGroundImg
.
setScaleType
(
"fitXY"
);
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommendUtil.java
View file @
f5bb9486
...
...
@@ -150,17 +150,13 @@ public class RecommendUtil {
botIds
.
append
(
third
.
getBotAccount
()).
append
(
File
.
separator
);
ProjectData
forth
=
list
.
get
(
3
);
botIds
.
append
(
forth
.
getBotAccount
()).
append
(
File
.
separator
);
RecommandPojo
pojoFirst
=
buildImgFrmTxtContainerFirstRow
(
new
StringBuilder
(
Constants
.
IMG_PREFIX
)
.
append
(
first
.
getBannerImgUrl
()).
toString
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
first
.
getName
()).
toString
(),
RecommandPojo
pojoFirst
=
buildImgFrmTxtContainerFirstRow
(
first
.
getBannerImgUrl
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
first
.
getName
()).
toString
(),
TempleUtils
.
correctName
(
first
.
getName
()),
"first.png"
);
RecommandPojo
pojoSe
=
buildImgFrmTxtContainerFirstRow
(
new
StringBuilder
(
Constants
.
IMG_PREFIX
)
.
append
(
second
.
getBannerImgUrl
()).
toString
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
second
.
getName
()).
toString
(),
RecommandPojo
pojoSe
=
buildImgFrmTxtContainerFirstRow
(
second
.
getBannerImgUrl
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
second
.
getName
()).
toString
(),
TempleUtils
.
correctName
(
second
.
getName
()),
"second.png"
);
RecommandPojo
pojoThird
=
buildImgFrmTxtContainerFirstRow
(
new
StringBuilder
(
Constants
.
IMG_PREFIX
)
.
append
(
third
.
getBannerImgUrl
()).
toString
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
third
.
getName
()).
toString
(),
RecommandPojo
pojoThird
=
buildImgFrmTxtContainerFirstRow
(
third
.
getBannerImgUrl
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
third
.
getName
()).
toString
(),
TempleUtils
.
correctName
(
third
.
getName
()),
"third.png"
);
RecommandPojo
pojoFourth
=
buildImgFrmTxtContainerFourth
(
new
StringBuilder
(
Constants
.
IMG_PREFIX
)
.
append
(
forth
.
getBannerImgUrl
()).
toString
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
forth
.
getName
()).
toString
(),
RecommandPojo
pojoFourth
=
buildImgFrmTxtContainerFourth
(
forth
.
getBannerImgUrl
(),
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
forth
.
getName
()).
toString
(),
TempleUtils
.
correctName
(
forth
.
getName
()));
rowContainer
.
setItems
(
Arrays
.
asList
(
pojoFirst
,
pojoSe
,
pojoThird
,
pojoFourth
));
...
...
@@ -171,7 +167,7 @@ public class RecommendUtil {
//scrollList.add(buildRecommendList(getListData(3, 12, 16, list, botIds)));
mainTemplate
.
getItems
().
addAll
(
Arrays
.
asList
(
RECOM_BACK_IMG
,
RANK_HEAD
,
scrollView
,
buildPageButton
(
1
,
list
.
size
()),
RANK_CATEGORY_FOOTER
));
list
.
size
()
/
12
+
list
.
size
()%
12
==
0
?
0
:
1
),
RANK_CATEGORY_FOOTER
));
botIds
.
deleteCharAt
(
botIds
.
length
()-
1
);
String
idToken
=
Base64
.
getEncoder
().
encodeToString
(
botIds
.
toString
().
getBytes
());
...
...
@@ -210,7 +206,7 @@ public class RecommendUtil {
begin
=
end
;
}
mainTemplate
.
getItems
().
addAll
(
Arrays
.
asList
(
RECOM_BACK_IMG
,
RANK_HEAD
,
scrollView
,
buildPageButton
(
num
+
1
,
list
.
size
()),
RANK_CATEGORY_FOOTER
));
buildPageButton
(
num
+
1
,
list
.
size
()
/
12
+
list
.
size
()%
12
==
0
?
0
:
1
),
RANK_CATEGORY_FOOTER
));
botIds
.
deleteCharAt
(
botIds
.
length
()-
1
);
String
idToken
=
Base64
.
getEncoder
().
encodeToString
(
botIds
.
toString
().
getBytes
());
...
...
@@ -228,9 +224,8 @@ public class RecommendUtil {
StringBuilder
botIds
=
new
StringBuilder
();
int
num
=
0
;
for
(
ProjectData
bot:
bots
)
{
String
imgSrc
=
new
StringBuilder
(
Constants
.
IMG_PREFIX
).
append
(
bot
.
getBannerImgUrl
()).
toString
();
String
imageId
=
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
bot
.
getName
()).
toString
();
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
imgSrc
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
bot
.
getBannerImgUrl
()
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
detail
.
setNum
(++
num
);
data
.
add
(
detail
);
botIds
.
append
(
bot
.
getBotAccount
()).
append
(
File
.
separator
);
...
...
@@ -294,10 +289,10 @@ public class RecommendUtil {
//frame
RecommandPojo
frame
=
new
RecommandPojo
();
frame
.
setType
(
"Frame"
);
frame
.
setWidth
(
"4
0
dp"
);
frame
.
setHeight
(
"4
0
dp"
);
frame
.
setBackgroundColor
(
"rgb
a(0,0,0,0.9
)"
);
frame
.
setBorderRadius
(
"
1
5dp"
);
frame
.
setWidth
(
"4
5
dp"
);
frame
.
setHeight
(
"4
5
dp"
);
frame
.
setBackgroundColor
(
"rgb
(30,144,255
)"
);
frame
.
setBorderRadius
(
"
2
5dp"
);
RecommandPojo
frmCon
=
new
RecommandPojo
();
frmCon
.
setType
(
"Container"
);
...
...
@@ -455,9 +450,8 @@ public class RecommendUtil {
for
(
int
i
=
begin
;
i
<
end
;
i
++)
{
ProjectData
bot
=
bots
.
get
(
i
);
botIds
.
append
(
bot
.
getBotAccount
()).
append
(
File
.
separator
);
String
imgSrc
=
new
StringBuilder
(
Constants
.
IMG_PREFIX
).
append
(
bot
.
getBannerImgUrl
()).
toString
();
String
imageId
=
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
bot
.
getName
()).
toString
();
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
imgSrc
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
bot
.
getBannerImgUrl
()
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
detail
.
setNum
(
i
-
begin
+
n
);
data
.
add
(
detail
);
}
...
...
@@ -469,9 +463,8 @@ public class RecommendUtil {
int
n
=
1
+
row
*
4
;
for
(
int
i
=
begin
;
i
<
end
;
i
++)
{
ProjectData
bot
=
bots
.
get
(
i
);
String
imgSrc
=
new
StringBuilder
(
Constants
.
IMG_PREFIX
).
append
(
bot
.
getBannerImgUrl
()).
toString
();
String
imageId
=
new
StringBuilder
(
Constants
.
PRE_PRODUCT_IMG
).
append
(
bot
.
getName
()).
toString
();
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
imgSrc
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
RecommandBotInfo
detail
=
new
RecommandBotInfo
(
bot
.
getBannerImgUrl
()
,
imageId
,
TempleUtils
.
correctName
(
bot
.
getName
()));
detail
.
setNum
(
i
-
begin
+
n
);
data
.
add
(
detail
);
}
...
...
@@ -602,7 +595,7 @@ public class RecommendUtil {
backGroundImg
.
setPosition
(
"absolute"
);
backGroundImg
.
setTop
(
"0dp"
);
backGroundImg
.
setLeft
(
"0dp"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
end
.jpg"
);
backGroundImg
.
setSrc
(
"https://didi-gz5.jiaoyou365.com/duai/image/back
New
.jpg"
);
backGroundImg
.
setHeight
(
"100%"
);
backGroundImg
.
setWidth
(
"100%"
);
backGroundImg
.
setScaleType
(
"fitXY"
);
...
...
@@ -653,4 +646,10 @@ public class RecommendUtil {
public
static
void
setRankDocument
(
RecommandDocument
rankDocument
)
{
RecommendUtil
.
rankDocument
=
rankDocument
;
}
public
static
void
main
(
String
[]
args
)
{
String
s
=
"sgagoijcue4569kmd9eir8345/234/23526/dfhh/2345345"
;
System
.
out
.
println
(
s
.
length
());
System
.
out
.
println
(
Base64
.
getEncoder
().
encodeToString
(
s
.
getBytes
()).
length
());
}
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
View file @
f5bb9486
...
...
@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Utils;
import
ai.qiwu.com.xiaoduhome.pojo.OverTimeDetail
;
import
ai.qiwu.com.xiaoduhome.service.DplBotRedisService
;
import
ai.qiwu.com.xiaoduhome.service.DplBotService
;
import
ai.qiwu.com.xiaoduhome.service.DplBotServiceBoth
;
import
ai.qiwu.com.xiaoduhome.service.ResponseEncapsulation
;
import
ai.qiwu.com.xiaoduhome.spirit.SpiritService
;
import
ai.qiwu.com.xiaoduhome.xiaoai.model.request.XiaoAiRequest
;
...
...
@@ -119,13 +120,13 @@ public class XiaoDuHomeController {
try
{
//log.info("--------------分界线-------------------");
// DplBotService service = new DplBotService(Utils.getHttpServletRequest(), 5);
// log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes()
);
DplBotRedisService
service
=
new
DplBotRedisService
(
request
,
5
,
stringRedisTemplate
);
//
log.info(service.getStrRequest());
DplBotServiceBoth
service
=
new
DplBotServiceBoth
(
request
,
6
,
stringRedisTemplate
);
log
.
info
(
"请求信息中的attributes:{}"
,
service
.
getRequest
().
getSession
().
getAttributes
()
);
log
.
info
(
service
.
getStrRequest
());
//service.disableVerify();
service
.
enableVerify
();
String
str
=
service
.
run
();
//
log.info("响应信息:{}", str);
log
.
info
(
"响应信息:{}"
,
str
);
return
str
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/UserBehaviorData.java
View file @
f5bb9486
...
...
@@ -26,4 +26,6 @@ public class UserBehaviorData {
private
volatile
Byte
mark
=
1
;
private
volatile
String
jytUserId
;
private
volatile
String
channel
;
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/data/ProjectDataResult.java
0 → 100644
View file @
f5bb9486
package
ai
.
qiwu
.
com
.
xiaoduhome
.
pojo
.
data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
/**
* @author 苗权威
* @dateTime 20-1-18 上午11:15
*/
@Getter
@Setter
@ToString
public
class
ProjectDataResult
{
private
Integer
code
;
private
String
msg
;
private
ResultData
data
;
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/data/ResultData.java
0 → 100644
View file @
f5bb9486
package
ai
.
qiwu
.
com
.
xiaoduhome
.
pojo
.
data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 苗权威
* @dateTime 20-1-18 上午11:16
*/
@Getter
@Setter
@ToString
public
class
ResultData
{
private
List
<
ProjectData
>
bots
;
private
Map
<
String
,
Map
<
String
,
Long
>>
channelAcc
;
private
Map
<
String
,
Map
<
String
,
String
>>
headImg
;
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/data/UpdateUserCollectData.java
0 → 100644
View file @
f5bb9486
package
ai
.
qiwu
.
com
.
xiaoduhome
.
pojo
.
data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.ToString
;
import
java.util.Map
;
/**
* @author 苗权威
* @dateTime 20-1-19 下午1:41
*/
@Getter
@Setter
@ToString
public
class
UpdateUserCollectData
{
private
String
userId
;
private
Map
<
String
,
Long
>
collectInfo
;
private
String
channel
;
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotServiceBoth.java
View file @
f5bb9486
This diff is collapsed.
Click to expand it.
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java
View file @
f5bb9486
This diff is collapsed.
Click to expand it.
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
View file @
f5bb9486
...
...
@@ -43,7 +43,7 @@ import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL;
* @dateTime 19-8-14 下午8:56
*/
@Slf4j
@Component
//
@Component
public
class
ScheduleService
implements
InitializingBean
{
private
static
volatile
int
allProductCount
;
private
static
volatile
int
rankPageSize
;
...
...
@@ -54,7 +54,6 @@ public class ScheduleService implements InitializingBean {
static
volatile
HashMap
<
String
,
OnProductDetail
>
PRODUCT_NAME_DETAIL
=
new
HashMap
<>();
static
volatile
HashMap
<
String
,
OnProductDetail
>
PRODUCT_ID_DETAIL
=
new
HashMap
<>();
private
static
volatile
HashMap
<
String
,
Map
<
String
,
String
>>
ASIDE_IMG
=
new
HashMap
<>();
private
static
final
List
<
String
>
EXCEPT_BOT_ACCOUNT
=
new
ArrayList
<>();
static
final
String
[]
CATEGORY
=
{
"古风"
,
"儿童"
,
"科幻"
,
"占星"
,
"恋爱"
,
"灾难"
,
"架空"
,
"经营"
,
"冒险"
,
"武侠"
};
...
...
@@ -72,10 +71,6 @@ public class ScheduleService implements InitializingBean {
private
final
XiaoDuOrderTbRepository
xiaoDuOrderTbRepository
;
static
final
String
FLOWER_UNIT_PRICE
=
Config
.
getProperty
(
"unitPrice"
,
UNIT_PRICE
);
static
volatile
Long
curTime
=
System
.
currentTimeMillis
();
public
static
volatile
Map
<
String
,
String
>
channelId2RecommendBotAcc
=
new
HashMap
<>();
public
static
volatile
Map
<
String
,
List
<
String
>>
channel2Bots
=
new
HashMap
<>();
...
...
@@ -134,28 +129,6 @@ public class ScheduleService implements InitializingBean {
//log.error("更新推荐页出错:{}", e.getMessage());
}
@Scheduled
(
cron
=
"0 * */1 * * ?"
)
public
void
clearUserBehaviorData
()
{
DplbotServiceUtil
.
POOL
.
submit
(()
->
{
List
<
String
>
needClear
=
new
ArrayList
<>();
for
(
String
userId:
DplbotServiceUtil
.
USER_HISTORY
.
keySet
())
{
UserBehaviorData
data
=
DplbotServiceUtil
.
USER_HISTORY
.
get
(
userId
);
if
(
data
!=
null
)
{
if
(
data
.
getMark
()
==
1
)
data
.
setMark
((
byte
)
0
);
else
{
needClear
.
add
(
userId
);
}
}
}
for
(
String
userId:
needClear
)
DplbotServiceUtil
.
USER_HISTORY
.
remove
(
userId
);
});
}
@Scheduled
(
cron
=
"*/30 * * * * ?"
)
public
void
updateTheCurTime
()
{
DplbotServiceUtil
.
POOL
.
submit
(()
->
curTime
=
System
.
currentTimeMillis
());
}
// @Scheduled(cron = "0 0 19 * * ?")
public
void
initRankingList
()
{
new
Thread
(()
->
{
...
...
@@ -310,26 +283,6 @@ public class ScheduleService implements InitializingBean {
log
.
info
(
"getChannelAllBots:"
+
jiaoyouChannel2Bots
);
}
private
void
getAsideImg
()
{
DplbotServiceUtil
.
getPOOL
().
submit
(()
->
{
List
<
String
>
botIds
=
gameProjectTbRepository
.
getAllOnTableProductIds
();
HashMap
<
String
,
Map
<
String
,
String
>>
ai
=
new
HashMap
<>();
for
(
String
botId:
botIds
)
{
try
{
HashMap
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"include"
,
"audioNpc"
);
params
.
put
(
"aipioneerUsername"
,
botId
);
String
str
=
OkHttp3Utils
.
doGet
(
ASIDE_IMG_URL
,
params
);
AsideImageResponse
response
=
JSON
.
parseObject
(
str
,
AsideImageResponse
.
class
);
ai
.
put
(
botId
,
response
.
getData
().
getNpcHeadImgUrl
());
}
catch
(
Exception
e
)
{
log
.
error
(
"定时获取头像出错:botId:{},{}"
,
botId
,
ScheduleService
.
getProductIdDetail
().
get
(
botId
).
getName
());
}
}
ASIDE_IMG
=
ai
;
});
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
initAllOnTableProductInfo
();
...
...
@@ -339,7 +292,6 @@ public class ScheduleService implements InitializingBean {
deleteOverTimeHistory
();
deleteUnPayedOrder
();
// tian();
getAsideImg
();
getAllChannelRecommendBotAccount
();
getChannelAllBots
();
getJiaoYouChannelRecordBots
();
...
...
@@ -397,18 +349,6 @@ public class ScheduleService implements InitializingBean {
return
CATEGORY_PRODUCT_ID_LIST
;
}
public
static
String
getAsideImgUrl
(
String
botId
,
String
name
)
{
String
url
;
Map
<
String
,
String
>
imgs
=
ASIDE_IMG
.
get
(
botId
);
if
(
imgs
==
null
)
{
url
=
DEFAULT_ASIDE_IMG_URL
;
}
else
{
url
=
imgs
.
get
(
name
);
}
if
(
url
==
null
)
url
=
DEFAULT_ASIDE_IMG_URL
;
return
url
;
}
public
static
int
getRankPageSize
()
{
return
rankPageSize
;
}
...
...
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleServiceNew.java
View file @
f5bb9486
package
ai
.
qiwu
.
com
.
xiaoduhome
.
service
;
import
ai.qiwu.com.xiaoduhome.common.Config
;
import
ai.qiwu.com.xiaoduhome.common.OkHttp3Utils
;
import
ai.qiwu.com.xiaoduhome.pojo.UserBehaviorData
;
import
ai.qiwu.com.xiaoduhome.pojo.data.ProjectData
;
import
ai.qiwu.com.xiaoduhome.pojo.data.ProjectDataResult
;
import
ai.qiwu.com.xiaoduhome.pojo.playAside.AsideImageResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
ai
.
qiwu
.
com
.
xiaoduhome
.
common
.
Constants
.
DPL_COMPONENT_ID
.
DEFAULT_ASIDE_IMG_URL
;
import
static
ai
.
qiwu
.
com
.
xiaoduhome
.
common
.
Constants
.
UNIT_PRICE
;
/**
* @author 苗权威
* @dateTime 20-1-15 下午8:24
...
...
@@ -24,10 +31,16 @@ public class ScheduleServiceNew implements InitializingBean {
private
static
volatile
Map
<
String
,
ProjectData
>
botAccount2Project
=
new
HashMap
<>();
private
static
volatile
Map
<
String
,
ProjectData
>
name2Project
=
new
HashMap
<>();
private
static
volatile
Map
<
String
,
Map
<
String
,
Long
>>
channel2BotAccountList
=
new
HashMap
<>();
private
static
volatile
Map
<
String
,
Map
<
String
,
String
>>
ASIDE_IMG
=
new
HashMap
<>();
static
final
String
FLOWER_UNIT_PRICE
=
Config
.
getProperty
(
"unitPrice"
,
UNIT_PRICE
);
static
volatile
Long
curTime
=
System
.
currentTimeMillis
();
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
getAllProjects
();
// buildLunchNewDocument
}
private
void
getAllProjects
()
{
...
...
@@ -35,30 +48,63 @@ public class ScheduleServiceNew implements InitializingBean {
try
{
String
response
=
OkHttp3Utils
.
doGet
(
DplbotServiceUtil
.
HOST_UTL
+
"/audio_box/project"
);
if
(
StringUtils
.
isNotBlank
(
response
))
{
JSONObject
object
=
JSON
.
parseObject
(
response
);
List
<
ProjectData
>
list
=
object
.
getObject
(
"bots"
,
List
.
class
);
Map
<
String
,
Map
<
String
,
Long
>>
map
=
object
.
getObject
(
"channelAcc"
,
Map
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
final
Map
<
String
,
ProjectData
>
botAcc
=
new
HashMap
<>();
final
Map
<
String
,
ProjectData
>
name
=
new
HashMap
<>();
list
.
forEach
(
projectData
->
{
botAcc
.
put
(
projectData
.
getBotAccount
(),
projectData
);
name
.
put
(
projectData
.
getName
(),
projectData
);
});
botAccount2Project
=
botAcc
;
name2Project
=
name
;
allProjects
=
list
;
}
if
(!
CollectionUtils
.
isEmpty
(
map
))
{
channel2BotAccountList
=
map
;
ProjectDataResult
result
=
JSON
.
parseObject
(
response
,
ProjectDataResult
.
class
);
if
(
new
Integer
(
1
).
equals
(
result
.
getCode
()))
{
List
<
ProjectData
>
list
=
result
.
getData
().
getBots
();
Map
<
String
,
Map
<
String
,
Long
>>
map
=
result
.
getData
().
getChannelAcc
();
if
(!
CollectionUtils
.
isEmpty
(
list
))
{
final
Map
<
String
,
ProjectData
>
botAcc
=
new
HashMap
<>();
final
Map
<
String
,
ProjectData
>
name
=
new
HashMap
<>();
list
.
forEach
(
projectData
->
{
botAcc
.
put
(
projectData
.
getBotAccount
(),
projectData
);
name
.
put
(
projectData
.
getName
(),
projectData
);
});
botAccount2Project
=
botAcc
;
name2Project
=
name
;
allProjects
=
list
;
}
if
(!
CollectionUtils
.
isEmpty
(
map
))
{
channel2BotAccountList
=
map
;
}
if
(!
CollectionUtils
.
isEmpty
(
result
.
getData
().
getHeadImg
()))
{
ASIDE_IMG
=
result
.
getData
().
getHeadImg
();
}
}
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"ScheduleServiceNew#getAllProjects获取所有作品信息失败:"
+
e
);
}
log
.
info
(
"botAccount2Project:"
+
botAccount2Project
.
size
());
log
.
info
(
"name2Project:"
+
name2Project
.
size
());
log
.
info
(
"allProjects:"
+
allProjects
.
size
());
log
.
info
(
"channel2BotAccountList:"
+
channel2BotAccountList
.
size
());
log
.
info
(
"ASIDE_IMG:"
+
ASIDE_IMG
.
size
());
}).
start
();
}
@Scheduled
(
cron
=
"*/30 * * * * ?"
)
public
void
updateTheCurTime
()
{
curTime
=
System
.
currentTimeMillis
();
}
@Scheduled
(
cron
=
"0 * */1 * * ?"
)
public
void
clearUserBehaviorData
()
{
DplbotServiceUtil
.
POOL
.
submit
(()
->
{
List
<
String
>
needClear
=
new
ArrayList
<>();
for
(
String
userId:
DplbotServiceUtil
.
USER_HISTORY
.
keySet
())
{
UserBehaviorData
data
=
DplbotServiceUtil
.
USER_HISTORY
.
get
(
userId
);
if
(
data
!=
null
)
{
if
(
data
.
getMark
()
==
1
)
data
.
setMark
((
byte
)
0
);
else
{
needClear
.
add
(
userId
);
DplbotServiceUtil
.
updateTheUserCollectData
(
userId
,
data
.
getChannel
());
}
}
}
for
(
String
userId:
needClear
)
DplbotServiceUtil
.
USER_HISTORY
.
remove
(
userId
);
});
}
static
ProjectData
getProjectByName
(
String
name
)
{
return
name2Project
.
get
(
name
);
}
...
...
@@ -80,4 +126,16 @@ public class ScheduleServiceNew implements InitializingBean {
}
return
datas
;
}
public
static
String
getAsideImgUrl
(
String
botId
,
String
name
)
{
String
url
;
Map
<
String
,
String
>
imgs
=
ASIDE_IMG
.
get
(
botId
);
if
(
imgs
==
null
)
{
url
=
DEFAULT_ASIDE_IMG_URL
;
}
else
{
url
=
imgs
.
get
(
name
);
}
if
(
url
==
null
)
url
=
DEFAULT_ASIDE_IMG_URL
;
return
url
;
}
}
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/xiaoai/service/XiaoAiTestService.java
View file @
f5bb9486
...
...
@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Constants;
import
ai.qiwu.com.xiaoduhome.common.OkHttp3Utils
;
import
ai.qiwu.com.xiaoduhome.service.DplbotServiceUtil
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleService
;
import
ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew
;
import
ai.qiwu.com.xiaoduhome.xiaoai.common.RequestTerminal
;
import
ai.qiwu.com.xiaoduhome.xiaoai.common.RequestWordNullException
;
import
ai.qiwu.com.xiaoduhome.xiaoai.common.Utils
;
...
...
@@ -166,7 +167,7 @@ public class XiaoAiTestService {
prefix
=
"box"
+
i
;
job
=
(
JSONObject
)
ob
;
actor
=
job
.
getString
(
"npcName"
);
actorUrl
=
ScheduleService
.
getAsideImgUrl
(
job
.
getString
(
"botAccount"
),
actor
);
actorUrl
=
ScheduleService
New
.
getAsideImgUrl
(
job
.
getString
(
"botAccount"
),
actor
);
text
=
job
.
getString
(
"text"
);
if
(
StringUtils
.
isNotBlank
(
text
))
{
text
=
text
.
replaceAll
(
"\\{/.*?/}|\uD83C\uDD70|\uD83C\uDD71"
,
""
);
...
...
xiaoduhome/src/main/resources/application.yml
View file @
f5bb9486
...
...
@@ -41,6 +41,8 @@ spring:
host
:
localhost
port
:
6379
timeout
:
1000
pid
:
file
:
/home/dc2-user/projects/audiobox/duai/app.pid
logging
:
path
:
/home/dc2-user/projects/audiobox/duai/logs
...
...
xiaoduhome/src/main/resources/static/json/firstPage.json
View file @
f5bb9486
...
...
@@ -12,7 +12,7 @@
"componentId"
:
"loadingPage"
,
"top"
:
"0dp"
,
"left"
:
"0dp"
,
"src"
:
"https://didi-gz5.jiaoyou365.com/duai/image/Load
ing.pn
g"
,
"src"
:
"https://didi-gz5.jiaoyou365.com/duai/image/Load
New.jp
g"
,
"height"
:
"100%"
,
"width"
:
"100%"
,
"scale-type"
:
"fitXY"
,
...
...
xiaoduhome/src/main/resources/xiaodu.properties
View file @
f5bb9486
unitPrice
=
1
requestHost
=
http://didi-gz4.jiaoyou365.com:18082/
\ No newline at end of file
requestHost
=
http://didi-gz5.jiaoyou365.com:18082/
pidPath
=
/home/dc2-user/projects/audiobox/duai/app.pid
\ No newline at end of file
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