diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f869ea4..ae62fff 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,15 +3,35 @@
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -54,56 +74,33 @@
-
+
-
-
+
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
@@ -111,50 +108,41 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
@@ -173,20 +161,6 @@
- AUDIO_DIR
- log.info
- log.error
- scale-type
- first
- firstItem
- letter-spacing
- line-height
- version
- ite
- border-radius
- margin
- padding
- bottom
code
flex-direction
data.
@@ -203,6 +177,20 @@
position
direction
POOL.submit
+ AppFavoriteTBRepository
+ xiaoDuOrderTbRepository
+ SimpleDateFormat
+ Date
+ XiaoDuOrderTbRepository
+ check
+ XiaoDuOrderTB
+ AppFlowerTBRepository
+ XiaoDuHistoryTBRepository
+ PLAY_DOCUMENT
+ PRODUCT_NAME_DETAIL
+ imgPro
+ productName
+ recomList
OPENID_CACHE
@@ -218,57 +206,57 @@
@@ -301,8 +289,8 @@
-
-
+
+
@@ -314,8 +302,6 @@
-
-
@@ -401,7 +387,7 @@
-
+
@@ -527,6 +513,8 @@
+
+
@@ -540,7 +528,7 @@
-
+
@@ -1080,7 +1068,9 @@
-
+
+
+
@@ -1090,7 +1080,7 @@
-
+
@@ -1102,7 +1092,7 @@
-
+
@@ -1113,16 +1103,16 @@
-
+
-
+
-
+
@@ -1133,7 +1123,7 @@
-
+
@@ -1142,6 +1132,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1151,396 +1179,389 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java
index ede667b..6ba4273 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/XiaoduhomeApplication.java
@@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
//@EntityScan(basePackages = {"ai.qiwu.com.xiaoduhome.entity"})
//@EnableJpaRepositories(basePackages = {"ai.qiwu.com.xiaoduhome.repository"})
@EnableScheduling
-@EnableJpaAuditing
public class XiaoduhomeApplication {
public static void main(String[] args) {
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
index d59888c..1e9a678 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
@@ -44,6 +44,7 @@ public interface Constants {
String BACK_TRACE = "trace";
String PRE_CATEGORY = "categ";
+ String PRE_FUNNY_IMG = "funny";
String CLICK_PATTERN = "[{type: SendEvent,componentId:%s}]";
@@ -90,7 +91,7 @@ public interface Constants {
}
interface WelcomeWord {
- String WELCOME = "欢迎来到互动天地,这里有海量的作品在这等您";
+ String WELCOME = "欢迎来到交游天下,这里有海量的作品在这等您";
String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦";
String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名";
String FAIL_COLLECT = "好像出了什么问题,请再说一遍吧";
@@ -109,8 +110,8 @@ public interface Constants {
String INVALID_RESPONSE = "技能返回了无效的响应,可能技能响应数据量超过24KB,或是技能在request的dialogState为COMPLETED时仍然发送Dialog.Delegate指令等";
String DEVICE_COMMUNICATION_ERROR = "DuerOS与端通信异常";
- String COLLECT_FAIL = "你可以在作品介绍页收藏该作品";
- String UN_COLLECT_FAIL = "你可以在该作品的介绍页进行取消操作";
+ String COLLECT_FAIL = "您可以点击屏幕上的按钮收藏该作品";
+ String UN_COLLECT_FAIL = "您可以点击屏幕上的按钮进行取消操作";
String INTERFACE_ERROR = "终端接口请求出错";
String HTTP_CONNECTION_CLOSE_FAILED = "与终端的链接关闭错误";
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java
index 72c2630..1d2be02 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Utils.java
@@ -6,7 +6,11 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -112,8 +116,13 @@ public class Utils {
return botNames;
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws ParseException {
String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
//System.out.println(String.format(s, "gsagh"));
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String time = format.format(System.currentTimeMillis());
+ Timestamp timestamp = Timestamp.valueOf(time);
+ System.out.println(timestamp);
+ System.out.println(format.format(new Date(System.currentTimeMillis())));
}
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
index 9c446ad..ac45436 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
@@ -5,6 +5,7 @@ import ai.qiwu.com.xiaoduhome.common.Constants;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyDocument;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPageItemData;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPojo;
+import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyUtil;
import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdateDocument;
import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdatePojo;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankBotInfo;
@@ -37,6 +38,8 @@ import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
+import static ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils.getPlayDocument;
+
/**
* @author 苗权威
* @dateTime 19-8-24 下午2:03
@@ -67,17 +70,22 @@ public class TempleUtils {
}
public static FunnyDocument getFunnyDocument(List bots) {
- FunnyDocument document = JSON.parseObject(getDPLTemple("static/json/funny.json"), FunnyDocument.class);
+ FunnyDocument document = FunnyUtil.getFunnyDocument();
List datas = new ArrayList<>();
- FunnyPojo page = document.getMainTemplate().getItems().get(1).getItems().get(0);
+ FunnyPojo page = FunnyUtil.getPagerCom(document);
List dataList = new ArrayList<>();
page.setItems(dataList);
for (OnProductDetail bot : bots) {
FunnyPageItemData data = new FunnyPageItemData();
data.setImgSrc(new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString());
- data.setText(bot.getIntro());
+ String intro = bot.getIntro();
+ if (StringUtils.isBlank(intro)) intro = "作者太懒,啥都没写";
+ data.setText(intro);
+ data.setHead(correctName(bot.getName()));
+ data.setImgId(new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString());
+ data.setAnimId(String.valueOf(bot.getId()));
datas.add(data);
- dataList.add(getFunnyPageItemPojo());
+ dataList.add(FunnyUtil.getPagerItem());
}
page.setData(datas);
return document;
@@ -106,6 +114,10 @@ public class TempleUtils {
return RANKING_DOCUMENT;
}
+// public static RankingDocument getNextRank() {
+//
+// }
+
public static RecommandDocument getRecommend() {
RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand.json"), RecommandDocument.class);
List datas = new ArrayList<>();
@@ -121,6 +133,7 @@ public class TempleUtils {
botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
document.setRecommendIdList(idToken);
+ document.setCount(String.valueOf(botIds.length()));
}
document.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas);
return document;
@@ -130,6 +143,7 @@ public class TempleUtils {
CollectHistoryDocument historyDocument = JSON.parseObject(getDPLTemple("static/json/history.json"), CollectHistoryDocument.class);
XiaoDuHistoryBotTimeRepository historyTBRepository = BaseHolder.getBean("xiaoDuHistoryBotTimeRepository");
List historyProInfo = historyTBRepository.getByXiaoduUserId(userId);
+ if (historyProInfo == null || historyProInfo.size() == 0) return null;
ArrayList projectInfoList = new ArrayList<>();
int i = 1;
final StringBuilder build = new StringBuilder();
@@ -164,6 +178,7 @@ public class TempleUtils {
CollectHistoryDocument collectHistoryDocument = JSON.parseObject(getDPLTemple("static/json/collectPage.json"), CollectHistoryDocument.class);
AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository");
List favoriteProducts = favorite.getFavoriteBotIds(userId);
+ if (favoriteProducts == null || favoriteProducts.size() == 0) return null;
ArrayList projectInfoList = new ArrayList<>();
int i = 1;
log.info("id list:{}", favoriteProducts);
@@ -254,6 +269,7 @@ public class TempleUtils {
pojo.setFlexDirection("row");
pojo.setWidth("100%");
pojo.setHeight("100%");
+ pojo.setMarginTop("40dp");
FunnyPojo image = new FunnyPojo();
image.setSrc("${data.imgSrc}");
@@ -262,11 +278,14 @@ public class TempleUtils {
image.setHeight("400dp");
image.setWidth("400dp");
image.setMarginLeft("25dp");
+ image.setScaleType("fitXY");
+ image.setBorderRadius("18dp");
FunnyPojo textContainer = new FunnyPojo();
textContainer.setType("Container");
textContainer.setWidth("500dp");
textContainer.setHeight("100%");
+ textContainer.setMarginLeft("20dp");
FunnyPojo text = new FunnyPojo();
text.setType("Text");
@@ -288,31 +307,27 @@ public class TempleUtils {
return pojo;
}
- public static void main(String[] args) throws IOException, CloneNotSupportedException {
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-// System.out.println(sdf.format(new java.sql.Date(1566887509312L)));
-
+ public static void main(String[] args) {
new Thread(() -> {
- int i = 3000;
long start = System.currentTimeMillis();
+ int i = 5000;
while (i-- > 0) {
- try {
- FunnyPojo pageItem = JSON.parseObject(getJsonFromName("static/json/funnyPageItem.json"),FunnyPojo.class);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ getPlayDocument("gsgdg", "sgege", "dsgrgh");
}
- long end = System.currentTimeMillis();
- System.out.println("JSON:"+(end-start));
+ System.out.println("pojo:"+(System.currentTimeMillis()-start));
}).start();
+
new Thread(() -> {
- int i = 3000;
long start = System.currentTimeMillis();
+ int i = 5000;
while (i-- > 0) {
- getFunnyPageItemPojo();
+ MyDocument document = JSON.parseObject(getDPLTemple("static/json/play.json"), MyDocument.class);
+ document.getMainTemplate().getItems().get(1).setHeaderTitle("gsgdg");
+ List- container = document.getMainTemplate().getItems().get(2).getItems();
+ container.get(1).setSrc("sgege");
+ container.get(0).getItems().get(0).setText("dsgrgh");
}
- long end = System.currentTimeMillis();
- System.out.println("TEST:"+(end-start));
+ System.out.println("fastJson:"+(System.currentTimeMillis()-start));
}).start();
}
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPageItemData.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPageItemData.java
index 26afa59..d07609b 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPageItemData.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPageItemData.java
@@ -10,4 +10,7 @@ import lombok.Data;
public class FunnyPageItemData {
private String imgSrc;
private String text;
+ private String head;
+ private String imgId;
+ private String animId;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
index f849428..60527c6 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
@@ -36,6 +36,10 @@ public class FunnyPojo {
private String fontSize;
@JsonProperty("line-height")
private String lineHeight;
+ @JsonProperty("scale-type")
+ private String scaleType;
+ @JsonProperty("border-radius")
+ private String borderRadius;
private List data;
private String text;
private String bottom;
@@ -45,4 +49,14 @@ public class FunnyPojo {
private String looping;
private String autoplay;
private List onLoaded;
+ private List onClick;
+ @JsonProperty("border-width")
+ private String borderWidth;
+ @JsonProperty("padding-vertical")
+ private String paddingVertical;
+ @JsonProperty("padding-horizontal")
+ private String paddingHorizontal;
+ @JsonProperty("border-color")
+ private String borderColor;
+ private String color;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java
new file mode 100644
index 0000000..dfebd8d
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java
@@ -0,0 +1,183 @@
+package ai.qiwu.com.xiaoduhome.common.temple.funny;
+
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.PRE_FUNNY_IMG;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 下午2:31
+ */
+public class FunnyUtil {
+
+ private static final FunnyPojo PAGER_ITEM = getPageItem();
+
+ public static FunnyDocument getFunnyDocument() {
+ FunnyDocument document = new FunnyDocument();
+ FunnyMainTemplate mainTemplate = new FunnyMainTemplate();
+ document.setMainTemplate(mainTemplate);
+ getMainItem(mainTemplate.getItems());
+ return document;
+ }
+
+ private static void getMainItem(List items) {
+ // background image
+ FunnyPojo background = new FunnyPojo();
+ background.setType("Image");
+ background.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
+ background.setHeight("100%");
+ background.setWidth("100%");
+ background.setPosition("absolute");
+ background.setLeft("0dp");
+ background.setTop("0dp");
+
+ //pager container
+ FunnyPojo pageContainer = new FunnyPojo();
+ pageContainer.setType("Container");
+ pageContainer.setWidth("100%");
+ pageContainer.setHeight("100%");
+
+ FunnyPojo pager = new FunnyPojo();
+ pager.setType("Pager");
+ pager.setDirection("horizontal");
+ pager.setComponentId("funnyPage");
+ pager.setWidth("100%");
+ pager.setHeight("100%");
+ Event onLoadEvent = new Event("AutoPage", "funnyPage");
+ onLoadEvent.setDurationInMillisecond(3000);
+ Event setPage = new Event("SetPage", "funnyPage");
+ setPage.setPosition("relative");
+ setPage.setValue("-1");
+ pager.setOnLoaded(Arrays.asList(onLoadEvent, setPage));
+
+ pageContainer.setItems(Collections.singletonList(pager));
+
+ // audio
+ FunnyPojo audio = new FunnyPojo();
+ audio.setType("Audio");
+ audio.setComponentId("audioCom");
+ audio.setLooping("false");
+ audio.setAutoplay("true");
+
+ // footer container
+ FunnyPojo footerContainer = new FunnyPojo();
+ footerContainer.setType("Container");
+ footerContainer.setPosition("absolute");
+ footerContainer.setWidth("100%");
+ footerContainer.setLeft("0");
+ footerContainer.setBottom("0");
+ FunnyPojo footer = new FunnyPojo();
+ footer.setType("Footer");
+ footer.setHints(Arrays.asList("返回","上一页","下一页"));
+ footerContainer.setItems(Collections.singletonList(footer));
+
+ items.add(background);
+ items.add(pageContainer);
+ items.add(audio);
+ items.add(footerContainer);
+ }
+
+ private static FunnyPojo getPageItem() {
+ // container
+ FunnyPojo pojo = new FunnyPojo();
+ pojo.setType("Container");
+ pojo.setWidth("100%");
+ pojo.setHeight("100%");
+ pojo.setMarginTop("40dp");
+
+ // image,text container
+ FunnyPojo imgTxtContainer = new FunnyPojo();
+ imgTxtContainer.setType("Container");
+ imgTxtContainer.setFlexDirection("row");
+
+ // image
+ FunnyPojo image = new FunnyPojo();
+ image.setType("Image");
+ image.setComponentId("${data.animId}");
+ image.setSrc("${data.imgSrc}");
+ image.setMarginTop("30dp");
+ image.setHeight("300dp");
+ image.setWidth("300dp");
+ image.setMarginLeft("25dp");
+ image.setScaleType("fitXY");
+ image.setBorderRadius("20dp");
+ Event imageEvent1 = new Event("SendEvent", "${data.imgId}");
+ Event animEvent1 = new Event("Animation", "${data.animId}");
+ animEvent1.setFrom("1");
+ animEvent1.setTo("0.6");
+ animEvent1.setEasing("ease-out");
+ animEvent1.setAttribute("scaleX");
+ animEvent1.setDuration(1500L);
+ animEvent1.setRepeatCount("1");
+ Event animEvent2 = new Event("Animation", "${data.animId}");
+ animEvent2.setFrom("1");
+ animEvent2.setTo("0.6");
+ animEvent2.setEasing("ease-out");
+ animEvent2.setAttribute("scaleY");
+ animEvent2.setDuration(1500L);
+ animEvent2.setRepeatCount("1");
+ image.setOnClick(Arrays.asList(imageEvent1, animEvent1, animEvent2));
+
+ // head,content container
+ FunnyPojo textContainer = new FunnyPojo();
+ textContainer.setType("Container");
+ textContainer.setWidth("500dp");
+ textContainer.setHeight("100%");
+ textContainer.setMarginLeft("20dp");
+
+ FunnyPojo head = new FunnyPojo();
+ head.setType("Text");
+ head.setText("${data.head}");
+ head.setFontSize("35dp");
+ head.setLineHeight("60dp");
+ head.setMarginTop("20dp");
+ head.setMarginLeft("10dp");
+
+ FunnyPojo text = new FunnyPojo();
+ text.setType("Text");
+ text.setText("${data.text}");
+ text.setFontSize("25dp");
+ text.setLineHeight("60dp");
+ text.setMarginTop("10dp");
+ text.setMarginLeft("10dp");
+
+ textContainer.setItems(Arrays.asList(head, text));
+
+ imgTxtContainer.setItems(Arrays.asList(image, textContainer));
+
+ // frame
+ FunnyPojo frame = new FunnyPojo();
+ frame.setType("Frame");
+ frame.setWidth("300dp");
+ frame.setHeight("50dp");
+ frame.setMarginTop("15dp");
+ frame.setMarginLeft("25dp");
+ frame.setBorderWidth("1dp");
+ frame.setBorderRadius("20dp");
+ frame.setPaddingVertical("6dp");
+ frame.setPaddingHorizontal("60dp");
+ frame.setBorderColor("rgb(255,255,255,0.4)");
+ FunnyPojo frameText = new FunnyPojo();
+ frameText.setType("Text");
+ frameText.setFontSize("20dp");
+ frameText.setText("点击图片查看详情");
+ frameText.setColor("rgb(255,255,255)");
+ frame.setItems(Collections.singletonList(frameText));
+
+ pojo.setItems(Arrays.asList(imgTxtContainer, frame));
+ return pojo;
+ }
+
+ public static FunnyPojo getPagerItem() {
+ return PAGER_ITEM;
+ }
+
+ public static FunnyPojo getPagerCom(FunnyDocument document) {
+ return document.getMainTemplate().getItems().get(1).getItems().get(0);
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayDocument.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayDocument.java
new file mode 100644
index 0000000..9a07c3a
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayDocument.java
@@ -0,0 +1,19 @@
+package ai.qiwu.com.xiaoduhome.common.temple.play;
+
+import com.baidu.dueros.data.response.directive.dpl.Document;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 上午10:18
+ */
+@Getter
+@Setter
+@ToString
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PlayDocument extends Document {
+ private PlayMainTemplate mainTemplate;
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayMainTemplate.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayMainTemplate.java
new file mode 100644
index 0000000..443df03
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayMainTemplate.java
@@ -0,0 +1,23 @@
+package ai.qiwu.com.xiaoduhome.common.temple.play;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 上午10:17
+ */
+@Data
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PlayMainTemplate {
+ private List parameters = new ArrayList<>();
+ private List items;
+
+ public PlayMainTemplate() {
+ this.parameters.add("payload");
+ this.items = new ArrayList<>();
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayPojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayPojo.java
new file mode 100644
index 0000000..8331e1d
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayPojo.java
@@ -0,0 +1,41 @@
+package ai.qiwu.com.xiaoduhome.common.temple.play;
+
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 上午10:10
+ */
+@Data
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class PlayPojo {
+ private String type;
+ private String position;
+ private String left;
+ private String top;
+ private String src;
+ private String height;
+ private String width;
+ private String headerTitle;
+ private Boolean hasBackIcon;
+ private String componentId;
+ private List items;
+ private String bottom;
+ private String padding;
+ @JsonProperty("font-size")
+ private String fontSize;
+ @JsonProperty("font-style")
+ private String fontStyle;
+ private String looping;
+ private String autoplay;
+ private List onEnd;
+ private List hints;
+ private String text;
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
new file mode 100644
index 0000000..36c98ab
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
@@ -0,0 +1,144 @@
+package ai.qiwu.com.xiaoduhome.common.temple.play;
+
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 上午10:21
+ */
+public class PlayUtils {
+
+ public static PlayDocument getPlayDocument(String headerName, String audio, String text) {
+ PlayDocument document = new PlayDocument();
+ PlayMainTemplate mainTemplate = new PlayMainTemplate();
+ document.setMainTemplate(mainTemplate);
+ getPlayPojo(mainTemplate.getItems(),headerName, audio, text);
+ return document;
+ }
+
+ private static void getPlayPojo(List items, String headerName, String audioSrc, String textContent) {
+ // ---------image----------
+ PlayPojo image = new PlayPojo();
+ image.setType("Image");
+ image.setPosition("absolute");
+ image.setTop("0dp");
+ image.setLeft("0dp");
+ image.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
+ image.setHeight("100%");
+ image.setWidth("100%");
+
+ items.add(image);
+
+ // --------header-------------
+ PlayPojo header = new PlayPojo();
+ header.setType("Header");
+ if (headerName == null) header.setHeaderTitle("");
+ else header.setHeaderTitle(headerName);
+ header.setHasBackIcon(false);
+
+ items.add(header);
+
+ // --------whole-------------
+ PlayPojo whole = new PlayPojo();
+ whole.setType("Container");
+ whole.setHeight("100%");
+ whole.setWidth("100%");
+ whole.setComponentId("whole");
+
+ PlayPojo textContainer = new PlayPojo();
+ textContainer.setType("Container");
+ textContainer.setPadding("35dp");
+ textContainer.setPosition("absolute");
+ textContainer.setBottom("120dp");
+ PlayPojo text = new PlayPojo();
+ text.setType("Text");
+ text.setComponentId("text");
+ text.setFontSize("28dp");
+ text.setFontStyle("normal");
+ text.setText(textContent);
+ List textConItems = new ArrayList<>();
+ textConItems.add(text);
+ textContainer.setItems(textConItems);
+
+ PlayPojo audio = new PlayPojo();
+ audio.setType("Audio");
+ audio.setComponentId("audioCom");
+ audio.setLooping("false");
+ audio.setAutoplay("true");
+ audio.setSrc(audioSrc);
+ Event onEnd = new Event("SendEvent","audio");
+ List audioOnEndEventList = new ArrayList<>();
+ audioOnEndEventList.add(onEnd);
+ audio.setOnEnd(audioOnEndEventList);
+
+ List wholeItems = new ArrayList<>();
+ wholeItems.add(textContainer);
+ wholeItems.add(audio);
+ whole.setItems(wholeItems);
+
+ items.add(whole);
+
+ //--------footer--------
+ PlayPojo footerContainer = new PlayPojo();
+ footerContainer.setType("Container");
+ footerContainer.setPosition("absolute");
+ footerContainer.setWidth("100%");
+ footerContainer.setLeft("0");
+ footerContainer.setBottom("0");
+
+ PlayPojo footer = new PlayPojo();
+ footer.setType("Footer");
+ footer.setHints(Arrays.asList("我要送花","收藏","回到首页","返回"));
+
+ List footerContainerItems = new ArrayList<>();
+ footerContainerItems.add(footer);
+ footerContainer.setItems(footerContainerItems);
+
+ items.add(footer);
+ }
+
+ public static PlayPojo getWholePojo(String audioSrc, String textContent) {
+ PlayPojo whole = new PlayPojo();
+ whole.setType("Container");
+ whole.setHeight("100%");
+ whole.setWidth("100%");
+ whole.setComponentId("whole");
+
+ PlayPojo textContainer = new PlayPojo();
+ textContainer.setType("Container");
+ textContainer.setPadding("35dp");
+ textContainer.setPosition("absolute");
+ textContainer.setBottom("120dp");
+ PlayPojo text = new PlayPojo();
+ text.setType("Text");
+ text.setComponentId("text");
+ text.setFontSize("28dp");
+ text.setFontStyle("normal");
+ text.setText(textContent);
+ List textConItems = new ArrayList<>();
+ textConItems.add(text);
+ textContainer.setItems(textConItems);
+
+ PlayPojo audio = new PlayPojo();
+ audio.setType("Audio");
+ audio.setComponentId("audioCom");
+ audio.setLooping("false");
+ audio.setAutoplay("true");
+ audio.setSrc(audioSrc);
+ Event onEnd = new Event("SendEvent","audio");
+ List audioOnEndEventList = new ArrayList<>();
+ audioOnEndEventList.add(onEnd);
+ audio.setOnEnd(audioOnEndEventList);
+
+ List wholeItems = new ArrayList<>();
+ wholeItems.add(textContainer);
+ wholeItems.add(audio);
+ whole.setItems(wholeItems);
+
+ return whole;
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
index f5229c4..dbd4f07 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
@@ -21,4 +21,7 @@ public class RankingDocument extends Document {
@JsonIgnore
private String rankBotIds;
+
+ @JsonIgnore
+ private String count;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandDocument.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandDocument.java
index 13cb872..d5531a9 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandDocument.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandDocument.java
@@ -20,4 +20,7 @@ public class RecommandDocument extends Document {
@JsonIgnore
private String recommendIdList;
+
+ @JsonIgnore
+ private String count;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
index 6f6f53d..1db5038 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
@@ -9,14 +9,13 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.util.Date;
+import java.sql.Date;
/**
* @author 苗权威
* @dateTime 19-8-21 下午4:00
*/
@Entity
-@EntityListeners(AuditingEntityListener.class)
@Table(name = "app_favorite_tb")
@Data
public class AppFavoriteTB {
@@ -33,11 +32,9 @@ public class AppFavoriteTB {
@Column
private Integer module;
- @CreatedDate
- @Column(name = "gmt_create",nullable = false,updatable = false)
- private Date createTime;
+ @Column(name = "gmt_create")
+ private java.sql.Date createTime;
@Column(name = "gmt_modified")
- @LastModifiedDate
private Date updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
index fbec539..0d02cbd 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
@@ -9,7 +9,8 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.util.Date;
+import java.sql.Date;
+import java.sql.Timestamp;
/**
* @author 苗权威
@@ -17,7 +18,6 @@ import java.util.Date;
*/
@Entity
@Table(name = "app_flower_tb")
-@EntityListeners(AuditingEntityListener.class)
@Data
public class AppFlowerTB {
@Id
@@ -45,11 +45,9 @@ public class AppFlowerTB {
@Column
private Integer status;
- @CreatedDate
- @Column(name = "gmt_create",nullable = false,updatable = false)
- private Date createTime;
+ @Column(name = "gmt_create")
+ private Timestamp createTime;
@Column(name = "gmt_modified")
- @LastModifiedDate
- private Date updateTime;
+ private Timestamp updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
index 187fe78..87313d1 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
@@ -1,21 +1,26 @@
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.util.Date;
+import java.sql.Date;
+import java.sql.Timestamp;
/**
* @author 苗权威
* @dateTime 19-8-26 下午2:19
*/
+@Getter
+@Setter
+@ToString
@Entity
-@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_history_tb")
-@Data
public class XiaoDuHistoryTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -30,11 +35,9 @@ public class XiaoDuHistoryTB {
@Column(name = "last_time")
private Long lastTime;
- @CreatedDate
- @Column(name = "create_time",nullable = false,updatable = false)
- private Date createTime;
+ @Column(name = "create_time")
+ private Timestamp createTime;
@Column(name = "update_time")
- @LastModifiedDate
- private Date updateTime;
+ private Timestamp updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderIdTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderIdTB.java
index c8854d8..d165ecf 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderIdTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderIdTB.java
@@ -10,7 +10,6 @@ import javax.persistence.*;
* @dateTime 19-8-22 下午4:23
*/
@Entity
-@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb")
@Data
public class XiaoDuOrderIdTB {
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
index 258b7ce..cf372e7 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
@@ -1,11 +1,14 @@
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
+import org.hibernate.annotations.CreationTimestamp;
+import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
+import java.sql.Timestamp;
import java.util.Date;
/**
@@ -13,7 +16,6 @@ import java.util.Date;
* @dateTime 19-8-22 下午3:45
*/
@Entity
-@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb")
@Data
public class XiaoDuOrderTB {
@@ -39,8 +41,8 @@ public class XiaoDuOrderTB {
@Column(name = "order_id")
private String orderId;
- @Column
- private String timestamp;
+ @Column(name = "time_stamp")
+ private Long timeStamp;
@Column(name = "is_buy")
private Boolean isBuy;
@@ -54,11 +56,9 @@ public class XiaoDuOrderTB {
@Column(name = "status")
private Boolean status;
- @CreatedDate
- @Column(name = "create_time",nullable = false,updatable = false)
- private Date createTime;
+ @Column(name = "create_time")
+ private Timestamp createTime;
@Column(name = "update_time")
- @LastModifiedDate
- private Date updateTime;
+ private Timestamp updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Event.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Event.java
index 60cc984..1f9b121 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Event.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Event.java
@@ -17,6 +17,17 @@ public class Event {
private String type;
private String componentId;
private Integer durationInMillisecond;
+ private String distance;
+ private Integer index;
+ private String align;
+ private String from;
+ private String to;
+ private String easing;
+ private String attribute;
+ private Long duration;
+ private String repeatCount;
+ private String position;
+ private String value;
public Event() {
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFavoriteTBRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFavoriteTBRepository.java
index 195dd5a..47aa341 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFavoriteTBRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFavoriteTBRepository.java
@@ -3,6 +3,7 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFavoriteTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -16,9 +17,13 @@ import java.util.List;
@Repository
public interface AppFavoriteTBRepository extends JpaRepository {
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
@Query(value = "INSERT INTO app_favorite_tb (bot_username,module,user_id,gmt_create,gmt_modified) VALUES (?1, 0, ?2, now(), now())",nativeQuery = true)
void insertFavorite(String botId, Integer userId);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
@Query(value = "DELETE FROM app_favorite_tb WHERE bot_username=?1 AND user_id=?2",nativeQuery = true)
void deleteFavorite(String botId, Integer userId);
@@ -27,11 +32,11 @@ public interface AppFavoriteTBRepository extends JpaRepository boolean exists(Example
example);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
S save(S s);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
void deleteByBotIdAndUserId(String botId, Integer userId);
@Query(value="SELECT bot_username from app_favorite_tb where user_id=?1", nativeQuery = true)
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFlowerTBRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFlowerTBRepository.java
index fc95b43..db1ca70 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFlowerTBRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppFlowerTBRepository.java
@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
+import java.sql.Timestamp;
+
/**
* @author 苗权威
* @dateTime 19-8-19 下午8:36
@@ -14,11 +17,12 @@ import org.springframework.transaction.annotation.Transactional;
@Repository
public interface AppFlowerTBRepository extends JpaRepository {
- @Transactional
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
@Query(value = "INSERT INTO app_flower_tb (module,bot_username,user_id,unit_price,number,order_id,status,gmt_create,gmt_modified) VALUES (0,?1,?2,1,1,?3,1,?4,?4)",nativeQuery = true)
- void insertOrder(String botId, String userId, String orderId, String time);
+ void insertOrder(String botId, String userId, String orderId, Timestamp time);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
S save(S s);
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppUserTBRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppUserTBRepository.java
index cc694b9..8eddeb3 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppUserTBRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/AppUserTBRepository.java
@@ -2,8 +2,10 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppUserTB;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
/**
* @author 苗权威
@@ -13,6 +15,8 @@ import org.springframework.stereotype.Repository;
public interface AppUserTBRepository extends JpaRepository {
AppUserTB getByPhone(String phone);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
@Query(value = "INSERT INTO app_user_tb (user_phone,gmt_create) VALUES (?1, now())", nativeQuery = true)
void insertUser(String phone);
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
index 9263162..2bc71af 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
@@ -2,6 +2,7 @@ package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
@@ -18,15 +19,17 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository getAllUser();
- @Transactional
- @Query(value = "delete from xiaodu_history_tb where xiaodu_user_id=?1 and last_time < (select last_time from xiaodu_history_tb where xiaodu_user_id=?1 order by last_time limit 14,1)", nativeQuery = true)
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "delete from xiaodu_history_tb where xiaodu_user_id=?1 and last_time < (select last_time from (select last_time from xiaodu_history_tb where xiaodu_user_id=?1 order by last_time limit 14,1) t1)", nativeQuery = true)
void deleteOverTime(String userId);
- @Transactional
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
@Query(value = "delete from xiaodu_history_tb where last_time 1", nativeQuery = true)
void deletePasted(Long boundTime);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
S save(S s);
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTBIdRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTBIdRepository.java
index 94072ec..409cc85 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTBIdRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTBIdRepository.java
@@ -13,7 +13,7 @@ public interface XiaoDuOrderTBIdRepository extends JpaRepository S save(S s);
}
\ No newline at end of file
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTbRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTbRepository.java
index 77d242d..e9d8c35 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTbRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuOrderTbRepository.java
@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
+import java.util.Date;
+
/**
* @author 苗权威
* @dateTime 19-8-22 下午3:59
@@ -15,21 +18,25 @@ public interface XiaoDuOrderTbRepository extends JpaRepository boolean exists(Example example);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
S save(S s);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
S saveAndFlush(S s);
- @Transactional
- @Query(value = "UPDATE xiaodu_order_tb SET creation_timestamp=?2,order_id=?3,status=1,update_time=now() WHERE ch_order_id=?1",nativeQuery = true)
- void updateAterSeccessPayed(String chOrderId, String creationTimestamp, String orderId);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "UPDATE xiaodu_order_tb SET order_id=?1,status=1,update_time=now() WHERE ch_order_id=?2",nativeQuery = true)
+ void updateAterSeccessPayed(String orderId,String chOrderId);
- @Transactional
+ @Transactional(rollbackFor = Exception.class)
@Override
void delete(XiaoDuOrderTB xiaoDuOrderTB);
- void deleteByStatus(Boolean status);
+ @Modifying
+ @Transactional(rollbackFor = Exception.class)
+ @Query(value = "DELETE FROM xiaodu_order_tb WHERE status=0 AND time_stamp1",nativeQuery = true)
+ void deleteOverTimeOrder(Long bound);
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
index c86171e..e1a2737 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
@@ -5,7 +5,8 @@ import ai.qiwu.com.xiaoduhome.common.temple.Agent;
import ai.qiwu.com.xiaoduhome.common.temple.CollectHistoryDocument;
import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyDocument;
-import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPojo;
+import ai.qiwu.com.xiaoduhome.common.temple.play.PlayDocument;
+import ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingDocument;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandDocument;
import ai.qiwu.com.xiaoduhome.entity.primary.*;
@@ -33,9 +34,8 @@ import com.baidu.dueros.data.response.OutputSpeech;
import com.baidu.dueros.data.response.card.Card;
import com.baidu.dueros.data.response.card.LinkAccountCard;
import com.baidu.dueros.data.response.directive.Directive;
-import com.baidu.dueros.data.response.directive.ElicitSlot;
-import com.baidu.dueros.data.response.directive.display.Hint;
import com.baidu.dueros.data.response.directive.display.PushStack;
+import com.baidu.dueros.data.response.directive.dpl.Document;
import com.baidu.dueros.data.response.directive.dpl.ExecuteCommands;
import com.baidu.dueros.data.response.directive.dpl.RenderDocument;
import com.baidu.dueros.data.response.directive.dpl.commands.*;
@@ -43,7 +43,6 @@ import com.baidu.dueros.data.response.directive.dpl.event.UserEvent;
import com.baidu.dueros.data.response.directive.pay.Buy;
import com.baidu.dueros.data.response.directive.pay.Charge;
import com.baidu.dueros.model.Response;
-import com.baidu.dueros.nlu.ConfirmationStatus;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Example;
@@ -51,6 +50,8 @@ import org.springframework.data.domain.Example;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.nio.charset.StandardCharsets;
+import java.sql.Date;
+import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
@@ -73,9 +74,6 @@ import static ai.qiwu.com.xiaoduhome.service.ScheduleService.CATEGORY_PRODUCT_LI
*/
@Slf4j
public class DplBotService extends BaseBot {
-
- private static final MyDocument PLAY_DOCUMENT;
-
private static final MyDocument LOAD_DOCUMENT;
private static final MyDocument PROD_INFO;
@@ -95,9 +93,9 @@ public class DplBotService extends BaseBot {
private static final ConcurrentHashMap LAST_OUTTIME_RESULT = new ConcurrentHashMap<>();
- static {
- PLAY_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/play.json"), MyDocument.class);
+ private static volatile FunnyDocument FUNNY_DEFAULT_DOCUMENT;
+ static {
LOAD_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/onLunch2.json"), MyDocument.class);
List- thirdRow = LOAD_DOCUMENT.getMainTemplate().getItems().get(1).getItems().get(1).getItems();
List l1 = new ArrayList<>();
@@ -282,6 +280,35 @@ public class DplBotService extends BaseBot {
// this.setSessionAttribute("botAcc", botAccount);
// return new Response();
// }
+ if ("测试".equals(intentRequest.getQuery().getOriginal())) {
+ try {
+ Document document = Document.getDocumentFromString(getDPLTemple("static/json/textComponent.json"));
+ RenderDocument render = new RenderDocument(document);
+ this.addDirective(render);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new Response();
+ }else if ("旋转".equals(intentRequest.getQuery().getOriginal())) {
+ try {
+ Document document = Document.getDocumentFromString(getDPLTemple("static/json/textRota.json"));
+ RenderDocument render = new RenderDocument(document);
+ this.addDirective(render);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new Response();
+ }else if ("拉伸".equals(intentRequest.getQuery().getOriginal()) ||
+ "增加".equals(intentRequest.getQuery().getOriginal())) {
+ try {
+ Document document = Document.getDocumentFromString(getDPLTemple("static/json/testScale.json"));
+ RenderDocument render = new RenderDocument(document);
+ this.addDirective(render);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new Response();
+ }
String userId = getUserId();
OverTimeDetail detail;
if ((detail = LAST_OUTTIME_RESULT.remove(userId)) != null) {
@@ -301,7 +328,13 @@ public class DplBotService extends BaseBot {
return buildErrorResponse(SORRY_UNCATCH);
} catch (TimeoutException e) {
log.info("超时,让用户再说一遍:{}",e.toString());
- return buildErrorResponse(SORRY_UNCATCH);
+ if ("funny".equals(getIntent().getName()) && FUNNY_DEFAULT_DOCUMENT != null) {
+ RenderDocument document = new RenderDocument(FUNNY_DEFAULT_DOCUMENT);
+ this.addDirective(document);
+ return new Response();
+ }else {
+ return buildErrorResponse(SORRY_UNCATCH);
+ }
} catch (Exception all) {
log.error("任务执行发生了错误:{}", all.toString());
return buildErrorResponse(SORRY_UNCATCH);
@@ -327,12 +360,9 @@ public class DplBotService extends BaseBot {
}
String text = data.getText();
text = text.substring(text.indexOf("】")+1);
- PLAY_DOCUMENT.getMainTemplate().getItems().get(1).setHeaderTitle(productName);
- List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
- container.get(1).setSrc(data.getAudio());
- container.get(0).getItems().get(0).setText(text);
+ PlayDocument document = PlayUtils.getPlayDocument(productName, data.getAudio(), text);
- RenderDocument render = new RenderDocument(PLAY_DOCUMENT);
+ RenderDocument render = new RenderDocument(document);
this.setSessionAttribute(PRE_COLLE, null);
String trace = getSessionAttribute(BACK_TRACE);
if (trace == null || trace.length() != 2) trace = "00";
@@ -373,7 +403,9 @@ public class DplBotService extends BaseBot {
String productName = componentId.substring(5);
OnProductDetail productDetail = ScheduleService.PRODUCT_NAME_DETAIL.get(productName);
- if (productDetail == null) return buildErrorResponse("目前不支持该作品");
+ if (productDetail == null && !productName.equals("清新传")) {
+ return buildErrorResponse("目前不支持该作品");
+ }
String imgUrl = new StringBuilder(Constants.IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
List
- content = PROD_INFO.getMainTemplate().getItems().get(2).getItems().get(0).getItems().get(0).getItems();
@@ -467,6 +499,7 @@ public class DplBotService extends BaseBot {
trace = builder.append(productDetail.getBotAccount()).toString();
log.info("after trace------------:{}",trace);
this.setSessionAttribute(BACK_TRACE, trace);
+ this.setSessionAttribute("pageSign",null);
return new Response();
} else if (Constants.PRE_ENTER_PRODUCT.equals(componentPrefix)) {
String productName = componentId.substring(5);
@@ -483,12 +516,13 @@ public class DplBotService extends BaseBot {
}
String text = data.getText();
text = text.substring(text.indexOf("】")+1);
- PLAY_DOCUMENT.getMainTemplate().getItems().get(1).setHeaderTitle(productName);
- List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
- container.get(1).setSrc(data.getAudio());
- container.get(0).getItems().get(0).setText(text);
+ PlayDocument document = PlayUtils.getPlayDocument(productName, data.getAudio(), text);
+// PLAY_DOCUMENT.getMainTemplate().getItems().get(1).setHeaderTitle(productName);
+// List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
+// container.get(1).setSrc(data.getAudio());
+// container.get(0).getItems().get(0).setText(text);
- RenderDocument render = new RenderDocument(PLAY_DOCUMENT);
+ RenderDocument render = new RenderDocument(document);
this.setSessionAttribute(PRE_COLLE, null);
String trace = getSessionAttribute(BACK_TRACE);
if (trace == null || trace.length()<2) trace = "00";
@@ -596,7 +630,7 @@ public class DplBotService extends BaseBot {
public void run() {
try {
String baiduOrderReferenceId = buyEvent.getPayload().getBaiduOrderReferenceId();
- String timeStamp = buyEvent.getTimestamp();
+ long timeStamp = Long.parseLong(buyEvent.getTimestamp())*1000;
String botId = new String(Base64.getDecoder().decode(buyEvent.getToken()), StandardCharsets.UTF_8);
String userId = getSessionAttribute("userId");
Integer unitePrice = Integer.parseInt(Config.getProperty("unitPrice", Constants.UNIT_PRICE));
@@ -609,9 +643,12 @@ public class DplBotService extends BaseBot {
orderTB.setNumber(1);
orderTB.setIsBuy(true);
orderTB.setOrderId(baiduOrderReferenceId);
- orderTB.setTimestamp(timeStamp);
+ orderTB.setTimeStamp(timeStamp);
orderTB.setUnitPrice(unitePrice);
orderTB.setXiaoduUserId(getUserId());
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ orderTB.setCreateTime(timestamp);
+ orderTB.setUpdateTime(timestamp);
XiaoDuOrderTB response = repository.save(orderTB);
if (response == null) throw new Exception("向interface_db中的xiaodu_order_tb插入数据失败");
} catch (Exception e) {
@@ -647,7 +684,7 @@ public class DplBotService extends BaseBot {
flowerTB.setUserId(Integer.parseInt(userId));
flowerTB.setStatus(1);
flowerTB.setUnitPrice(unitePrice/100.0);
- flowerTB.setCreateTime(new Date(Integer.parseInt(timeStamp)*1000));
+ flowerTB.setCreateTime(new Timestamp(Long.parseLong(timeStamp)*1000));
flowerTB.setOrderId(0);
AppFlowerTB response = flowerRepository.save(flowerTB);
if (response == null) throw new Exception("向app_flower_tb中插入数据失败");
@@ -903,8 +940,8 @@ public class DplBotService extends BaseBot {
class CollectThread implements Runnable {
- String botId;
- String userId;
+ final String botId;
+ final String userId;
CollectThread(String botId, String userId) {
this.botId = botId;
@@ -918,9 +955,14 @@ public class DplBotService extends BaseBot {
entity.setBotId(botId);
entity.setUserId(user_id);
entity.setModule(0);
+ java.sql.Date cur = new java.sql.Date(System.currentTimeMillis());
+ entity.setCreateTime(cur);
+ entity.setUpdateTime(cur);
//Example example = Example.of(entity);
+ log.info("collect ddddddddddd,user_id:{},botId:{}",user_id,botId);
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
repository.save(entity);
+ log.info("collect 33333333333333");
// boolean exist = repository.exists(example);
// log.info("2333:{}",exist);
// if (!exist) {
@@ -931,8 +973,8 @@ public class DplBotService extends BaseBot {
}
class UnCollectThread implements Runnable {
- String botId;
- String userId;
+ final String botId;
+ final String userId;
UnCollectThread(String botId, String userId) {
this.botId = botId;
@@ -945,9 +987,10 @@ public class DplBotService extends BaseBot {
// entity.setBotId(botId);
// entity.setUserId(Integer.parseInt(userId));
+ log.info("unCollect ddddddddddd,user_id:{},botId:{}",userId,botId);
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
- log.info("取消收藏被调用");
repository.deleteByBotIdAndUserId(botId, Integer.parseInt(userId));
+ log.info("取消收藏被调用");
//repository.deleteFavorite(userId, userid);
}
}
@@ -1066,6 +1109,8 @@ public class DplBotService extends BaseBot {
return;
} else if ("back".equals(intentName)) {
String trace = getSessionAttribute(BACK_TRACE);
+ dplBotService.setSessionAttribute("pageSign",null);
+ detail.getAttributes().put("pageSign",null);
char second;
if (trace == null || trace.length() <= 2 || getQuery().contains("首")) {
// home page
@@ -1106,6 +1151,10 @@ public class DplBotService extends BaseBot {
break;
}
CollectHistoryDocument document = TempleUtils.getCollectPage(Integer.parseInt(appUserId));
+ if (document == null) {
+ detail.setResponse(buildErrorResponse("您还未收藏过任何作品,快去收藏吧"));
+ break;
+ }
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
dplBotService.setSessionAttribute(BACK_TRACE, "01");
@@ -1118,6 +1167,10 @@ public class DplBotService extends BaseBot {
case '2': {
//history
CollectHistoryDocument document = TempleUtils.getHistory(getUserId());
+ if (document == null) {
+ detail.setResponse(buildErrorResponse("哎呀,可能是您太久没玩了,历史记录已被清空"));
+ break;
+ }
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
dplBotService.setSessionAttribute(PRE_COLLE,document.getIdToken());
@@ -1225,7 +1278,119 @@ public class DplBotService extends BaseBot {
}
LAST_OUTTIME_RESULT.put(userId, detail);
return;
- } else if ("history".equals(intentName)) {
+ }
+ else if ("lastPage".equals(intentName)) {
+ String signPage = getSessionAttribute("pageSign");
+ if (signPage == null) {
+ detail.setResponse(buildErrorResponse("哎呀,小悟累啦,滑不动了"));
+ LAST_OUTTIME_RESULT.put(userId,detail);
+ return;
+ }
+ String pageIndex = getSessionAttribute("pageIndex");
+ int sign = Integer.parseInt(signPage);
+ int index = 0;
+ switch (sign) {
+ case 6: {
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ SetPageCommand setPage = new SetPageCommand();
+ setPage.setComponentId("funnyPage");
+ setPage.setPosition(SetPageCommand.Position.RELATIVE);
+ setPage.setValue(-1);
+ executeCommands.addCommand(setPage);
+ dplBotService.addDirective(executeCommands);
+ detail.getDirectives().add(executeCommands);
+ break;
+ }
+ case 3: {
+
+ }
+ case 4: {
+ index = 0;
+ if (pageIndex != null) index = Integer.parseInt(pageIndex);
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ ScrollToIndexCommand scroll = new ScrollToIndexCommand();
+ scroll.setComponentId("scrollToIndex");
+ index -= 4;
+ if (index < 0) index = 0;
+ scroll.setIndex(index+4);
+ scroll.setAlign(ScrollToIndexCommand.AlignType.FIRST);
+ executeCommands.addCommand(scroll);
+ dplBotService.addDirective(executeCommands);
+ detail.getDirectives().add(executeCommands);
+ dplBotService.setSessionAttribute("pageIndex", String.valueOf(index));
+ detail.getAttributes().put("pageIndex", String.valueOf(index));
+ break;
+ }
+ default:{
+ detail.setResponse(buildErrorResponse("该功能还没实现"));
+ }
+ }
+ LAST_OUTTIME_RESULT.put(userId,detail);
+ return;
+ }
+ else if ("nextPage".equals(intentName)) {
+ String signPage = getSessionAttribute("pageSign");
+ if (signPage == null) {
+ detail.setResponse(buildErrorResponse("哎呀,小悟累啦,滑不动了"));
+ LAST_OUTTIME_RESULT.put(userId,detail);
+ return;
+ }
+ String pageIndex = getSessionAttribute("pageIndex");
+ int sign = Integer.parseInt(signPage);
+ int index = 0;
+ switch (sign) {
+ case 6: {
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ SetPageCommand setPage = new SetPageCommand();
+ setPage.setComponentId("funnyPage");
+ setPage.setPosition(SetPageCommand.Position.RELATIVE);
+ setPage.setValue(1);
+ executeCommands.addCommand(setPage);
+ dplBotService.addDirective(executeCommands);
+ detail.getDirectives().add(executeCommands);
+ break;
+ }
+ case 3: {
+ index = 4;
+ if (pageIndex != null) index = Integer.parseInt(pageIndex);
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ ScrollToIndexCommand scroll = new ScrollToIndexCommand();
+ scroll.setComponentId("scrollToIndex");
+ if (index >= 9) index = 6;
+ scroll.setIndex(index);
+ scroll.setAlign(ScrollToIndexCommand.AlignType.LAST);
+ executeCommands.addCommand(scroll);
+ dplBotService.addDirective(executeCommands);
+ detail.getDirectives().add(executeCommands);
+ dplBotService.setSessionAttribute("pageIndex", String.valueOf(index));
+ detail.getAttributes().put("pageIndex", String.valueOf(index));
+ break;
+ }
+ case 4: {
+ index = 3;
+ if (pageIndex != null) index = Integer.parseInt(pageIndex);
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ ScrollToIndexCommand scroll = new ScrollToIndexCommand();
+ scroll.setComponentId("scrollToIndex");
+ index += 4;
+ if (index >= 15) index = 14;
+ scroll.setIndex(index);
+ scroll.setAlign(ScrollToIndexCommand.AlignType.LAST);
+ executeCommands.addCommand(scroll);
+ dplBotService.addDirective(executeCommands);
+ detail.getDirectives().add(executeCommands);
+ dplBotService.setSessionAttribute("pageIndex", String.valueOf(index));
+ detail.getAttributes().put("pageIndex", String.valueOf(index));
+ break;
+ }
+ default:{
+ detail.setResponse(buildErrorResponse("该功能还没实现"));
+ }
+ }
+ LAST_OUTTIME_RESULT.put(userId,detail);
+ return;
+ }
+ else if ("history".equals(intentName)) {
CollectHistoryDocument document = TempleUtils.getHistory(getUserId());
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
@@ -1258,11 +1423,15 @@ public class DplBotService extends BaseBot {
dplBotService.setSessionAttribute("recommand", token);
dplBotService.setSessionAttribute(PRE_COLLE, null);
dplBotService.setSessionAttribute("ranking", null);
+ dplBotService.setSessionAttribute("count", recommandDocument.getCount());
detail.getAttributes().put("ranking", null);
detail.getAttributes().put("recommand", token);
detail.getAttributes().put(PRE_COLLE, null);
+ detail.getAttributes().put("count", recommandDocument.getCount());
}
+ dplBotService.setSessionAttribute("pageSign", "3");
+ detail.getAttributes().put("pageSign", "3");
dplBotService.setSessionAttribute(BACK_TRACE, "03");
detail.getAttributes().put(BACK_TRACE,"03");
LAST_OUTTIME_RESULT.put(userId, detail);
@@ -1286,6 +1455,8 @@ public class DplBotService extends BaseBot {
detail.getAttributes().put("recommand", null);
detail.getAttributes().put(PRE_COLLE, null);
}
+ dplBotService.setSessionAttribute("pageSign", "4");
+ detail.getAttributes().put("pageSign", "4");
dplBotService.setSessionAttribute(BACK_TRACE, "04");
detail.getAttributes().put(BACK_TRACE, "04");
LAST_OUTTIME_RESULT.put(userId, detail);
@@ -1306,7 +1477,7 @@ public class DplBotService extends BaseBot {
botAccount = dplBotService.getSessionAttribute("botAcc");
if(botAccount == null) {
String word = COLLECT_FAIL;
- if (collect) word = UN_COLLECT_FAIL;
+ if (!collect) word = UN_COLLECT_FAIL;
detail.setResponse(buildErrorResponse(word));
LAST_OUTTIME_RESULT.put(userId, detail);
return;
@@ -1332,8 +1503,7 @@ public class DplBotService extends BaseBot {
if (alreadyCollected) {
if (collect) detail.setResponse(buildErrorResponse("您之前就已经收藏过该作品啦,看来你真的很喜欢它"));
else {
- //final String lamBotAccount = botAccount;
- POOL.submit(new UnCollectThread(botAccount, userId));
+ POOL.submit(new UnCollectThread(botAccount, appUserId));
String botName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
if (inProductInfo) {
ExecuteCommands commands = changeIconIdTextAfterCollect(false, botAccount);
@@ -1344,7 +1514,7 @@ public class DplBotService extends BaseBot {
}
}else {
if (collect) {
- POOL.submit(new CollectThread(botAccount, userId));
+ POOL.submit(new CollectThread(botAccount, appUserId));
String word = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
if (inProductInfo) {
ExecuteCommands commands = changeIconIdTextAfterCollect(true, botAccount);
@@ -1417,24 +1587,31 @@ public class DplBotService extends BaseBot {
botId = trace.substring(2);
}
XiaoDuOrderTbRepository repository = BaseHolder.getBean("xiaoDuOrderTbRepository");
- repository.saveAndFlush(buildBeforePayPojo(botId, appUserId, userId, unitPrice, Integer.parseInt(num), orderId));
-
- XiaoDuOrderTB check = new XiaoDuOrderTB();
- check.setOrderId(orderId);
- Example example = Example.of(check);
- if (repository.exists(example)) {
- Charge charge = new Charge(amount, orderId, "flower", botId);
+ XiaoDuOrderTB response = repository.save(buildBeforePayPojo(botId, appUserId, userId, unitPrice, Integer.parseInt(num), orderId));
+
+ //XiaoDuOrderTB check = new XiaoDuOrderTB();
+ //check.setOrderId(orderId);
+ //Example example = Example.of(check);
+ if (response != null && response.getId() != null) {
+ String desc = new StringBuilder("感谢您赏赐给该作品的").append(num).append("朵鲜花").toString();
+ String name = ScheduleService.PRODUCT_ID_DETAIL.get(botId).getName();
+ if (name != null) desc = new StringBuilder("感谢您赏赐给").append(name)
+ .append("的").append(num).append("朵鲜花").toString();
+ Charge charge = new Charge(amount, orderId, "鲜花", desc);
charge.setToken(new StringBuilder(botId).append(File.separator).append(num).toString());
dplBotService.addDirective(charge);
detail.getDirectives().add(charge);
detail.setResponse(buildErrorResponse("请扫描二维码完成支付"));
} else {
+ log.error("订单没有插入到xioadu_order_tb");
detail.setResponse(buildErrorResponse(ERROR_SEND_FLOWER));
}
}else {
+ log.error("无法获取到botID");
detail.setResponse(buildErrorResponse(ERROR_SEND_FLOWER));
}
} else {
+ log.error("无法从配置文件中获取到鲜花的单价");
detail.setResponse(buildErrorResponse(ERROR_SEND_FLOWER));
}
LAST_OUTTIME_RESULT.put(userId, detail);
@@ -1473,10 +1650,13 @@ public class DplBotService extends BaseBot {
FunnyDocument document = displayFunnyRecommandPage(text);
if (document != null) {
document.getMainTemplate().getItems().get(2).setSrc(data.getAudio());
+ FUNNY_DEFAULT_DOCUMENT = document;
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
- detail.getDirectives().add(render);
+ //detail.getDirectives().add(render);
LAST_OUTTIME_RESULT.put(userId, detail);
+ dplBotService.setSessionAttribute("pageSign", "6");
+ detail.getAttributes().put("pageSign", "6");
return;
}
log.info("funny出现问题");
@@ -1498,10 +1678,12 @@ public class DplBotService extends BaseBot {
//LAST_OUTTIME_RESULT.put(userId, new Response(outputSpeech));
}
else if (!botAccount.equals(beforeBotAccount)) {
- List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
- container.get(1).setSrc(data.getAudio());
- container.get(0).getItems().get(0).setText(text);
- RenderDocument render = new RenderDocument(PLAY_DOCUMENT);
+// List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
+// container.get(1).setSrc(data.getAudio());
+// container.get(0).getItems().get(0).setText(text);
+ String productName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
+ PlayDocument document = PlayUtils.getPlayDocument(correctName(productName), data.getAudio(), text);
+ RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
detail.getDirectives().add(render);
POOL.submit(() -> {
@@ -1512,6 +1694,9 @@ public class DplBotService extends BaseBot {
historyTB.setLastTime(System.currentTimeMillis());
historyTB.setBotId(botAccount);
historyTB.setXiaoduUserId(userId);
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ historyTB.setCreateTime(timestamp);
+ historyTB.setUpdateTime(timestamp);
log.info("插入历史数据:{}", botAccount);
} else {
historyTB.setLastTime(System.currentTimeMillis());
@@ -1548,12 +1733,12 @@ public class DplBotService extends BaseBot {
// executeCommands.addCommand(update);
// dplBotService.addDirective(executeCommands);
// detail.getDirectives().add(executeCommands);
- List
- container = PLAY_DOCUMENT.getMainTemplate().getItems().get(2).getItems();
- container.get(1).setSrc(data.getAudio());
- container.get(0).getItems().get(0).setText(text);
- RenderDocument document = new RenderDocument(PLAY_DOCUMENT);
- dplBotService.addDirective(document);
- detail.getDirectives().add(document);
+
+ String productName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
+ PlayDocument document = PlayUtils.getPlayDocument(correctName(productName), data.getAudio(), text);
+ RenderDocument render = new RenderDocument(document);
+ dplBotService.addDirective(render);
+ detail.getDirectives().add(render);
LAST_OUTTIME_RESULT.put(userId, detail);
//LAST_OUTTIME_RESULT.put(userId, new Response());
}
@@ -1566,6 +1751,7 @@ public class DplBotService extends BaseBot {
log.info("botNames:{}",botNames);
List bots = new ArrayList<>();
for (String botName : botNames) {
+ if (botName.equals("清新传")) botName = "清新传{/zhuan4/}";
OnProductDetail detail = ScheduleService.PRODUCT_NAME_DETAIL.get(botName);
if (detail == null) continue;
bots.add(detail);
@@ -1587,7 +1773,12 @@ public class DplBotService extends BaseBot {
xiaoDuOrderTB.setNumber(number);
xiaoDuOrderTB.setIsBuy(false);
xiaoDuOrderTB.setStatus(false);
- xiaoDuOrderTB.setOrderId(orderId);
+ xiaoDuOrderTB.setChOrderId(orderId);
+ long timeStamp = System.currentTimeMillis();
+ xiaoDuOrderTB.setTimeStamp(timeStamp);
+ Timestamp stamp = new Timestamp(timeStamp);
+ xiaoDuOrderTB.setCreateTime(stamp);
+ xiaoDuOrderTB.setUpdateTime(stamp);
return xiaoDuOrderTB;
}
@@ -1608,10 +1799,12 @@ public class DplBotService extends BaseBot {
POOL.submit(() -> {
XiaoDuOrderTbRepository repository = BaseHolder.getBean("xiaoDuOrderTbRepository");
try {
- repository.updateAterSeccessPayed(chOrderId, createTimestamp, baiduOrderReferenceId);
+ repository.updateAterSeccessPayed(baiduOrderReferenceId,chOrderId);
} catch (Exception e) {
- log.error("更新用户{}的支付状态出错,订单信息:订单号:{}.baiduOrderId:{},createTime:{}"
- ,userId, chOrderId, baiduOrderReferenceId, createTimestamp);
+// StringWriter writer = new StringWriter();
+// e.printStackTrace(new PrintWriter(writer,true));
+ log.error("更新用户{}的支付状态出错:{},订单信息:订单号:{}.baiduOrderId:{},createTime:{}",
+ e.toString(),userId, chOrderId, baiduOrderReferenceId, createTimestamp);
}
});
POOL.submit(() -> {
@@ -1631,6 +1824,9 @@ public class DplBotService extends BaseBot {
flowerTB.setStatus(1);
flowerTB.setUnitPrice(Double.parseDouble(Config.getProperty("unitPrice", Constants.UNIT_PRICE))/100);
flowerTB.setUserId(Integer.parseInt(appUserId));
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ flowerTB.setCreateTime(timestamp);
+ flowerTB.setUpdateTime(timestamp);
flower.save(flowerTB);
} catch (Exception e) {
log.error("像app_flower_tb中添加数据失败,{},数据信息:botAccount:{},num:{},xiaoduUserId:{}",
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
index 196b7bf..815f8c3 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+import java.sql.Date;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -49,7 +50,10 @@ public class ScheduleService implements InitializingBean {
@Autowired
public ScheduleService(GameProjectTbRepository gameProjectTbRepository,
- ProjectLabelRepository projectLabelRepository, AllOnProductInfoRepository allOnProductInfoRepository, XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository, XiaoDuOrderTbRepository xiaoDuOrderTbRepository) {
+ ProjectLabelRepository projectLabelRepository,
+ AllOnProductInfoRepository allOnProductInfoRepository,
+ XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository,
+ XiaoDuOrderTbRepository xiaoDuOrderTbRepository) {
this.gameProjectTbRepository = gameProjectTbRepository;
this.projectLabelRepository = projectLabelRepository;
this.allOnProductInfoRepository = allOnProductInfoRepository;
@@ -108,7 +112,8 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 2 * * ?")
public void deleteOverTimeHistory() {
new Thread(() -> {
- xiaoDuHistoryTBRepository.deletePasted((long) (System.currentTimeMillis()-2592E5));
+ xiaoDuHistoryTBRepository.deletePasted(System.currentTimeMillis()-259200000);//3 days
+ //xiaoDuHistoryTBRepository.deletePasted(System.currentTimeMillis()-300000);
List userIds = xiaoDuHistoryTBRepository.getAllUser();
for (String userId: userIds) {
xiaoDuHistoryTBRepository.deleteOverTime(userId);
@@ -120,7 +125,8 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 3 * * ?")
public void deleteUnPayedOrder() {
new Thread(() -> {
- xiaoDuOrderTbRepository.deleteByStatus(false);
+ long boundTime = System.currentTimeMillis()-600000;
+ xiaoDuOrderTbRepository.deleteOverTimeOrder(boundTime);
}).start();
}
@@ -130,6 +136,8 @@ public class ScheduleService implements InitializingBean {
initRecommendList();
initRankingList();
initProductList();
+ deleteOverTimeHistory();
+ deleteUnPayedOrder();
tian();
keng();
}
diff --git a/xiaoduhome/src/main/resources/static/json/frame.json b/xiaoduhome/src/main/resources/static/json/frame.json
index 30b30f0..0683269 100644
--- a/xiaoduhome/src/main/resources/static/json/frame.json
+++ b/xiaoduhome/src/main/resources/static/json/frame.json
@@ -16,14 +16,14 @@
"border-top-left-radius": "25dp",
"border-top-right-radius": "15dp",
"border-bottom-right-radius": "15dp",
- "padding-vertical": "5dp",
+ "padding-vertical": "8dp",
"padding-horizontal": "15dp",
"border-color": "rgb(255,255,255)",
"items": [
{
"type": "Text",
"font-size": "15dp",
- "color": "rgb(255,255,255,0.4)"
+ "color": "rgb(255,255,255)"
}
]
}
diff --git a/xiaoduhome/src/main/resources/static/json/funnyPageItem.json b/xiaoduhome/src/main/resources/static/json/funnyPageItem.json
index f2cd73b..3bd81be 100644
--- a/xiaoduhome/src/main/resources/static/json/funnyPageItem.json
+++ b/xiaoduhome/src/main/resources/static/json/funnyPageItem.json
@@ -1,29 +1,92 @@
{
"type": "Container",
- "flex-direction": "row",
+ "margin-top": "40dp",
"width": "100%",
"height": "100%",
"items": [
{
- "type": "Image",
- "margin-top": "30dp",
- "height": "400dp",
- "width": "400dp",
- "margin-left": "25dp",
- "src": "${data.imgSrc}"
+ "type": "Container",
+ "flex-direction": "row",
+ "items": [
+ {
+ "type": "Image",
+ "margin-top": "30dp",
+ "height": "300dp",
+ "width": "300dp",
+ "scale-type": "fitXY",
+ "border-radius": "18dp",
+ "margin-left": "25dp",
+ "src": "${data.imgSrc}",
+ "componentId": "funnyImage",
+ "onClick": [
+ {
+ "type": "SendEvent"
+ },
+ {
+ "type": "Animation",
+ "componentId": "funnyImage",
+ "from": 1,
+ "to": 0.6,
+ "easing": "ease-out",
+ "attribute": "scaleX",
+ "duration": 1500,
+ "repeatCount": "1"
+ },
+ {
+ "type": "Animation",
+ "componentId": "funnyImage",
+ "from": 1,
+ "to": 0.6,
+ "easing": "ease-out",
+ "attribute": "scaleY",
+ "duration": 1500,
+ "repeatCount": "1"
+ }
+ ]
+ },
+ {
+ "type": "Container",
+ "margin-left": "20dp",
+ "width": "500dp",
+ "height": "100%",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.head}",
+ "font-size": "35dp",
+ "line-height":"60dp",
+ "margin-top": "30dp",
+ "margin-left": "10dp"
+ },
+ {
+ "type": "Text",
+ "text": "${data.text}",
+ "font-size": "25dp",
+ "line-height":"60dp",
+ "margin-top": "30dp",
+ "margin-left": "10dp"
+ }
+ ]
+ }
+ ]
},
{
- "type": "Container",
- "width": "500dp",
- "height": "100%",
+ "type": "Frame",
+ "width": "300dp",
+ "height": "50dp",
+ "margin-top": "15dp",
+ "margin-left": "25dp",
+ "border-width": "1dp",
+ "border-radius": "20dp",
+ "padding-vertical": "6dp",
+ "padding-horizontal": "60dp",
+ "border-color": "rgb(255,255,255)",
"items": [
{
"type": "Text",
- "text": "${data.text}",
- "font-size": "25dp",
- "line-height":"60dp",
- "margin-top": "30dp",
- "margin-left": "10dp"
+ "font-size": "20dp",
+ "text": "点击图片查看详情",
+ "color": "rgb(255,255,255)"
}
]
}
diff --git a/xiaoduhome/src/main/resources/static/json/onLunch2.json b/xiaoduhome/src/main/resources/static/json/onLunch2.json
index 720f42a..52e9b4f 100644
--- a/xiaoduhome/src/main/resources/static/json/onLunch2.json
+++ b/xiaoduhome/src/main/resources/static/json/onLunch2.json
@@ -32,6 +32,21 @@
"direction": "vertical",
"height": "100%",
"width": "100%",
+ "componentId": "scrollCom",
+ "onLoaded": [
+ {
+ "type": "ScrollToIndex",
+ "componentId": "rankScroll",
+ "index": 7,
+ "align": "center"
+ },
+ {
+ "type": "ScrollToIndex",
+ "componentId": "recomScroll",
+ "index": 6,
+ "align": "center"
+ }
+ ],
"items": [
{
"type": "Container",
@@ -43,6 +58,7 @@
"height": "250dp",
"width": "100%",
"direction": "horizontal",
+ "componentId": "rankScroll",
"items": [
{
"type": "Container",
@@ -86,6 +102,7 @@
"type": "List",
"height": "100%",
"width": "100%",
+ "componentId": "recomScroll",
"direction": "horizontal",
"items": [
{
diff --git a/xiaoduhome/src/main/resources/static/json/play.json b/xiaoduhome/src/main/resources/static/json/play.json
index b413291..27559cf 100644
--- a/xiaoduhome/src/main/resources/static/json/play.json
+++ b/xiaoduhome/src/main/resources/static/json/play.json
@@ -18,8 +18,7 @@
{
"type": "Header",
"headerTitle": "交游天下",
- "headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
- "hasBackIcon": true
+ "hasBackIcon": false
},
{
"type": "Container",
@@ -65,7 +64,7 @@
{
"type": "Footer",
"hints": [
- "送花","收藏作品","回到首页"
+ "我要送花","收藏","回到首页","返回"
]
}
]
diff --git a/xiaoduhome/src/main/resources/static/json/productInfo.json b/xiaoduhome/src/main/resources/static/json/productInfo.json
index 1bdaa4d..9304207 100644
--- a/xiaoduhome/src/main/resources/static/json/productInfo.json
+++ b/xiaoduhome/src/main/resources/static/json/productInfo.json
@@ -45,7 +45,21 @@
"border-radius": "30dp",
"scale-type": "fitCenter",
"margin-left": "50dp",
- "margin-top": "12dp"
+ "margin-top": "12dp",
+ "componentId": "imgPro",
+ "onClick": [
+ {
+ "type": "Animation",
+ "componentId": "imgPro",
+ "from": 0,
+ "to": 360,
+ "easing": "ease-out",
+ "attribute": "rotation",
+ "duration": 2000,
+ "repeatCount": 1,
+ "repeatMode": "reverse"
+ }
+ ]
},
{
"type": "Container",
diff --git a/xiaoduhome/src/main/resources/static/json/ranking.json b/xiaoduhome/src/main/resources/static/json/ranking.json
index e8a7ce7..67e7c6e 100644
--- a/xiaoduhome/src/main/resources/static/json/ranking.json
+++ b/xiaoduhome/src/main/resources/static/json/ranking.json
@@ -22,9 +22,8 @@
},
{
"type": "Header",
- "headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "排行榜",
- "hasBackIcon": true
+ "hasBackIcon": false
},
{
"type": "Container",
@@ -38,6 +37,7 @@
"height": "100%",
"width": "100%",
"direction": "horizontal",
+ "componentId": "scrollToIndex",
"items": [
{
"type": "Container",
diff --git a/xiaoduhome/src/main/resources/static/json/recommand.json b/xiaoduhome/src/main/resources/static/json/recommand.json
index e7e23b7..3e66859 100644
--- a/xiaoduhome/src/main/resources/static/json/recommand.json
+++ b/xiaoduhome/src/main/resources/static/json/recommand.json
@@ -22,9 +22,8 @@
},
{
"type": "Header",
- "headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "推荐页",
- "hasBackIcon": true
+ "hasBackIcon": false
},
{
"type": "Container",
@@ -38,6 +37,7 @@
"height": "100%",
"width": "100%",
"direction": "horizontal",
+ "componentId": "scrollToIndex",
"items": [
{
"type": "Container",
diff --git a/xiaoduhome/src/main/resources/static/json/testScale.json b/xiaoduhome/src/main/resources/static/json/testScale.json
new file mode 100644
index 0000000..d0ffba5
--- /dev/null
+++ b/xiaoduhome/src/main/resources/static/json/testScale.json
@@ -0,0 +1,117 @@
+{
+ "type": "DPL",
+ "version": "1.0",
+ "mainTemplate": {
+ "parameters": [
+ "payload"
+ ],
+ "items": [
+ {
+ "type": "Image",
+ "position": "absolute",
+ "top": "0dp",
+ "left": "0dp",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24_bg.jpg",
+ "height": "100%",
+ "width": "100%"
+ },
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "flex-direction": "row",
+ "items": [
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo_image_compid",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo_image_compid",
+ "from": 0.5,
+ "to": 2,
+ "easing": "ease-in",
+ "attribute": "scaleX",
+ "duration": 4000,
+ "repeatCount": "3",
+ "repeatMode": "reverse"
+ },
+
+ {
+ "type": "Animation",
+ "componentId": "demo_image_compid",
+ "from": 1,
+ "to": 1.5,
+ "easing": "ease-in",
+ "attribute": "scaleY",
+ "duration": 4000,
+ "repeatCount": "3",
+ "repeatMode": "reverse"
+ },
+ {
+ "type": "SetState",
+ "componentId": "demo_image_compid",
+ "state": "opacity",
+ "value": 0.4
+ }
+ ]
+ },
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo_image",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo_image",
+ "from": 1,
+ "to": 0.6,
+ "easing": "ease-out",
+ "attribute": "scaleX",
+ "duration": 3000,
+ "repeatCount": "1"
+ },
+ {
+ "type": "Animation",
+ "componentId": "demo_image",
+ "from": 1,
+ "to": 0.6,
+ "easing": "ease-out",
+ "attribute": "scaleY",
+ "duration": 3000,
+ "repeatCount": "1"
+ }
+ ]
+ },
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo",
+ "from": 0.7,
+ "to": 1.5,
+ "easing": "ease-out",
+ "attribute": "scaleY",
+ "duration": 3000,
+ "repeatCount": "4"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/xiaoduhome/src/main/resources/static/json/textComponent.json b/xiaoduhome/src/main/resources/static/json/textComponent.json
new file mode 100644
index 0000000..094855d
--- /dev/null
+++ b/xiaoduhome/src/main/resources/static/json/textComponent.json
@@ -0,0 +1,69 @@
+{
+ "type": "DPL",
+ "version": "1.0",
+ "mainTemplate": {
+ "parameters": [
+ "payload"
+ ],
+ "items": [
+ {
+ "type": "Image",
+ "position": "absolute",
+ "top": "0dp",
+ "left": "0dp",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24_bg.jpg",
+ "height": "100%",
+ "width": "100%"
+ },
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "flex-direction": "row",
+ "items": [
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo_image_compid",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo_image_compid",
+ "from": "400dp",
+ "to": "100dp",
+ "easing": "ease-in",
+ "attribute": "width",
+ "duration": 4000,
+ "repeatCount": "3",
+ "repeatMode": "reverse"
+ }
+ ]
+ },
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo_image",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo_image",
+ "from": "400dp",
+ "to": "100dp",
+ "easing": "ease-out",
+ "attribute": "height",
+ "duration": 3000,
+ "repeatCount": "4"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/xiaoduhome/src/main/resources/static/json/textRota.json b/xiaoduhome/src/main/resources/static/json/textRota.json
new file mode 100644
index 0000000..b792e88
--- /dev/null
+++ b/xiaoduhome/src/main/resources/static/json/textRota.json
@@ -0,0 +1,91 @@
+{
+ "type": "DPL",
+ "version": "1.0",
+ "mainTemplate": {
+ "parameters": [
+ "payload"
+ ],
+ "items": [
+ {
+ "type": "Image",
+ "position": "absolute",
+ "top": "0dp",
+ "left": "0dp",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24_bg.jpg",
+ "height": "100%",
+ "width": "100%"
+ },
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "flex-direction": "row",
+ "items": [
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"40dp",
+ "componentId": "demo",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo",
+ "from": 0,
+ "to": 180,
+ "easing": "ease",
+ "attribute": "rotation",
+ "duration": 3000,
+ "repeatCount": 4,
+ "repeatMode": "reverse"
+ }
+ ]
+ },
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"30dp",
+ "componentId": "demo1",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo1",
+ "from": 0,
+ "to": 360,
+ "easing": "ease-out",
+ "attribute": "rotation",
+ "duration": 2000,
+ "repeatCount": 4,
+ "repeatMode": "reverse"
+ }
+ ]
+ },
+ {
+ "type": "Image",
+ "src": "https://duerstatic.bj.bcebos.com/dbp-image%2FDPLMaterial%2Fimage2019-6-24_19-0-24.png",
+ "width": "200dp",
+ "height": "400dp",
+ "margin-left":"30dp",
+ "componentId": "demo2",
+ "onClick":[
+ {
+ "type": "Animation",
+ "componentId": "demo2",
+ "from": -40,
+ "to": 200,
+ "easing": "ease-out",
+ "attribute": "rotation",
+ "duration": 3000,
+ "repeatCount": 4,
+ "repeatMode": "restart"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file