Merge branch 'new-dev' into 2.0-dev

# Conflicts:
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
#	hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
master
袁野 8 months ago
parent d752345fb2
commit ba05c0d457
  1. 92
      hai-bweb/src/main/java/com/bweb/config/msg/MerStoreAccountChgHandler.java
  2. 1
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 20
      hai-service/src/main/java/com/hai/common/utils/WxUtils.java
  5. 5
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  6. 4
      hai-service/src/main/java/com/hai/config/EtcService.java
  7. 114
      hai-service/src/main/java/com/hai/config/PetroCouponConfig.java
  8. 2
      hai-service/src/main/java/com/hai/etc/impl/EtcCarMsgServiceImpl.java
  9. 8
      hai-service/src/main/resources/dev/commonConfig.properties
  10. 5
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  11. 5
      hai-service/src/main/resources/prod/commonConfig.properties

@ -32,52 +32,52 @@ public class MerStoreAccountChgHandler {
public void init() {
new Thread(() -> {
{
//消息处理
while (true){
try {
//构建的队列为左进右出
Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName());
if (o != null) {
//处理消息
logger.info("消息通道:"+o);
Map<String, Object> param = (Map<String, Object>) o;
if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) {
Map<String, Object> otherParam = new HashMap<>();
otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
merchantStoreAccountService.recharge(
MapUtils.getLong(param, "storeId"),
new BigDecimal(MapUtils.getString(param, "price")),
otherParam);
}
if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) {
Map<String, Object> otherParam = new HashMap<>();
otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
merchantStoreAccountService.consume(
MapUtils.getLong(param, "storeId"),
new BigDecimal(MapUtils.getString(param, "price")),
otherParam);
}
} else {
Thread.sleep(1000);
}
}catch (Exception e){
logger.error("监听订单状态变更错误",e);
}
}
// //消息处理
// while (true){
// try {
// //构建的队列为左进右出
// Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName());
// if (o != null) {
// //处理消息
// logger.info("消息通道:"+o);
//
// Map<String, Object> param = (Map<String, Object>) o;
//
// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) {
// Map<String, Object> otherParam = new HashMap<>();
// otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
// otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
// otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
//
// merchantStoreAccountService.recharge(
// MapUtils.getLong(param, "storeId"),
// new BigDecimal(MapUtils.getString(param, "price")),
// otherParam);
// }
//
// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) {
// Map<String, Object> otherParam = new HashMap<>();
// otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
// otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
// otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
//
// merchantStoreAccountService.consume(
// MapUtils.getLong(param, "storeId"),
// new BigDecimal(MapUtils.getString(param, "price")),
// otherParam);
// }
//
// } else {
// Thread.sleep(1000);
// }
// }catch (Exception e){
// logger.error("监听订单状态变更错误",e);
// }
// }
}
}).start();
}

@ -64,6 +64,7 @@ public class ApiCouponController {
public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) {
try {
PetroConfig.init(type);
JSONObject jsonObject = petroConfig.synCouponRule();

File diff suppressed because one or more lines are too long

@ -687,4 +687,24 @@ public class WxUtils {
}
public static String generateSignSph(Map<String , Object> map , String key) throws Exception {
Set<String> keySet = map.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) || k.equals("secret")) {
continue;
}
if (map.get(k) != null) // 参数值为空,则不参与签名
{
sb.append(k).append("=").append(map.get(k)).append("&");
}
}
sb.append("secret=").append(key);
return MD5Util.encode(sb.toString().getBytes()).toUpperCase();
}
}

@ -171,4 +171,9 @@ public class CommonSysConfig {
private String NdOrgCode;
private String NdKey;
private String SphPostUrl;
private String SphMerchant;
private String SphReqCode;
private String SphSecret;
}

@ -9,12 +9,10 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.context.annotation.Configuration;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
/**

@ -0,0 +1,114 @@
package com.hai.config;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.WxUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* @serviceName .java
* @author Sum1Dream
* @version 1.0.0
* @Description // 中石油卡券
* @createTime 18:33 2023/11/13
**/
@Configuration
public class PetroCouponConfig {
/**
* @Author Sum1Dream
* @Name getCouponList
* @Description // 获取卡券列表
* @Date 11:50 2024/4/7
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponList() throws Exception {
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.reserve");
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getSphMerchant());
paramMap.put("sign", WxUtils.generateSignSph(paramMap , CommonSysConst.getSysConfig().getSphSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getSphPostUrl() , paramSort(paramMap), new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name getCoupon
* @Description // 获取电子券
* @Date 17:19 2024/4/7
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCoupon(String orderNo , String mobile, String reqCode) throws Exception {
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.once");
paramMap.put("batchId" , orderNo);
paramMap.put("mobile" , mobile);
paramMap.put("reqCode" , reqCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getSphMerchant());
paramMap.put("sign", WxUtils.generateSignSph(paramMap , CommonSysConst.getSysConfig().getSphSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getSphPostUrl() , paramSort(paramMap), new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name getCouponQuery
* @Description // 查询电子券信息
* @Date 17:25 2024/4/7
* @Param couponCode
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponQuery(String couponCode ) throws Exception {
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.query");
paramMap.put("couponCode" , couponCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getSphMerchant());
paramMap.put("sign", WxUtils.generateSignSph(paramMap , CommonSysConst.getSysConfig().getSphSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getSphPostUrl() , paramSort(paramMap), new HashMap<>());
}
/**
* @Author Sum1Dream
* @Name getCouponDestroy
* @Description // 作废电子券
* @Date 17:26 2024/4/7
* @Param couponCode
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCouponDestroy(String couponCode ) throws Exception {
JSONObject paramMap = new JSONObject();
paramMap.put("method" , "api.coupon.destroy");
paramMap.put("couponCode" , couponCode);
paramMap.put("merchant" ,CommonSysConst.getSysConfig().getSphMerchant());
paramMap.put("sign", WxUtils.generateSignSph(paramMap , CommonSysConst.getSysConfig().getSphSecret()));
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getSphPostUrl() , paramSort(paramMap), new HashMap<>());
}
private static String paramSort(final Map<String, Object> param) {
Set<String> keySet = param.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (StringUtils.isBlank(sb.toString())) {
sb.append(k).append("=").append(param.get(k));
} else {
sb.append("&").append(k).append("=").append(param.get(k));
}
}
return sb.toString();
}
}

@ -57,11 +57,11 @@ public class EtcCarMsgServiceImpl implements EtcCarMsgService {
insertContractOrder(contractOrder);
}
etcCarMsg.setExt3(car.getString("errMsg"));
etcCarMsg.setExt2(car.toJSONString());
}
etcCarMsg.setExt1(jsonObject.getString("errMsg"));
etcCarMsg.setExt3(jsonObject.toJSONString());
if (etcCarMsg.getId() != null) {
etcCarMsgMapper.updateByPrimaryKey(etcCarMsg);

@ -174,4 +174,10 @@ EtcPrivateKey = MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAO8+KWh/OmBahFk7
#NUODE
NdPostUrl = http://nuode-test.yuetong18.cn/nuode-module-supplier/
NdOrgCode = 19181483-91e9-4e13-9236-fb917ed9529d
NdKey= 5df3f620-e269-458d-9556-87e26d30256a
NdKey= 5df3f620-e269-458d-9556-87e26d30256a
#Sph
SphPostUrl = https://api.coupon.shuangpenghui.com//business/entry
SphMerchant = 355920109860
SphReqCode = z9zhwgk31j2kkk4b
SphSecret = Es9cshhRoDxeFAuGItLZUDi8Qj3PWrje

@ -153,4 +153,7 @@ GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98
#NUODE
NdPostUrl = https://nuode.qianbao18.com/nuode-module-supplier/
NdOrgCode = 414a3d16-30f9-40d1-a2cd-b06066b38708
NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a

@ -158,4 +158,7 @@ GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98
#NUODE
NdPostUrl = https://nuode.qianbao18.com/nuode-module-supplier/
NdOrgCode = 414a3d16-30f9-40d1-a2cd-b06066b38708
NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
NdKey= 4a6a6836-42f5-4ead-8629-ca1265bfb98c
wxZxjzAppId=wxc872cb59b56681a7
wxZxjzAppSecret=9ef7ef25aea61b06e47f349032a74f6a
Loading…
Cancel
Save