积分记录管理端
This commit is contained in:
@@ -28,7 +28,7 @@ public class DataMigrationUtil extends Thread {
|
|||||||
// courseCatalogue();
|
// courseCatalogue();
|
||||||
// courseCatalogueChapter();
|
// courseCatalogueChapter();
|
||||||
// courseCatalogueChapterVideo();
|
// courseCatalogueChapterVideo();
|
||||||
user();//用的都是copy表里的数据
|
// user();//用的都是copy表里的数据
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,4 +45,7 @@ public class JfTransactionDetails implements Serializable {
|
|||||||
@TableLogic
|
@TableLogic
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private MyUserEntity user;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.modules.common.entity.JfTransactionDetails;
|
import com.peanut.modules.common.entity.JfTransactionDetails;
|
||||||
|
import com.peanut.modules.common.entity.MyUserEntity;
|
||||||
import com.peanut.modules.master.service.JfTransactionDetailsService;
|
import com.peanut.modules.master.service.JfTransactionDetailsService;
|
||||||
|
import com.peanut.modules.master.service.MyUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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;
|
||||||
@@ -12,6 +14,8 @@ 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.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,15 +29,25 @@ public class JfTransactionDetailsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JfTransactionDetailsService jfService;
|
private JfTransactionDetailsService jfService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MyUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/listByPage")
|
@RequestMapping("/listByPage")
|
||||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||||
MPJLambdaWrapper<JfTransactionDetails> wrapper = new MPJLambdaWrapper();
|
MPJLambdaWrapper<JfTransactionDetails> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,JfTransactionDetails::getUserId);
|
||||||
|
wrapper.selectAll(JfTransactionDetails.class);
|
||||||
if (params.containsKey("userId")&& StringUtils.isNotEmpty(params.get("userId").toString())) {
|
if (params.containsKey("userId")&& StringUtils.isNotEmpty(params.get("userId").toString())) {
|
||||||
wrapper.eq(JfTransactionDetails::getUserId,params.get("userId"));
|
wrapper.eq(JfTransactionDetails::getUserId,params.get("userId"));
|
||||||
}
|
}
|
||||||
|
if (params.containsKey("userName")&& StringUtils.isNotEmpty(params.get("userName").toString())) {
|
||||||
|
wrapper.like(MyUserEntity::getName,params.get("userName"));
|
||||||
|
wrapper.like(MyUserEntity::getNickname,params.get("userName"));
|
||||||
|
}
|
||||||
|
|
||||||
if (params.containsKey("actType")&&StringUtils.isNotEmpty(params.get("actType").toString())) {
|
if (params.containsKey("actType")&&StringUtils.isNotEmpty(params.get("actType").toString())) {
|
||||||
wrapper.eq(JfTransactionDetails::getActType,params.get("actType"));
|
wrapper.eq(JfTransactionDetails::getActType,params.get("actType"));
|
||||||
}
|
}
|
||||||
@@ -41,9 +55,16 @@ public class JfTransactionDetailsController {
|
|||||||
wrapper.like(JfTransactionDetails::getRemark,params.get("remark"));
|
wrapper.like(JfTransactionDetails::getRemark,params.get("remark"));
|
||||||
}
|
}
|
||||||
wrapper.orderByDesc(JfTransactionDetails::getCreateTime);
|
wrapper.orderByDesc(JfTransactionDetails::getCreateTime);
|
||||||
Page<JfTransactionDetails> records = jfService.page(new Page<>(
|
Page<JfTransactionDetails> page = jfService.page(new Page<>(
|
||||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||||
return R.ok().put("result", records);
|
List<JfTransactionDetails> records = page.getRecords();
|
||||||
|
if (records.size() > 0) {
|
||||||
|
for (int i=0;i<records.size();i++) {
|
||||||
|
records.get(i).setUser(userService.getById(records.get(i).getUserId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.setRecords(records);
|
||||||
|
return R.ok().put("result", page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/getJfTransactionDetailsById")
|
@RequestMapping("/getJfTransactionDetailsById")
|
||||||
@@ -51,6 +72,33 @@ public class JfTransactionDetailsController {
|
|||||||
return R.ok().put("result", jfService.getById(id));
|
return R.ok().put("result", jfService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//冲扣积分
|
||||||
|
@RequestMapping("/saveJfTransactionDetails")
|
||||||
|
public R saveJfTransactionDetails(@RequestBody Map<String, Object> params) {
|
||||||
|
JfTransactionDetails jf = new JfTransactionDetails();
|
||||||
|
MyUserEntity user = userService.getById(params.get("userId").toString());
|
||||||
|
BigDecimal changeAmount = new BigDecimal(params.get("changeAmount").toString());
|
||||||
|
String actType = params.get("actType").toString();
|
||||||
|
if (actType.equals("0")) {
|
||||||
|
jf.setActType(0);
|
||||||
|
user.setJf(user.getJf().add(changeAmount));
|
||||||
|
}else {
|
||||||
|
jf.setActType(1);
|
||||||
|
user.setJf(user.getJf().subtract(changeAmount));
|
||||||
|
}
|
||||||
|
userService.updateById(user);
|
||||||
|
jf.setUserId(user.getId());
|
||||||
|
jf.setChangeAmount(changeAmount);
|
||||||
|
jf.setRemark(params.get("remark").toString());
|
||||||
|
jf.setUserBalance(user.getJf());
|
||||||
|
jfService.save(jf);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/saveOrUpdateJfTransactionDetails")
|
@RequestMapping("/saveOrUpdateJfTransactionDetails")
|
||||||
public R saveOrUpdateJfTransactionDetails(@RequestBody JfTransactionDetails jf) {
|
public R saveOrUpdateJfTransactionDetails(@RequestBody JfTransactionDetails jf) {
|
||||||
jfService.saveOrUpdate(jf);
|
jfService.saveOrUpdate(jf);
|
||||||
|
|||||||
Reference in New Issue
Block a user