Commit e6545993 authored by liaoanyuan's avatar liaoanyuan

管理员登录接口修改

parent 4c159a83
...@@ -7,6 +7,9 @@ import lombok.Data; ...@@ -7,6 +7,9 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/**
* 管理员实体类
*/
@Data @Data
@ApiModel(value = "AccountInfo") @ApiModel(value = "AccountInfo")
public class AccountInfo implements Serializable { public class AccountInfo implements Serializable {
......
package cn.wisenergy.model.app; package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -9,70 +8,66 @@ import java.io.Serializable; ...@@ -9,70 +8,66 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* 充值卡实体类 * 充值卡字卡实体类
*
* @author 86187
*/ */
@Data @Data
@ApiModel(value = "CardInfo") @ApiModel(value = "CardInfo")
@TableName("card")
public class CardInfo implements Serializable { public class CardInfo implements Serializable {
private static final long serialVersionUID = 2732927512736158423L;
/** /**
* 子卡id * 子卡id
*/ */
@ApiModelProperty(value = "子卡id", name = "id") @ApiModelProperty(value = "子卡id",name = "id")
private Integer id; private Integer id;
/** /**
* 批次号 * 批次号
*/ */
@ApiModelProperty(value = "批次号", name = "batchNumber") @ApiModelProperty(value = "批次号",name = "batchNumber")
private String batchNumber; private String batchNumber;
/** /**
* 批次号 * 批次号
*/ */
@ApiModelProperty(value = "批次号", name = "batchNumber") @ApiModelProperty(value = "批次号",name = "batchNumber")
private String cardNumber; private String cardNumber;
/** /**
* 次数 * 次数
*/ */
@ApiModelProperty(value = "次数", name = "limit") @ApiModelProperty(value = "次数",name = "limit")
private Integer limit; private Integer limit;
/** /**
* 秘钥 * 秘钥
*/ */
@ApiModelProperty(value = "秘钥", name = "secretKey") @ApiModelProperty(value = "秘钥",name = "secretKey")
private String secretKey; private String secretKey ;
/** /**
* 卡的金额 * 卡的金额
*/ */
@ApiModelProperty(value = "卡的金额", name = "money") @ApiModelProperty(value = "卡的金额",name = "money")
private Integer money; private String money;
/** /**
* 状态 * 状态
*/ */
@ApiModelProperty(value = "状态 0:未使用 1:已使用", name = "status") @ApiModelProperty(value = "状态 0:未使用 1:已使用",name = "status")
private Integer status; private Integer status;
/** /**
* 是否删除 * 是否删除
*/ */
@ApiModelProperty(name = "isDelete", value = "是否删除 0:正常 1:删除") @ApiModelProperty(name = "isDelete",value = "是否删除 0:正常 1:删除")
private Integer isDelete; private Integer isDelete;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间", name = "creteTime") @ApiModelProperty(value = "创建时间",name = "creteTime")
private Date createTime; private Date createTime;
/** /**
* 更改时间 *更改时间
*/ */
@ApiModelProperty(value = "更改时间", name = "updateTime") @ApiModelProperty(value = "更改时间",name = "updateTime")
private Date updateTime; private Date updateTime;
} }
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "AccountInfo")
public class AccountLoginVo implements Serializable {
private static final long serialVersionUID = -3802879442149734552L;
/**
* 管理员账号
*/
@ApiModelProperty(name = "name",value = "管理员账号")
private String userName;
/**
* 管理员密码
*/
@ApiModelProperty(name="password",value = "管理员密码")
private String password;
}
...@@ -2,12 +2,13 @@ package cn.wisenergy.service.app; ...@@ -2,12 +2,13 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.AccountDto; import cn.wisenergy.model.dto.AccountDto;
import cn.wisenergy.model.vo.AccountLoginVo;
public interface AccountSerivce { public interface AccountSerivce {
/** /**
* 查询管理员信息 * 查询管理员信息
* @param userName,password 查询参数 * @param accountLoginVo 查询参数
* @return 管理员信息 * @return 管理员信息
*/ */
R<AccountDto> getAccountInfo(String userName, String password); R<AccountDto> getAccountInfo(AccountLoginVo accountLoginVo);
} }
...@@ -4,9 +4,7 @@ import cn.wisenergy.common.utils.R; ...@@ -4,9 +4,7 @@ import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.RefillCard; import cn.wisenergy.model.app.RefillCard;
import cn.wisenergy.model.dto.RefillCardDto; import cn.wisenergy.model.dto.RefillCardDto;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface RefillCardService { public interface RefillCardService {
/** /**
......
...@@ -5,6 +5,7 @@ import cn.wisenergy.common.utils.R; ...@@ -5,6 +5,7 @@ import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.AccountMapper; import cn.wisenergy.mapper.AccountMapper;
import cn.wisenergy.model.app.AccountInfo; import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.dto.AccountDto; import cn.wisenergy.model.dto.AccountDto;
import cn.wisenergy.model.vo.AccountLoginVo;
import cn.wisenergy.service.app.AccountSerivce; import cn.wisenergy.service.app.AccountSerivce;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -22,17 +23,20 @@ public class AccountSerivceImpl implements AccountSerivce { ...@@ -22,17 +23,20 @@ public class AccountSerivceImpl implements AccountSerivce {
private AccountMapper accountMapper; private AccountMapper accountMapper;
@Override @Override
public R<AccountDto> getAccountInfo(String userName, String password) { public R<AccountDto> getAccountInfo(AccountLoginVo accountLoginVo) {
log.info("AccountSerivceImpl[].getAccountInfo[].input.param:userName,password"+userName,password); log.info("AccountSerivceImpl[].getAccountInfo[].input.param:accountLoginVo:"+accountLoginVo);
if (null==accountLoginVo) {
return R.error("账号或密码为空");
}
//判断参数是否为空 //判断参数是否为空
if (StringUtils.isEmpty(userName)||StringUtils.isEmpty(password)) { if (StringUtils.isEmpty(accountLoginVo.getUserName())||StringUtils.isEmpty(accountLoginVo.getPassword())) {
return R.error("账号或密码为空"); return R.error("账号或密码为空");
} }
//创建参数容器map //创建参数容器map
HashMap<String, Object> map = new HashMap<>(4); HashMap<String, Object> map = new HashMap<>(4);
map.put("userName",userName); map.put("userName",accountLoginVo.getUserName());
//查询管理者信息 //查询管理者信息
AccountInfo accountInfo = accountMapper.getAccountInfo(map); AccountInfo accountInfo = accountMapper.getAccountInfo(map);
...@@ -42,10 +46,9 @@ public class AccountSerivceImpl implements AccountSerivce { ...@@ -42,10 +46,9 @@ public class AccountSerivceImpl implements AccountSerivce {
//将加密过后的密码与传输数据进行比较 //将加密过后的密码与传输数据进行比较
String s = Md5Util.digestMD5(accountInfo.getPassword()); String s = Md5Util.digestMD5(accountInfo.getPassword());
if (!password.equals(s)) { if (!accountLoginVo.getPassword().equals(s)) {
return R.error("密码或者用户名错误"); return R.error("密码或者用户名错误");
} }
//查询超过则进行数据copy //查询超过则进行数据copy
AccountDto accountDto = new AccountDto(); AccountDto accountDto = new AccountDto();
BeanUtils.copyProperties(accountInfo,accountDto); BeanUtils.copyProperties(accountInfo,accountDto);
......
...@@ -61,7 +61,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme ...@@ -61,7 +61,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
//判断数据是否修改成功 //判断数据是否修改成功
if (edit == 0) { if (edit == 0) {
return R.error("数据修改失败"); return R.ok(1,false);
} }
return R.ok(0, true); return R.ok(0, true);
...@@ -128,7 +128,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme ...@@ -128,7 +128,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
//判断数据是否修改成功 //判断数据是否修改成功
if (i == 0) { if (i == 0) {
return R.error("数据修改失败"); return R.ok(1,false);
} }
return R.ok(0, true); return R.ok(0, true);
} }
......
...@@ -63,7 +63,7 @@ public class RefillCardServiceImpl implements RefillCardService { ...@@ -63,7 +63,7 @@ public class RefillCardServiceImpl implements RefillCardService {
} }
int update = refillCardMapper.update(batchNumber); int update = refillCardMapper.update(batchNumber);
if (update==0) { if (update==0) {
return R.error("数据修改失败"); R.ok(1,false);
} }
return R.ok(0,true); return R.ok(0,true);
} }
...@@ -122,7 +122,7 @@ public class RefillCardServiceImpl implements RefillCardService { ...@@ -122,7 +122,7 @@ public class RefillCardServiceImpl implements RefillCardService {
CardInfo cardInfo = new CardInfo(); CardInfo cardInfo = new CardInfo();
cardInfo.setBatchNumber(byId.getBatchNumber()); cardInfo.setBatchNumber(byId.getBatchNumber());
cardInfo.setIsDelete(0); cardInfo.setIsDelete(0);
cardInfo.setMoney(498); cardInfo.setMoney("10");
cardInfo.setStatus(0); cardInfo.setStatus(0);
cardInfo.setLimit(3); cardInfo.setLimit(3);
cardInfo.setSecretKey(SecretkeyUtil.getSecretkey()); cardInfo.setSecretKey(SecretkeyUtil.getSecretkey());
...@@ -132,12 +132,12 @@ public class RefillCardServiceImpl implements RefillCardService { ...@@ -132,12 +132,12 @@ public class RefillCardServiceImpl implements RefillCardService {
int add1 = cardMapper.add(cardInfos); int add1 = cardMapper.add(cardInfos);
if (add1==0) { if (add1==0) {
R.error("数据添加失败"); return R.ok(1,false);
} }
int isMakeCard = refillCardMapper.setIsMakeCard(id); int isMakeCard = refillCardMapper.setIsMakeCard(id);
if (isMakeCard==0) { if (isMakeCard==0) {
R.error("充值卡是否制卡状态修改失败"); return R.ok(1,false);
} }
return R.ok(0,true); return R.ok(0,true);
} }
......
...@@ -172,7 +172,7 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit ...@@ -172,7 +172,7 @@ public class UserLimitServiceImpl extends ServiceImpl<UserLimitMapper, UserLimit
//3、保存充值记录 //3、保存充值记录
PayRecord payRecord = new PayRecord(); PayRecord payRecord = new PayRecord();
payRecord.setCardId(cardInfo.getId()); payRecord.setCardId(cardInfo.getId());
payRecord.setMoney(cardInfo.getMoney()); payRecord.setMoney(Integer.valueOf(cardInfo.getMoney()));
payRecord.setPayLimit(cardInfo.getLimit()); payRecord.setPayLimit(cardInfo.getLimit());
payRecord.setResult(0); payRecord.setResult(0);
payRecord.setType(addLimitVo.getPayType()); payRecord.setType(addLimitVo.getPayType());
......
...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app; ...@@ -2,6 +2,7 @@ package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.AccountDto; import cn.wisenergy.model.dto.AccountDto;
import cn.wisenergy.model.vo.AccountLoginVo;
import cn.wisenergy.service.app.AccountSerivce; import cn.wisenergy.service.app.AccountSerivce;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -10,9 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -10,9 +11,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author 86187 * @author 86187
...@@ -31,9 +30,9 @@ public class AccountController { ...@@ -31,9 +30,9 @@ public class AccountController {
@ApiImplicitParam(name = "password",value = "密码",required = true) @ApiImplicitParam(name = "password",value = "密码",required = true)
}) })
@PostMapping("/login") @PostMapping("/login")
public R<AccountDto> getAccountInfo(String userName, String password){ public R<AccountDto> getAccountInfo(@RequestBody AccountLoginVo accountLoginVo){
log.info("AccountController[].getAccountInfo[].input.param:userName,password"+userName,password); log.info("AccountController[].getAccountInfo[].input.param:accountLoginVo:"+accountLoginVo);
//返回数据 //返回数据
return accountSerivce.getAccountInfo(userName, password); return accountSerivce.getAccountInfo(accountLoginVo);
} }
} }
...@@ -16,8 +16,6 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -16,8 +16,6 @@ import org.springframework.web.bind.annotation.PostMapping;
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.List;
@Api(tags = "充值卡管理") @Api(tags = "充值卡管理")
@RestController @RestController
@RequestMapping("/refillCard") @RequestMapping("/refillCard")
......
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