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
袁野 10 months ago
parent 415a13e8ec
commit 9f48149490
  1. 61
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  2. 40
      hai-bweb/src/main/java/com/bweb/controller/ApiProductController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 10
      hai-bweb/src/main/java/com/bweb/controller/OutRechargePriceController.java
  5. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  6. 90
      hai-cweb/src/main/java/com/cweb/controller/HighCouponCodeOtherController.java
  7. 1
      hai-order/src/main/java/com/web/config/AuthConfig.java
  8. 25
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  9. 58
      hai-order/src/main/java/com/web/controller/notify/PetroNotifyController.java
  10. 49
      hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java
  11. 189
      hai-service/src/main/java/com/hai/common/utils/PetroEncryptUtil.java
  12. 30
      hai-service/src/main/java/com/hai/common/utils/WxUtils.java
  13. 5
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  14. 326
      hai-service/src/main/java/com/hai/config/PetroConfig.java
  15. 77
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  16. 38
      hai-service/src/main/java/com/hai/dao/ApiCouponMapper.java
  17. 70
      hai-service/src/main/java/com/hai/dao/ApiCouponSqlProvider.java
  18. 81
      hai-service/src/main/java/com/hai/entity/ApiCoupon.java
  19. 301
      hai-service/src/main/java/com/hai/entity/ApiCouponExample.java
  20. 2
      hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java
  21. 5
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
  22. 14
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  23. 1
      hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java
  24. 12
      hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java
  25. 16
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  26. 30
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  27. 16
      hai-service/src/main/resources/dev/commonConfig.properties
  28. 22
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  29. 21
      hai-service/src/main/resources/prod/commonConfig.properties
  30. 1
      v1/src/main/java/com/v1/config/AuthConfig.java
  31. 97
      v1/src/main/java/com/v1/controller/business/ApiCouponController.java

@ -68,8 +68,8 @@ public class ApiCouponController {
JSONObject jsonObject = petroConfig.synCouponRule();
if (jsonObject.getString("code").equals("1")) {
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
if (jsonObject.getString("resultCode").equals("0000")) {
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONArray jsonArray = JSONArray.parseArray(data);
System.out.println(jsonArray);
@ -78,42 +78,41 @@ public class ApiCouponController {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
apiCoupon = apiCouponService.findCoupon(object.getString("request_code"));
System.out.println(object);
System.out.println(object.getString("request_code"));
System.out.println(apiCoupon);
apiCoupon = apiCouponService.findCoupon(object.getString("alias"));
if (apiCoupon == null ) {
if (object.getInteger("status") == 1 && object.getInteger("total_num") > 0) {
apiCoupon = new ApiCoupon();
apiCoupon.setCode(object.getString("request_code"));
apiCoupon.setDesc(object.getString("ticket_desc"));
apiCoupon.setGoodsType(object.getString("goods_type"));
apiCoupon.setName(object.getString("ticket_name"));
apiCoupon.setEffectiveDays(object.getInteger("effective_days"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setCreateTime(new Date());
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("face_amount"));
apiCouponService.insertCoupon(apiCoupon);
apiCoupon = new ApiCoupon();
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setCreateTime(new Date());
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.insertCoupon(apiCoupon);
} else {
apiCoupon.setCode(object.getString("request_code"));
apiCoupon.setDesc(object.getString("ticket_desc"));
apiCoupon.setName(object.getString("ticket_name"));
apiCoupon.setGoodsType(object.getString("goods_type"));
apiCoupon.setEffectiveDays(object.getInteger("effective_days"));
apiCoupon.setCode(object.getString("alias"));
apiCoupon.setDesc(object.getString("declare"));
apiCoupon.setGoodsType(object.getString("bizType"));
apiCoupon.setName(object.getString("title"));
apiCoupon.setValidType(object.getInteger("validType"));
if (object.getInteger("validType") == 1) {
apiCoupon.setValidDate(object.getDate("validDate"));
}
apiCoupon.setEffectiveDays(object.getInteger("validDate"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setUpdateTime(new Date());
apiCoupon.setPrice(object.getInteger("face_amount"));
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setStatus(object.getInteger("status"));
apiCoupon.setPrice(object.getInteger("faceValue"));
apiCouponService.editCoupon(apiCoupon);
}
}

@ -1,5 +1,6 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -10,6 +11,7 @@ import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.RechargeConfig;
import com.hai.entity.*;
import com.hai.model.OutRechargePriceModel;
import com.hai.model.ResponseData;
@ -342,5 +344,43 @@ public class ApiProductController {
}
}
@RequestMapping(value = "/jNiuGoodsList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询简牛话费产品列表")
public ResponseData jNiuGoodsList() {
try {
JSONObject object = RechargeConfig.jNiuGoodsList();
JSONArray array = object.getJSONArray("data");
List<JSONObject> list = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
JSONObject jsonObject = array.getJSONObject(i);
JSONArray jsonArray = jsonObject.getJSONArray("goodsOption");
for (int j = 0; j < jsonArray.size(); j++) {
JSONObject goodsOption = jsonArray.getJSONObject(j);
JSONArray childArray = goodsOption.getJSONArray("child");
for (int t = 0; t < childArray.size(); t++) {
JSONObject child = childArray.getJSONObject(j);
JSONObject data = new JSONObject();
data.put("title" , jsonObject.getString("sort_title") + goodsOption.getString("name"));
data.put("goodsId" , child.getString("goods_id"));
data.put("goodsOptionId" , child.getString("goods_option_id"));
data.put("platPrice" , child.getString("plat_price"));
data.put("officialPrice" , child.getString("official_price"));
list.add(data);
}
}
}
return ResponseMsgUtil.success(list);
} catch (Exception e) {
log.error("ApiMerchantsController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -260,21 +260,21 @@ public class OutRechargePriceController {
map.put("sourceId" , outRechargePrice.getId());
List<BsRechargeCode> rechargeCodes = bsRechargeCodeService.getListRechargeCode(map);
if ((outRechargePrice.getRechargePlatform().contains("-2-") || outRechargePrice.getRechargePlatform().contains("-3-") || outRechargePrice.getRechargePlatform().contains("-4-") ) && rechargeCodes.size() == 0) {
if ((outRechargePrice.getRechargePlatform().contains("-2-") || outRechargePrice.getRechargePlatform().contains("-3-") || outRechargePrice.getRechargePlatform().contains("-4-") || outRechargePrice.getRechargePlatform().contains("-5-") ) && rechargeCodes.size() == 0) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停平台需要输入商品编码!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停,简牛平台需要输入商品编码!");
}
for (BsRechargeCode rechargeCode : rechargeCodes) {
if ((rechargeCode.getRechargePlatform() == 2 || rechargeCode.getRechargePlatform() == 3 || rechargeCode.getRechargePlatform() == 4) ){
if ((rechargeCode.getRechargePlatform() == 2 || rechargeCode.getRechargePlatform() == 3 || rechargeCode.getRechargePlatform() == 4 || rechargeCode.getRechargePlatform() == 5) ){
if (rechargeCode.getGoodsId() == null) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停平台需要输入商品编码!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停,简牛平台需要输入商品编码!");
}
if (rechargeCode.getGoodsId().length() == 0) {
log.error("OutRechargePriceController -> editPriceStatus() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停平台需要输入商品编码!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "龙阅,城宇,畅停,简牛平台需要输入商品编码!");
}
}

@ -148,6 +148,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/userDiscount/*")
.excludePathPatterns("/highThirdParty/*")
.excludePathPatterns("/group/*")
.excludePathPatterns("/couponCodeOther/*")
;
}

@ -1,9 +1,16 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.PetroConfig;
import com.hai.entity.HighCouponCodeOther;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -22,6 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@ -34,6 +42,12 @@ public class HighCouponCodeOtherController {
@Resource
private HighCouponCodeOtherService highCouponCodeOtherService;
@Resource
private HighOrderService highOrderService;
@Resource
private PetroConfig petroConfig;
@RequestMapping(value = "/getList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询卡券码列表")
@ -54,4 +68,80 @@ public class HighCouponCodeOtherController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/unusedCoupons", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取核销码")
public ResponseData unusedCoupons(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
Map<String,Object> map = new HashMap<>();
map.put("orderId", orderId);
List<HighCouponCodeOther> highCouponCodeOtherServiceList = highCouponCodeOtherService.getList(map);
if (highCouponCodeOtherServiceList.isEmpty()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到核销码!");
}
HighCouponCodeOther couponCodeOther = highCouponCodeOtherServiceList.get(0);
HighOrder highOrder = highOrderService.getOrderById(orderId);
PetroConfig.init(2);
JSONObject jsonObject = petroConfig.getCheckCode(couponCodeOther.getCouNo() , highOrder.getMemPhone());
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject object = JSONObject.parseObject(data);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighCouponCodeOtherController --> getList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/cancelCouponsYt", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "撤销电子券")
public ResponseData cancelCouponsYt(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
Map<String,Object> map = new HashMap<>();
map.put("orderId", orderId);
List<HighCouponCodeOther> highCouponCodeOtherServiceList = highCouponCodeOtherService.getList(map);
HighCouponCodeOther couponCodeOther = highCouponCodeOtherServiceList.get(0);
HighOrder highOrder = highOrderService.getOrderById(orderId);
PetroConfig.init(2);
JSONObject jsonObject = petroConfig.cancelCouponsYt(couponCodeOther.getCouNo() , highOrder.getMemPhone());
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
return ResponseMsgUtil.success(data);
} catch (Exception e) {
log.error("HighCouponCodeOtherController --> getList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/cancelCouponsYtApi", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "撤销电子券")
public ResponseData cancelCouponsYtApi(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
HighOrder highOrder = highOrderService.getOrderById(orderId);
PetroConfig.init(2);
JSONObject jsonObject = petroConfig.cancelCouponsYt(highOrder.getHighChildOrderList().get(0).getExt6() , highOrder.getMemPhone());
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
return ResponseMsgUtil.success(data);
} catch (Exception e) {
log.error("HighCouponCodeOtherController --> getList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -99,6 +99,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/telChargeCallback/*")
.excludePathPatterns("/huiPayNotify/*")
.excludePathPatterns("/groupOrder/*")
.excludePathPatterns("/petroNotify/*")
;
}

@ -743,4 +743,29 @@ public class OrderPayController {
return ResponseMsgUtil.success("");
}
@RequestMapping(value = "counterPay" , method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "聚合收银台")
public ResponseData counterPay(@RequestBody JSONObject body, HttpServletRequest request) {
if (body == null
|| StringUtils.isBlank(body.getString("combineOrderNo"))
|| StringUtils.isBlank(body.getString("openId"))
) {
log.error("wechatCombinePay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String , Object> map = new HashMap<>();
map.put("combineOrderNo" , body.getString("combineOrderNo"));
List<HighOrder> orders = orderService.getOrderList(map);
CombineOrderModel combineOrderModel = new CombineOrderModel();
return ResponseMsgUtil.success("");
}
}

@ -0,0 +1,58 @@
package com.web.controller.notify;
import com.alibaba.fastjson.JSONObject;
import com.hai.config.PetroConfig;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
@Controller
@RequestMapping(value = "/petroNotify")
@Api(value = "中石油业务通知")
public class PetroNotifyController {
private static Logger log = LoggerFactory.getLogger(PetroConfig.class);
@RequestMapping(value = "/petroCallback", method = RequestMethod.POST)
@ApiOperation(value = "中石油回调")
@ResponseBody
public void rechargeCallbackByJj(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
try {
log.info("============回调任务Start=============");
log.info("尖椒订单充值-回调参数: " + jsonObject);
log.info("============回调任务End=============");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter();
JSONObject postJson = new JSONObject();
postJson.put("resultCode" ,"0000");
postJson.put("errMsg" ,"");
writer.write(postJson.toJSONString());
writer.flush();
writer.close();
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
}

@ -7,10 +7,13 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.PetroConfig;
import com.hai.dao.HighCouponAgentCodeMapper;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
import com.hai.openApi.service.ApiCouponService;
import com.hai.service.HighCouponService;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCouponService;
import org.slf4j.Logger;
@ -48,7 +51,10 @@ public class HighCouponSchedule {
private HighOrderService highOrderService;
@Resource
private HuiLianTongConfig huiLianTongConfig;
private ApiCouponService apiCouponService;
@Resource
private PetroConfig petroConfig;
/**
* @Author 胡锐
@ -125,4 +131,45 @@ public class HighCouponSchedule {
}
}
@Scheduled(cron="0 0/15 * * * ?") //每30分钟执行一次
public void handlePetroCouponStatus() throws Exception {
HighCouponCodeOtherExample example = new HighCouponCodeOtherExample();
example.createCriteria().andStatusEqualTo(20).andTypeEqualTo(6);
List<HighCouponCodeOther> otherList = highCouponCodeOtherMapper.selectByExample(example);
for (HighCouponCodeOther couponCodeOther : otherList) {
HighOrder highOrder = highOrderService.getOrderById(couponCodeOther.getOrderId());
ApiCoupon apiCoupon = apiCouponService.findCoupon(couponCodeOther.getCouTypeCode());
PetroConfig.init(apiCoupon.getType());
JSONObject jsonObject = petroConfig.couponDetail(couponCodeOther.getCouNo() , highOrder.getMemPhone());
if (!jsonObject.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前订单未查询到!");
}
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject jsonData = JSONObject.parseObject(data);
if (jsonData.getInteger("state") == 40) {
couponCodeOther.setStatus(jsonData.getInteger("state"));
couponCodeOther.setStationCode(jsonData.getString("station"));
couponCodeOther.setStationName(jsonData.getString("stationName"));
couponCodeOther.setUseTime(jsonData.getDate("usedTime"));
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3);
highOrder.getHighChildOrderList().get(0).setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
}
}
}

@ -0,0 +1,189 @@
package com.hai.common.utils;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Map;
import java.util.TreeMap;
public class PetroEncryptUtil {
/**
* 生成签名
*
* @param signMaps
* @return
* @throws Exception
*/
public static String generateSign(Map<String, Object> signMaps) {
StringBuilder sb = new StringBuilder();
TreeMap<String, Object> sortedMap = new TreeMap<>(signMaps);
// 字典序
for (Map.Entry<String, Object> entry : sortedMap.entrySet()) {
String key = entry.getKey();
String value = (String) entry.getValue();
// 为空不参与签名、参数名区分大小写
if (!"sign".equals(key)) {
sb.append(key).append("=").append(value).append("&");
}
}
sb = new StringBuilder(sb.substring(0, sb.length() - 1));
// MD5加密
return md532(sb.toString());
}
/***
* MD5加码 生成32位md5码
*/
public static String md532(String inStr) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
return "";
}
char[] charArray = inStr.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i = 0; i < charArray.length; i++)
byteArray[i] = (byte) charArray[i];
byte[] md5Bytes = md5.digest(byteArray);
StringBuilder hexValue = new StringBuilder();
for (byte md5Byte : md5Bytes) {
int val = ((int) md5Byte) & 0xff;
if (val < 16)
hexValue.append("0");
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
/**
* 加密解密算法
*
* @param inStr 加密字符串
* @param secretKey 秘钥
* 算法
* 1加密字符串和秘钥转换成字符数组
* 2秘钥去重复
* 3循环一秘钥字符串数组{ 循环二加密字符串数组{
* 秘钥字符的ASC码 加密字符的ASC码 进行二进制异或运算
* }
* }
* 4把字符串转为16进制
*/
private static String convert(String inStr, String secretKey) {
char[] a = inStr.toCharArray();
char[] s = rmRepeated(secretKey).toCharArray();
for (int i = 0; i < s.length; i++) {
for (int j = 0; j < a.length; j++) {
a[j] = (char) (a[j] ^ s[i]);
}
}
return new String(a);
}
/**
* 清除字符串中重复字母算法
*
* @param s
* @return
*/
private static String rmRepeated(String s) {
int len = s.length();
int k = 0;
int count = 0;
String str = "";
char[] c = new char[len];
for (int i = 0; i < len; i++) {
c[i] = s.charAt(i);
}
for (int i = 0; i < len; i++) {
k = i + 1;
while (k < len - count) {
if (c[i] == c[k]) {
for (int j = k; j < len - 1; j++) {
c[j] = c[j + 1];// 出现重复字母,从k位置开始将数组往前挪位
}
count++;// 重复字母出现的次数
k--;
}
k++;
}
}
for (int i = 0; i < len - count; i++) {
str += String.valueOf(c[i]);
}
return str;
}
/*
* 将字符串编码成16进制数字,适用于所有字符包括中文
*/
private static String hexString = "0123456789ABCDEF";
public static String encode(String str) {
// 根据默认编码获取字节数组
String r;
byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
StringBuilder sb = new StringBuilder(bytes.length * 2);
// 将字节数组中每个字节拆解成2位16进制整数
for (byte aByte : bytes) {
sb.append(hexString.charAt((aByte & 0xf0) >> 4));
sb.append(hexString.charAt((aByte & 0x0f)));
}
r = sb.toString();
return r;
}
/*
* 将16进制数字解码成字符串,适用于所有字符包括中文
*/
public static String decode(String bytes) {
String r = "";
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bytes.length() / 2);
// 将每2位16进制整数组装成一个字节
for (int i = 0; i < bytes.length(); i += 2) {
byteArrayOutputStream.write((hexString.indexOf(bytes.charAt(i)) << 4 | hexString.indexOf(bytes.charAt(i + 1))));
}
r = byteArrayOutputStream.toString("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return r;
}
/**
* 加密
*
* @param inStr 原字符串
* @param secretKey 秘钥
* @return
*/
public static String encrypt(String inStr, String secretKey) {
String hexStr = convert(inStr, secretKey);
return encode(hexStr);
}
/**
* 解密
*
* @param inStr 原字符串
* @param secretKey 秘钥
* @return
*/
public static String decrypt(String inStr, String secretKey) {
String hexStr = decode(inStr);
return convert(hexStr, secretKey);
}
}

@ -21,6 +21,7 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.util.*;
@ -533,6 +534,35 @@ public class WxUtils {
}
}
public static String generateSignApi(final Map<String, Object> data, String key, WXPayConstants.SignType signType , Boolean isUpperCase) throws Exception {
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) || k.equals("app_secret")) {
continue;
}
if (k.equals("notify_url")) {
k = URLEncoder.encode(k, "UTF-8");
}
if (data.get(k) != null) // 参数值为空,则不参与签名
{
sb.append(k).append("=").append(data.get(k)).append("&");
}
}
sb.append("app_secret=").append(key);
if (WXPayConstants.SignType.MD5.equals(signType)) {
return MD5(sb.toString() , isUpperCase);
}
else if (WXPayConstants.SignType.HMACSHA256.equals(signType)) {
return HMACSHA256(sb.toString(), key);
}
else {
throw new Exception(String.format("Invalid sign_type: %s", signType));
}
}
/**
* 用SHA1算法生成安全签名
* @param token 票据

@ -116,6 +116,11 @@ public class CommonSysConfig {
private String CyAppSecret;
private String CyPostUrl;
private String JnApiKey;
private String JnNotifyUrl;
private String JnAppSecret;
private String JnPostUrl;
private String unionAppId;
private String unionSecret;
private String unionRsaKey;

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.PetroEncryptUtil;
import com.hai.enum_type.TripartiteReqLogReqType;
import com.hai.enum_type.TripartiteReqLogType;
import com.hai.service.BsTripartiteReqLogService;
@ -67,38 +68,38 @@ public class PetroConfig {
* @return com.alibaba.fastjson.JSONObject
*/
public JSONObject synCouponRule() throws Exception{
public JSONObject synCouponRule() {
log.info("========================请求任务Start=========================");
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
req.put("appId", petroAppid);
req.put("appKey", petroAppKey);
req.put("jsonData" , "");
req.put("timestamp", new Date().getTime() + "");
req.put("nonce" , generateRandomString(16));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("pageSize" , 100);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, petroAesKey);
//加密的内容放到参数中
req.put("biz_content", bizContent);
//生成签名
String sign = createSign(req, petroAppKey);
String sign = PetroEncryptUtil.generateSign(req);
Map<String , Object> postData = new HashMap<>();
postData.put("sign" , sign);
postData.put("timestamp" , req.get("timestamp"));
postData.put("jsonData" , "");
postData.put("nonce" , req.get("nonce"));
postData.put("appId", petroAppid);
//签名放到参数中
req.put("sign", sign);
JSONObject object = HttpsUtils.doPost(reqUrl + "syn-coupon-rule/v1", req , new HashMap<>());
log.info("获取券列表-请求参数: " + JSON.toJSONString(req));
JSONObject object = HttpsUtils.doPost(reqUrl + "/outapi/getCouTypesYt", postData);
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "syn-coupon-rule/v1",
reqUrl + "/outapi/getCouTypesYt",
req.toString(),
object.toString()
);
log.info("购买加油券充值订单-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}
@ -114,39 +115,48 @@ public class PetroConfig {
* @Param orderNo
* @return com.alibaba.fastjson.JSONObject
*/
public JSONObject getCoupon(String code , String phone , String orderNo) throws Exception{
public JSONObject getCoupon(String code , String phone) {
log.info("========================请求任务Start=========================");
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
req.put("appId", petroAppid);
req.put("appKey", petroAppKey);
req.put("timestamp", new Date().getTime() + "");
req.put("nonce" , generateRandomString(16));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("request_code" , code);
billBizContent.put("user_code" , phone);
billBizContent.put("out_trade_no" , orderNo);
JSONObject jsonData = new JSONObject();
jsonData.put("alias" , code);
jsonData.put("businessId" , phone);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, petroAesKey);
String bizContent = JSONObject.toJSONString(jsonData);
bizContent = encrypt(bizContent);
//加密的内容放到参数中
req.put("biz_content", bizContent);
req.put("jsonData", bizContent);
//生成签名
String sign = createSign(req, petroAppKey);
//签名放到参数中
req.put("sign", sign);
JSONObject object = HttpsUtils.doPost(reqUrl + "get-coupon", req , new HashMap<>());
String sign = PetroEncryptUtil.generateSign(req);
Map<String , Object> postData = new HashMap<>();
postData.put("sign" , sign);
postData.put("timestamp" , req.get("timestamp"));
postData.put("jsonData" , bizContent);
postData.put("nonce" , req.get("nonce"));
postData.put("appId", petroAppid);
log.info("获取电子券-请求参数: " + JSON.toJSONString(req));
JSONObject object = HttpsUtils.doPost(reqUrl + "/outapi/getCouponYt", postData);
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "get-coupon",
reqUrl + "/outapi/getCouponYt",
req.toString(),
object.toString()
);
log.info("获取电子券-回调参数: " + JSON.toJSONString(object));
log.info("========================请求任务End=========================");
// 请求接口
return object;
}
@ -154,39 +164,46 @@ public class PetroConfig {
/**
* @Author Sum1Dream
* @Name couponDetail
* @Description // 获取静态码
* @Description // 查询电子券状态
* @Date 11:20 2023/11/17
* @Param ticketNum
* @return com.alibaba.fastjson.JSONObject
*/
public JSONObject couponDetail(String ticketNum) throws Exception{
public JSONObject couponDetail(String ticketNum , String phone) throws Exception{
log.info("========================请求任务Start=========================");
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
req.put("appId", petroAppid);
req.put("appKey", petroAppKey);
req.put("timestamp", new Date().getTime() + "");
req.put("nonce" , generateRandomString(16));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("ticket_num" , ticketNum);
JSONObject jsonData = new JSONObject();
jsonData.put("voucher" , ticketNum);
jsonData.put("businessId" , phone);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, petroAesKey);
String bizContent = JSONObject.toJSONString(jsonData);
bizContent = encrypt(bizContent);
//加密的内容放到参数中
req.put("biz_content", bizContent);
req.put("jsonData", bizContent);
//生成签名
String sign = createSign(req, petroAppKey);
String sign = PetroEncryptUtil.generateSign(req);
//签名放到参数中
req.put("sign", sign);
log.info("============请求任务Start=============");
log.info("购买加油券充值订单-请求参数: " + JSON.toJSONString(req));
Map<String , Object> postData = new HashMap<>();
postData.put("sign" , sign);
postData.put("timestamp" , req.get("timestamp"));
postData.put("jsonData" , bizContent);
postData.put("nonce" , req.get("nonce"));
postData.put("appId", petroAppid);
log.info("查询电子券状态-请求参数: " + JSON.toJSONString(req));
// 请求接口
JSONObject object = HttpsUtils.doPost(reqUrl + "couponDetail", req , new HashMap<>());
JSONObject object = HttpsUtils.doPost(reqUrl + "/outapi/getStateYt", postData);
log.info("购买加油券充值订单-回调参数: " + JSON.toJSONString(object));
log.info("查询电子券状态-回调参数: " + JSON.toJSONString(object));
reqLogService.insert(
TripartiteReqLogType.type18,
@ -202,123 +219,154 @@ public class PetroConfig {
/**
* @Author Sum1Dream
* @Name cancelCoupon
* @Description // 作废下单
* @Date 11:21 2023/11/17
* @Name unusedCoupons
* @Description // 获取核销码
* @Date 14:32 2024/1/31
* @Param ticketNum
* @Param phone
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject cancelCoupon(String ticketNum) throws Exception{
public JSONObject getCheckCode(String ticketNum , String phone) throws Exception{
log.info("========================请求任务Start=========================");
Map<String, Object> req = new HashMap<>();
req.put("version", version);
req.put("appid", petroAppid);
req.put("signtype", "MD5");
req.put("timestamp", DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS));
req.put("appId", petroAppid);
req.put("appKey", petroAppKey);
req.put("timestamp", new Date().getTime() + "");
req.put("nonce" , generateRandomString(16));
// 业务数据
JSONObject billBizContent = new JSONObject();
billBizContent.put("ticket_num" , ticketNum);
JSONObject jsonData = new JSONObject();
jsonData.put("voucher" , ticketNum);
jsonData.put("businessId" , phone);
//业务内容加密
String bizContent = JSONObject.toJSONString(billBizContent);
bizContent = encrypt(bizContent, petroAesKey);
String bizContent = JSONObject.toJSONString(jsonData);
bizContent = encrypt(bizContent);
//加密的内容放到参数中
req.put("biz_content", bizContent);
req.put("jsonData", bizContent);
//生成签名
String sign = createSign(req, petroAppKey);
String sign = PetroEncryptUtil.generateSign(req);
//签名放到参数中
req.put("sign", sign);
Map<String , Object> postData = new HashMap<>();
postData.put("sign" , sign);
postData.put("timestamp" , req.get("timestamp"));
postData.put("jsonData" , bizContent);
postData.put("nonce" , req.get("nonce"));
postData.put("appId", petroAppid);
log.info("查询电子券状态-请求参数: " + JSON.toJSONString(req));
// 请求接口
return HttpsUtils.doPost(reqUrl + "cancelCoupon", req , new HashMap<>());
JSONObject object = HttpsUtils.doPost(reqUrl + "/outapi/getCheckCode", postData);
log.info("查询电子券状态-回调参数: " + JSON.toJSONString(object));
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "get-coupon",
req.toString(),
object.toString()
);
return object;
}
/**
* @param params 签名params null和""不参与签名
* @param key 密钥
* @return 签名code
*/
public static String createSign(Map<String, Object> params, String key) {
if (StringUtils.isEmpty(key)) {
return null;
}
if (params == null || params.keySet() == null || params.keySet().isEmpty()) {
return null;
}
Object[] parKeys = params.keySet().toArray();
Arrays.sort(parKeys);
StringBuffer temp = new StringBuffer();
boolean first = true;
for (Object parKey : parKeys) {
String parKeyStr = null;
if(parKey != null){
parKeyStr = parKey.toString();
}
if ("sign".equals(parKeyStr)) {
continue;
}
if (first) {
first = false;
} else {
temp.append("&");
}
Object value = params.get(parKey);
if (value != null) {
String v = value.toString();
if (!"".equals(v)) {
temp.append(parKey).append("=").append(value.toString());
}
}
}
temp.append("&").append("key").append("=").append(key);
return DigestUtils.md5Hex(temp.toString());
* @Author Sum1Dream
* @Name cancelCouponsYt
* @Description // 注销电子券
* @Date 15:19 2024/1/31
* @Param ticketNum
* @Param phone
* @return com.alibaba.fastjson.JSONObject
*/
public JSONObject cancelCouponsYt(String ticketNum , String phone) throws Exception{
log.info("========================请求任务Start=========================");
Map<String, Object> req = new HashMap<>();
req.put("appId", petroAppid);
req.put("appKey", petroAppKey);
req.put("timestamp", new Date().getTime() + "");
req.put("nonce" , generateRandomString(16));
String [] vouchers = {ticketNum};
// 业务数据
JSONObject jsonData = new JSONObject();
jsonData.put("vouchers" , vouchers);
jsonData.put("businessId" , phone);
//业务内容加密
String bizContent = JSONObject.toJSONString(jsonData);
bizContent = encrypt(bizContent);
//加密的内容放到参数中
req.put("jsonData", bizContent);
//生成签名
String sign = PetroEncryptUtil.generateSign(req);
//签名放到参数中
req.put("sign", sign);
Map<String , Object> postData = new HashMap<>();
postData.put("sign" , sign);
postData.put("timestamp" , req.get("timestamp"));
postData.put("jsonData" , bizContent);
postData.put("nonce" , req.get("nonce"));
postData.put("appId", petroAppid);
log.info("查询电子券状态-请求参数: " + JSON.toJSONString(req));
// 请求接口
JSONObject object = HttpsUtils.doPost(reqUrl + "/outapi/cancelCouponsYt", postData);
log.info("查询电子券状态-回调参数: " + JSON.toJSONString(object));
reqLogService.insert(
TripartiteReqLogType.type18,
req.get("timestamp").toString(),
TripartiteReqLogReqType.type1,
reqUrl + "get-coupon",
req.toString(),
object.toString()
);
return object;
}
/**
* @Author Sum1Dream
* @Name generateRandomString
* @Description // 生成16位随机字符串
* @Date 16:24 2024/1/15
* @Param length 长度
* @return java.lang.String
*/
private static String generateRandomString(Integer length) {
UUID uuid = UUID.randomUUID();
return uuid.toString().replaceAll("-", "").substring(0, length);
}
/**
* @param content AES加密前的明文
* @param key 秘钥
* @return AES加密后的内容
*/
public static String encrypt(final String content,final String key) {
try {
byte[] raw = key.getBytes(charset);
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
//"算法/模式/补码方式"
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(content.getBytes(charset));
//此处使用Hex做转码功能,同时能起到2次加密的作用。
return DatatypeConverter.printHexBinary(encrypted);
} catch (Exception e) {
e.printStackTrace();
return null;
}
public static String encrypt(final String content) {
return PetroEncryptUtil.encrypt(content , petroAesKey);
}
/**
* @Author Sum1Dream
* @Name decrypt
* @Description // 解密
* @Date 16:19 2023/11/15
* @Param content
* @Author Sum1Dream
* @Name decrypt
* @Description // 解密
* @Date 16:19 2023/11/15
* @Param content
* @Param key
* @return java.lang.String
*/
*/
public static String decrypt(final String content) {
try {
byte[] raw = petroAesKey.getBytes("UTF-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(2, skeySpec);
byte[] hexBinary = DatatypeConverter.parseHexBinary(content);
byte[] original = cipher.doFinal(hexBinary);
return new String(original, "UTF-8");
} catch (Exception var7) {
return null;
}
return PetroEncryptUtil.decrypt(content , petroAesKey);
}
}

@ -245,9 +245,80 @@ public class RechargeConfig {
* @Date 14:11 2024/1/5
* @return com.alibaba.fastjson.JSONObject
*/
// public static JSONObject jNiuGoodsList() throws {
//
// }
public static JSONObject jNiuGoodsList() throws Exception{
log.info("发起简牛快充查询产品列表");
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMap.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
log.info("发起简牛快充查询产品列表-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/goods-list", paramMap , new HashMap<>());
log.info("发起简牛快充查询产品列表-响应参数: " + jsonObject.toJSONString());
return jsonObject;
}
/**
* @Author Sum1Dream
* @Name rechargeOrderByJn
* @Description // 简牛下单
* @Date 14:33 2024/1/25
* @Param object
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject rechargeOrderByJn(JSONObject object) throws Exception{
log.info("发起简牛下单表");
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMap.put("account" , object.getBigDecimal("price"));
paramMap.put("goods_id" , object.getBigDecimal("goodsId"));
paramMap.put("order_no" , object.getBigDecimal("orderNo"));
paramMap.put("option_id" , object.getBigDecimal("optionId"));
paramMap.put("notify_url" , CommonSysConst.getSysConfig().getJnNotifyUrl());
paramMap.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
log.info("发起简牛下单-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/order-create", paramMap , new HashMap<>());
log.info("发起简牛下单-响应参数: " + jsonObject.toJSONString());
return jsonObject;
}
/**
* @Author Sum1Dream
* @Name checkOrderByJn
* @Description // 简牛查询订单
* @Date 14:33 2024/1/25
* @Param object
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject checkOrderByJn(JSONObject object) throws Exception {
log.info("发起简牛快充查询产品列表");
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMap.put("order_no" , object.getString("orderNo"));
paramMap.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
log.info("发起简牛查询订单-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/check-order", paramMap , new HashMap<>());
log.info("发起简牛查询订单-响应参数: " + jsonObject.toJSONString());
return jsonObject;
}
/**
* @Author Sum1Dream
* @Name cancelOrderJn
* @Description // 取消订单简牛
* @Date 14:38 2024/1/25
* @Param object
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject cancelOrderJn(JSONObject object) throws Exception {
log.info("发起简牛快充查询产品列表");
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("appid" , CommonSysConst.getSysConfig().getJnApiKey());
paramMap.put("out_order_no" , object.getString("orderNo"));
paramMap.put("sign", WxUtils.generateSignApi(paramMap , CommonSysConst.getSysConfig().getJnAppSecret() , WXPayConstants.SignType.MD5 , false));
log.info("发起取消订单简牛-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJnPostUrl()+ "/modules/api/open/cancel-order", paramMap , new HashMap<>());
log.info("发起取消订单简牛-响应参数: " + jsonObject.toJSONString());
return jsonObject;
}
private static String paramSort(final Map<String, Object> param) {

@ -39,15 +39,21 @@ public interface ApiCouponMapper extends ApiCouponMapperExt {
int deleteByPrimaryKey(Long id);
@Insert({
"insert into api_coupon (`type`, goods_type, ",
"`name`, code, `desc`, ",
"price, img, effective_days, ",
"insert into api_coupon (cou_category, `type`, ",
"goods_type, `name`, ",
"code, `desc`, price, ",
"cou_discount_value, cou_discount_max_value, ",
"img, valid_type, ",
"effective_days, valid_date, ",
"create_time, update_time, ",
"`status`, op_id, op_name, ",
"ext_1, ext_2, ext_3)",
"values (#{type,jdbcType=INTEGER}, #{goodsType,jdbcType=VARCHAR}, ",
"#{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, ",
"#{price,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}, #{effectiveDays,jdbcType=INTEGER}, ",
"values (#{couCategory,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, ",
"#{goodsType,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
"#{code,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{price,jdbcType=INTEGER}, ",
"#{couDiscountValue,jdbcType=DECIMAL}, #{couDiscountMaxValue,jdbcType=DECIMAL}, ",
"#{img,jdbcType=VARCHAR}, #{validType,jdbcType=INTEGER}, ",
"#{effectiveDays,jdbcType=INTEGER}, #{validDate,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
@ -62,14 +68,19 @@ public interface ApiCouponMapper extends ApiCouponMapperExt {
@SelectProvider(type=ApiCouponSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="cou_category", property="couCategory", jdbcType=JdbcType.INTEGER),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type", property="goodsType", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR),
@Result(column="price", property="price", jdbcType=JdbcType.INTEGER),
@Result(column="cou_discount_value", property="couDiscountValue", jdbcType=JdbcType.DECIMAL),
@Result(column="cou_discount_max_value", property="couDiscountMaxValue", jdbcType=JdbcType.DECIMAL),
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
@Result(column="valid_type", property="validType", jdbcType=JdbcType.INTEGER),
@Result(column="effective_days", property="effectiveDays", jdbcType=JdbcType.INTEGER),
@Result(column="valid_date", property="validDate", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -83,21 +94,27 @@ public interface ApiCouponMapper extends ApiCouponMapperExt {
@Select({
"select",
"id, `type`, goods_type, `name`, code, `desc`, price, img, effective_days, create_time, ",
"id, cou_category, `type`, goods_type, `name`, code, `desc`, price, cou_discount_value, ",
"cou_discount_max_value, img, valid_type, effective_days, valid_date, create_time, ",
"update_time, `status`, op_id, op_name, ext_1, ext_2, ext_3",
"from api_coupon",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="cou_category", property="couCategory", jdbcType=JdbcType.INTEGER),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type", property="goodsType", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR),
@Result(column="price", property="price", jdbcType=JdbcType.INTEGER),
@Result(column="cou_discount_value", property="couDiscountValue", jdbcType=JdbcType.DECIMAL),
@Result(column="cou_discount_max_value", property="couDiscountMaxValue", jdbcType=JdbcType.DECIMAL),
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
@Result(column="valid_type", property="validType", jdbcType=JdbcType.INTEGER),
@Result(column="effective_days", property="effectiveDays", jdbcType=JdbcType.INTEGER),
@Result(column="valid_date", property="validDate", jdbcType=JdbcType.TIMESTAMP),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@ -120,14 +137,19 @@ public interface ApiCouponMapper extends ApiCouponMapperExt {
@Update({
"update api_coupon",
"set `type` = #{type,jdbcType=INTEGER},",
"set cou_category = #{couCategory,jdbcType=INTEGER},",
"`type` = #{type,jdbcType=INTEGER},",
"goods_type = #{goodsType,jdbcType=VARCHAR},",
"`name` = #{name,jdbcType=VARCHAR},",
"code = #{code,jdbcType=VARCHAR},",
"`desc` = #{desc,jdbcType=VARCHAR},",
"price = #{price,jdbcType=INTEGER},",
"cou_discount_value = #{couDiscountValue,jdbcType=DECIMAL},",
"cou_discount_max_value = #{couDiscountMaxValue,jdbcType=DECIMAL},",
"img = #{img,jdbcType=VARCHAR},",
"valid_type = #{validType,jdbcType=INTEGER},",
"effective_days = #{effectiveDays,jdbcType=INTEGER},",
"valid_date = #{validDate,jdbcType=TIMESTAMP},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",

@ -28,6 +28,10 @@ public class ApiCouponSqlProvider {
SQL sql = new SQL();
sql.INSERT_INTO("api_coupon");
if (record.getCouCategory() != null) {
sql.VALUES("cou_category", "#{couCategory,jdbcType=INTEGER}");
}
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
@ -52,14 +56,30 @@ public class ApiCouponSqlProvider {
sql.VALUES("price", "#{price,jdbcType=INTEGER}");
}
if (record.getCouDiscountValue() != null) {
sql.VALUES("cou_discount_value", "#{couDiscountValue,jdbcType=DECIMAL}");
}
if (record.getCouDiscountMaxValue() != null) {
sql.VALUES("cou_discount_max_value", "#{couDiscountMaxValue,jdbcType=DECIMAL}");
}
if (record.getImg() != null) {
sql.VALUES("img", "#{img,jdbcType=VARCHAR}");
}
if (record.getValidType() != null) {
sql.VALUES("valid_type", "#{validType,jdbcType=INTEGER}");
}
if (record.getEffectiveDays() != null) {
sql.VALUES("effective_days", "#{effectiveDays,jdbcType=INTEGER}");
}
if (record.getValidDate() != null) {
sql.VALUES("valid_date", "#{validDate,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
@ -102,14 +122,19 @@ public class ApiCouponSqlProvider {
} else {
sql.SELECT("id");
}
sql.SELECT("cou_category");
sql.SELECT("`type`");
sql.SELECT("goods_type");
sql.SELECT("`name`");
sql.SELECT("code");
sql.SELECT("`desc`");
sql.SELECT("price");
sql.SELECT("cou_discount_value");
sql.SELECT("cou_discount_max_value");
sql.SELECT("img");
sql.SELECT("valid_type");
sql.SELECT("effective_days");
sql.SELECT("valid_date");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
@ -139,6 +164,10 @@ public class ApiCouponSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getCouCategory() != null) {
sql.SET("cou_category = #{record.couCategory,jdbcType=INTEGER}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
@ -163,14 +192,30 @@ public class ApiCouponSqlProvider {
sql.SET("price = #{record.price,jdbcType=INTEGER}");
}
if (record.getCouDiscountValue() != null) {
sql.SET("cou_discount_value = #{record.couDiscountValue,jdbcType=DECIMAL}");
}
if (record.getCouDiscountMaxValue() != null) {
sql.SET("cou_discount_max_value = #{record.couDiscountMaxValue,jdbcType=DECIMAL}");
}
if (record.getImg() != null) {
sql.SET("img = #{record.img,jdbcType=VARCHAR}");
}
if (record.getValidType() != null) {
sql.SET("valid_type = #{record.validType,jdbcType=INTEGER}");
}
if (record.getEffectiveDays() != null) {
sql.SET("effective_days = #{record.effectiveDays,jdbcType=INTEGER}");
}
if (record.getValidDate() != null) {
sql.SET("valid_date = #{record.validDate,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
@ -212,14 +257,19 @@ public class ApiCouponSqlProvider {
sql.UPDATE("api_coupon");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("cou_category = #{record.couCategory,jdbcType=INTEGER}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("goods_type = #{record.goodsType,jdbcType=VARCHAR}");
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
sql.SET("`desc` = #{record.desc,jdbcType=VARCHAR}");
sql.SET("price = #{record.price,jdbcType=INTEGER}");
sql.SET("cou_discount_value = #{record.couDiscountValue,jdbcType=DECIMAL}");
sql.SET("cou_discount_max_value = #{record.couDiscountMaxValue,jdbcType=DECIMAL}");
sql.SET("img = #{record.img,jdbcType=VARCHAR}");
sql.SET("valid_type = #{record.validType,jdbcType=INTEGER}");
sql.SET("effective_days = #{record.effectiveDays,jdbcType=INTEGER}");
sql.SET("valid_date = #{record.validDate,jdbcType=TIMESTAMP}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
@ -238,6 +288,10 @@ public class ApiCouponSqlProvider {
SQL sql = new SQL();
sql.UPDATE("api_coupon");
if (record.getCouCategory() != null) {
sql.SET("cou_category = #{couCategory,jdbcType=INTEGER}");
}
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
@ -262,14 +316,30 @@ public class ApiCouponSqlProvider {
sql.SET("price = #{price,jdbcType=INTEGER}");
}
if (record.getCouDiscountValue() != null) {
sql.SET("cou_discount_value = #{couDiscountValue,jdbcType=DECIMAL}");
}
if (record.getCouDiscountMaxValue() != null) {
sql.SET("cou_discount_max_value = #{couDiscountMaxValue,jdbcType=DECIMAL}");
}
if (record.getImg() != null) {
sql.SET("img = #{img,jdbcType=VARCHAR}");
}
if (record.getValidType() != null) {
sql.SET("valid_type = #{validType,jdbcType=INTEGER}");
}
if (record.getEffectiveDays() != null) {
sql.SET("effective_days = #{effectiveDays,jdbcType=INTEGER}");
}
if (record.getValidDate() != null) {
sql.SET("valid_date = #{validDate,jdbcType=TIMESTAMP}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}

@ -1,6 +1,7 @@
package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -18,6 +19,11 @@ public class ApiCoupon implements Serializable {
*/
private Long id;
/**
* 10满减券 40 折扣券
*/
private Integer couCategory;
/**
* 类型1四川中石油 2.贵州中石油
*/
@ -48,16 +54,36 @@ public class ApiCoupon implements Serializable {
*/
private Integer price;
/**
* 折扣率 折扣为9.7折时为0.97
*/
private BigDecimal couDiscountValue;
/**
* 当折扣计算后金额大余最大折扣金额时以最大折扣金额为准
*/
private BigDecimal couDiscountMaxValue;
/**
* 卡券图片
*/
private String img;
/**
* 券有效期类型 1固定2动态
*/
private Integer validType;
/**
* 有效天数
*/
private Integer effectiveDays;
/**
* 有效期
*/
private Date validDate;
/**
* 创建时间
*/
@ -108,6 +134,14 @@ public class ApiCoupon implements Serializable {
this.id = id;
}
public Integer getCouCategory() {
return couCategory;
}
public void setCouCategory(Integer couCategory) {
this.couCategory = couCategory;
}
public Integer getType() {
return type;
}
@ -156,6 +190,22 @@ public class ApiCoupon implements Serializable {
this.price = price;
}
public BigDecimal getCouDiscountValue() {
return couDiscountValue;
}
public void setCouDiscountValue(BigDecimal couDiscountValue) {
this.couDiscountValue = couDiscountValue;
}
public BigDecimal getCouDiscountMaxValue() {
return couDiscountMaxValue;
}
public void setCouDiscountMaxValue(BigDecimal couDiscountMaxValue) {
this.couDiscountMaxValue = couDiscountMaxValue;
}
public String getImg() {
return img;
}
@ -164,6 +214,14 @@ public class ApiCoupon implements Serializable {
this.img = img;
}
public Integer getValidType() {
return validType;
}
public void setValidType(Integer validType) {
this.validType = validType;
}
public Integer getEffectiveDays() {
return effectiveDays;
}
@ -172,6 +230,14 @@ public class ApiCoupon implements Serializable {
this.effectiveDays = effectiveDays;
}
public Date getValidDate() {
return validDate;
}
public void setValidDate(Date validDate) {
this.validDate = validDate;
}
public Date getCreateTime() {
return createTime;
}
@ -249,14 +315,19 @@ public class ApiCoupon implements Serializable {
}
ApiCoupon other = (ApiCoupon) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCouCategory() == null ? other.getCouCategory() == null : this.getCouCategory().equals(other.getCouCategory()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getGoodsType() == null ? other.getGoodsType() == null : this.getGoodsType().equals(other.getGoodsType()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getCouDiscountValue() == null ? other.getCouDiscountValue() == null : this.getCouDiscountValue().equals(other.getCouDiscountValue()))
&& (this.getCouDiscountMaxValue() == null ? other.getCouDiscountMaxValue() == null : this.getCouDiscountMaxValue().equals(other.getCouDiscountMaxValue()))
&& (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg()))
&& (this.getValidType() == null ? other.getValidType() == null : this.getValidType().equals(other.getValidType()))
&& (this.getEffectiveDays() == null ? other.getEffectiveDays() == null : this.getEffectiveDays().equals(other.getEffectiveDays()))
&& (this.getValidDate() == null ? other.getValidDate() == null : this.getValidDate().equals(other.getValidDate()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
@ -272,14 +343,19 @@ public class ApiCoupon implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCouCategory() == null) ? 0 : getCouCategory().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getGoodsType() == null) ? 0 : getGoodsType().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
result = prime * result + ((getCouDiscountValue() == null) ? 0 : getCouDiscountValue().hashCode());
result = prime * result + ((getCouDiscountMaxValue() == null) ? 0 : getCouDiscountMaxValue().hashCode());
result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode());
result = prime * result + ((getValidType() == null) ? 0 : getValidType().hashCode());
result = prime * result + ((getEffectiveDays() == null) ? 0 : getEffectiveDays().hashCode());
result = prime * result + ((getValidDate() == null) ? 0 : getValidDate().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
@ -298,14 +374,19 @@ public class ApiCoupon implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", couCategory=").append(couCategory);
sb.append(", type=").append(type);
sb.append(", goodsType=").append(goodsType);
sb.append(", name=").append(name);
sb.append(", code=").append(code);
sb.append(", desc=").append(desc);
sb.append(", price=").append(price);
sb.append(", couDiscountValue=").append(couDiscountValue);
sb.append(", couDiscountMaxValue=").append(couDiscountMaxValue);
sb.append(", img=").append(img);
sb.append(", validType=").append(validType);
sb.append(", effectiveDays=").append(effectiveDays);
sb.append(", validDate=").append(validDate);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);

@ -1,5 +1,6 @@
package com.hai.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -185,6 +186,66 @@ public class ApiCouponExample {
return (Criteria) this;
}
public Criteria andCouCategoryIsNull() {
addCriterion("cou_category is null");
return (Criteria) this;
}
public Criteria andCouCategoryIsNotNull() {
addCriterion("cou_category is not null");
return (Criteria) this;
}
public Criteria andCouCategoryEqualTo(Integer value) {
addCriterion("cou_category =", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryNotEqualTo(Integer value) {
addCriterion("cou_category <>", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryGreaterThan(Integer value) {
addCriterion("cou_category >", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryGreaterThanOrEqualTo(Integer value) {
addCriterion("cou_category >=", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryLessThan(Integer value) {
addCriterion("cou_category <", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryLessThanOrEqualTo(Integer value) {
addCriterion("cou_category <=", value, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryIn(List<Integer> values) {
addCriterion("cou_category in", values, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryNotIn(List<Integer> values) {
addCriterion("cou_category not in", values, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryBetween(Integer value1, Integer value2) {
addCriterion("cou_category between", value1, value2, "couCategory");
return (Criteria) this;
}
public Criteria andCouCategoryNotBetween(Integer value1, Integer value2) {
addCriterion("cou_category not between", value1, value2, "couCategory");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
@ -585,6 +646,126 @@ public class ApiCouponExample {
return (Criteria) this;
}
public Criteria andCouDiscountValueIsNull() {
addCriterion("cou_discount_value is null");
return (Criteria) this;
}
public Criteria andCouDiscountValueIsNotNull() {
addCriterion("cou_discount_value is not null");
return (Criteria) this;
}
public Criteria andCouDiscountValueEqualTo(BigDecimal value) {
addCriterion("cou_discount_value =", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueNotEqualTo(BigDecimal value) {
addCriterion("cou_discount_value <>", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueGreaterThan(BigDecimal value) {
addCriterion("cou_discount_value >", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("cou_discount_value >=", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueLessThan(BigDecimal value) {
addCriterion("cou_discount_value <", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueLessThanOrEqualTo(BigDecimal value) {
addCriterion("cou_discount_value <=", value, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueIn(List<BigDecimal> values) {
addCriterion("cou_discount_value in", values, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueNotIn(List<BigDecimal> values) {
addCriterion("cou_discount_value not in", values, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("cou_discount_value between", value1, value2, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountValueNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("cou_discount_value not between", value1, value2, "couDiscountValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueIsNull() {
addCriterion("cou_discount_max_value is null");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueIsNotNull() {
addCriterion("cou_discount_max_value is not null");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueEqualTo(BigDecimal value) {
addCriterion("cou_discount_max_value =", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueNotEqualTo(BigDecimal value) {
addCriterion("cou_discount_max_value <>", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueGreaterThan(BigDecimal value) {
addCriterion("cou_discount_max_value >", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("cou_discount_max_value >=", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueLessThan(BigDecimal value) {
addCriterion("cou_discount_max_value <", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueLessThanOrEqualTo(BigDecimal value) {
addCriterion("cou_discount_max_value <=", value, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueIn(List<BigDecimal> values) {
addCriterion("cou_discount_max_value in", values, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueNotIn(List<BigDecimal> values) {
addCriterion("cou_discount_max_value not in", values, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("cou_discount_max_value between", value1, value2, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andCouDiscountMaxValueNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("cou_discount_max_value not between", value1, value2, "couDiscountMaxValue");
return (Criteria) this;
}
public Criteria andImgIsNull() {
addCriterion("img is null");
return (Criteria) this;
@ -655,6 +836,66 @@ public class ApiCouponExample {
return (Criteria) this;
}
public Criteria andValidTypeIsNull() {
addCriterion("valid_type is null");
return (Criteria) this;
}
public Criteria andValidTypeIsNotNull() {
addCriterion("valid_type is not null");
return (Criteria) this;
}
public Criteria andValidTypeEqualTo(Integer value) {
addCriterion("valid_type =", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeNotEqualTo(Integer value) {
addCriterion("valid_type <>", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeGreaterThan(Integer value) {
addCriterion("valid_type >", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("valid_type >=", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeLessThan(Integer value) {
addCriterion("valid_type <", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeLessThanOrEqualTo(Integer value) {
addCriterion("valid_type <=", value, "validType");
return (Criteria) this;
}
public Criteria andValidTypeIn(List<Integer> values) {
addCriterion("valid_type in", values, "validType");
return (Criteria) this;
}
public Criteria andValidTypeNotIn(List<Integer> values) {
addCriterion("valid_type not in", values, "validType");
return (Criteria) this;
}
public Criteria andValidTypeBetween(Integer value1, Integer value2) {
addCriterion("valid_type between", value1, value2, "validType");
return (Criteria) this;
}
public Criteria andValidTypeNotBetween(Integer value1, Integer value2) {
addCriterion("valid_type not between", value1, value2, "validType");
return (Criteria) this;
}
public Criteria andEffectiveDaysIsNull() {
addCriterion("effective_days is null");
return (Criteria) this;
@ -715,6 +956,66 @@ public class ApiCouponExample {
return (Criteria) this;
}
public Criteria andValidDateIsNull() {
addCriterion("valid_date is null");
return (Criteria) this;
}
public Criteria andValidDateIsNotNull() {
addCriterion("valid_date is not null");
return (Criteria) this;
}
public Criteria andValidDateEqualTo(Date value) {
addCriterion("valid_date =", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateNotEqualTo(Date value) {
addCriterion("valid_date <>", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateGreaterThan(Date value) {
addCriterion("valid_date >", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateGreaterThanOrEqualTo(Date value) {
addCriterion("valid_date >=", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateLessThan(Date value) {
addCriterion("valid_date <", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateLessThanOrEqualTo(Date value) {
addCriterion("valid_date <=", value, "validDate");
return (Criteria) this;
}
public Criteria andValidDateIn(List<Date> values) {
addCriterion("valid_date in", values, "validDate");
return (Criteria) this;
}
public Criteria andValidDateNotIn(List<Date> values) {
addCriterion("valid_date not in", values, "validDate");
return (Criteria) this;
}
public Criteria andValidDateBetween(Date value1, Date value2) {
addCriterion("valid_date between", value1, value2, "validDate");
return (Criteria) this;
}
public Criteria andValidDateNotBetween(Date value1, Date value2) {
addCriterion("valid_date not between", value1, value2, "validDate");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -341,4 +341,4 @@ public class HighCouponCodeOther implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -503,9 +503,8 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
ApiMchProduct mchProduct = apiMchProductService.findByMap(mapProduct);
// 计算成本价格
BigDecimal price = priceComputeConfig.computationPriceCost(mchProduct.getDiscount() , new BigDecimal(apiCoupon.getPrice()/100));
BigDecimal price = priceComputeConfig.computationPriceCost(mchProduct.getDiscount() , new BigDecimal(apiCoupon.getPrice()));
// 判断金额是否充足
if (apiMerchants.getAmounts().compareTo(price) < 0) {
@ -522,7 +521,7 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
ApiOrder apiOrder = new ApiOrder();
apiOrder.setCreateTime(new Date());
apiOrder.setTitle(apiMerchants.getMerchantName() + "|" + OrderProductType.PRODUCT_TYPE18.getName() + "|扣款" + price);
apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice()/100));
apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice()));
apiOrder.setCostPrice(price);
apiOrder.setOrderPrice(price);
apiOrder.setMchId(object.getString("merchId"));

@ -701,21 +701,21 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
}
// 发放卡券
JSONObject jsonObject = petroConfig.getCoupon(apiCoupon.getCode() , order.getMemPhone() , order.getOrderNo());
JSONObject jsonObject = petroConfig.getCoupon(apiCoupon.getCode() , order.getMemPhone());
if (!jsonObject.getString("code").equals("1")) {
if (!jsonObject.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
order.setOrderStatus(OrderStatus.STATUS3.getNumber());
order.setFinishTime(new Date());
order.getHighChildOrderList().get(0).setExt5(object.getString("request_code"));
order.getHighChildOrderList().get(0).setExt6(ticketListObject.getString("ticket_num"));
// 券类型别名
order.getHighChildOrderList().get(0).setExt5(object.getString("alias"));
// 唯一标识
order.getHighChildOrderList().get(0).setExt6(object.getString("voucher"));
orderService.updateOrderData(order);
}

@ -189,6 +189,7 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService {
ApiAmountRecordExample example = new ApiAmountRecordExample();
example.createCriteria().andMchIdEqualTo(apiMerchants.getMchId());
example.setOrderByClause("create_time desc");
return apiAmountRecordMapper.selectByExample(example);
}

@ -378,21 +378,19 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService {
couponCodeOther.setType(6);
}
// 发放卡券
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , phone , couponAgentCode.getConvertCode());
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , phone);
if (!jsonObject.getString("code").equals("1")) {
if (!jsonObject.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
couponCodeOther.setCouponAgentCodeId(couponAgentCodeId);
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(ticketListObject.getString("ticket_num"));
couponCodeOther.setCouTypeCode(object.getString("alias"));
couponCodeOther.setCouNo(object.getString("voucher"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(new Date());
couponCodeOther.setValidEndDate(coupon.getSalesEndTime());

@ -537,23 +537,19 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
}
// 发放卡券
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone() , order.getOrderNo());
JSONObject jsonObject = petroConfig.getCoupon(coupon.getCouponKey() , order.getMemPhone());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
if (!jsonObject.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , jsonObject.getString("errMsg"));
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(childOrder.getId());
couponCodeOther.setCouTypeCode(object.getString("request_code"));
couponCodeOther.setCouNo(ticketListObject.getString("ticket_num"));
couponCodeOther.setCouTypeCode(object.getString("alias"));
couponCodeOther.setCouNo(object.getString("voucher"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(new Date());
couponCodeOther.setValidEndDate(coupon.getSalesEndTime());

@ -316,21 +316,20 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
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 , "系统维护中");
JSONObject preSendCoupon = petroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone());
if (!preSendCoupon.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(preSendCoupon.getString("biz_content"));
String data = PetroConfig.decrypt(preSendCoupon.getString("jsonResult"));
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.setCouTypeCode(object.getString("alias"));
couponCodeOther.setCouNo(object.getString("voucher"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(new Date());
couponCodeOther.setValidEndDate(discount.getSalesEndTime());
@ -353,21 +352,20 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
}
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 , "系统维护中");
JSONObject preSendCoupon = petroConfig.getCoupon(couponList.get(0).getHighCoupon().getCouponKey(), userModel.getHighUser().getPhone());
if (!preSendCoupon.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(preSendCoupon.getString("biz_content"));
String data = PetroConfig.decrypt(preSendCoupon.getString("jsonResult"));
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.setCouTypeCode(object.getString("alias"));
couponCodeOther.setCouNo(object.getString("voucher"));
couponCodeOther.setActiveTime(new Date());
couponCodeOther.setValidStartDate(new Date());
couponCodeOther.setValidEndDate(discount.getSalesEndTime());

@ -109,6 +109,12 @@ CyApiKey=cyMYLABWa2H2u
CyAppSecret =cysslWXHnMHDMEvDEtwSWaJMGwl4dkcPLT
CyPostUrl=http://120.24.83.85:8999/
#JN
JnNotifyUrl = https://hsgcs.dctpay.com/order/mobileRechargeNotify/rechargeCallbackByJn
JnApiKey=k0e8y20qk7w36q
JnAppSecret =cd3c528482d67d5d56376db6fb97f561
JnPostUrl=https://open.jnycc.com
unionAppId=7113783e75354df2a985efd3f31b9528
unionSecret=e2c731d2a026469aa6d218432f361653
unionRsaKey=891f6775fba7f12cc23df7c75e02b39b891f6775fba7f12c
@ -151,9 +157,7 @@ ScPetroAppid = 510000313181602615
ScPetroAppKey = 510000kA5kxtaDnx3V6HE
ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U
GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000990232626265
GzPetroAppKey = 520000W4S3BRkFhaDsNMM
GzPetroAesKey = A8P2sUnM6PsKPwusiFEDFjMu8Hh8wB79
#
GzPetroUrl = http://140.143.82.223:1588/gz
GzPetroAppid = F0bdoJRwt
GzPetroAppKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98
GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98

@ -100,10 +100,18 @@ CyApiKey=cyMYLABWa2H2u
CyAppSecret =cysslWXHnMHDMEvDEtwSWaJMGwl4dkcPLT
CyPostUrl=http://120.24.83.85:8999/
#JN
JnNotifyUrl = https://hsg.dctpay.com/order/mobileRechargeNotify/rechargeCallbackByJn
JnApiKey=k0e8y20qk7w36q
JnAppSecret =cd3c528482d67d5d56376db6fb97f561
JnPostUrl=https://open.jnycc.com
unionAppId=ced46392acfe42be863fdfdd3e61164a
unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa
unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586
#url
fileUrl=/home/project/hsg/filesystem/
@ -131,17 +139,13 @@ 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
GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000325108579843
GzPetroAppKey = 520000A3CVdd4vmcjtkDR
GzPetroAesKey = A39Yu3YcxtpM2UdiSMef6e7pcjmbkFi7
GzPetroUrl = http://140.143.82.223:1588/gz
GzPetroAppid = F0bdoJRwt
GzPetroAppKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98
GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98

@ -106,6 +106,12 @@ CyApiKey=cyMYLABWa2H2u
CyAppSecret =cysslWXHnMHDMEvDEtwSWaJMGwl4dkcPLT
CyPostUrl=http://120.24.83.85:8999/
#JN
JnNotifyUrl = https://hsg.dctpay.com/order/mobileRechargeNotify/rechargeCallbackByJn
JnApiKey=k0e8y20qk7w36q
JnAppSecret =cd3c528482d67d5d56376db6fb97f561
JnPostUrl=https://open.jnycc.com
unionAppId=ced46392acfe42be863fdfdd3e61164a
unionSecret=a0f380bb22cd4ce2a8d35f3bf437d6fa
unionRsaKey=f2e6b6b95da445866194498c371a7c8af2e6b6b95da44586
@ -141,12 +147,9 @@ 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 = 5100003131816026151
#ScPetroAppKey = 510000kA5kxtaDnx3V6HE
#ScPetroAesKey = AptFsUgpgAij3evH7rm4ubTKu5viSx9U
GzPetroUrl = http://43.136.176.177:8080/hd-api/out/
GzPetroAppid = 520000325108579843
GzPetroAppKey = 520000A3CVdd4vmcjtkDR
GzPetroAesKey = A39Yu3YcxtpM2UdiSMef6e7pcjmbkFi7
GzPetroUrl = http://140.143.82.223:1588/gz
GzPetroAppid = F0bdoJRwt
GzPetroAppKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98
GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98

@ -101,6 +101,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/orderRebate/*")
.excludePathPatterns("/refuelOnline/*")
.excludePathPatterns("/apiCoupon/*")
.excludePathPatterns("/apiMerchants/*")
;
}

@ -1,5 +1,6 @@
package com.v1.controller.business;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
@ -186,11 +187,10 @@ public class ApiCouponController {
ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null);
HighOrder highOrder = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo());
HighChildOrder childOrder = highOrder.getHighChildOrderList().get(0);
// 派发停车
// 查询卡
ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName());
if (apiCoupon.getType().equals(1)) {
@ -199,16 +199,15 @@ public class ApiCouponController {
PetroConfig.init(2);
}
JSONObject jsonObject = petroConfig.couponDetail(apiOrder.getExt3());
JSONObject jsonObject = petroConfig.couponDetail(apiOrder.getExt3() , highOrder.getMemPhone());
if (!jsonObject.getString("code").equals("1")) {
if (!jsonObject.getString("resultCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前订单未查询到!");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
JSONObject jsonData = JSONObject.parseObject(data);
jsonData.put("out_trade_no" , object.getString("mchOrderNo"));
jsonData.put("mchOrderNo" , object.getString("mchOrderNo"));
return ResponseMsgUtil.success(jsonData);
@ -218,5 +217,89 @@ public class ApiCouponController {
}
}
@RequestMapping(value = "/getCheckCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取核销码")
public ResponseData getCheckCode(@RequestBody JSONObject object , HttpServletRequest request) {
try {
String ip;
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
if (
StringUtils.isBlank(object.getString("mchOrderNo")) ||
StringUtils.isBlank(object.getString("sign")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("merchId"))
) {
log.error("createOrder error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "帐户错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE18.getApiCode(), object.getString("merchId"))) {
log.error("getAllCities error!", "当前帐户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "");
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT);
}
Map<String , Object> map = new HashMap<>();
map.put("mchOrderNo" , object.getString("mchOrderNo"));
map.put("apiKey" , apiMerchants.getApiKey());
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map, object.getString("sign"))) {
log.error("createOrder error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null);
HighOrder highOrder = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo());
HighChildOrder childOrder = highOrder.getHighChildOrderList().get(0);
// 查询卡券
ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName());
if (apiCoupon.getType().equals(1)) {
PetroConfig.init(1);
} else {
PetroConfig.init(2);
}
JSONObject jsonObject = petroConfig.getCheckCode(highOrder.getHighChildOrderList().get(0).getExt6() , highOrder.getMemPhone());
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult"));
return ResponseMsgUtil.success(JSONObject.parseObject(data));
} catch (Exception e) {
log.error("HighOpenApiController --> createOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

Loading…
Cancel
Save