| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.util.vipshop.DingDanXiaApiUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | |
| | | if (goodsBrief == null) |
| | | continue; |
| | | // 商品VO |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55",system); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(SystemEnum.blks)); |
| | | GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "dingdanxia/vipshopauth") |
| | | public void dingDanXiaAuth(String code, String state, HttpServletRequest request, PrintWriter out) { |
| | | //暂时不使用 |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderBackUp; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; |
| | | import com.yeshi.fanli.job.order.taobao.TaoBaoOrderUpdateJob; |
| | | import com.yeshi.fanli.job.order.taobao.UpdateOrderJob; |
| | | import com.yeshi.fanli.job.order.taobao.UpdateTBRelationAndSpecialOrderJob; |
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService; |
| | |
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService; |
| | | |
| | | @Resource |
| | | private UpdateTBRelationAndSpecialOrderJob updateRelationAndSpecialOrderJob; |
| | | |
| | | @Resource |
| | | private UpdateOrderJob updateOrderJob; |
| | | |
| | | @Resource |
| | | private OrderProcessService orderProcessService; |
| | | |
| | | @Resource |
| | | private TaoBaoOrderBackUpDao taoBaoOrderBackUpDao; |
| | | private TaoBaoOrderUpdateJob taoBaoOrderUpdateJob; |
| | | |
| | | /** |
| | | * 查询列表 - 新后台 |
| | |
| | | int p = 0; |
| | | for (Iterator<String> its = orderIds.iterator(); its.hasNext(); ) { |
| | | String orderId = its.next(); |
| | | List<TaoBaoOrder> list = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId); |
| | | try { |
| | | //如果创建时间超过了90天的抛出异常 |
| | | if (list.size() == 0 || TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") < System.currentTimeMillis() - 1000 * 60 * 60L * 24 * 90) |
| | | throw new Exception("需要本地更新"); |
| | | long startTime = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") - 1000L; |
| | | long endTime = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") + 1000L; |
| | | updateRelationAndSpecialOrderJob.updateRelationAndSpecialOrder(startTime, endTime); |
| | | updateOrderJob.updateOrder(startTime, endTime); |
| | | } catch (Exception e) { |
| | | //从本地备份拿出订单 |
| | | List<String> tradeIds = new ArrayList<>(); |
| | | for (TaoBaoOrder order : list) { |
| | | tradeIds.add(order.getTradeId()); |
| | | } |
| | | List<TaoBaoOrderBackUp> orderBackUps = taoBaoOrderBackUpDao.listByIds(tradeIds); |
| | | List<TaoBaoOrder> orderList = new ArrayList<>(); |
| | | for (TaoBaoOrderBackUp backUp : orderBackUps) { |
| | | orderList.add(TaoKeOrderApiUtil.parseTaoBaoOrderNew(JSONObject.fromObject(backUp.getContent()))); |
| | | } |
| | | updateOrderJob.addOrder(orderList); |
| | | } |
| | | taoBaoOrderUpdateJob.updateTaoBaoOrder(orderId); |
| | | } |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("更新成功")); |
| | | } catch (Exception e) { |
| | | |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("更新失败")); |
| | | e.printStackTrace(); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.jd; |
| | | |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import com.yeshi.fanli.entity.pdd.UserPDDAuthRecord; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class JDOrderBackUpDao extends MongodbBaseDao<JDBackUpOrder> { |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<CommonOrder> test(); |
| | | |
| | | List<CommonOrder> list(@Param("query") DaoQuery query,@Param("start")long start,@Param("count")int count); |
| | | |
| | | |
| | | public static class DaoQuery { |
| | | public Integer state; |
| | | public Integer sourceType; |
| | | public Date minThirdCreateTime; |
| | | public Date maxThirdCreateTime; |
| | | public List<String> sortList; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.jd; |
| | | |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | //京东订单备份 |
| | | public class JDOrderForBackUpResult { |
| | | private boolean hasMore; |
| | | private List<JDBackUpOrder> orderList; |
| | | |
| | | public JDOrderForBackUpResult(boolean hasMore, List<JDBackUpOrder> orderList) { |
| | | this.hasMore = hasMore; |
| | | this.orderList = orderList; |
| | | } |
| | | |
| | | public JDOrderForBackUpResult() { |
| | | |
| | | } |
| | | |
| | | public boolean isHasMore() { |
| | | return hasMore; |
| | | } |
| | | |
| | | public void setHasMore(boolean hasMore) { |
| | | this.hasMore = hasMore; |
| | | } |
| | | |
| | | public List<JDBackUpOrder> getOrderList() { |
| | | return orderList; |
| | | } |
| | | |
| | | public void setOrderList(List<JDBackUpOrder> orderList) { |
| | | this.orderList = orderList; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.jd; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Document(collection = "jdOrderBackUp") |
| | | public class JDBackUpOrder { |
| | | |
| | | @Id |
| | | private String id; |
| | | @Indexed |
| | | private Date orderTime; |
| | | private String content; |
| | | //更新时间 |
| | | private Date updateTime; |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Date getOrderTime() { |
| | | return orderTime; |
| | | } |
| | | |
| | | public void setOrderTime(Date orderTime) { |
| | | this.orderTime = orderTime; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.fanli.job.order.jd; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dao.jd.JDOrderBackUpDao; |
| | | import com.yeshi.fanli.dto.jd.JDOrderForBackUpResult; |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private JDOrderBackUpDao jdOrderBackUpDao; |
| | | |
| | | |
| | | /** |
| | | * 保存订单 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @XxlJob("order-jd-backup") |
| | | public ReturnT<String> backUpOrder(String param) throws Exception { |
| | | //更新90天以前的近3天的数据 |
| | | long startTime = System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 90; |
| | | |
| | | for (int i = 0; i < 24 * 3; i++) { |
| | | List<JDBackUpOrder> orderList = getBackUpOrders(new Date(startTime + i * 1000 * 60 * 60L)); |
| | | if (orderList != null && orderList.size() > 0) { |
| | | for (JDBackUpOrder order : orderList) { |
| | | order.setUpdateTime(new Date()); |
| | | jdOrderBackUpDao.save(order); |
| | | } |
| | | } |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | private List<JDBackUpOrder> getBackUpOrders(Date hourDate) { |
| | | List<JDBackUpOrder> jdOrderList = new ArrayList<>(); |
| | | int pageSize = 200; |
| | | int page = 1; |
| | | JDOrderForBackUpResult result = JDApiUtil.getOrderListForBackUp(page++, pageSize, hourDate, JDApiUtil.ORDER_TYPE_UPDATETIME); |
| | | if (result != null) { |
| | | jdOrderList.addAll(result.getOrderList()); |
| | | while (result != null && result.isHasMore()) { |
| | | result = JDApiUtil.getOrderListForBackUp(page++, pageSize, hourDate, JDApiUtil.ORDER_TYPE_UPDATETIME); |
| | | if (result != null) |
| | | jdOrderList.addAll(result.getOrderList()); |
| | | } |
| | | } |
| | | return jdOrderList; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.job.order.taobao; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.fanli.dao.taobao.TaoBaoOrderBackUpDao; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderBackUp; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @title: TaoBaoOrderUpdateJob |
| | | * @description: 淘宝订单更新机制 |
| | | * @date 2021/10/9 16:30 |
| | | */ |
| | | @Component |
| | | public class TaoBaoOrderUpdateJob { |
| | | @Resource |
| | | private CommonOrderService commonOrderService; |
| | | @Resource |
| | | private TaoBaoOrderService taoBaoOrderService; |
| | | @Resource |
| | | private UpdateTBRelationAndSpecialOrderJob updateRelationAndSpecialOrderJob; |
| | | @Resource |
| | | private UpdateOrderJob updateOrderJob; |
| | | @Resource |
| | | private TaoBaoOrderBackUpDao taoBaoOrderBackUpDao; |
| | | |
| | | //更新正在处于付款状态的订单 |
| | | @XxlJob("order-taobao-updatePayStateOrder") |
| | | public ReturnT<String> updatePayStateOrder(String param) throws Exception { |
| | | //更新30天之前的 |
| | | List<CommonOrder> commonOrders = commonOrderService.listPayStateOrder(Constant.SOURCE_TYPE_TAOBAO, new Date(TimeUtil.convertToTimeTemp("20200201", "yyyyMMdd")), new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 30)); |
| | | if (commonOrders == null || commonOrders.size() == 0) { |
| | | throw new Exception("没有订单需要更新"); |
| | | } |
| | | |
| | | Set<String> orderIds = new HashSet<>(); |
| | | for (CommonOrder co : commonOrders) { |
| | | orderIds.add(co.getOrderNo()); |
| | | } |
| | | |
| | | for (String orderId : orderIds) { |
| | | updateTaoBaoOrder(orderId); |
| | | |
| | | } |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | public void updateTaoBaoOrder(String orderId) { |
| | | List<TaoBaoOrder> list = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId); |
| | | try { |
| | | //如果创建时间超过了90天的抛出异常 |
| | | if (list.size() == 0 || TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") < System.currentTimeMillis() - 1000 * 60 * 60L * 24 * 90) |
| | | throw new Exception("需要本地更新"); |
| | | long startTime = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") - 1000L; |
| | | long endTime = TimeUtil.convertToTimeTemp(list.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") + 1000L; |
| | | updateRelationAndSpecialOrderJob.updateRelationAndSpecialOrder(startTime, endTime); |
| | | updateOrderJob.updateOrder(startTime, endTime); |
| | | } catch (Exception e) { |
| | | //从本地备份拿出订单 |
| | | List<String> tradeIds = new ArrayList<>(); |
| | | for (TaoBaoOrder order : list) { |
| | | tradeIds.add(order.getTradeId()); |
| | | } |
| | | List<TaoBaoOrderBackUp> orderBackUps = taoBaoOrderBackUpDao.listByIds(tradeIds); |
| | | List<TaoBaoOrder> orderList = new ArrayList<>(); |
| | | for (TaoBaoOrderBackUp backUp : orderBackUps) { |
| | | orderList.add(TaoKeOrderApiUtil.parseTaoBaoOrderNew(JSONObject.fromObject(backUp.getContent()))); |
| | | } |
| | | updateRelationAndSpecialOrderJob.addRelationAndSpecialOrder(orderList); |
| | | updateOrderJob.addOrder(orderList); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | addRelationAndSpecialOrder(list); |
| | | } |
| | | |
| | | private void addRelationAndSpecialOrder(List<TaoBaoOrder> orderList) { |
| | | public void addRelationAndSpecialOrder(List<TaoBaoOrder> orderList) { |
| | | //5分钟不更新就报警 |
| | | try { |
| | | redisManager.cacheCommonString(RedisKeyEnum.monitor.getKey() + Constant.SOURCE_TYPE_TAOBAO, "1", 60 * 5); |
| | |
| | | package com.yeshi.fanli.job.order.vipshop; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.vipshop.VipShopOrderMapper; |
| | | import com.yeshi.fanli.entity.order.CommonOrder; |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.vipshop.DingDanXiaApiUtil; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | List<VipShopOrder> orders = vipShopOrderService.listByOrderSn(p); |
| | | if (orders == null || orders.size() == 0) |
| | | throw new Exception("订单不存在"); |
| | | Thread.sleep(1000); |
| | | VipShopOrder vipShopOrder = DingDanXiaApiUtil.getOrderDetail(p); |
| | | if (vipShopOrder != null) { |
| | | List<VipShopOrder> vipShopOrderList = new ArrayList<>(); |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Resource |
| | | private CommonOrderService commonOrderService; |
| | | |
| | | @XxlJob("order-vip-updateByLongTimeNoUpdate") |
| | | public ReturnT<String> updateByLongTimeNoUpdate(String param) throws Exception { |
| | | Date maxCreateTime = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 15); |
| | | Date minCreateTime = new Date(maxCreateTime.getTime() - 1000 * 60 * 60 * 24L * 60L); |
| | | VipShopOrderMapper.DaoQuery daoQuery = new VipShopOrderMapper.DaoQuery(); |
| | | daoQuery.orderSubStatusName = "已付款"; |
| | | daoQuery.minCreateTime = minCreateTime; |
| | | daoQuery.maxCreateTime = maxCreateTime; |
| | | long count = vipShopOrderMapper.count(daoQuery); |
| | | if (count > 0) { |
| | | daoQuery.start = 0; |
| | | daoQuery.count = (int) count; |
| | | List<VipShopOrder> orderList = vipShopOrderMapper.list(daoQuery); |
| | | for (VipShopOrder order : orderList) { |
| | | try { |
| | | updateByOrderSn(order.getOrderSn()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | List<CommonOrder> commonOrders = commonOrderService.listPayStateOrder(Constant.SOURCE_TYPE_VIP, null, new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L * 10)); |
| | | if (commonOrders == null || commonOrders.size() == 0) { |
| | | throw new Exception("没有需要更新的订单"); |
| | | } |
| | | Set<String> orderIds = new HashSet<>(); |
| | | for (CommonOrder commonOrder : commonOrders) { |
| | | orderIds.add(commonOrder.getOrderNo()); |
| | | } |
| | | for (String orderId : orderIds) { |
| | | updateByOrderSn(orderId); |
| | | } |
| | | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | |
| | | // 判断所有的订单状态 |
| | | int invalidCount = 0; |
| | | for (TaoBaoOrder tb : taoBaoOrders) { |
| | | if ("订单失效" .equalsIgnoreCase(tb.getOrderState())) { |
| | | if ("订单失效".equalsIgnoreCase(tb.getOrderState())) { |
| | | invalidCount++; |
| | | } |
| | | } |
| | |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(taoBaoOrder); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | |
| | | if ("饿了么" .equalsIgnoreCase(taoBaoOrder.getOrderType())) { |
| | | if ("饿了么".equalsIgnoreCase(taoBaoOrder.getOrderType())) { |
| | | cog.setGoodsId(taoBaoOrder.getTradeId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_ELME); |
| | | TaoBaoOrderGoods goods = taoBaoOrderGoodsMapper.selectByTradeId(taoBaoOrder.getTradeId()); |
| | |
| | | // 判断所有的订单状态 |
| | | int invalidCount = 0; |
| | | for (SuningOrderInfo order : suningOrderList) { |
| | | if ("退款" .equalsIgnoreCase(order.getOrderLineStatusDesc()) |
| | | || "订单已取消" .equalsIgnoreCase(order.getOrderLineStatusDesc())) { |
| | | if ("退款".equalsIgnoreCase(order.getOrderLineStatusDesc()) |
| | | || "订单已取消".equalsIgnoreCase(order.getOrderLineStatusDesc())) { |
| | | invalidCount++; |
| | | } |
| | | } |
| | |
| | | return commonOrderMapper.listByGoodsIdAndUidAndMinThirdCreateTime(goodsId, uid, minThirdCreateTime, 0, 1000); |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrder> listPayStateOrder(int sourceType, Date minThirdCreateTime, Date maxThirdCreateTime) { |
| | | CommonOrderMapper.DaoQuery daoQuery = new CommonOrderMapper.DaoQuery(); |
| | | daoQuery.minThirdCreateTime = minThirdCreateTime; |
| | | daoQuery.maxThirdCreateTime = maxThirdCreateTime; |
| | | daoQuery.state = CommonOrder.STATE_FK; |
| | | daoQuery.sourceType = sourceType; |
| | | daoQuery.sortList = Arrays.asList(new String[]{"co_third_create_time ASC"}); |
| | | return commonOrderMapper.list(daoQuery, 0, 200); |
| | | } |
| | | |
| | | } |
| | |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | public JSONObject getRewardJumpInfo(String orderNo, Integer goodsType,SystemEnum system); |
| | | public JSONObject getRewardJumpInfo(String orderNo, Integer goodsType, SystemEnum system); |
| | | |
| | | /** |
| | | * 根据交易号获取订单详情 |
| | |
| | | */ |
| | | public List<CommonOrder> listByGoodsIdAndUidAndMinThirdCreateTime(Long goodsId, Long uid, Date minThirdCreateTime); |
| | | |
| | | |
| | | /** |
| | | * 获取处于已付款状态的订单 |
| | | * |
| | | * @param sourceType 订单来源类型 |
| | | * @param minThirdCreateTime 最小第三方创建时间 |
| | | * @param maxThirdCreateTime 最大第三方创建时间 |
| | | * @return |
| | | */ |
| | | public List<CommonOrder> listPayStateOrder(int sourceType, Date minThirdCreateTime, Date maxThirdCreateTime); |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.yeshi.fanli.dto.jd.*; |
| | | import com.yeshi.fanli.entity.jd.JDBackUpOrder; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo; |
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo; |
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo; |
| | | import com.yeshi.fanli.dto.jd.JDFilter; |
| | | import com.yeshi.fanli.dto.jd.JDOrderResult; |
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo; |
| | | import com.yeshi.fanli.dto.jd.JDSearchResult; |
| | | import com.yeshi.fanli.dto.jd.JDShopInfo; |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | |
| | | return resultJson.optJSONObject("data").optString("clickURL"); |
| | | } |
| | | |
| | | public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String giftCouponKey, String positionId, |
| | | public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String giftCouponKey, String positionId, |
| | | String subUnionId) { |
| | | String log = "京东转链出错:"; |
| | | try { |
| | |
| | | root = JSONObject.fromObject(root.optString("result")); |
| | | if (root.optInt("code") == 200 && root.optJSONArray("data") != null) { |
| | | |
| | | String date = root.optJSONArray("data").toString(); |
| | | JSONArray data = root.optJSONArray("data"); |
| | | Type typeToken = new TypeToken<List<JDOrder>>() { |
| | | }.getType(); |
| | | List<JDOrder> orderList = new Gson().fromJson(date, typeToken); |
| | | List<JDOrder> orderList = new Gson().fromJson(data.toString(), typeToken); |
| | | if (orderList != null) |
| | | for (JDOrder order : orderList) { |
| | | Map<Long, List<JDOrderItem>> map = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | |
| | | public static JDOrderForBackUpResult getOrderListForBackUp(int page, int pageSize, Date time, int type) { |
| | | JSONObject json = new JSONObject(); |
| | | JSONObject orderReq = new JSONObject(); |
| | | orderReq.put("pageNo", page); |
| | | orderReq.put("pageSize", pageSize); |
| | | orderReq.put("type", type); |
| | | orderReq.put("time", TimeUtil.getGernalTime(time.getTime(), "yyyyMMddHH")); |
| | | |
| | | json.put("orderReq", orderReq); |
| | | String result = baseRequest2("jd.union.open.order.query", null, json); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result).optJSONObject("jd_union_open_order_query_response"); |
| | | if (root.optInt("code") == 0) { |
| | | boolean hasMore = root.optBoolean("hasMore"); |
| | | root = JSONObject.fromObject(root.optString("result")); |
| | | if (root.optInt("code") == 200 && root.optJSONArray("data") != null) { |
| | | List<JDBackUpOrder> orderList = new ArrayList<>(); |
| | | JSONArray data = root.optJSONArray("data"); |
| | | for (int i = 0; i < data.size(); i++) { |
| | | JSONObject item = data.optJSONObject(i); |
| | | String orderId = item.optString("orderId"); |
| | | Long orderTime = item.optLong("orderTime"); |
| | | JDBackUpOrder order = new JDBackUpOrder(); |
| | | order.setId(orderId); |
| | | order.setContent(item.toString()); |
| | | order.setOrderTime(new Date(orderTime )); |
| | | orderList.add(order); |
| | | } |
| | | return new JDOrderForBackUpResult(hasMore, orderList); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static String createLiJin(String sku) { |
| | | JSONObject json = new JSONObject(); |
| | | JSONObject couponReq = new JSONObject(); |
| | |
| | | import com.yeshi.fanli.dto.vipshop.VipShopOrderQueryModel; |
| | | import com.yeshi.fanli.dto.vipshop.VipShopQueryOrderResultDTO; |
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrder; |
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.net.URLEncoder; |
| | |
| | | |
| | | |
| | | public static VipShopOrder getOrderDetail(String orderSn) { |
| | | VipShopOrder vipShopOrder = getOrderDetail(orderSn, null); |
| | | if (vipShopOrder == null) { |
| | | //临时使用 |
| | | return getOrderDetail(orderSn, "B8DCE961C5DBD2F52AAEECB6F307546608445FE3"); |
| | | } |
| | | return vipShopOrder; |
| | | } |
| | | |
| | | public static VipShopOrder getOrderDetail(String orderSn, String accessToken) { |
| | | |
| | | String url = "http://api.tbk.dingdanxia.com/vip/order_details?apikey=" + API_KEY; |
| | | url += "&orderSn=" + orderSn; |
| | | if (!StringUtil.isNullOrEmpty(accessToken)) { |
| | | url += "&access_token=" + accessToken; |
| | | } |
| | | |
| | | String result = HttpUtil.get(url); |
| | | System.out.println(result); |
| | | JSONObject data = JSONObject.fromObject(result); |
| | | if (data.optInt("code") != 200) { |
| | | return null; |
| | | } |
| | | VipShopOrder vipShopOrder = new Gson().fromJson(data.optJSONObject("data").toString(), VipShopOrder.class); |
| | | return vipShopOrder; |
| | | if (data.optJSONObject("data") != null) { |
| | | VipShopOrder vipShopOrder = new Gson().fromJson(data.optJSONObject("data").toString(), VipShopOrder.class); |
| | | return vipShopOrder; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | //获取accesstoken的信息 |
| | | public static String getAcessTokenInfo(String code, String state) { |
| | | String url = "http://api.tbk.dingdanxia.com/user/get_vip_access?apikey=" + API_KEY; |
| | | url += "&code=" + code; |
| | | url += "&state=" + state; |
| | | String result = HttpUtil.get(url); |
| | | return result; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // convertLinkByUrl("6918302458239328477", "123"); |
| | | // convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032"); |
| | | |
| | | |
| | | |
| | | // VipShopOrderQueryModel queryModel = new VipShopOrderQueryModel(); |
| | |
| | | // VipShopQueryOrderResultDTO resultDTO = getOrderList(queryModel); |
| | | // System.out.println(resultDTO); |
| | | |
| | | getOrderDetail("21081436395569"); |
| | | // String result = getAcessTokenInfo("576a51ae7b9b4db1bbfc921cf381ac0c", "1234"); |
| | | // System.out.println(result); |
| | | VipShopOrder order = getOrderDetail("20071472613828"); |
| | | |
| | | |
| | | // System.out.println(order); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | <!--<dubbo:registry address="zookeeper://172.16.16.46:2181"/>--> |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2182"/> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | |
| | | task =false |
| | | outnetwork =false |
| | | test=true |
| | | test=false |
| | |
| | | rocketmq.SecretKey=ixWg90QbYFKP6ae5xpAo2P1qwIyll5 |
| | | #测试 http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | #正式 http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | |
| | | |
| | |
| | | </if> |
| | | order by co_id desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <sql id="listWhere"> |
| | | <if test="query.state!=null"> |
| | | and co_state=#{query.state} |
| | | </if> |
| | | |
| | | <if test="query.minThirdCreateTime!=null"> |
| | | and co_third_create_time>=#{query.minThirdCreateTime} |
| | | </if> |
| | | |
| | | <if test="query.maxThirdCreateTime!=null"> |
| | | and #{query.maxThirdCreateTime}>co_third_create_time |
| | | </if> |
| | | |
| | | <if test="query.sourceType!=null"> |
| | | and co_source_type=#{query.sourceType} |
| | | </if> |
| | | |
| | | |
| | | </sql> |
| | | |
| | | |
| | | <select id="list" |
| | | resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_common_order co WHERE 1=1 |
| | | <include refid="listWhere"> |
| | | |
| | | </include> |
| | | <if test="query.sortList!=null"> |
| | | <foreach collection="query.sortList" open=" order by " separator="," item="item"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | | </delete> |