Commit 0348618f by 苗权威

9.2

parent 41e7e3b7
...@@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
//@EntityScan(basePackages = {"ai.qiwu.com.xiaoduhome.entity"}) //@EntityScan(basePackages = {"ai.qiwu.com.xiaoduhome.entity"})
//@EnableJpaRepositories(basePackages = {"ai.qiwu.com.xiaoduhome.repository"}) //@EnableJpaRepositories(basePackages = {"ai.qiwu.com.xiaoduhome.repository"})
@EnableScheduling @EnableScheduling
@EnableJpaAuditing
public class XiaoduhomeApplication { public class XiaoduhomeApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -44,6 +44,7 @@ public interface Constants { ...@@ -44,6 +44,7 @@ public interface Constants {
String BACK_TRACE = "trace"; String BACK_TRACE = "trace";
String PRE_CATEGORY = "categ"; String PRE_CATEGORY = "categ";
String PRE_FUNNY_IMG = "funny";
String CLICK_PATTERN = "[{type: SendEvent,componentId:%s}]"; String CLICK_PATTERN = "[{type: SendEvent,componentId:%s}]";
...@@ -90,7 +91,7 @@ public interface Constants { ...@@ -90,7 +91,7 @@ public interface Constants {
} }
interface WelcomeWord { interface WelcomeWord {
String WELCOME = "欢迎来到互动天地,这里有海量的作品在这等您"; String WELCOME = "欢迎来到交游天下,这里有海量的作品在这等您";
String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦"; String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦";
String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名"; String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名";
String FAIL_COLLECT = "好像出了什么问题,请再说一遍吧"; String FAIL_COLLECT = "好像出了什么问题,请再说一遍吧";
...@@ -109,8 +110,8 @@ public interface Constants { ...@@ -109,8 +110,8 @@ public interface Constants {
String INVALID_RESPONSE = "技能返回了无效的响应,可能技能响应数据量超过24KB,或是技能在request的dialogState为COMPLETED时仍然发送Dialog.Delegate指令等"; String INVALID_RESPONSE = "技能返回了无效的响应,可能技能响应数据量超过24KB,或是技能在request的dialogState为COMPLETED时仍然发送Dialog.Delegate指令等";
String DEVICE_COMMUNICATION_ERROR = "DuerOS与端通信异常"; String DEVICE_COMMUNICATION_ERROR = "DuerOS与端通信异常";
String COLLECT_FAIL = "你可以在作品介绍页收藏该作品"; String COLLECT_FAIL = "您可以点击屏幕上的按钮收藏该作品";
String UN_COLLECT_FAIL = "你可以在该作品的介绍页进行取消操作"; String UN_COLLECT_FAIL = "您可以点击屏幕上的按钮进行取消操作";
String INTERFACE_ERROR = "终端接口请求出错"; String INTERFACE_ERROR = "终端接口请求出错";
String HTTP_CONNECTION_CLOSE_FAILED = "与终端的链接关闭错误"; String HTTP_CONNECTION_CLOSE_FAILED = "与终端的链接关闭错误";
......
...@@ -6,7 +6,11 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -6,7 +6,11 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -112,8 +116,13 @@ public class Utils { ...@@ -112,8 +116,13 @@ public class Utils {
return botNames; return botNames;
} }
public static void main(String[] args) { public static void main(String[] args) throws ParseException {
String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]"; String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
//System.out.println(String.format(s, "gsagh")); //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())));
} }
} }
...@@ -5,6 +5,7 @@ import ai.qiwu.com.xiaoduhome.common.Constants; ...@@ -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.FunnyDocument;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPageItemData; 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.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.PlayUpdateDocument;
import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdatePojo; import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdatePojo;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankBotInfo; import ai.qiwu.com.xiaoduhome.common.temple.rank.RankBotInfo;
...@@ -37,6 +38,8 @@ import java.util.ArrayList; ...@@ -37,6 +38,8 @@ import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.List; import java.util.List;
import static ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils.getPlayDocument;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-24 下午2:03 * @dateTime 19-8-24 下午2:03
...@@ -67,17 +70,22 @@ public class TempleUtils { ...@@ -67,17 +70,22 @@ public class TempleUtils {
} }
public static FunnyDocument getFunnyDocument(List<OnProductDetail> bots) { public static FunnyDocument getFunnyDocument(List<OnProductDetail> bots) {
FunnyDocument document = JSON.parseObject(getDPLTemple("static/json/funny.json"), FunnyDocument.class); FunnyDocument document = FunnyUtil.getFunnyDocument();
List<FunnyPageItemData> datas = new ArrayList<>(); List<FunnyPageItemData> datas = new ArrayList<>();
FunnyPojo page = document.getMainTemplate().getItems().get(1).getItems().get(0); FunnyPojo page = FunnyUtil.getPagerCom(document);
List<FunnyPojo> dataList = new ArrayList<>(); List<FunnyPojo> dataList = new ArrayList<>();
page.setItems(dataList); page.setItems(dataList);
for (OnProductDetail bot : bots) { for (OnProductDetail bot : bots) {
FunnyPageItemData data = new FunnyPageItemData(); FunnyPageItemData data = new FunnyPageItemData();
data.setImgSrc(new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString()); 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); datas.add(data);
dataList.add(getFunnyPageItemPojo()); dataList.add(FunnyUtil.getPagerItem());
} }
page.setData(datas); page.setData(datas);
return document; return document;
...@@ -106,6 +114,10 @@ public class TempleUtils { ...@@ -106,6 +114,10 @@ public class TempleUtils {
return RANKING_DOCUMENT; return RANKING_DOCUMENT;
} }
// public static RankingDocument getNextRank() {
//
// }
public static RecommandDocument getRecommend() { public static RecommandDocument getRecommend() {
RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand.json"), RecommandDocument.class); RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand.json"), RecommandDocument.class);
List<RecommandBotInfo> datas = new ArrayList<>(); List<RecommandBotInfo> datas = new ArrayList<>();
...@@ -121,6 +133,7 @@ public class TempleUtils { ...@@ -121,6 +133,7 @@ public class TempleUtils {
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());
document.setRecommendIdList(idToken); document.setRecommendIdList(idToken);
document.setCount(String.valueOf(botIds.length()));
} }
document.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas); document.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas);
return document; return document;
...@@ -130,6 +143,7 @@ public class TempleUtils { ...@@ -130,6 +143,7 @@ public class TempleUtils {
CollectHistoryDocument historyDocument = JSON.parseObject(getDPLTemple("static/json/history.json"), CollectHistoryDocument.class); CollectHistoryDocument historyDocument = JSON.parseObject(getDPLTemple("static/json/history.json"), CollectHistoryDocument.class);
XiaoDuHistoryBotTimeRepository historyTBRepository = BaseHolder.getBean("xiaoDuHistoryBotTimeRepository"); XiaoDuHistoryBotTimeRepository historyTBRepository = BaseHolder.getBean("xiaoDuHistoryBotTimeRepository");
List<XiaoDuHistoryBotIdTime> historyProInfo = historyTBRepository.getByXiaoduUserId(userId); List<XiaoDuHistoryBotIdTime> historyProInfo = historyTBRepository.getByXiaoduUserId(userId);
if (historyProInfo == null || historyProInfo.size() == 0) return null;
ArrayList<HistoryData> projectInfoList = new ArrayList<>(); ArrayList<HistoryData> projectInfoList = new ArrayList<>();
int i = 1; int i = 1;
final StringBuilder build = new StringBuilder(); final StringBuilder build = new StringBuilder();
...@@ -164,6 +178,7 @@ public class TempleUtils { ...@@ -164,6 +178,7 @@ public class TempleUtils {
CollectHistoryDocument collectHistoryDocument = JSON.parseObject(getDPLTemple("static/json/collectPage.json"), CollectHistoryDocument.class); CollectHistoryDocument collectHistoryDocument = JSON.parseObject(getDPLTemple("static/json/collectPage.json"), CollectHistoryDocument.class);
AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository"); AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository");
List<String> favoriteProducts = favorite.getFavoriteBotIds(userId); List<String> favoriteProducts = favorite.getFavoriteBotIds(userId);
if (favoriteProducts == null || favoriteProducts.size() == 0) return null;
ArrayList<HistoryData> projectInfoList = new ArrayList<>(); ArrayList<HistoryData> projectInfoList = new ArrayList<>();
int i = 1; int i = 1;
log.info("id list:{}", favoriteProducts); log.info("id list:{}", favoriteProducts);
...@@ -254,6 +269,7 @@ public class TempleUtils { ...@@ -254,6 +269,7 @@ public class TempleUtils {
pojo.setFlexDirection("row"); pojo.setFlexDirection("row");
pojo.setWidth("100%"); pojo.setWidth("100%");
pojo.setHeight("100%"); pojo.setHeight("100%");
pojo.setMarginTop("40dp");
FunnyPojo image = new FunnyPojo(); FunnyPojo image = new FunnyPojo();
image.setSrc("${data.imgSrc}"); image.setSrc("${data.imgSrc}");
...@@ -262,11 +278,14 @@ public class TempleUtils { ...@@ -262,11 +278,14 @@ public class TempleUtils {
image.setHeight("400dp"); image.setHeight("400dp");
image.setWidth("400dp"); image.setWidth("400dp");
image.setMarginLeft("25dp"); image.setMarginLeft("25dp");
image.setScaleType("fitXY");
image.setBorderRadius("18dp");
FunnyPojo textContainer = new FunnyPojo(); FunnyPojo textContainer = new FunnyPojo();
textContainer.setType("Container"); textContainer.setType("Container");
textContainer.setWidth("500dp"); textContainer.setWidth("500dp");
textContainer.setHeight("100%"); textContainer.setHeight("100%");
textContainer.setMarginLeft("20dp");
FunnyPojo text = new FunnyPojo(); FunnyPojo text = new FunnyPojo();
text.setType("Text"); text.setType("Text");
...@@ -288,31 +307,27 @@ public class TempleUtils { ...@@ -288,31 +307,27 @@ public class TempleUtils {
return pojo; return pojo;
} }
public static void main(String[] args) throws IOException, CloneNotSupportedException { public static void main(String[] args) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
// System.out.println(sdf.format(new java.sql.Date(1566887509312L)));
new Thread(() -> { new Thread(() -> {
int i = 3000;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
int i = 5000;
while (i-- > 0) { while (i-- > 0) {
try { getPlayDocument("gsgdg", "sgege", "dsgrgh");
FunnyPojo pageItem = JSON.parseObject(getJsonFromName("static/json/funnyPageItem.json"),FunnyPojo.class);
} catch (IOException e) {
e.printStackTrace();
}
} }
long end = System.currentTimeMillis(); System.out.println("pojo:"+(System.currentTimeMillis()-start));
System.out.println("JSON:"+(end-start));
}).start(); }).start();
new Thread(() -> { new Thread(() -> {
int i = 3000;
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
int i = 5000;
while (i-- > 0) { while (i-- > 0) {
getFunnyPageItemPojo(); MyDocument document = JSON.parseObject(getDPLTemple("static/json/play.json"), MyDocument.class);
document.getMainTemplate().getItems().get(1).setHeaderTitle("gsgdg");
List<Item> 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("fastJson:"+(System.currentTimeMillis()-start));
System.out.println("TEST:"+(end-start));
}).start(); }).start();
} }
} }
...@@ -10,4 +10,7 @@ import lombok.Data; ...@@ -10,4 +10,7 @@ import lombok.Data;
public class FunnyPageItemData { public class FunnyPageItemData {
private String imgSrc; private String imgSrc;
private String text; private String text;
private String head;
private String imgId;
private String animId;
} }
...@@ -36,6 +36,10 @@ public class FunnyPojo { ...@@ -36,6 +36,10 @@ public class FunnyPojo {
private String fontSize; private String fontSize;
@JsonProperty("line-height") @JsonProperty("line-height")
private String lineHeight; private String lineHeight;
@JsonProperty("scale-type")
private String scaleType;
@JsonProperty("border-radius")
private String borderRadius;
private List<FunnyPageItemData> data; private List<FunnyPageItemData> data;
private String text; private String text;
private String bottom; private String bottom;
...@@ -45,4 +49,14 @@ public class FunnyPojo { ...@@ -45,4 +49,14 @@ public class FunnyPojo {
private String looping; private String looping;
private String autoplay; private String autoplay;
private List<Event> onLoaded; private List<Event> onLoaded;
private List<Event> 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;
} }
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<FunnyPojo> 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);
}
}
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;
}
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<String> parameters = new ArrayList<>();
private List<PlayPojo> items;
public PlayMainTemplate() {
this.parameters.add("payload");
this.items = new ArrayList<>();
}
}
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<PlayPojo> 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<Event> onEnd;
private List<String> hints;
private String text;
}
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<PlayPojo> 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<PlayPojo> 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<Event> audioOnEndEventList = new ArrayList<>();
audioOnEndEventList.add(onEnd);
audio.setOnEnd(audioOnEndEventList);
List<PlayPojo> 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<PlayPojo> 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<PlayPojo> 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<Event> audioOnEndEventList = new ArrayList<>();
audioOnEndEventList.add(onEnd);
audio.setOnEnd(audioOnEndEventList);
List<PlayPojo> wholeItems = new ArrayList<>();
wholeItems.add(textContainer);
wholeItems.add(audio);
whole.setItems(wholeItems);
return whole;
}
}
...@@ -21,4 +21,7 @@ public class RankingDocument extends Document { ...@@ -21,4 +21,7 @@ public class RankingDocument extends Document {
@JsonIgnore @JsonIgnore
private String rankBotIds; private String rankBotIds;
@JsonIgnore
private String count;
} }
...@@ -20,4 +20,7 @@ public class RecommandDocument extends Document { ...@@ -20,4 +20,7 @@ public class RecommandDocument extends Document {
@JsonIgnore @JsonIgnore
private String recommendIdList; private String recommendIdList;
@JsonIgnore
private String count;
} }
...@@ -9,14 +9,13 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -9,14 +9,13 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.sql.Date;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-21 下午4:00 * @dateTime 19-8-21 下午4:00
*/ */
@Entity @Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "app_favorite_tb") @Table(name = "app_favorite_tb")
@Data @Data
public class AppFavoriteTB { public class AppFavoriteTB {
...@@ -33,11 +32,9 @@ public class AppFavoriteTB { ...@@ -33,11 +32,9 @@ public class AppFavoriteTB {
@Column @Column
private Integer module; private Integer module;
@CreatedDate @Column(name = "gmt_create")
@Column(name = "gmt_create",nullable = false,updatable = false) private java.sql.Date createTime;
private Date createTime;
@Column(name = "gmt_modified") @Column(name = "gmt_modified")
@LastModifiedDate
private Date updateTime; private Date updateTime;
} }
...@@ -9,7 +9,8 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -9,7 +9,8 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.sql.Date;
import java.sql.Timestamp;
/** /**
* @author 苗权威 * @author 苗权威
...@@ -17,7 +18,6 @@ import java.util.Date; ...@@ -17,7 +18,6 @@ import java.util.Date;
*/ */
@Entity @Entity
@Table(name = "app_flower_tb") @Table(name = "app_flower_tb")
@EntityListeners(AuditingEntityListener.class)
@Data @Data
public class AppFlowerTB { public class AppFlowerTB {
@Id @Id
...@@ -45,11 +45,9 @@ public class AppFlowerTB { ...@@ -45,11 +45,9 @@ public class AppFlowerTB {
@Column @Column
private Integer status; private Integer status;
@CreatedDate @Column(name = "gmt_create")
@Column(name = "gmt_create",nullable = false,updatable = false) private Timestamp createTime;
private Date createTime;
@Column(name = "gmt_modified") @Column(name = "gmt_modified")
@LastModifiedDate private Timestamp updateTime;
private Date updateTime;
} }
package ai.qiwu.com.xiaoduhome.entity.secondary; package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.sql.Date;
import java.sql.Timestamp;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-26 下午2:19 * @dateTime 19-8-26 下午2:19
*/ */
@Getter
@Setter
@ToString
@Entity @Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_history_tb") @Table(name = "xiaodu_history_tb")
@Data
public class XiaoDuHistoryTB { public class XiaoDuHistoryTB {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
...@@ -30,11 +35,9 @@ public class XiaoDuHistoryTB { ...@@ -30,11 +35,9 @@ public class XiaoDuHistoryTB {
@Column(name = "last_time") @Column(name = "last_time")
private Long lastTime; private Long lastTime;
@CreatedDate @Column(name = "create_time")
@Column(name = "create_time",nullable = false,updatable = false) private Timestamp createTime;
private Date createTime;
@Column(name = "update_time") @Column(name = "update_time")
@LastModifiedDate private Timestamp updateTime;
private Date updateTime;
} }
...@@ -10,7 +10,6 @@ import javax.persistence.*; ...@@ -10,7 +10,6 @@ import javax.persistence.*;
* @dateTime 19-8-22 下午4:23 * @dateTime 19-8-22 下午4:23
*/ */
@Entity @Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb") @Table(name = "xiaodu_order_tb")
@Data @Data
public class XiaoDuOrderIdTB { public class XiaoDuOrderIdTB {
......
package ai.qiwu.com.xiaoduhome.entity.secondary; package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
/** /**
...@@ -13,7 +16,6 @@ import java.util.Date; ...@@ -13,7 +16,6 @@ import java.util.Date;
* @dateTime 19-8-22 下午3:45 * @dateTime 19-8-22 下午3:45
*/ */
@Entity @Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb") @Table(name = "xiaodu_order_tb")
@Data @Data
public class XiaoDuOrderTB { public class XiaoDuOrderTB {
...@@ -39,8 +41,8 @@ public class XiaoDuOrderTB { ...@@ -39,8 +41,8 @@ public class XiaoDuOrderTB {
@Column(name = "order_id") @Column(name = "order_id")
private String orderId; private String orderId;
@Column @Column(name = "time_stamp")
private String timestamp; private Long timeStamp;
@Column(name = "is_buy") @Column(name = "is_buy")
private Boolean isBuy; private Boolean isBuy;
...@@ -54,11 +56,9 @@ public class XiaoDuOrderTB { ...@@ -54,11 +56,9 @@ public class XiaoDuOrderTB {
@Column(name = "status") @Column(name = "status")
private Boolean status; private Boolean status;
@CreatedDate @Column(name = "create_time")
@Column(name = "create_time",nullable = false,updatable = false) private Timestamp createTime;
private Date createTime;
@Column(name = "update_time") @Column(name = "update_time")
@LastModifiedDate private Timestamp updateTime;
private Date updateTime;
} }
...@@ -17,6 +17,17 @@ public class Event { ...@@ -17,6 +17,17 @@ public class Event {
private String type; private String type;
private String componentId; private String componentId;
private Integer durationInMillisecond; 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() { public Event() {
} }
......
...@@ -3,6 +3,7 @@ package ai.qiwu.com.xiaoduhome.repository.primary; ...@@ -3,6 +3,7 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFavoriteTB; import ai.qiwu.com.xiaoduhome.entity.primary.AppFavoriteTB;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -16,9 +17,13 @@ import java.util.List; ...@@ -16,9 +17,13 @@ import java.util.List;
@Repository @Repository
public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, Integer> { public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, Integer> {
@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) @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); 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) @Query(value = "DELETE FROM app_favorite_tb WHERE bot_username=?1 AND user_id=?2",nativeQuery = true)
void deleteFavorite(String botId, Integer userId); void deleteFavorite(String botId, Integer userId);
...@@ -27,11 +32,11 @@ public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, In ...@@ -27,11 +32,11 @@ public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, In
@Override @Override
<S extends AppFavoriteTB> boolean exists(Example<S> example); <S extends AppFavoriteTB> boolean exists(Example<S> example);
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
<S extends AppFavoriteTB> S save(S s); <S extends AppFavoriteTB> S save(S s);
@Transactional @Transactional(rollbackFor = Exception.class)
void deleteByBotIdAndUserId(String botId, Integer userId); void deleteByBotIdAndUserId(String botId, Integer userId);
@Query(value="SELECT bot_username from app_favorite_tb where user_id=?1", nativeQuery = true) @Query(value="SELECT bot_username from app_favorite_tb where user_id=?1", nativeQuery = true)
......
...@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.primary; ...@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTB; import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTB;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-19 下午8:36 * @dateTime 19-8-19 下午8:36
...@@ -14,11 +17,12 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -14,11 +17,12 @@ import org.springframework.transaction.annotation.Transactional;
@Repository @Repository
public interface AppFlowerTBRepository extends JpaRepository<AppFlowerTB, Integer> { public interface AppFlowerTBRepository extends JpaRepository<AppFlowerTB, Integer> {
@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) @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 @Override
<S extends AppFlowerTB> S save(S s); <S extends AppFlowerTB> S save(S s);
......
...@@ -2,8 +2,10 @@ package ai.qiwu.com.xiaoduhome.repository.primary; ...@@ -2,8 +2,10 @@ package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppUserTB; import ai.qiwu.com.xiaoduhome.entity.primary.AppUserTB;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author 苗权威 * @author 苗权威
...@@ -13,6 +15,8 @@ import org.springframework.stereotype.Repository; ...@@ -13,6 +15,8 @@ import org.springframework.stereotype.Repository;
public interface AppUserTBRepository extends JpaRepository<AppUserTB, Integer> { public interface AppUserTBRepository extends JpaRepository<AppUserTB, Integer> {
AppUserTB getByPhone(String phone); 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) @Query(value = "INSERT INTO app_user_tb (user_phone,gmt_create) VALUES (?1, now())", nativeQuery = true)
void insertUser(String phone); void insertUser(String phone);
} }
...@@ -2,6 +2,7 @@ package ai.qiwu.com.xiaoduhome.repository.secondary; ...@@ -2,6 +2,7 @@ package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB; import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -18,15 +19,17 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB ...@@ -18,15 +19,17 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB
@Query(value = "SELECT DISTINCT xiaodu_user_id FROM xiaodu_history_tb", nativeQuery = true) @Query(value = "SELECT DISTINCT xiaodu_user_id FROM xiaodu_history_tb", nativeQuery = true)
List<String> getAllUser(); List<String> getAllUser();
@Transactional @Modifying
@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) @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); void deleteOverTime(String userId);
@Transactional @Modifying
@Transactional(rollbackFor = Exception.class)
@Query(value = "delete from xiaodu_history_tb where last_time <?1", nativeQuery = true) @Query(value = "delete from xiaodu_history_tb where last_time <?1", nativeQuery = true)
void deletePasted(Long boundTime); void deletePasted(Long boundTime);
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
<S extends XiaoDuHistoryTB> S save(S s); <S extends XiaoDuHistoryTB> S save(S s);
......
...@@ -13,7 +13,7 @@ public interface XiaoDuOrderTBIdRepository extends JpaRepository<XiaoDuOrderIdTB ...@@ -13,7 +13,7 @@ public interface XiaoDuOrderTBIdRepository extends JpaRepository<XiaoDuOrderIdTB
XiaoDuOrderIdTB getByXiaoduUserIdAndBotIdAndUnitPrice(String xiaoduUserId, String botId, Integer unitPrice); XiaoDuOrderIdTB getByXiaoduUserIdAndBotIdAndUnitPrice(String xiaoduUserId, String botId, Integer unitPrice);
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
<S extends XiaoDuOrderIdTB> S save(S s); <S extends XiaoDuOrderIdTB> S save(S s);
} }
\ No newline at end of file
...@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.secondary; ...@@ -3,10 +3,13 @@ package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB; import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB;
import org.springframework.data.domain.Example; import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-22 下午3:59 * @dateTime 19-8-22 下午3:59
...@@ -15,21 +18,25 @@ public interface XiaoDuOrderTbRepository extends JpaRepository<XiaoDuOrderTB, In ...@@ -15,21 +18,25 @@ public interface XiaoDuOrderTbRepository extends JpaRepository<XiaoDuOrderTB, In
@Override @Override
<S extends XiaoDuOrderTB> boolean exists(Example<S> example); <S extends XiaoDuOrderTB> boolean exists(Example<S> example);
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
<S extends XiaoDuOrderTB> S save(S s); <S extends XiaoDuOrderTB> S save(S s);
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
<S extends XiaoDuOrderTB> S saveAndFlush(S s); <S extends XiaoDuOrderTB> S saveAndFlush(S s);
@Transactional @Modifying
@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) @Transactional(rollbackFor = Exception.class)
void updateAterSeccessPayed(String chOrderId, String creationTimestamp, String orderId); @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 @Override
void delete(XiaoDuOrderTB xiaoDuOrderTB); 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_stamp<?1",nativeQuery = true)
void deleteOverTimeOrder(Long bound);
} }
...@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.sql.Date;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -49,7 +50,10 @@ public class ScheduleService implements InitializingBean { ...@@ -49,7 +50,10 @@ public class ScheduleService implements InitializingBean {
@Autowired @Autowired
public ScheduleService(GameProjectTbRepository gameProjectTbRepository, public ScheduleService(GameProjectTbRepository gameProjectTbRepository,
ProjectLabelRepository projectLabelRepository, AllOnProductInfoRepository allOnProductInfoRepository, XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository, XiaoDuOrderTbRepository xiaoDuOrderTbRepository) { ProjectLabelRepository projectLabelRepository,
AllOnProductInfoRepository allOnProductInfoRepository,
XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository,
XiaoDuOrderTbRepository xiaoDuOrderTbRepository) {
this.gameProjectTbRepository = gameProjectTbRepository; this.gameProjectTbRepository = gameProjectTbRepository;
this.projectLabelRepository = projectLabelRepository; this.projectLabelRepository = projectLabelRepository;
this.allOnProductInfoRepository = allOnProductInfoRepository; this.allOnProductInfoRepository = allOnProductInfoRepository;
...@@ -108,7 +112,8 @@ public class ScheduleService implements InitializingBean { ...@@ -108,7 +112,8 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
public void deleteOverTimeHistory() { public void deleteOverTimeHistory() {
new Thread(() -> { new Thread(() -> {
xiaoDuHistoryTBRepository.deletePasted((long) (System.currentTimeMillis()-2592E5)); xiaoDuHistoryTBRepository.deletePasted(System.currentTimeMillis()-259200000);//3 days
//xiaoDuHistoryTBRepository.deletePasted(System.currentTimeMillis()-300000);
List<String> userIds = xiaoDuHistoryTBRepository.getAllUser(); List<String> userIds = xiaoDuHistoryTBRepository.getAllUser();
for (String userId: userIds) { for (String userId: userIds) {
xiaoDuHistoryTBRepository.deleteOverTime(userId); xiaoDuHistoryTBRepository.deleteOverTime(userId);
...@@ -120,7 +125,8 @@ public class ScheduleService implements InitializingBean { ...@@ -120,7 +125,8 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 3 * * ?") @Scheduled(cron = "0 0 3 * * ?")
public void deleteUnPayedOrder() { public void deleteUnPayedOrder() {
new Thread(() -> { new Thread(() -> {
xiaoDuOrderTbRepository.deleteByStatus(false); long boundTime = System.currentTimeMillis()-600000;
xiaoDuOrderTbRepository.deleteOverTimeOrder(boundTime);
}).start(); }).start();
} }
...@@ -130,6 +136,8 @@ public class ScheduleService implements InitializingBean { ...@@ -130,6 +136,8 @@ public class ScheduleService implements InitializingBean {
initRecommendList(); initRecommendList();
initRankingList(); initRankingList();
initProductList(); initProductList();
deleteOverTimeHistory();
deleteUnPayedOrder();
tian(); tian();
keng(); keng();
} }
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
"border-top-left-radius": "25dp", "border-top-left-radius": "25dp",
"border-top-right-radius": "15dp", "border-top-right-radius": "15dp",
"border-bottom-right-radius": "15dp", "border-bottom-right-radius": "15dp",
"padding-vertical": "5dp", "padding-vertical": "8dp",
"padding-horizontal": "15dp", "padding-horizontal": "15dp",
"border-color": "rgb(255,255,255)", "border-color": "rgb(255,255,255)",
"items": [ "items": [
{ {
"type": "Text", "type": "Text",
"font-size": "15dp", "font-size": "15dp",
"color": "rgb(255,255,255,0.4)" "color": "rgb(255,255,255)"
} }
] ]
} }
......
{ {
"type": "Container", "type": "Container",
"flex-direction": "row", "margin-top": "40dp",
"width": "100%", "width": "100%",
"height": "100%", "height": "100%",
"items": [ "items": [
{ {
"type": "Container",
"flex-direction": "row",
"items": [
{
"type": "Image", "type": "Image",
"margin-top": "30dp", "margin-top": "30dp",
"height": "400dp", "height": "300dp",
"width": "400dp", "width": "300dp",
"scale-type": "fitXY",
"border-radius": "18dp",
"margin-left": "25dp", "margin-left": "25dp",
"src": "${data.imgSrc}" "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", "type": "Container",
"margin-left": "20dp",
"width": "500dp", "width": "500dp",
"height": "100%", "height": "100%",
"items": [ "items": [
{ {
"type": "Text", "type": "Text",
"text": "${data.head}",
"font-size": "35dp",
"line-height":"60dp",
"margin-top": "30dp",
"margin-left": "10dp"
},
{
"type": "Text",
"text": "${data.text}", "text": "${data.text}",
"font-size": "25dp", "font-size": "25dp",
"line-height":"60dp", "line-height":"60dp",
...@@ -28,4 +69,26 @@ ...@@ -28,4 +69,26 @@
] ]
} }
] ]
},
{
"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",
"font-size": "20dp",
"text": "点击图片查看详情",
"color": "rgb(255,255,255)"
}
]
}
]
} }
\ No newline at end of file
...@@ -32,6 +32,21 @@ ...@@ -32,6 +32,21 @@
"direction": "vertical", "direction": "vertical",
"height": "100%", "height": "100%",
"width": "100%", "width": "100%",
"componentId": "scrollCom",
"onLoaded": [
{
"type": "ScrollToIndex",
"componentId": "rankScroll",
"index": 7,
"align": "center"
},
{
"type": "ScrollToIndex",
"componentId": "recomScroll",
"index": 6,
"align": "center"
}
],
"items": [ "items": [
{ {
"type": "Container", "type": "Container",
...@@ -43,6 +58,7 @@ ...@@ -43,6 +58,7 @@
"height": "250dp", "height": "250dp",
"width": "100%", "width": "100%",
"direction": "horizontal", "direction": "horizontal",
"componentId": "rankScroll",
"items": [ "items": [
{ {
"type": "Container", "type": "Container",
...@@ -86,6 +102,7 @@ ...@@ -86,6 +102,7 @@
"type": "List", "type": "List",
"height": "100%", "height": "100%",
"width": "100%", "width": "100%",
"componentId": "recomScroll",
"direction": "horizontal", "direction": "horizontal",
"items": [ "items": [
{ {
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
{ {
"type": "Header", "type": "Header",
"headerTitle": "交游天下", "headerTitle": "交游天下",
"headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg", "hasBackIcon": false
"hasBackIcon": true
}, },
{ {
"type": "Container", "type": "Container",
...@@ -65,7 +64,7 @@ ...@@ -65,7 +64,7 @@
{ {
"type": "Footer", "type": "Footer",
"hints": [ "hints": [
"送花","收藏作品","回到首页" "我要送花","收藏","回到首页","返回"
] ]
} }
] ]
......
...@@ -45,7 +45,21 @@ ...@@ -45,7 +45,21 @@
"border-radius": "30dp", "border-radius": "30dp",
"scale-type": "fitCenter", "scale-type": "fitCenter",
"margin-left": "50dp", "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", "type": "Container",
......
...@@ -22,9 +22,8 @@ ...@@ -22,9 +22,8 @@
}, },
{ {
"type": "Header", "type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "排行榜", "headerTitle": "排行榜",
"hasBackIcon": true "hasBackIcon": false
}, },
{ {
"type": "Container", "type": "Container",
...@@ -38,6 +37,7 @@ ...@@ -38,6 +37,7 @@
"height": "100%", "height": "100%",
"width": "100%", "width": "100%",
"direction": "horizontal", "direction": "horizontal",
"componentId": "scrollToIndex",
"items": [ "items": [
{ {
"type": "Container", "type": "Container",
......
...@@ -22,9 +22,8 @@ ...@@ -22,9 +22,8 @@
}, },
{ {
"type": "Header", "type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "推荐页", "headerTitle": "推荐页",
"hasBackIcon": true "hasBackIcon": false
}, },
{ {
"type": "Container", "type": "Container",
...@@ -38,6 +37,7 @@ ...@@ -38,6 +37,7 @@
"height": "100%", "height": "100%",
"width": "100%", "width": "100%",
"direction": "horizontal", "direction": "horizontal",
"componentId": "scrollToIndex",
"items": [ "items": [
{ {
"type": "Container", "type": "Container",
......
{
"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
{
"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
{
"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
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