Commit f5bb9486 by 苗权威

2.19

parent 07a5b650
...@@ -2,9 +2,8 @@ package ai.qiwu.com.xiaoduhome; ...@@ -2,9 +2,8 @@ package ai.qiwu.com.xiaoduhome;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; 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.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
...@@ -13,6 +12,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -13,6 +12,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class XiaoduhomeApplication { public class XiaoduhomeApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication application = new SpringApplication(XiaoduhomeApplication.class);
application.addListeners(new ApplicationPidFileWriter());
SpringApplication.run(XiaoduhomeApplication.class, args); SpringApplication.run(XiaoduhomeApplication.class, args);
} }
......
...@@ -3,6 +3,8 @@ package ai.qiwu.com.xiaoduhome.common; ...@@ -3,6 +3,8 @@ package ai.qiwu.com.xiaoduhome.common;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Properties; import java.util.Properties;
...@@ -19,7 +21,11 @@ public class Config { ...@@ -19,7 +21,11 @@ public class Config {
String filename = "xiaodu.properties"; String filename = "xiaodu.properties";
properties = new Properties(); properties = new Properties();
try { 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) { } catch (Exception e) {
log.error("获取配置文件对象出错:{}", e.toString()); log.error("获取配置文件对象出错:{}", e.toString());
System.exit(1); System.exit(1);
......
...@@ -62,7 +62,7 @@ public interface Constants { ...@@ -62,7 +62,7 @@ public interface Constants {
String COLLECTED_IMG_URL = "https://didi-gz5.jiaoyou365.com/duai/image/collec.png"; 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 UN_COLLECTED_IMG_URL = "https://didi-gz5.jiaoyou365.com/duai/image/uncollec.png";
String DEFAULT_ASIDE_IMG_URL = "http://didi-gz4.jiaoyou365.com/Editor/upload/img/npc/2019/02/19174004213.png"; String DEFAULT_ASIDE_IMG_URL = "http://didi-gz5.jiaoyou365.com/Editor/upload/img/npc/2019/02/19174004213.png";
} }
interface PRODUCT_INTRO { interface PRODUCT_INTRO {
...@@ -96,8 +96,8 @@ public interface Constants { ...@@ -96,8 +96,8 @@ public interface Constants {
} }
interface SKILL_SECURITY { interface SKILL_SECURITY {
String REDIRECT_URI = "https://xiaodu.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/15966f1c8158104bd82712f95d8a1150"; String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/3a0610f8af67a3c92d803a80a1c8976c";
String CLIENT_ID = "aiqiwucom"; String CLIENT_ID = "aiqiwucom";
String CLIENT_SECRET = "miaoquanwei"; String CLIENT_SECRET = "miaoquanwei";
} }
......
...@@ -143,6 +143,7 @@ public class OkHttp3Utils { ...@@ -143,6 +143,7 @@ public class OkHttp3Utils {
case 3 : header = "jiaoyou-audio-child-test";break; case 3 : header = "jiaoyou-audio-child-test";break;
case 2 : case 2 :
case 4 : header = "jiaoyou-audio-adult-test";break; case 4 : header = "jiaoyou-audio-adult-test";break;
case 6 : header = "baidu-screen-jiaoyou-audio-test";break;
default: header = "jiaoyou-audio-test"; default: header = "jiaoyou-audio-test";
} }
} }
...@@ -304,6 +305,34 @@ public class OkHttp3Utils { ...@@ -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 { public static String doDelete(String url, Map<String, String> headers, String jsonStr) throws IOException {
Request.Builder builder = new Request.Builder(); Request.Builder builder = new Request.Builder();
Request request = builder.url(url).build(); Request request = builder.url(url).build();
......
...@@ -256,11 +256,15 @@ public class Utils { ...@@ -256,11 +256,15 @@ public class Utils {
List<String> list = Arrays.asList(s1); List<String> list = Arrays.asList(s1);
StringBuilder num = new StringBuilder(); StringBuilder num = new StringBuilder();
boolean first = true; boolean first = true;
for (String str: numStr.split("")) { String[] arr = numStr.split("");
for (String str: arr) {
int i; int i;
if (first) { if (first) {
first = false; 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);
} }
else if ((i = list.indexOf(str)) != -1) num.append(i); else if ((i = list.indexOf(str)) != -1) num.append(i);
......
...@@ -174,7 +174,7 @@ public class CollectHistoryUtils { ...@@ -174,7 +174,7 @@ public class CollectHistoryUtils {
backGroundImg.setPosition("absolute"); backGroundImg.setPosition("absolute");
backGroundImg.setTop("0dp"); backGroundImg.setTop("0dp");
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backend.jpg"); backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backNew.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setScaleType("fitXY"); backGroundImg.setScaleType("fitXY");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
......
...@@ -260,8 +260,7 @@ public class TempleUtils { ...@@ -260,8 +260,7 @@ public class TempleUtils {
for (ProjectData projectInfo : list) { for (ProjectData projectInfo : list) {
String productName = correctName(projectInfo.getName()); String productName = correctName(projectInfo.getName());
String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(projectInfo.getName()).toString(); 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(projectInfo.getBannerImgUrl(), imageId,productName);
LunchBotData data = new LunchBotData(src, imageId,productName);
data.setNum(begin++); data.setNum(begin++);
dataList.add(data); dataList.add(data);
} }
......
...@@ -25,6 +25,7 @@ public class LunchPojo { ...@@ -25,6 +25,7 @@ public class LunchPojo {
private String width; private String width;
private String left; private String left;
private String top; private String top;
private String bottom;
private String right; private String right;
private String src; private String src;
private List<LunchPojo> items; private List<LunchPojo> items;
...@@ -58,6 +59,10 @@ public class LunchPojo { ...@@ -58,6 +59,10 @@ public class LunchPojo {
private String text; private String text;
@JsonProperty("font-size") @JsonProperty("font-size")
private String fontSize; private String fontSize;
@JsonProperty("justify-content")
private String justifyContent;
private List<LunchBotData> data; private List<LunchBotData> data;
private List<FrameTemple> firstItem; private List<FrameTemple> firstItem;
private String headerImage;
private List<String> hints;
} }
package ai.qiwu.com.xiaoduhome.common.temple.onLunch; package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils; 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.pojo.dpl.Event;
import ai.qiwu.com.xiaoduhome.service.ScheduleService; import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew; import ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew;
...@@ -19,9 +20,10 @@ public class LunchUtils { ...@@ -19,9 +20,10 @@ public class LunchUtils {
private static final LunchPojo LUNCH_LIST_CATEGORY_CON = buildCategoryList(); private static final LunchPojo LUNCH_LIST_CATEGORY_CON = buildCategoryList();
private static final LunchPojo LUNCH_HEAD = buildLunchHead(); private static final LunchPojo LUNCH_HEAD = buildLunchHead();
private static final LunchPojo LUNCH_BACK_IMG = buildLunchBackgroundImg(); private static final LunchPojo LUNCH_BACK_IMG = buildLunchBackgroundImg();
private static final LunchPojo LUNCH_LOGO_IMG = buildLogoImage(); private static final LunchPojo FOOTER = buildHomeFooter();
private static final LunchPojo LUNCH_HSITORY_IMG = buildHistoryImg(); // private static final LunchPojo LUNCH_LOGO_IMG = buildLogoImage();
private static final LunchPojo LUNCH_COLLECT_IMG = buildCollectImg(); // private static final LunchPojo LUNCH_HSITORY_IMG = buildHistoryImg();
// private static final LunchPojo LUNCH_COLLECT_IMG = buildCollectImg();
private volatile static LunchDocument lunchDocument = buildLunchNewDocument(); private volatile static LunchDocument lunchDocument = buildLunchNewDocument();
...@@ -47,7 +49,8 @@ public class LunchUtils { ...@@ -47,7 +49,8 @@ public class LunchUtils {
LunchPojo scroll = buildLunchScroll(); LunchPojo scroll = buildLunchScroll();
scroll.setItems(list); 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; return document;
} }
...@@ -70,7 +73,7 @@ public class LunchUtils { ...@@ -70,7 +73,7 @@ public class LunchUtils {
LunchPojo scroll = buildLunchScroll(); LunchPojo scroll = buildLunchScroll();
// scroll.setItems(Arrays.asList(conRecommend,conRanking,conCategory)); // 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; return document;
} }
...@@ -78,8 +81,10 @@ public class LunchUtils { ...@@ -78,8 +81,10 @@ public class LunchUtils {
LunchPojo scroll = new LunchPojo(); LunchPojo scroll = new LunchPojo();
scroll.setType("ScrollView"); scroll.setType("ScrollView");
scroll.setDirection("vertical"); scroll.setDirection("vertical");
scroll.setMarginTop("180dp");
scroll.setWidth("100%"); scroll.setWidth("100%");
scroll.setMarginBottom("10dp"); scroll.setPaddingBottom("20dp");
// scroll.setMarginBottom("10dp");
return scroll; return scroll;
} }
...@@ -105,12 +110,13 @@ public class LunchUtils { ...@@ -105,12 +110,13 @@ public class LunchUtils {
private static LunchPojo buildLunchList(List<LunchBotData> data) { private static LunchPojo buildLunchList(List<LunchBotData> data) {
LunchPojo container = new LunchPojo(); LunchPojo container = new LunchPojo();
container.setType("Container"); container.setType("Container");
container.setMarginBottom("28dp"); container.setMarginBottom("45dp");
container.setAlignItems("center");
container.setWidth("100%"); container.setWidth("100%");
LunchPojo list = new LunchPojo(); LunchPojo list = new LunchPojo();
list.setType("List"); list.setType("List");
list.setMarginLeft("30dp"); list.setMarginLeft("20dp");
// list.setMarginRight("15dp"); // list.setMarginRight("15dp");
list.setDirection("horizontal"); list.setDirection("horizontal");
list.setData(data); list.setData(data);
...@@ -137,8 +143,8 @@ public class LunchUtils { ...@@ -137,8 +143,8 @@ public class LunchUtils {
//image //image
LunchPojo image = new LunchPojo(); LunchPojo image = new LunchPojo();
image.setType("Image"); image.setType("Image");
image.setWidth("210dp"); image.setWidth("200dp");
image.setHeight("210dp"); image.setHeight("200dp");
image.setMarginLeft("7dp"); image.setMarginLeft("7dp");
image.setMarginTop("7dp"); image.setMarginTop("7dp");
image.setPosition("absolute"); image.setPosition("absolute");
...@@ -150,16 +156,17 @@ public class LunchUtils { ...@@ -150,16 +156,17 @@ public class LunchUtils {
//frame //frame
LunchPojo frame = new LunchPojo(); LunchPojo frame = new LunchPojo();
frame.setType("Frame"); frame.setType("Frame");
frame.setWidth("35dp"); frame.setWidth("45dp");
frame.setHeight("35dp"); frame.setHeight("45dp");
frame.setBackgroundColor("rgba(0,0,0,0.8)"); frame.setBackgroundColor("rgb(30,144,255)");
frame.setBorderRadius("13dp"); frame.setBorderRadius("25dp");
LunchPojo frmCon = new LunchPojo(); LunchPojo frmCon = new LunchPojo();
frmCon.setType("Container"); frmCon.setType("Container");
frmCon.setWidth("100%"); frmCon.setWidth("100%");
frmCon.setHeight("100%"); frmCon.setHeight("100%");
frmCon.setAlignItems("center"); frmCon.setAlignItems("center");
frmCon.setJustifyContent("center");
LunchPojo frmText = new LunchPojo(); LunchPojo frmText = new LunchPojo();
frmText.setType("Text"); frmText.setType("Text");
...@@ -191,7 +198,7 @@ public class LunchUtils { ...@@ -191,7 +198,7 @@ public class LunchUtils {
backGroundImg.setPosition("absolute"); backGroundImg.setPosition("absolute");
backGroundImg.setTop("0dp"); backGroundImg.setTop("0dp");
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backend.jpg"); backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backNew.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setScaleType("fitXY"); backGroundImg.setScaleType("fitXY");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
...@@ -200,14 +207,40 @@ public class LunchUtils { ...@@ -200,14 +207,40 @@ public class LunchUtils {
} }
private static LunchPojo buildLunchHead() { private static LunchPojo buildLunchHead() {
// LunchPojo head = new LunchPojo();
// head.setType("Header");
// //head.setHeaderTitle("交游天下");
// head.setHasBackIcon(false);
// return head;
LunchPojo head = new LunchPojo(); LunchPojo head = new LunchPojo();
head.setType("Header"); head.setType("Image");
//head.setHeaderTitle("交游天下"); head.setPosition("absolute");
head.setHasBackIcon(false); 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; 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() { private static LunchPojo buildLogoImage() {
LunchPojo logoCon = new LunchPojo(); LunchPojo logoCon = new LunchPojo();
logoCon.setType("Container"); logoCon.setType("Container");
......
...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.pojo.ActorWithWord; ...@@ -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.dpl.Event;
import ai.qiwu.com.xiaoduhome.pojo.playAside.PlayPageData; import ai.qiwu.com.xiaoduhome.pojo.playAside.PlayPageData;
import ai.qiwu.com.xiaoduhome.service.ScheduleService; import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import ai.qiwu.com.xiaoduhome.service.ScheduleServiceNew;
import java.util.*; import java.util.*;
...@@ -18,7 +19,7 @@ public class PlayUtils { ...@@ -18,7 +19,7 @@ public class PlayUtils {
private static final PlayPojo PLAY_FLOWER = buildFlower(); private static final PlayPojo PLAY_FLOWER = buildFlower();
private static final PlayPojo PLAY_LOGO = buildLogoImage(); private static final PlayPojo PLAY_LOGO = buildLogoImage();
private static final PlayPojo PLAY_COLLECT = buildCollect(); 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(); private static final PlayPojo PLAY_LIST_ITEM = buildContent();
...@@ -31,7 +32,7 @@ public class PlayUtils { ...@@ -31,7 +32,7 @@ public class PlayUtils {
List<PlayPageData> dataList = new ArrayList<>(); List<PlayPageData> dataList = new ArrayList<>();
for (ActorWithWord aw: aws) { for (ActorWithWord aw: aws) {
PlayPageData data = new PlayPageData(aw.getActor(), ScheduleService.getAsideImgUrl(botAccount, aw.getActor()), PlayPageData data = new PlayPageData(aw.getActor(), ScheduleServiceNew.getAsideImgUrl(botAccount, aw.getActor()),
aw.getText().replaceAll("<br>","\n")); aw.getText().replaceAll("<br>","\n"));
dataList.add(data); dataList.add(data);
} }
...@@ -355,7 +356,7 @@ public class PlayUtils { ...@@ -355,7 +356,7 @@ public class PlayUtils {
backGroundImg.setPosition("absolute"); backGroundImg.setPosition("absolute");
backGroundImg.setTop("0dp"); backGroundImg.setTop("0dp");
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backend.jpg"); backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backNew.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY"); backGroundImg.setScaleType("fitXY");
......
...@@ -119,6 +119,7 @@ public class ProductInfoUtils { ...@@ -119,6 +119,7 @@ public class ProductInfoUtils {
ProductInfoPojo label = new ProductInfoPojo(); ProductInfoPojo label = new ProductInfoPojo();
label.setType("Text"); label.setType("Text");
label.setMarginLeft("5%"); label.setMarginLeft("5%");
label.setTextOverflow("ellipsis");
label.setFontSize("22dp"); label.setFontSize("22dp");
label.setMaxLines(1); label.setMaxLines(1);
label.setText(labelText); label.setText(labelText);
...@@ -260,7 +261,7 @@ public class ProductInfoUtils { ...@@ -260,7 +261,7 @@ public class ProductInfoUtils {
backGroundImg.setPosition("absolute"); backGroundImg.setPosition("absolute");
backGroundImg.setTop("0dp"); backGroundImg.setTop("0dp");
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backend.jpg"); backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backNew.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY"); backGroundImg.setScaleType("fitXY");
......
...@@ -150,17 +150,13 @@ public class RecommendUtil { ...@@ -150,17 +150,13 @@ public class RecommendUtil {
botIds.append(third.getBotAccount()).append(File.separator); botIds.append(third.getBotAccount()).append(File.separator);
ProjectData forth = list.get(3); ProjectData forth = list.get(3);
botIds.append(forth.getBotAccount()).append(File.separator); botIds.append(forth.getBotAccount()).append(File.separator);
RecommandPojo pojoFirst = buildImgFrmTxtContainerFirstRow(new StringBuilder(Constants.IMG_PREFIX) RecommandPojo pojoFirst = buildImgFrmTxtContainerFirstRow(first.getBannerImgUrl(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(first.getName()).toString(),
.append(first.getBannerImgUrl()).toString(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(first.getName()).toString(),
TempleUtils.correctName(first.getName()), "first.png"); TempleUtils.correctName(first.getName()), "first.png");
RecommandPojo pojoSe = buildImgFrmTxtContainerFirstRow(new StringBuilder(Constants.IMG_PREFIX) RecommandPojo pojoSe = buildImgFrmTxtContainerFirstRow(second.getBannerImgUrl(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(second.getName()).toString(),
.append(second.getBannerImgUrl()).toString(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(second.getName()).toString(),
TempleUtils.correctName(second.getName()), "second.png"); TempleUtils.correctName(second.getName()), "second.png");
RecommandPojo pojoThird = buildImgFrmTxtContainerFirstRow(new StringBuilder(Constants.IMG_PREFIX) RecommandPojo pojoThird = buildImgFrmTxtContainerFirstRow(third.getBannerImgUrl(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(third.getName()).toString(),
.append(third.getBannerImgUrl()).toString(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(third.getName()).toString(),
TempleUtils.correctName(third.getName()), "third.png"); TempleUtils.correctName(third.getName()), "third.png");
RecommandPojo pojoFourth = buildImgFrmTxtContainerFourth(new StringBuilder(Constants.IMG_PREFIX) RecommandPojo pojoFourth = buildImgFrmTxtContainerFourth(forth.getBannerImgUrl(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(forth.getName()).toString(),
.append(forth.getBannerImgUrl()).toString(), new StringBuilder(Constants.PRE_PRODUCT_IMG).append(forth.getName()).toString(),
TempleUtils.correctName(forth.getName())); TempleUtils.correctName(forth.getName()));
rowContainer.setItems(Arrays.asList(pojoFirst, pojoSe, pojoThird, pojoFourth)); rowContainer.setItems(Arrays.asList(pojoFirst, pojoSe, pojoThird, pojoFourth));
...@@ -171,7 +167,7 @@ public class RecommendUtil { ...@@ -171,7 +167,7 @@ public class RecommendUtil {
//scrollList.add(buildRecommendList(getListData(3, 12, 16, list, botIds))); //scrollList.add(buildRecommendList(getListData(3, 12, 16, list, botIds)));
mainTemplate.getItems().addAll(Arrays.asList(RECOM_BACK_IMG,RANK_HEAD,scrollView,buildPageButton(1, 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); botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes()); String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
...@@ -210,7 +206,7 @@ public class RecommendUtil { ...@@ -210,7 +206,7 @@ public class RecommendUtil {
begin = end; begin = end;
} }
mainTemplate.getItems().addAll(Arrays.asList(RECOM_BACK_IMG,RANK_HEAD,scrollView, 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); botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes()); String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
...@@ -228,9 +224,8 @@ public class RecommendUtil { ...@@ -228,9 +224,8 @@ public class RecommendUtil {
StringBuilder botIds = new StringBuilder(); StringBuilder botIds = new StringBuilder();
int num = 0; int num = 0;
for (ProjectData bot: bots) { 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(); 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); detail.setNum(++num);
data.add(detail); data.add(detail);
botIds.append(bot.getBotAccount()).append(File.separator); botIds.append(bot.getBotAccount()).append(File.separator);
...@@ -294,10 +289,10 @@ public class RecommendUtil { ...@@ -294,10 +289,10 @@ public class RecommendUtil {
//frame //frame
RecommandPojo frame = new RecommandPojo(); RecommandPojo frame = new RecommandPojo();
frame.setType("Frame"); frame.setType("Frame");
frame.setWidth("40dp"); frame.setWidth("45dp");
frame.setHeight("40dp"); frame.setHeight("45dp");
frame.setBackgroundColor("rgba(0,0,0,0.9)"); frame.setBackgroundColor("rgb(30,144,255)");
frame.setBorderRadius("15dp"); frame.setBorderRadius("25dp");
RecommandPojo frmCon = new RecommandPojo(); RecommandPojo frmCon = new RecommandPojo();
frmCon.setType("Container"); frmCon.setType("Container");
...@@ -455,9 +450,8 @@ public class RecommendUtil { ...@@ -455,9 +450,8 @@ public class RecommendUtil {
for (int i = begin; i < end; i++) { for (int i = begin; i < end; i++) {
ProjectData bot = bots.get(i); ProjectData bot = bots.get(i);
botIds.append(bot.getBotAccount()).append(File.separator); 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(); 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); detail.setNum(i-begin+n);
data.add(detail); data.add(detail);
} }
...@@ -469,9 +463,8 @@ public class RecommendUtil { ...@@ -469,9 +463,8 @@ public class RecommendUtil {
int n = 1+row*4; int n = 1+row*4;
for (int i = begin; i < end; i++) { for (int i = begin; i < end; i++) {
ProjectData bot = bots.get(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(); 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); detail.setNum(i-begin+n);
data.add(detail); data.add(detail);
} }
...@@ -602,7 +595,7 @@ public class RecommendUtil { ...@@ -602,7 +595,7 @@ public class RecommendUtil {
backGroundImg.setPosition("absolute"); backGroundImg.setPosition("absolute");
backGroundImg.setTop("0dp"); backGroundImg.setTop("0dp");
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backend.jpg"); backGroundImg.setSrc("https://didi-gz5.jiaoyou365.com/duai/image/backNew.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY"); backGroundImg.setScaleType("fitXY");
...@@ -653,4 +646,10 @@ public class RecommendUtil { ...@@ -653,4 +646,10 @@ public class RecommendUtil {
public static void setRankDocument(RecommandDocument rankDocument) { public static void setRankDocument(RecommandDocument rankDocument) {
RecommendUtil.rankDocument = 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());
}
} }
...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Utils; ...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Utils;
import ai.qiwu.com.xiaoduhome.pojo.OverTimeDetail; import ai.qiwu.com.xiaoduhome.pojo.OverTimeDetail;
import ai.qiwu.com.xiaoduhome.service.DplBotRedisService; import ai.qiwu.com.xiaoduhome.service.DplBotRedisService;
import ai.qiwu.com.xiaoduhome.service.DplBotService; 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.service.ResponseEncapsulation;
import ai.qiwu.com.xiaoduhome.spirit.SpiritService; import ai.qiwu.com.xiaoduhome.spirit.SpiritService;
import ai.qiwu.com.xiaoduhome.xiaoai.model.request.XiaoAiRequest; import ai.qiwu.com.xiaoduhome.xiaoai.model.request.XiaoAiRequest;
...@@ -119,13 +120,13 @@ public class XiaoDuHomeController { ...@@ -119,13 +120,13 @@ public class XiaoDuHomeController {
try { try {
//log.info("--------------分界线-------------------"); //log.info("--------------分界线-------------------");
// DplBotService service = new DplBotService(Utils.getHttpServletRequest(), 5); // DplBotService service = new DplBotService(Utils.getHttpServletRequest(), 5);
// log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes()); DplBotServiceBoth service = new DplBotServiceBoth(request, 6, stringRedisTemplate);
DplBotRedisService service = new DplBotRedisService(request, 5, stringRedisTemplate); log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes());
// log.info(service.getStrRequest()); log.info(service.getStrRequest());
//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();
......
...@@ -26,4 +26,6 @@ public class UserBehaviorData { ...@@ -26,4 +26,6 @@ public class UserBehaviorData {
private volatile Byte mark = 1; private volatile Byte mark = 1;
private volatile String jytUserId; private volatile String jytUserId;
private volatile String channel;
} }
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;
}
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;
}
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;
}
...@@ -43,7 +43,7 @@ import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL; ...@@ -43,7 +43,7 @@ import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL;
* @dateTime 19-8-14 下午8:56 * @dateTime 19-8-14 下午8:56
*/ */
@Slf4j @Slf4j
@Component //@Component
public class ScheduleService implements InitializingBean { public class ScheduleService implements InitializingBean {
private static volatile int allProductCount; private static volatile int allProductCount;
private static volatile int rankPageSize; private static volatile int rankPageSize;
...@@ -54,7 +54,6 @@ public class ScheduleService implements InitializingBean { ...@@ -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_NAME_DETAIL = new HashMap<>();
static volatile HashMap<String, OnProductDetail> PRODUCT_ID_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<>(); private static final List<String> EXCEPT_BOT_ACCOUNT = new ArrayList<>();
static final String[] CATEGORY = {"古风", "儿童", "科幻", "占星", "恋爱", "灾难", "架空", "经营", "冒险", "武侠"}; static final String[] CATEGORY = {"古风", "儿童", "科幻", "占星", "恋爱", "灾难", "架空", "经营", "冒险", "武侠"};
...@@ -72,10 +71,6 @@ public class ScheduleService implements InitializingBean { ...@@ -72,10 +71,6 @@ public class ScheduleService implements InitializingBean {
private final XiaoDuOrderTbRepository xiaoDuOrderTbRepository; 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, String> channelId2RecommendBotAcc = new HashMap<>();
public static volatile Map<String, List<String>> channel2Bots = new HashMap<>(); public static volatile Map<String, List<String>> channel2Bots = new HashMap<>();
...@@ -134,28 +129,6 @@ public class ScheduleService implements InitializingBean { ...@@ -134,28 +129,6 @@ public class ScheduleService implements InitializingBean {
//log.error("更新推荐页出错:{}", e.getMessage()); //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 * * ?") // @Scheduled(cron = "0 0 19 * * ?")
public void initRankingList() { public void initRankingList() {
new Thread(() -> { new Thread(() -> {
...@@ -310,26 +283,6 @@ public class ScheduleService implements InitializingBean { ...@@ -310,26 +283,6 @@ public class ScheduleService implements InitializingBean {
log.info("getChannelAllBots:"+jiaoyouChannel2Bots); 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 @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
initAllOnTableProductInfo(); initAllOnTableProductInfo();
...@@ -339,7 +292,6 @@ public class ScheduleService implements InitializingBean { ...@@ -339,7 +292,6 @@ public class ScheduleService implements InitializingBean {
deleteOverTimeHistory(); deleteOverTimeHistory();
deleteUnPayedOrder(); deleteUnPayedOrder();
// tian(); // tian();
getAsideImg();
getAllChannelRecommendBotAccount(); getAllChannelRecommendBotAccount();
getChannelAllBots(); getChannelAllBots();
getJiaoYouChannelRecordBots(); getJiaoYouChannelRecordBots();
...@@ -397,18 +349,6 @@ public class ScheduleService implements InitializingBean { ...@@ -397,18 +349,6 @@ public class ScheduleService implements InitializingBean {
return CATEGORY_PRODUCT_ID_LIST; 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() { public static int getRankPageSize() {
return rankPageSize; return rankPageSize;
} }
......
package ai.qiwu.com.xiaoduhome.service; 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.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.pojo.UserBehaviorData;
import ai.qiwu.com.xiaoduhome.pojo.data.ProjectData; 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.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; 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 苗权威 * @author 苗权威
* @dateTime 20-1-15 下午8:24 * @dateTime 20-1-15 下午8:24
...@@ -24,10 +31,16 @@ public class ScheduleServiceNew implements InitializingBean { ...@@ -24,10 +31,16 @@ public class ScheduleServiceNew implements InitializingBean {
private static volatile Map<String, ProjectData> botAccount2Project = new HashMap<>(); private static volatile Map<String, ProjectData> botAccount2Project = new HashMap<>();
private static volatile Map<String, ProjectData> name2Project = 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, 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 @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
getAllProjects(); getAllProjects();
// buildLunchNewDocument
} }
private void getAllProjects() { private void getAllProjects() {
...@@ -35,30 +48,63 @@ public class ScheduleServiceNew implements InitializingBean { ...@@ -35,30 +48,63 @@ public class ScheduleServiceNew implements InitializingBean {
try { try {
String response = OkHttp3Utils.doGet(DplbotServiceUtil.HOST_UTL+"/audio_box/project"); String response = OkHttp3Utils.doGet(DplbotServiceUtil.HOST_UTL+"/audio_box/project");
if (StringUtils.isNotBlank(response)) { if (StringUtils.isNotBlank(response)) {
JSONObject object = JSON.parseObject(response); ProjectDataResult result = JSON.parseObject(response, ProjectDataResult.class);
List<ProjectData> list = object.getObject("bots", List.class); if (new Integer(1).equals(result.getCode())) {
Map<String, Map<String, Long>> map = object.getObject("channelAcc", Map.class); List<ProjectData> list = result.getData().getBots();
if (!CollectionUtils.isEmpty(list)) { Map<String, Map<String, Long>> map = result.getData().getChannelAcc();
final Map<String, ProjectData> botAcc = new HashMap<>(); if (!CollectionUtils.isEmpty(list)) {
final Map<String, ProjectData> name = new HashMap<>(); final Map<String, ProjectData> botAcc = new HashMap<>();
list.forEach(projectData -> { final Map<String, ProjectData> name = new HashMap<>();
botAcc.put(projectData.getBotAccount(), projectData); list.forEach(projectData -> {
name.put(projectData.getName(), projectData); botAcc.put(projectData.getBotAccount(), projectData);
}); name.put(projectData.getName(), projectData);
botAccount2Project = botAcc; });
name2Project = name; botAccount2Project = botAcc;
allProjects = list; name2Project = name;
} allProjects = list;
if (!CollectionUtils.isEmpty(map)) { }
channel2BotAccountList = map; if (!CollectionUtils.isEmpty(map)) {
channel2BotAccountList = map;
}
if (!CollectionUtils.isEmpty(result.getData().getHeadImg())) {
ASIDE_IMG = result.getData().getHeadImg();
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.warn("ScheduleServiceNew#getAllProjects获取所有作品信息失败:"+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(); }).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) { static ProjectData getProjectByName(String name) {
return name2Project.get(name); return name2Project.get(name);
} }
...@@ -80,4 +126,16 @@ public class ScheduleServiceNew implements InitializingBean { ...@@ -80,4 +126,16 @@ public class ScheduleServiceNew implements InitializingBean {
} }
return datas; 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;
}
} }
...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Constants; ...@@ -4,6 +4,7 @@ import ai.qiwu.com.xiaoduhome.common.Constants;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils; import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.service.DplbotServiceUtil; import ai.qiwu.com.xiaoduhome.service.DplbotServiceUtil;
import ai.qiwu.com.xiaoduhome.service.ScheduleService; 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.RequestTerminal;
import ai.qiwu.com.xiaoduhome.xiaoai.common.RequestWordNullException; import ai.qiwu.com.xiaoduhome.xiaoai.common.RequestWordNullException;
import ai.qiwu.com.xiaoduhome.xiaoai.common.Utils; import ai.qiwu.com.xiaoduhome.xiaoai.common.Utils;
...@@ -166,7 +167,7 @@ public class XiaoAiTestService { ...@@ -166,7 +167,7 @@ public class XiaoAiTestService {
prefix = "box"+i; prefix = "box"+i;
job = (JSONObject)ob; job = (JSONObject)ob;
actor = job.getString("npcName"); actor = job.getString("npcName");
actorUrl = ScheduleService.getAsideImgUrl(job.getString("botAccount"), actor); actorUrl = ScheduleServiceNew.getAsideImgUrl(job.getString("botAccount"), actor);
text = job.getString("text"); text = job.getString("text");
if (StringUtils.isNotBlank(text)) { if (StringUtils.isNotBlank(text)) {
text = text.replaceAll("\\{/.*?/}|\uD83C\uDD70|\uD83C\uDD71", ""); text = text.replaceAll("\\{/.*?/}|\uD83C\uDD70|\uD83C\uDD71", "");
......
...@@ -41,6 +41,8 @@ spring: ...@@ -41,6 +41,8 @@ spring:
host: localhost host: localhost
port: 6379 port: 6379
timeout: 1000 timeout: 1000
pid:
file: /home/dc2-user/projects/audiobox/duai/app.pid
logging: logging:
path: /home/dc2-user/projects/audiobox/duai/logs path: /home/dc2-user/projects/audiobox/duai/logs
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"componentId": "loadingPage", "componentId": "loadingPage",
"top": "0dp", "top": "0dp",
"left": "0dp", "left": "0dp",
"src": "https://didi-gz5.jiaoyou365.com/duai/image/Loading.png", "src": "https://didi-gz5.jiaoyou365.com/duai/image/LoadNew.jpg",
"height": "100%", "height": "100%",
"width": "100%", "width": "100%",
"scale-type": "fitXY", "scale-type": "fitXY",
......
unitPrice=1 unitPrice=1
requestHost=http://didi-gz4.jiaoyou365.com:18082/ requestHost=http://didi-gz5.jiaoyou365.com:18082/
\ No newline at end of file pidPath=/home/dc2-user/projects/audiobox/duai/app.pid
\ No newline at end of file
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