Commit 4f01d931 by 苗权威

10.9

parent 57788ede
...@@ -232,6 +232,9 @@ public class TTService { ...@@ -232,6 +232,9 @@ public class TTService {
} }
List<Future<ResponseCodeWithData>> futures = new ArrayList<>(); List<Future<ResponseCodeWithData>> futures = new ArrayList<>();
List<String> file_ls = new ArrayList<>(); List<String> file_ls = new ArrayList<>();
String rootFolder = new StringBuilder(Initialize.getAudioDir()).append(File.separator).append(botName).append(File.separator).toString();
String uploadFolder = new StringBuilder(rootFolder).append(Initialize.getUploadedDir()).append(File.separator).toString();
//String combineFolder = new StringBuilder(rootFolder).append("combine").append(File.separator).toString();
// 第三方语音是否生成,为0则代表不处理该第三方语音 // 第三方语音是否生成,为0则代表不处理该第三方语音
boolean geneThird = request.getGen3rd() == null || request.getGen3rd() != 0; boolean geneThird = request.getGen3rd() == null || request.getGen3rd() != 0;
if (infoList != null && infoList.size() != 0) { if (infoList != null && infoList.size() != 0) {
...@@ -247,8 +250,10 @@ public class TTService { ...@@ -247,8 +250,10 @@ public class TTService {
String url = null; //moodUrl String url = null; //moodUrl
String tone = "正常"; // 第三方请求的情绪为:正常 String tone = "正常"; // 第三方请求的情绪为:正常
// 是否是第三方请求 // 是否是第三方请求
boolean isPersonThirdParty = Initialize.getThirdPartyTts().contains(person); boolean isPersonThirdParty = Initialize.getThirdPartyTts().contains(person);
// 非第三方请求需要对person及tone进行校正,以得到确实存在的url // 非第三方请求需要对person及tone进行校正,以得到确实存在的url
if (!isPersonThirdParty) { if (!isPersonThirdParty) {
// person不存在则置为默认person // person不存在则置为默认person
...@@ -280,24 +285,22 @@ public class TTService { ...@@ -280,24 +285,22 @@ public class TTService {
String fileName = TTSUtils.buildMP3Filename(text); String fileName = TTSUtils.buildMP3Filename(text);
// 含有npcName字段则先去人工合成目录下找寻,人工没有则去合成目录寻找 // 含有npcName字段则先去人工合成目录下找寻,人工没有则去合成目录寻找
if (StringUtils.isNotBlank(npcName)) { if (StringUtils.isNotBlank(npcName)) {
String path = StringUtils.join(new String[]{Initialize.getAudioDir(), botName, Initialize.getUploadedDir(),npcName, fileName}, File.separator); String path = new StringBuilder(uploadFolder).append(npcName).append(File.separator).append(fileName).toString();
//String path = StringUtils.join(new String[]{Initialize.getAudioDir(), botName, Initialize.getUploadedDir(),npcName, fileName}, File.separator);
// log.info("111"); // log.info("111");
if (TTSUtils.doesFileExist(path)) { if (TTSUtils.doesFileExist(path)) {
filepath = path; filepath = path;
} }
// else { // else if (text.indexOf("\uD83C\uDD70") != -1){
// Pattern pattern = Pattern.compile(TTSUtils.getAbRegex()); //
// if (pattern.matcher(text).find()) {
// String combineRecordPath = StringUtils.join(new String[]{Initialize.getAudioDir(), botName, person, tone, Initialize.getUploadedDir(), fileName}, File.separator);
// if (TTSUtils.doesFileExist(combineRecordPath)) filepath = combineRecordPath;
// }
// } // }
//log.info("222"); //log.info("222");
} }
if (filepath == null) { if (filepath == null) {
//log.info("333"); //log.info("333");
// 目录为:(audio_dir)/botname/person/tone // 目录为:(audio_dir)/botname/person/tone
String folder = StringUtils.join(new String[]{Initialize.getAudioDir(), botName, person, tone}, File.separator); String folder = new StringBuilder(rootFolder).append(person).append(File.separator).append(tone).toString();
//String folder = StringUtils.join(new String[]{Initialize.getAudioDir(), botName, person, tone}, File.separator);
boolean createDirRes = TTSUtils.makedir(folder); boolean createDirRes = TTSUtils.makedir(folder);
if (!createDirRes) { if (!createDirRes) {
log.error("tts_ls创建目录:{}失败",folder); log.error("tts_ls创建目录:{}失败",folder);
......
...@@ -268,6 +268,6 @@ public class Test { ...@@ -268,6 +268,6 @@ public class Test {
System.out.println(mr.replaceAll("\\W", "")); System.out.println(mr.replaceAll("\\W", ""));
String ssss = "你当{/dang1/}前分{/fen1/}数{/shu4/}是\uD83C\uDD700\uD83C\uDD71。"; String ssss = "你当{/dang1/}前分{/fen1/}数{/shu4/}是\uD83C\uDD700\uD83C\uDD71。";
System.out.println(TTSUtils.buildMP3Filename(ssss)); System.out.println(ssss.indexOf("\uD83C\uDD70"));
} }
} }
...@@ -34,7 +34,7 @@ public interface Constants { ...@@ -34,7 +34,7 @@ public interface Constants {
String UNIT_PRICE = "1"; String UNIT_PRICE = "1";
Integer CO_HI_PAGE_SIZE = 4; Integer CO_HI_PAGE_SIZE = 4;
Integer RE_RA_CA_PAGE_SIZE = 16; Integer RE_RA_CA_PAGE_SIZE = 12;
interface DPL_COMPONENT_ID { interface DPL_COMPONENT_ID {
String FLOWE = "flowe"; String FLOWE = "flowe";
......
...@@ -24,6 +24,7 @@ public class CollectHistoryPagePojo { ...@@ -24,6 +24,7 @@ public class CollectHistoryPagePojo {
private String type; private String type;
private String position; private String position;
private String left; private String left;
private String right;
private String width; private String width;
private String bottom; private String bottom;
private String height; private String height;
......
...@@ -31,7 +31,7 @@ public class CollectHistoryUtils { ...@@ -31,7 +31,7 @@ public class CollectHistoryUtils {
allContainer.setWidth("100%"); allContainer.setWidth("100%");
allContainer.setPaddingRight("15dp"); allContainer.setPaddingRight("15dp");
allContainer.setPaddingLeft("15dp"); allContainer.setPaddingLeft("15dp");
allContainer.setPaddingBottom("180dp"); allContainer.setPaddingBottom("130dp");
CollectHistoryPagePojo list = new CollectHistoryPagePojo(); CollectHistoryPagePojo list = new CollectHistoryPagePojo();
list.setType("List"); list.setType("List");
...@@ -109,24 +109,24 @@ public class CollectHistoryUtils { ...@@ -109,24 +109,24 @@ public class CollectHistoryUtils {
author.setMarginLeft("100dp"); author.setMarginLeft("100dp");
author.setTextOverflow("ellipsis"); author.setTextOverflow("ellipsis");
// divide // // divide
CollectHistoryPagePojo divide = new CollectHistoryPagePojo(); // CollectHistoryPagePojo divide = new CollectHistoryPagePojo();
divide.setType("Frame"); // divide.setType("Frame");
divide.setPosition("absolute"); // divide.setPosition("absolute");
divide.setMarginTop("90dp"); // divide.setMarginTop("90dp");
divide.setWidth("100%"); // divide.setWidth("100%");
divide.setBorderColor("rgba(255,255,255,0.5)"); // divide.setBorderColor("rgba(255,255,255,0.3)");
divide.setBorderWidth("1dp"); // divide.setBorderWidth("0.5dp");
main.setItems(Arrays.asList(num,image, nameIntroCon, author, divide)); main.setItems(Arrays.asList(num,image, nameIntroCon, author));
return main; return main;
} }
private static CollectHistoryPagePojo buildPageButton(int curIndex, int num) { private static CollectHistoryPagePojo buildPageButton(int curIndex, int num) {
CollectHistoryPagePojo fCon = new CollectHistoryPagePojo(); CollectHistoryPagePojo fCon = new CollectHistoryPagePojo();
fCon.setType("Container"); fCon.setType("Container");
fCon.setLeft("447dp"); fCon.setTop("20dp");
fCon.setBottom("70dp"); fCon.setRight("15dp");
fCon.setPosition("absolute"); fCon.setPosition("absolute");
CollectHistoryPagePojo frame = new CollectHistoryPagePojo(); CollectHistoryPagePojo frame = new CollectHistoryPagePojo();
......
...@@ -59,7 +59,7 @@ public class TempleUtils { ...@@ -59,7 +59,7 @@ public class TempleUtils {
FRAME_RAKKING.getItems().get(1).getItems().get(0).setText("小度小度,打开排行榜"); FRAME_RAKKING.getItems().get(1).getItems().get(0).setText("小度小度,打开排行榜");
FRAME_RAKKING.getItems().get(0).setText("排行榜"); FRAME_RAKKING.getItems().get(0).setText("排行榜");
FRAME_RECOMMAND = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class); FRAME_RECOMMAND = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class);
FRAME_RECOMMAND.getItems().get(1).getItems().get(0).setText("小度小度,打开推荐"); FRAME_RECOMMAND.getItems().get(1).getItems().get(0).setText("小度小度,打开推荐页");
FRAME_RECOMMAND.getItems().get(0).setText("推荐作品"); FRAME_RECOMMAND.getItems().get(0).setText("推荐作品");
FRAME_CATEGORY = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class); FRAME_CATEGORY = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class);
FRAME_CATEGORY.getItems().get(1).getItems().get(0).setText("小度小度,打开第二十一个"); FRAME_CATEGORY.getItems().get(1).getItems().get(0).setText("小度小度,打开第二十一个");
...@@ -269,11 +269,11 @@ public class TempleUtils { ...@@ -269,11 +269,11 @@ public class TempleUtils {
public static List<LunchBotData> buildCategoryDataList() { public static List<LunchBotData> buildCategoryDataList() {
ArrayList<LunchBotData> dataList = new ArrayList<>(); ArrayList<LunchBotData> dataList = new ArrayList<>();
int i = 21; int i = 17;
for (String cateName : ScheduleService.getCATEGORY()) { for (String cateName : ScheduleService.getCATEGORY()) {
String imageId = new StringBuilder(PRE_CATEGORY).append(cateName).toString(); String imageId = new StringBuilder(PRE_CATEGORY).append(cateName).toString();
String imgSrc = new StringBuilder(IMG_CUSTOM_PREFIX) String imgSrc = new StringBuilder(IMG_CUSTOM_PREFIX)
.append(ScheduleService.getCategoryCharac()[i-21]).append(".png").toString(); .append(ScheduleService.getCategoryCharac()[i-17]).append(".png").toString();
LunchBotData data = new LunchBotData(imgSrc, imageId, cateName); LunchBotData data = new LunchBotData(imgSrc, imageId, cateName);
data.setNum(i++); data.setNum(i++);
dataList.add(data); dataList.add(data);
......
...@@ -4,7 +4,6 @@ import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils; ...@@ -4,7 +4,6 @@ import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event; import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import ai.qiwu.com.xiaoduhome.service.ScheduleService; import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
...@@ -34,7 +33,7 @@ public class LunchUtils { ...@@ -34,7 +33,7 @@ public class LunchUtils {
conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand())); conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand()));
conRecommend.setMarginTop("30dp"); conRecommend.setMarginTop("30dp");
LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 11)); LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 9));
conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking())); conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking()));
LunchPojo conCategory = buildLunchCategoryList(TempleUtils.buildCategoryDataList()); LunchPojo conCategory = buildLunchCategoryList(TempleUtils.buildCategoryDataList());
...@@ -217,7 +216,7 @@ public class LunchUtils { ...@@ -217,7 +216,7 @@ public class LunchUtils {
LunchPojo logo = new LunchPojo(); LunchPojo logo = new LunchPojo();
logo.setType("Image"); logo.setType("Image");
logo.setPosition("absolute"); logo.setPosition("absolute");
logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/uncollec.png"); logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/collec.png");
logo.setWidth("40dp"); logo.setWidth("40dp");
logo.setHeight("40dp"); logo.setHeight("40dp");
logo.setScaleType("centerInside"); logo.setScaleType("centerInside");
......
...@@ -20,6 +20,7 @@ public class PlayPojo { ...@@ -20,6 +20,7 @@ public class PlayPojo {
private String position; private String position;
private String left; private String left;
private String top; private String top;
private String bottom;
private String src; private String src;
private String height; private String height;
private String width; private String width;
......
...@@ -22,20 +22,67 @@ public class PlayUtils { ...@@ -22,20 +22,67 @@ public class PlayUtils {
private static final PlayPojo PLAY_UN_COLLECT = buildUnCollect(); private static final PlayPojo PLAY_UN_COLLECT = buildUnCollect();
public static PlayDocument getPlayDocument(String headerName, String aside, String asideImg, public static PlayDocument getPlayDocument(String headerName, String aside, String asideImg,
String audio, String text, boolean collected) { String audio, String text) {
PlayDocument document = new PlayDocument(); PlayDocument document = new PlayDocument();
document.setDuration(180000); document.setDuration(180000);
PlayMainTemplate mainTemplate = new PlayMainTemplate(); PlayMainTemplate mainTemplate = new PlayMainTemplate();
document.setMainTemplate(mainTemplate); document.setMainTemplate(mainTemplate);
PlayPojo collectComponent = PLAY_COLLECT; PlayPojo collectComponent = PLAY_COLLECT;
if (!collected) collectComponent = PLAY_UN_COLLECT; //if (!collected) collectComponent = PLAY_UN_COLLECT;
mainTemplate.setItems(Arrays.asList(PLAY_BACK_IMG, buildLunchHead(headerName), PLAY_LOGO, mainTemplate.setItems(Arrays.asList(PLAY_BACK_IMG, buildLunchHead(headerName), PLAY_LOGO,
buildAside(aside), buildAsideImage(asideImg), buildWholeContainer(audio, text) buildAside(aside), buildAsideImage(asideImg), buildWholeContainer(audio, text)
,collectComponent, PLAY_FLOWER, PLAY_HINT)); ,collectComponent, PLAY_FLOWER, PLAY_HINT));
return document; return document;
} }
public static PlayPojo buildCollect() { private static PlayPojo buildFlower() {
PlayPojo backGroundImg = new PlayPojo();
backGroundImg.setType("Image");
backGroundImg.setPosition("absolute");
backGroundImg.setRight("120dp");
backGroundImg.setTop("20dp");
backGroundImg.setHeight("50dp");
backGroundImg.setWidth("50dp");
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/flower.png");
backGroundImg.setOnClick(Collections.singletonList(new Event("SendEvent", "playButton")));
backGroundImg.setScaleType("fitCenter");
return backGroundImg;
}
private static PlayPojo buildCollect() {
PlayPojo backGroundImg = new PlayPojo();
backGroundImg.setType("Image");
backGroundImg.setPosition("absolute");
backGroundImg.setRight("30dp");
backGroundImg.setTop("20dp");
backGroundImg.setHeight("50dp");
backGroundImg.setWidth("50dp");
backGroundImg.setComponentId("playCollect");
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/collec.png");
backGroundImg.setOnClick(Collections.singletonList(new Event("SendEvent", "playButton")));
backGroundImg.setScaleType("fitCenter");
return backGroundImg;
}
private static PlayPojo buildUnCollect() {
PlayPojo backGroundImg = new PlayPojo();
backGroundImg.setType("Image");
backGroundImg.setPosition("absolute");
backGroundImg.setRight("30dp");
backGroundImg.setTop("20dp");
backGroundImg.setHeight("50dp");
backGroundImg.setWidth("50dp");
backGroundImg.setComponentId("playCollect");
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/uncollec.png");
backGroundImg.setOnClick(Collections.singletonList(new Event("SendEvent", "playButton")));
backGroundImg.setScaleType("fitCenter");
return backGroundImg;
}
private static PlayPojo buildCollectFrame() {
PlayPojo collectCon = new PlayPojo(); PlayPojo collectCon = new PlayPojo();
collectCon.setType("Container"); collectCon.setType("Container");
collectCon.setLeft("300dp"); collectCon.setLeft("300dp");
...@@ -71,7 +118,7 @@ public class PlayUtils { ...@@ -71,7 +118,7 @@ public class PlayUtils {
return collectCon; return collectCon;
} }
public static PlayPojo buildUnCollect() { private static PlayPojo buildUnCollectFrame() {
PlayPojo collectCon = new PlayPojo(); PlayPojo collectCon = new PlayPojo();
collectCon.setType("Container"); collectCon.setType("Container");
collectCon.setLeft("300dp"); collectCon.setLeft("300dp");
...@@ -107,7 +154,7 @@ public class PlayUtils { ...@@ -107,7 +154,7 @@ public class PlayUtils {
return collectCon; return collectCon;
} }
public static PlayPojo buildFlower() { private static PlayPojo buildFlowerFrame() {
PlayPojo flowerCon = new PlayPojo(); PlayPojo flowerCon = new PlayPojo();
flowerCon.setType("Container"); flowerCon.setType("Container");
flowerCon.setLeft("600dp"); flowerCon.setLeft("600dp");
...@@ -142,7 +189,7 @@ public class PlayUtils { ...@@ -142,7 +189,7 @@ public class PlayUtils {
return flowerCon; return flowerCon;
} }
public static PlayPojo buildWholeContainer(String audioSrc, String textContent) { private static PlayPojo buildWholeContainer(String audioSrc, String textContent) {
PlayPojo whole = new PlayPojo(); PlayPojo whole = new PlayPojo();
whole.setType("Container"); whole.setType("Container");
whole.setHeight("100%"); whole.setHeight("100%");
...@@ -153,7 +200,7 @@ public class PlayUtils { ...@@ -153,7 +200,7 @@ public class PlayUtils {
textContainer.setType("Container"); textContainer.setType("Container");
textContainer.setPadding("35dp"); textContainer.setPadding("35dp");
textContainer.setPosition("absolute"); textContainer.setPosition("absolute");
textContainer.setTop("140dp"); textContainer.setBottom("250dp");
PlayPojo text = new PlayPojo(); PlayPojo text = new PlayPojo();
text.setType("Text"); text.setType("Text");
...@@ -206,8 +253,8 @@ public class PlayUtils { ...@@ -206,8 +253,8 @@ public class PlayUtils {
logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/logo.png"); logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/logo.png");
logo.setWidth("200dp"); logo.setWidth("200dp");
logo.setHeight("60dp"); logo.setHeight("60dp");
logo.setTop("10dp"); logo.setTop("20dp");
logo.setRight("10dp"); logo.setLeft("10dp");
return logo; return logo;
} }
...@@ -215,11 +262,12 @@ public class PlayUtils { ...@@ -215,11 +262,12 @@ public class PlayUtils {
PlayPojo asideContainer = new PlayPojo(); PlayPojo asideContainer = new PlayPojo();
asideContainer.setType("Container"); asideContainer.setType("Container");
asideContainer.setPosition("absolute"); asideContainer.setPosition("absolute");
asideContainer.setLeft("130dp"); asideContainer.setLeft("115dp");
asideContainer.setTop("135dp"); asideContainer.setTop("185dp");
PlayPojo frame = new PlayPojo(); PlayPojo frame = new PlayPojo();
frame.setType("Frame"); frame.setType("Frame");
frame.setWidth("70dp");
frame.setPaddingLeft("50dp"); frame.setPaddingLeft("50dp");
frame.setPaddingRight("15dp"); frame.setPaddingRight("15dp");
frame.setPaddingVertical("10dp"); frame.setPaddingVertical("10dp");
...@@ -241,8 +289,8 @@ public class PlayUtils { ...@@ -241,8 +289,8 @@ public class PlayUtils {
PlayPojo asideContainer = new PlayPojo(); PlayPojo asideContainer = new PlayPojo();
asideContainer.setType("Container"); asideContainer.setType("Container");
asideContainer.setPosition("absolute"); asideContainer.setPosition("absolute");
asideContainer.setLeft("60dp"); asideContainer.setLeft("35dp");
asideContainer.setTop("120dp"); asideContainer.setTop("167dp");
PlayPojo frame = new PlayPojo(); PlayPojo frame = new PlayPojo();
frame.setType("Frame"); frame.setType("Frame");
......
...@@ -46,7 +46,7 @@ public class ProductInfoUtils { ...@@ -46,7 +46,7 @@ public class ProductInfoUtils {
coverImage.setWidth("280dp"); coverImage.setWidth("280dp");
coverImage.setHeight("280dp"); coverImage.setHeight("280dp");
coverImage.setBorderRadius("30dp"); coverImage.setBorderRadius("30dp");
coverImage.setScaleType("fitCenter"); coverImage.setScaleType("fitXY");
coverImage.setMarginLeft("50dp"); coverImage.setMarginLeft("50dp");
coverImage.setMarginTop("12dp"); coverImage.setMarginTop("12dp");
coverImage.setComponentId("imgPro"); coverImage.setComponentId("imgPro");
...@@ -153,7 +153,7 @@ public class ProductInfoUtils { ...@@ -153,7 +153,7 @@ public class ProductInfoUtils {
iconCon.setType("Container"); iconCon.setType("Container");
iconCon.setPosition("absolute"); iconCon.setPosition("absolute");
iconCon.setFlexDirection("row"); iconCon.setFlexDirection("row");
iconCon.setBottom("160dp"); iconCon.setBottom("170dp");
iconCon.setItems(Arrays.asList(buildStart(startComponId), buildFlower(flowerId, flowerText), iconCon.setItems(Arrays.asList(buildStart(startComponId), buildFlower(flowerId, flowerText),
buildCollect(collectId, collectSrc, collectText))); buildCollect(collectId, collectSrc, collectText)));
return iconCon; return iconCon;
...@@ -187,7 +187,7 @@ public class ProductInfoUtils { ...@@ -187,7 +187,7 @@ public class ProductInfoUtils {
ProductInfoPojo flowerCon = new ProductInfoPojo(); ProductInfoPojo flowerCon = new ProductInfoPojo();
flowerCon.setType("Container"); flowerCon.setType("Container");
flowerCon.setAlignItems("center"); flowerCon.setAlignItems("center");
flowerCon.setMarginLeft("130dp"); flowerCon.setMarginLeft("120dp");
flowerCon.setOnClick(Collections.singletonList(new Event("SendEvent", flowerId))); flowerCon.setOnClick(Collections.singletonList(new Event("SendEvent", flowerId)));
ProductInfoPojo image = new ProductInfoPojo(); ProductInfoPojo image = new ProductInfoPojo();
......
...@@ -25,6 +25,7 @@ public class RecommandPojo { ...@@ -25,6 +25,7 @@ public class RecommandPojo {
private String position; private String position;
private String top; private String top;
private String left; private String left;
private String right;
private String src; private String src;
private String headerTitle; private String headerTitle;
private Boolean hasBackIcon; private Boolean hasBackIcon;
...@@ -53,5 +54,8 @@ public class RecommandPojo { ...@@ -53,5 +54,8 @@ public class RecommandPojo {
private String backgroundColor; private String backgroundColor;
@JsonProperty("flex-direction") @JsonProperty("flex-direction")
private String flexDirection; private String flexDirection;
@JsonProperty("justify-content")
private String justifyContent;
private String looping;
private String autoplay;
} }
...@@ -29,7 +29,7 @@ public class XiaoDuHomeController { ...@@ -29,7 +29,7 @@ public class XiaoDuHomeController {
//service.disableVerify(); //service.disableVerify();
service.enableVerify(); service.enableVerify();
String str = service.run(); String str = service.run();
//log.info("响应信息:{}", str); log.info("响应信息:{}", str);
return str; return str;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.BaseHolder; ...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.BaseHolder;
import ai.qiwu.com.xiaoduhome.common.Config; import ai.qiwu.com.xiaoduhome.common.Config;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils; import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchUtils; import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchUtils;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommendUtil;
import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb; import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail; import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB; import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
...@@ -29,6 +30,7 @@ import java.util.logging.Level; ...@@ -29,6 +30,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.DEFAULT_ASIDE_IMG_URL; import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.DEFAULT_ASIDE_IMG_URL;
import static ai.qiwu.com.xiaoduhome.common.Constants.RE_RA_CA_PAGE_SIZE;
import static ai.qiwu.com.xiaoduhome.common.Constants.UNIT_PRICE; import static ai.qiwu.com.xiaoduhome.common.Constants.UNIT_PRICE;
import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL; import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL;
...@@ -39,15 +41,16 @@ import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL; ...@@ -39,15 +41,16 @@ import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL;
@Slf4j @Slf4j
@Component @Component
public class ScheduleService implements InitializingBean { public class ScheduleService implements InitializingBean {
private static int allProductCount; private static volatile int allProductCount;
private static volatile int rankPageSize;
private static volatile List<GameProjectTb> RANKING_LIST = new ArrayList<>(); private static volatile List<GameProjectTb> RANKING_LIST = new ArrayList<>();
private static volatile List<GameProjectTb> RECOMMEND_LIST = new ArrayList<>(); private static volatile List<GameProjectTb> RECOMMEND_LIST = new ArrayList<>();
private static volatile List<OnProductDetail> ALL_ON_PRODUCT = new ArrayList<>(); private static volatile List<OnProductDetail> ALL_ON_PRODUCT = new ArrayList<>();
private static volatile List<OnProductDetail> RANK_ORDER_IDs = new ArrayList<>(); private static volatile List<OnProductDetail> RANK_ORDER_IDs = new ArrayList<>();
static final HashMap<String, OnProductDetail> PRODUCT_NAME_DETAIL = new HashMap<>(); static volatile HashMap<String, OnProductDetail> PRODUCT_NAME_DETAIL = new HashMap<>();
static final HashMap<String, OnProductDetail> PRODUCT_ID_DETAIL = new HashMap<>(); static volatile HashMap<String, OnProductDetail> PRODUCT_ID_DETAIL = new HashMap<>();
private static final HashMap<String, Map<String,String>> ASIDE_IMG = new HashMap<>(); private static volatile HashMap<String, Map<String,String>> ASIDE_IMG = new HashMap<>();
private static final HashMap<String, String> NX2_BOT_TO_HZ1 = new HashMap<>(); private static final HashMap<String, String> NX2_BOT_TO_HZ1 = new HashMap<>();
private static final HashMap<String, String> HZ1_BOT_TO_NX2 = new HashMap<>(); private static final HashMap<String, String> HZ1_BOT_TO_NX2 = new HashMap<>();
...@@ -56,7 +59,7 @@ public class ScheduleService implements InitializingBean { ...@@ -56,7 +59,7 @@ public class ScheduleService implements InitializingBean {
static final String[] CATEGORY = {"古风", "儿童", "科幻", "占星", "恋爱", "灾难", "架空", "经营", "冒险", "武侠"}; static final String[] CATEGORY = {"古风", "儿童", "科幻", "占星", "恋爱", "灾难", "架空", "经营", "冒险", "武侠"};
private static final String[] CATEGORY_CHARAC={"gufeng","child","kehuan","zhanxing","lianai","zainan","jiakong","jingying","maoxian","wuxia"}; private static final String[] CATEGORY_CHARAC={"gufeng","child","kehuan","zhanxing","lianai","zainan","jiakong","jingying","maoxian","wuxia"};
private static final HashMap<String,List<String>> CATEGORY_PRODUCT_ID_LIST = new HashMap<>(); private static volatile HashMap<String,List<String>> CATEGORY_PRODUCT_ID_LIST = new HashMap<>();
private final GameProjectTbRepository gameProjectTbRepository; private final GameProjectTbRepository gameProjectTbRepository;
...@@ -151,18 +154,24 @@ public class ScheduleService implements InitializingBean { ...@@ -151,18 +154,24 @@ public class ScheduleService implements InitializingBean {
new Thread(() -> { new Thread(() -> {
ALL_ON_PRODUCT = allOnProductInfoRepository.findAllByApplyStatus(1); ALL_ON_PRODUCT = allOnProductInfoRepository.findAllByApplyStatus(1);
allProductCount = ALL_ON_PRODUCT.size(); allProductCount = ALL_ON_PRODUCT.size();
rankPageSize = allProductCount / RE_RA_CA_PAGE_SIZE + (allProductCount%RE_RA_CA_PAGE_SIZE == 0 ? 0:1);
TreeMap<Long, OnProductDetail> rankOrder = new TreeMap<>((o1, o2) -> o1-o2 < 0 ? 1 :(o1.equals(o2) ? 0 : -1)); TreeMap<Long, OnProductDetail> rankOrder = new TreeMap<>((o1, o2) -> o1-o2 < 0 ? 1 :(o1.equals(o2) ? 0 : -1));
HashMap<String, OnProductDetail> nd = new HashMap<>();
HashMap<String, OnProductDetail> id = new HashMap<>();
for (OnProductDetail item : ALL_ON_PRODUCT) { for (OnProductDetail item : ALL_ON_PRODUCT) {
String productName = item.getName(); String productName = item.getName();
String botAccount = item.getBotAccount(); String botAccount = item.getBotAccount();
List<String> labels = projectLabelRepository.productLabels(item.getId()); List<String> labels = projectLabelRepository.productLabels(item.getId());
//PRODUCT_LABELS.put(productName, labels); //PRODUCT_LABELS.put(productName, labels);
item.setLabels(labels); item.setLabels(labels);
PRODUCT_NAME_DETAIL.put(productName, item); nd.put(productName, item);
PRODUCT_ID_DETAIL.put(botAccount, item); id.put(botAccount, item);
rankOrder.put(item.getWatch(), item); rankOrder.put(item.getWatch(), item);
} }
RANK_ORDER_IDs.addAll(rankOrder.values()); PRODUCT_NAME_DETAIL = nd;
PRODUCT_ID_DETAIL = id;
RANK_ORDER_IDs = new ArrayList<>(rankOrder.values());
RecommendUtil.setRankDocument(null);
//log.info("作品详细信息:{}", PRODUCT_NAME_DETAIL); //log.info("作品详细信息:{}", PRODUCT_NAME_DETAIL);
}).start(); }).start();
//log.error("更新推荐页出错:{}", e.getMessage()); //log.error("更新推荐页出错:{}", e.getMessage());
...@@ -171,13 +180,15 @@ public class ScheduleService implements InitializingBean { ...@@ -171,13 +180,15 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 1 * * ?") @Scheduled(cron = "0 0 1 * * ?")
public void initProductList() { public void initProductList() {
new Thread(() -> { new Thread(() -> {
HashMap<String,List<String>> ci = new HashMap<>();
for (String category: CATEGORY) { for (String category: CATEGORY) {
//List<GameProjectTb> list = gameProjectTbRepository.categoryProject(category); //List<GameProjectTb> list = gameProjectTbRepository.categoryProject(category);
List<String> idList = gameProjectTbRepository.categoryProList(category); List<String> idList = gameProjectTbRepository.categoryProList(category);
CATEGORY_PRODUCT_ID_LIST.put(category, idList); ci.put(category, idList);
//CATEGORY_PRODUCT_LIST.put(category, list); //CATEGORY_PRODUCT_LIST.put(category, list);
//log.info("分类{},作品列表{}", category, list); //log.info("分类{},作品列表{}", category, list);
} }
CATEGORY_PRODUCT_ID_LIST = ci;
}).start(); }).start();
//log.error("更新分类作品列表出错:{}", e.getMessage()); //log.error("更新分类作品列表出错:{}", e.getMessage());
} }
...@@ -213,6 +224,7 @@ public class ScheduleService implements InitializingBean { ...@@ -213,6 +224,7 @@ public class ScheduleService implements InitializingBean {
private void getAsideImg() { private void getAsideImg() {
DplbotServiceUtil.getPOOL().submit(() -> { DplbotServiceUtil.getPOOL().submit(() -> {
List<String> botIds = gameProjectTbRepository.getAllOnTableProductIds(); List<String> botIds = gameProjectTbRepository.getAllOnTableProductIds();
HashMap<String, Map<String,String>> ai = new HashMap<>();
for (String botId: botIds) { for (String botId: botIds) {
try { try {
String nxBotId = HZ1_BOT_TO_NX2.get(botId); String nxBotId = HZ1_BOT_TO_NX2.get(botId);
...@@ -225,11 +237,12 @@ public class ScheduleService implements InitializingBean { ...@@ -225,11 +237,12 @@ public class ScheduleService implements InitializingBean {
params.put("aipioneerUsername",nxBotId); params.put("aipioneerUsername",nxBotId);
String str = OkHttp3Utils.doGet(ASIDE_IMG_URL, params); String str = OkHttp3Utils.doGet(ASIDE_IMG_URL, params);
AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class); AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
ASIDE_IMG.put(botId, response.getData().getNpcHeadImgUrl()); ai.put(botId, response.getData().getNpcHeadImgUrl());
} catch (Exception e) { } catch (Exception e) {
log.error("定时获取头像出错:botId:{},{}",botId, ScheduleService.getProductIdDetail().get(botId).getName()); log.error("定时获取头像出错:botId:{},{}",botId, ScheduleService.getProductIdDetail().get(botId).getName());
} }
} }
ASIDE_IMG = ai;
}); });
} }
...@@ -360,4 +373,8 @@ public class ScheduleService implements InitializingBean { ...@@ -360,4 +373,8 @@ public class ScheduleService implements InitializingBean {
if (url == null) url = DEFAULT_ASIDE_IMG_URL; if (url == null) url = DEFAULT_ASIDE_IMG_URL;
return url; return url;
} }
public static int getRankPageSize() {
return rankPageSize;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment