|
@@ -12,6 +12,7 @@ import org.springblade.common.utils.BeanPropertyUtil;
|
|
|
import org.springblade.common.utils.IPUtils;
|
|
import org.springblade.common.utils.IPUtils;
|
|
|
import org.springblade.core.log.logger.BladeLogger;
|
|
import org.springblade.core.log.logger.BladeLogger;
|
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
import org.springblade.gateway.goods_gateway.exception.HelpGoodsException;
|
|
import org.springblade.gateway.goods_gateway.exception.HelpGoodsException;
|
|
|
import org.springblade.gateway.point_gateway.enums.PointTypeEnum;
|
|
import org.springblade.gateway.point_gateway.enums.PointTypeEnum;
|
|
|
import org.springblade.gateway.point_gateway.exception.PointExchangeException;
|
|
import org.springblade.gateway.point_gateway.exception.PointExchangeException;
|
|
@@ -78,156 +79,13 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void pointExchange(YeepayOrder yeepayOrder) {
|
|
public void pointExchange(YeepayOrder yeepayOrder) {
|
|
|
-/* UserPufaPoint user = userPufaPointService.getOne(new LambdaQueryWrapper<UserPufaPoint>().eq(UserPufaPoint::getPhone, yeepayOrder.getPhone()));
|
|
|
|
|
- Assert.notNull(user, "用户不存在");
|
|
|
|
|
- PointGoods goods = pointGoodsService.getById(yeepayOrder.getPointGoodsId());
|
|
|
|
|
- Assert.notNull(goods, "商品不存在");
|
|
|
|
|
- UserAddress address = userAddressService.getById(yeepayOrder.getAddressId());
|
|
|
|
|
- Assert.notNull(address, "请添加收货地址");
|
|
|
|
|
- Assert.notNull(yeepayOrder.getActiveId(), "兑换失败");
|
|
|
|
|
-
|
|
|
|
|
- Boolean isLimit = Optional.ofNullable(goods.getIsLimit()).orElse(false);
|
|
|
|
|
- if (isLimit) {
|
|
|
|
|
- int size = goodsOrderService.list(new LambdaQueryWrapper<GoodsOrder>()
|
|
|
|
|
- .eq(GoodsOrder::getPhone, yeepayOrder.getPhone()).eq(GoodsOrder::getPointGoodsId, yeepayOrder.getPointGoodsId())).size();
|
|
|
|
|
- System.out.println(size);
|
|
|
|
|
- if ((yeepayOrder.getNum() + size) > goods.getLimitBuy()) {
|
|
|
|
|
- throw new PointExchangeException("超过限购数量");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (goods.getRemain() < yeepayOrder.getNum()) {
|
|
|
|
|
- throw new PointExchangeException("库存不足");
|
|
|
|
|
- }
|
|
|
|
|
- if (user.getPufaPoint().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
|
- throw new PointExchangeException("积分不足");
|
|
|
|
|
- }
|
|
|
|
|
- //商品所需积分
|
|
|
|
|
- BigDecimal exchangeNum = BigDecimal.valueOf(yeepayOrder.getNum());
|
|
|
|
|
- BigDecimal exchangePoint = goods.getPoint().multiply(exchangeNum);
|
|
|
|
|
-
|
|
|
|
|
- BigDecimal userPoint = user.getPufaPoint().subtract(exchangePoint);
|
|
|
|
|
-
|
|
|
|
|
- if (userPoint.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
|
|
- throw new PointExchangeException("积分不足");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- user.setPufaPoint(userPoint);
|
|
|
|
|
- Assert.isTrue(userPufaPointService.saveOrUpdate(user), "兑换失败");
|
|
|
|
|
- //下单
|
|
|
|
|
- yeepayOrder.setUserId(user.getUserId());
|
|
|
|
|
- yeepayOrder.setUsePoint(exchangePoint);
|
|
|
|
|
- createOrder(yeepayOrder);
|
|
|
|
|
-
|
|
|
|
|
- //添加积分消费
|
|
|
|
|
- PointRecord pointRecord = new PointRecord();
|
|
|
|
|
- pointRecord.setPoint(goods.getPoint());
|
|
|
|
|
- pointRecord.setUserId(user.getUserId());
|
|
|
|
|
- pointRecord.setPointGoodsId(yeepayOrder.getPointGoodsId());
|
|
|
|
|
- pointRecord.setPointType(PointTypeEnum.PUFA_POINT_EXCHANGE);
|
|
|
|
|
- pointRecord.setPhone(yeepayOrder.getPhone());
|
|
|
|
|
- pointRecord.setActiveId(yeepayOrder.getActiveId());
|
|
|
|
|
- Assert.isTrue(pointRecordService.save(pointRecord), "兑换失败");*/
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HashMap<String, Object> cashExchange(YeepayOrder yeepayOrder) throws Exception {
|
|
public HashMap<String, Object> cashExchange(YeepayOrder yeepayOrder) throws Exception {
|
|
|
-/* UserPufaPoint user = userPufaPointService.getOne(new LambdaQueryWrapper<UserPufaPoint>().eq(UserPufaPoint::getPhone, yeepayOrder.getPhone()));
|
|
|
|
|
- Assert.notNull(user, "用户不存在");
|
|
|
|
|
- PointGoods goods = pointGoodsService.getById(yeepayOrder.getPointGoodsId());
|
|
|
|
|
- Assert.notNull(goods, "商品不存在");
|
|
|
|
|
- UserAddress address = userAddressService.getById(yeepayOrder.getAddressId());
|
|
|
|
|
- Assert.notNull(address, "请添加收货地址");
|
|
|
|
|
- Assert.notNull(yeepayOrder.getActiveId(), "兑换失败");
|
|
|
|
|
|
|
|
|
|
- Boolean isLimit = Optional.ofNullable(goods.getIsLimit()).orElse(false);
|
|
|
|
|
- if (isLimit) {
|
|
|
|
|
- int size = goodsOrderService.list(new LambdaQueryWrapper<GoodsOrder>().eq(GoodsOrder::getPhone, yeepayOrder.getPhone())
|
|
|
|
|
- .eq(GoodsOrder::getPointGoodsId, yeepayOrder.getPointGoodsId())).size();
|
|
|
|
|
- if ((yeepayOrder.getNum() + size) > goods.getLimitBuy()) {
|
|
|
|
|
- throw new PointExchangeException("超过限购数量");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (goods.getRemain() < yeepayOrder.getNum()) {
|
|
|
|
|
- throw new PointExchangeException("库存不足");
|
|
|
|
|
- }
|
|
|
|
|
- //商品所需积分
|
|
|
|
|
- BigDecimal exchangeNum = BigDecimal.valueOf(yeepayOrder.getNum());
|
|
|
|
|
- BigDecimal needPoint = goods.getPoint().multiply(exchangeNum);
|
|
|
|
|
- BigDecimal amount = needPoint.divide(BigDecimal.valueOf(100));
|
|
|
|
|
-
|
|
|
|
|
- //判断兑换数量(判断兑换次数大于零)
|
|
|
|
|
- Assert.isTrue(Integer.valueOf(-1).equals(BigDecimal.ZERO.compareTo(BigDecimal.valueOf(yeepayOrder.getNum()))), "兑换数量必须大于零");
|
|
|
|
|
-
|
|
|
|
|
- //回调地址
|
|
|
|
|
- String callbackUrl = new StringBuilder(yeePayConst.getServiceUrl())
|
|
|
|
|
- .append("/app/point/callbackUrl").toString();
|
|
|
|
|
- yeepayOrder.setId(new SnowflakeGenerator().next());
|
|
|
|
|
- yeepayOrder.setPayStatus(YeepayOrderPayStatus.待付款);
|
|
|
|
|
- yeepayOrder.setAmount(amount);
|
|
|
|
|
- yeepayOrder.setHelpGoodsName(goods.getName());
|
|
|
|
|
- yeepayOrder.setCallbackUrl(callbackUrl);
|
|
|
|
|
- yeepayOrder.setCreateTime(new Date());
|
|
|
|
|
- yeepayOrder.setUserId(user.getUserId());
|
|
|
|
|
- yeepayOrder.setUsePoint(BigDecimal.ZERO);
|
|
|
|
|
- yeepayOrder.setPointGoodsName(goods.getName());
|
|
|
|
|
- yeepayOrder.setIp(IPUtils.getRealIp(request));
|
|
|
|
|
-
|
|
|
|
|
- // 请求易宝
|
|
|
|
|
- try {
|
|
|
|
|
- InitOrderDto initOrderDto = InitOrderDto
|
|
|
|
|
- .builder()
|
|
|
|
|
- .orderId(yeepayOrder.getId().toString())
|
|
|
|
|
- .orderAmount(amount.doubleValue())
|
|
|
|
|
- .goodsName(goods.getName())
|
|
|
|
|
- .scene("OFFLINE")
|
|
|
|
|
- .payWay("WECHAT_OFFIACCOUNT")
|
|
|
|
|
- .userIp(yeepayOrder.getIp())
|
|
|
|
|
- .channel("WECHAT")
|
|
|
|
|
- .userId(yeepayOrder.getOpenId())
|
|
|
|
|
- .appId(configForOfficial.getAppId())
|
|
|
|
|
- //支付订单有效期为一天
|
|
|
|
|
- .expiredTime(DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(DateUtil.now(), 1), DateUtil.PATTERN_DATETIME))
|
|
|
|
|
- .notifyUrl(callbackUrl)
|
|
|
|
|
- .build();
|
|
|
|
|
- //设置易宝配置内容
|
|
|
|
|
- initOrderDto.setParentMerchantNo(yeePayConst.getPlatformServiceNo());
|
|
|
|
|
- initOrderDto.setMerchantNo(yeePayConst.getMerchantNo());
|
|
|
|
|
- YopResponse yopResponse = yeepaySaasService.aggPrepay(initOrderDto);
|
|
|
|
|
-
|
|
|
|
|
- //返回数据
|
|
|
|
|
- String stringResult = yopResponse.getStringResult();
|
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(stringResult);
|
|
|
|
|
- //返回给前端
|
|
|
|
|
- String prePayTn = jsonObject.getString("prePayTn");
|
|
|
|
|
-
|
|
|
|
|
- if (!StringUtils.equals(jsonObject.getString("code"), "00000")) {
|
|
|
|
|
- bladeLogger.error("创建道具订单错误", jsonObject.getString("message"));
|
|
|
|
|
- log.error("创建道具订单错误:{}", jsonObject.getString("message"));
|
|
|
|
|
- throw new HelpGoodsException("创建订单失败");
|
|
|
|
|
- }
|
|
|
|
|
- yeepayOrder.setUniqueOrderNo(jsonObject.getString(BeanPropertyUtil.getFieldName(YeepayOrder::getUniqueOrderNo)));
|
|
|
|
|
- yeepayOrder.setQrCodeUrl(jsonObject.getString(BeanPropertyUtil.getFieldName(YeepayOrder::getQrCodeUrl)));
|
|
|
|
|
- yeepayOrder.setBankOrderId(jsonObject.get("bankOrderId").toString());
|
|
|
|
|
- yeepayOrder.setPrePayTn(prePayTn);
|
|
|
|
|
- //保存订单
|
|
|
|
|
- Assert.isTrue(yeepayOrderService.save(yeepayOrder), "创建订单失败");
|
|
|
|
|
-
|
|
|
|
|
- JSONObject prePayTnJson = JSONObject.parseObject(prePayTn);
|
|
|
|
|
-
|
|
|
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
- map.put("appId", prePayTnJson.get("appId"));
|
|
|
|
|
- map.put("timeStamp", prePayTnJson.get("timeStamp"));
|
|
|
|
|
- map.put("nonceStr", prePayTnJson.get("nonceStr"));
|
|
|
|
|
- map.put("package", prePayTnJson.get("package"));
|
|
|
|
|
- map.put("signType", prePayTnJson.get("signType"));
|
|
|
|
|
- map.put("paySign", prePayTnJson.get("paySign"));
|
|
|
|
|
-
|
|
|
|
|
- return map;
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- throw new Exception(e.getMessage());
|
|
|
|
|
- }*/
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -260,7 +118,6 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
goodsOrder.setCash(yeepayOrder.getAmount());
|
|
goodsOrder.setCash(yeepayOrder.getAmount());
|
|
|
}
|
|
}
|
|
|
goodsOrder.setUsePoint(yeepayOrder.getUsePoint());
|
|
goodsOrder.setUsePoint(yeepayOrder.getUsePoint());
|
|
|
-
|
|
|
|
|
Assert.isTrue(goodsOrderService.save(goodsOrder), "兑换失败");
|
|
Assert.isTrue(goodsOrderService.save(goodsOrder), "兑换失败");
|
|
|
|
|
|
|
|
//更新商品库存
|
|
//更新商品库存
|
|
@@ -311,108 +168,6 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HashMap<String, Object> hybridExchange(YeepayOrder yeepayOrder) throws Exception {
|
|
public HashMap<String, Object> hybridExchange(YeepayOrder yeepayOrder) throws Exception {
|
|
|
|
|
|
|
|
-/* UserPufaPoint user = userPufaPointService.getOne(new LambdaQueryWrapper<UserPufaPoint>().eq(UserPufaPoint::getPhone, yeepayOrder.getPhone()));
|
|
|
|
|
- Assert.notNull(user, "用户不存在");
|
|
|
|
|
- PointGoods goods = pointGoodsService.getById(yeepayOrder.getPointGoodsId());
|
|
|
|
|
- Assert.notNull(goods, "商品不存在");
|
|
|
|
|
- UserAddress address = userAddressService.getById(yeepayOrder.getAddressId());
|
|
|
|
|
- Assert.notNull(address, "请添加收货地址");
|
|
|
|
|
- Assert.notNull(yeepayOrder.getActiveId(), "兑换失败");
|
|
|
|
|
-
|
|
|
|
|
- Boolean isLimit = Optional.ofNullable(goods.getIsLimit()).orElse(false);
|
|
|
|
|
- if (isLimit) {
|
|
|
|
|
- int size = goodsOrderService.list(new LambdaQueryWrapper<GoodsOrder>().eq(GoodsOrder::getPhone, yeepayOrder.getPhone()).eq(GoodsOrder::getPointGoodsId, yeepayOrder.getPointGoodsId())).size();
|
|
|
|
|
- if ((yeepayOrder.getNum() + size) > goods.getLimitBuy()) {
|
|
|
|
|
- throw new PointExchangeException("超过限购数量");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (goods.getRemain() < yeepayOrder.getNum()) {
|
|
|
|
|
- throw new PointExchangeException("库存不足");
|
|
|
|
|
- }
|
|
|
|
|
- if (user.getPufaPoint().compareTo(yeepayOrder.getUsePoint()) <= 0) {
|
|
|
|
|
- throw new PointExchangeException("积分不足");
|
|
|
|
|
- }
|
|
|
|
|
- //商品所需积分
|
|
|
|
|
- BigDecimal exchangeNum = BigDecimal.valueOf(yeepayOrder.getNum());
|
|
|
|
|
- BigDecimal exchangePoint = goods.getPoint().multiply(exchangeNum);
|
|
|
|
|
-
|
|
|
|
|
- if (user.getPufaPoint().compareTo(exchangePoint) >= 0) {
|
|
|
|
|
- log.info("积分兑换");
|
|
|
|
|
- this.pointExchange(yeepayOrder);
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //需要的现金
|
|
|
|
|
- BigDecimal usePoint = exchangePoint.subtract(yeepayOrder.getUsePoint());
|
|
|
|
|
- BigDecimal useCash = usePoint.divide(BigDecimal.valueOf(100));
|
|
|
|
|
-
|
|
|
|
|
- //判断兑换数量(判断兑换次数大于零)
|
|
|
|
|
- Assert.isTrue(Integer.valueOf(-1).equals(BigDecimal.ZERO.compareTo(BigDecimal.valueOf(yeepayOrder.getNum()))), "兑换数量必须大于零");
|
|
|
|
|
-
|
|
|
|
|
- //回调地址
|
|
|
|
|
- String callbackUrl = new StringBuilder(yeePayConst.getServiceUrl())
|
|
|
|
|
- .append("/app/point/callbackUrl").toString();
|
|
|
|
|
- yeepayOrder.setId(new SnowflakeGenerator().next());
|
|
|
|
|
- yeepayOrder.setPayStatus(YeepayOrderPayStatus.待付款);
|
|
|
|
|
- yeepayOrder.setAmount(useCash);
|
|
|
|
|
- yeepayOrder.setHelpGoodsName(goods.getName());
|
|
|
|
|
- yeepayOrder.setCallbackUrl(callbackUrl);
|
|
|
|
|
- yeepayOrder.setCreateTime(new Date());
|
|
|
|
|
- yeepayOrder.setPointGoodsName(goods.getName());
|
|
|
|
|
- yeepayOrder.setUserId(user.getUserId());
|
|
|
|
|
-
|
|
|
|
|
- // 请求易宝
|
|
|
|
|
- try {
|
|
|
|
|
- InitOrderDto initOrderDto = InitOrderDto
|
|
|
|
|
- .builder()
|
|
|
|
|
- .orderId(yeepayOrder.getId().toString())
|
|
|
|
|
- .orderAmount(useCash.doubleValue())
|
|
|
|
|
- .goodsName(goods.getName())
|
|
|
|
|
- .scene("OFFLINE")
|
|
|
|
|
- .payWay("WECHAT_OFFIACCOUNT")
|
|
|
|
|
- .userIp(yeepayOrder.getIp())
|
|
|
|
|
- .channel("WECHAT")
|
|
|
|
|
- .userId(yeepayOrder.getOpenId())
|
|
|
|
|
- .appId(configForOfficial.getAppId())
|
|
|
|
|
- //支付订单有效期为一天
|
|
|
|
|
- .expiredTime(DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(DateUtil.now(), 1), DateUtil.PATTERN_DATETIME))
|
|
|
|
|
- .notifyUrl(callbackUrl)
|
|
|
|
|
- .build();
|
|
|
|
|
- //设置易宝配置内容
|
|
|
|
|
- initOrderDto.setParentMerchantNo(yeePayConst.getPlatformServiceNo());
|
|
|
|
|
- initOrderDto.setMerchantNo(yeePayConst.getMerchantNo());
|
|
|
|
|
- YopResponse yopResponse = yeepaySaasService.aggPayPayLink(initOrderDto);
|
|
|
|
|
-
|
|
|
|
|
- //返回数据
|
|
|
|
|
- String stringResult = yopResponse.getStringResult();
|
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(stringResult);
|
|
|
|
|
- String prePayTn = jsonObject.getString("prePayTn");
|
|
|
|
|
- if (!StringUtils.equals(jsonObject.getString("code"), "00000")) {
|
|
|
|
|
- bladeLogger.error("创建道具订单错误", jsonObject.getString("message"));
|
|
|
|
|
- log.error("创建道具订单错误:{}", jsonObject.getString("message"));
|
|
|
|
|
- throw new HelpGoodsException("创建订单失败");
|
|
|
|
|
- }
|
|
|
|
|
- yeepayOrder.setUniqueOrderNo(jsonObject.getString(BeanPropertyUtil.getFieldName(YeepayOrder::getUniqueOrderNo)));
|
|
|
|
|
- yeepayOrder.setQrCodeUrl(jsonObject.getString(BeanPropertyUtil.getFieldName(YeepayOrder::getQrCodeUrl)));
|
|
|
|
|
- yeepayOrder.setBankOrderId(jsonObject.get("bankOrderId").toString());
|
|
|
|
|
- yeepayOrder.setPrePayTn(prePayTn);
|
|
|
|
|
-
|
|
|
|
|
- //保存订单
|
|
|
|
|
- Assert.isTrue(yeepayOrderService.save(yeepayOrder), "创建订单失败");
|
|
|
|
|
- JSONObject prePayTnJson = JSONObject.parseObject(prePayTn);
|
|
|
|
|
-
|
|
|
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|
|
|
|
- map.put("appId", prePayTnJson.get("appId"));
|
|
|
|
|
- map.put("timeStamp", prePayTnJson.get("timeStamp"));
|
|
|
|
|
- map.put("nonceStr", prePayTnJson.get("nonceStr"));
|
|
|
|
|
- map.put("package", prePayTnJson.get("package"));
|
|
|
|
|
- map.put("signType", prePayTnJson.get("signType"));
|
|
|
|
|
- map.put("paySign", prePayTnJson.get("paySign"));
|
|
|
|
|
-
|
|
|
|
|
- return map;
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- throw new Exception(e.getMessage());
|
|
|
|
|
- }*/
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -431,8 +186,8 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
Assert.notNull(address, "请添加收货地址");
|
|
Assert.notNull(address, "请添加收货地址");
|
|
|
Assert.notNull(yeepayOrder.getActiveId(), "兑换失败");
|
|
Assert.notNull(yeepayOrder.getActiveId(), "兑换失败");
|
|
|
|
|
|
|
|
- Boolean isLimit = Integer.valueOf(1).equals(goods.getIsLimit());
|
|
|
|
|
- if (isLimit) {
|
|
|
|
|
|
|
+ int isLimit = Optional.ofNullable(goods.getIsLimit()).orElse(0);
|
|
|
|
|
+ if (isLimit == 1) {
|
|
|
int size = goodsOrderService.list(new LambdaQueryWrapper<GoodsOrder>()
|
|
int size = goodsOrderService.list(new LambdaQueryWrapper<GoodsOrder>()
|
|
|
.eq(GoodsOrder::getPhone, yeepayOrder.getPhone()).eq(GoodsOrder::getPointGoodsId, yeepayOrder.getPointGoodsId())).size();
|
|
.eq(GoodsOrder::getPhone, yeepayOrder.getPhone()).eq(GoodsOrder::getPointGoodsId, yeepayOrder.getPointGoodsId())).size();
|
|
|
System.out.println(size);
|
|
System.out.println(size);
|
|
@@ -491,6 +246,15 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
//需要的现金
|
|
//需要的现金
|
|
|
BigDecimal usePoint = exchangePoint.subtract(yeepayOrder.getUsePoint());
|
|
BigDecimal usePoint = exchangePoint.subtract(yeepayOrder.getUsePoint());
|
|
|
amount = usePoint.divide(BigDecimal.valueOf(100));
|
|
amount = usePoint.divide(BigDecimal.valueOf(100));
|
|
|
|
|
+
|
|
|
|
|
+ PointRecord pointRecord = new PointRecord();
|
|
|
|
|
+ pointRecord.setPoint(yeepayOrder.getUsePoint());
|
|
|
|
|
+ pointRecord.setUserId(user.getUserId());
|
|
|
|
|
+ pointRecord.setPointGoodsId(yeepayOrder.getPointGoodsId());
|
|
|
|
|
+ pointRecord.setPointType(PointTypeEnum.PUFA_POINT_EXCHANGE);
|
|
|
|
|
+ pointRecord.setPhone(yeepayOrder.getPhone());
|
|
|
|
|
+ pointRecord.setActiveId(yeepayOrder.getActiveId());
|
|
|
|
|
+ Assert.isTrue(pointRecordService.save(pointRecord), "兑换失败");
|
|
|
}else {
|
|
}else {
|
|
|
amount = exchangePoint.divide(BigDecimal.valueOf(100));
|
|
amount = exchangePoint.divide(BigDecimal.valueOf(100));
|
|
|
}
|
|
}
|
|
@@ -508,6 +272,11 @@ public class PointExchangeServiceImpl implements PointExchangeService {
|
|
|
yeepayOrder.setCallbackUrl(callbackUrl);
|
|
yeepayOrder.setCallbackUrl(callbackUrl);
|
|
|
yeepayOrder.setCreateTime(new Date());
|
|
yeepayOrder.setCreateTime(new Date());
|
|
|
yeepayOrder.setUserId(user.getUserId());
|
|
yeepayOrder.setUserId(user.getUserId());
|
|
|
|
|
+ if (StringUtil.isEmpty(yeepayOrder.getUsePoint())){
|
|
|
|
|
+ yeepayOrder.setUsePoint(BigDecimal.ZERO);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ yeepayOrder.setUsePoint(yeepayOrder.getUsePoint());
|
|
|
|
|
+ }
|
|
|
yeepayOrder.setUsePoint(BigDecimal.ZERO);
|
|
yeepayOrder.setUsePoint(BigDecimal.ZERO);
|
|
|
yeepayOrder.setPointGoodsName(goods.getName());
|
|
yeepayOrder.setPointGoodsName(goods.getName());
|
|
|
yeepayOrder.setIp(IPUtils.getRealIp(request));
|
|
yeepayOrder.setIp(IPUtils.getRealIp(request));
|