提交 fc42841c 作者: han

优化

上级 594593c2
......@@ -89,7 +89,7 @@ public class UserPointsController extends BaseController {
}
@ApiOperation(value = "用户购买积分")
@ApiOperation(value = "用户购买积分(微信支付已成功)")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/weixinBuyPoints")
public ResultBody weixinBuyPoints(@RequestBody BuyPointsVO buyPointsVO,HttpServletRequest request) {
......@@ -115,4 +115,11 @@ public class UserPointsController extends BaseController {
return userPointsService.insertBuyPointsType(buyPointsVO);
}
@ApiOperation(value = "根据类型ID返回购买积分选购类型")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/buyPointsTypeById")
public Integer buyPointsTypeById(@ApiParam(value = "购买聊天时长的类型id,唯一识别id", required = true) Integer typeId){
return userPointsService.buyPointsTypeById(typeId);
}
}
......@@ -42,4 +42,6 @@ public interface UserPointsService {
ResultBody updateBuyPointsType(BuyPointsVO buyPointsVO);
ResultBody selectAllBuyPointsType();
Integer buyPointsTypeById(Integer typeId);
}
......@@ -15,6 +15,7 @@ import com.mmc.iuav.user.model.qo.userpoints.AppPointsDetailsQO;
import com.mmc.iuav.user.model.qo.userpoints.UserPointQO;
import com.mmc.iuav.user.model.qo.userpoints.UserPointsDetailsQO;
import com.mmc.iuav.user.model.vo.BuyPointsVO;
import com.mmc.iuav.user.model.vo.MessageTimeVO;
import com.mmc.iuav.user.model.vo.OrderRequestParamsVO;
import com.mmc.iuav.user.model.vo.userpoints.ChangeUserPointVO;
import com.mmc.iuav.user.model.vo.userpoints.PointTypeVO;
......@@ -175,17 +176,17 @@ public class UserPointsServiceImpl implements UserPointsService {
return ResultBody.error("购买积分类型不能传递为空");
}
BuyPointsVO buyPointsVO1 = userPointsDao.selectBuyPointsType(buyPointsVO.getId());
OrderRequestParamsVO orderRequestParamsVO = new OrderRequestParamsVO();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String content = "WP" + sdf.format(new Date());
orderRequestParamsVO.setOrderNo(content);
orderRequestParamsVO.setDescription("购买积分");
BigDecimal money = buyPointsVO1.getMoney();
BigDecimal amountInFen = money.multiply(new BigDecimal("100")).setScale(0, RoundingMode.DOWN);
orderRequestParamsVO.setAmount(amountInFen.intValue());
orderRequestParamsVO.setOrderPort(4);
// 扣除金额
Map map = paymentAppApi.orderPay(orderRequestParamsVO, token);
// OrderRequestParamsVO orderRequestParamsVO = new OrderRequestParamsVO();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
// String content = "WP" + sdf.format(new Date());
// orderRequestParamsVO.setOrderNo(content);
// orderRequestParamsVO.setDescription("购买积分");
// BigDecimal money = buyPointsVO1.getMoney();
// BigDecimal amountInFen = money.multiply(new BigDecimal("100")).setScale(0, RoundingMode.DOWN);
// orderRequestParamsVO.setAmount(amountInFen.intValue());
// orderRequestParamsVO.setOrderPort(4);
// // 扣除金额
// Map map = paymentAppApi.orderPay(orderRequestParamsVO, token);
// 增加积分
ChangeUserPointVO changeUserPointVO = new ChangeUserPointVO();
changeUserPointVO.setUserAccountId(userAccountId);
......@@ -212,4 +213,12 @@ public class UserPointsServiceImpl implements UserPointsService {
List<BuyPointsVO> buyPointsVOS = userPointsDao.selectAllBuyPointsType();
return ResultBody.success(buyPointsVOS);
}
@Override
public Integer buyPointsTypeById(Integer typeId) {
BuyPointsVO buyPointsVO = userPointsDao.selectBuyPointsType(typeId);
BigDecimal money = buyPointsVO.getMoney();
BigDecimal amountInFen = money.multiply(new BigDecimal("100")).setScale(0, RoundingMode.DOWN);
return amountInFen.intValue();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论