Commit 7e58c1b2 authored by licc's avatar licc

代码fix

parent deb83406
......@@ -46,7 +46,12 @@ public class R<T> implements Serializable {
public R(T data, String msg) {
this.code = 0;
this.message = "success";
this.data = data;
this.message = msg;
}
public R(int code, String msg,T data) {
this.code = code;
this.data = data;
this.message = msg;
}
......@@ -119,4 +124,15 @@ public class R<T> implements Serializable {
return new R<>(code, msg);
}
/**
* 请求失败,返回前台信息
*
* @param code 错误码
* @param msg 描述
* @return R
*/
public static <T> R<T> error(int code, String msg,T data) {
return new R<>(code, msg,data);
}
}
......@@ -120,9 +120,9 @@ public class RefillCardServiceImpl implements RefillCardService {
//子卡添加
for (int i = 0; i < byId.getCardNumber(); i++) {
CardInfo cardInfo = new CardInfo();
cardInfo.setBanthNumber(byId.getBatchNumber());
cardInfo.setBatchNumber(byId.getBatchNumber());
cardInfo.setIsDelete(0);
cardInfo.setMoney("10");
cardInfo.setMoney(498);
cardInfo.setStatus(0);
cardInfo.setLimit(3);
cardInfo.setSecretKey(SecretkeyUtil.getSecretkey());
......
......@@ -126,6 +126,10 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
return R.error("用户查询信息不存在!");
}
if (userLimit.getUsableLimit() == 0) {
return R.error(1,"您的查询次数已使用完了,请充值!", false);
}
//扣减用户可用查询次数
int usableLimit = userLimit.getUsableLimit() - 1;
......
......@@ -73,13 +73,13 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
//查询相关信息
ScoreInfo scoreInfo = scoreInfoMapper.getById(user.getId());
LoginRecord loginRecord = loginRecordMapper.getById(user.getId());
UserLimit userLimit = userLimitMapper.getById(user.getId());
UserLimit userLimit = userLimitMapper.getByUserId(user.getId());
List<PayRecord> byId = payRecordMapper.getById(user.getId());
//计算累计充值金额
Integer sumMoney=0;
for (PayRecord payRecord : byId) {
sumMoney+=Integer.valueOf(payRecord.getMoney());
sumMoney+=payRecord.getMoney();
}
//将消息进行同步
......
......@@ -76,17 +76,6 @@ public class SchemeController {
return R.ok("添加成功");
}
@ApiOperation(value = "测试主键自增", notes = "测试主键自增")
@ApiImplicitParam(name = "schemeInfo", value = "信息", dataType = "SchemeInfo")
@PostMapping("/add")
public R<SchemeInfo> add(@RequestBody SchemeInfo schemeInfo) {
R<SchemeInfo> scheme = volunteerService.add(schemeInfo);
log.info("scheme:" + scheme);
return scheme;
}
@ApiOperation(value = "获取方案列表", notes = "获取方案列表", httpMethod = "GET")
@ApiImplicitParam(name = "queryVo", value = "查询参数", dataType = "SchemeQueryVo")
@GetMapping("/getSchemeList")
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.app.UserLimit;
import cn.wisenergy.model.app.Volunteer;
import cn.wisenergy.model.vo.AddLimitVo;
import cn.wisenergy.service.app.UserLimitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author 86187
* @ Description: PC-用户查询次数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment