提交代码

dev-discount
胡锐 2 years ago
parent bc6713e33b
commit a9bcd6800f
  1. 4
      hai-bweb/src/main/java/com/bweb/controller/HighGasController.java
  2. 696
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  3. 556
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  4. 1219
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  5. 108
      hai-cweb/src/main/java/com/cweb/controller/pay/QzOrderController.java
  6. 256
      hai-cweb/src/main/java/com/cweb/controller/pay/ThirdOrderController.java
  7. 228
      hai-cweb/src/main/java/com/cweb/controller/pay/TuanYouController.java
  8. 587
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  9. 212
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  10. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  11. 4
      hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java
  12. 97
      hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java
  13. 14
      hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java
  14. 16
      hai-service/src/main/java/com/hai/entity/HighGasOrder.java
  15. 70
      hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java
  16. 50
      hai-service/src/main/java/com/hai/enum_type/OrderPayTypeEnum.java
  17. 2
      hai-service/src/main/java/com/hai/order/service/OrderPayService.java
  18. 17
      hai-service/src/main/java/com/hai/order/service/impl/OrderPayServiceImpl.java
  19. 32
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  20. 2
      hai-service/src/main/java/com/hai/service/impl/ApiOpenServiceImpl.java
  21. 5
      hai-service/src/main/java/com/hai/service/impl/HighFleetOilCardServiceImpl.java
  22. 5
      hai-service/src/main/java/com/hai/service/impl/HighOilCardServiceImpl.java
  23. 1286
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  24. 4
      hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java
  25. 2
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -21,6 +21,7 @@ import com.hai.entity.*;
import com.hai.enum_type.*; import com.hai.enum_type.*;
import com.hai.model.*; import com.hai.model.*;
import com.hai.msg.entity.MsgTopic; import com.hai.msg.entity.MsgTopic;
import com.hai.order.type.OrderPayType;
import com.hai.service.*; import com.hai.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -774,7 +775,6 @@ public class HighGasController {
} }
} }
@RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST) @RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "订单退款") @ApiOperation(value = "订单退款")
@ -876,7 +876,7 @@ public class HighGasController {
//order.setRefundTime(new Date()); //order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice()); //order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order); highOrderService.updateOrderDetail(order);
} else if (order.getPayType().equals(OrderPayTypeEnum.type7.getType())) { } else if (order.getPayType().equals(OrderPayType.PAY_TYPE7.getNumber())) {
// 油卡退款 // 油卡退款
oilCardService.refund(order.getOrderNo()); oilCardService.refund(order.getOrderNo());
} }

@ -1,696 +0,0 @@
/*
package com.cweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConfig;
import com.hai.config.CommonSysConst;
import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope;
import com.hai.enum_type.GasClassGroupTaskStatus;
import com.hai.enum_type.MerAccountMarketingType;
import com.hai.enum_type.OrderChildGoodsTypeEnum;
import com.hai.model.GasPayPriceModel;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DeadlockLoserDataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.net.URLDecoder;
import java.util.*;
import java.util.stream.Collectors;
*/
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/3/26 23:08
*//*
@Controller
@RequestMapping(value = "/highOrder")
@Api(value = "订单接口")
public class HighOrderController {
private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class);
@Autowired
private UserCenter userCenter;
@Resource
private CommonService commonService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighCouponService highCouponService;
@Resource
private HighMerchantStoreService highMerchantStoreService;
@Resource
private HighMerchantAccountMarketingService merchantAccountMarketingService;
@Resource
private HighCouponCodeService highCouponCodeService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private HighDiscountCouponRelService highDiscountCouponRelService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighUserService highUserService;
@Resource
private HighTyAgentOilStationService tyAgentOilStationService;
@Resource
private HighTyAgentPriceService tyAgentPriceService;
@Resource
private HighGasDiscountOilPriceService gasDiscountOilPriceService;
@Resource
private HighGasStaffService gasStaffService;
@Resource
private HighGasClassGroupTaskService gasClassGroupTaskService;
@Resource
private BsCompanyService bsCompanyService;
@RequestMapping(value="/addOrder",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加订单")
public ResponseData addOrder(@RequestBody HighOrder highOrder, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (highOrder.getHighChildOrderList() == null
|| highOrder.getHighChildOrderList().size() == 0
) {
log.error("HighOrderController --> addOrder() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
if (StringUtils.isBlank(userInfoModel.getHighUser().getPhone())) {
log.error("HighOrderController --> addOrder() error!", "未绑定手机号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NO_BIND_PHONE, "");
}
HighDiscountUserRel highDiscountUserRel = null;
if (highOrder.getMemDiscountId() != null) {
// 卡优惠券信息
highDiscountUserRel = highDiscountUserRelService.getRelById(highOrder.getMemDiscountId());
if (highDiscountUserRel == null || highDiscountUserRel.getStatus() != 1) {
log.error("HighOrderController --> addOrder() error!", "优惠券状态错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券状态错误");
}
}
// 定义当前卡券是否可以直冲积分
boolean buyPoints = false;
BigDecimal totalPrice = new BigDecimal("0");
BigDecimal totalActualPrice = new BigDecimal("0");
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
if (childOrder.getGoodsType() == null || childOrder.getGoodsId() == null || childOrder.getSaleCount() == null) {
log.error("HighOrderController --> addOrder() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 商品类型 1:卡卷 2:金币充值 3:团油【加油站】
if (childOrder.getGoodsType() == 1) {
if (childOrder.getSaleCount() != 1) {
log.error("HighOrderController --> addOrder() error!", "卡卷只能购买一张");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡卷只能购买一张");
}
// 查询卡卷信息
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 判断是否实物商品
if (coupon.getWherePost() != null && coupon.getWherePost()) {
if (highOrder.getPostData().getString("address").length() == 0 || highOrder.getPostData().getString("user").length() == 0 || highOrder.getPostData().getString("phone").length() == 0 ) {
log.error("HighOrderController --> addOrder() error!", "请输入收货相关信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入收货相关信息");
}
// 先把String对象转换成Json对象
highOrder.setRemarks(highOrder.getPostData().toString());
}
if (coupon == null) {
log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
}
if (coupon.getReserveStatus() == true) {
if (childOrder.getStoreId() == null) {
log.error("HighOrderController --> addOrder() error!", "未选择门店");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未选择门店");
}
// 查询门店信息
HighMerchantStoreModel merchantStore = highMerchantStoreService.getMerchantStoreById(childOrder.getStoreId());
if (merchantStore == null) {
log.error("HighOrderController --> addOrder() error!", "未选择门店");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息");
}
if (!merchantStore.getMerchantId().equals(coupon.getMerchantId())) {
log.error("HighOrderController --> addOrder() error!", "卡券无法在此门店消费");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡券无法在此门店消费");
}
}
// 支付类型:1.微信支付 2.金币支付
if(coupon.getPayType() == 2) {
highOrder.setPayModel(1); // 支付模式:1 金币,2 第三方平台,3 混合
highOrder.setPayType(3); // 支付方式: 1:支付宝 2:微信 3:金币
}
// 是否达到限购数量
if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) {
log.error("HighOrderController --> addOrder() error!", "已达到限购数量");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",已达到限购数量");
}
// 校验优惠券是否可用 如果使用优惠券就只能使用卡券的原价
if (highDiscountUserRel != null) {
List<HighDiscountCouponRel> discountCouponRelList = highDiscountCouponRelService.getRelByCoupon(coupon.getId());
if (discountCouponRelList.size() > 0) {
HighDiscountUserRel finalHighDiscountUserRel = highDiscountUserRel;
List<HighDiscountCouponRel> collect = discountCouponRelList.stream().filter(o -> o.getDiscountId().equals(finalHighDiscountUserRel.getDiscountId())).collect(Collectors.toList());
if (collect == null || collect.size() == 0) {
log.error("HighOrderController --> addOrder() error!", "无法使用优惠券");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法使用优惠券");
}
}
childOrder.setGoodsPrice(coupon.getSalesPrice());
} else {
childOrder.setGoodsPrice(coupon.getDiscountPrice());
}
// 贵州中石化
if (coupon.getCouponSource() != 4 && coupon.getCouponSource() != 5) {
if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) {
log.error("HighOrderController --> addOrder() error!", "卡卷库存数量不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "系统维护中");
}
}
if (coupon.getBuyPoints()) {
buyPoints = true;
}
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(coupon.getCouponName());
childOrder.setGoodsImg(coupon.getCouponImg());
childOrder.setGoodsSpecName("默认");
childOrder.setExt1(coupon.getCouponSource().toString());
}
if (childOrder.getGoodsType() == 2) {
if (childOrder.getGoodsPrice() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值金额");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值金额");
}
// 查询用户信息
HighUser user = highUserService.findByUserId(childOrder.getGoodsId());
if (user == null) {
log.error("HighOrderController --> addOrder() error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(user.getName());
childOrder.setGoodsImg(user.getHeaderImg());
childOrder.setGoodsSpecName("默认");
}
if (childOrder.getGoodsType() == 3) {
if (childOrder.getGasPriceGun() == null || childOrder.getGasPriceVip() == null || StringUtils.isBlank(childOrder.getGasGunNo()) || StringUtils.isBlank(childOrder.getGasOilNo()) || childOrder.getGasOilType() == null) {
log.error("HighOrderController --> addOrder() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 加油限制
if (childOrder.getGasOilType().equals(1)) {
SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "汽油");
if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "汽油加油金额不能超过" + refuelLimit.getCodeValue()+"元");
}
} else if (childOrder.getGasOilType().equals(2)){
SecDictionary refuelLimit = commonService.mappingSysName("REFUEL_LIMIT", "柴油");
if (refuelLimit != null && childOrder.getGoodsPrice().compareTo(new BigDecimal(refuelLimit.getCodeValue())) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "柴油加油金额不能超过" + refuelLimit.getCodeValue()+"元");
}
}
if (highOrderService.getGasTheDayOrderNum(userInfoModel.getHighUser().getId()) >= 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
if (StringUtils.isNotBlank(highOrder.getGasStaffCode())) {
String qrCodeSignKey = commonService.getDictionaryCodeName("QR_CODE_SIGN_KEY", "1");
if (StringUtils.isBlank(qrCodeSignKey)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知秘钥");
}
String staffId;
try {
staffId = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(URLDecoder.decode(highOrder.getGasStaffCode(),"UTF-8")), qrCodeSignKey);
} catch (Exception e) {
log.error("HighOrderController --> addOrder() error!", "收银员code解析失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "收银员code解析失败");
}
// 查询员工
HighGasStaff gasStaff = gasStaffService.getStaffDetailById(Long.parseLong(staffId));
if (gasStaff == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知收银员");
}
if (gasStaff.getMerchantStoreId().equals(childOrder.getGoodsId())) {
childOrder.setGasStaffId(gasStaff.getId());
childOrder.setGasStaffName(gasStaff.getName());
}
}
// 查询加油站是否开启班组
Map<String, Object> classGroup = new HashMap<>();
classGroup.put("merchantStoreId", childOrder.getGoodsId());
classGroup.put("status", GasClassGroupTaskStatus.status1.getStatus());
List<HighGasClassGroupTask> groupTaskList = gasClassGroupTaskService.getGroupTaskList(classGroup);
if (groupTaskList.size() > 0) {
HighGasClassGroupTask groupTask = groupTaskList.get(0);
childOrder.setGasClassGroupId(groupTask.getGasClassGroupId());
childOrder.setGasClassGroupName(groupTask.getGasClassGroupName());
childOrder.setGasClassGroupTaskId(groupTask.getId());
}
// 查询门店
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId());
if (store == null) {
log.error("HighOrderController --> addOrder() error!", "未找到门店信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息");
}
if (highOrder.getIsTyAgent() != null && highOrder.getIsTyAgent().equals(true)) {
// 查询加油站
HighTyAgentOilStation oilStation = tyAgentOilStationService.getDetailByOilStationId(childOrder.getGoodsId());
if (oilStation != null) {
childOrder.setGasSalesmanId(oilStation.getTySalesmanId());
childOrder.setGasSalesmanName(oilStation.getTySalesmanName());
childOrder.setGasAgentId(oilStation.getTyAgentId());
childOrder.setGasAgentName(oilStation.getTyAgentName());
childOrder.setGasOrgId(oilStation.getOrganizationId());
childOrder.setGasOrgName(oilStation.getOrganizationName());
}
}
// 营销减免的金额
BigDecimal marketingPrice = merchantAccountMarketingService.getPrice(store.getMerchantId(), MerAccountMarketingType.type3.getType(), Integer.valueOf(childOrder.getGasOilNo()));
// 计算价格
GasPayPriceModel priceModel = gasDiscountOilPriceService.oilPriceDiscountCompute(childOrder.getGoodsPrice(), childOrder.getGoodsId(), childOrder.getGasOilNo(), highOrder.getIsTyAgent());
// 使用了优惠价
if (highDiscountUserRel != null) {
// 支付价格
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
// 油价信息
childOrder.setGasPriceGun(priceModel.getPriceGun());
childOrder.setGasPriceVip(priceModel.getPriceGun());
childOrder.setGasPriceOfficial(new BigDecimal("0"));
childOrder.setGasPricePlatform(priceModel.getPriceGun());
childOrder.setGasOilLiters(priceModel.getOilLiters());
childOrder.setGasDiscount(new BigDecimal("0"));
childOrder.setExt1(childOrder.getGasPricePlatform().toString());
childOrder.setGasOilSubsidy(new BigDecimal("0"));
childOrder.setGasLitersPreferences(new BigDecimal("0"));
childOrder.setGasPricePreferences(priceModel.getPriceGun());
} else {
// 支付价格
childOrder.setGoodsActualPrice(priceModel.getPayPrice());
// 油价信息
childOrder.setGasPriceGun(priceModel.getPriceGun());
childOrder.setGasPriceVip(priceModel.getPriceVip());
childOrder.setGasPriceOfficial(priceModel.getPriceOfficial());
childOrder.setGasPricePlatform(priceModel.getPricePlatform());
childOrder.setGasOilLiters(priceModel.getOilLiters());
childOrder.setGasDiscount(priceModel.getDiscount());
childOrder.setExt1(priceModel.getPricePlatform().toString());
childOrder.setGasOilSubsidy(priceModel.getPreferentialMargin());
childOrder.setGasLitersPreferences(priceModel.getLitersPreferences());
childOrder.setGasPricePreferences(priceModel.getPricePreferences());
}
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
childOrder.setGoodsImg(CommonSysConst.getSysConfig().getHsgDomainName()+"/filesystem/"+store.getStoreLogo());
} else {
childOrder.setGoodsImg(store.getStoreLogo());
}
childOrder.setGoodsName(store.getStoreName());
childOrder.setGoodsSpecName("默认");
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
// 成本价 油站价 减 营销策略价
childOrder.setGasPriceCost(priceModel.getPriceGun().subtract(marketingPrice));
if (marketingPrice.compareTo(new BigDecimal("0")) <= 0) {
childOrder.setGasPriceCostTotal(childOrder.getTotalPrice());
} else {
childOrder.setGasPriceCostTotal(childOrder.getGasPriceCost().multiply(childOrder.getGasOilLiters()).setScale(2, BigDecimal.ROUND_HALF_DOWN));
}
}
if (childOrder.getGoodsType() == 7) {
// 查询优惠券包
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(childOrder.getGoodsId().intValue());
if (discountPackage == null) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到优惠券包");
}
if (discountPackage.getStatus() != 1) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不可用");
}
if (discountPackageActualService.getStockByPackageId(discountPackage.getId()) == 0) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "库存数量不足");
}
if (discountPackage.getPurchaseNum() < discountPackageActualService.userPurchaseByUserId(userInfoModel.getHighUser().getId().intValue(), discountPackage.getId())) {
log.error("HighOrderController --> addOrder() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过购买限制");
}
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(discountPackage.getTitle());
childOrder.setGoodsImg(discountPackage.getListImg());
childOrder.setGoodsPrice(discountPackage.getPrice());
childOrder.setGoodsActualPrice(discountPackage.getPrice());
childOrder.setGoodsSpecName("默认");
}
// 汇联通充值
if (childOrder.getGoodsType() == 8) {
if (childOrder.getGoodsPrice() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值金额");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值金额");
}
if (highOrder.getMemCardNo() == null) {
log.error("HighOrderController --> addOrder() error!", "请设置充值卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请设置充值卡号");
}
// 查询用户信息
HighUser user = highUserService.findByUserId(childOrder.getGoodsId());
if (user == null) {
log.error("HighOrderController --> addOrder() error!", "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
highOrder.setPayType(2); // 第三方平台
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(user.getName());
childOrder.setGoodsImg(user.getHeaderImg());
childOrder.setGoodsSpecName("默认");
}
childOrder.setMemId(userInfoModel.getHighUser().getId());
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
childOrder.setGiveawayType(false); // 是否是赠品 0:否 1:是
childOrder.setChildOrdeStatus(1); // 1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
childOrder.setPraiseStatus(0);
// 累计订单价格
totalPrice = totalPrice.add(childOrder.getTotalPrice());
totalActualPrice = totalActualPrice.add(childOrder.getGoodsActualPrice());
}
// 积分抵扣金额
BigDecimal integralDeductionPrice = new BigDecimal(0);
if (buyPoints && highOrder.getPayGold() != null) {
integralDeductionPrice = new BigDecimal(highOrder.getPayGold()).divide(new BigDecimal(100));
String remark = "订单" + highOrder.getOrderNo() + "购买,使用积分:" + highOrder.getPayGold();
highUserService.goldHandle(userInfoModel.getHighUser().getId(), highOrder.getPayGold(), 2, 2, highOrder.getId() , remark);
BigDecimal payGold = new BigDecimal(highOrder.getPayGold());
if (payGold.compareTo(totalActualPrice.subtract(integralDeductionPrice)) < 0) {
highOrder.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
highOrder.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币
}
}
if (request.getHeader("regionId") != null && request.getHeader("regionId").length() != 0) {
SecRegion region = commonService.getParentByRegion(Long.valueOf(request.getHeader("regionId")));
if (region != null) {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
if (bsCompany != null) {
highOrder.setCompanyId(bsCompany.getId());
}
}
}
highOrder.setMerchId(request.getHeader("mchId"));
highOrder.setWhetherRebate(false);
highOrder.setTotalPrice(totalPrice);
highOrder.setPayablePrice(totalActualPrice);
// 是否使用了优惠券
if (highDiscountUserRel != null) {
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName());
// 优惠券使用范围
if (highDiscountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type1.getType())) {
// 暂无限制
} else if (highDiscountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type2.getType())) {
// 1:卡卷 2:金币充值 3:团油【加油站】 4: KFC 5:电影票 6:话费充值
if (!highOrder.getHighChildOrderList().get(0).getGoodsType().equals(1)) {
log.error("HighOrderController --> addOrder() error!", "此优惠券只能购买卡券商品使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能购买卡券商品使用");
}
} else if (highDiscountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type3.getType())) {
if (!highOrder.getHighChildOrderList().get(0).getGoodsType().equals(6)) {
log.error("HighOrderController --> addOrder() error!", "此优惠券只能充值话费中使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能充值话费中使用");
}
} else if (highDiscountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type7.getType())) {
if (!highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
log.error("HighOrderController --> addOrder() error!", "此优惠券只能充值话费中使用");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能充值话费中使用");
}
} else {
log.error("HighOrderController --> addOrder() error!", "暂时无法使用此优惠券");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用此优惠券");
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 1) {
// 如果订单总额 小于 满减价格
if (highOrder.getTotalPrice().compareTo(highDiscountUserRel.getHighDiscount().getDiscountCondition()) > 1) {
log.error("HighOrderController --> addOrder() error!", "订单未达到满减额度");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+highDiscountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券");
}
// 订单总额 - 满减额度
BigDecimal payablePrice = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (payablePrice.compareTo(new BigDecimal("0")) < 0) {
highOrder.setPayablePrice(new BigDecimal("0"));
} else {
highOrder.setPayablePrice(payablePrice);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 2) {
// 订单总额 - 满减额度
BigDecimal payablePrice = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (payablePrice.compareTo(new BigDecimal("0")) == -1) {
highOrder.setPayablePrice(new BigDecimal("0"));
} else {
highOrder.setPayablePrice(payablePrice);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 3) {
// 折扣除100
BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice();
// 订单总额 * 折扣
BigDecimal payablePrice = highOrder.getTotalPrice().multiply(discountPrice).setScale(2, BigDecimal.ROUND_HALF_DOWN);
highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(payablePrice));
highOrder.setPayablePrice(payablePrice);
}
}
highOrder.setOrderNo("HF" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5));
highOrder.setMemId(userInfoModel.getHighUser().getId());
highOrder.setMemName(userInfoModel.getHighUser().getName());
highOrder.setMemPhone(userInfoModel.getHighUser().getPhone());
highOrder.setCreateTime(new Date());
highOrder.setOrderStatus(1);
highOrder.setPrintStatus(false);
highOrder.setPrintNum(0);
highOrder.setPayPrice(highOrder.getPayablePrice().subtract(integralDeductionPrice));
highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(highOrder.getPayPrice()));
highOrderService.insertOrder(highOrder);
return ResponseMsgUtil.success(highOrderService.getOrderById(highOrder.getId()));
} catch (DeadlockLoserDataAccessException deadlockLoserDataAccessException) {
log.error("HighActivityController -> userLottery() error!", "服务器繁忙");
return ResponseMsgUtil.builderResponse(ErrorCode.SERVER_BUSY_ERROR.getCode(),ErrorCode.SERVER_BUSY_ERROR.getMsg(),null);
} catch (Exception e) {
log.error("HighOrderController -> addOrder() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getOrderByOrderNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据订单号查询订单详情")
public ResponseData getOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
return ResponseMsgUtil.success(highOrderService.getOrderByOrderNo(orderNo));
} catch (Exception e) {
log.error("HighOrderController --> getOrderByOrderNo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询订单详情")
public ResponseData getOrderById(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
return ResponseMsgUtil.success(highOrderService.getOrderById(orderId));
} catch (Exception e) {
log.error("HighOrderController --> getOrderById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/cancelOrder", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据订单id 取消订单")
public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
highOrderService.cancelOrder(orderId);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> cancelOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/orderCheck", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据订单id查看订单")
public ResponseData orderCheck(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
highOrderService.orderCheck(orderId);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> cancelOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/cancelOrderByOrderNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据订单号 取消订单")
public ResponseData cancelOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
HighOrder order = highOrderService.getOrderByOrderNo(orderNo);
if (order == null) {
log.error("HighOrderController --> addOrder() error!", "未找到订单");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
highOrderService.cancelOrder(order.getId());
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> cancelOrderByOrderNo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户订单")
public ResponseData getUserOrderList(
@RequestParam(name = "status", required = false) String status,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
Map<String,Object> map = new HashMap<>();
map.put("memId", userInfoModel.getHighUser().getId());
map.put("status", status);
map.put("orderNo", orderNo);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highOrderService.getOrderList(map)));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}
*/

@ -1,556 +0,0 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.cweb.config.WxMsgConfig;
import com.google.gson.JsonObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
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;
import com.hai.service.*;
import com.hai.service.pay.impl.GoodsOrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
@Controller
@RequestMapping(value = "/czOrder")
@Api(value = "充值回调")
public class CzOrderController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@Resource
private UserCenter userCenter;
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService outRechargeChildOrderService;
@Resource
private BsRequestRecordService bsRequestRecordService;
@Resource
private HighUserService highUserService;
@Resource
private UnionPayConfig unionPayConfig;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private ApiOrderRecordService apiOrderRecordService;
@Resource
private BsIntegralRebateService bsIntegralRebateService;
@Resource
private HighGoldRecService highGoldRecService;
@RequestMapping(value = "/rechargeCallbackByJj", method = RequestMethod.POST)
@ApiOperation(value = "尖椒充值回调")
@ResponseBody
public void rechargeCallbackByJj(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) {
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"));
OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id"));
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId());
BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo());
bsRequestRecord.setReturnContent(String.valueOf(dataObject));
bsRequestRecord.setUpdateTime(new Date());
bsRequestRecordService.updateRequestRecord(bsRequestRecord);
// 判断是否充值成功
if (dataObject.getInteger("status") == 3) {
if (rechargeOrder.getRechargeStatus() ==201) {
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);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
} 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 = "/rechargeCallbackByLy", method = RequestMethod.POST)
@ApiOperation(value = "龙阅充值回调")
@ResponseBody
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 {
// 推送记录
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) {
if (rechargeOrder.getRechargeStatus() ==201) {
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);
rechargeOrder.setFinishTime(new Date());
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
if (rechargeOrder.getPayType() == 6) {
apiOrderRecord(rechargeOrder);
}
} 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 = "/rechargeCallbackByCy", method = RequestMethod.POST)
@ApiOperation(value = "城宇充值回调")
@ResponseBody
public void rechargeCallbackByCy(@RequestBody String reqBodyStr, HttpServletRequest request, HttpServletResponse response) {
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"));
//
// OutRechargeChildOrder childOrder = outRechargeChildOrderService.findByOrderNo(dataObject.getString("out_order_id"));
//
// OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId());
//
// BsRequestRecord bsRequestRecord = bsRequestRecordService.findRequestRecordByOrderNo(childOrder.getOrderNo());
//
// bsRequestRecord.setReturnContent(String.valueOf(dataObject));
// bsRequestRecord.setUpdateTime(new Date());
// bsRequestRecordService.updateRequestRecord(bsRequestRecord);
//
// // 判断是否充值成功
// if (dataObject.getInteger("status") == 3) {
// 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);
// if (rechargeOrder.getPayType() == 6) {
// apiOrderRecord(rechargeOrder);
// }
//
// } 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);
}
}
// 回调结果处理
private void callbackResult(OutRechargeChildOrder childOrder , OutRechargeOrder rechargeOrder) throws Exception {
// 101:充值成功 102: 充值中 103:充值失败 104 未充值
// 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (childOrder.getStatus() == 102 && rechargeOrder.getPayStatus() == 102) {
Date rechargeTime = rechargeOrder.getCreateTimed();
Date currentTime = new Date();
// 当前时间减去充值时间
int hours = (int) ((currentTime.getTime() - rechargeTime.getTime()) / (1000 * 60 * 60));
// // 判断快充 并且 充值时间小于6
// if (rechargeOrder.getRechargeType() == 1 && hours < 6) {
// outRechargeOrderService.pollRequest(rechargeOrder);
// return;
// }
// 判断慢充 并且 充值时间小于72
if (hours < 72) {
outRechargeOrderService.pollRequest(rechargeOrder);
return;
}
rechargeOrder.setRechargeStatus(203);
childOrder.setStatus(103);
outRechargeOrderService.updateOrder(rechargeOrder);
outRechargeChildOrderService.updateOrder(childOrder);
outRechargeOrderService.refundOrder(rechargeOrder.getId());
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedFail(
rechargeOrder.getRechargeContent() + "充值失败",
String.valueOf(rechargeOrder.getPayRealPrice()),
highUser.getOpenId());
}).start();
}
}
@RequestMapping(value="/apiCallBack",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "apiCallBack")
public String test(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
System.out.println("reqBodyStr");
return "SUCCESS";
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
}
@RequestMapping(value="/orderToPayByWx",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "微信订单支付发起支付")
public ResponseData orderToPayByWx(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
Integer openIdType = jsonObject.getInteger("openIdType"); // openId类型 1:小程序 2:公众号
String openId = jsonObject.getString("openId"); // openId
if (orderId == null || StringUtils.isBlank(openId)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
if (order == null) {
log.error("orderToPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getPayStatus() != 101) {
log.error("orderToPayByWx error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
Map<String,Object> map = new HashMap<>();
map.put("orderNo", order.getOrderNo());
map.put("payPrice", order.getPayRealPrice());
map.put("orderScene", "RECHARGE_ORDER");
map.put("body","充值话费");
map.put("subject","充值话费");
//微信支付
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8");
int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo();
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号
if (openIdType != null && openIdType.equals(2)) {
weChatPayReqInfo.setSub_appid("wxa075e8509802f826"); //商户号公众号
} else {
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId());//小程序
}
weChatPayReqInfo.setSub_mch_id("1614670195");
weChatPayReqInfo.setSub_openid(openId);
weChatPayReqInfo.setNonce_str(nonce_str); //随机字符串
weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述
weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号
weChatPayReqInfo.setTotal_fee(total_fee); //总金额
weChatPayReqInfo.setSpbill_create_ip("139.159.177.244"); //终端ip
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url
weChatPayReqInfo.setTrade_type("JSAPI"); //交易类型
weChatPayReqInfo.setAttach(map.get("orderScene").toString());
weChatPayReqInfo.setProfit_sharing("N");
//附加数据,区分订单类型
Map<String,String> payMap = new HashMap<>();
payMap.put("app_id", weChatPayReqInfo.getSub_appid());
payMap.put("api_key",SysConst.getSysConfig().getWxApiKey());
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
return ResponseMsgUtil.success(sortedMap);
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/hltUnionCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "工会卡支付")
public ResponseData hltUnionCardPay(@RequestBody JSONObject body,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (body == null
|| body.getLong("orderId") == null
|| StringUtils.isBlank(body.getString("password"))
|| StringUtils.isBlank(body.getString("cardNo"))
) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(body.getLong("orderId"));
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getPayStatus() != 101) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(order.getUserId());
if (userPayPassword == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(body.getString("password"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码
if (!AESEncodeUtil.aesEncrypt(body.getString("password")).equals(userPayPassword.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo"));
if (userCard == null) {
log.error("hltUnionCardPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
outRechargeOrderService.hltUnionCardPay(userCard, order);
return ResponseMsgUtil.success(outRechargeOrderService.findByOrderId(body.getLong("orderId")));
} catch (Exception e) {
log.error("hltUnionCardPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderToUnionPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "订单支付发起银联支付")
public ResponseData orderToUnionPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
if (orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getPayStatus() != 101) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPayRealPrice(), "话费充值", CommonSysConst.getSysConfig().getUnionPayTelNotifyUrl(), request));
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
private void apiOrderRecord(OutRechargeOrder rechargeOrder) {
Map<String, Object> orderMap = new HashMap<>();
orderMap.put("orderId" , rechargeOrder.getId());
// 查询是否用重复订单
ApiOrderRecord apiOrderRecord = apiOrderRecordService.queryOrderResult(orderMap);
apiOrderRecord.setStatus(100);
apiOrderRecord.setRequestTime(new Date());
apiOrderRecordService.updateOrderRecord(apiOrderRecord);
}
}

@ -1,108 +0,0 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.security.AESEncodeUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.WxOrderConfig;
import com.hai.dao.HighGasOrderRefundMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderRefund;
import com.hai.entity.HighOrder;
import com.hai.model.OrderRefundModel;
import com.hai.service.HighOrderService;
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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.Date;
@Controller
@RequestMapping(value = "/qianzhu")
@Api(value = "千猪回调")
public class QzOrderController {
private static Logger log = LoggerFactory.getLogger(QzOrderController.class);
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/orderNotify", method = RequestMethod.POST)
@ApiOperation(value = "千猪订单回调")
public void orderNotify(@RequestBody String reqBodyStr,HttpServletRequest request, HttpServletResponse response) {
try {
log.info(reqBodyStr);
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
HighOrder order = highOrderService.getOrderByOrderNo(dataObject.getString("orderNo"));
if (order != null) {
JSONObject data = dataObject.getJSONObject("data");
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
// 4:KFC肯德基 5:电影票
if (childOrder.getGoodsType() == 4) {
// 10:已出票 -5:已取消 -3:部分取消 -10:退款
if (dataObject.getInteger("eventType") == -5) {
// 微信退款
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), data.getBigDecimal("cancelReason"), data.getBigDecimal("cancelReason"));
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
childOrder.setChildOrderStatus(5);
order.setOrderStatus(5);
order.setCancelTime(new Date());
order.setCancelRemarks(data.getString("cancelReason"));
highOrderService.updateOrderDetail(order);
}
}
if (dataObject.getInteger("eventType") == -10) {
// 微信退款
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), data.getBigDecimal("refundAmount"), data.getBigDecimal("refundAmount"));
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
childOrder.setChildOrderStatus(4);
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(data.getBigDecimal("refundAmount"));
highOrderService.updateOrderDetail(order);
}
}
}
if (childOrder.getGoodsType() == 5) {
// 5:已支付(默认不发) 10:已出票 -5:已取消 15:交易成功
if (dataObject.getInteger("eventType") == -5) {
childOrder.setChildOrderStatus(5);
order.setOrderStatus(5);
order.setCancelTime(new Date());
order.setCancelRemarks(data.getString("cancelReason"));
}
if (dataObject.getInteger("eventType") == 15) {
childOrder.setChildOrderStatus(3);
order.setOrderStatus(3);
order.setFinishTime(new Date());
}
}
}
highOrderService.updateOrder(order);
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);
}
}
}

@ -1,256 +0,0 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.OrderType;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.MathUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.UnionPayConfig;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserPayPasswordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
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.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ThreadLocalRandom;
@Controller
@RequestMapping(value = "/thirdOrder")
@Api(value = "第三方订单支付接口")
public class ThirdOrderController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@Resource
private UserCenter userCenter;
@Resource
private HighOrderService highOrderService;
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private HighUserCardService highUserCardService;
@Resource
private UnionPayConfig unionPayConfig;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@RequestMapping(value="/orderToPayByWx",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "微信订单支付发起支付")
public ResponseData orderToPayByWx(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
Integer openIdType = jsonObject.getInteger("openIdType"); // openId类型 1:小程序 2:公众号
String openId = jsonObject.getString("openId"); // openId
if (orderId == null || StringUtils.isBlank(openId)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
HighOrder order = highOrderService.getOrderById(jsonObject.getLong("orderId"));
if (order == null) {
log.error("orderToPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getOrderStatus() != 1) {
log.error("orderToPayByWx error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
Map<String,Object> map = new HashMap<>();
map.put("orderNo", order.getOrderNo());
map.put("payPrice", order.getPayRealPrice());
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
map.put("orderScene", OrderType.KFC_ORDER.getModuleCode());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
map.put("orderScene", OrderType.STARBUCKS_ORDER.getModuleCode());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10) {
map.put("orderScene", OrderType.THIRD_ORDER.getModuleCode());
}
// 肯德基订单 星巴克订单
map.put("body", "购买第三方产品");
map.put("subject","购买第三方产品");
//微信支付
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8");
int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo();
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号
if (openIdType != null && openIdType.equals(2)) {
weChatPayReqInfo.setSub_appid("wxa075e8509802f826"); //商户号公众号
} else {
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId());//小程序
}
weChatPayReqInfo.setSub_mch_id("1614670195");
weChatPayReqInfo.setSub_openid(openId);
weChatPayReqInfo.setNonce_str(nonce_str); //随机字符串
weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述
weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号
weChatPayReqInfo.setTotal_fee(total_fee); //总金额
weChatPayReqInfo.setSpbill_create_ip("139.159.177.244"); //终端ip
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url
weChatPayReqInfo.setTrade_type("JSAPI"); //交易类型
weChatPayReqInfo.setAttach(map.get("orderScene").toString());
weChatPayReqInfo.setProfit_sharing("N");
//附加数据,区分订单类型
Map<String,String> payMap = new HashMap<>();
payMap.put("app_id", weChatPayReqInfo.getSub_appid());
payMap.put("api_key",SysConst.getSysConfig().getWxApiKey());
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
return ResponseMsgUtil.success(sortedMap);
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/hltUnionCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "工会卡支付")
public ResponseData hltUnionCardPay(@RequestBody JSONObject body, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (body == null
|| body.getLong("orderId") == null
|| StringUtils.isBlank(body.getString("password"))
|| StringUtils.isBlank(body.getString("cardNo"))
) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo"));
if (userCard == null) {
log.error("hltUnionCardPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
// 订单
HighOrder order = highOrderService.getOrderById(body.getLong("orderId"));
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款
if (order.getOrderStatus() != 1) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(order.getMemId());
if (userPayPassword == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(body.getString("password"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码
if (!AESEncodeUtil.aesEncrypt(body.getString("password")).equals(userPayPassword.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
highOrderService.hltUnionCardPayByThirdProduct(userCard, order.getId());
return ResponseMsgUtil.success(order);
} catch (Exception e) {
log.error("hltUnionCardPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderToUnionPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "订单支付发起银联支付")
public ResponseData orderToUnionPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
if (orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
HighOrder order = highOrderService.getOrderById(orderId);
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getOrderStatus() != 1) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPayRealPrice(), "购买第三方产品", CommonSysConst.getSysConfig().getUnionPayNotifyUrl(), request));
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,228 +0,0 @@
package com.cweb.controller.pay;
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.AESEncodeUtil;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.UnionPayConfig;
import com.hai.config.WxOrderConfig;
import com.hai.dao.HighGasOrderRefundMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderRefund;
import com.hai.entity.HighOrder;
import com.hai.enum_type.OrderPayTypeEnum;
import com.hai.model.OrderRefundModel;
import com.hai.model.ResponseData;
import com.hai.service.HighOilCardService;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.security.*;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping(value = "/tuanyou")
@Api(value = "团油回调")
public class TuanYouController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@Resource
private HighOrderService highOrderService;
@Resource
private HighGasOrderRefundMapper highGasOrderRefundMapper;
@Resource
private HighUserService highUserService;
@Resource
private HighOilCardService oilCardService;
@RequestMapping(value = "/orderPaymentNotify", method = RequestMethod.POST)
@ApiOperation(value = "订单支付回调")
public void orderPaymentNotify(HttpServletRequest request, HttpServletResponse response) {
try {
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
@RequestMapping(value = "/orderRefundNotify", method = RequestMethod.POST)
@ApiOperation(value = "订单退款回调")
@ResponseBody
public void orderRefundNotify(@RequestBody String reqBodyStr,HttpServletRequest request, HttpServletResponse response) {
try {
log.info(reqBodyStr);
HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund();
highGasOrderRefund.setCreateTime(new Date());
highGasOrderRefund.setReturnContent(reqBodyStr);
highGasOrderRefundMapper.insert(highGasOrderRefund);
JSONObject dataObject = JSONObject.parseObject(reqBodyStr, JSONObject.class);
String dataStr = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(dataObject.getString("data")), CommonSysConst.getSysConfig().getTuanYouAppSecret());
JSONObject object = JSONObject.parseObject(dataStr);
// 查询订单
HighOrder order = highOrderService.getOrderByOrderNo(object.getString("thirdOrderNo"));
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
if (order != null) {
if (order.getOrderStatus() == 2 || order.getOrderStatus() == 3 || order.getOrderStatus() == 6 || order.getOrderStatus() == 7) {
// 退单结果 true:成功 false:失败
if (object.getBoolean("refundResult") == true && order != null) {
if (order.getPayType() == 2) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order);
}
} else if (order.getPayType() == 3){
String remark = "订单" + order.getOrderNo() + "退款,退还积分:" + order.getPayGold();
// 积分退款
highUserService.goldHandle(order.getMemId(), order.getPayGold(),1, 3, order.getId() , remark);
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order);
} else if (order.getPayType() == 4) {
String refundOrderNo = String.valueOf(System.currentTimeMillis());
JSONObject refund = HuiLianTongUnionCardConfig.refund(refundOrderNo, order.getPaySerialNo());
if(!refund.getString("respCode").equals("0000")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR,refund.getString("respMessage"));
}
JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(refund.getString("data"));
if (consumptionResult.getBoolean("success") != true) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!"+consumptionResult.getString("message"));
}
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order);
} else if (order.getPayType() == 5) {
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, 00);
startTime.set(Calendar.MINUTE, 00);
startTime.set(Calendar.SECOND, 00);
Calendar endTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, 23);
startTime.set(Calendar.MINUTE, 59);
startTime.set(Calendar.SECOND, 59);
// 订单是否处于当日的订单
if (DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) {
// 订单撤销
JSONObject refund = UnionPayConfig.cancel(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo());
System.out.println(refund.toJSONString());
if (!refund.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
}
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order);
} else {
// 订单退款
JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
System.out.println(refund.toJSONString());
if (!refund.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
JSONObject refund2 = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID1, UnionPayConfig.TERM_ID1, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund2.getString("resultcode").equals("00") || !refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund2.getString("returnmsg"));
}
}
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrderDetail(order);
}
} else if (order.getPayType().equals(OrderPayTypeEnum.type7.getType())) {
// 油卡退款
oilCardService.refund(order.getOrderNo());
}
} else if (!object.getBoolean("refundResult") == true && order != null) {
order.setOrderStatus(7);
//order.setRefusalRefundContent(object.getString("refundFailReason"));
highOrderService.updateOrderDetail(order);
}
}
}
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
} finally {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter writer= null;
try {
writer = response.getWriter();
} catch (IOException e) {
e.printStackTrace();
}
writer.write("success");
}
}
@RequestMapping(value = "/abnormalOrderRefund", method = RequestMethod.POST)
@ApiOperation(value = "异常订单退款")
@ResponseBody
public ResponseData abnormalOrderRefund(@RequestBody JSONObject body) {
try {
if (StringUtils.isNotBlank(body.getString("orderNo"))) {
// 查询订单
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("orderNo"));
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
if (order != null && order.getOrderStatus() == 2) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(4);
}
order.setOrderStatus(4);
//order.setRefundTime(new Date());
//order.setRefundPrice(order.getPayRealPrice());
highOrderService.updateOrder(order);
return ResponseMsgUtil.success("退款成功");
}
}
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,587 +0,0 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSON;
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.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.*;
import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighPayRecordMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
import com.hai.enum_type.MerStoreAmountSourceTypeEnum;
import com.hai.enum_type.MerStoreAmountTypeEnum;
import com.hai.enum_type.MerchantStoreSourceType;
import com.hai.enum_type.OrderPushType;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.msg.entity.MsgTopic;
import com.hai.service.*;
import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.*;
@Controller
@RequestMapping(value = "/unionPay")
@Api(value = "银联支付")
public class UnionPayController {
private static Logger log = LoggerFactory.getLogger(UnionPayController.class);
@Resource
private RedisTemplate redisTemplate;
@Resource
private HighOrderService highOrderService;
@Resource
private HighOrderPreService highOrderPreService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private HighCouponService highCouponService;
@Resource
private HighCouponCodeService highCouponCodeService;
@Resource
private HighUserService highUserService;
@Resource
private HighUserCouponMapper highUserCouponMapper;
@Resource
private HighMerchantStoreService highMerchantStoreService;
@Resource
private HighProfitSharingRecordService highProfitSharingRecordService;
@Resource
private HighCouponCodeOtherMapper highCouponCodeOtherMapper;
@Resource
private HighActivityInfoService highActivityInfoService;
@Resource
private HighActivityUserLotteryNumService highActivityUserLotteryNumService;
@Resource
private NotifyService notifyService;
@Resource
private HuiLianTongConfig huiLianTongConfig;
@Resource
private HighPayRecordMapper highPayRecordMapper;
@Resource
private HighDiscountPackageDiscountActualService discountPackageDiscountActualService;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageService discountPackageService;
@Resource
private HighDiscountPackageRecordService discountPackageRecordService;
@Resource
private HighDiscountUserRelService highDiscountUserRelService;
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private ApiMemberProductService apiMemberProductService;
@Resource
private ShellGroupService shellGroupService;
@Resource
private JinZhuJiaYouService jinZhuJiaYouService;
@RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation(value = "银联支付 -> 异步回调")
public void notify(@RequestBody String params,HttpServletRequest request, HttpServletResponse response) {
try {
System.out.println(params);
log.info(params);
if (StringUtils.isNotBlank(params)) {
// 参数解码
String paramsStr = URLDecoder.decode(params,"utf-8");
// 记录请求参数
HighPayRecord payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date());
payRecord.setResType(2);
payRecord.setPayType(3);
payRecord.setBodyInfo(paramsStr);
highPayRecordMapper.insert(payRecord);
// 转换成JSON格式
JSONObject body = JSONObject.parseObject(paramsStr.substring(0, paramsStr.length() - 1));
if (StringUtils.isNotBlank(body.getString("tradetrace"))) {
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("tradetrace"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
// 查询用户
HighUser highUser = highUserService.findByUserId(order.getMemId());
if (order.getOrderStatus() == 1) {
order.setPaySerialNo(body.getString("wtorderid")); // 支付流水号
//order.setPayRealPrice(body.getBigDecimal("payamt")); // 实付金额
order.setPayRealPrice(order.getPayPrice()); // 实付金额
order.setPayTime(new Date()); // 支付时间
//order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
order.setPayType(5); // 支付方式: 1:支付宝 2:微信 3:金币 4:工会卡 5:银联 6:银联分期
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
/*
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
// 商品类型 商品类型 1:卡卷 2:金币充值
if (highChildOrder.getGoodsType() == 1) {
highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 是否预约
if (coupon.getReserveStatus() == true) {
HighOrderPre orderPre = new HighOrderPre();
orderPre.setCompanyId(coupon.getCompanyId());
orderPre.setMerchantId(coupon.getMerchantId());
orderPre.setMerchantStoreId(highChildOrder.getStoreId());
orderPre.setPreOrderNo(System.currentTimeMillis()+"");
orderPre.setOrderId(order.getId());
orderPre.setOrderNo(order.getOrderNo());
orderPre.setChildOrderId(highChildOrder.getId());
orderPre.setPayRealPrice(order.getPayRealPrice());
orderPre.setGoodsType(1);
orderPre.setGoodsName(coupon.getCouponName());
orderPre.setGoodsId(coupon.getId());
orderPre.setPreUserId(order.getMemId());
orderPre.setPreUserName(order.getMemName());
orderPre.setPreUserPhone(order.getMemPhone());
orderPre.setPreUserRemark(order.getRemarks());
orderPre.setStatus(1);
highOrderPreService.insertOrderPre(orderPre);
}
// 贵州中石化
if (coupon.getCouponSource() == 4) {
Map<String,Object> push = new HashMap<>();
push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone());
push.put("thirdUserId", highUser.getUnionId());
// 推送给高速
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(highChildOrder.getExt2());
if (returnParam != null && returnParam.getString("respCode").equals("0000")) {
// 解密
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
}
// 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
} else if (coupon.getCouponSource() == 5) {
// 给用户发码
JSONObject sendResponse = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone());
// 推送记录
JSONObject sendRequest = new JSONObject();
sendRequest.put("requestCode", coupon.getCouponKey());
sendRequest.put("tradeId", order.getOrderNo());
sendRequest.put("ticketSum", highChildOrder.getSaleCount());
sendRequest.put("phone", order.getMemPhone());
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type10.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(sendRequest.toJSONString());
highGasOrderPush.setReturnContent(sendResponse.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
JSONObject couponDetail = sendResponse.getJSONObject("ticketDetail");
JSONArray codeList = sendResponse.getJSONArray("codeList");
for (Object data : codeList) {
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(2);
couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode"));
couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data)));
couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd"));
couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd"));
couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date());
highCouponCodeOtherMapper.insert(couponCodeOther);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo());
highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate());
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
} else {
HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId());
code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付
code.setReceiveTime(new Date());
highCouponCodeService.updateCouponCode(code);
// 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setOrderId(order.getId());
highUserCoupon.setChildOrderId(highChildOrder.getId());
highUserCoupon.setMerchantId(code.getMerchantId());
highUserCoupon.setCouponId(code.getCouponId());
highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCouponCodeId(code.getId());
highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(code.getExt1());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, coupon.getRecycleDay());
if (userEndTime.getTime().compareTo(code.getUseEndTime()) == 1) {
highUserCoupon.setUseEndTime(code.getUseEndTime());
} else {
highUserCoupon.setUseEndTime(userEndTime.getTime());
}
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon);
}
// 查询卡券是否有活动
Map<String, Object> activity = highActivityInfoService.getNewActivityByCouponId(coupon.getId());
if (activity != null && MapUtils.getLong(activity, "id") != null) {
highActivityUserLotteryNumService.addLotteryNum(MapUtils.getLong(activity, "id"),order.getMemId(), 1);
}
}
if (highChildOrder.getGoodsType() == 2) {
highChildOrder.setChildOrdeStatus(3); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 金币 1:100
Integer goldNum = new BigDecimal(highChildOrder.getTotalPrice().toString()).multiply(new BigDecimal("100")).intValue();
String remark = "订单" + order.getOrderNo() + "积分充值积分:" + goldNum;
highUserService.goldHandle(highChildOrder.getGoodsId(), goldNum, 1, 1, highChildOrder.getId() , remark);
}
if (highChildOrder.getGoodsType() == 3) {
highChildOrder.setChildOrdeStatus(3);
order.setOrderStatus(3);
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId());
// 来源类型 1:平台自建 2:团油
if (store.getSourceType().equals(1)) {
// 预存类型 0:非预存 1:预存门店
if (store.getPrestoreType() != null && store.getPrestoreType().equals(1)) {
Map<String, Object> pushParam = new HashMap<>();
pushParam.put("businessType", MerStoreAmountTypeEnum.type2.getType());
pushParam.put("storeId", highChildOrder.getGoodsId());
pushParam.put("price", order.getTotalPrice());
pushParam.put("sourceType", MerStoreAmountSourceTypeEnum.type2.getType());
pushParam.put("sourceId", order.getId());
pushParam.put("sourceContent", "订单号:" + order.getOrderNo() + ",加油金额:¥" + order.getTotalPrice());
pushParam.put("opUserId", order.getMemId());
pushParam.put("opUserName", order.getMemName());
// 扣预存款
this.redisTemplate.boundListOps(MsgTopic.MerStoreAccount.getName()).leftPush(pushParam);
}
} else if (store.getSourceType().equals(2)) {
// 推送团油订单
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("gasId", store.getStoreKey());
paramMap.put("oilNo", highChildOrder.getGasOilNo());
paramMap.put("gunNo", highChildOrder.getGasGunNo());
BigDecimal priceGun = highChildOrder.getGasPriceGun();
BigDecimal priceVip = highChildOrder.getGasPriceVip();
paramMap.put("priceGun", priceGun); // 枪单价
paramMap.put("priceVip", priceVip); // 优惠价
paramMap.put("driverPhone", order.getMemPhone());
paramMap.put("thirdSerialNo", order.getOrderNo());
paramMap.put("refuelingAmount", highChildOrder.getTotalPrice());
// 油品类型 1:汽油:2:柴油;3:天然气
if (highChildOrder.getGasOilType() == 1) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount());
} else if (highChildOrder.getGasOilType() == 2) {
paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount());
}
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap);
// 推送团油订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type1.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(orderPushObject.getString("code"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap));
highGasOrderPush.setReturnContent(orderPushObject.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
// 推送加好油
shellGroupService.gasSyncPayment(order.getOrderNo(),
store.getStoreKey(),
order.getPayTime(),
highChildOrder.getTotalPrice(),
highChildOrder.getGasOilNo(),
highChildOrder.getGasGunNo(),
order.getPayablePrice(),
order.getDeductionPrice()
);
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) {
// 推送金猪加油
jinZhuJiaYouService.payOrder(order.getOrderNo(), highChildOrder.getGasPriceChannelPay());
}
}
if (highChildOrder.getGoodsType() == 4 || highChildOrder.getGoodsType() == 9) {
highChildOrder.setChildOrdeStatus(2);
}
if (highChildOrder.getGoodsType() == 7) {
highChildOrder.setChildOrdeStatus(2);
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());
if (actual != null) {
List<HighDiscountPackageDiscountActual> discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId());
for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
}
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
}
}
*/
HighGasOrderPush orderPush = new HighGasOrderPush();
JSONObject returnObject = new JSONObject();
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
returnObject = QianZhuConfig.payKfcOrder(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
returnObject = QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 10){
orderPush.setType(OrderPushType.type9.getType());
ApiMemberProduct memberProduct = apiMemberProductService.findById(order.getHighChildOrderList().get(0).getGoodsId());
returnObject = QianZhuConfig.insertV2(memberProduct.getProductId() , order.getOrderNo() , order.getRemarks());
}
highOrderService.updateOrder(order);
orderPush.setOrderNo(order.getOrderNo());
orderPush.setCreateTime(new Date());
orderPush.setRequestContent(order.getOrderNo());
orderPush.setReturnContent(returnObject.toJSONString());
highGasOrderPushMapper.insert(orderPush);
if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) {
new Thread(() -> {
highOrderService.printGasOrder(order.getHighChildOrderList().get(0).getGoodsId(), order, false);
}).start();
}
}
}
}
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
JSONObject result = new JSONObject();
result.put("resultcode", "00");
out.write(result.toJSONString().getBytes());
out.flush();
out.close();
} catch (Exception e) {
log.error("UnionPayController --> notify() error!", e);
}
}
@RequestMapping(value = "/notifyTel", method = RequestMethod.POST)
@ApiOperation(value = "银联支付 -> 异步回调")
public void notifyTel(@RequestBody String params,HttpServletRequest request, HttpServletResponse response) {
try {
System.out.println(params);
log.info(params);
if (StringUtils.isNotBlank(params)) {
// 参数解码
String paramsStr = URLDecoder.decode(params,"utf-8");
// 记录请求参数
HighPayRecord payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date());
payRecord.setResType(2);
payRecord.setPayType(3);
payRecord.setBodyInfo(paramsStr);
highPayRecordMapper.insert(payRecord);
// 转换成JSON格式
JSONObject body = JSONObject.parseObject(paramsStr.substring(0, paramsStr.length() - 1));
if (StringUtils.isNotBlank(body.getString("tradetrace"))) {
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(body.getString("tradetrace"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
order.setPaySerialNo(body.getString("wtorderid")); // 支付流水号
order.setPayRealPrice(order.getPayRealPrice()); // 实付金额
order.setPayStatus(102);
order.setRechargeStatus(204);
order.setPayType(4);
order.setPayTime(new Date()); // 支付时间
outRechargeOrderService.updateOrder(order);
outRechargeOrderService.pollRequest(order);
}
}
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
JSONObject result = new JSONObject();
result.put("resultcode", "00");
out.write(result.toJSONString().getBytes());
out.flush();
out.close();
} catch (Exception e) {
log.error("UnionPayController --> notify() error!", e);
}
}
@RequestMapping(value = "/refreshStagingOrder", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "银联分期支付 -> 刷新分期订单")
public ResponseData refreshStagingOrder(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) {
try {
if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("orderNo"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
if (order.getOrderStatus().equals(1)) {
String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4)
+CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length())
+ DateUtil.format(new Date(), DateUtil.YMDHMS)
+ IDGenerator.nextId(6);
JSONObject responseObject = UnionStagingPayConfig.queryStaging(orgTrace, order.getPaySerialNo(), "", order.getCreateTime(), request);
if (responseObject.getString("sysRetCode").equals("000000")) {
}
return ResponseMsgUtil.success(responseObject);
}
return ResponseMsgUtil.success(order);
} catch (Exception e) {
log.error("UnionPayController --> refreshStagingOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,212 +0,0 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.cweb.config.WxMsgConfig;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.WechatCallBackInfo;
import com.hai.common.pay.util.IOUtil;
import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.ResponseData;
import com.hai.model.WxSharingOrderRequestModel;
import com.hai.model.WxSharingReceiversVO;
import com.hai.service.HighOrderService;
import com.hai.service.HighProfitSharingRecordService;
import com.hai.service.HighUserService;
import com.hai.service.TelApiService;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayRecordService;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.cglib.beans.BeanMap;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.net.ssl.SSLContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.security.*;
import java.util.*;
@Controller
@RequestMapping(value = "/wechatpay")
@Api(value = "微信支付")
public class WechatPayController {
private static Logger log = LoggerFactory.getLogger(WechatPayController.class);
private WXPayConstants.SignType signType;
@Resource
private NotifyService notifyService;
@Resource
private PayRecordService payRecordService;
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserService highUserService;
@Resource
private TelApiService telApiService;
@Resource
private HighProfitSharingRecordService highProfitSharingRecordService;
@RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation(value = "微信支付 -> 异步回调")
public void wechatNotify(HttpServletRequest request, HttpServletResponse response) {
try {
log.info("微信支付 -> 异步通知:处理开始");
String resXml = ""; // 反馈给微信服务器
String notifyXml = null; // 微信支付系统发送的数据(<![CDATA[product_001]]>格式)
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
log.info("微信支付系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
resXml = notifyService.wechatNotify(map);
/* if (SignatureUtil.reCheckIsSignValidFromWeiXin(notifyXml, SysConst.getSysConfig().getWxApiKey(), "UTF-8")) {
log.info("微信支付系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
resXml = notifyService.wechatNotify(map);
} else {
log.error("微信支付 -> 异步通知:验签失败");
log.error("apiKey:" + SysConst.getSysConfig().getWxApiKey());
log.error("返回信息:" + notifyXml);
resXml = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>"
+ "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> ";
}*/
new Thread(() -> {
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
HighUser highUser = highUserService.findByUserId(order.getMemId());
HighChildOrder presentation = highOrderService.getChildOrderByPresentation(order.getId());
WxMsgConfig.pushOneUser(
presentation.getGoodsName() + "(" + GoodsType.getNameByType(presentation.getGoodsType()) + ")",
String.valueOf(order.getPayPrice()),
order.getOrderNo(),
order.getPayTime(),
PayType.getNameByType(order.getPayType()), order.getId(),
highUser.getOpenId());
}).start();
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(resXml.getBytes());
out.flush();
out.close();
log.info("微信支付 -> 异步通知:处理完成");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
@RequestMapping(value = "/addLedgerReceiver", method = RequestMethod.POST)
@ApiOperation(value = "微信支付 -> 添加分账接收方")
public void addLedgerReceiver(@RequestParam(name = "sub_mch_id", required = true) String sub_mch_id,
HttpServletRequest request, HttpServletResponse response) {
try {
WxSharingReceiversVO receiversVO = new WxSharingReceiversVO();
receiversVO.setAccount("1603942866");
receiversVO.setType("MERCHANT_ID");
receiversVO.setName("重庆惠昕石化有限责任公司");
receiversVO.setRelation_type("SERVICE_PROVIDER");
Map<String , String> map = new HashMap<>();
map.put("mch_id" , "1289663601");
map.put("sub_mch_id" , sub_mch_id);
map.put("appid" , "wxa075e8509802f826");
map.put("nonce_str" , WxUtils.makeNonStr());
map.put("sign_type" , "HMAC-SHA256");
map.put("receiver" , JSONObject.toJSONString(receiversVO));
String sign = WxUtils.generateSignature(map, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
map.put("sign" , sign);
String url = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver";
String xm = WxUtils.mapToXml(map);
String rest = String.valueOf(HttpsUtils.postData(url, xm));
System.out.println(rest);
log.info("微信支付 -> 添加分账接收方:处理开始");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
String getToken(String method, String url, String body) throws UnsupportedEncodingException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, FileNotFoundException {
long timeMillis = System.currentTimeMillis();
String nonceStr = String.valueOf(timeMillis);
long timestamp = System.currentTimeMillis() / 1000;
String message = buildMessage(method, url, timestamp, nonceStr, body);
PrivateKey privateKey = PemUtil.loadPrivateKey(new FileInputStream("G:/hurui-project/hai-parent/hai-cweb/src/main/resources/privatekey/apiclient_key.pem"));
String signature = sign(privateKey,message.getBytes("utf-8"));
return "mchid=\"" + SysConst.getSysConfig().getWxSubMchId() + "\","
+ "nonce_str=\"" + nonceStr + "\","
+ "timestamp=\"" + timestamp + "\","
+ "serial_no=\"" + "1B08DC2A078B0B1F77A65C97C445AAD545B5EAA6" + "\","
+ "signature=\"" + signature + "\"";
}
String sign(PrivateKey privateKey,byte[] message) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException {
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initSign(privateKey);
sign.update(message);
return Base64.getEncoder().encodeToString(sign.sign());
}
String buildMessage(String method, String url, long timestamp, String nonceStr, String body) {
return method + ""
+ url + ""
+ timestamp + ""
+ nonceStr + ""
+ body + "";
}
}

@ -303,7 +303,7 @@ public class OrderPayController {
return ResponseMsgUtil.success(orderPayService.oilCardPay(order, userCard)); return ResponseMsgUtil.success(orderPayService.oilCardPay(order, userCard));
} else if (userCard.getType().equals(UserCardType.type3.getType())) { } else if (userCard.getType().equals(UserCardType.type3.getType())) {
return ResponseMsgUtil.success(orderPayService.oilCardFleetPay(order, userCard)); return ResponseMsgUtil.success(orderPayService.oilCardFleetPay(order, userCard, body.getString("carLicensePlate")));
} else { } else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的卡号类型"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的卡号类型");

@ -10,7 +10,6 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighGasOrder; import com.hai.entity.HighGasOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.enum_type.OrderPayTypeEnum;
import com.hai.enum_type.OrderStatusEnum; import com.hai.enum_type.OrderStatusEnum;
import com.hai.enum_type.UserObjectTypeEnum; import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
@ -19,6 +18,7 @@ import com.hai.order.model.ExportGasOrderModel;
import com.hai.order.model.OrderThirdPartyModel; import com.hai.order.model.OrderThirdPartyModel;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.OrderOilStatus; import com.hai.order.type.OrderOilStatus;
import com.hai.order.type.OrderPayType;
import com.web.config.SysConst; import com.web.config.SysConst;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -185,7 +185,7 @@ public class OrderThirdPartyController {
model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice()); model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice());
model.setPayablePrice(thirdPartyModel.getPayablePrice()); model.setPayablePrice(thirdPartyModel.getPayablePrice());
model.setPayPrice(thirdPartyModel.getPayPrice()); model.setPayPrice(thirdPartyModel.getPayPrice());
model.setPayType(OrderPayTypeEnum.getNameByType(thirdPartyModel.getPayType())); model.setPayType(OrderPayType.getDataByType(thirdPartyModel.getPayType()).getName());
model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus())); model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus()));
model.setCreateTime(thirdPartyModel.getCreateTime()); model.setCreateTime(thirdPartyModel.getCreateTime());
model.setPayTime(thirdPartyModel.getPayTime()); model.setPayTime(thirdPartyModel.getPayTime());

@ -48,25 +48,26 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
"total_deduction_price, deduction_coupon_price, ", "total_deduction_price, deduction_coupon_price, ",
"deduction_product_price, payable_price, ", "deduction_product_price, payable_price, ",
"pay_gold, pay_price, ", "pay_gold, pay_price, ",
"gas_refuel_price, gas_oil_no, ", "gas_refuel_price, gas_car_license_plate, ",
"gas_gun_no, gas_oil_type, ", "gas_oil_no, gas_gun_no, ",
"gas_price_platform, gas_price_gun, ", "gas_oil_type, gas_price_platform, ",
"gas_price_vip, gas_price_official, ", "gas_price_gun, gas_price_vip, ",
"gas_price_cost, gas_price_cost_total, ", "gas_price_official, gas_price_cost, ",
"gas_price_channel_pay, gas_oil_liters, ", "gas_price_cost_total, gas_price_channel_pay, ",
"gas_discount, gas_oil_subsidy, ", "gas_oil_liters, gas_discount, ",
"gas_liters_preferences, gas_price_preferences, ", "gas_oil_subsidy, gas_liters_preferences, ",
"gas_class_group_id, gas_class_group_name, ", "gas_price_preferences, gas_class_group_id, ",
"gas_class_group_task_id, gas_staff_id, ", "gas_class_group_name, gas_class_group_task_id, ",
"gas_staff_name, gas_salesman_id, ", "gas_staff_id, gas_staff_name, ",
"gas_salesman_name, gas_agent_id, ", "gas_salesman_id, gas_salesman_name, ",
"gas_agent_name, gas_org_id, ", "gas_agent_id, gas_agent_name, ",
"gas_org_name, pay_type, ", "gas_org_id, gas_org_name, ",
"`status`, create_time, ", "pay_type, `status`, ",
"cancel_time, pay_time, ", "create_time, cancel_time, ",
"refund_time, refund_remarks, ", "pay_time, refund_time, ",
"ext_1, ext_2, ext_3, ", "refund_remarks, ext_1, ",
"ext_4, ext_5, ext_6)", "ext_2, ext_3, ext_4, ",
"ext_5, ext_6)",
"values (#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ", "values (#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ",
"#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ", "#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ",
"#{memId,jdbcType=BIGINT}, #{memPhone,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memPhone,jdbcType=VARCHAR}, ",
@ -76,25 +77,26 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
"#{totalDeductionPrice,jdbcType=DECIMAL}, #{deductionCouponPrice,jdbcType=DECIMAL}, ", "#{totalDeductionPrice,jdbcType=DECIMAL}, #{deductionCouponPrice,jdbcType=DECIMAL}, ",
"#{deductionProductPrice,jdbcType=DECIMAL}, #{payablePrice,jdbcType=DECIMAL}, ", "#{deductionProductPrice,jdbcType=DECIMAL}, #{payablePrice,jdbcType=DECIMAL}, ",
"#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ", "#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ",
"#{gasRefuelPrice,jdbcType=DECIMAL}, #{gasOilNo,jdbcType=VARCHAR}, ", "#{gasRefuelPrice,jdbcType=DECIMAL}, #{gasCarLicensePlate,jdbcType=VARCHAR}, ",
"#{gasGunNo,jdbcType=VARCHAR}, #{gasOilType,jdbcType=INTEGER}, ", "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ",
"#{gasPricePlatform,jdbcType=DECIMAL}, #{gasPriceGun,jdbcType=DECIMAL}, ", "#{gasOilType,jdbcType=INTEGER}, #{gasPricePlatform,jdbcType=DECIMAL}, ",
"#{gasPriceVip,jdbcType=DECIMAL}, #{gasPriceOfficial,jdbcType=DECIMAL}, ", "#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ",
"#{gasPriceCost,jdbcType=DECIMAL}, #{gasPriceCostTotal,jdbcType=DECIMAL}, ", "#{gasPriceOfficial,jdbcType=DECIMAL}, #{gasPriceCost,jdbcType=DECIMAL}, ",
"#{gasPriceChannelPay,jdbcType=DECIMAL}, #{gasOilLiters,jdbcType=DECIMAL}, ", "#{gasPriceCostTotal,jdbcType=DECIMAL}, #{gasPriceChannelPay,jdbcType=DECIMAL}, ",
"#{gasDiscount,jdbcType=DECIMAL}, #{gasOilSubsidy,jdbcType=DECIMAL}, ", "#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ",
"#{gasLitersPreferences,jdbcType=DECIMAL}, #{gasPricePreferences,jdbcType=DECIMAL}, ", "#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ",
"#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ", "#{gasPricePreferences,jdbcType=DECIMAL}, #{gasClassGroupId,jdbcType=BIGINT}, ",
"#{gasClassGroupTaskId,jdbcType=BIGINT}, #{gasStaffId,jdbcType=BIGINT}, ", "#{gasClassGroupName,jdbcType=VARCHAR}, #{gasClassGroupTaskId,jdbcType=BIGINT}, ",
"#{gasStaffName,jdbcType=VARCHAR}, #{gasSalesmanId,jdbcType=BIGINT}, ", "#{gasStaffId,jdbcType=BIGINT}, #{gasStaffName,jdbcType=VARCHAR}, ",
"#{gasSalesmanName,jdbcType=VARCHAR}, #{gasAgentId,jdbcType=BIGINT}, ", "#{gasSalesmanId,jdbcType=BIGINT}, #{gasSalesmanName,jdbcType=VARCHAR}, ",
"#{gasAgentName,jdbcType=VARCHAR}, #{gasOrgId,jdbcType=BIGINT}, ", "#{gasAgentId,jdbcType=BIGINT}, #{gasAgentName,jdbcType=VARCHAR}, ",
"#{gasOrgName,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ", "#{gasOrgId,jdbcType=BIGINT}, #{gasOrgName,jdbcType=VARCHAR}, ",
"#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", "#{payType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ",
"#{refundTime,jdbcType=TIMESTAMP}, #{refundRemarks,jdbcType=VARCHAR}, ", "#{payTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", "#{refundRemarks,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ",
"#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasOrder record); int insert(HighGasOrder record);
@ -126,6 +128,7 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
@Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_car_license_plate", property="gasCarLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER), @Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER),
@ -173,14 +176,14 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
"id, order_no, child_order_no, channel_type, channel_order_no, mem_id, mem_phone, ", "id, order_no, child_order_no, channel_type, channel_order_no, mem_id, mem_phone, ",
"company_id, company_name, mer_id, mer_name, store_id, store_name, store_address, ", "company_id, company_name, mer_id, mer_name, store_id, store_name, store_address, ",
"total_deduction_price, deduction_coupon_price, deduction_product_price, payable_price, ", "total_deduction_price, deduction_coupon_price, deduction_product_price, payable_price, ",
"pay_gold, pay_price, gas_refuel_price, gas_oil_no, gas_gun_no, gas_oil_type, ", "pay_gold, pay_price, gas_refuel_price, gas_car_license_plate, gas_oil_no, gas_gun_no, ",
"gas_price_platform, gas_price_gun, gas_price_vip, gas_price_official, gas_price_cost, ", "gas_oil_type, gas_price_platform, gas_price_gun, gas_price_vip, gas_price_official, ",
"gas_price_cost_total, gas_price_channel_pay, gas_oil_liters, gas_discount, gas_oil_subsidy, ", "gas_price_cost, gas_price_cost_total, gas_price_channel_pay, gas_oil_liters, ",
"gas_liters_preferences, gas_price_preferences, gas_class_group_id, gas_class_group_name, ", "gas_discount, gas_oil_subsidy, gas_liters_preferences, gas_price_preferences, ",
"gas_class_group_task_id, gas_staff_id, gas_staff_name, gas_salesman_id, gas_salesman_name, ", "gas_class_group_id, gas_class_group_name, gas_class_group_task_id, gas_staff_id, ",
"gas_agent_id, gas_agent_name, gas_org_id, gas_org_name, pay_type, `status`, ", "gas_staff_name, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ",
"create_time, cancel_time, pay_time, refund_time, refund_remarks, ext_1, ext_2, ", "gas_org_id, gas_org_name, pay_type, `status`, create_time, cancel_time, pay_time, ",
"ext_3, ext_4, ext_5, ext_6", "refund_time, refund_remarks, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6",
"from high_gas_order", "from high_gas_order",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -206,6 +209,7 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
@Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_car_license_plate", property="gasCarLicensePlate", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR),
@Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER), @Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER),
@ -279,6 +283,7 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt {
"pay_gold = #{payGold,jdbcType=INTEGER},", "pay_gold = #{payGold,jdbcType=INTEGER},",
"pay_price = #{payPrice,jdbcType=DECIMAL},", "pay_price = #{payPrice,jdbcType=DECIMAL},",
"gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL},", "gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL},",
"gas_car_license_plate = #{gasCarLicensePlate,jdbcType=VARCHAR},",
"gas_oil_no = #{gasOilNo,jdbcType=VARCHAR},", "gas_oil_no = #{gasOilNo,jdbcType=VARCHAR},",
"gas_gun_no = #{gasGunNo,jdbcType=VARCHAR},", "gas_gun_no = #{gasGunNo,jdbcType=VARCHAR},",
"gas_oil_type = #{gasOilType,jdbcType=INTEGER},", "gas_oil_type = #{gasOilType,jdbcType=INTEGER},",

@ -108,6 +108,10 @@ public class HighGasOrderSqlProvider {
sql.VALUES("gas_refuel_price", "#{gasRefuelPrice,jdbcType=DECIMAL}"); sql.VALUES("gas_refuel_price", "#{gasRefuelPrice,jdbcType=DECIMAL}");
} }
if (record.getGasCarLicensePlate() != null) {
sql.VALUES("gas_car_license_plate", "#{gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) { if (record.getGasOilNo() != null) {
sql.VALUES("gas_oil_no", "#{gasOilNo,jdbcType=VARCHAR}"); sql.VALUES("gas_oil_no", "#{gasOilNo,jdbcType=VARCHAR}");
} }
@ -294,6 +298,7 @@ public class HighGasOrderSqlProvider {
sql.SELECT("pay_gold"); sql.SELECT("pay_gold");
sql.SELECT("pay_price"); sql.SELECT("pay_price");
sql.SELECT("gas_refuel_price"); sql.SELECT("gas_refuel_price");
sql.SELECT("gas_car_license_plate");
sql.SELECT("gas_oil_no"); sql.SELECT("gas_oil_no");
sql.SELECT("gas_gun_no"); sql.SELECT("gas_gun_no");
sql.SELECT("gas_oil_type"); sql.SELECT("gas_oil_type");
@ -434,6 +439,10 @@ public class HighGasOrderSqlProvider {
sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}");
} }
if (record.getGasCarLicensePlate() != null) {
sql.SET("gas_car_license_plate = #{record.gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) { if (record.getGasOilNo() != null) {
sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}"); sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}");
} }
@ -619,6 +628,7 @@ public class HighGasOrderSqlProvider {
sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}"); sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}");
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}");
sql.SET("gas_car_license_plate = #{record.gasCarLicensePlate,jdbcType=VARCHAR}");
sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}"); sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}");
sql.SET("gas_gun_no = #{record.gasGunNo,jdbcType=VARCHAR}"); sql.SET("gas_gun_no = #{record.gasGunNo,jdbcType=VARCHAR}");
sql.SET("gas_oil_type = #{record.gasOilType,jdbcType=INTEGER}"); sql.SET("gas_oil_type = #{record.gasOilType,jdbcType=INTEGER}");
@ -748,6 +758,10 @@ public class HighGasOrderSqlProvider {
sql.SET("gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL}");
} }
if (record.getGasCarLicensePlate() != null) {
sql.SET("gas_car_license_plate = #{gasCarLicensePlate,jdbcType=VARCHAR}");
}
if (record.getGasOilNo() != null) { if (record.getGasOilNo() != null) {
sql.SET("gas_oil_no = #{gasOilNo,jdbcType=VARCHAR}"); sql.SET("gas_oil_no = #{gasOilNo,jdbcType=VARCHAR}");
} }

@ -119,6 +119,11 @@ public class HighGasOrder implements Serializable {
*/ */
private BigDecimal gasRefuelPrice; private BigDecimal gasRefuelPrice;
/**
* 加油站车牌
*/
private String gasCarLicensePlate;
/** /**
* 加油站油号 * 加油站油号
*/ */
@ -472,6 +477,14 @@ public class HighGasOrder implements Serializable {
this.gasRefuelPrice = gasRefuelPrice; this.gasRefuelPrice = gasRefuelPrice;
} }
public String getGasCarLicensePlate() {
return gasCarLicensePlate;
}
public void setGasCarLicensePlate(String gasCarLicensePlate) {
this.gasCarLicensePlate = gasCarLicensePlate;
}
public String getGasOilNo() { public String getGasOilNo() {
return gasOilNo; return gasOilNo;
} }
@ -817,6 +830,7 @@ public class HighGasOrder implements Serializable {
&& (this.getPayGold() == null ? other.getPayGold() == null : this.getPayGold().equals(other.getPayGold())) && (this.getPayGold() == null ? other.getPayGold() == null : this.getPayGold().equals(other.getPayGold()))
&& (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) && (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice()))
&& (this.getGasRefuelPrice() == null ? other.getGasRefuelPrice() == null : this.getGasRefuelPrice().equals(other.getGasRefuelPrice())) && (this.getGasRefuelPrice() == null ? other.getGasRefuelPrice() == null : this.getGasRefuelPrice().equals(other.getGasRefuelPrice()))
&& (this.getGasCarLicensePlate() == null ? other.getGasCarLicensePlate() == null : this.getGasCarLicensePlate().equals(other.getGasCarLicensePlate()))
&& (this.getGasOilNo() == null ? other.getGasOilNo() == null : this.getGasOilNo().equals(other.getGasOilNo())) && (this.getGasOilNo() == null ? other.getGasOilNo() == null : this.getGasOilNo().equals(other.getGasOilNo()))
&& (this.getGasGunNo() == null ? other.getGasGunNo() == null : this.getGasGunNo().equals(other.getGasGunNo())) && (this.getGasGunNo() == null ? other.getGasGunNo() == null : this.getGasGunNo().equals(other.getGasGunNo()))
&& (this.getGasOilType() == null ? other.getGasOilType() == null : this.getGasOilType().equals(other.getGasOilType())) && (this.getGasOilType() == null ? other.getGasOilType() == null : this.getGasOilType().equals(other.getGasOilType()))
@ -883,6 +897,7 @@ public class HighGasOrder implements Serializable {
result = prime * result + ((getPayGold() == null) ? 0 : getPayGold().hashCode()); result = prime * result + ((getPayGold() == null) ? 0 : getPayGold().hashCode());
result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode());
result = prime * result + ((getGasRefuelPrice() == null) ? 0 : getGasRefuelPrice().hashCode()); result = prime * result + ((getGasRefuelPrice() == null) ? 0 : getGasRefuelPrice().hashCode());
result = prime * result + ((getGasCarLicensePlate() == null) ? 0 : getGasCarLicensePlate().hashCode());
result = prime * result + ((getGasOilNo() == null) ? 0 : getGasOilNo().hashCode()); result = prime * result + ((getGasOilNo() == null) ? 0 : getGasOilNo().hashCode());
result = prime * result + ((getGasGunNo() == null) ? 0 : getGasGunNo().hashCode()); result = prime * result + ((getGasGunNo() == null) ? 0 : getGasGunNo().hashCode());
result = prime * result + ((getGasOilType() == null) ? 0 : getGasOilType().hashCode()); result = prime * result + ((getGasOilType() == null) ? 0 : getGasOilType().hashCode());
@ -952,6 +967,7 @@ public class HighGasOrder implements Serializable {
sb.append(", payGold=").append(payGold); sb.append(", payGold=").append(payGold);
sb.append(", payPrice=").append(payPrice); sb.append(", payPrice=").append(payPrice);
sb.append(", gasRefuelPrice=").append(gasRefuelPrice); sb.append(", gasRefuelPrice=").append(gasRefuelPrice);
sb.append(", gasCarLicensePlate=").append(gasCarLicensePlate);
sb.append(", gasOilNo=").append(gasOilNo); sb.append(", gasOilNo=").append(gasOilNo);
sb.append(", gasGunNo=").append(gasGunNo); sb.append(", gasGunNo=").append(gasGunNo);
sb.append(", gasOilType=").append(gasOilType); sb.append(", gasOilType=").append(gasOilType);

@ -1466,6 +1466,76 @@ public class HighGasOrderExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andGasCarLicensePlateIsNull() {
addCriterion("gas_car_license_plate is null");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateIsNotNull() {
addCriterion("gas_car_license_plate is not null");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateEqualTo(String value) {
addCriterion("gas_car_license_plate =", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotEqualTo(String value) {
addCriterion("gas_car_license_plate <>", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateGreaterThan(String value) {
addCriterion("gas_car_license_plate >", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateGreaterThanOrEqualTo(String value) {
addCriterion("gas_car_license_plate >=", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLessThan(String value) {
addCriterion("gas_car_license_plate <", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLessThanOrEqualTo(String value) {
addCriterion("gas_car_license_plate <=", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateLike(String value) {
addCriterion("gas_car_license_plate like", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotLike(String value) {
addCriterion("gas_car_license_plate not like", value, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateIn(List<String> values) {
addCriterion("gas_car_license_plate in", values, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotIn(List<String> values) {
addCriterion("gas_car_license_plate not in", values, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateBetween(String value1, String value2) {
addCriterion("gas_car_license_plate between", value1, value2, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasCarLicensePlateNotBetween(String value1, String value2) {
addCriterion("gas_car_license_plate not between", value1, value2, "gasCarLicensePlate");
return (Criteria) this;
}
public Criteria andGasOilNoIsNull() { public Criteria andGasOilNoIsNull() {
addCriterion("gas_oil_no is null"); addCriterion("gas_oil_no is null");
return (Criteria) this; return (Criteria) this;

@ -1,50 +0,0 @@
package com.hai.enum_type;
import java.util.Objects;
/**
* 支付方式
* @author hurui
*/
public enum OrderPayTypeEnum {
type1(1 , "支付宝"),
type2(2 , "微信"),
type3(3 , "金币"),
type4(4 , "汇联通工会卡"),
type5(5 , "银联"),
type6(6 , "银联分期"),
type7(7 , "嗨森逛油卡"),
type8(8 , "API商户"),
;
private Integer type;
private String name;
OrderPayTypeEnum(int type , String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (OrderPayTypeEnum ele : values()) {
if(Objects.equals(type,ele.getType())) return ele.getName();
}
return null;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -33,6 +33,6 @@ public interface OrderPayService {
* @param userCard 用户卡号 * @param userCard 用户卡号
* @return * @return
*/ */
HighOrder oilCardFleetPay(HighOrder order, HighUserCard userCard); HighOrder oilCardFleetPay(HighOrder order, HighUserCard userCard, String carLicensePlate);
} }

@ -13,8 +13,10 @@ import com.hai.order.service.OrderService;
import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderProductType;
import com.hai.service.HighFleetOilCardService; import com.hai.service.HighFleetOilCardService;
import com.hai.service.HighGasOrderService;
import com.hai.service.HighOilCardService; import com.hai.service.HighOilCardService;
import com.hai.service.HighUserCardService; import com.hai.service.HighUserCardService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -44,6 +46,9 @@ public class OrderPayServiceImpl implements OrderPayService {
@Resource @Resource
private OrderService orderService; private OrderService orderService;
@Resource
private HighGasOrderService gasOrderService;
@Override @Override
public HighOrder hltCardPay(HighOrder order, HighUserCard userCard) throws Exception { public HighOrder hltCardPay(HighOrder order, HighUserCard userCard) throws Exception {
String goodsDesc = ""; String goodsDesc = "";
@ -114,7 +119,17 @@ public class OrderPayServiceImpl implements OrderPayService {
} }
@Override @Override
public HighOrder oilCardFleetPay(HighOrder order, HighUserCard userCard) { public HighOrder oilCardFleetPay(HighOrder order, HighUserCard userCard, String carLicensePlate) {
if (StringUtils.isNotBlank(carLicensePlate)) {
// 加油订单
HighGasOrder gasOrder = gasOrderService.getDetailByOrderNo(order.getOrderNo());
if (gasOrder != null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油订单");
}
gasOrder.setGasCarLicensePlate(carLicensePlate);
gasOrderService.updateGasOrder(gasOrder);
}
// 油卡扣款 // 油卡扣款
Map<String, Object> consumeMap = new HashMap<>(); Map<String, Object> consumeMap = new HashMap<>();
consumeMap.put("sourceType", OilCardRecordSourceTypeEnum.type2.getType()); consumeMap.put("sourceType", OilCardRecordSourceTypeEnum.type2.getType());

@ -33,38 +33,6 @@ public interface HighOrderService {
*/ */
void updateChildOrder(HighChildOrder highChildOrder); void updateChildOrder(HighChildOrder highChildOrder);
/**
* @Author 胡锐
* @Description 金币支付订单
* @Date 2021/3/27 11:20
**/
void goldPayOrder(Long userId, Long orderId) throws Exception;
/**
* 油卡支付订单
* @param userCardId 用户与卡号关系
* @param orderId 订单id
* @throws Exception
*/
void oilCardPayOrder(Long userCardId, Long orderId) throws Exception;
/**
* 油卡支付订单
* @param userCardId 用户与卡号关系
* @param orderId 订单id
* @param carLicensePlate 车牌
* @throws Exception
*/
void fleetOilCardPayOrder(Long userCardId, Long orderId, String carLicensePlate) throws Exception;
/**
* 汇联通工会卡支付
* @param userCardId
* @param orderId
* @throws Exception
*/
void hltUnionCardPay(Long userCardId, Long orderId) throws Exception;
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 修改订单 * @Description 修改订单

@ -17,8 +17,6 @@ import com.hai.dao.HighOrderMapper;
import com.hai.dao.OutRechargeOrderMapper; import com.hai.dao.OutRechargeOrderMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.OrderPayModelEnum;
import com.hai.enum_type.OrderPayTypeEnum;
import com.hai.service.*; import com.hai.service.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;

@ -12,6 +12,7 @@ import com.hai.enum_type.*;
import com.hai.model.OilCardOrderModel; import com.hai.model.OilCardOrderModel;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.OrderPayType;
import com.hai.service.*; import com.hai.service.*;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -279,8 +280,8 @@ public class HighFleetOilCardServiceImpl implements HighFleetOilCardService {
) { ) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单当前状态无法退款"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单当前状态无法退款");
} }
if (!order.getPayType().equals(OrderPayTypeEnum.type7.getType())) { if (!order.getPayType().equals(OrderPayType.PAY_TYPE8.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式,不是油卡"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式,不是车队油卡");
} }
if (StringUtils.isBlank(order.getMemCardNo())) { if (StringUtils.isBlank(order.getMemCardNo())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号");

@ -12,6 +12,7 @@ import com.hai.entity.*;
import com.hai.enum_type.*; import com.hai.enum_type.*;
import com.hai.model.OilCardOrderModel; import com.hai.model.OilCardOrderModel;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.order.type.OrderPayType;
import com.hai.service.*; import com.hai.service.*;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -201,8 +202,8 @@ public class HighOilCardServiceImpl implements HighOilCardService {
if (order == null) { if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的的订单");
} }
if (!order.getPayType().equals(OrderPayTypeEnum.type7.getType())) { if (!order.getPayType().equals(OrderPayType.PAY_TYPE7.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式,不是油卡"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付方式,不是个人油卡");
} }
if (StringUtils.isBlank(order.getMemCardNo())) { if (StringUtils.isBlank(order.getMemCardNo())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油卡卡号");

@ -146,7 +146,7 @@ public class HighUserCardServiceImpl implements HighUserCardService {
@Override @Override
public Boolean isBindHtlCard(Long userId) { public Boolean isBindHtlCard(Long userId) {
HighUserCardExample example = new HighUserCardExample(); HighUserCardExample example = new HighUserCardExample();
example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0); example.createCriteria().andUserIdEqualTo(userId).andTypeEqualTo(UserCardType.type1.getType()).andStatusNotEqualTo(0);
List<HighUserCard> list = highUserCardMapper.selectByExample(example); List<HighUserCard> list = highUserCardMapper.selectByExample(example);
if (list.size() > 0) { if (list.size() > 0) {
return true; return true;
@ -157,7 +157,7 @@ public class HighUserCardServiceImpl implements HighUserCardService {
@Override @Override
public HighUserCard getUserHtlCardNo(Long userId) { public HighUserCard getUserHtlCardNo(Long userId) {
HighUserCardExample example = new HighUserCardExample(); HighUserCardExample example = new HighUserCardExample();
example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0); example.createCriteria().andUserIdEqualTo(userId).andTypeEqualTo(UserCardType.type1.getType()).andStatusNotEqualTo(0);
List<HighUserCard> list = highUserCardMapper.selectByExample(example); List<HighUserCard> list = highUserCardMapper.selectByExample(example);
if(list.size() > 0) { if(list.size() > 0) {
return list.get(0); return list.get(0);

@ -187,7 +187,7 @@ public class HighUserServiceImpl implements HighUserService {
user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId)); user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId));
// 查询油卡 // 查询油卡
List<HighUserCard> oilCardList = highUserCardService.getListByUser(userId, 2); List<HighUserCard> oilCardList = highUserCardService.getListByUser(userId, UserCardType.type2.getType());
if (oilCardList.size() > 0) { if (oilCardList.size() > 0) {
user.setIsSetOilCard(true); user.setIsSetOilCard(true);
// 查询油卡 // 查询油卡

Loading…
Cancel
Save