修改话费订单导出

袁野 2 years ago
parent a33d255cad
commit 831e5c9c63
  1. 16
      hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 17
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  4. 2
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  5. 33
      hai-service/src/main/java/com/hai/dao/ApiAmountRecordMapperExt.java
  6. 13
      hai-service/src/main/java/com/hai/service/ApiAmountRecordService.java
  7. 2
      hai-service/src/main/java/com/hai/service/ApiOpenService.java
  8. 22
      hai-service/src/main/java/com/hai/service/impl/ApiAmountRecordServiceImpl.java
  9. 113
      hai-service/src/main/java/com/hai/service/impl/ApiOpenServiceImpl.java
  10. 61
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  11. 64
      v1/src/main/java/com/v1/controller/GzSinopecController.java
  12. 12
      v1/src/main/java/com/v1/controller/RechargeProductController.java

@ -10,9 +10,12 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighMerchant;
import com.hai.entity.HighUser;
import com.hai.enum_type.OrderPushType;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighOpenApiService;
@ -58,6 +61,9 @@ public class HighOpenApiController {
@Resource
private HuiLianTongConfig huiLianTongConfig;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取专属优惠券")
@ -186,6 +192,16 @@ public class HighOpenApiController {
// 商户派发电子券
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, object.getString("orderNo"), object.getString("couTypeCode"), object.getInteger("distCouCount"), object.getString("phone"), object.getString("thirdUserId"));
System.out.println("派发电子券" + returnParam);
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(object.getString("orderNo"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(object));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (returnParam == null || !returnParam.getString("result").equals("success")) {
log.error("HighOpenApiController -> couJointDist() error!","商户派发电子券失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户派发电子券失败");

File diff suppressed because one or more lines are too long

@ -76,9 +76,6 @@ public class CzOrderController {
@Resource
private ApiOrderRecordService apiOrderRecordService;
@Resource
private ApiAmountRecordService apiAmountRecordService;
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST)
@ApiOperation(value = "龙阅充值回调")
@ -194,7 +191,9 @@ public class CzOrderController {
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
apiOrderRecord(rechargeOrder);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
} else {
callbackResult(childOrder , rechargeOrder);
@ -259,7 +258,9 @@ public class CzOrderController {
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
apiOrderRecord(rechargeOrder);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
} else {
callbackResult(childOrder , rechargeOrder);
}
@ -299,6 +300,7 @@ public class CzOrderController {
outRechargeOrderService.rechargeOrderToRefund(rechargeOrder.getId());
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedFail(
@ -475,9 +477,9 @@ public class CzOrderController {
}
}
@RequestMapping(value="/test",method = RequestMethod.POST)
@RequestMapping(value="/apiCallBack",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "ces")
@ApiOperation(value = "apiCallBack")
public String test(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
@ -485,6 +487,7 @@ public class CzOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
System.out.println("reqBodyStr");
return "SUCCESS";

@ -63,7 +63,7 @@ public class RechargeConfig {
paramMap.put("out_trade_num" , object.getString("out_trade_num"));
paramMap.put("product_id" , object.getString("product_id"));
paramMap.put("mobile" , object.getString("mobile"));
paramMap.put("notify_url" , CommonSysConst.getSysConfig().getJjNotifyUrl());
paramMap.put("notify_url" , CommonSysConst.getSysConfig().getLyNotifyUrl());
paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId());
paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap);

@ -1,7 +1,40 @@
package com.hai.dao;
import com.hai.entity.ApiOrderRecord;
import com.hai.entity.OutRechargeOrder;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
/**
* mapper扩展类
*/
public interface ApiAmountRecordMapperExt {
@Select({"SELECT * FROM api_order_record aor WHERE TIMESTAMPDIFF(MINUTE,aor.request_time,SYSDATE()) < 15 AND aor.status = 100"})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="amount_type", property="amountType", jdbcType=JdbcType.INTEGER),
@Result(column="amount", property="amount", jdbcType=JdbcType.DECIMAL),
@Result(column="before_amount", property="beforeAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="after_amount", property="afterAmount", jdbcType=JdbcType.DECIMAL),
@Result(column="mch_id", property="mchId", jdbcType=JdbcType.VARCHAR),
@Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
@Result(column="source_id", property="sourceId", jdbcType=JdbcType.BIGINT),
@Result(column="source_order_no", property="sourceOrderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="source_content", property="sourceContent", jdbcType=JdbcType.VARCHAR),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@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),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<ApiOrderRecord> callBackOrderList();
}

@ -2,6 +2,9 @@ package com.hai.service;
import com.hai.entity.ApiAmountRecord;
import java.util.List;
import java.util.Map;
/**
* @serviceName ApiAmountRecordService.java
* @author Sum1Dream
@ -31,4 +34,14 @@ public interface ApiAmountRecordService {
*/
ApiAmountRecord findById(Long id);
/**
* @Author Sum1Dream
* @name isRefundOrder.java
* @Description // 查询是否已经退款
* @Date 10:35 2022/6/15
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.lang.Boolean
*/
List<ApiAmountRecord> getApiAmountRecordByList(Map<String , Object> map);
}

@ -22,6 +22,6 @@ public interface ApiOpenService {
* @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject
*/
JSONObject createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception;
void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception;
}

@ -2,12 +2,16 @@ package com.hai.service.impl;
import com.hai.dao.ApiAmountRecordMapper;
import com.hai.entity.ApiAmountRecord;
import com.hai.entity.ApiAmountRecordExample;
import com.hai.service.ApiAmountRecordService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("apiAmountRecordService")
public class ApiAmountRecordServiceImpl implements ApiAmountRecordService {
@ -27,4 +31,22 @@ public class ApiAmountRecordServiceImpl implements ApiAmountRecordService {
public ApiAmountRecord findById(Long id) {
return apiAmountRecordMapper.selectByPrimaryKey(id);
}
@Override
public List<ApiAmountRecord> getApiAmountRecordByList(Map<String, Object> map) {
ApiAmountRecordExample example = new ApiAmountRecordExample();
ApiAmountRecordExample.Criteria criteria = example.createCriteria();
if (StringUtils.isBlank(MapUtils.getString(map , "orderNo"))) {
criteria.andSourceOrderNoEqualTo(MapUtils.getString(map , "orderNo"));
}
if (MapUtils.getInteger(map , "amountType") == null) {
criteria.andAmountTypeEqualTo(MapUtils.getInteger(map , "amountType"));
}
if (MapUtils.getInteger(map , "sourceType") == null) {
criteria.andSourceTypeEqualTo(MapUtils.getInteger(map , "sourceType"));
}
return apiAmountRecordMapper.selectByExample(example);
}
}

@ -50,9 +50,12 @@ public class ApiOpenServiceImpl implements ApiOpenService {
@Resource
private BsRequestRecordService bsRequestRecordService;
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public JSONObject createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception {
public void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception {
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("sourceOrderNo" , object.getString("orderNo"));
@ -97,7 +100,7 @@ public class ApiOpenServiceImpl implements ApiOpenService {
apiAmountRecord.setSourceType(3);
apiAmountRecord.setSourceOrderNo(object.getString("orderNo"));
apiAmountRecord.setSourceId(apiProduct.getId());
apiAmountRecord.setSourceContent(apiMerchants.getMerchantName() + "|" + object.getString("mobile") + "充值" + apiProduct.getRechargePrice());
apiAmountRecord.setSourceContent(apiMerchants.getMerchantName() + "|" + object.getString("mobile") + "充值" + apiProduct.getRechargePrice() + "|扣款" + productConfig.getDiscountPrice());
apiAmountRecordService.insertAmountRecord(apiAmountRecord);
@ -126,8 +129,7 @@ public class ApiOpenServiceImpl implements ApiOpenService {
outRechargeOrder.setUserId(apiMerchants.getId());
outRechargeOrderMapper.insert(outRechargeOrder);
pollRequest(outRechargeOrder);
outRechargeOrderService.pollRequest(outRechargeOrder);
// 插入订单记录
ApiOrderRecord apiOrderRecordPost = new ApiOrderRecord();
apiOrderRecordPost.setStatus(103);
@ -136,113 +138,12 @@ public class ApiOpenServiceImpl implements ApiOpenService {
apiOrderRecordPost.setCreateTime(new Date());
apiOrderRecordPost.setMchId(apiMerchants.getMchId());
apiOrderRecordPost.setOrderId(outRechargeOrder.getId());
apiOrderRecordPost.setGoodsId(apiProduct.getId().toString());
apiOrderRecordPost.setGoodsId(productConfig.getId().toString());
apiOrderRecordPost.setNotifyUrl(object.getString("notifyUrl"));
apiOrderRecordPost.setUpdateTime(new Date());
apiOrderRecordService.insertOrderRecord(apiOrderRecordPost);
return null;
}
private void pollRequest(OutRechargeOrder outRechargeOrder) throws Exception {
// 查询充值产品
ApiProduct apiProduct = apiProductService.findById(outRechargeOrder.getGoodsId());
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
childOrderMap.put("parent_order_id", outRechargeOrder.getId());
childOrderMap.put("status", 102);
List<OutRechargeChildOrder> childOrderList = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap);
OutRechargeChildOrder childOrder = new OutRechargeChildOrder();
// 1:尖椒 2:龙阅 3:畅停
int type = 0;
int rechargePlatformType = 0;
// 判断子订单是否存在充值中订单
if (childOrderList.size() > 0) {
childOrder = childOrderList.get(0);
childOrder.setStatus(103);
childOrder.setUpdateTime(new Date());
outRechargeChildOrderService.updateOrder(childOrder);
type = childOrder.getRechargePlatform();
}
JSONObject object = new JSONObject();
String orderNo = "CZ" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5);
String[] rechargePlatform = apiProduct.getRechargePlatform().split("-");
for (String s : rechargePlatform) {
// 尖椒充值
if (s.equals("1") && (type == 2 || type == 0)) {
object.put("out_order_id", orderNo);
object.put("amount", apiProduct.getRechargePrice());
object.put("mobile", outRechargeOrder.getRechargeContent());
if (apiProduct.getRechargeType() == 1) {
object.put("is_fast", 1);
}
JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object);
object.put("return_content", returnObject);
if (returnObject != null && returnObject.getLong("code") == 200) {
childOrder.setStatus(102);
} else {
childOrder.setStatus(103);
}
rechargePlatformType = 1;
break;
}
if (s.equals("2") && (type == 1 || type == 0)) {
object.put("out_trade_num", orderNo);
object.put("product_id", apiProduct.getProductId());
object.put("mobile", outRechargeOrder.getRechargeContent());
JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object);
object.put("return_content", returnObject);
if (returnObject != null && returnObject.getLong("errno") == 0) {
childOrder.setStatus(102);
} else {
childOrder.setStatus(103);
}
rechargePlatformType = 2;
break;
}
}
childOrder.setOrderNo(orderNo);
childOrder.setCreateTime(new Date());
childOrder.setParentOrderId(outRechargeOrder.getId());
childOrder.setRechargePlatform(rechargePlatformType);
childOrder.setUpdateTime(new Date());
outRechargeChildOrderService.insertOrder(childOrder);
// 创建提交记录
BsRequestRecord requestRecord = new BsRequestRecord();
requestRecord.setCreateTime(new Date());
requestRecord.setUpdateTime(new Date());
requestRecord.setOrderNo(orderNo);
requestRecord.setRequestContent(object.toJSONString());
requestRecord.setOperatorId(0L);
requestRecord.setOperatorName("系统生成");
requestRecord.setSourceId(childOrder.getId().toString());
requestRecord.setSourceType(1);
bsRequestRecordService.insertRequestRecord(requestRecord);
// 判断是否充值提交成功
if (childOrder.getStatus() == 102) {
outRechargeOrder.setRechargeStatus(201);
}
if (childOrder.getStatus() == 103) {
outRechargeOrder.setRechargeStatus(204);
}
outRechargeOrderMapper.updateByPrimaryKey(outRechargeOrder);
}
}

@ -90,6 +90,15 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private ApiAmountRecordService apiAmountRecordService;
@Resource
private ApiOrderRecordService apiOrderRecordService;
@Override
public List<OutRechargeOrder> getListRechargeOrder(Map<String, Object> map) {
@ -679,6 +688,58 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
order.setRefundFee(order.getPayRealPrice());
outRechargeOrderService.updateOrder(order);
}
// 商户预充值 帐户退款
if (order.getPayType() == 6) {
Map<String , Object> map = new HashMap<>();
map.put("orderNo" , order.getOrderNo());
map.put("amountType" , 1);
map.put("sourceType" , 2);
if ( apiAmountRecordService.getApiAmountRecordByList(map).size() == 1) {
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(order.getMerchId());
// 插入金额记录
// 变更前金额
BigDecimal beforeAmount = apiMerchants.getAmounts();
// 计算金额
apiMerchants.setAmounts(apiMerchants.getAmounts().add(order.getPayPrice()));
// 变更后金额
BigDecimal afterAmount = apiMerchants.getAmounts();
apiMerchantsService.updateApiMerchants(apiMerchants);
ApiAmountRecord apiAmountRecord = new ApiAmountRecord();
apiAmountRecord.setCreateTime(new Date());
apiAmountRecord.setUpdateTime(new Date());
apiAmountRecord.setMchId(order.getMerchId());
apiAmountRecord.setStatus(100);
apiAmountRecord.setAmount(order.getPayPrice());
apiAmountRecord.setAfterAmount(afterAmount);
apiAmountRecord.setBeforeAmount(beforeAmount);
apiAmountRecord.setAmountType(1);
apiAmountRecord.setSourceType(2);
apiAmountRecord.setSourceOrderNo(order.getOrderNo());
apiAmountRecord.setSourceId(order.getId());
apiAmountRecord.setSourceContent(apiMerchants.getMerchantName() + "|订单退款" + order.getPayPrice());
apiAmountRecordService.insertAmountRecord(apiAmountRecord);
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("orderId" , order.getId());
// 查询是否用重复订单
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap);
apiOrderRecord.setStatus(100);
apiOrderRecord.setRequestTime(new Date());
apiOrderRecordService.updateOrderRecord(apiOrderRecord);
}
}
}

@ -6,7 +6,10 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighUser;
import com.hai.enum_type.OrderPushType;
import com.hai.model.ResponseData;
import com.hai.service.HighOpenApiService;
import com.hai.service.HighUserService;
@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -36,6 +40,9 @@ public class GzSinopecController {
@Resource
private HighUserService highUserService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private SecConfigService secConfigService;
@ -57,7 +64,7 @@ public class GzSinopecController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前手机号暂无用户");
}
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
map.put("userId", highUser.getId());
map.put("useScope", useScope);
if (year != null) {
@ -73,7 +80,7 @@ public class GzSinopecController {
}
}
@RequestMapping(value="/getGuizhouSinopecList",method = RequestMethod.POST)
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取贵州中石化电子卡券")
public ResponseData getGuizhouSinopecList(HttpServletRequest request) {
@ -81,13 +88,13 @@ public class GzSinopecController {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!secConfigService.isConfig("IP_WHITE", ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
@ -99,18 +106,18 @@ public class GzSinopecController {
JSONObject corpCouTypes = HuiLianTongConfig.getCorpCouTypes(token);
System.out.println(corpCouTypes.toJSONString());
if (!corpCouTypes.getString("result").equals("success")) {
log.error("HighOpenApiController -> getGuizhouSinopecList() error!","获取电子卡券列表失败");
log.error("HighOpenApiController -> getGuizhouSinopecList() error!", "获取电子卡券列表失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败");
}
return ResponseMsgUtil.success(corpCouTypes.getJSONArray("data"));
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
log.error("HighCouponController -> getGuizhouSinopec() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/checkCouponStatus",method = RequestMethod.POST)
@RequestMapping(value = "/checkCouponStatus", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询电子券状态")
public ResponseData checkCouponStatus(@RequestBody JSONObject object, HttpServletRequest request) {
@ -118,13 +125,13 @@ public class GzSinopecController {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!secConfigService.isConfig("IP_WHITE", ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
@ -135,18 +142,18 @@ public class GzSinopecController {
// 查询电子卡券类型
JSONObject data = HuiLianTongConfig.getCouState(token, object.getString("couNo"));
if (!data.getString("result").equals("success")) {
log.error("HighOpenApiController -> insertCoupon() error!","查询电子券状态失败");
log.error("HighOpenApiController -> insertCoupon() error!", "查询电子券状态失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询电子券状态失败");
}
return ResponseMsgUtil.success(data.getJSONObject("data"));
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
log.error("HighCouponController -> getGuizhouSinopec() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/couJointDist",method = RequestMethod.POST)
@RequestMapping(value = "/couJointDist", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "商户派发电子券")
public ResponseData couJointDist(@RequestBody JSONObject object, HttpServletRequest request) {
@ -154,13 +161,13 @@ public class GzSinopecController {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!secConfigService.isConfig("IP_WHITE", ip)) {
log.error("couJointDist error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
@ -170,20 +177,29 @@ public class GzSinopecController {
// 商户派发电子券
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, object.getString("orderNo"), object.getString("couTypeCode"), object.getInteger("distCouCount"), object.getString("phone"), object.getString("thirdUserId"));
if (returnParam == null || !returnParam.getString("result").equals("success")) {
log.error("HighOpenApiController -> couJointDist() error!","商户派发电子券失败");
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(object.getString("orderNo"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(object));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (!returnParam.getString("result").equals("success")) {
log.error("HighOpenApiController -> couJointDist() error!", "商户派发电子券失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户派发电子券失败");
}
return ResponseMsgUtil.success(returnParam.getJSONArray("data"));
} catch (Exception e) {
log.error("HighOpenApiController -> couJointDist() error!",e);
log.error("HighOpenApiController -> couJointDist() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/test",method = RequestMethod.POST)
@RequestMapping(value = "/test", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "测试")
public ResponseData test(HttpServletRequest request) {
@ -192,13 +208,13 @@ public class GzSinopecController {
String ip = "";
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
ip = request.getRemoteAddr();
}
ip = request.getHeader("x-forwarded-for");
ip = request.getHeader("x-forwarded-for");
return ResponseMsgUtil.success(ip);
} catch (Exception e) {
log.error("HighCouponController -> getGuizhouSinopec() error!",e);
log.error("HighCouponController -> getGuizhouSinopec() error!", e);
return ResponseMsgUtil.exception(e);
}
}

@ -212,13 +212,13 @@ public class RechargeProductController {
JSONObject returnObject = new JSONObject();
returnObject.put("sourceOrderNo" , apiOrderRecord.getSourceOrderNo());
returnObject.put("callbackStatus" , apiOrderRecord.getStatus());
returnObject.put("goodsId" , apiOrderRecord.getGoodsId());
returnObject.put("apiConfigProductId" , apiOrderRecord.getGoodsId());
returnObject.put("type" , rechargeOrder.getType());
returnObject.put("operatorName" , rechargeOrder.getOperatorName());
returnObject.put("rechargeType" , rechargeOrder.getRechargeType());
returnObject.put("rechargeContent" , rechargeOrder.getRechargeContent());
returnObject.put("rechargePrice" , rechargeOrder.getRechargePrice());
returnObject.put("payRealPrice" , rechargeOrder.getPayRealPrice());
returnObject.put("payPrice" , rechargeOrder.getPayPrice());
returnObject.put("createTimed" , rechargeOrder.getCreateTimed());
returnObject.put("payStatus" , rechargeOrder.getPayStatus());
returnObject.put("rechargeStatus" , rechargeOrder.getRechargeStatus());
@ -254,7 +254,7 @@ public class RechargeProductController {
if (StringUtils.isBlank(object.getString("mobile")) ||
StringUtils.isBlank(object.getString("apiConfigProductId")) ||
StringUtils.isBlank(object.getString("appKey")) ||
StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("orderNo")) ||
StringUtils.isBlank(object.getString("notifyUrl")) ||
StringUtils.isBlank(object.getString("sign")) ||
@ -285,7 +285,7 @@ public class RechargeProductController {
Map<String , Object> map = new HashMap<>();
map.put("mobile" , object.getString("mobile"));
map.put("goodsId" , apiProductConfig.getProductId());
map.put("apiConfigProductId" , object.getString("apiConfigProductId"));
map.put("orderNo" , object.getString("orderNo"));
map.put("notifyUrl" , object.getString("notifyUrl"));
map.put("apiKey" , object.getString("apiKey"));
@ -295,8 +295,8 @@ public class RechargeProductController {
log.error("createOrder error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
return ResponseMsgUtil.success(apiOpenService.createOrder(object , apiMerchants , apiProductConfig));
apiOpenService.createOrder(object , apiMerchants , apiProductConfig);
return ResponseMsgUtil.success("下单成功");
} catch (Exception e) {
log.error("HighOpenApiController --> createOrder() error!", e);

Loading…
Cancel
Save