袁野 2 months ago
commit 752e68f359
  1. 22
      order/src/main/resources/prod/logback.xml
  2. 7
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  3. 23
      service/src/main/java/com/hfkj/config/GenerateSign.java
  4. 2
      service/src/main/java/com/hfkj/model/order/orderExport/OrderGoodsExportModel.java
  5. 78
      service/src/main/java/com/hfkj/service/goods/BsOrderMemberService.java
  6. 53
      service/src/main/java/com/hfkj/service/goods/impl/BsOrderMemberServiceImpl.java
  7. 42
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  8. 12
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  9. 4
      service/src/main/java/com/hfkj/sysenum/GoodsVpdSourceEnum.java
  10. 88
      service/src/main/java/com/hfkj/yushang/YuShangService.java
  11. 4
      service/src/main/resources/dev/commonConfig.properties

@ -267,4 +267,26 @@
</logger> </logger>
<!-- 美团接口 --> <!-- 美团接口 -->
<!--美团接口 -->
<appender name="YuShangLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>log/YuShangLog.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>log/YuShangLog/YuShangLog.log.%d.%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>7
<encoder>
<pattern>
%d %p (%file:%line\)- %m%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
</appender>
<logger name="com.hfkj.yushang.YuShangService" level="INFO">
<appender-ref ref="YuShangLog" />
</logger>
<!-- 美团接口 -->
</configuration> </configuration>

@ -138,4 +138,11 @@ public class CommonSysConfig {
private String mtAccessKey; private String mtAccessKey;
private String mtSecretKey; private String mtSecretKey;
private String mtPostUrl; private String mtPostUrl;
/**
* 娱尚接口请求参数
*/
private String yuShangAppKey;
private String yuShangAppSecret;
private String yuShangPostUrl;
} }

@ -39,6 +39,8 @@ public class GenerateSign {
return sb.toString(); return sb.toString();
} }
/** /**
* @MethodName paramSort * @MethodName paramSort
* @Description: 不带key * @Description: 不带key
@ -61,6 +63,27 @@ public class GenerateSign {
return sb.toString(); return sb.toString();
} }
/**
* 生成签名
* @param data 数据
* @param key 秘钥app_secret
* @return 加密结果
*/
public static String paramSortYuShang(final Map<String, Object> data, String key){
Set<String> keySet = data.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (k.equals(WXPayConstants.FIELD_SIGN)) {
continue;
}
sb.append(data.get(k));
}
sb.append(key);
return sb.toString();
}
/** /**
* 生成畅停签名. 注意若含有sign_type字段必须和signType参数保持一致 * 生成畅停签名. 注意若含有sign_type字段必须和signType参数保持一致
* *

@ -113,7 +113,7 @@ public class OrderGoodsExportModel {
public Date updateTime; public Date updateTime;
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("完成时间") @ExcelProperty("签收时间")
public Date finishTime; public Date finishTime;

@ -0,0 +1,78 @@
package com.hfkj.service.goods;
import com.hfkj.entity.BsOrderMember;
import java.util.List;
import java.util.Map;
public interface BsOrderMemberService {
/**
* @MethodName create
* @Description: 创建
* @param orderMember
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:18
*/
void create(BsOrderMember orderMember);
/**
* @MethodName update
* @Description: 更新
* @param orderMember
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:19
*/
void update(BsOrderMember orderMember);
/**
* @MethodName delete
* @Description: 删除
* @param id
* @param fullDelete
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:19
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName queryDetail
* @Description: 查询详情
* @param id
* @return: com.hfkj.entity.BsOrderMember
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:19
*/
BsOrderMember queryDetail(Long id);
/**
* @MethodName findGoodsOrder
* @Description: 根据订单号查询
* @param orderNo
* @return: com.hfkj.entity.BsOrderMember
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:22
*/
BsOrderMember findGoodsOrder(String orderNo);
/**
* @MethodName queryDetailByMap
* @Description: 查询订单详情
* @param map
* @return: com.hfkj.entity.BsOrderMember
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:27
*/
BsOrderMember queryDetailByMap(Map<String , Object> map);
/**
* @MethodName getList
* @Description: 查询订单列表
* @param map
* @return: java.util.List<com.hfkj.entity.BsOrderMember>
* @Author: Sum1Dream
* @Date: 2024/9/5 下午4:27
*/
List<BsOrderMember> getList(Map<String , Object> map);
}

@ -0,0 +1,53 @@
package com.hfkj.service.goods.impl;
import com.hfkj.dao.BsOrderMemberMapper;
import com.hfkj.entity.BsOrderMember;
import com.hfkj.service.goods.BsOrderMemberService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@Service("bsOrderMemberService")
public class BsOrderMemberServiceImpl implements BsOrderMemberService {
@Resource
private BsOrderMemberMapper bsOrderMemberMapper;
@Override
public void create(BsOrderMember orderMember) {
bsOrderMemberMapper.insert(orderMember);
}
@Override
public void update(BsOrderMember orderMember) {
bsOrderMemberMapper.updateByPrimaryKey(orderMember);
}
@Override
public void delete(Long id, Boolean fullDelete) {
bsOrderMemberMapper.deleteByPrimaryKey(id);
}
@Override
public BsOrderMember queryDetail(Long id) {
return bsOrderMemberMapper.selectByPrimaryKey(id);
}
@Override
public BsOrderMember findGoodsOrder(String orderNo) {
return null;
}
@Override
public BsOrderMember queryDetailByMap(Map<String, Object> map) {
return null;
}
@Override
public List<BsOrderMember> getList(Map<String, Object> map) {
return Collections.emptyList();
}
}

@ -67,6 +67,8 @@ public class OrderCreateService {
private GoodsJumpService goodsJumpService; private GoodsJumpService goodsJumpService;
@Resource @Resource
private BsOrderStarbucksService orderStarbucksService; private BsOrderStarbucksService orderStarbucksService;
@Resource
private BsOrderMemberService orderMemberService;
/** /**
* 事务产品 * 事务产品
@ -110,7 +112,45 @@ public class OrderCreateService {
} }
// 虚拟配置 // 虚拟配置
orderChild.setBusiness(goodsVpd); 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())) {
couponHlt(order , orderChild , goodsVpd , goodsMsg , goodsSpecs , businessObj);
}
return orderChild;
}
public void yuShang(OrderModel order, OrderChildModel orderChild , GoodsVpd goodsVpd , GoodsMsg goodsMsg , GoodsSpecs goodsSpecs , JSONObject businessObj ) {
// 创建娱尚订单
BsOrderMember orderMember = new BsOrderMember();
orderMember.setOrderNo(orderChild.getOrderNo());
orderMember.setChildOrderNo(orderChild.getChildOrderNo());
orderMember.setMerId(orderChild.getMerId());
orderMember.setPlatformCode(businessObj.getString("platformCode"));
orderMember.setUserId(order.getUserId());
orderMember.setUserPhone(order.getUserPhone());
orderMember.setGoodsId(goodsMsg.getId());
orderMember.setGoodsName(goodsMsg.getTitle());
orderMember.setGoodsTypeId(goodsMsg.getGoodsType());
orderMember.setGoodsTypeName(goodsMsg.getGoodsTypeName());
orderMember.setGoodsBrandId(goodsMsg.getGoodsBrand());
orderMember.setGoodsBrandName(goodsMsg.getGoodsBrandName());
orderMember.setGoodsSpecsId(goodsSpecs.getId());
orderMember.setGoodsSpecsName(goodsSpecs.getName());
orderMember.setGoodsSpescOriginalPrice(goodsSpecs.getOriginalPrice());
orderMember.setGoodsSpescSalePrice(goodsSpecs.getSalePrice());
orderMember.setGoodsVpdId(goodsVpd.getId());
orderMember.setGoodsVpdKey(goodsVpd.getKey());
orderMember.setGoodsVpdSource(goodsVpd.getSource());
orderMember.setGoodsCount(orderChild.getProductCount());
orderMember.setStatus(OrderChildStatusEnum.status1.getCode());
orderMemberService.create(orderMember);
}
public void couponHlt(OrderModel order, OrderChildModel orderChild , GoodsVpd goodsVpd , GoodsMsg goodsMsg , GoodsSpecs goodsSpecs , JSONObject businessObj ) throws Exception{
// 创建卡券订单 // 创建卡券订单
BsOrderCoupon orderCoupon = new BsOrderCoupon(); BsOrderCoupon orderCoupon = new BsOrderCoupon();
orderCoupon.setOrderNo(orderChild.getOrderNo()); orderCoupon.setOrderNo(orderChild.getOrderNo());
@ -164,8 +204,6 @@ public class OrderCreateService {
} }
orderCouponNoService.editData(orderCouponNo); orderCouponNoService.editData(orderCouponNo);
} }
return orderChild;
} }
public OrderChildModel goods(OrderModel order, OrderChildModel orderChild) throws Exception { public OrderChildModel goods(OrderModel order, OrderChildModel orderChild) throws Exception {

@ -22,6 +22,7 @@ import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.sysenum.GoodsVpdSourceEnum; import com.hfkj.sysenum.GoodsVpdSourceEnum;
import com.hfkj.sysenum.order.*; import com.hfkj.sysenum.order.*;
import com.hfkj.yushang.YuShangService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -113,6 +114,17 @@ public class OrderPaySuccessService {
GoodsVpd vpd = goodsVpdService.queryDetailBySpecsId(childOrder.getProductSpecId()); GoodsVpd vpd = goodsVpdService.queryDetailBySpecsId(childOrder.getProductSpecId());
if (vpd.getSource() == GoodsVpdSourceEnum.type1.getCode()) { if (vpd.getSource() == GoodsVpdSourceEnum.type1.getCode()) {
} else if (vpd.getSource() == GoodsVpdSourceEnum.type2.getCode()) {
Map<String , Object> map = new HashMap<>();
map.put("productCode" , vpd.getKey());
map.put("BuyCount" , childOrder.getProductCount());
map.put("MOrderID" , childOrder.getChildOrderNo());
map.put("ChargeAccount" , childOrder.getChildOrderNo());
// 推送给汇联通 todo dingdan shangsong
// JSONObject returnParam = YuShangService.insertV2(couponNo.getChannelOrderNo());
} else if (vpd.getSource() == GoodsVpdSourceEnum.type4.getCode()) { } else if (vpd.getSource() == GoodsVpdSourceEnum.type4.getCode()) {
// 推送给汇联通 // 推送给汇联通
JSONObject returnParam = HuiLianTongCouponService.costRechargeOrder(couponNo.getChannelOrderNo()); JSONObject returnParam = HuiLianTongCouponService.costRechargeOrder(couponNo.getChannelOrderNo());

@ -12,6 +12,10 @@ public enum GoodsVpdSourceEnum {
* 内部虚拟商品 * 内部虚拟商品
*/ */
type1(1, "内部虚拟商品"), type1(1, "内部虚拟商品"),
/**
* 娱尚虚拟商品
*/
type2(2, "娱尚虚拟商品"),
/** /**
* 贵州中石化 * 贵州中石化
*/ */

@ -0,0 +1,88 @@
package com.hfkj.yushang;
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.common.utils.MD5Util;
import com.hfkj.config.CommonSysConst;
import com.hfkj.config.GenerateSign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Map;
public class YuShangService {
private static Logger log = LoggerFactory.getLogger(YuShangService.class);
/**
* @MethodName insertV2
* @Description: 直充订单提交接口
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/5 下午2:17
*/
public static JSONObject insertV2(Map<String , Object> map) throws Exception {
JSONObject object = request("/Order/InsertV2" , map);
if ( object.getInteger("Code") == 999) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**
* @MethodName queryV2
* @Description: 订单查询接口
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/5 下午2:29
*/
public static JSONObject queryV2(Map<String , Object> map) throws Exception {
JSONObject object = request("Order/QueryV2" , map);
if ( object.getInteger("Code") == 999) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**
* 请求
* @param postUrl 接口请求地址
* @param param 参数
* @return
* @throws Exception
*/
public static JSONObject request(String postUrl, Map<String,Object> param) throws Exception {
log.info("============ 娱尚请求-START =============");
param.put("AppKey", CommonSysConst.getSysConfig().getYuShangAppKey());
param.put("timestamp", new Date().getTime());
param.put("CustomerIP", "127.0.0.1");
param.put("sign", MD5Util.encode(GenerateSign.paramSortYuShang(param,CommonSysConst.getSysConfig().getQianZhuSecret()).getBytes()).toLowerCase());
log.info("请求接口:" + postUrl);
log.info("请求参数:" + JSONObject.toJSONString(param));
JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getYuShangPostUrl()+ postUrl, JSONObject.toJSONString(param));
log.info("响应参数:" + response.toJSONString());
log.info("============ 娱尚请求-END ==============");
return response;
}
}

@ -76,3 +76,7 @@ mtNotifyUrl = https://phg.dctpay.com/order/cinemaNotify/notify
mtAccessKey=DVNKSHSDHHJ6-TK mtAccessKey=DVNKSHSDHHJ6-TK
mtSecretKey=lj2YDjGnqroY1OuR5zriWg== mtSecretKey=lj2YDjGnqroY1OuR5zriWg==
mtPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open mtPostUrl=https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/login/h5/loginFree/redirection?test_open_swimlane=test-open
yuShangAppKey=211394653
yuShangAppSecret=cyQpQKMaGUG186iEZRt1uQ==
yuShangPostUrl=http://mbsmemberwebapi.test.onfishes.com/
Loading…
Cancel
Save