Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 12 months ago
parent 25034e4938
commit c2cefe0ea1
  1. 12
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 4
      hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java
  4. 1
      hai-service/src/main/java/com/hai/config/CommonConfig.java
  5. 5
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  6. 52
      hai-service/src/main/java/com/hai/config/PetroConfig.java
  7. 2
      hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java
  8. 20
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  9. 25
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  10. 44
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  11. 5
      hai-service/src/main/resources/dev/commonConfig.properties
  12. 19
      hai-service/src/main/resources/prod/commonConfig.properties

@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.ScPetroConfig;
import com.hai.config.PetroConfig;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
import io.swagger.annotations.Api;
@ -51,14 +51,16 @@ public class ApiCouponController {
@RequestMapping(value = "/synCouponRule", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取四川中石油卡券")
public ResponseData synCouponRule() {
@ApiOperation(value = "获取中石油卡券")
public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) {
try {
JSONObject jsonObject = ScPetroConfig.synCouponRule();
PetroConfig.init(type);
JSONObject jsonObject = PetroConfig.synCouponRule();
if (jsonObject.getString("code").equals("1")) {
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONArray jsonArray = JSONArray.parseArray(data);
return ResponseMsgUtil.success(jsonArray);
}

File diff suppressed because one or more lines are too long

@ -285,6 +285,10 @@ public class GoodsOrderController {
jsonObjects.getJSONObject("data").put("orderId" , orderId);
if (jsonObjects.getJSONObject("data") == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "录入失败!");
}
GoodsLogistics logistics = goodsLogisticsService.editLogistics(jsonObjects.getJSONObject("data"));
redisUtil.set("logisticsMsg" + orderId , logistics ,21600);

@ -172,6 +172,7 @@ public class CommonConfig {
}
}
public static JSONObject getLogisticsMsg(String num) {
String appcode = "f9ace4c915054ca697a76fb9a4e1e8c0";

@ -149,4 +149,9 @@ public class CommonSysConfig {
private String ScPetroAppKey;
private String ScPetroAesKey;
private String GzPetroUrl;
private String GzPetroAppid;
private String GzPetroAppKey;
private String GzPetroAesKey;
}

@ -20,17 +20,32 @@ import java.util.*;
* @createTime 18:33 2023/11/13
**/
@Component
public class ScPetroConfig {
public class PetroConfig {
private static final String reqUrl = CommonSysConst.getSysConfig().getScPetroUrl();
private static final String ScPetroAppKey = CommonSysConst.getSysConfig().getScPetroAppKey();
private static final String ScPetroAppid = CommonSysConst.getSysConfig().getScPetroAppid();
private static final String ScPetroAesKey = CommonSysConst.getSysConfig().getScPetroAesKey();
private static String reqUrl;
private static String petroAppKey;
private static String petroAppid;
private static String petroAesKey;
private static final String version = "1.0";
private final static String charset = "UTF-8";
public static void init(Integer type) {
if (type == 1) {
reqUrl = CommonSysConst.getSysConfig().getScPetroUrl();
petroAppKey = CommonSysConst.getSysConfig().getScPetroAppKey();
petroAppid = CommonSysConst.getSysConfig().getScPetroAppid();
petroAesKey = CommonSysConst.getSysConfig().getScPetroAesKey();
} else {
reqUrl = CommonSysConst.getSysConfig().getGzPetroUrl();
petroAppKey = CommonSysConst.getSysConfig().getGzPetroAppKey();
petroAppid = CommonSysConst.getSysConfig().getGzPetroAppid();
petroAesKey = CommonSysConst.getSysConfig().getGzPetroAesKey();
}
}
/**
* @Author Sum1Dream
* @Name synCouponRule
@ -42,7 +57,7 @@ public class ScPetroConfig {
public static JSONObject synCouponRule() throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
@ -52,12 +67,12 @@ public class ScPetroConfig {
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
bizContent = encrypt(bizContent, petroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
@ -76,9 +91,10 @@ public class ScPetroConfig {
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getCoupon(String code , String phone , String orderNo) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
@ -90,12 +106,12 @@ public class ScPetroConfig {
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
bizContent = encrypt(bizContent, petroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
@ -113,7 +129,7 @@ public class ScPetroConfig {
public static JSONObject couponDetail(String ticketNum) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
@ -124,12 +140,12 @@ public class ScPetroConfig {
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
bizContent = encrypt(bizContent, petroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
@ -147,7 +163,7 @@ public class ScPetroConfig {
public static JSONObject cancelCoupon(String ticketNum) throws Exception{
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", ScPetroAppid);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
@ -158,12 +174,12 @@ public class ScPetroConfig {
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, ScPetroAesKey);
bizContent = encrypt(bizContent, petroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, ScPetroAppKey);
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
// 请求接口
@ -245,7 +261,7 @@ public class ScPetroConfig {
*/
public static String decrypt(final String content) {
try {
byte[] raw = ScPetroAesKey.getBytes("UTF-8");
byte[] raw = petroAesKey.getBytes("UTF-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(2, skeySpec);

@ -19,7 +19,7 @@ public class HighCouponCodeOther implements Serializable {
private Long id;
/**
* 类型 1 贵州中石化 2 重庆中石油 3 优惠券 4:黔印象停车券
* 类型 1 贵州中石化 2 重庆中石油 3 优惠券 4:黔印象停车券 5:四川中石油 6贵州中石油
*/
private Integer type;

@ -13,7 +13,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.ScPetroConfig;
import com.hai.config.PetroConfig;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
@ -362,28 +362,34 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
}
} else if (coupon.getCouponSource().equals(7)) {
} else if (coupon.getCouponSource().equals(7) || coupon.getCouponSource().equals(8)) {
if (StringUtils.isBlank(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请填写客户手机号");
}
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号格式错误");
}
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
if (coupon.getCouponSource().equals(7)) {
PetroConfig.init(1);
couponCodeOther.setType(5);
} else {
PetroConfig.init(2);
couponCodeOther.setType(6);
}
// 发放卡券
JSONObject jsonObject = ScPetroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
JSONObject jsonObject = PetroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(5);
couponCodeOther.setCouponAgentCodeId(couponAgentCodeId);
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(ticketListObject.getString("ticket_num"));

@ -11,19 +11,16 @@ import com.hai.common.utils.IDGenerator;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.ScPetroConfig;
import com.hai.dao.HighChildOrderMapper;
import com.hai.config.PetroConfig;
import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighCouponCodeMapperExt;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
import com.hai.model.GzSinopecModel;
import com.hai.model.UserInfoModel;
import com.hai.openApi.config.BlxConfig;
import com.hai.openApi.service.ApiBlxCouponService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderStatus;
import com.hai.order.utils.OrderUtil;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -34,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.net.SocketTimeoutException;
import java.util.*;
/**
@ -527,21 +523,30 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , object.getString("msg"));
}
}
} else if (coupon.getCouponSource().equals(7)) {
} else if (coupon.getCouponSource().equals(7) || coupon.getCouponSource().equals(8)) {
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
if (coupon.getCouponSource().equals(7)) {
PetroConfig.init(1);
couponCodeOther.setType(5);
} else {
PetroConfig.init(2);
couponCodeOther.setType(6);
}
// 发放卡券
JSONObject jsonObject = ScPetroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
JSONObject jsonObject = PetroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(5);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(childOrder.getId());
couponCodeOther.setCouTypeCode(object.getString("request_code"));

@ -8,7 +8,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.config.ChongQingCNPCService;
import com.hai.config.ScPetroConfig;
import com.hai.config.PetroConfig;
import com.hai.dao.HighCouponCodeMapper;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighDiscountAgentCodeMapper;
@ -301,6 +301,7 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
discountAgentCode.setExt2(tradeId);
updateCode(discountAgentCode);
} else if (discount.getUsingRange() == 11) {
PetroConfig.init(1);
List<HighDiscountCouponRel> couponList = couponRelList.stream().filter(o -> o.getHighCoupon().getCouponSource().equals(7)).collect(Collectors.toList());
if (couponList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置四川中石油卡券");
@ -312,12 +313,49 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = ScPetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
JSONObject preSendCoupon = PetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
if (!preSendCoupon.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "系统维护中");
}
String data = ScPetroConfig.decrypt(preSendCoupon.getString("biz_content"));
String data = PetroConfig.decrypt(preSendCoupon.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(3);
couponCodeOther.setDiscountAgentCodeId(discountAgentCode.getId());
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(ticketListObject.getString("ticket_num"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(new Date());
couponCodeOther.setValidEndDate(discount.getSalesEndTime());
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
discountAgentCode.setExt2(tradeId);
updateCode(discountAgentCode);
} else if (discount.getUsingRange() == 12) {
PetroConfig.init(2);
List<HighDiscountCouponRel> couponList = couponRelList.stream().filter(o -> o.getHighCoupon().getCouponSource().equals(8)).collect(Collectors.toList());
if (couponList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券未配置贵州中石油卡券");
}
// 四川中石油业务状态
SecConfig ScStatus = secConfigService.findByCodeType("GZ_PRINTER_STATUS_" + couponList.get(0).getHighCoupon().getCouponKey());
if (ScStatus != null && StringUtils.isNotBlank(ScStatus.getCodeValue())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, ScStatus.getCodeValue());
}
String tradeId = discountAgentCode.getId()+""+System.currentTimeMillis()+"";
// 预发码
JSONObject preSendCoupon = PetroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone() , tradeId);
if (!preSendCoupon.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "系统维护中");
}
String data = PetroConfig.decrypt(preSendCoupon.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;

@ -150,3 +150,8 @@ ScPetroUrl = http://43.136.176.177:8081/hd-api/out/
ScPetroAppid = 510000313181602615
ScPetroAppKey = 510000kA5kxtaDnx3V6HE
ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U
GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000990232626265
GzPetroAppKey = 520000W4S3BRkFhaDsNMM
GzPetroAesKey = A8P2sUnM6PsKPwusiFEDFjMu8Hh8wB79

@ -137,11 +137,16 @@ diandianwAppSecret=msk48q5jinmpsfdgpcyryx6lhkoiii4s
groupCode = https://pay.dctpay.com/cweb?accountId=0001&key=
#ScPetroUrl = http://43.136.176.177:8081/hd-api/out/
#ScPetroAppid = 510000526745391907
#ScPetroAppKey = 5100006xmbmM2NBpm5HXT
#ScPetroAesKey = AueRgSEVwPg87ebYhbYvfxMM3XAkvimu
ScPetroUrl = http://43.136.176.177:8081/hd-api/out/
ScPetroAppid = 510000313181602615
ScPetroAppKey = 510000kA5kxtaDnx3V6HE
ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U
ScPetroAppid = 510000526745391907
ScPetroAppKey = 5100006xmbmM2NBpm5HXT
ScPetroAesKey = AueRgSEVwPg87ebYhbYvfxMM3XAkvimu
#ScPetroUrl = http://43.136.176.177:8081/hd-api/out/
#ScPetroAppid = 510000313181602615
#ScPetroAppKey = 510000kA5kxtaDnx3V6HE
#ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U
GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000087256385445
GzPetroAppKey = 520000eEMUAwVr88FpWWV
GzPetroAesKey = AWppsMKHmj9hd4vtdiR9vdnr5sgv7c8W

Loading…
Cancel
Save