diff --git a/.idea/jpa.xml b/.idea/jpa.xml index dbff7c1..607c554 100644 --- a/.idea/jpa.xml +++ b/.idea/jpa.xml @@ -2,8 +2,8 @@ \ No newline at end of file diff --git a/src/main/java/cn/van/business/model/cj/XbMessage.java b/src/main/java/cn/van/business/model/cj/XbMessage.java new file mode 100644 index 0000000..cf52dcf --- /dev/null +++ b/src/main/java/cn/van/business/model/cj/XbMessage.java @@ -0,0 +1,35 @@ +package cn.van.business.model.cj; + +import jakarta.persistence.*; +import jakarta.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDate; + +@Getter +@Setter +@Entity +@Table(name = "xb_message") +public class XbMessage { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "create_date") + private LocalDate createDate; + + @Size(max = 100) + @Column(name = "skuId", length = 100) + private String skuId; + + @Size(max = 10240) + @Column(name = "tip_original_message", length = 10240) + private String tipOriginalMessage; + + @Size(max = 100) + @Column(name = "from_wxid", length = 100) + private String fromWxid; + +} diff --git a/src/main/java/cn/van/business/model/cj/XbMessageItem.java b/src/main/java/cn/van/business/model/cj/XbMessageItem.java new file mode 100644 index 0000000..5eeb519 --- /dev/null +++ b/src/main/java/cn/van/business/model/cj/XbMessageItem.java @@ -0,0 +1,71 @@ +package cn.van.business.model.cj; + +import jakarta.persistence.*; +import jakarta.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDate; + +@Getter +@Setter +@Entity +@Table(name = "xb_message_item") +public class XbMessageItem { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "create_date") + private LocalDate createDate; + + @Size(max = 100) + @Column(name = "skuId", length = 100) + private String skuId; + + @Size(max = 100) + @Column(name = "xb_message_id", length = 100) + private String xbMessageId; + + @Lob + @Column(name = "json_query_result") + private String jsonQueryResult; + + @Lob + @Column(name = "json_couponList") + private String jsonCouponlist; + + @Size(max = 100) + @Column(name = "spuid", length = 100) + private String spuid; + + @Size(max = 1024) + @Column(name = "sku_name", length = 1024) + private String skuName; + + @Lob + @Column(name = "json_shopInfo") + private String jsonShopinfo; + + @Size(max = 1024) + @Column(name = "priceInfo", length = 1024) + private String priceInfo; + + @Size(max = 1024) + @Column(name = "json_commissionInfo", length = 1024) + private String jsonCommissioninfo; + + @Size(max = 1024) + @Column(name = "json_imageList", length = 1024) + private String jsonImagelist; + + @Size(max = 100) + @Column(name = "owner", length = 100) + private String owner; + + @Size(max = 1024) + @Column(name = "json_categoryInfo", length = 1024) + private String jsonCategoryinfo; + +} diff --git a/src/main/java/cn/van/business/repository/XbMessageItemRepository.java b/src/main/java/cn/van/business/repository/XbMessageItemRepository.java new file mode 100644 index 0000000..9f9013e --- /dev/null +++ b/src/main/java/cn/van/business/repository/XbMessageItemRepository.java @@ -0,0 +1,18 @@ +package cn.van.business.repository; + +import cn.van.business.model.cj.XbMessageItem; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * @author Leo + * @version 1.0 + * @create 2025/5/2 19:16 + * @description:评论数据访问层接口 + */ +@Repository +public interface XbMessageItemRepository extends JpaRepository { + + + +} diff --git a/src/main/java/cn/van/business/repository/XbMessageRepository.java b/src/main/java/cn/van/business/repository/XbMessageRepository.java new file mode 100644 index 0000000..ef3e0ad --- /dev/null +++ b/src/main/java/cn/van/business/repository/XbMessageRepository.java @@ -0,0 +1,18 @@ +package cn.van.business.repository; + +import cn.van.business.model.cj.XbMessage; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * @author Leo + * @version 1.0 + * @create 2025/5/2 19:16 + * @description:评论数据访问层接口 + */ +@Repository +public interface XbMessageRepository extends JpaRepository { + + + +} diff --git a/src/main/java/cn/van/business/util/JDUtil.java b/src/main/java/cn/van/business/util/JDUtil.java index 47fe8e3..55962aa 100644 --- a/src/main/java/cn/van/business/util/JDUtil.java +++ b/src/main/java/cn/van/business/util/JDUtil.java @@ -3,14 +3,13 @@ package cn.van.business.util; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import cn.van.business.model.cj.XbMessage; +import cn.van.business.model.cj.XbMessageItem; import cn.van.business.model.jd.JDOrder; import cn.van.business.model.jd.OrderRow; import cn.van.business.model.pl.Comment; import cn.van.business.model.pl.TaobaoComment; -import cn.van.business.repository.CommentRepository; -import cn.van.business.repository.JDOrderRepository; -import cn.van.business.repository.OrderRowRepository; -import cn.van.business.repository.TaobaoCommentRepository; +import cn.van.business.repository.*; import cn.van.business.util.ds.DeepSeekClientUtil; import cn.van.business.util.ds.GPTClientUtil; import com.alibaba.fastjson2.JSON; @@ -128,6 +127,9 @@ public class JDUtil { private final CommentRepository commentRepository; private JDOrderRepository jdOrderRepository; private final TaobaoCommentRepository taobaoCommentRepository; + private final XbMessageRepository xbMessageRepository; + private final XbMessageItemRepository xbMessageItemRepository; + private final OrderUtil orderUtil; private final DeepSeekClientUtil deepSeekClientUtil; @@ -142,15 +144,17 @@ public class JDUtil { // 构造函数中注入StringRedisTemplate @Autowired - public JDUtil(JDOrderRepository jdOrderRepository, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, WXUtil wxUtil, TaobaoCommentRepository taobaoCommentRepository, OrderUtil orderUtil, DeepSeekClientUtil deepSeekClientUtil, CommentRepository commentRepository, GPTClientUtil gptClientUtil) { + public JDUtil(JDOrderRepository jdOrderRepository, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, WXUtil wxUtil, TaobaoCommentRepository taobaoCommentRepository, XbMessageItemRepository xbMessageItemRepository, OrderUtil orderUtil, DeepSeekClientUtil deepSeekClientUtil, CommentRepository commentRepository, XbMessageRepository xbMessageRepository, GPTClientUtil gptClientUtil) { this.jdOrderRepository = jdOrderRepository; this.redisTemplate = redisTemplate; this.orderRowRepository = orderRowRepository; this.wxUtil = wxUtil; this.taobaoCommentRepository = taobaoCommentRepository; + this.xbMessageItemRepository = xbMessageItemRepository; this.orderUtil = orderUtil; this.deepSeekClientUtil = deepSeekClientUtil; this.commentRepository = commentRepository; + this.xbMessageRepository = xbMessageRepository; this.gptClientUtil = gptClientUtil; handleProductWithJF(); } @@ -198,6 +202,7 @@ public class JDUtil { // 2. 生成推广内容 HashMap> contentResult = generatePromotionContent(message, true); + // 3. 发送文本内容 for (String text : contentResult.get("text")) { wxUtil.sendTextMessage(chatRoom_BY, text, 1, chatRoom_BY, true); @@ -1164,242 +1169,242 @@ public class JDUtil { return finallyMessage; } - /** - * { - * "jd_union_open_goods_query_responce": { - * "code": "0", - * "queryResult": { - * "code": 200, - * "data": [ - * { - * "brandCode": "16407", - * "brandName": "松下(Panasonic)", - * "categoryInfo": { - * "cid1": 737, - * "cid1Name": "家用电器", - * "cid2": 794, - * "cid2Name": "大 家 电", - * "cid3": 880, - * "cid3Name": "洗衣机" - * }, - * "comments": 10000, - * "commissionInfo": { - * "commission": 599.95, - * "commissionShare": 5, - * "couponCommission": 592.95, - * "endTime": 1743609599000, - * "isLock": 1, - * "plusCommissionShare": 5, - * "startTime": 1742486400000 - * }, - * "couponInfo": { - * "couponList": [ - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 100, - * "getEndTime": 1746028799000, - * "getStartTime": 1743436800000, - * "isBest": 1, - * "isInputCoupon": 1, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeVJzBK6Q6mfry4nz4ylRYHXsp_NnipDSrReNwGZGTxXhj94SGi9SkzR_7xaWEXLpO2boqow", - * "platformType": 0, - * "quota": 5000, - * "useEndTime": 1746028799000, - * "useStartTime": 1743436800000 - * }, - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 50, - * "getEndTime": 1746028799000, - * "getStartTime": 1743436800000, - * "hotValue": 0, - * "isBest": 0, - * "isInputCoupon": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoervD9YaNNXlsj6OBbZoWSFI1sZXw31PSjK04AH6tFP_Iu0YJlePWBT6sZfNvp14W0QK2K6A", - * "platformType": 0, - * "quota": 5000, - * "useEndTime": 1746028799000, - * "useStartTime": 1743436800000 - * }, - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 40, - * "getEndTime": 1746028799000, - * "getStartTime": 1743436800000, - * "hotValue": 0, - * "isBest": 0, - * "isInputCoupon": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeqQdmhZbv1TiAn0QqI5gnT4g_zAgV5887llN8j6TatV-zpDfReipMr-hKkwQasE9NNUV2uQ", - * "platformType": 0, - * "quota": 500, - * "useEndTime": 1746028799000, - * "useStartTime": 1743436800000 - * }, - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 20, - * "getEndTime": 1746028799000, - * "getStartTime": 1743436800000, - * "hotValue": 0, - * "isBest": 0, - * "isInputCoupon": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoepukjRCuLpbwceODRbBw5HpNLRTVe5Olp99d34Izdo0s9lDtTIdyYZ-uJRCEXnc5N3OZ5LA", - * "platformType": 0, - * "quota": 2000, - * "useEndTime": 1746028799000, - * "useStartTime": 1743436800000 - * }, - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 10, - * "getEndTime": 1746028799000, - * "getStartTime": 1743436800000, - * "hotValue": 0, - * "isBest": 0, - * "isInputCoupon": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeKIIbuvk-VsfJj_m1o3PRHqRaEBIbXHwooEMMt3z44T3cNQTkQsS8TjGnEeIz1obKp_t_mQ", - * "platformType": 0, - * "quota": 1000, - * "useEndTime": 1746028799000, - * "useStartTime": 1743436800000 - * } - * ] - * }, - * "deliveryType": 1, - * "eliteType": [], - * "forbidTypes": [ - * 0 - * ], - * "goodCommentsShare": 99, - * "imageInfo": { - * "imageList": [ - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/273873/17/14072/113544/67ebd215Feef3f56b/fc5156bf59a25ba3.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/273802/16/14273/84419/67ebd224F72dbcc8d/8ffe6f99aeeeb8fd.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/278931/40/12819/81341/67ea0227F41ffc604/ab1c6727e5d4f224.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/276989/12/13440/79310/67ea0226F68c2ed40/8acdeda05aa3596b.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/284503/25/12384/59498/67ea0225F8be60c83/b29ea34abc64346e.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/284667/29/12481/56118/67ea0225F97d9c729/f4c81d77064957bd.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/270959/35/13852/50552/67ea0224F911b8f00/248f9a7751549db7.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/274981/3/13326/48019/67ea0224Fe64bca69/b062218fc8db9b29.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/283691/1/12478/82267/67ea0223Fd4ecb0f5/2c32de327d8aa440.jpg" - * }, - * { - * "url": "https://img14.360buyimg.com/pop/jfs/t1/281457/31/12476/94335/67ea0222Fde76593a/cdddcd59b0b20c9a.jpg" - * } - * ] - * }, - * "inOrderComm30Days": 633170.8, - * "inOrderCount30Days": 3000, - * "inOrderCount30DaysSku": 100, - * "isHot": 1, - * "isJdSale": 1, - * "isOversea": 0, - * "itemId": "BsrqLq5CfIziE7BSl3ItPp8q_3DFaNVYJqfkRRLc7HR", - * "jxFlags": [], - * "materialUrl": "jingfen.jd.com/detail/BsrqLq5CfIziE7BSl3ItPp8q_3DFaNVYJqfkRRLc7HR.html", - * "oriItemId": "BMrqLq5CfIz9X04KC3ItPp8q_3DFaNVYJqfkRRLc7HR", - * "owner": "g", - * "pinGouInfo": {}, - * "pingGouInfo": {}, - * "priceInfo": { - * "lowestCouponPrice": 11899, - * "lowestPrice": 11999, - * "lowestPriceType": 1, - * "price": 11999 - * }, - * "purchasePriceInfo": { - * "basisPriceType": 1, - * "code": 200, - * "couponList": [ - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 100, - * "isBest": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeVJzBK6Q6mfry4nz4ylRYHXsp_NnipDSrReNwGZGTxXhj94SGi9SkzR_7xaWEXLpO2boqow", - * "platformType": 0, - * "quota": 5000 - * }, - * { - * "bindType": 1, - * "couponStatus": 0, - * "couponStyle": 0, - * "discount": 40, - * "isBest": 0, - * "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeqQdmhZbv1TiAn0QqI5gnT4g_zAgV5887llN8j6TatV-zpDfReipMr-hKkwQasE9NNUV2uQ", - * "platformType": 0, - * "quota": 500 - * } - * ], - * "message": "success", - * "purchaseNum": 1, - * "purchasePrice": 11859, - * "thresholdPrice": 11999 - * }, - * "shopInfo": { - * "shopId": 1000001741, - * "shopLabel": "0", - * "shopLevel": 4.9, - * "shopName": "松下洗衣机京东自营旗舰店" - * }, - * "skuName": "松下(Panasonic)白月光4.0Ultra 洗烘套装 10kg滚筒洗衣机+变频热泵烘干机 除毛升级2.0 水氧SPA护理 8532N+8532NR", - * "skuTagList": [ - * { - * "index": 1, - * "name": "自营", - * "type": 11 - * }, - * { - * "index": 1, - * "name": "plus", - * "type": 6 - * }, - * { - * "index": 3, - * "name": "7天无理由退货", - * "type": 12 - * } - * ], - * "spuid": 100137629936, - * "videoInfo": {} - * } - * ], - * "message": "success", - * "requestId": "o_0b721560_m8yp5pqj_88394507", - * "totalCount": 1 - * } - * } - * } - * - * */ + /* + { + "jd_union_open_goods_query_responce": { + "code": "0", + "queryResult": { + "code": 200, + "data": [ + { + "brandCode": "16407", + "brandName": "松下(Panasonic)", + "categoryInfo": { + "cid1": 737, + "cid1Name": "家用电器", + "cid2": 794, + "cid2Name": "大 家 电", + "cid3": 880, + "cid3Name": "洗衣机" + }, + "comments": 10000, + "commissionInfo": { + "commission": 599.95, + "commissionShare": 5, + "couponCommission": 592.95, + "endTime": 1743609599000, + "isLock": 1, + "plusCommissionShare": 5, + "startTime": 1742486400000 + }, + "couponInfo": { + "couponList": [ + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 100, + "getEndTime": 1746028799000, + "getStartTime": 1743436800000, + "isBest": 1, + "isInputCoupon": 1, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeVJzBK6Q6mfry4nz4ylRYHXsp_NnipDSrReNwGZGTxXhj94SGi9SkzR_7xaWEXLpO2boqow", + "platformType": 0, + "quota": 5000, + "useEndTime": 1746028799000, + "useStartTime": 1743436800000 + }, + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 50, + "getEndTime": 1746028799000, + "getStartTime": 1743436800000, + "hotValue": 0, + "isBest": 0, + "isInputCoupon": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoervD9YaNNXlsj6OBbZoWSFI1sZXw31PSjK04AH6tFP_Iu0YJlePWBT6sZfNvp14W0QK2K6A", + "platformType": 0, + "quota": 5000, + "useEndTime": 1746028799000, + "useStartTime": 1743436800000 + }, + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 40, + "getEndTime": 1746028799000, + "getStartTime": 1743436800000, + "hotValue": 0, + "isBest": 0, + "isInputCoupon": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeqQdmhZbv1TiAn0QqI5gnT4g_zAgV5887llN8j6TatV-zpDfReipMr-hKkwQasE9NNUV2uQ", + "platformType": 0, + "quota": 500, + "useEndTime": 1746028799000, + "useStartTime": 1743436800000 + }, + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 20, + "getEndTime": 1746028799000, + "getStartTime": 1743436800000, + "hotValue": 0, + "isBest": 0, + "isInputCoupon": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoepukjRCuLpbwceODRbBw5HpNLRTVe5Olp99d34Izdo0s9lDtTIdyYZ-uJRCEXnc5N3OZ5LA", + "platformType": 0, + "quota": 2000, + "useEndTime": 1746028799000, + "useStartTime": 1743436800000 + }, + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 10, + "getEndTime": 1746028799000, + "getStartTime": 1743436800000, + "hotValue": 0, + "isBest": 0, + "isInputCoupon": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeKIIbuvk-VsfJj_m1o3PRHqRaEBIbXHwooEMMt3z44T3cNQTkQsS8TjGnEeIz1obKp_t_mQ", + "platformType": 0, + "quota": 1000, + "useEndTime": 1746028799000, + "useStartTime": 1743436800000 + } + ] + }, + "deliveryType": 1, + "eliteType": [], + "forbidTypes": [ + 0 + ], + "goodCommentsShare": 99, + "imageInfo": { + "imageList": [ + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/273873/17/14072/113544/67ebd215Feef3f56b/fc5156bf59a25ba3.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/273802/16/14273/84419/67ebd224F72dbcc8d/8ffe6f99aeeeb8fd.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/278931/40/12819/81341/67ea0227F41ffc604/ab1c6727e5d4f224.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/276989/12/13440/79310/67ea0226F68c2ed40/8acdeda05aa3596b.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/284503/25/12384/59498/67ea0225F8be60c83/b29ea34abc64346e.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/284667/29/12481/56118/67ea0225F97d9c729/f4c81d77064957bd.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/270959/35/13852/50552/67ea0224F911b8f00/248f9a7751549db7.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/274981/3/13326/48019/67ea0224Fe64bca69/b062218fc8db9b29.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/283691/1/12478/82267/67ea0223Fd4ecb0f5/2c32de327d8aa440.jpg" + }, + { + "url": "https://img14.360buyimg.com/pop/jfs/t1/281457/31/12476/94335/67ea0222Fde76593a/cdddcd59b0b20c9a.jpg" + } + ] + }, + "inOrderComm30Days": 633170.8, + "inOrderCount30Days": 3000, + "inOrderCount30DaysSku": 100, + "isHot": 1, + "isJdSale": 1, + "isOversea": 0, + "itemId": "BsrqLq5CfIziE7BSl3ItPp8q_3DFaNVYJqfkRRLc7HR", + "jxFlags": [], + "materialUrl": "jingfen.jd.com/detail/BsrqLq5CfIziE7BSl3ItPp8q_3DFaNVYJqfkRRLc7HR.html", + "oriItemId": "BMrqLq5CfIz9X04KC3ItPp8q_3DFaNVYJqfkRRLc7HR", + "owner": "g", + "pinGouInfo": {}, + "pingGouInfo": {}, + "priceInfo": { + "lowestCouponPrice": 11899, + "lowestPrice": 11999, + "lowestPriceType": 1, + "price": 11999 + }, + "purchasePriceInfo": { + "basisPriceType": 1, + "code": 200, + "couponList": [ + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 100, + "isBest": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeVJzBK6Q6mfry4nz4ylRYHXsp_NnipDSrReNwGZGTxXhj94SGi9SkzR_7xaWEXLpO2boqow", + "platformType": 0, + "quota": 5000 + }, + { + "bindType": 1, + "couponStatus": 0, + "couponStyle": 0, + "discount": 40, + "isBest": 0, + "link": "https://coupon.m.jd.com/coupons/show.action?linkKey=AAROH_xIpeffAs_-naABEFoeqQdmhZbv1TiAn0QqI5gnT4g_zAgV5887llN8j6TatV-zpDfReipMr-hKkwQasE9NNUV2uQ", + "platformType": 0, + "quota": 500 + } + ], + "message": "success", + "purchaseNum": 1, + "purchasePrice": 11859, + "thresholdPrice": 11999 + }, + "shopInfo": { + "shopId": 1000001741, + "shopLabel": "0", + "shopLevel": 4.9, + "shopName": "松下洗衣机京东自营旗舰店" + }, + "skuName": "松下(Panasonic)白月光4.0Ultra 洗烘套装 10kg滚筒洗衣机+变频热泵烘干机 除毛升级2.0 水氧SPA护理 8532N+8532NR", + "skuTagList": [ + { + "index": 1, + "name": "自营", + "type": 11 + }, + { + "index": 1, + "name": "plus", + "type": 6 + }, + { + "index": 3, + "name": "7天无理由退货", + "type": 12 + } + ], + "spuid": 100137629936, + "videoInfo": {} + } + ], + "message": "success", + "requestId": "o_0b721560_m8yp5pqj_88394507", + "totalCount": 1 + } + } + } + + */ // 如果需要图片和SKU名称,则代表要把图片下载发过去,还有对应的skuName StringBuilder couponInfo = null; @@ -1407,12 +1412,20 @@ public class JDUtil { String format = null; DateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒"); + Integer xbMessageId = 0; + if (!isCj) { try { priceList = extractPrices(message); finallyMessage.put("priceList", priceList); } catch (Exception ignored) { } + }else { + XbMessage xbMessage = new XbMessage(); + xbMessage.setCreateDate(LocalDate.now()); + xbMessage.setTipOriginalMessage( message); + xbMessage = xbMessageRepository.save(xbMessage); + xbMessageId = xbMessage.getId(); } for (String url : urls) { try { @@ -1427,7 +1440,26 @@ public class JDUtil { continue; } long totalCount = productInfo.getTotalCount(); - + if (isCj){ + if (totalCount == 0){ + // 优惠券 + }else { + // 商品信息 + XbMessageItem xbMessageItem = new XbMessageItem(); + xbMessageItem.setCreateDate(LocalDate.now()); + xbMessageItem.setXbMessageId(String.valueOf(xbMessageId)); + xbMessageItem.setJsonQueryResult(JSONObject.toJSONString(productInfo.getData()[0])); + xbMessageItem.setJsonCouponlist(JSONObject.toJSONString(productInfo.getData()[0].getCouponInfo().getCouponList())); + xbMessageItem.setJsonShopinfo(JSONObject.toJSONString(productInfo.getData()[0].getShopInfo())); + xbMessageItem.setJsonCategoryinfo(JSONObject.toJSONString(productInfo.getData()[0].getCategoryInfo())); + xbMessageItem.setJsonImagelist(JSONObject.toJSONString(productInfo.getData()[0].getImageInfo().getImageList())); + xbMessageItem.setSpuid(String.valueOf(productInfo.getData()[0].getSpuid())); + xbMessageItem.setSkuId(String.valueOf(productInfo.getData()[0].getSkuId())); + xbMessageItem.setSkuName(productInfo.getData()[0].getSkuName()); + xbMessageItem.setOwner(productInfo.getData()[0].getOwner()); + xbMessageItemRepository.save(xbMessageItem); + } + } if (totalCount == 0) { //couponInfo.append("链接类型:优惠券\n\n"); } else { @@ -1516,7 +1548,6 @@ public class JDUtil { finallyMessage.put("data", dataList); finallyMessage.put("urlList", urlList); - } catch (Exception e) { logger.error("处理商品链接时发生异常:{}", url, e); couponInfo.append(" 处理商品链接时发生异常:").append(url).append("\n"); @@ -1543,9 +1574,14 @@ public class JDUtil { finallyMessage.put("text", textList); finallyMessage.put("images", imagesList); finallyMessage.put("finalWenAn", finalWenAn); + return finallyMessage; } + private void cjToDB(){ + new Date(); + + } /** diff --git a/src/main/java/cn/van/business/util/WXUtil.java b/src/main/java/cn/van/business/util/WXUtil.java index 7f7a90d..d186337 100644 --- a/src/main/java/cn/van/business/util/WXUtil.java +++ b/src/main/java/cn/van/business/util/WXUtil.java @@ -48,8 +48,8 @@ public class WXUtil { // 线报来源群 public static Map chatRoom_xb = new HashMap<>(); - // 搬运群,对外带佣金,不带方案 - public static String chatRoom_BY = "50400969285@chatroom"; + // 747|23:38:48|wxid_kr145nk7l0an31|收到群聊|群(50322578882@chatroom)wxid_ytpc72mdoskt22:1 + public static String chatRoom_BY = "50322578882@chatroom"; //群(50006079425@chatroom)wxid_cfmrk2upjtf322:1 public static List chatRoom_JD_Order = new ArrayList<>();