| | |
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.InputStreamReader;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.security.SignatureException;
|
| | |
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Scanner;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.crypto.Mac;
|
| | |
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | | import org.yeshi.utils.wx.WXUtil;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | |
| | | * @throws
|
| | | */
|
| | | @RequestMapping(value = "faquan/haowuquan")
|
| | | public void haoWuQuan(HttpServletRequest request, String content, String sign, PrintWriter out) {
|
| | | if (!sign.equalsIgnoreCase(StringUtil.Md5(content + "banliapp"))) {
|
| | | out.print(JsonUtil.loadFalseResult("签名错误"));
|
| | | return;
|
| | | public void haoWuQuan(HttpServletRequest request, String content, PrintWriter out) {
|
| | | // if (!sign.equalsIgnoreCase(StringUtil.Md5(content + "banliapp"))) {
|
| | | // out.print(JsonUtil.loadFalseResult("签名错误"));
|
| | | // return;
|
| | | // }
|
| | | String contentDecode = "";
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
| | | List<MultipartFile> files = multipartRequest.getFiles("file");
|
| | | try {
|
| | | InputStream input = files.get(0).getInputStream();
|
| | | InputStreamReader reader = new InputStreamReader(input, "UTF-16LE");
|
| | | int d = -1;
|
| | | String st = "";
|
| | | while ((d = reader.read()) != -1) {
|
| | | st += ((char) d);
|
| | | }
|
| | | System.out.println(st);
|
| | | contentDecode = st;
|
| | |
|
| | | contentDecode = contentDecode.substring(contentDecode.indexOf("mtopjsonp1(") + "mtopjsonp1(".length(),
|
| | | contentDecode.length()).trim();
|
| | | if (contentDecode.endsWith(")"))
|
| | | contentDecode = contentDecode.substring(0, contentDecode.length() - 1);
|
| | |
|
| | | System.out.println(contentDecode);
|
| | |
|
| | | reader.close();
|
| | |
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | String contentDecode = StringUtil.getFromBase64(content);
|
| | | JSONObject data = JSONObject.fromObject(contentDecode);
|
| | |
|
| | | JSONObject data = JSONObject.fromObject(contentDecode).optJSONObject("data");
|
| | |
|
| | | JSONArray array = data.optJSONObject("recommend").optJSONArray("resultList");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | for (int i = array.size()-1; i >=0; i--) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | String title = item.optString("itemName");
|
| | | String doc = item.optString("cusShareText");
|
| | | long itemId = item.optLong("itemId");
|
| | | String publishTime=item.optString("cusPublishTime");
|
| | | JSONArray imageArray = item.optJSONArray("imageList");
|
| | | List<String> imgList = new ArrayList<>();
|
| | | for (int j = 0; j < imageArray.size(); j++) {
|
| | |
| | | imgInfo.setW(1);
|
| | | imgInfo.setLarge(false);
|
| | | imgInfo.setUrl(imgList.get(j));
|
| | | if (i != 0) {
|
| | | String sourceImg = imgList.get(j);
|
| | | if (!imgInfo.getUrl().startsWith("http")) {
|
| | | sourceImg = "https:" + imgInfo.getUrl();
|
| | | }
|
| | | imgInfo.setUrl(TbImgUtil.getTBSizeImg(sourceImg, 500));
|
| | | imgInfo.setUrlHD(sourceImg);
|
| | | if (j != 0) {
|
| | | imgInfo.setType(ImgEnum.img);
|
| | | } else {
|
| | | imgInfo.setType(ImgEnum.goods);
|
| | |
| | | imageList.add(imgInfo);
|
| | | }
|
| | |
|
| | | List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HOT, 1, 20);
|
| | |
|
| | | ruleList.get(0).getActivityUser();
|
| | | List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20);
|
| | |
|
| | | ActivityUser user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser();
|
| | | try {
|
| | | goodsEvaluateService.addGoodsEvaluate(itemId, imageList, user, doc, null);
|
| | | goodsEvaluateService.addGoodsEvaluate(itemId, imageList, user, doc, null, null);
|
| | | } catch (GoodsEvaluateException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | |
| | | try {
|
| | | goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods, acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | |
| | | // goods = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods);
|
| | | |
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
| | | }
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | if (jumpLink == null) {
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | }
|
| | | } else {
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods; |
| | | |
| | | public interface TaoBaoOrderGoodsMapper extends BaseMapper<TaoBaoOrderGoods> { |
| | | |
| | | /** |
| | | * 根据交易ID检索 |
| | | * @Title: selectByTradeId |
| | | * @Description: |
| | | * @param tradeId |
| | | * @return |
| | | * TaoBaoOrderGoods 返回类型 |
| | | * @throws |
| | | */ |
| | | public TaoBaoOrderGoods selectByTradeId(String tradeId); |
| | | |
| | | } |
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.persistence.Transient;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | |
| | | private String relationId;
|
| | | @Column(name = "to_trade_id")
|
| | | private String tradeId;// 交易ID
|
| | | @Transient
|
| | | private TaoBaoOrderGoods goods;
|
| | |
|
| | | public TaoBaoOrderGoods getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(TaoBaoOrderGoods goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 淘宝订单商品信息补充表
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_taobao_order_goods")
|
| | | public class TaoBaoOrderGoods {
|
| | | @Column(name = "tog_id")
|
| | | private Long id;
|
| | | @Column(name = "tog_trade_id")
|
| | | private String tradeId;// 交易ID
|
| | | @Column(name = "tog_category_name")
|
| | | private String categoryName;// 类型名称
|
| | | @Column(name = "tog_img")
|
| | | private String img;// 封面图片
|
| | | @Column(name = "tog_title")
|
| | | private String title;// 标题
|
| | | @Column(name = "tog_price")
|
| | | private String price;// 价格
|
| | | @Column(name = "tog_goods_id")
|
| | | private Long goodsId;// 商品ID
|
| | | @Column(name = "tog_link")
|
| | | private String link;// 链接
|
| | | @Column(name = "tog_create_time")
|
| | | private Date createTime;// 创建时间
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
| | | }
|
| | |
|
| | | public void setTradeId(String tradeId) {
|
| | | this.tradeId = tradeId;
|
| | | }
|
| | |
|
| | | public String getCategoryName() {
|
| | | return categoryName;
|
| | | }
|
| | |
|
| | | public void setCategoryName(String categoryName) {
|
| | | this.categoryName = categoryName;
|
| | | }
|
| | |
|
| | | public String getImg() {
|
| | | return img;
|
| | | }
|
| | |
|
| | | public void setImg(String img) {
|
| | | this.img = img;
|
| | | }
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getPrice() {
|
| | | return price;
|
| | | }
|
| | |
|
| | | public void setPrice(String price) {
|
| | | this.price = price;
|
| | | }
|
| | |
|
| | | public Long getGoodsId() {
|
| | | return goodsId;
|
| | | }
|
| | |
|
| | | public void setGoodsId(Long goodsId) {
|
| | | this.goodsId = goodsId;
|
| | | }
|
| | |
|
| | | public String getLink() {
|
| | | return link;
|
| | | }
|
| | |
|
| | | public void setLink(String link) {
|
| | | this.link = link;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderGoodsMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods"> |
| | | <id column="tog_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tog_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <result column="tog_category_name" property="categoryName" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="tog_img" property="img" jdbcType="VARCHAR" /> |
| | | <result column="tog_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="tog_price" property="price" jdbcType="VARCHAR" /> |
| | | <result column="tog_goods_id" property="goodsId" jdbcType="VARCHAR" /> |
| | | <result column="tog_link" property="link" jdbcType="VARCHAR" /> |
| | | <result column="tog_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">tog_id,tog_trade_id,tog_category_name,tog_img,tog_title,tog_price,tog_goods_id,tog_link,tog_create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_order_goods where tog_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByTradeId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_order_goods where tog_trade_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_order_goods where tog_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_taobao_order_goods |
| | | (tog_id,tog_trade_id,tog_category_name,tog_img,tog_title,tog_price,tog_goods_id,tog_link,tog_create_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{tradeId,jdbcType=VARCHAR},#{categoryName,jdbcType=VARCHAR},#{img,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{price,jdbcType=VARCHAR},#{goodsId,jdbcType=VARCHAR},#{link,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_taobao_order_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tog_id,</if> |
| | | <if test="tradeId != null">tog_trade_id,</if> |
| | | <if test="categoryName != null">tog_category_name,</if> |
| | | <if test="img != null">tog_img,</if> |
| | | <if test="title != null">tog_title,</if> |
| | | <if test="price != null">tog_price,</if> |
| | | <if test="goodsId != null">tog_goods_id,</if> |
| | | <if test="link != null">tog_link,</if> |
| | | <if test="createTime != null">tog_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="categoryName != null">#{categoryName,jdbcType=VARCHAR},</if> |
| | | <if test="img != null">#{img,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">#{price,jdbcType=VARCHAR},</if> |
| | | <if test="goodsId != null">#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="link != null">#{link,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods">update |
| | | yeshi_ec_taobao_order_goods set tog_trade_id = |
| | | #{tradeId,jdbcType=VARCHAR},tog_category_name = |
| | | #{categoryName,jdbcType=VARCHAR},tog_img = |
| | | #{img,jdbcType=VARCHAR},tog_title = |
| | | #{title,jdbcType=VARCHAR},tog_price = |
| | | #{price,jdbcType=VARCHAR},tog_goods_id = |
| | | #{goodsId,jdbcType=VARCHAR},tog_link = |
| | | #{link,jdbcType=VARCHAR},tog_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where tog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods"> |
| | | update yeshi_ec_taobao_order_goods |
| | | <set> |
| | | <if test="tradeId != null">tog_trade_id=#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="categoryName != null">tog_category_name=#{categoryName,jdbcType=VARCHAR},</if> |
| | | <if test="img != null">tog_img=#{img,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">tog_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="price != null">tog_price=#{price,jdbcType=VARCHAR},</if> |
| | | <if test="goodsId != null">tog_goods_id=#{goodsId,jdbcType=VARCHAR},</if> |
| | | <if test="link != null">tog_link=#{link,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">tog_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where tog_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | e.printStackTrace(); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | // 按照发布显示时间段起始时间为准。 |
| | | goodsEvaluate.setPublishTime(goodsEvaluate.getStartTime()); |
| | | |
| | | |
| | | List<CommentInfo> comments = evaluateNew.getComments(); |
| | | if (comments != null && comments.size() > 0) { |
| | | EvaluateEnum typeEnum = evaluateNew.getType(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addGoodsEvaluate(Long goodsId, List<ImgInfo> imgList, ActivityUser user, String title, String comment) |
| | | throws GoodsEvaluateException { |
| | | public void addGoodsEvaluate(Long goodsId, List<ImgInfo> imgList, ActivityUser user, String title, String comment, |
| | | Date startTime) throws GoodsEvaluateException { |
| | | if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) { |
| | | throw new GoodsEvaluateException(1, "相关参数不能为空"); |
| | | } |
| | | |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO, goodsId); |
| | | if (evaluateList != null && evaluateList.size() > 0) |
| | | return; |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = null; |
| | | try { |
| | |
| | | goodsEvaluate.setShareNum((int) (Math.random() * 5000) + 1000); |
| | | goodsEvaluate.setShareNumReal(0); |
| | | goodsEvaluate.setWeight(0.0); |
| | | goodsEvaluate.setStartTime(new Date()); |
| | | if (startTime == null) |
| | | startTime = new Date(); |
| | | goodsEvaluate.setStartTime(startTime); |
| | | goodsEvaluate.setEndTime(DateUtil.plusDayDate(3, new Date())); |
| | | goodsEvaluate.setPublishTime(new Date()); |
| | | goodsEvaluate.setCreateTime(new Date()); |
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.transaction.support.DefaultTransactionDefinition;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderGoodsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderTradeMapMapper;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderTradeMap;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | |
| | | @Resource(name = "transactionManager")
|
| | | private DataSourceTransactionManager transactionManager;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderGoodsMapper taoBaoOrderGoodsMapper;
|
| | |
|
| | | /**
|
| | | * 获取订单的哈希值
|
| | | *
|
| | |
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String orderId = its.next();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrder, TaoBaoOrderUtil.getOrderDataHashCode(map.get(orderId)));
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrder,
|
| | | TaoBaoOrderUtil.getOrderDataHashCode(map.get(orderId)));
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (Constant.IS_OUTNET) {
|
| | |
| | | taoBaoOrderTradeMapMapper.insertSelective(map);
|
| | | }
|
| | |
|
| | | // 添加淘宝订单
|
| | | private void insertTaoBaoOrder(TaoBaoOrder taoBaoOrder) {
|
| | | taoBaoOrderMapper.insertSelective(taoBaoOrder);
|
| | | addTaoBaoOrderTradeMap(taoBaoOrder);
|
| | | addTaoBaoOrderGoods(taoBaoOrder.getGoods());
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addTaoBaoOrder(String orderId, List<TaoBaoOrder> list) {
|
| | |
| | | try {
|
| | |
|
| | | LogHelper.test("订单号与订单数量:" + orderId + "-" + list.size());
|
| | | |
| | |
|
| | | // 验证orderby是否正确
|
| | | if (list != null && list.size() > 0) {
|
| | | int maxOrderBy = list.get(0).getOrderBy();
|
| | |
| | | if (oldOrderList == null || oldOrderList.size() == 0) {
|
| | | for (TaoBaoOrder taoBaoOrder : list) {
|
| | | taoBaoOrder.setLatestUpdateTime(new Date());
|
| | | taoBaoOrderMapper.insertSelective(taoBaoOrder);
|
| | | addTaoBaoOrderTradeMap(taoBaoOrder);
|
| | | insertTaoBaoOrder(taoBaoOrder);
|
| | | }
|
| | | } else {
|
| | | if (StringUtil.isNullOrEmpty(oldOrderList.get(0).getTradeId())) {
|
| | | taoBaoOrderMapper.deleteByOrderId(orderId);
|
| | | for (TaoBaoOrder taoBaoOrder : list) {
|
| | | taoBaoOrder.setLatestUpdateTime(new Date());
|
| | | taoBaoOrderMapper.insertSelective(taoBaoOrder);
|
| | | addTaoBaoOrderTradeMap(taoBaoOrder);
|
| | | insertTaoBaoOrder(taoBaoOrder);
|
| | | }
|
| | | } else {
|
| | | // 按tradeId更新
|
| | |
| | | TaoBaoOrder order = taoBaoOrderMapper.selectTaoBaoOrderByTradeId(taoBaoOrder.getTradeId());
|
| | | if (order == null) {
|
| | | taoBaoOrder.setLatestUpdateTime(new Date());
|
| | | taoBaoOrderMapper.insertSelective(taoBaoOrder);
|
| | | addTaoBaoOrderTradeMap(taoBaoOrder);
|
| | | insertTaoBaoOrder(taoBaoOrder);
|
| | | } else {
|
| | | taoBaoOrder.setId(order.getId());
|
| | | if (!StringUtil.isNullOrEmpty(order.getRelationId()))
|
| | |
| | | public Long countOrderByDay(String preDay) {
|
| | | return taoBaoOrderMapper.countOrderByDay(preDay);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addTaoBaoOrderGoods(TaoBaoOrderGoods goods) {
|
| | | if (goods == null || StringUtil.isNullOrEmpty(goods.getTradeId()))
|
| | | return;
|
| | | TaoBaoOrderGoods oldGoods = taoBaoOrderGoodsMapper.selectByTradeId(goods.getTradeId());
|
| | | if (oldGoods != null)
|
| | | return;
|
| | |
|
| | | if (goods.getCreateTime() == null)
|
| | | goods.setCreateTime(new Date());
|
| | | taoBaoOrderGoodsMapper.insertSelective(goods);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.dynamic; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | |
| | | import com.sun.istack.Nullable; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | |
| | | * @param title 标题 必传 |
| | | * @param comment |
| | | */ |
| | | public void addGoodsEvaluate(Long goodsId,List<ImgInfo> imgList, ActivityUser user, String title,String comment) throws GoodsEvaluateException; |
| | | public void addGoodsEvaluate(Long goodsId,List<ImgInfo> imgList, ActivityUser user, String title,String comment,Date startTime) throws GoodsEvaluateException; |
| | | |
| | | |
| | | } |
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods;
|
| | |
|
| | | /**
|
| | | * 淘宝订单服务
|
| | |
| | | public List<TaoBaoOrder> listByStateAndCreateTime(String state, Date minCreateTime, Date maxCreateTime);
|
| | |
|
| | | public Long countOrderByDay(String preDay);
|
| | | |
| | | /**
|
| | | * 添加订单商品
|
| | | * @Title: addTaoBaoOrderGoods
|
| | | * @Description: |
| | | * @param goods |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addTaoBaoOrderGoods(TaoBaoOrderGoods goods);
|
| | | }
|
| | |
| | | OrderMoneyRecievedMQMsg msg = new OrderMoneyRecievedMQMsg(Integer.parseInt(type),
|
| | | Long.parseLong(uid), Integer.parseInt(sourceType), orderNo, moneyMap.get(mapKey),
|
| | | new Date(), 0);
|
| | | LogHelper.test(String.format("批量返利到账订单分发:\n key值:%s \n 内容:", key, new Gson().toJson(msg)));
|
| | | LogHelper.test(String.format("批量返利到账订单分发:\n key值:%s \n 内容:%s", key, new Gson().toJson(msg)));
|
| | | producer.send(MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,
|
| | | OrderTopicTagEnum.orderFanLiSeparateByOrderNo, msg));
|
| | | }
|
| | |
| | | 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.TaoBaoOrderGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoPunishOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | taoBaoOrder.setRelationId(item.optString("relation_id"));
|
| | | taoBaoOrder.setSpecialId(item.optString("special_id"));
|
| | | taoBaoOrder.setTradeId(item.optString("trade_id"));
|
| | | // 解析商品信息
|
| | | TaoBaoOrderGoods goods = new TaoBaoOrderGoods();
|
| | | goods.setCategoryName(item.optString("item_category_name"));
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsId(item.optLong("item_id"));
|
| | | goods.setImg(item.optString("item_img"));
|
| | | goods.setLink(item.optString("item_link"));
|
| | | goods.setPrice(item.optString("item_price"));
|
| | | goods.setTitle(item.optString("item_title"));
|
| | | goods.setTradeId(item.optString("trade_id"));
|
| | | |
| | | taoBaoOrder.setGoods(goods);
|
| | | orderList.add(taoBaoOrder);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(params, app);
|
| | | if (Constant.IS_TEST)
|
| | | System.out.println(json);
|
| | | return parseTaoBaoOrderNew(json.toString());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|