Commit cafc9711 by 苗权威

8.29

parent a1aa3fa5
......@@ -30,6 +30,7 @@ public interface Constants {
String LOAD_INTRO = "扫描二维码输入手机号获取验证码登录";
String REWARD_FLOWER = "请扫码支付";
String UNIT_PRICE = "1";
interface DPL_COMPONENT_ID {
String FLOWE = "flowe";
......@@ -93,6 +94,7 @@ public interface Constants {
String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦";
String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名";
String FAIL_COLLECT = "好像出了什么问题,请再说一遍吧";
String ERROR_SEND_FLOWER = "好像出了什么问题,我们终止了该订单";
}
interface EndMsg {
......
......@@ -19,8 +19,8 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public class OkHttp3Utils {
private static final OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.build();
public static String doGet(String url) throws IOException {
......
package ai.qiwu.com.xiaoduhome.common;
import ai.qiwu.com.xiaoduhome.pojo.Payload;
import ai.qiwu.com.xiaoduhome.pojo.UserInfoByTokenResult;
import com.alibaba.fastjson.JSON;
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
......@@ -99,8 +98,20 @@ public class Utils {
return Constants.XIAOWU_API.BASIC_PREFIX + str;
}
public static List<String> getRecommandBotNames(String word) {
int start = word.indexOf("《");
int end = word.lastIndexOf("》");
word = word.substring(start, end+1);
String[] names = word.split("、");
List<String> botNames = new ArrayList<>();
for (String name : names) {
botNames.add(name.substring(1, name.length()-1));
}
return botNames;
}
public static void main(String[] args) {
String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
System.out.println(String.format(s, "gsagh"));
//System.out.println(String.format(s, "gsagh"));
}
}
......@@ -45,6 +45,15 @@ public class XiaoDuOrderTB {
@Column(name = "is_buy")
private Boolean isBuy;
@Column(name = "ch_order_id")
private String chOrderId;
@Column(name = "creation_timestamp")
private String creationTimestamp;
@Column(name = "status")
private Boolean status;
@CreatedDate
@Column(name = "create_time",nullable = false,updatable = false)
private Date createTime;
......
......@@ -3,6 +3,7 @@ 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.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
......@@ -17,4 +18,16 @@ public interface XiaoDuOrderTbRepository extends JpaRepository<XiaoDuOrderTB, In
@Transactional
@Override
<S extends XiaoDuOrderTB> S save(S s);
@Transactional
@Override
<S extends XiaoDuOrderTB> S saveAndFlush(S s);
@Transactional
@Query(value = "UPDATE xiaodu_order_id 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);
@Transactional
@Override
void delete(XiaoDuOrderTB xiaoDuOrderTB);
}
......@@ -2,6 +2,7 @@ package ai.qiwu.com.xiaoduhome.service;
import ai.qiwu.com.xiaoduhome.common.Constants;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.common.Utils;
import ai.qiwu.com.xiaoduhome.pojo.QiWuRequest;
import ai.qiwu.com.xiaoduhome.pojo.QiWuResponse;
import com.alibaba.fastjson.JSON;
......@@ -11,6 +12,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.Random;
/**
* @author 苗权威
......@@ -42,6 +44,19 @@ class RequestTerminal {
}
public static void main(String[] args) throws IOException {
backRequest("2353461");
int i = 10;
while (i-- > 0) {
final int j = i;
new Thread(() -> {
try {
String userId = j+"2453525"+j;
log.info(userId);
String word = requestTerminate("有什么好玩的吗",userId).getText();
System.out.println(Utils.getRecommandBotNames(word));
} catch (IOException e) {
e.printStackTrace();
}
}).start();
}
}
}
......@@ -55,31 +55,24 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 19 * * ?")
public void initRankingList() {
try {
new Thread(() -> {
RANKING_LIST = gameProjectTbRepository.findFirst15ByApplyStatusOrderByWatchDesc(1);
//log.info("排行榜:{}", RANKING_LIST);
}).start();
} catch (Exception e) {
log.error("更新排行榜出错:{}", e.getMessage());
}
//log.error("更新排行榜出错:{}", e.getMessage());
}
@Scheduled(cron = "0 0 18 * * ?")
public void initRecommendList() {
try {
new Thread(() -> {
RECOMMEND_LIST = gameProjectTbRepository.recommendList();
//log.info("推荐:{}", RECOMMEND_LIST);
}).start();
} catch (Exception e) {
log.error("更新推荐页出错:{}", e.getMessage());
}
//log.error("更新推荐页出错:{}", e.getMessage());
}
@Scheduled(cron = "0 0 17 * * ?")
public void initAllOnTableProductInfo() {
try {
new Thread(() -> {
ALL_ON_PRODUCT = allOnProductInfoRepository.findAllByApplyStatus(1);
for (OnProductDetail item : ALL_ON_PRODUCT) {
......@@ -93,14 +86,11 @@ public class ScheduleService implements InitializingBean {
}
//log.info("作品详细信息:{}", PRODUCT_NAME_DETAIL);
}).start();
} catch (Exception e) {
log.error("更新推荐页出错:{}", e.getMessage());
}
//log.error("更新推荐页出错:{}", e.getMessage());
}
@Scheduled(cron = "0 0 1 ? * 7")
public void initProductList() {
try {
new Thread(() -> {
for (String category: CATEGORY) {
List<GameProjectTb> list = gameProjectTbRepository.categoryProject(category);
......@@ -108,14 +98,11 @@ public class ScheduleService implements InitializingBean {
log.info("分类{},作品列表{}", category, list);
}
}).start();
} catch (Exception e) {
log.error("更新分类作品列表出错:{}", e.getMessage());
}
//log.error("更新分类作品列表出错:{}", e.getMessage());
}
@Scheduled(cron = "0 0 2 * * ?")
public void deleteOverTimeHistory() {
try {
new Thread(() -> {
xiaoDuHistoryTBRepository.deletePasted((long) (System.currentTimeMillis()-2592E5));
List<String> userIds = xiaoDuHistoryTBRepository.getAllUser();
......@@ -123,9 +110,7 @@ public class ScheduleService implements InitializingBean {
xiaoDuHistoryTBRepository.deleteOverTime(userId);
}
}).start();
}catch (Exception e) {
log.error("清理历史记录数据库出错:{}", e.toString());
}
//log.error("清理历史记录数据库出错:{}", e.toString());
}
@Override
......
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