Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
# Conflicts:
# fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
5个文件已添加
38个文件已修改
1 文件已重命名
| | |
| | | @RequestMapping("threeShareNew")
|
| | | public String threeShareNew(HttpServletRequest request, HttpSession session, HttpServletResponse response,
|
| | | long uid) {
|
| | | String serverName = request.getServerName();
|
| | | String contextPath = request.getContextPath();
|
| | | UserInfo userInfo = userInfoService.getUserById(uid);
|
| | | if (userInfo == null) {
|
| | | return "share/error";
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.util.ad.DouYinAdUtil;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("ad/callback/douyin")
|
| | | public class DouYinCallBackController {
|
| | | @Resource
|
| | | private DouYinClickEventService douYinClickEventService;
|
| | |
|
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | | /**
|
| | | * 抖音下载回调
|
| | |
| | | */
|
| | | @RequestMapping("monitor")
|
| | | public void download(DouYinClickEvent event, PrintWriter out) {
|
| | | LogHelper.test(new Gson().toJson(event));
|
| | | douYinClickEventService.save(event);
|
| | | if (event.getOs() == 0) {
|
| | | DeviceActive active = deviceActiveService.getFirstActiveInfo(event.getAndroidId());
|
| | | if (active != null) {
|
| | | DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(), active.getCreateTime().getTime());
|
| | | }
|
| | | }
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | |
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | data.put("hotFuctionLink", configService.get("hot_function_url"));
|
| | | data.put("hotFuctionLink",
|
| | | configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));//
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | |
|
| | | @RequestMapping("getsystemclientparams")
|
| | | public void getSystemClientParams(AcceptData acceptData, Long uid, HttpServletRequest request, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | |
| | | : DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setIpInfo(ipInfo);
|
| | | da.setChannel(acceptData.getChannel());
|
| | | da.setImei(acceptData.getImei());
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
| | | userActiveLog.setVersionCode(acceptData.getVersion());
|
| | | userActiveLog.setOsVersion(acceptData.getOsVersion());
|
| | | userActiveLog.setDeviceType(acceptData.getDeviceType());
|
| | | userActiveLog.setDevice(acceptData.getDevice());
|
| | | |
| | | userActiveLogService.addUserActiveLog(userActiveLog);
|
| | |
|
| | | outUserInfo(acceptData, out, remotIP, find, acceptData.getDevice());
|
| | |
| | | userActiveLog.setVersionCode(acceptData.getVersion());
|
| | | userActiveLog.setOsVersion(acceptData.getOsVersion());
|
| | | userActiveLog.setDeviceType(acceptData.getDeviceType());
|
| | | userActiveLog.setDevice(acceptData.getDevice());
|
| | | userActiveLogService.addUserActiveLog(userActiveLog);
|
| | |
|
| | | // 处理用户信息
|
| | |
| | | // 创建时间在28号后的才有新人欢迎
|
| | | if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
|
| | | UserHomeMsgVO vo = new UserHomeMsgVO();
|
| | | vo.setContent(String.format("恭喜你,成为%s的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让%s成为你的省钱助手吧!",Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | | vo.setContent(String.format("恭喜你,成为%s的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让%s成为你的省钱助手吧!",
|
| | | Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),
|
| | | Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | | vo.setTitle("新人欢迎");
|
| | | vo.setCreateTime(getTimeDesc(now, new Date(time)));
|
| | | vo.setType(UserHomeMsgVO.TYPE_WELCOME);
|
| | |
| | | // 1、活动区域
|
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
|
| | |
|
| | | List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode, Integer.parseInt(acceptData.getVersion()));
|
| | | List<Special> listSpecial = specialService.listByPlaceKey("msg_activities", platformCode,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special : listSpecial) {
|
| | |
|
| | |
| | | if ((time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd") || uid == null)) {
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | map.put("title", "新人欢迎");
|
| | | map.put("content",String.format("恭喜你,成为%s的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让%s成为你的省钱助手吧!",Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | | map.put("content",
|
| | | String.format("恭喜你,成为%s的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让%s成为你的省钱助手吧!",
|
| | | Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()),
|
| | | Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | | map.put("createTime", new Date(time));
|
| | | UserMsgCenter msgCenternre = new UserMsgCenter();
|
| | | msgCenternre.setWelcomeMsg(map);
|
| | |
| | | /**
|
| | | * 提醒大图
|
| | | */
|
| | | if (!"douyin".equalsIgnoreCase(acceptData.getChannel())) {
|
| | | MsgCommonDTO notify = msgConfigService.getNotifyMsg();
|
| | |
|
| | | if (notify != null && notify.getShow() == true) {
|
| | |
| | | read = true;
|
| | | // 查询是否已读
|
| | | UserCommonMsgVO vo = new UserCommonMsgVO(notify.getIcon(), notify.getTitle(), notify.getUpdateTime(),
|
| | | UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(), notify.getParams(),
|
| | | 0);
|
| | | UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(),
|
| | | notify.getParams(), 0);
|
| | | vo.setPicture(notify.getPicture());
|
| | | root.put("notifyMsg", builder.create().toJson(vo));
|
| | | }
|
| | |
|
| | | }
|
| | | root.put("list", builder.create().toJson(listCenter));
|
| | | root.put("commonList", builder.create().toJson(commonMsgList));
|
| | | root.put("count", listCenter.size());
|
| | |
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | data.put("hotFuctionLink", configService.get("hot_function_url"));
|
| | | data.put("hotFuctionLink",configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
|
| | | object.put("weiXin", userInfoExtra.getWeiXin());
|
| | | object.put("weiXinState", 3);
|
| | | object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过返利券赚钱技巧。");
|
| | | object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过板栗快省赚钱技巧。");
|
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
|
| | | object.put("weiXinState", 1);
|
| | |
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
|
| | | bossData.put("weiXin", userInfoExtra.getWeiXin());
|
| | | bossData.put("weiXinState", 3);
|
| | | bossData.put("weiXinTip", "添加TA的微信,你可向TA学习如何通过返利券赚钱。");
|
| | | bossData.put("weiXinTip", "添加TA的微信,你可向TA学习如何通过板栗快省赚钱。");
|
| | | } else {
|
| | | if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
|
| | | bossData.put("weiXinState", 1);
|
New file |
| | |
| | | package com.yeshi.fanli.dao.ad;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | |
|
| | | @Repository
|
| | | public class DouYinClickEventDao extends MongodbBaseDao<DouYinClickEvent> {
|
| | |
|
| | | public DouYinClickEvent selectByAid(String aid) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("aid").is(aid));
|
| | | return findOne(query);
|
| | | }
|
| | |
|
| | | public DouYinClickEvent selectByUuid(String uuid) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("uuid").is(uuid));
|
| | | return findOne(query);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | |
| | | DeviceActive selectFirst(String device); |
| | | |
| | | DeviceActive selectFirstByImei(String imei); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.ad;
|
| | |
|
| | | /**
|
| | | * 抖音广告与设备处理队列
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class DouYinDeviceActiveQueueDTO {
|
| | | public final static int TYPE_AD = 1;
|
| | | public final static int TYPE_DEVICE = 2;
|
| | |
|
| | | private int type;
|
| | | private String aid;
|
| | | private String device;
|
| | | private int platform;
|
| | | |
| | | public DouYinDeviceActiveQueueDTO() {
|
| | | }
|
| | |
|
| | | public DouYinDeviceActiveQueueDTO(int type, String aid) {
|
| | | this.type = type;
|
| | | this.aid = aid;
|
| | | }
|
| | |
|
| | | public DouYinDeviceActiveQueueDTO(int type, String device, int platform) {
|
| | | this.type = type;
|
| | | this.device = device;
|
| | | this.platform = platform;
|
| | | }
|
| | |
|
| | | public int getPlatform() {
|
| | | return platform;
|
| | | }
|
| | |
|
| | | public void setPlatform(int platform) {
|
| | | this.platform = platform;
|
| | | }
|
| | |
|
| | | public int getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(int type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public String getAid() {
|
| | | return aid;
|
| | | }
|
| | |
|
| | | public void setAid(String aid) {
|
| | | this.aid = aid;
|
| | | }
|
| | |
|
| | | public String getDevice() {
|
| | | return device;
|
| | | }
|
| | |
|
| | | public void setDevice(String device) {
|
| | | this.device = device;
|
| | | }
|
| | | }
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinUserActionInfo.java |
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class DouYinUserActionInfo {
|
| | | public class DouYinUserActionInfoDTO {
|
| | |
|
| | | // 0: 激活
|
| | | // 1: 注册
|
| | |
| | | private long convTime;// UTC时间戳
|
| | | private int eventType;
|
| | |
|
| | | public DouYinUserActionInfo(String callback, String muid, int os, long convTime,
|
| | | public DouYinUserActionInfoDTO(String callback, String muid, int os, long convTime,
|
| | | int eventType) {
|
| | | this.callback = callback;
|
| | | this.muid = muid;
|
| | |
| | | this.eventType = eventType;
|
| | | }
|
| | |
|
| | | public DouYinUserActionInfo() {
|
| | | public DouYinUserActionInfoDTO() {
|
| | | }
|
| | |
|
| | | public String getCallback() {
|
| | |
| | | package com.yeshi.fanli.entity.ad;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | |
| | |
|
| | | public final static String MONITOR__LINK__PARAMS = "aid=__AID__&aidName=__AID__NAME__&campaignId=__CAMPAIGN__ID__&cid=__CID__&csite=__CSITE__&ctype=__CTYPE__&mac=__MAC__&mac1=__MAC1__&ua=__UA__&idfa=__IDFA__&imei=__IMEI__&uuid=__UUID__&androidId=__ANDROIDID__&openUDID=__OPENUDID__&os=__OS__&ip=__IP__&ts=__TS__&convertId=__CONVERT__ID __&callback=__CALLBACK__PARAM __";// 监测链接
|
| | |
|
| | | @Id
|
| | | @Field
|
| | | private String aid; // 广告计划id 原值
|
| | | @Field
|
| | |
| | | */
|
| | | @Table("yeshi_ec_log_user_active")
|
| | | public class UserActiveLog {
|
| | | @Column(name = "ual_id")
|
| | | @Column(name = "lua_id")
|
| | | private Long id;
|
| | | @Column(name = "ual_uid")
|
| | | @Column(name = "lua_uid")
|
| | | private Long uid;
|
| | | @Column(name = "lua_ip")
|
| | | private String ip;
|
| | |
| | | private String deviceType;
|
| | | @Column(name = "lua_os_version")
|
| | | private String osVersion;
|
| | | @Column(name = "lua_device")
|
| | | private String device;//设备号
|
| | |
|
| | | public String getDevice() {
|
| | | return device;
|
| | | }
|
| | |
|
| | | public void setDevice(String device) {
|
| | | this.device = device;
|
| | | }
|
| | |
|
| | | public String getDeviceType() {
|
| | | return deviceType;
|
| | |
| | | private Date updateTime;
|
| | | @Column(name = "da_ip")
|
| | | private String ipInfo;
|
| | | @Column(name = "da_channel")
|
| | | private String channel;// 渠道
|
| | | @Column(name = "da_imei")
|
| | | private String imei;
|
| | |
|
| | | public String getImei() {
|
| | | return imei;
|
| | | }
|
| | |
|
| | | public void setImei(String imei) {
|
| | | this.imei = imei;
|
| | | }
|
| | |
|
| | | public String getChannel() {
|
| | | return channel;
|
| | | }
|
| | |
|
| | | public void setChannel(String channel) {
|
| | | this.channel = channel;
|
| | | }
|
| | |
|
| | | public String getIpInfo() {
|
| | | return ipInfo;
|
| | |
| | | InputStream cer = null;
|
| | |
|
| | | int p = deviceList.size() / 50 + 1;
|
| | | JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "返利券苹果端进行了重大更新!请立即升级",
|
| | | "更多优惠券,更高返利,尽在新版苹果端返利券!");
|
| | | JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "板栗快省苹果端进行了重大更新!请立即升级",
|
| | | "更多优惠券,更高返利,尽在新版苹果端板栗快省!");
|
| | | for (int i = 0; i < p; i++) {
|
| | | cer = this.getClass().getClassLoader().getResourceAsStream("certificate/老版本-生产证书.p12");
|
| | | try {
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | |
| | | * @return
|
| | | */
|
| | | private List<TaoBaoOrder> getCommonOrder(long startTime, int span) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(startTime, startTime + span * 1000L,
|
| | | 1);
|
| | | return orderList;
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | private List<TaoBaoOrder> getCommonSettleOrder(long startTime, int span) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(startTime, startTime + span * 1000L,
|
| | | 3);
|
| | | return orderList;
|
| | | }
|
| | |
|
| | |
| | | List<TaoBaoOrder> orderList = taoBaoOrderMapper.listLongTimeNoUpdateOrders(0, 10);
|
| | | List<TaoBaoOrder> updateOrderList = new ArrayList<>();
|
| | | for (TaoBaoOrder order : orderList) {
|
| | | List<TaoBaoOrder> newList = TaoKeOrderApiUtil.getTaoBaoAllOrder(order.getCreateTime(), 60, 1,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | long time = TimeUtil.convertToTimeTemp(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> newList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(time, time + 60 * 1000L, 1);
|
| | | for (TaoBaoOrder o : newList) {
|
| | | if (o.getOrderId().equalsIgnoreCase(order.getOrderId()))
|
| | | updateOrderList.add(o);
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | |
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getCommonOrder(long startTime, int span) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取第三方普通订单
|
| | | * |
| | | * @param startTime
|
| | | * @param span
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getThirdCommonOrder(long startTime, int span) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoThirdAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoThirdAllOrder(startTimeStr, span, page,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(startTime, startTime + span * 1000L,
|
| | | 1);
|
| | | return orderList;
|
| | | }
|
| | |
|
| | |
| | | // 处理3-15天前的订单,每天跑一次
|
| | | Calendar ca = Calendar.getInstance();
|
| | | int hour = ca.get(Calendar.HOUR_OF_DAY);
|
| | |
|
| | | long startTime = TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(ca.getTimeInMillis() - 1000 * 60 * 60 * 24 * 3L, "yyyy-MM-dd"), "yyyy-MM-dd")
|
| | | - hour * (1000 * 60 * 60 * 12L);
|
| | | long endTime = startTime + 1000 * 60 * 60 * 12L;
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, false);
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, true);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(startTime, endTime, 3);
|
| | | addOrder(orderList);
|
| | | }
|
| | |
|
| | |
| | | Calendar ca = Calendar.getInstance();
|
| | | long startTime = ca.getTimeInMillis() - 1000 * 60 * 5L - 1000 * 60 * 60 * 2L;
|
| | | long endTime = startTime + 1000 * 60 * 60 * 2L;
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, false);
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, true);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(startTime, endTime, 3);
|
| | | addOrder(orderList);
|
| | | }
|
| | |
|
| | |
| | | * 结束页码(每页100条数据)
|
| | | */
|
| | | public void updateRelationAndSpecialOrder(long startTime, long endTime) {
|
| | | List<TaoBaoOrder> list = TaoKeOrderApiUtil.getSpecialOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_ALL);
|
| | | List<TaoBaoOrder> list1 = TaoKeOrderApiUtil.getThirdSpecialOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_ALL);
|
| | | List<TaoBaoOrder> list2 = TaoKeOrderApiUtil.getRelationOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_ALL);
|
| | | List<TaoBaoOrder> list3 = TaoKeOrderApiUtil.getThirdRelationOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_ALL);
|
| | | List<TaoBaoOrder> list =TaoKeOrderApiUtil.getTaoBaoSpecialOrderList (startTime, endTime,1);
|
| | | List<TaoBaoOrder> list1 = TaoKeOrderApiUtil.getTaoBaoRelationOrderList (startTime, endTime,1);
|
| | | if (list1 != null && list1.size() > 0)
|
| | | list.addAll(list1);
|
| | | if (list2 != null && list2.size() > 0)
|
| | | list.addAll(list2);
|
| | | if (list3 != null && list3.size() > 0)
|
| | | list.addAll(list3);
|
| | | // 爬取到的订单号
|
| | | if (list != null)
|
| | | for (TaoBaoOrder order : list) {
|
| | |
| | | }
|
| | |
|
| | | public void updateRelationAndSpecialSettleOrder(long startTime, long endTime) {
|
| | | List<TaoBaoOrder> list = TaoKeOrderApiUtil.getSpecialOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT);
|
| | | List<TaoBaoOrder> list1 = TaoKeOrderApiUtil.getThirdSpecialOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT);
|
| | | List<TaoBaoOrder> list2 = TaoKeOrderApiUtil.getRelationOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT);
|
| | | List<TaoBaoOrder> list3 = TaoKeOrderApiUtil.getThirdRelationOrder(startTime, endTime,TaoKeOrderApiUtil.TK_STATUS_SETTLEMENT);
|
| | | List<TaoBaoOrder> list = TaoKeOrderApiUtil.getTaoBaoSpecialOrderList (startTime, endTime,3);
|
| | | List<TaoBaoOrder> list1 = TaoKeOrderApiUtil.getTaoBaoRelationOrderList (startTime, endTime,3);
|
| | | if (list1 != null && list1.size() > 0)
|
| | | list.addAll(list1);
|
| | | if (list2 != null && list2.size() > 0)
|
| | | list.addAll(list2);
|
| | | if (list3 != null && list3.size() > 0)
|
| | | list.addAll(list3);
|
| | | // 爬取到的订单号
|
| | | if (list != null)
|
| | | for (TaoBaoOrder order : list) {
|
| | | LogHelper.orderInfo("爬取到的订单号:" + order.getOrderId());
|
| | | }
|
| | |
|
| | | addRelationAndSpecialOrder(list);
|
| | | }
|
| | |
|
| | |
| | | from yeshi_ec_user where appid=#{appId} and identifycode=#{openId}
|
| | | </select>
|
| | | <!-- 根据AppId与电话号码获取用户 -->
|
| | | <select id="listByAppIdAndPhone" resultMap="BaseResultMap">
|
| | | <select id="listByAppIdAndPhone" resultMap="BaseResultMap"
|
| | | useCache="false" flushCache="true">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user where appid=#{appId} and phone=#{phone}
|
| | |
| | | from yeshi_ec_msg_device_read_state where mdrs_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap"> |
| | | <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap" useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and |
| | | mdrs_platform=#{platform} and mdrs_type=#{type} |
| | | </select> |
| | | <select id="listByDeviceAndPlatform" resultMap="BaseResultMap"> |
| | | <select id="listByDeviceAndPlatform" resultMap="BaseResultMap" useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and |
| | |
| | | <result column="da_createtime" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="da_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="da_ip" property="ipInfo" jdbcType="VARCHAR" /> |
| | | <result column="da_channel" property="channel" jdbcType="VARCHAR" /> |
| | | <result column="da_imei" property="imei" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip |
| | | </sql> |
| | | <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByDeviceAndPlatform" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_device = #{device} and |
| | | da_platform=#{platform} order by da_id desc limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstByDeviceAndPlatform" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_device = #{device} and |
| | | da_platform=#{platform} limit 1 |
| | | </select> |
| | | |
| | | <select id="selectByDeviceToeknMd5AndPlatform" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_device_token_md5 = |
| | | #{deviceTokenMd5} and da_platform=#{platform} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectFirst" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | <select id="selectFirst" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_device = |
| | | #{0} order by da_id limit 1 |
| | | from yeshi_ec_device_active where da_device = #{0} order by da_id |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstByImei" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_device_active where da_imei = #{0} order by da_id |
| | | limit 1 |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceActive" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_device_active |
| | | (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip) |
| | | (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{ipInfo,jdbcType=VARCHAR}) |
| | | </insert> |
| | | (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{ipInfo,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{imei,jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_device_active |
| | |
| | | <if test="createTime != null">da_createtime,</if> |
| | | <if test="updateTime != null">da_updatetime,</if> |
| | | <if test="ipInfo != null">da_ip,</if> |
| | | |
| | | <if test="channel != null">da_channel,</if> |
| | | <if test="imei != null">da_imei,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if> |
| | | <if test="channel != null">#{channel,jdbcType=VARCHAR}</if> |
| | | <if test="imei != null">#{imei,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceActive">update |
| | |
| | | #{deviceToken,jdbcType=VARCHAR},da_version_code = |
| | | #{versionCode,jdbcType=INTEGER},da_createtime = |
| | | #{createTime,jdbcType=TIMESTAMP},da_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP},da_ip = |
| | | #{ipInfo,jdbcType=VARCHAR} |
| | | where da_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | #{updateTime,jdbcType=TIMESTAMP},da_ip = #{ipInfo,jdbcType=VARCHAR} |
| | | ,da_channel =#{channel,jdbcType=VARCHAR},da_imei =#{imei,jdbcType=VARCHAR} where da_id = |
| | | #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive"> |
| | | update yeshi_ec_device_active |
| | | <set> |
| | | <if test="platform != null">da_platform=#{platform,jdbcType=INTEGER},</if> |
| | | <if test="device != null">da_device=#{device,jdbcType=VARCHAR},</if> |
| | | <if test="deviceTokenMd5 != null">da_device_token_md5=#{deviceTokenMd5,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="deviceTokenMd5 != null">da_device_token_md5=#{deviceTokenMd5,jdbcType=VARCHAR},</if> |
| | | <if test="deviceToken != null">da_device_token=#{deviceToken,jdbcType=VARCHAR},</if> |
| | | <if test="versionCode != null">da_version_code=#{versionCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">da_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">da_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="ipInfo != null">da_ip=#{ipInfo,jdbcType=VARCHAR},</if> |
| | | <if test="channel !=null">da_channel =#{channel,jdbcType=VARCHAR},</if> |
| | | <if test="imei !=null">da_imei =#{imei,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where da_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | <result column="lua_device_type" property="deviceType" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="lua_os_version" property="osVersion" jdbcType="VARCHAR" /> |
| | | <result column="lua_device" property="device" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version |
| | | <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectLatestByUid" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id desc limit 1 |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id |
| | | desc limit 1 |
| | | </select> |
| | | |
| | | <select id="selectFirstActiveInfo" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id limit 1 |
| | | from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id |
| | | limit 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_log_user_active |
| | | (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version) |
| | | (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR}) |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="updateTime != null">lua_updatetime,</if> |
| | | <if test="deviceType != null">lua_device_type,</if> |
| | | <if test="osVersion != null">lua_os_version,</if> |
| | | <if test="device != null">lua_device,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceType != null">#{deviceType,jdbcType=VARCHAR},</if> |
| | | <if test="osVersion != null">#{osVersion,jdbcType=VARCHAR}</if> |
| | | <if test="device != null">#{device,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog">update |
| | |
| | | #{createTime,jdbcType=TIMESTAMP},lua_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,lua_device_type |
| | | =#{deviceType,jdbcType=VARCHAR} ,lua_os_version |
| | | =#{osVersion,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | =#{osVersion,jdbcType=VARCHAR},lua_device |
| | | =#{device,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog"> |
| | | update yeshi_ec_log_user_active |
| | | <set> |
| | |
| | | <if test="versionCode != null">lua_version_code=#{versionCode,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">lua_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">lua_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="id !=null">lua_id =#{id,jdbcType=BIGINT},</if> |
| | | <if test="deviceType !=null">lua_device_type =#{deviceType,jdbcType=VARCHAR},</if> |
| | | <if test="osVersion !=null">lua_os_version =#{osVersion,jdbcType=VARCHAR},</if> |
| | | <if test="device !=null">lua_device =#{device,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where lua_id = #{id,jdbcType=BIGINT} |
| | | </update> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.ad;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.ad.DouYinClickEventDao;
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | | import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
|
| | | import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
|
| | |
|
| | | @Service
|
| | | public class DouYinClickEventServiceImpl implements DouYinClickEventService {
|
| | |
|
| | | @Resource
|
| | | private DouYinClickEventDao douYinClickEventDao;
|
| | |
|
| | | @Override
|
| | | public void save(DouYinClickEvent event) {
|
| | | // 查询
|
| | | DouYinClickEvent old = douYinClickEventDao.selectByAid(event.getAid());
|
| | | if (old == null) {
|
| | | douYinClickEventDao.save(event);
|
| | | DouYinDeviceActiveCMQManager.getInstance().addAdActive(event.getAid());
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DouYinClickEvent selectByAid(String aid) {
|
| | | return douYinClickEventDao.selectByAid(aid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DouYinClickEvent selectByUuid(String uuid) {
|
| | | return douYinClickEventDao.selectByUuid(uuid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | buffer.append(" ");
|
| | | buffer.append("早安~\n");
|
| | | buffer.append("我的邀请码:【邀请码】\n");
|
| | | buffer.append("购物省钱返利券App:【邀请链接】");
|
| | | buffer.append("购物省钱板栗快省App:【邀请链接】");
|
| | |
|
| | | content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。").replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | |
| | | stList.add(identifyCode);
|
| | | if (stList.size() >= limitCount) {// 触发报警
|
| | | if ("1".equalsIgnoreCase(configService.get("can_send_emergency_msg")))
|
| | | EmergencyUtil.baoJin(key, "返利券【分享赚】", phones);
|
| | | EmergencyUtil.baoJin(key, "板栗快省【分享赚】", phones);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | stList.add(identifyCode);
|
| | | if (stList.size() >= limitCount) {// 触发报警
|
| | | if ("1".equalsIgnoreCase(configService.get("can_send_emergency_msg")))
|
| | | EmergencyUtil.baoJin(key, "返利券【领券返利】", phones);
|
| | | EmergencyUtil.baoJin(key, "板栗快省【领券返利】", phones);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Config config = new Config();
|
| | | config.setCreatetime(System.currentTimeMillis() + "");
|
| | | config.setKey(KEY_ZHUSHOU);
|
| | | config.setName("消息-返利券小助手");
|
| | | config.setName("消息-板栗快省小助手");
|
| | | config.setValue(new Gson().toJson(dto));
|
| | | configService.save(config);
|
| | | }
|
| | |
| | |
|
| | | if (olist != null && olist.size() > 0) {
|
| | | long time = TimeUtil.convertToTimeTemp(olist.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss");
|
| | | olist = TaoKeOrderApiUtil.getTaoBaoAllOrder(TimeUtil.getGernalTime(time, "yyyy-MM-dd HH:mm:ss"),
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL);
|
| | | List<TaoBaoOrder> thirdOList = TaoKeOrderApiUtil.getTaoBaoThirdAllOrder(
|
| | | TimeUtil.getGernalTime(time, "yyyy-MM-dd HH:mm:ss"), 30, 1,
|
| | | TaoKeOrderApiUtil.TK_STATUS_ALL, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (thirdOList != null && thirdOList.size() > 0)
|
| | | olist.addAll(thirdOList);
|
| | |
|
| | | olist = TaoKeOrderApiUtil.getTaoBaoCommonOrderList(time, time + 1000 * 2L, 1);
|
| | | if (olist != null && olist.size() > 0) {
|
| | | for (int i = 0; i < olist.size(); i++) {
|
| | | if (!olist.get(i).getOrderId()
|
| | |
| | | // 加资金
|
| | | userMoneyService.addUserMoney(uid, money, detail);
|
| | | pushMsg(uid, "关于近期订单与资金异常的排查与修复结果通知",
|
| | | "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有未统计或错误统计的订单,我们已经为您补齐资金,对应资金已经存入您的账户余额中,敬请查收注查收。感谢信任,返利券App终将成为您最信任的购物省钱助手。");
|
| | | "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有未统计或错误统计的订单,我们已经为您补齐资金,对应资金已经存入您的账户余额中,敬请查收注查收。感谢信任,板栗快省App终将成为您最信任的购物省钱助手。");
|
| | | userMoneyMsgNotificationService.systemEqualize(uid, "订单统计异常修复", money, userInfoService.getBalance(uid));
|
| | | } catch (UserMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | |
| | |
|
| | | } else {// 资金需要减少,不要扣钱
|
| | | pushMsg(uid, "关于近期订单与资金异常的排查与修复结果通知",
|
| | | "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有错误统计的订单,我们已经为您恢复正常,所涉及订单多统计出来的资金,不会被扣除,即您账户中的资金将保持不变,已提现的资金,也不会收回,敬请知晓。感谢信任,返利券App终将成为您最信任的购物省钱助手。");
|
| | | "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有错误统计的订单,我们已经为您恢复正常,所涉及订单多统计出来的资金,不会被扣除,即您账户中的资金将保持不变,已提现的资金,也不会收回,敬请知晓。感谢信任,板栗快省App终将成为您最信任的购物省钱助手。");
|
| | | // userMoneyMsgNotificationService.systemEqualize(uid, "订单统计异常修复",
|
| | | // money, userInfoService.getBalance(uid));
|
| | | // 加入提现审核异常保护中
|
| | |
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
|
| | |
|
| | | @Service
|
| | | public class DeviceActiveServiceImpl implements DeviceActiveService {
|
| | |
| | | }
|
| | |
|
| | | deviceActiveMapper.insertSelective(deviceActive);
|
| | | DouYinDeviceActiveCMQManager.getInstance().addDeviceActive(deviceActive.getDevice(),
|
| | | deviceActive.getPlatform());
|
| | | } else {
|
| | | DeviceActive updateDeviceActive = new DeviceActive();
|
| | | updateDeviceActive.setId(da.getId());
|
| | | updateDeviceActive.setUpdateTime(new Date());
|
| | | updateDeviceActive.setVersionCode(deviceActive.getVersionCode());
|
| | | if (StringUtil.isNullOrEmpty(da.getImei()))
|
| | | updateDeviceActive.setImei(deviceActive.getImei());
|
| | | if (!StringUtil.isNullOrEmpty(deviceActive.getDeviceToken())) {
|
| | | updateDeviceActive.setDeviceToken(deviceActive.getDeviceToken());
|
| | | updateDeviceActive.setDeviceTokenMd5(StringUtil.Md5(deviceActive.getDeviceToken()));
|
| | |
| | | return deviceActiveMapper.selectFirst(device);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DeviceActive getFirstActiveInfoByImei(String imei) {
|
| | | return deviceActiveMapper.selectFirstByImei(imei);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | tips.add("确认领取后,你将成为赠送者的一级队员;");
|
| | | tips.add("返利券奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
|
| | | tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
|
| | | tips.add("成功领取后,请到“我的-福利中心”中查看。");
|
| | | } else {
|
| | | tips.add("返利券奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
|
| | | tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
|
| | | tips.add("成功领取后,请到“我的-福利中心”中查看。");
|
| | | }
|
| | | } else {
|
| | |
| | | String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
|
| | | if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
|
| | | defaultNickName = defaultNickName + uid;
|
| | | if ((defaultNickName.equals(user.getNickName()) || "返利券".equals(user.getNickName()))) {
|
| | | if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
|
| | | updateUserInfo.setNickName(weiXinUser.getNickname());
|
| | | }
|
| | | }
|
| | |
| | | String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
|
| | | if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
|
| | | defaultNickName = defaultNickName + uid;
|
| | | if ((defaultNickName.equals(user.getNickName()) || "返利券".equals(user.getNickName()))) {
|
| | | if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
|
| | | updateUserInfo.setNickName(weiXinUser.getNickname());
|
| | | }
|
| | | }
|
| | |
| | | userActiveLog.setCreateTime(new Date());
|
| | | userActiveLog.setUpdateTime(new Date());
|
| | | userActiveLogMapper.insertSelective(userActiveLog);
|
| | | } else if (latestLog != null) {
|
| | | // 如果设备 ,版本,渠道有变化则需要更改
|
| | | String oldIdentify = latestLog.getDevice() + "#" + latestLog.getVersionCode() + "#"
|
| | | + latestLog.getChannel();
|
| | | String newIdentify = userActiveLog.getDevice() + "#" + userActiveLog.getVersionCode() + "#"
|
| | | + userActiveLog.getChannel();
|
| | | if (!oldIdentify.equalsIgnoreCase(newIdentify)) {// 设备信息变化要记录信息
|
| | | userActiveLog.setCreateTime(new Date());
|
| | | userActiveLog.setUpdateTime(new Date());
|
| | | userActiveLogMapper.insertSelective(userActiveLog);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | @Override
|
| | | public UserActiveLog getFirstActiveInfo(Long uid) {
|
| | |
|
| | | |
| | | return userActiveLogMapper.selectFirstActiveInfo(uid);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class UserInfoExtraServiceImpl implements UserInfoExtraService {
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInviteRecordService userInviteRecordService;
|
| | | |
| | |
|
| | | @Override
|
| | | public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
|
| | |
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | | UserInfo userInfo = userInfoExtra.getUserInfo();
|
| | |
| | | userInfoExtra.setRankOrderNum(selfOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_REBATE);
|
| | | }
|
| | |
|
| | |
|
| | | if (rank != null) {
|
| | | userInfoExtra.setUserRank(rank);
|
| | |
| | | throw new UserInfoExtraException(1, "激活失败");
|
| | | }
|
| | |
|
| | | |
| | | // 邀请码有效、生成邀请码
|
| | | String code = UserUtil.getInviteCode(uid);
|
| | | if (code == null || code.trim().length() == 0) {
|
| | |
| | | // 保存额外信息
|
| | | saveUserInfoExtra(userInfoExtra);
|
| | |
|
| | | |
| | | Long id = userInfoExtra.getId();
|
| | | if (id == null) {
|
| | | throw new UserInfoExtraException(1, "激活码生成失败");
|
| | |
| | |
|
| | | return code;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void activationInviteWX(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException{
|
| | |
| | | }
|
| | |
|
| | | // 获取微信信息
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code,wxAccount.getAppId(),wxAccount.getAppSecret());
|
| | | WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
|
| | | wxAccount.getAppSecret());
|
| | | if (weiXinUser == null) {
|
| | | throw new UserInfoExtraException(1, "微信授权失败");
|
| | | }
|
| | |
| | | String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
|
| | | if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
|
| | | defaultNickName = defaultNickName + uid;
|
| | | if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName()))) {
|
| | | if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName())
|
| | | || invitee.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName()))) {
|
| | | updateUserInfo.setNickName(weiXinUser.getNickname());
|
| | | }
|
| | | }
|
| | |
| | | } else if (!wxUnionId.equals(wxUnionIdExist)){
|
| | | throw new UserInfoExtraException(1, "绑定微信与激活微信不一致");
|
| | | }
|
| | | |
| | |
|
| | | // 邀请人ID -1.5.3新版
|
| | | Long inviterId = userInviteRecordService.getNewestInviterId(wxUnionId);
|
| | |
| | | throw new UserInfoExtraException(1, "关系绑定时失败");
|
| | | }
|
| | |
|
| | | |
| | | // 邀请码有效、生成邀请码
|
| | | String inviteCode = UserUtil.getInviteCode(uid);
|
| | | if (inviteCode == null || inviteCode.trim().length() == 0) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserInfoExtra getUserInfoExtra(Long uid) {
|
| | | return userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public UserInfoExtra getByUidForUpdate(Long uid) {
|
| | | return userInfoExtraMapper.getByUidForUpdate(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void updateGoldCoin(Long id, Integer goldCoin) {
|
| | | userInfoExtraMapper.updateGoldCoin(id, goldCoin);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserInfoExtraVO getInfoExtraVOByUid(Long uid) {
|
| | | return userInfoExtraMapper.getInfoExtraVOByUid(uid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public String getUserInviteCode(Long uid) throws UserInfoExtraException {
|
| | |
| | | return isNew;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserRank gerUserRank(Long uid) {
|
| | | if(uid == null) {
|
| | |
| | | return userInfoExtra.getUserRank();
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public UserInfo getUserByInviteCode(String inviteCode) throws UserInfoExtraException{
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | |
| | | }
|
| | | return inviter;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public UserInfo getInviterInfo(WXAccountInfoDTO wxAccount,Long uid, String code) throws UserInfoExtraException{
|
| | |
| | | addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, user.getWxUnionId());
|
| | | }
|
| | |
|
| | | if (user.getNickName() != null && !user.getNickName().startsWith("返利券")) {
|
| | | if (user.getNickName() != null && !user.getNickName().startsWith("返利券")&&!user.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName())) {
|
| | | addModifyRecord(uid, ModifyTypeEnum.nickName, user.getNickName() + "");
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.ad;
|
| | |
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | |
|
| | | public interface DouYinClickEventService {
|
| | |
|
| | | /**
|
| | | * 缓存到数据库
|
| | | * |
| | | * @param event
|
| | | */
|
| | | public void save(DouYinClickEvent event);
|
| | |
|
| | | /**
|
| | | * 根据广告ID查询
|
| | | * |
| | | * @param aid
|
| | | * @return
|
| | | */
|
| | | public DouYinClickEvent selectByAid(String aid);
|
| | |
|
| | | /**
|
| | | * 根据androidID查询
|
| | | * @param androidId
|
| | | * @return
|
| | | */
|
| | | public DouYinClickEvent selectByUuid(String uuid);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public DeviceActive getFirstActiveInfo(String device);
|
| | | |
| | | /**
|
| | | * 根据IMEI查询
|
| | | * @param imei
|
| | | * @return
|
| | | */
|
| | | public DeviceActive getFirstActiveInfoByImei(String imei);
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static String getAppName(String platform, String version) {
|
| | | if (VersionUtil.greaterThan_2_0(platform, version))
|
| | | // if (VersionUtil.greaterThan_2_0(platform, version))
|
| | | return Constant.systemCommonConfig.getProjectChineseName();
|
| | | else
|
| | | return "返利券";
|
| | | // else
|
| | | // return "返利券";
|
| | | }
|
| | |
|
| | | public static WXAccountInfoDTO getWXAccount(String platform, String version) {
|
| | | // if (VersionUtil.greaterThan_2_0(platform, version)) {
|
| | | // return new WXAccountInfoDTO("wxa99686bb65a9f466", "57390718ddedaa1591f6876cdcf96f43", "wx879fb78463222cd5",
|
| | | // "2ad8ec333a9f96b13c5c5c1c2b13cd67");
|
| | | // } else {
|
| | | return new WXAccountInfoDTO("wx43617e2ed82c5b28", "f8a65908fb4681bdd181de70f6ab9a3b", "wx5c0d167c6e3ad726",
|
| | | // return new WXAccountInfoDTO("wx43617e2ed82c5b28",
|
| | | // "f8a65908fb4681bdd181de70f6ab9a3b", "wx5c0d167c6e3ad726",
|
| | | // "0c79d5869bb0f2d7c13e43f9a18f440d");
|
| | | return new WXAccountInfoDTO("wxa99686bb65a9f466", "57390718ddedaa1591f6876cdcf96f43", "wx5c0d167c6e3ad726",
|
| | | "0c79d5869bb0f2d7c13e43f9a18f440d");
|
| | | // }
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.entity.ad.DouYinClickEvent;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.push.PushQueueRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
|
| | | import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.ad.DouYinAdUtil;
|
| | | import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
|
| | |
| | | @Resource
|
| | | private IntegralTaskRecordService integralTaskRecordService;
|
| | |
|
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | |
|
| | | private static boolean isInited = false;
|
| | |
|
| | | public void onApplicationEvent(ContextRefreshedEvent arg0) {
|
| | |
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
|
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private DouYinClickEventService douYinClickEventService;
|
| | |
|
| | | // 抖音
|
| | | public void doDouYinDeviceActiveJob() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | Map<String, DouYinDeviceActiveQueueDTO> map = DouYinDeviceActiveCMQManager.getInstance()
|
| | | .consume(16);
|
| | | if (map != null) {
|
| | | // 是否是首单
|
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | DouYinDeviceActiveQueueDTO active = map.get(key);
|
| | | if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_AD) {// 抖音
|
| | | DouYinClickEvent event = douYinClickEventService.selectByAid(active.getAid());
|
| | | if (event != null) {
|
| | | if (event.getOs() == 0) {
|
| | | DeviceActive deviceActive = deviceActiveService
|
| | | .getFirstActiveInfoByImei(event.getUuid());
|
| | | if (deviceActive != null) {
|
| | | if (event != null) {
|
| | | if (event.getOs() == 0)
|
| | | DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
|
| | | deviceActive.getCreateTime().getTime());
|
| | | else if (event.getOs() == 1)
|
| | | DouYinAdUtil.activeIOS(event.getCallback(), event.getIdfa(),
|
| | | deviceActive.getCreateTime().getTime());
|
| | | }
|
| | | }
|
| | | } else {// TODO 处理IOS
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | } else if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_DEVICE) {// 设备
|
| | |
|
| | | if (active.getPlatform() == 1) {
|
| | | DeviceActive deviceActive = deviceActiveService
|
| | | .getFirstActiveInfo(active.getDevice());
|
| | | if (deviceActive != null) {
|
| | | DouYinClickEvent event = douYinClickEventService
|
| | | .selectByUuid(deviceActive.getImei());
|
| | | if (event != null) {// 回调
|
| | | if (deviceActive != null)
|
| | | DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
|
| | | deviceActive.getCreateTime().getTime());
|
| | | }
|
| | | }
|
| | | } else {
|
| | | // TODO 兼容IOS
|
| | | }
|
| | | }
|
| | | DouYinDeviceActiveCMQManager.getInstance().delete(key);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.ad.DouYinUserActionInfo;
|
| | | import com.yeshi.fanli.dto.ad.DouYinUserActionInfoDTO;
|
| | |
|
| | | public class DouYinAdUtil {
|
| | |
|
| | | public final static String SIGN_KEY = "tdqaWqs-Xkkxe-nea-UDsPtnorzpARzgB";
|
| | | public final static String SIGN_KEY = "TuXUwRE-aosga-mno-LTxzgvSbhrkUKbK";
|
| | |
|
| | | // 上传用户行为
|
| | | private static void postUserAction(DouYinUserActionInfo info, String signKey) {
|
| | | private static void postUserAction(DouYinUserActionInfoDTO info, String signKey) {
|
| | | String url = "http://ad.toutiao.com/track/activate/";
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("callback", info.getCallback());
|
| | |
| | | url = url.substring(0, url.length() - 1);
|
| | | String sign = StringUtil.Md5(url + signKey);
|
| | | url += "&sign=" + sign;
|
| | | String result = HttpUtil.post(url);
|
| | | System.out.println(url);
|
| | | String result = HttpUtil.get(url);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | |
| | | * @param callBack
|
| | | */
|
| | | public static void activeAndroid(String callBack, String imei, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_ACTIVE);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_ACTIVE);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | | public static void activeIOS(String callBack, String idfa, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_ACTIVE);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_ACTIVE);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | |
| | | * 注册
|
| | | */
|
| | | public static void registerAndroid(String callBack, String imei, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_REGISTER);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_REGISTER);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | | public static void registerIOS(String callBack, String idfa, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_REGISTER);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_REGISTER);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | |
|
| | | public static void validOrderAndroid(String callBack, String imei, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_ORDER);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_ORDER);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | | public static void validOrderIOS(String callBack, String idfa, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_ORDER);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_ORDER);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | |
|
| | | public static void retainedAndroid(String callBack, String imei, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_CILIU);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_CILIU);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
| | | public static void retainedIOS(String callBack, String idfa, Long convTime) {
|
| | | DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
|
| | | DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
|
| | | convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
|
| | | DouYinUserActionInfo.EVENT_TYPE_CILIU);
|
| | | DouYinUserActionInfoDTO.EVENT_TYPE_CILIU);
|
| | | postUserAction(info, SIGN_KEY);
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.util.cmq;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.yeshi.utils.CMQUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.qcloud.cmq.Message;
|
| | | import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class DouYinDeviceActiveCMQManager {
|
| | |
|
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
|
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
|
| | | private static DouYinDeviceActiveCMQManager jdOrderCMQManager;
|
| | | private static CMQUtil cmqUtil;
|
| | |
|
| | | public static String DOUYIN_DEVICE_ACTIVE = "douyin-device-active";
|
| | |
|
| | | static {
|
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey);
|
| | | DOUYIN_DEVICE_ACTIVE += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | cmqUtil.createQueue(DOUYIN_DEVICE_ACTIVE);
|
| | | }
|
| | |
|
| | | public static DouYinDeviceActiveCMQManager getInstance() {
|
| | | if (jdOrderCMQManager == null)
|
| | | jdOrderCMQManager = new DouYinDeviceActiveCMQManager();
|
| | | return jdOrderCMQManager;
|
| | | }
|
| | |
|
| | | public void addDeviceActive(String device, int platform) {
|
| | | if (StringUtil.isNullOrEmpty(device) || platform == 0)
|
| | | return;
|
| | | DouYinDeviceActiveQueueDTO dto = new DouYinDeviceActiveQueueDTO(DouYinDeviceActiveQueueDTO.TYPE_DEVICE, device,
|
| | | platform);
|
| | | cmqUtil.sendMsg(DOUYIN_DEVICE_ACTIVE, new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | | public void addAdActive(String aid) {
|
| | | if (StringUtil.isNullOrEmpty(aid))
|
| | | return;
|
| | | DouYinDeviceActiveQueueDTO dto = new DouYinDeviceActiveQueueDTO(DouYinDeviceActiveQueueDTO.TYPE_AD, aid);
|
| | | cmqUtil.sendMsg(DOUYIN_DEVICE_ACTIVE, new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | | public Map<String, DouYinDeviceActiveQueueDTO> consume(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, DOUYIN_DEVICE_ACTIVE);
|
| | | Map<String, DouYinDeviceActiveQueueDTO> map = new HashMap<>();
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | map.put(msg.receiptHandle, new Gson().fromJson(result, DouYinDeviceActiveQueueDTO.class));
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void delete(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(DOUYIN_DEVICE_ACTIVE, receiptHandle);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.dto.order.OrderQuery;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoOrderResultDTO;
|
| | | import com.yeshi.fanli.dto.taobao.WeiQuanOrderResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoPunishOrder;
|
| | |
| | | public static int TK_STATUS_SUCCESS = 14;
|
| | | public static int TK_STATUS_INVALID = 13;
|
| | |
|
| | | /**
|
| | | * 获取会员订单
|
| | | * |
| | | * @param startTime-开始时间
|
| | | * @param page-页码
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getTaoBaoSpecialOrder(String startTime, int span, int page, int tkStatus,
|
| | | String appKey, String appSecret) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | orderQuery.orderScene = 3;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.span = span;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取第三方会员订单
|
| | | * |
| | | * @param startTime
|
| | | * @param page
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getTaoBaoSpecialThirdOrder(String startTime, int span, int page, int tkStatus,
|
| | | String appKey, String appSecret) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | orderQuery.orderScene = 3;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.span = span;
|
| | | orderQuery.orderCountType = 2;
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取渠道订单
|
| | | * |
| | | * @param startTime
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getTaoBaoRelationOrder(String startTime, int span, int page, int tkStatus,
|
| | | String appKey, String appSecret) {
|
| | |
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.span = span;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | orderQuery.orderScene = 2;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 第三方渠道订单
|
| | | * |
| | | * @param startTime
|
| | | * @param page
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getTaoBaoRelationThirdOrder(String startTime, int span, int page, int tkStatus,
|
| | | String appKey, String appSecret) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.span = span;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | orderQuery.orderScene = 2;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.orderCountType = 2;
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取所有的订单(不带渠道信息与会员信息)
|
| | | * |
| | | * @param startTime
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getTaoBaoAllOrder(String startTime, String appKey, String appSecret, int tkStatus) {
|
| | |
|
| | | return getTaoBaoAllOrder(startTime, 1200, 1, tkStatus, appKey, appSecret);
|
| | | }
|
| | |
|
| | | public static List<TaoBaoOrder> getTaoBaoAllOrder(String startTime, int span, int page, int tkStatus, String appKey,
|
| | | String appSecret) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.span = span;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | orderQuery.orderScene = 1;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.orderCountType = 1;
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取第三方订单
|
| | | * |
| | | * @param startTime
|
| | | * @param span
|
| | | * @param page
|
| | | * @param appKey
|
| | | * @param appSecret
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getTaoBaoThirdAllOrder(String startTime, int span, int page, int tkStatus,
|
| | | String appKey, String appSecret) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.startTime = startTime;
|
| | | orderQuery.span = span;
|
| | | orderQuery.tkStatus = tkStatus;
|
| | | if (tkStatus == TK_STATUS_SETTLEMENT)
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | else
|
| | | orderQuery.orderQueryType = "create_time";
|
| | | orderQuery.orderScene = 1;
|
| | | orderQuery.pageNo = page;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.orderCountType = 2;
|
| | | return queryTaoBaoOrder(orderQuery, appKey, appSecret);
|
| | | }
|
| | |
|
| | | private static TaoBaoPunishOrder parsePunishOrder(JSONObject data) {
|
| | | TaoBaoPunishOrder order = new TaoBaoPunishOrder();
|
| | |
| | | return resultList;
|
| | | }
|
| | |
|
| | | |
| | | @Deprecated
|
| | | private static List<TaoBaoOrder> queryTaoBaoOrder(OrderQuery orderQuery, String appKey, String appSecret) {
|
| | |
|
| | | Map<String, String> map = new HashMap<>();
|
| | |
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
|
| | | return parseTaoBaoOrder(json.toString());
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | |
| | | return orderList;
|
| | | }
|
| | |
|
| | | private static List<TaoBaoOrder> getSpecialOrder(long startTime, int span, int tkStatus) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = getTaoBaoSpecialOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = getTaoBaoSpecialOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | | private static TaoBaoOrderResultDTO parseTaoBaoOrderNew(String response) {
|
| | |
|
| | | /**
|
| | | * 获取第三方普通订单
|
| | | * |
| | | * @param startTime
|
| | | * @param span
|
| | | * @return
|
| | | */
|
| | | private static List<TaoBaoOrder> getThirdTSpecialOrder(long startTime, int span, int tkStatus) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = getTaoBaoSpecialThirdOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = getTaoBaoSpecialThirdOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | | TaoBaoOrderResultDTO dto=new TaoBaoOrderResultDTO(false, false, null, new ArrayList<>());
|
| | |
|
| | | private static List<TaoBaoOrder> getRelationOrder(long startTime, int span, int tkStatus) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = getTaoBaoRelationOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = getTaoBaoRelationOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | private static List<TaoBaoOrder> getThirdRelationOrder(long startTime, int span, int tkStatus) {
|
| | | int page = 1;
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | List<TaoBaoOrder> orderList = getTaoBaoRelationThirdOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | List<TaoBaoOrder> tempOrderList = getTaoBaoRelationThirdOrder(startTimeStr, span, page, tkStatus,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取某个区间的会员订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getSpecialOrder(long startTime, long endTime, int tkStatus) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | long span = (endTime - startTime) % 1000 == 0 ? (endTime - startTime) / 1000 : (endTime - startTime) / 1000 + 1;
|
| | | int count = (int) (span / 1200);
|
| | | if (span % 1200 != 0)
|
| | | count++;
|
| | | for (int i = 0; i < count; i++) {
|
| | | long startT = startTime + i * 1200 * 1000L;
|
| | | int s = 1200;
|
| | | if (endTime < startT + 1200 * 1000L) {
|
| | | s = (int) ((endTime - startT) / 1000) + 1;
|
| | | if (s < 60)
|
| | | s = 60;
|
| | | }
|
| | | List<TaoBaoOrder> tempOrderList = getSpecialOrder(startT, s, tkStatus);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取某个区间的第三方会员订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getThirdSpecialOrder(long startTime, long endTime, int tkStatus) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | long span = (endTime - startTime) % 1000 == 0 ? (endTime - startTime) / 1000 : (endTime - startTime) / 1000 + 1;
|
| | | int count = (int) (span / 1200);
|
| | | if (span % 1200 != 0)
|
| | | count++;
|
| | | for (int i = 0; i < count; i++) {
|
| | | long startT = startTime + i * 1200 * 1000L;
|
| | | int s = 1200;
|
| | | if (endTime < startT + 1200 * 1000L) {
|
| | | s = (int) ((endTime - startT) / 1000) + 1;
|
| | | if (s < 60)
|
| | | s = 60;
|
| | | }
|
| | | List<TaoBaoOrder> tempOrderList = getThirdTSpecialOrder(startT, s, tkStatus);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取渠道订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getRelationOrder(long startTime, long endTime, int tkStatus) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | long span = (endTime - startTime) % 1000 == 0 ? (endTime - startTime) / 1000 : (endTime - startTime) / 1000 + 1;
|
| | | int count = (int) (span / 1200);
|
| | | if (span % 1200 != 0)
|
| | | count++;
|
| | | for (int i = 0; i < count; i++) {
|
| | | long startT = startTime + i * 1200 * 1000L;
|
| | | int s = 1200;
|
| | | if (endTime < startT + 1200 * 1000L) {
|
| | | s = (int) ((endTime - startT) / 1000) + 1;
|
| | | if (s < 60)
|
| | | s = 60;
|
| | | }
|
| | | List<TaoBaoOrder> tempOrderList = getRelationOrder(startT, s, tkStatus);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取某个区间的第三方渠道订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getThirdRelationOrder(long startTime, long endTime, int tkStatus) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | long span = (endTime - startTime) % 1000 == 0 ? (endTime - startTime) / 1000 : (endTime - startTime) / 1000 + 1;
|
| | | int count = (int) (span / 1200);
|
| | | if (span % 1200 != 0)
|
| | | count++;
|
| | | for (int i = 0; i < count; i++) {
|
| | | long startT = startTime + i * 1200 * 1000L;
|
| | | int s = 1200;
|
| | | if (endTime < startT + 1200 * 1000L) {
|
| | | s = (int) ((endTime - startT) / 1000) + 1;
|
| | | if (s < 60)
|
| | | s = 60;
|
| | | }
|
| | | List<TaoBaoOrder> tempOrderList = getThirdRelationOrder(startT, s, tkStatus);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | private static List<TaoBaoOrder> getTaoBaoSettleOrders(long startTime, int span, boolean third) {
|
| | | OrderQuery orderQuery = new OrderQuery();
|
| | | orderQuery.span = span;
|
| | | orderQuery.orderQueryType = "settle_time";
|
| | | orderQuery.orderScene = 1;
|
| | | orderQuery.pageSize = 100;
|
| | | orderQuery.tkStatus=TK_STATUS_SETTLEMENT;
|
| | | int page = 1;
|
| | | orderQuery.pageNo = page;
|
| | | if (third)
|
| | | orderQuery.orderCountType = 2;
|
| | | else
|
| | | orderQuery.orderCountType = 1;
|
| | |
|
| | | String startTimeStr = TimeUtil.getGernalTime(startTime, "yyyy-MM-dd HH:mm:ss");
|
| | | orderQuery.startTime = startTimeStr;
|
| | | List<TaoBaoOrder> orderList = queryTaoBaoOrder(orderQuery, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | while (orderList.size() == 100 * page) {
|
| | | page++;
|
| | | orderQuery.pageNo = page;
|
| | | List<TaoBaoOrder> tempOrderList = queryTaoBaoOrder(orderQuery, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取结算订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param third
|
| | | * -是否为第三方订单
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getTaoBaoSettleOrders(long startTime, long endTime, boolean third) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | long span = (endTime - startTime) % 1000 == 0 ? (endTime - startTime) / 1000 : (endTime - startTime) / 1000 + 1;
|
| | | int count = (int) (span / 1200);
|
| | | if (span % 1200 != 0)
|
| | | count++;
|
| | | for (int i = 0; i < count; i++) {
|
| | | long startT = startTime + i * 1200 * 1000L;
|
| | | int s = 1200;
|
| | | if (endTime < startT + 1200 * 1000L) {
|
| | | s = (int) ((endTime - startT) / 1000) + 1;
|
| | | if (s < 60)
|
| | | s = 60;
|
| | | }
|
| | | List<TaoBaoOrder> tempOrderList = getTaoBaoSettleOrders(startT, s, third);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | |
|
| | | JSONArray array = null;
|
| | | JSONObject data = JSONObject.fromObject(response);
|
| | | try {
|
| | | Thread.sleep(1000 * 10);// 加个延时,防止API请求频率限制
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | JSONObject rootData=data.optJSONObject("tbk_order_details_get_response").optJSONObject("data");
|
| | | array =rootData .optJSONObject("results")
|
| | | .optJSONArray("publisher_order_dto");
|
| | | dto.setHasPre( rootData.optBoolean("has_pre"));
|
| | | dto.setPositionIndex(rootData.optString("position_index"));
|
| | | dto.setHasNext(rootData.optBoolean("has_next"));
|
| | | } catch (Exception e) {
|
| | | return dto;
|
| | | }
|
| | |
|
| | | if (array != null)
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | |
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | try {
|
| | | TaoBaoOrder taoBaoOrder = new TaoBaoOrder();
|
| | | taoBaoOrder.setAdPositionId(item.optString("adzone_id"));
|
| | | taoBaoOrder.setAdPositionName(item.optString("adzone_name"));
|
| | | taoBaoOrder.setAuctionId(item.optLong("item_id"));
|
| | | taoBaoOrder.setClassName(item.optString("item_category_name"));
|
| | | taoBaoOrder.setClickTime(item.optString("click_time"));
|
| | | taoBaoOrder.setCount(item.optInt("item_num"));
|
| | | taoBaoOrder.setCreateTime(item.optString("tk_create_time"));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("total_commission_fee")))
|
| | | taoBaoOrder.seteIncome(new BigDecimal(item.optString("total_commission_fee")));
|
| | | else
|
| | | taoBaoOrder.seteIncome(new BigDecimal(0));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("pub_share_pre_fee")))
|
| | | taoBaoOrder.setEstimate(new BigDecimal(item.optString("pub_share_pre_fee")));
|
| | | else
|
| | | taoBaoOrder.setEstimate(new BigDecimal(0));
|
| | | taoBaoOrder.setiRatio(new BigDecimal(item.optString("income_rate")));
|
| | | taoBaoOrder.setLatestUpdateTime(null);
|
| | | taoBaoOrder.setManagerWangWang(null);
|
| | | taoBaoOrder.setOrderBy(null);
|
| | | taoBaoOrder.setOrderId(item.optString("trade_parent_id"));
|
| | | if (item.optInt("tk_status") == 12)
|
| | | taoBaoOrder.setOrderState("订单付款");
|
| | | else if (item.optInt("tk_status") == 3)
|
| | | taoBaoOrder.setOrderState("订单结算");
|
| | | else if (item.optInt("tk_status") == 13)
|
| | | taoBaoOrder.setOrderState("订单失效");
|
| | | else if (item.optInt("tk_status") == 14)
|
| | | taoBaoOrder.setOrderState("订单成功");
|
| | |
|
| | | taoBaoOrder.setOrderType(item.optString("order_type"));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("alipay_total_price")))
|
| | | taoBaoOrder.setPayment(new BigDecimal(item.optString("alipay_total_price")));
|
| | | else
|
| | | taoBaoOrder.setPayment(new BigDecimal(0));
|
| | | taoBaoOrder.setPrice(new BigDecimal(item.optString("item_price")));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("pay_price")))
|
| | | taoBaoOrder.setSettlement(new BigDecimal(item.optString("pay_price")));
|
| | | else
|
| | | taoBaoOrder.setSettlement(new BigDecimal(0));
|
| | | taoBaoOrder.setSettlementTime(item.optString("tk_earning_time"));
|
| | | taoBaoOrder.setShop(item.optString("seller_shop_title"));
|
| | | taoBaoOrder.setSourceMediaId(item.optString("site_id"));
|
| | | taoBaoOrder.setSourceMediaName(item.optString("site_name"));
|
| | | taoBaoOrder.setsRatio(null);
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("subsidy_fee")))// 补贴金额
|
| | | taoBaoOrder.setSubsidy(new BigDecimal(item.optString("subsidy_fee")));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("subsidy_rate")))
|
| | | taoBaoOrder.setSubsidyRatio(new BigDecimal(item.optString("subsidy_rate")));
|
| | | taoBaoOrder.setSubsidyType(item.optString("subsidy_type"));
|
| | | taoBaoOrder.setTechnologySupportPercent(null);
|
| | | taoBaoOrder.setThirdService(null);
|
| | | taoBaoOrder.setTitle(item.optString("item_title"));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("total_commission_fee")))
|
| | | taoBaoOrder.setTkMoney(new BigDecimal(item.optString("total_commission_fee")));
|
| | | else
|
| | | taoBaoOrder.setTkMoney(new BigDecimal(0));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("commission_rate")))
|
| | | taoBaoOrder.setTkRate(new BigDecimal(item.optString("commission_rate")));
|
| | | else if (!StringUtil.isNullOrEmpty(item.optString("total_commission_rate")))
|
| | | taoBaoOrder.setTkRate(new BigDecimal(item.optString("total_commission_rate")));
|
| | | taoBaoOrder.setTransactionPlatform(item.optString("terminal_type"));
|
| | | taoBaoOrder.setRelationId(item.optString("relation_id"));
|
| | | taoBaoOrder.setSpecialId(item.optString("special_id"));
|
| | | taoBaoOrder.setTradeId(item.optString("trade_id"));
|
| | | orderList.add(taoBaoOrder);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "订单号信息:" + item.toString(), "订单解析出错");
|
| | | } catch (Exception e1) {
|
| | | }
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | | dto.setOrderList(orderList);
|
| | | return dto;
|
| | | }
|
| | |
|
| | | public static WeiQuanOrderResult getTaoBaoRelationWeiQuanOrderList(Date startTime, int searchType, int page,
|
| | |
| | |
|
| | | return finalResult;
|
| | | }
|
| | | |
| | | /**
|
| | | * 新版本淘宝订单
|
| | | */
|
| | |
|
| | | /**
|
| | | * 获取淘宝会员运营订单
|
| | | * |
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | | */
|
| | | public static List<TaoBaoOrder> getTaoBaoSpecialOrderList(long startTime, long endTime, int queryType) {
|
| | | return getTaoBaoOrderList(startTime, endTime, queryType, 3);
|
| | | }
|
| | |
|
| | | public static List<TaoBaoOrder> getTaoBaoRelationOrderList(long startTime, long endTime, int queryType) {
|
| | | return getTaoBaoOrderList(startTime, endTime, queryType, 2);
|
| | | }
|
| | | |
| | | public static List<TaoBaoOrder> getTaoBaoCommonOrderList(long startTime, long endTime, int queryType) {
|
| | | return getTaoBaoOrderList(startTime, endTime, queryType, 1);
|
| | | }
|
| | | |
| | | |
| | | public static List<TaoBaoOrder> getTaoBaoOrderList(long startTime, long endTime, int queryType,int orderScene) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | // 跨度20分钟
|
| | | long span=(1000 * 60 * 20L);
|
| | | long jianGe = endTime - startTime;
|
| | | long page = jianGe %span==0?jianGe/span:jianGe /span+1 ;
|
| | | if (page == 0)
|
| | | page = 1;
|
| | | for (int i = 1; i <= page; i++) {
|
| | | long start = startTime + (i - 1) * span;
|
| | | long end = start + span;
|
| | | if (end > endTime)
|
| | | end = endTime;
|
| | | TaoBaoOrderResultDTO dto = queryNewOrder(TimeUtil.getGernalTime(start, "yyyy-MM-dd HH:mm:ss"),
|
| | | TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),null, queryType, orderScene);
|
| | | if (dto != null)
|
| | | orderList.addAll(dto.getOrderList());
|
| | | while(dto.isHasNext())
|
| | | {
|
| | | dto=queryNewOrder(TimeUtil.getGernalTime(start, "yyyy-MM-dd HH:mm:ss"),
|
| | | TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),dto.getPositionIndex(), queryType, orderScene);
|
| | | if (dto != null)
|
| | | orderList.addAll(dto.getOrderList());
|
| | | }
|
| | | }
|
| | | return orderList;
|
| | | }
|
| | | |
| | |
|
| | | private static TaoBaoOrderResultDTO queryNewOrder(String startTime, String endTime,String positionIndex, int queryType, int orderScene) {
|
| | | Map<String, String> params = new HashMap<>();
|
| | | params.put("query_type", queryType + "");
|
| | | params.put("page_size", "100");
|
| | | params.put("start_time", startTime);
|
| | | params.put("end_time", endTime);
|
| | | params.put("page_no", "1");
|
| | | params.put("order_scene", orderScene + "");
|
| | | if(!StringUtil.isNullOrEmpty(positionIndex))
|
| | | params.put("position_index", positionIndex + "");
|
| | | params.put("method", "taobao.tbk.order.details.get");
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(params, app);
|
| | | return parseTaoBaoOrderNew(json.toString());
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | //搜狐网址
|
| | | private static String getShortLink2(String url) {
|
| | | try {
|
| | | String totalUrl = String.format(
|
| | | "http://api.t.sina.com.cn/short_url/shorten.json?source=2849184197&url_long=%s", // 3403499693
|
| | | URLEncoder.encode(url));
|
| | | "https://sohu.gg/api/?key=2zumZxsL8MuX&url=%s",
|
| | | URLEncoder.encode(url,"UTF-8"));
|
| | | String result = get(totalUrl, null);
|
| | | System.out.println(result);
|
| | | JSONObject data = JSONArray.fromObject(result).optJSONObject(0);
|
| | | return data.optString("url_short");
|
| | | if(result!=null&&result.startsWith("http"))
|
| | | return result;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|