Commit 6f871228 by 苗权威

9.24

parent 7b2df62c
......@@ -8,9 +8,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
//@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) {
......
......@@ -51,7 +51,7 @@ public interface Constants {
String COLLECTED_IMG_URL = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/collec.png";
String UN_COLLECTED_IMG_URL = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/uncollec.png";
String DEFAULT_ASIDE_IMG_URL = "http://aws-nx2.chewrobot.com:8888/Editor/Editor/static/img/default.png";
String DEFAULT_ASIDE_IMG_URL = "http://aws-nx2.chewrobot.com:8888/Editor/upload/img/npc/2019/06/10100450218.png";
}
interface PRODUCT_INTRO {
......
......@@ -116,6 +116,14 @@ public class Utils {
return botNames;
}
public static Timestamp getCurTime() {
return new Timestamp(new Date().getTime());
}
public static Timestamp getCurTime(long curTimeMills) {
return new Timestamp(new Date(curTimeMills).getTime());
}
public static void main(String[] args) throws ParseException {
String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
//System.out.println(String.format(s, "gsagh"));
......
......@@ -9,7 +9,6 @@ import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyUtil;
import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchBotData;
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;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankUtil;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingDocument;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandBotInfo;
......@@ -18,7 +17,6 @@ import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandPojo;
import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryBotIdTime;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Data;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Item;
import ai.qiwu.com.xiaoduhome.pojo.dpl.MyDocument;
import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
......@@ -26,9 +24,6 @@ import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryBotTimeRepository;
import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import com.alibaba.fastjson.JSON;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
......@@ -40,14 +35,11 @@ import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import static ai.qiwu.com.xiaoduhome.common.Constants.CATEGORY_IMG_URL.GU_FENG;
import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.PRE_CATEGORY;
import static ai.qiwu.com.xiaoduhome.common.Constants.IMG_CUSTOM_PREFIX;
import static ai.qiwu.com.xiaoduhome.common.Constants.IMG_PREFIX;
import static ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils.getPlayDocument;
/**
* @author 苗权威
......@@ -249,7 +241,7 @@ public class TempleUtils {
return historyDocument;
}
public static CollectHistoryDocument getCollectPage(Integer userId) {
public static CollectHistoryDocument getCollectPage(Long userId) {
CollectHistoryDocument collectHistoryDocument = JSON.parseObject(getDPLTemple("static/json/collectPage.json"), CollectHistoryDocument.class);
AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository");
List<String> favoriteProducts = favorite.getFavoriteBotIds(userId);
......
package ai.qiwu.com.xiaoduhome.common.temple.productInfo;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
......@@ -11,6 +12,6 @@ import lombok.Setter;
@Getter
@Setter
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class ProductInfoDocument {
public class ProductInfoDocument extends Document {
private ProductInfoMainTemplate mainTemplate;
}
......@@ -21,6 +21,7 @@ public class ProductInfoUtils {
ProductInfoDocument document = new ProductInfoDocument();
ProductInfoMainTemplate mainTemplate = new ProductInfoMainTemplate();
document.setMainTemplate(mainTemplate);
document.setDuration(120000);
mainTemplate.getItems().addAll(Arrays.asList(BACK_IMG, HEADER, buildLeftRightPart(src, productName, time,
author, labelText, introText, startComponId, flowerId, flowerText, collectId, collectSrc, collectText), FOOTER));
return document;
......@@ -83,6 +84,7 @@ public class ProductInfoUtils {
name.setMarginTop("10dp");
name.setFontSize("38dp");
name.setMarginLeft("5%");
name.setText(productName);
return name;
}
......@@ -210,6 +212,7 @@ public class ProductInfoUtils {
collectCon.setType("Container");
collectCon.setAlignItems("center");
collectCon.setMarginLeft("120dp");
collectCon.setComponentId(collectId);
collectCon.setOnClick(Collections.singletonList(new Event("SendEvent", collectId)));
ProductInfoPojo image = new ProductInfoPojo();
......
......@@ -29,7 +29,7 @@ public class XiaoDuHomeController {
//service.disableVerify();
service.enableVerify();
String str = service.run();
log.info("响应信息:{}", str);
//log.info("响应信息:{}", str);
return str;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -10,6 +10,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
/**
* @author 苗权威
......@@ -17,24 +18,28 @@ import java.sql.Date;
*/
@Entity
@Table(name = "app_favorite_tb")
@Data
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
public class AppFavoriteTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Long id;
@Column(name = "bot_username")
private String botId;
@Column(name = "user_id")
private Integer userId;
private Long userId;
@Column
private Integer module;
@Column(name = "gmt_create")
private java.sql.Date createTime;
@CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false)
private Timestamp createTime;
@Column(name = "gmt_modified")
private Date updateTime;
@LastModifiedDate
@Column(name = "gmt_modified", nullable = false)
private Timestamp updateTime;
}
......@@ -18,11 +18,12 @@ import java.sql.Timestamp;
*/
@Entity
@Table(name = "app_flower_tb")
@EntityListeners(AuditingEntityListener.class)
@Data
public class AppFlowerTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Long id;
@Column
private Integer module;
......@@ -31,23 +32,25 @@ public class AppFlowerTB {
private String botName;
@Column(name = "user_id")
private Integer userId;
private Long userId;
@Column(name = "unit_price")
private Double unitPrice;
@Column
private Integer number;
private Long number;
@Column(name = "order_id")
private Integer orderId;
private Long orderId;
@Column
private Integer status;
@Column(name = "gmt_create")
@CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false)
private Timestamp createTime;
@Column(name = "gmt_modified")
@LastModifiedDate
@Column(name = "gmt_modified", nullable = false)
private Timestamp updateTime;
}
......@@ -3,6 +3,8 @@ package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
......@@ -13,18 +15,19 @@ import java.util.Date;
*/
@Entity
@Table(name = "app_user_tb")
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
@ToString
public class AppUserTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "info_id")
private Integer infoId;
private Long infoId;
@Column(name = "user_phone")
private String phone;
@Column(name = "gmt_create")
@CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false)
private Date createTime;
}
......@@ -3,6 +3,7 @@ package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
......@@ -18,8 +19,8 @@ import java.util.Date;
@ToString
public class GameProjectTb {
@Id
@GeneratedValue
private Integer id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column
private String intro;
......
......@@ -19,8 +19,8 @@ import java.util.List;
@ToString
public class OnProductDetail {
@Id
@GeneratedValue
private Integer id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column
private String intro;
......
......@@ -17,12 +17,12 @@ import javax.persistence.*;
@ToString
public class ProjectLabel {
@Id
@GeneratedValue
private Integer id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column
private String name;
@Column(name = "project_id")
private String productId;
private Long productId;
}
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
......@@ -11,11 +13,12 @@ import javax.persistence.*;
*/
@Entity
@Table(name = "xiaodu_history_tb")
@Data
@Getter
@Setter
public class XiaoDuHistoryBotIdTime {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Long id;
@Column(name = "bot_id")
private String botId;
......
......@@ -18,13 +18,13 @@ import java.sql.Timestamp;
*/
@Getter
@Setter
@ToString
@Entity
@Table(name = "xiaodu_history_tb")
@EntityListeners(AuditingEntityListener.class)
public class XiaoDuHistoryTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Long id;
@Column(name = "bot_id")
private String botId;
......@@ -35,9 +35,11 @@ public class XiaoDuHistoryTB {
@Column(name = "last_time")
private Long lastTime;
@Column(name = "create_time")
@CreatedDate
@Column(name = "create_time", updatable = false, nullable = false)
private Timestamp createTime;
@LastModifiedDate
@Column(name = "update_time")
private Timestamp updateTime;
}
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
......@@ -11,7 +13,8 @@ import javax.persistence.*;
*/
@Entity
@Table(name = "xiaodu_order_tb")
@Data
@Getter
@Setter
public class XiaoDuOrderIdTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
......
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedDate;
......@@ -17,17 +19,19 @@ import java.util.Date;
*/
@Entity
@Table(name = "xiaodu_order_tb")
@Data
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
public class XiaoDuOrderTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Long id;
@Column(name = "bot_id")
private String botId;
@Column(name = "app_user_id")
private String appUserId;
private Long appUserId;
@Column(name = "xiaodu_user_id")
private String xiaoduUserId;
......@@ -56,9 +60,11 @@ public class XiaoDuOrderTB {
@Column(name = "status")
private Boolean status;
@Column(name = "create_time")
@CreatedDate
@Column(name = "create_time", updatable = false, nullable = false)
private Timestamp createTime;
@Column(name = "update_time")
@LastModifiedDate
@Column(name = "update_time", nullable = false)
private Timestamp updateTime;
}
......@@ -13,7 +13,7 @@ import lombok.ToString;
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class Payload {
public class JYTUserResponse {
private String infoId;
private String userPhone;
}
......@@ -2,6 +2,7 @@ package ai.qiwu.com.xiaoduhome.pojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.HashMap;
import java.util.List;
......@@ -12,16 +13,15 @@ import java.util.List;
*/
@Getter
@Setter
@ToString
public class UserBehaviorData {
// 用户浏览历史
private volatile HashMap<String, Byte> userBotId2History = new HashMap<>();
private volatile HashMap<String, Long> userBotId2History = new HashMap<>();
// 用户对作品所送花的数目
private volatile HashMap<String, Long> userBotId2Flowers = new HashMap<>();
// 用户是否收藏该作品
private volatile HashMap<String, Byte> userBotId2Collected = new HashMap<>();
// timestamp与mark之间的关系:清扫线程每五分钟更新缓存中所有mark为1的对象的timestamp并将mark改为0,
// 若发现mark为0的timestamp五分钟之前的则删除缓存
private volatile Long timeStamp = System.currentTimeMillis();
// 标记清除,每半小时标记一次
private volatile Byte mark = 1;
private volatile String jytUserId;
......
......@@ -16,24 +16,12 @@ import java.util.List;
*/
@Repository
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)
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);
@Override
<S extends AppFavoriteTB> boolean exists(Example<S> example);
@Override
<S extends AppFavoriteTB> S save(S s);
void deleteByBotIdAndUserId(String botId, Integer userId);
@Modifying
@Transactional
void deleteByBotIdAndUserId(String botId, Long userId);
@Query(value="SELECT bot_username from app_favorite_tb where user_id=?1", nativeQuery = true)
List<String> getFavoriteBotIds(Long userId);
......
......@@ -16,12 +16,6 @@ import java.sql.Timestamp;
*/
@Repository
public interface AppFlowerTBRepository extends JpaRepository<AppFlowerTB, Integer> {
@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, Timestamp time);
@Override
<S extends AppFlowerTB> S save(S s);
......
......@@ -13,10 +13,7 @@ import java.util.List;
*/
@Repository
public interface AppFlowerTBTintRepository extends JpaRepository<AppFlowerTBTiny, Integer> {
AppFlowerTBTiny getByUserIdAndBotIdAndUnitPrice(Integer userId, String botId, Double unitPrice);
List<AppFlowerTBTiny> getByUserIdAndBotId(Integer userId, String botId);
List<AppFlowerTBTiny> getByUserIdAndBotId(Long userId, String botId);
@Query(value = "select number from app_flower_tb where user_id=?1 and bot_username=?2", nativeQuery = true)
List<Long> getFlowerNumByUserIdAndBotAccount(Long userId, String botAccount);
......
......@@ -20,9 +20,6 @@ public interface GameProjectTbRepository extends JpaRepository<GameProjectTb, In
@Query(value = "select id,intro,name,watch,banner_img_url,apply_status,bot_account,user_nickname from game_project_tb where apply_status = 1 and id >= (select floor(RAND()*(select MAX(id) from game_project_tb))) order by id limit 10", nativeQuery = true)
List<GameProjectTb> recommendList();
@Query(value = "select p.id,p.intro,p.name,p.watch,p.banner_img_url,p.apply_status,p.bot_account,p.user_nickname from game_project_tb as p,game_project_label_tb as l where l.name= :category and p.id = l.project_id and p.apply_status=1", nativeQuery = true)
List<GameProjectTb> categoryProject(@Param("category") String category);
@Query(value = "select p.bot_account from game_project_tb as p,game_project_label_tb as l where l.name=?1 and p.apply_status=1 and p.id = l.project_id",nativeQuery = true)
List<String> categoryProList(String category);
......
......@@ -16,5 +16,5 @@ import java.util.List;
public interface ProjectLabelRepository extends JpaRepository<ProjectLabel, Integer> {
@Query(value = "SELECT name FROM game_project_label_tb WHERE project_id = :productId", nativeQuery = true)
List<String> productLabels(@Param("productId") Integer productId);
List<String> productLabels(@Param("productId") Long productId);
}
......@@ -13,9 +13,6 @@ import java.util.List;
* @dateTime 19-8-26 下午2:21
*/
public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB, Integer> {
@Query(value = "SELECT bot_id FROM xiaodu_history_tb WHERE xiaodu_user_id=?1 ORDER BY last_time LIMIT 15", nativeQuery = true)
List<String> getHistory(String xiaoduUserId);
@Query(value = "SELECT DISTINCT xiaodu_user_id FROM xiaodu_history_tb", nativeQuery = true)
List<String> getAllUser();
......
......@@ -10,9 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
* @dateTime 19-8-22 下午4:28
*/
public interface XiaoDuOrderTBIdRepository extends JpaRepository<XiaoDuOrderIdTB, Integer> {
XiaoDuOrderIdTB getByXiaoduUserIdAndBotIdAndUnitPrice(String xiaoduUserId, String botId, Integer unitPrice);
@Override
<S extends XiaoDuOrderIdTB> S save(S s);
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -48,9 +48,10 @@ class RequestTerminal {
String url = "http://aws-nx2.chewrobot.com:18082/api/works";
HashMap<String, String> params = new HashMap<>();
params.put("include", "npcHeadImgUrl");
params.put("aipioneerUsername","1814141710");
String str = OkHttp3Utils.doGet(url, params);
AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
System.out.println(response.getData().getNpcHeadImgUrl());
params.put("aipioneerUsername","8343905461");
// String str = OkHttp3Utils.doGet(url, params);
// AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
// System.out.println(response.getData().getNpcHeadImgUrl());
requestTerminate("有科幻类的吗", "2352521agag");
}
}
package ai.qiwu.com.xiaoduhome.service;
import ai.qiwu.com.xiaoduhome.common.BaseHolder;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
/**
* 存储之前留存的代码,以备后用
* @author 苗权威
* @dateTime 19-9-24 上午10:49
*/
public class RunnableService {
static class UnCollectThread implements Runnable {
final String botId;
final String userId;
UnCollectThread(String botId, String userId) {
this.botId = botId;
this.userId = userId;
}
@Override
public void run() {
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
repository.deleteByBotIdAndUserId(botId, Long.parseLong(userId));
}
}
// class SendFlowerBuyToXiaoduTB implements Runnable {
// BuyEvent buyEvent;
//
// SendFlowerBuyToXiaoduTB(BuyEvent buyEvent) {
// this.buyEvent = buyEvent;
// }
// @Override
// public void run() {
// try {
// String baiduOrderReferenceId = buyEvent.getPayload().getBaiduOrderReferenceId();
// 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));
// if (userId == null) userId = getUserIdByToken(getAccessToken());
// if (userId == null) throw new Exception("未获取到用户id");
// XiaoDuOrderTbRepository repository = BaseHolder.getBean("xiaoDuOrderTbRepository");
// XiaoDuOrderTB orderTB = new XiaoDuOrderTB();
// orderTB.setAppUserId(userId);
// orderTB.setBotId(botId);
// orderTB.setNumber(1);
// orderTB.setIsBuy(true);
// orderTB.setOrderId(baiduOrderReferenceId);
// 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) {
// log.error("用户成功支付,xiaodu_order_tb操作出现错误:{}",e.toString());
// }
// }
// }
//
// class SendFlowerThread implements Runnable {
// BuyEvent buyEvent;
//
// SendFlowerThread(BuyEvent buyEvent) {
// this.buyEvent = buyEvent;
// }
//
// @Override
// public void run() {
// //String baiduOrderReferenceId = buyEvent.getPayload().getBaiduOrderReferenceId();
// String timeStamp = buyEvent.getTimestamp();
// String botId = new String(Base64.getDecoder().decode(buyEvent.getToken()), StandardCharsets.UTF_8);
// String userId = getSessionAttribute("userId");
// int unitePrice = Integer.parseInt(Config.getProperty("unitPrice", Constants.UNIT_PRICE));
// try {
// if (userId == null) userId = getUserIdByToken(getAccessToken());
// if (userId == null) throw new Exception("未获取到用户id");
// AppFlowerTBRepository flowerRepository = BaseHolder.getBean("appFlowerTBRepository");
// AppFlowerTB flowerTB = new AppFlowerTB();
// flowerTB.setNumber(1);
// flowerTB.setModule(0);
// flowerTB.setBotName(botId);
// flowerTB.setUserId(Integer.parseInt(userId));
// flowerTB.setStatus(1);
// flowerTB.setUnitPrice(unitePrice/100.0);
// 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中插入数据失败");
// } catch (Exception e) {
// log.error("用户成功支付,game_flower_tb操作出现错误:{}",e.toString());
// }
// }
// }
}
package ai.qiwu.com.xiaoduhome.service;
import ai.qiwu.com.xiaoduhome.common.Config;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchUtils;
import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.pojo.UserBehaviorData;
import ai.qiwu.com.xiaoduhome.pojo.playAside.AsideImageResponse;
import ai.qiwu.com.xiaoduhome.repository.primary.AllOnProductInfoRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.GameProjectTbRepository;
......@@ -25,6 +27,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.DEFAULT_ASIDE_IMG_URL;
import static ai.qiwu.com.xiaoduhome.common.Constants.UNIT_PRICE;
import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.ASIDE_IMG_URL;
/**
......@@ -62,6 +65,10 @@ public class ScheduleService implements InitializingBean {
private final XiaoDuOrderTbRepository xiaoDuOrderTbRepository;
static final String FLOWER_UNIT_PRICE = Config.getProperty("unitPrice", UNIT_PRICE);
static volatile Long curTime = System.currentTimeMillis();
@Autowired
public ScheduleService(GameProjectTbRepository gameProjectTbRepository,
ProjectLabelRepository projectLabelRepository,
......@@ -75,6 +82,26 @@ public class ScheduleService implements InitializingBean {
this.xiaoDuOrderTbRepository = xiaoDuOrderTbRepository;
}
@Scheduled(cron = "0 */30 * * * ?")
public void cleatUserBehaviorData() {
DplbotServiceUtil.POOL.submit(() -> {
List<String> needClear = new ArrayList<>();
for (String userId: DplbotServiceUtil.USER_HISTORY.keySet()) {
UserBehaviorData data = DplbotServiceUtil.USER_HISTORY.get(userId);
if (data != null) {
if (data.getMark() == 1) data.setMark((byte) 0);
else needClear.add(userId);
}
}
for (String userId: needClear) DplbotServiceUtil.USER_HISTORY.remove(userId);
});
}
@Scheduled(cron = "*/10 * * * * ?")
public void updateTheCurTime() {
DplbotServiceUtil.POOL.submit(() -> curTime = System.currentTimeMillis());
}
@Scheduled(cron = "0 0 19 * * ?")
public void initRankingList() {
new Thread(() -> {
......@@ -200,17 +227,19 @@ public class ScheduleService implements InitializingBean {
NX2_BOT_TO_HZ1.put("5741775745", "1586892647");
NX2_BOT_TO_HZ1.put("9159908109", "3899761881");
NX2_BOT_TO_HZ1.put("6035298742", "6559053319");
NX2_BOT_TO_HZ1.put("4366487183", "6402164753");
NX2_BOT_TO_HZ1.put("236055939", "6569120969");
NX2_BOT_TO_HZ1.put("9965361790", "9727432426");
NX2_BOT_TO_HZ1.put("2428131253", "9369493482");
NX2_BOT_TO_HZ1.put("8343905461", "7667391968");
NX2_BOT_TO_HZ1.put("2675579304", "2167984446");
NX2_BOT_TO_HZ1.put("6259213309", "438155367");
NX2_BOT_TO_HZ1.put("4707303948", "2139635657");
NX2_BOT_TO_HZ1.put("2090828382", "4731779365");
NX2_BOT_TO_HZ1.put("8907881060", "4577201364");
NX2_BOT_TO_HZ1.put("7051119238", "7907720862");
NX2_BOT_TO_HZ1.put("7414315062", "1029558688");
}
......@@ -242,7 +271,6 @@ public class ScheduleService implements InitializingBean {
EXCEPT_BOT_ACCOUNT.add("9256014607");
EXCEPT_BOT_ACCOUNT.add("1778815830");
EXCEPT_BOT_ACCOUNT.add("6823941516");
EXCEPT_BOT_ACCOUNT.add("4151097686");
}
public static HashMap<String, OnProductDetail> getProductIdDetail() {
......
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