合并代码

dev-discount
袁野 3 years ago
parent 1aca2f5a6b
commit 37a82dbd9f
  1. 20
      hai-bweb/src/main/java/com/bweb/controller/CommonController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 120
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  4. 2
      hai-service/src/main/java/com/hai/enum_type/OrderPushType.java
  5. 2
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  6. 11
      hai-service/src/main/java/com/hai/service/impl/OutRechargeChildOrderServiceImpl.java
  7. 13
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  8. 4
      hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java
  9. 4
      hai-service/src/main/resources/dev/commonConfig.properties

@ -313,5 +313,25 @@ public class CommonController {
}
}
@RequestMapping(value = "/findByLatAndLng", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
public ResponseData findByLatAndLng(
@RequestParam(name = "lng", required = true) String lng,
@RequestParam(name = "lat", required = true) String lat
) {
try {
System.out.println("请求经度==================" + lng);
System.out.println("请求纬度==================" + lat);
JSONObject object = commonService.findByLatAndLng(lng , lat);
System.out.println("请求经纬度========" + object);
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -14,8 +14,10 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.*;
import com.hai.config.CommonSysConst;
import com.hai.config.UnionPayConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighGasOrderRefundMapper;
import com.hai.entity.*;
import com.hai.enum_type.OrderPushType;
import com.hai.enum_type.RechargePayType;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -68,9 +70,77 @@ public class CzOrderController {
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private WechatPayUtil wechatPayUtil;
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST)
@ApiOperation(value = "龙阅充值回调")
@ResponseBody
public void rechargeCallback(
@RequestParam(name = "out_trade_num", required = true) String out_trade_num,
@RequestParam(name = "userid", required = true) Long userid,
@RequestParam(name = "state", required = true) Long state,
@RequestBody String reqBodyStr ,
HttpServletRequest request, HttpServletResponse response) {
try {
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type2.getType());
highGasOrderPush.setOrderNo(out_trade_num);
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(state.toString());
highGasOrderPush.setReturnContent(reqBodyStr);
highGasOrderPushMapper.insert(highGasOrderPush);
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(out_trade_num);
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId());
BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo());
bsRequestRecord.setReturnContent(reqBodyStr);
bsRequestRecord.setUpdateTime(new Date());
bsRequestRecordService.updateRequestRecord(bsRequestRecord);
// 判断是否充值成功
if (state == 1) {
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedSuccess(
rechargeOrder.getRechargeContent() + "充值成功",
String.valueOf(rechargeOrder.getPayRealPrice()),
rechargeOrder.getOrderNo(),
rechargeOrder.getFinishTime(),
RechargePayType.getNameByType(rechargeOrder.getPayType()),
highUser.getOpenId());
}).start();
childOrder.setStatus(101);
rechargeOrder.setRechargeStatus(202);
rechargeOrder.setPayStatus(100);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
} else {
callbackResult(childOrder , rechargeOrder);
}
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter();
writer.write("SUCCESS");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
@RequestMapping(value = "/rechargeCallbackByJj", method = RequestMethod.POST)
@ApiOperation(value = "尖椒充值回调")
@ResponseBody
@ -78,6 +148,18 @@ public class CzOrderController {
try {
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type2.getType());
highGasOrderPush.setOrderNo(dataObject.getString("out_order_id"));
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(dataObject.getString("status"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(dataObject));
highGasOrderPush.setReturnContent(dataObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
// 1 尖椒 2 龙阅
dataObject.put("orderNo" , dataObject.getString("out_order_id"));
@ -103,6 +185,12 @@ public class CzOrderController {
RechargePayType.getNameByType(rechargeOrder.getPayType()),
highUser.getOpenId());
}).start();
childOrder.setStatus(101);
rechargeOrder.setRechargeStatus(202);
rechargeOrder.setPayStatus(100);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
} else {
callbackResult(childOrder , rechargeOrder);
}
@ -121,23 +209,35 @@ public class CzOrderController {
@RequestMapping(value = "/rechargeCallbackByLy", method = RequestMethod.POST)
@ApiOperation(value = "龙阅充值回调")
@ResponseBody
public void rechargeCallbackByLy(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) {
public void rechargeCallbackByLy(
@RequestParam(name = "out_trade_num", required = true) String out_trade_num,
@RequestParam(name = "userid", required = true) Long userid,
@RequestParam(name = "state", required = true) Long state,
@RequestBody String reqBodyStr ,
HttpServletRequest request, HttpServletResponse response) {
try {
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
// 1 尖椒 2 龙阅
dataObject.put("orderNo" , dataObject.getString("out_trade_num"));
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id"));
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type2.getType());
highGasOrderPush.setOrderNo(out_trade_num);
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(state.toString());
highGasOrderPush.setReturnContent(reqBodyStr);
highGasOrderPushMapper.insert(highGasOrderPush);
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(out_trade_num);
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId());
BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo());
bsRequestRecord.setReturnContent(String.valueOf(dataObject));
bsRequestRecord.setReturnContent(reqBodyStr);
bsRequestRecord.setUpdateTime(new Date());
bsRequestRecordService.updateRequestRecord(bsRequestRecord);
// 判断是否充值成功
if (dataObject.getInteger("status") == 3) {
if (state == 1) {
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedSuccess(
@ -148,6 +248,12 @@ public class CzOrderController {
RechargePayType.getNameByType(rechargeOrder.getPayType()),
highUser.getOpenId());
}).start();
childOrder.setStatus(101);
rechargeOrder.setRechargeStatus(202);
rechargeOrder.setPayStatus(100);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
} else {
callbackResult(childOrder , rechargeOrder);
}

@ -8,7 +8,7 @@ import java.util.Objects;
*/
public enum OrderPushType {
type1(1 , "加油订单"),
type2(2 , "话费订单"),
type2(2 , "充值订单"),
type3(3 , "KFC订单"),
type4(4 , "电影票订单"),
type5(5 , "汇联通会员卡"),

@ -538,6 +538,8 @@ public class CommonServiceImpl implements CommonService {
String url = "http://api.map.baidu.com/reverse_geocoding/v3/";
System.out.println("请求经纬度========" + map);
return HttpsUtils.doGet(url , map);
}

@ -44,6 +44,17 @@ public class OutRechargeChildOrderServiceImpl implements OutRechargeChildOrderSe
@Override
public OutRechargeChildOrder findByOrderNo(String orderNo) {
OutRechargeChildOrderExample example = new OutRechargeChildOrderExample();
OutRechargeChildOrderExample.Criteria criteria = example.createCriteria();
criteria.andOrderNoEqualTo(orderNo);
List<OutRechargeChildOrder> list = rechargeChildOrderMapper.selectByExample(example);
if (list.size() > 0 ) {
return list.get(0);
}
return null;
}

@ -215,7 +215,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 1) {
// 如果商品支付总额 小于 满减价格
if (outRechargePrice.getRechargePrice().compareTo(highDiscountUserRel.getHighDiscount().getDiscountCondition()) > 0) {
if (outRechargePrice.getRechargePrice().compareTo(highDiscountUserRel.getHighDiscount().getDiscountCondition()) < 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+highDiscountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券");
}
// 计算支付金额 = 商品充值总额 - 满减额度
@ -297,6 +297,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
outRechargeOrder.setOrderNo("RCG" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
outRechargeOrder.setCreateTimed(new Date());
outRechargeOrder.setGoodsId(goodsId);
outRechargeOrder.setRechargePrice(outRechargePrice.getRechargePrice());
if (object.getLong("memDiscountId") != null) {
outRechargeOrder.setPayPrice(outRechargePrice.getRechargePrice());
} else {
outRechargeOrder.setPayPrice(outRechargePrice.getPayPrice());
}
outRechargeOrder.setType(1);
outRechargeOrder.setOrderPrice(outRechargePrice.getRechargePrice());
outRechargeOrder.setOperatorName(OperatorEnum.getNameByType(outRechargePrice.getOperatorType()));
@ -813,9 +819,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 判断是否充值提交成功
if (childOrder.getStatus() == 102) {
outRechargeOrder.setRechargeStatus(201);
outRechargeOrderService.updateOrder(outRechargeOrder);
}
if (childOrder.getStatus() == 103) {
outRechargeOrder.setRechargeStatus(204);
}
outRechargeOrderService.updateOrder(outRechargeOrder);
}
@Override

@ -122,7 +122,7 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
BigDecimal priceBd = new BigDecimal(dictionary.getCodeName());
outRechargePrice = new OutRechargePrice();
outRechargePrice.setRechargePrice(priceBd);
outRechargePrice.setPayPrice(priceBd.multiply(object.getBigDecimal("discount").divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)));
outRechargePrice.setPayPrice(priceBd.multiply(object.getBigDecimal("discount").divide(new BigDecimal(100))));
outRechargePrice.setDiscount(object.getBigDecimal("discount"));
outRechargePrice.setRechargeType(object.getInteger("rechargeType"));
outRechargePrice.setOperatorType(object.getInteger("operatorType"));
@ -156,7 +156,7 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateRechargePrice(JSONObject object) {
OutRechargePrice outRechargePrice = outRechargePriceMapper.selectByPrimaryKey(object.getLong("id"));
outRechargePrice.setPayPrice(outRechargePrice.getRechargePrice().multiply(object.getBigDecimal("discount").divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)));
outRechargePrice.setPayPrice(outRechargePrice.getRechargePrice().multiply(object.getBigDecimal("discount").divide(new BigDecimal(100))));
outRechargePrice.setDiscount(object.getBigDecimal("discount"));
outRechargePrice.setRechargeType(object.getInteger("rechargeType"));
outRechargePrice.setOperatorType(object.getInteger("operatorType"));

@ -53,13 +53,13 @@ TelApiSecret=d11ee9b41e014a039f030e53ae6f5295
TelMemberId=d13091df65d64aafbf0f35d2093157b7
# Jj
JjNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallback
JjNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallbackByJj
JjAppKey = eaomqcbpdz7yjfih
JjUrl = https://hfcs.dmjvip.com/index.php/third/mobile/
JjAppSecret = xkf9eoq2cjh6uvzp0mtrga134lnibdw8
#LY
LyNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallback
LyNotifyUrl = https://hsgcs.dctpay.com/crest/czOrder/rechargeCallbackByLy
LyApiKey=CMdyxh2gJ7tbXc6rS0KADqPIfVpaQLjU
LyMemberId=18665
LyPostUrl=https://cz.31994.cn/yrapi.php/

Loading…
Cancel
Save