袁野 3 days ago
parent 798802daea
commit 20af3db305
  1. BIN
      bweb/lib/open-api-sdk-2.0-jd.jar
  2. 7
      bweb/pom.xml
  3. 100
      bweb/src/main/java/com/bweb/controller/TestController.java
  4. BIN
      schedule/lib/open-api-sdk-2.0-jd.jar
  5. BIN
      schedule/lib/open-platform-sdk-1.0.21.jar
  6. 21
      schedule/pom.xml
  7. 15
      schedule/src/main/java/com/hfkj/schedule/CouponSchedule.java
  8. 5
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  9. 1
      service/src/main/java/com/hfkj/jd/JdPostService.java
  10. 168
      service/src/main/java/com/hfkj/service/coupon/channel/YouTuCouponService.java
  11. 2
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  12. 23
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  13. 6
      service/src/main/resources/dev/commonConfig.properties
  14. 6
      service/src/main/resources/prod/commonConfig.properties
  15. BIN
      user/lib/open-api-sdk-2.0-jd.jar
  16. BIN
      user/lib/open-platform-sdk-1.0.21.jar
  17. 21
      user/pom.xml

Binary file not shown.

@ -31,6 +31,13 @@
<version>1.0.21</version> <version>1.0.21</version>
<systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath> <systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>jd.skd</groupId>
<artifactId>jd-open-sdk</artifactId>
<scope>system</scope>
<version>2.0</version>
<systemPath>${basedir}/lib/open-api-sdk-2.0-jd.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -6,12 +6,15 @@ import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.*; import com.hfkj.common.utils.*;
import com.hfkj.config.CommonSysConst; import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.jd.JdPostService; import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService; import com.hfkj.jd.JdService;
import com.hfkj.mer.BsMerPayConfigService; import com.hfkj.mer.BsMerPayConfigService;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.service.card.BsUserCardService; 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.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPayService; import com.hfkj.service.order.OrderPayService;
@ -38,12 +41,18 @@ import java.util.*;
@Api(value="测试") @Api(value="测试")
public class TestController { public class TestController {
private static Logger log = LoggerFactory.getLogger(TestController.class); private static Logger log = LoggerFactory.getLogger(TestController.class);
@Resource @Resource
private TradeService huiftTradeService; private TradeService huiftTradeService;
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource @Resource
private JdService jdService; private JdService jdService;
@RequestMapping(value="/thirdPayResult",method = RequestMethod.GET) @RequestMapping(value="/thirdPayResult",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "查询V家园订单交易状态") @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<String , Object> map = new HashMap<>();
map.put("logisticsStatus" , "AGENT_SIGN");
map.put("status" , 2);
List<BsOrderGoods> 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) @RequestMapping(value="/convertFourAreaByDetailStr",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -229,4 +267,66 @@ public class TestController {
return ResponseMsgUtil.exception(e); 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);
}
}
} }

@ -18,6 +18,20 @@
<artifactId>service</artifactId> <artifactId>service</artifactId>
<version>PACKT-SNAPSHOT</version> <version>PACKT-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>meituan.skd</groupId>
<artifactId>meituan-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.21</version>
<systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath>
</dependency>
<dependency>
<groupId>jd.skd</groupId>
<artifactId>jd-open-sdk</artifactId>
<scope>system</scope>
<version>2.0</version>
<systemPath>${basedir}/lib/open-api-sdk-2.0-jd.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -26,6 +40,13 @@
<directory>src/main/resources/${env}</directory> <directory>src/main/resources/${env}</directory>
<filtering>false</filtering> <filtering>false</filtering>
</resource> </resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>

@ -7,6 +7,7 @@ import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.HuiLianTongCouponService; import com.hfkj.service.coupon.channel.HuiLianTongCouponService;
import com.hfkj.service.coupon.channel.PetroConfig; import com.hfkj.service.coupon.channel.PetroConfig;
import com.hfkj.service.coupon.channel.YouTuCouponService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderChildService;
import com.hfkj.service.order.BsOrderService; import com.hfkj.service.order.BsOrderService;
@ -77,13 +78,15 @@ public class CouponSchedule {
// 查询卡券订单 // 查询卡券订单
BsOrderCoupon orderCoupon = orderCouponService.getDetail(coupon.getCouponOrderId()); BsOrderCoupon orderCoupon = orderCouponService.getDetail(coupon.getCouponOrderId());
if (orderCoupon != null) { if (orderCoupon != null) {
JSONObject jsonObject = PetroConfig.couponDetail(coupon.getGoodsVpdSourceCouNo(), orderCoupon.getUserPhone()); JSONObject objectP = new JSONObject();
if (jsonObject.getString("resultCode").equals("0000")) { objectP.put("couponCode" , coupon.getGoodsVpdSourceCouNo());
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); objectP.put("time" , new Date().getTime()/1000);
JSONObject jsonData = JSONObject.parseObject(data);
if (jsonData.getInteger("state") == 40) { JSONObject jsonObject = YouTuCouponService.getMerchantCouponState(objectP);
if (jsonObject.getString("code").equals("success")) {
if (jsonObject.getInteger("state") == 3) {
coupon.setStatus(OrderCouponNoStatusEnum.status3.getCode()); coupon.setStatus(OrderCouponNoStatusEnum.status3.getCode());
coupon.setFinishTime(jsonData.getDate("usedTime")); coupon.setFinishTime(new Date());
orderCouponNoService.editData(coupon); orderCouponNoService.editData(coupon);
} }
} }

@ -160,4 +160,9 @@ public class CommonSysConfig {
private String jDAppKey; private String jDAppKey;
private String jDAppSecret; private String jDAppSecret;
private String ytAccessKey;
private String ytSecretKey;
private String ytPostUrl;
} }

@ -40,6 +40,7 @@ import java.util.List;
* @Date 2024/10/11 下午3:25 * @Date 2024/10/11 下午3:25
**/ **/
public class JdPostService { public class JdPostService {
private static Logger log = LoggerFactory.getLogger(JdPostService.class); private static Logger log = LoggerFactory.getLogger(JdPostService.class);
/** /**

@ -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 "";
}
}

@ -129,7 +129,7 @@ public class OrderCreateService {
orderChild.setBusiness(goodsVpd); orderChild.setBusiness(goodsVpd);
if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type2.getCode())) { if (goodsVpd.getSource().equals(GoodsVpdSourceEnum.type2.getCode())) {
yuShang(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj); 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); couponHlt(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
} }

@ -6,6 +6,7 @@ import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.DateUtil;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.config.CommonSysConst; import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.*; import com.hfkj.entity.*;
import com.hfkj.meituan.MeiTuanService; import com.hfkj.meituan.MeiTuanService;
@ -14,10 +15,7 @@ import com.hfkj.qianzhu.CinemaService;
import com.hfkj.qianzhu.StarbucksService; import com.hfkj.qianzhu.StarbucksService;
import com.hfkj.service.coupon.BsOrderCouponNoService; import com.hfkj.service.coupon.BsOrderCouponNoService;
import com.hfkj.service.coupon.BsOrderCouponService; import com.hfkj.service.coupon.BsOrderCouponService;
import com.hfkj.service.coupon.channel.ChongQingCNPCCouponService; import com.hfkj.service.coupon.channel.*;
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.goods.*; import com.hfkj.service.goods.*;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl; import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
@ -204,14 +202,19 @@ public class OrderPaySuccessService {
orderCouponService.editData(orderCoupon); orderCouponService.editData(orderCoupon);
} else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) { } else if (vpd.getSource() == GoodsVpdSourceEnum.type10.getCode()) {
// 发放卡券
JSONObject jsonObject = PcytCNPCCouponConfig.getCoupon(couponNo.getOrderNo() , orderCoupon.getUserPhone() , orderCoupon.getGoodsVpdKey()); JSONObject objectP = new JSONObject();
if (!jsonObject.getString("code").equals("200")) { objectP.put("id" , orderCoupon.getGoodsVpdKey());
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg")); objectP.put("telephone" , orderCoupon.getUserPhone());
} objectP.put("tradeId" , couponNo.getOrderNo());
JSONObject object = jsonObject.getJSONObject("data"); 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.setExpireTime(vpd.getSalesEndTime());
couponNo.setDeliverTime(new Date()); couponNo.setDeliverTime(new Date());
couponNo.setChannelOrderNo(object.getString("recordId"));
couponNo.setGoodsVpdSourceCouNo(object.getString("couponCode")); couponNo.setGoodsVpdSourceCouNo(object.getString("couponCode"));
couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode()); couponNo.setStatus(OrderCouponNoStatusEnum.status2.getCode());
orderCouponNoService.editData(couponNo); orderCouponNoService.editData(couponNo);

@ -91,6 +91,6 @@ jDPostUrl = https://test-oil.dctpay.com
jDAppKey = C4FF710550C43FE76D4114E1C9C6A0C9 jDAppKey = C4FF710550C43FE76D4114E1C9C6A0C9
jDAppSecret = 873bcbc1d8d64f36832270c2ff59c194 jDAppSecret = 873bcbc1d8d64f36832270c2ff59c194
ytAccessKey=DVNKSHSDHHJ6-TK ytAccessKey=9326673207264334
ytSecretKey=lj2YDjGnqroY1OuR5zriWg== ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY
ytPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open ytPostUrl=https://youtu.95504.net/v4

@ -84,4 +84,8 @@ yuShangPostUrl=http://mbapiq.mbs.scyshy.com/
haiOilPostUrl = https://oil.dctpay.com haiOilPostUrl = https://oil.dctpay.com
haiOilAppid = hf166f4b2ed75e71 haiOilAppid = hf166f4b2ed75e71
haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b haiOilAppSecret = 5a11778cfdd4962282a359397bf4f86b
ytAccessKey=9326673207264334
ytSecretKey=VCLXFV09BNZNMERR9F21KI3LC7L101YY
ytPostUrl= https://sichuan.95504.net/v4

Binary file not shown.

@ -18,6 +18,20 @@
<artifactId>service</artifactId> <artifactId>service</artifactId>
<version>PACKT-SNAPSHOT</version> <version>PACKT-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>meituan.skd</groupId>
<artifactId>meituan-open-sdk</artifactId>
<scope>system</scope>
<version>1.0.21</version>
<systemPath>${basedir}/lib/open-platform-sdk-1.0.21.jar</systemPath>
</dependency>
<dependency>
<groupId>jd.skd</groupId>
<artifactId>jd-open-sdk</artifactId>
<scope>system</scope>
<version>2.0</version>
<systemPath>${basedir}/lib/open-api-sdk-2.0-jd.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -26,6 +40,13 @@
<directory>src/main/resources/${env}</directory> <directory>src/main/resources/${env}</directory>
<filtering>false</filtering> <filtering>false</filtering>
</resource> </resource>
<resource>
<directory>${basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>

Loading…
Cancel
Save