充值送积分
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.peanut.modules.book.controller;
|
package com.peanut.modules.book.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -97,7 +98,11 @@ public class BookBuyConfigController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("/getVipOrPoint")
|
@RequestMapping("/getVipOrPoint")
|
||||||
public R getVipOrPoint(@RequestParam("type") String type,@RequestParam("qudao") String qudao){
|
public R getVipOrPoint(@RequestParam("type") String type,@RequestParam("qudao") String qudao){
|
||||||
List<BookBuyConfigEntity> bookBuyConfigEntities = bookBuyConfigService.getBaseMapper().selectList(new QueryWrapper<BookBuyConfigEntity>().eq("type",type).eq("qudao",qudao));
|
List<BookBuyConfigEntity> bookBuyConfigEntities = bookBuyConfigService.getBaseMapper()
|
||||||
|
.selectList(new QueryWrapper<BookBuyConfigEntity>()
|
||||||
|
.and(t->t.eq("effective",0).or(q->q.le("start_time",new Date()).ge("end_time",new Date())))
|
||||||
|
.eq("type",type)
|
||||||
|
.eq("qudao",qudao));
|
||||||
|
|
||||||
return R.ok().put("list",bookBuyConfigEntities);
|
return R.ok().put("list",bookBuyConfigEntities);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ public class BookBuyConfigController {
|
|||||||
@RequestMapping("/getBookBuyConfigList")
|
@RequestMapping("/getBookBuyConfigList")
|
||||||
public R getBookBuyConfigList(@RequestBody Map params){
|
public R getBookBuyConfigList(@RequestBody Map params){
|
||||||
LambdaQueryWrapper<BookBuyConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BookBuyConfigEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.and(t->t.eq(BookBuyConfigEntity::getEffective,0)
|
||||||
|
.or(q->q.le(BookBuyConfigEntity::getStartTime,new Date()).ge(BookBuyConfigEntity::getEndTime,new Date())));
|
||||||
if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){
|
if (params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString())){
|
||||||
wrapper.eq(BookBuyConfigEntity::getType,params.get("type"));
|
wrapper.eq(BookBuyConfigEntity::getType,params.get("type"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ public class BookBuyConfigEntity implements Serializable {
|
|||||||
* 金额
|
* 金额
|
||||||
*/
|
*/
|
||||||
private String money;
|
private String money;
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
private String givejf;
|
||||||
/**
|
/**
|
||||||
* vip开通月份
|
* vip开通月份
|
||||||
*/
|
*/
|
||||||
@@ -48,5 +52,11 @@ public class BookBuyConfigEntity implements Serializable {
|
|||||||
* 充值名称
|
* 充值名称
|
||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
/**
|
||||||
|
* 生效类型 0长期有效 1有时间限制
|
||||||
|
*/
|
||||||
|
private int effective;
|
||||||
|
private Date startTime;
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,6 +31,8 @@ public class BuyConfigController {
|
|||||||
@RequestMapping("/getBookBuyConfigList")
|
@RequestMapping("/getBookBuyConfigList")
|
||||||
public R getBookBuyConfigList(@RequestBody Map<String, Object> params) {
|
public R getBookBuyConfigList(@RequestBody Map<String, Object> params) {
|
||||||
LambdaQueryWrapper<BookBuyConfigEntity> wrapper = new LambdaQueryWrapper();
|
LambdaQueryWrapper<BookBuyConfigEntity> wrapper = new LambdaQueryWrapper();
|
||||||
|
wrapper.and(t->t.eq(BookBuyConfigEntity::getEffective,0)
|
||||||
|
.or(q->q.le(BookBuyConfigEntity::getStartTime,new Date()).ge(BookBuyConfigEntity::getEndTime,new Date())));
|
||||||
if (StringUtils.isNotEmpty(params.get("qudao").toString())) {
|
if (StringUtils.isNotEmpty(params.get("qudao").toString())) {
|
||||||
wrapper.eq(BookBuyConfigEntity::getQudao,params.get("qudao"));
|
wrapper.eq(BookBuyConfigEntity::getQudao,params.get("qudao"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,6 +197,20 @@ public class AliPayServiceImpl implements AliPayService {
|
|||||||
if("point".equals(subject)){
|
if("point".equals(subject)){
|
||||||
// 插入花生币 变动记录
|
// 插入花生币 变动记录
|
||||||
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(Integer.valueOf(body));
|
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(Integer.valueOf(body));
|
||||||
|
//充值送积分
|
||||||
|
if (bookBuyConfigEntity != null && !"0".equals(bookBuyConfigEntity.getGivejf())) {
|
||||||
|
MyUserEntity userEntity = userService.getById(order.getUserId());
|
||||||
|
userEntity.setJf(userEntity.getJf().add(new BigDecimal(bookBuyConfigEntity.getGivejf())));
|
||||||
|
userService.updateById(userEntity);
|
||||||
|
JfTransactionDetails jfTransactionDetails = new JfTransactionDetails();
|
||||||
|
jfTransactionDetails.setUserId(userEntity.getId());
|
||||||
|
jfTransactionDetails.setChangeAmount(new BigDecimal(bookBuyConfigEntity.getGivejf()));
|
||||||
|
jfTransactionDetails.setActType(0);
|
||||||
|
jfTransactionDetails.setUserBalance(userEntity.getJf());
|
||||||
|
jfTransactionDetails.setRelationId(order.getOrderId());
|
||||||
|
jfTransactionDetails.setRemark("充币送积分:"+bookBuyConfigEntity.getDescription()+",订单号:"+order.getOrderSn());
|
||||||
|
jfTransactionDetailsDao.insert(jfTransactionDetails);
|
||||||
|
}
|
||||||
String realMoney = bookBuyConfigEntity.getRealMoney();
|
String realMoney = bookBuyConfigEntity.getRealMoney();
|
||||||
Integer money = Integer.valueOf(realMoney);
|
Integer money = Integer.valueOf(realMoney);
|
||||||
userService.rechargeHSPoint(Integer.valueOf(customerid),money);
|
userService.rechargeHSPoint(Integer.valueOf(customerid),money);
|
||||||
|
|||||||
@@ -267,6 +267,20 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
|||||||
PayWechatOrderEntity buy_order_id = payWechatOrderService.getBaseMapper().selectOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
|
PayWechatOrderEntity buy_order_id = payWechatOrderService.getBaseMapper().selectOne(new QueryWrapper<PayWechatOrderEntity>().eq("order_sn", order.getOrderSn()));
|
||||||
Integer buyorder = buy_order_id.getBuyOrderId();
|
Integer buyorder = buy_order_id.getBuyOrderId();
|
||||||
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(buyorder);
|
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(buyorder);
|
||||||
|
//充值送积分
|
||||||
|
if (bookBuyConfigEntity != null && !"0".equals(bookBuyConfigEntity.getGivejf())) {
|
||||||
|
MyUserEntity userEntity = userService.getById(order.getUserId());
|
||||||
|
userEntity.setJf(userEntity.getJf().add(new BigDecimal(bookBuyConfigEntity.getGivejf())));
|
||||||
|
userService.updateById(userEntity);
|
||||||
|
JfTransactionDetails jfTransactionDetails = new JfTransactionDetails();
|
||||||
|
jfTransactionDetails.setUserId(userEntity.getId());
|
||||||
|
jfTransactionDetails.setChangeAmount(new BigDecimal(bookBuyConfigEntity.getGivejf()));
|
||||||
|
jfTransactionDetails.setActType(0);
|
||||||
|
jfTransactionDetails.setUserBalance(userEntity.getJf());
|
||||||
|
jfTransactionDetails.setRelationId(order.getOrderId());
|
||||||
|
jfTransactionDetails.setRemark("充币送积分:"+bookBuyConfigEntity.getDescription()+",订单号:"+order.getOrderSn());
|
||||||
|
jfTransactionDetailsDao.insert(jfTransactionDetails);
|
||||||
|
}
|
||||||
String realMoney = bookBuyConfigEntity.getRealMoney();
|
String realMoney = bookBuyConfigEntity.getRealMoney();
|
||||||
int money = Integer.parseInt(realMoney);
|
int money = Integer.parseInt(realMoney);
|
||||||
userService.rechargeHSPoint(order.getUserId(), money);
|
userService.rechargeHSPoint(order.getUserId(), money);
|
||||||
|
|||||||
Reference in New Issue
Block a user