diff --git a/bweb/lib/open-api-sdk-2.0-jd.jar b/bweb/lib/open-api-sdk-2.0-jd.jar
new file mode 100644
index 0000000..6c1b46c
Binary files /dev/null and b/bweb/lib/open-api-sdk-2.0-jd.jar differ
diff --git a/bweb/pom.xml b/bweb/pom.xml
index 6df9864..ab1bd59 100644
--- a/bweb/pom.xml
+++ b/bweb/pom.xml
@@ -31,6 +31,13 @@
1.0.21
${basedir}/lib/open-platform-sdk-1.0.21.jar
+
+ jd.skd
+ jd-open-sdk
+ system
+ 2.0
+ ${basedir}/lib/open-api-sdk-2.0-jd.jar
+
diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java
index 8ea4479..d0b00a6 100644
--- a/bweb/src/main/java/com/bweb/controller/TestController.java
+++ b/bweb/src/main/java/com/bweb/controller/TestController.java
@@ -6,12 +6,15 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.*;
import com.hfkj.config.CommonSysConst;
+import com.hfkj.entity.BsOrderGoods;
import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService;
import com.hfkj.mer.BsMerPayConfigService;
import com.hfkj.model.ResponseData;
import com.hfkj.service.card.BsUserCardService;
+import com.hfkj.service.coupon.channel.YouTuCouponService;
+import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPayService;
@@ -38,12 +41,18 @@ import java.util.*;
@Api(value="测试")
public class TestController {
private static Logger log = LoggerFactory.getLogger(TestController.class);
+
@Resource
private TradeService huiftTradeService;
+
+ @Resource
+ private BsOrderGoodsService orderGoodsService;
+
@Resource
private JdService jdService;
+
@RequestMapping(value="/thirdPayResult",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询V家园订单交易状态")
@@ -212,6 +221,35 @@ public class TestController {
}
+ @RequestMapping(value="/confirmReceipt",method = RequestMethod.GET)
+ @ResponseBody
+ @ApiOperation(value = "confirmReceipt")
+ public ResponseData confirmReceipt() {
+ try {
+ Map map = new HashMap<>();
+
+ map.put("logisticsStatus" , "AGENT_SIGN");
+ map.put("status" , 2);
+
+ List orderGoodsList = orderGoodsService.getList(map);
+
+ for (BsOrderGoods goods : orderGoodsList) {
+
+ // 判断时间是否是十天前
+
+ if (DateUtil.differentDays(goods.getCreateTime() , new Date()) > 10) {
+ orderGoodsService.confirmReceipt(goods.getId());
+ }
+ }
+ return ResponseMsgUtil.success("");
+
+ } catch (Exception e) {
+ log.error("error!",e);
+ return ResponseMsgUtil.exception(e);
+ }
+ }
+
+
@RequestMapping(value="/convertFourAreaByDetailStr",method = RequestMethod.GET)
@ResponseBody
@@ -229,4 +267,66 @@ public class TestController {
return ResponseMsgUtil.exception(e);
}
}
+
+ @RequestMapping(value="/getYouTuCouponList",method = RequestMethod.GET)
+ @ResponseBody
+ @ApiOperation(value = "获取卡券")
+ public ResponseData getYouTuCouponList() {
+ try {
+
+ JSONObject object = new JSONObject();
+ object.put("time" , new Date().getTime()/1000);
+
+ JSONObject jsonObject = YouTuCouponService.getYouTuCouponList(object);
+
+ return ResponseMsgUtil.success(jsonObject);
+
+ } catch (Exception e) {
+ log.error("error!",e);
+ return ResponseMsgUtil.exception(e);
+ }
+ }
+
+ @RequestMapping(value="/getMerchantCouponCode",method = RequestMethod.GET)
+ @ResponseBody
+ @ApiOperation(value = "获取电子券码")
+ public ResponseData getMerchantCouponCode() {
+ try {
+
+ JSONObject object = new JSONObject();
+ object.put("id" , "759");
+ object.put("tradeId" , OrderUtil.generateOrderNo());
+ object.put("time" , new Date().getTime()/1000);
+
+ JSONObject jsonObject = YouTuCouponService.getMerchantCouponCode(object);
+
+ return ResponseMsgUtil.success(jsonObject);
+
+ } catch (Exception e) {
+ log.error("error!",e);
+ return ResponseMsgUtil.exception(e);
+ }
+ }
+
+ @RequestMapping(value="/merchantCouponToMember",method = RequestMethod.GET)
+ @ResponseBody
+ @ApiOperation(value = "获取电子券码")
+ public ResponseData merchantCouponToMember() {
+ try {
+
+ JSONObject object = new JSONObject();
+ object.put("id" , "759");
+ object.put("telephone" , "18090580471");
+ object.put("tradeId" , OrderUtil.generateOrderNo());
+ object.put("time" , new Date().getTime()/1000);
+
+ JSONObject jsonObject = YouTuCouponService.merchantCouponToMember(object);
+
+ return ResponseMsgUtil.success(jsonObject);
+
+ } catch (Exception e) {
+ log.error("error!",e);
+ return ResponseMsgUtil.exception(e);
+ }
+ }
}
diff --git a/schedule/lib/open-api-sdk-2.0-jd.jar b/schedule/lib/open-api-sdk-2.0-jd.jar
new file mode 100644
index 0000000..6c1b46c
Binary files /dev/null and b/schedule/lib/open-api-sdk-2.0-jd.jar differ
diff --git a/schedule/lib/open-platform-sdk-1.0.21.jar b/schedule/lib/open-platform-sdk-1.0.21.jar
new file mode 100644
index 0000000..0cbe24f
Binary files /dev/null and b/schedule/lib/open-platform-sdk-1.0.21.jar differ
diff --git a/schedule/pom.xml b/schedule/pom.xml
index 4a5f85b..c193162 100644
--- a/schedule/pom.xml
+++ b/schedule/pom.xml
@@ -18,6 +18,20 @@
service
PACKT-SNAPSHOT
+
+ meituan.skd
+ meituan-open-sdk
+ system
+ 1.0.21
+ ${basedir}/lib/open-platform-sdk-1.0.21.jar
+
+
+ jd.skd
+ jd-open-sdk
+ system
+ 2.0
+ ${basedir}/lib/open-api-sdk-2.0-jd.jar
+
@@ -26,6 +40,13 @@
src/main/resources/${env}
false
+
+ ${basedir}/lib
+ BOOT-INF/lib/
+
+ **/*.jar
+
+
diff --git a/schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java b/schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java
index 2d38d72..73e0ad5 100644
--- a/schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java
+++ b/schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java
@@ -7,6 +7,7 @@ import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
import com.hfkj.service.coupon.channel.PetroConfig;
+import com.hfkj.service.coupon.channel.YouTuCouponService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService;
@@ -77,13 +78,15 @@ public class CouponSchedule {
// 查询卡券订单
BsOrderCoupon orderCoupon = orderCouponService.getDetail(coupon.getCouponOrderId());
if (orderCoupon != null) {
- JSONObject jsonObject = PetroConfig.couponDetail(coupon.getGoodsVpdSourceCouNo(), orderCoupon.getUserPhone());
- if (jsonObject.getString("resultCode").equals("0000")) {
- String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
- JSONObject jsonData = JSONObject.parseObject(data);
- if (jsonData.getInteger("state") == 40) {
+ JSONObject objectP = new JSONObject();
+ objectP.put("couponCode" , coupon.getGoodsVpdSourceCouNo());
+ objectP.put("time" , new Date().getTime()/1000);
+
+ JSONObject jsonObject = YouTuCouponService.getMerchantCouponState(objectP);
+ if (jsonObject.getString("code").equals("success")) {
+ if (jsonObject.getInteger("state") == 3) {
coupon.setStatus(OrderCouponNoStatusEnum.status3.getCode());
- coupon.setFinishTime(jsonData.getDate("usedTime"));
+ coupon.setFinishTime(new Date());
orderCouponNoService.editData(coupon);
}
}
diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java
index 201da5a..5c8a785 100644
--- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java
+++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java
@@ -160,4 +160,9 @@ public class CommonSysConfig {
private String jDAppKey;
private String jDAppSecret;
+
+ private String ytAccessKey;
+ private String ytSecretKey;
+ private String ytPostUrl;
+
}
diff --git a/service/src/main/java/com/hfkj/jd/JdPostService.java b/service/src/main/java/com/hfkj/jd/JdPostService.java
index 095b2a3..476e459 100644
--- a/service/src/main/java/com/hfkj/jd/JdPostService.java
+++ b/service/src/main/java/com/hfkj/jd/JdPostService.java
@@ -40,6 +40,7 @@ import java.util.List;
* @Date 2024/10/11 下午3:25
**/
public class JdPostService {
+
private static Logger log = LoggerFactory.getLogger(JdPostService.class);
/**
diff --git a/service/src/main/java/com/hfkj/service/coupon/channel/YouTuCouponService.java b/service/src/main/java/com/hfkj/service/coupon/channel/YouTuCouponService.java
new file mode 100644
index 0000000..6e609da
--- /dev/null
+++ b/service/src/main/java/com/hfkj/service/coupon/channel/YouTuCouponService.java
@@ -0,0 +1,168 @@
+package com.hfkj.service.coupon.channel;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.hfkj.common.exception.ErrorCode;
+import com.hfkj.common.exception.ErrorHelp;
+import com.hfkj.common.exception.SysCode;
+import com.hfkj.common.utils.HttpsUtils;
+import com.hfkj.config.CommonSysConst;
+import com.meituan.sqt.utils.EncryptUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Map;
+
+/**
+ * @ClassName MeiTuanService
+ * @Author Sum1Dream
+ * @Description 优涂接口
+ * @Date 2024/8/26 下午4:52
+ **/
+public class YouTuCouponService {
+
+ private static Logger log = LoggerFactory.getLogger(YouTuCouponService.class);
+
+
+ /**
+ * @MethodName getYouTuCouponList
+ * @Description:电子券模板列表
+ * @param param
+ * @return: com.alibaba.fastjson.JSONObject
+ * @Author: Sum1Dream
+ * @Date: 2024/11/19 下午3:38
+ */
+ public static JSONObject getYouTuCouponList(JSONObject param) {
+
+ try {
+ JSONObject object = request( "/openapi/couponV3/getMerchantCouponTpl", param);
+
+ if (object.getInteger("code").equals(200)) {
+ return object.getJSONObject("data");
+ } else {
+ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!");
+ }
+
+ } catch (Exception e) {
+ log.info("响应错误信息:{}", e);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @MethodName getMerchantCouponCode
+ * @Description:获取电子券码
+ * @param param
+ * @return: com.alibaba.fastjson.JSONObject
+ * @Author: Sum1Dream
+ * @Date: 2024/11/19 下午3:38
+ */
+ public static JSONObject getMerchantCouponCode(JSONObject param) {
+
+ try {
+ JSONObject object = request( "/openapi/couponV3/getMerchantCouponCode", param);
+
+ if (object.getInteger("code").equals(200)) {
+ return object.getJSONObject("data");
+ } else {
+ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!");
+ }
+
+ } catch (Exception e) {
+ log.info("响应错误信息:{}", e);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @MethodName merchantCouponToMember
+ * @Description:发送电子券到优途
+ * @param param
+ * @return: com.alibaba.fastjson.JSONObject
+ * @Author: Sum1Dream
+ * @Date: 2024/11/19 下午4:36
+ */
+ public static JSONObject merchantCouponToMember(JSONObject param) {
+
+ try {
+ JSONObject object = request( "/openapi/couponV3/merchantCouponToMember", param);
+
+ if (object.getInteger("code").equals(200)) {
+ return object.getJSONObject("data");
+ } else {
+ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!");
+ }
+
+ } catch (Exception e) {
+ log.info("响应错误信息:{}", e);
+ }
+
+ return null;
+
+ }
+
+ public static JSONObject getMerchantCouponState(JSONObject param) {
+
+ try {
+ JSONObject object = request( "/openapi/couponV3/getMerchantCouponState", param);
+
+ if (object.getInteger("code").equals(200)) {
+ return object.getJSONObject("data");
+ } else {
+ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!");
+ }
+
+ } catch (Exception e) {
+ log.info("响应错误信息:{}", e);
+ }
+
+ return null;
+
+ }
+
+
+ public static JSONObject request(String url , JSONObject param) throws Exception {
+ log.info("获取卡券列表-请求参数: " + JSON.toJSONString(param));
+
+ StringBuilder stringBuffer = new StringBuilder();
+
+ param.put("app_id", CommonSysConst.getSysConfig().getYtAccessKey());
+ JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getYtPostUrl() + url + "?app_id" + CommonSysConst.getSysConfig().getYtAccessKey()
+ + "&sign=" + encryptSha1(String.valueOf(stringBuffer.append(CommonSysConst.getSysConfig().getYtSecretKey()).append(param.toJSONString())))
+ , param);
+ log.info("获取卡券列表-回调参数: " + JSON.toJSONString(response));
+ log.info("========================请求任务End=========================");
+ // 请求接口
+ return response;
+ }
+
+
+ public static String encryptSha1(String input) {
+ try {
+ // Create MD5 Hash
+ MessageDigest md = MessageDigest.getInstance("SHA-1");
+ md.update(input.getBytes(java.nio.charset.StandardCharsets.UTF_8));
+ byte[] digest = md.digest();
+ StringBuffer hexString = new StringBuffer();
+ for (byte b : digest) {
+ String hex = Integer.toHexString(0xff & b);
+ if (hex.length() == 1) hexString.append('0');
+ hexString.append(hex);
+ }
+ return hexString.toString();
+
+ } catch (NoSuchAlgorithmException e) {
+ e.printStackTrace();
+ }
+ return "";
+
+ }
+}
diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java
index 8976c04..80ff8a8 100644
--- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java
+++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java
@@ -129,7 +129,7 @@ public class OrderCreateService {
orderChild.setBusiness(goodsVpd);
if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type2.getCode())) {
yuShang(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
- } else if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type4.getCode())) {
+ } else if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type4.getCode()) || goodsVpd.getSource().equals(GoodsVpdSourceEnum.type10.getCode())) {
couponHlt(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
}
diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
index ffb9fd1..5b5f58e 100644
--- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
+++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
@@ -6,6 +6,7 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil;
+import com.hfkj.common.utils.OrderUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*;
import com.hfkj.meituan.MeiTuanService;
@@ -14,10 +15,7 @@ import com.hfkj.qianzhu.CinemaService;
import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService;
-import com.hfkj.service.coupon.channel.ChongQingCNPCCouponService;
-import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
-import com.hfkj.service.coupon.channel.PcytCNPCCouponConfig;
-import com.hfkj.service.coupon.channel.PetroConfig;
+import com.hfkj.service.coupon.channel.*;
import com.hfkj.service.goods.*;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
@@ -204,14 +202,19 @@ public class OrderPaySuccessService {
orderCouponService.editData(orderCoupon);
} else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) {
- // 发放卡券
- JSONObject jsonObject = PcytCNPCCouponConfig.getCoupon(couponNo.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey());
- if (!jsonObject.getString("code").equals("200")) {
- throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg"));
- }
- JSONObject object = jsonObject.getJSONObject("data");
+
+ JSONObject objectP = new JSONObject();
+ objectP.put("id" , orderCoupon.getGoodsVpdKey());
+ objectP.put("telephone" , orderCoupon.getUserPhone());
+ objectP.put("tradeId" , couponNo.getOrderNo());
+ objectP.put("time" , new Date().getTime()/1000);
+
+ JSONObject jsonObject = YouTuCouponService.merchantCouponToMember(objectP);
+
+ JSONObject object = jsonObject.getJSONObject("response").getJSONArray("records").getJSONObject(0);
couponNo.setExpireTime(vpd.getSalesEndTime());
couponNo.setDeliverTime(new Date());
+ couponNo.setChannelOrderNo(object.getString("recordId"));
couponNo.setGoodsVpdSourceCouNo(object.getString("couponCode"));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo);
diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties
index ca85c56..b492612 100644
--- a/service/src/main/resources/dev/commonConfig.properties
+++ b/service/src/main/resources/dev/commonConfig.properties
@@ -91,6 +91,6 @@ jDPostUrl = https://test-oil.dctpay.com
jDAppKey = C4FF710550C43FE76D4114E1C9C6A0C9
jDAppSecret = 873bcbc1d8d64f36832270c2ff59c194
-ytAccessKey=DVNKSHSDHHJ6-TK
-ytSecretKey=lj2YDjGnqroY1OuR5zriWg==
-ytPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open
+ytAccessKey=9326673207264334
+ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY
+ytPostUrl=https://youtu.95504.net/v4
diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties
index 90aa198..06efae2 100644
--- a/service/src/main/resources/prod/commonConfig.properties
+++ b/service/src/main/resources/prod/commonConfig.properties
@@ -84,4 +84,8 @@ yuShangPostUrl=http://mbapiq.mbs.scyshy.com/
haiOilPostUrl = https://oil.dctpay.com
haiOilAppid = hf166f4b2ed75e71
-haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b
\ No newline at end of file
+haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b
+
+ytAccessKey=9326673207264334
+ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY
+ytPostUrl= https://sichuan.95504.net/v4
\ No newline at end of file
diff --git a/user/lib/open-api-sdk-2.0-jd.jar b/user/lib/open-api-sdk-2.0-jd.jar
new file mode 100644
index 0000000..6c1b46c
Binary files /dev/null and b/user/lib/open-api-sdk-2.0-jd.jar differ
diff --git a/user/lib/open-platform-sdk-1.0.21.jar b/user/lib/open-platform-sdk-1.0.21.jar
new file mode 100644
index 0000000..0cbe24f
Binary files /dev/null and b/user/lib/open-platform-sdk-1.0.21.jar differ
diff --git a/user/pom.xml b/user/pom.xml
index 86a8a25..97d4dda 100644
--- a/user/pom.xml
+++ b/user/pom.xml
@@ -18,6 +18,20 @@
service
PACKT-SNAPSHOT
+
+ meituan.skd
+ meituan-open-sdk
+ system
+ 1.0.21
+ ${basedir}/lib/open-platform-sdk-1.0.21.jar
+
+
+ jd.skd
+ jd-open-sdk
+ system
+ 2.0
+ ${basedir}/lib/open-api-sdk-2.0-jd.jar
+
@@ -26,6 +40,13 @@
src/main/resources/${env}
false
+
+ ${basedir}/lib
+ BOOT-INF/lib/
+
+ **/*.jar
+
+