bug修复

This commit is contained in:
张乐
2020-08-17 18:32:53 +08:00
parent 506d04346b
commit 097eed991e
19 changed files with 111 additions and 87 deletions

View File

@@ -8,8 +8,14 @@
<el-input v-model="pram.author" placeholder="作者" maxlength="20"/> <el-input v-model="pram.author" placeholder="作者" maxlength="20"/>
</el-form-item> </el-form-item>
<el-form-item label="文章分类"> <el-form-item label="文章分类">
<!-- prop="cid" :rules="[{required:true, message:'请选择文章分类', trigger:['blur','change']}]"--> <el-select v-model="pram.cid" placeholder="请选择" style="width:100%;">
<el-cascader v-model="pram.cid" :options="categoryTreeData" :props="categoryProps" style="width:100%;" /> <el-option
v-for="item in categoryTreeData"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="图文封面" prop="imageInput" :rules="[{ required: true, message: '请上传图文封面', trigger: 'change' }]"> <el-form-item label="图文封面" prop="imageInput" :rules="[{ required: true, message: '请上传图文封面', trigger: 'change' }]">
<div class="upLoadPicBox" @click="modalPicTap('1')"> <div class="upLoadPicBox" @click="modalPicTap('1')">
@@ -94,7 +100,7 @@ export default {
}, },
pram: { pram: {
author: null, author: null,
cid: 0, cid: null,
content: null, content: null,
imageInput: '', imageInput: '',
isBanner: false, isBanner: false,
@@ -163,9 +169,9 @@ export default {
// this.pram.mediaId = mediaId // this.pram.mediaId = mediaId
}, },
handlerGetCategoryTreeData() { handlerGetCategoryTreeData() {
const _pram = { type: constants.categoryType[2].value, status: 1 } const _pram = { type: constants.categoryType[2].value, status: 1, pid: 0 }
categoryApi.treeCategroy(_pram).then(data => { categoryApi.treeCategroy(_pram).then(data => {
this.categoryTreeData = selfUtil.addTreeListLabelForCasCard(data) this.categoryTreeData = data
}) })
}, },
handerSubmit(form) { handerSubmit(form) {

View File

@@ -22,7 +22,6 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="用户名称:"> <el-form-item label="用户名称:">
{{uids}}
<el-select v-model="uids" style="width: 500px" reserve-keyword multiple remote filterable <el-select v-model="uids" style="width: 500px" reserve-keyword multiple remote filterable
:remote-method="remoteMethod" :loading="loading" placeholder="请输入用户名称" clearable @change="seachList"> :remote-method="remoteMethod" :loading="loading" placeholder="请输入用户名称" clearable @change="seachList">
<el-option <el-option

View File

@@ -57,7 +57,7 @@
</el-table-column> </el-table-column>
<el-table-column label="最后登录时间" prop="lastTime"> <el-table-column label="最后登录时间" prop="lastTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.lastTime | filterEmpty }}</span> <span>{{ scope.row.updateTime | filterEmpty }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="最后登录IP" prop="lastIp"> <el-table-column label="最后登录IP" prop="lastIp">

View File

@@ -35,20 +35,20 @@
<el-link :underline="false" @click="cityDetail(scope.row)">{{ scope.row.name }}</el-link> <el-link :underline="false" @click="cityDetail(scope.row)">{{ scope.row.name }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!--<el-table-column-->
label="状态" <!--label="状态"-->
min-width="100" <!--min-width="100"-->
> <!--&gt;-->
<template slot-scope="scope"> <!--<template slot-scope="scope">-->
<el-switch <!--<el-switch-->
v-model="scope.row.isShow" <!--v-model="scope.row.isShow"-->
class="demo" <!--class="demo"-->
active-text="开启" <!--active-text="开启"-->
inactive-text="关闭" <!--inactive-text="关闭"-->
@change="cityStatus(scope.row)" <!--@change="cityStatus(scope.row)"-->
/> <!--/>-->
</template> <!--</template>-->
</el-table-column> <!--</el-table-column>-->
<el-table-column <el-table-column
fixed="right" fixed="right"
min-width="80" min-width="80"
@@ -128,7 +128,8 @@ export default {
// 状态 // 状态
cityStatus(e) { cityStatus(e) {
logistics.updateStatus({ logistics.updateStatus({
id: e.cityId, id: e.id,
cityId: e.cityId,
status: e.isShow status: e.isShow
}).then(res => { }).then(res => {
this.$message.success('操作成功') this.$message.success('操作成功')

View File

@@ -27,19 +27,16 @@
</el-form-item> </el-form-item>
<el-form-item label="用户等级:"> <el-form-item label="用户等级:">
<el-select v-model="ruleForm.level" placeholder="请选择" class="selWidth" clearable filterable> <el-select v-model="ruleForm.level" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="" label="全部"></el-option>
<el-option :value="item.id" v-for="(item, index) in levelList" :key="index" :label="item.name"></el-option> <el-option :value="item.id" v-for="(item, index) in levelList" :key="index" :label="item.name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="用户分组:"> <el-form-item label="用户分组:">
<el-select v-model="ruleForm.groupId" placeholder="请选择" class="selWidth" clearable filterable> <el-select v-model="ruleForm.groupId" placeholder="请选择" class="selWidth" clearable filterable>
<el-option value="" label="全部"></el-option>
<el-option :value="item.id" v-for="(item, index) in groupList" :key="index" :label="item.groupName"></el-option> <el-option :value="item.id" v-for="(item, index) in groupList" :key="index" :label="item.groupName"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="用户标签:"> <el-form-item label="用户标签:">
<el-select v-model="labelData" placeholder="请选择" class="selWidth" clearable filterable multiple > <el-select v-model="labelData" placeholder="请选择" class="selWidth" clearable filterable multiple >
<el-option value="" label="全部"></el-option>
<el-option :value="item.id" v-for="(item, index) in labelLists" :key="index" :label="item.name"></el-option> <el-option :value="item.id" v-for="(item, index) in labelLists" :key="index" :label="item.name"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -138,7 +135,7 @@
}, },
// 等级列表 // 等级列表
levelLists () { levelLists () {
levelListApi({ page: 1, limit: 9999}).then(async res => { levelListApi({ page: 1, limit: 9999, isShow: 1, isDel: 0}).then(async res => {
this.levelList = res.list this.levelList = res.list
}) })
}, },

View File

@@ -94,7 +94,7 @@ export function getArticleBannerList(){
* *
*/ */
export function getArticleDetails(id){ export function getArticleDetails(id){
return request.get('article/info',id,{},{noAuth:true}); return request.get('article/info',id,{noAuth:true});
} }
/** /**

View File

@@ -86,7 +86,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
} }
lambdaQueryWrapper.orderByDesc(Article::getSort).orderByDesc(Article::getVisit); lambdaQueryWrapper.orderByDesc(Article::getSort).orderByDesc(Article::getVisit).orderByDesc(Article::getCreateTime);
List<Article> articleList = dao.selectList(lambdaQueryWrapper); List<Article> articleList = dao.selectList(lambdaQueryWrapper);
ArrayList<ArticleVo> articleVoArrayList = new ArrayList<>(); ArrayList<ArticleVo> articleVoArrayList = new ArrayList<>();

View File

@@ -5,6 +5,7 @@ import com.common.CommonResult;
import com.constants.Constants; import com.constants.Constants;
import com.exception.CrmebException; import com.exception.CrmebException;
import com.exception.ExceptionCodeEnum; import com.exception.ExceptionCodeEnum;
import com.utils.CrmebUtil;
import com.zbkj.crmeb.authorization.manager.TokenManager; import com.zbkj.crmeb.authorization.manager.TokenManager;
import com.zbkj.crmeb.system.request.SystemAdminLoginRequest; import com.zbkj.crmeb.system.request.SystemAdminLoginRequest;
import com.zbkj.crmeb.system.request.SystemAdminRequest; import com.zbkj.crmeb.system.request.SystemAdminRequest;
@@ -60,7 +61,7 @@ public class adminUser {
@ApiOperation(value="AdminUserLogin") @ApiOperation(value="AdminUserLogin")
@PostMapping(value = "/login", produces = "application/json") @PostMapping(value = "/login", produces = "application/json")
public CommonResult<SystemAdminResponse> SystemAdminLogin(@RequestBody @Validated SystemAdminLoginRequest systemAdminLoginRequest) throws Exception { public CommonResult<SystemAdminResponse> SystemAdminLogin(@RequestBody @Validated SystemAdminLoginRequest systemAdminLoginRequest, HttpServletRequest request) throws Exception {
// 判断验证码 // 判断验证码
ValidateCode validateCode = new ValidateCode(systemAdminLoginRequest.getKey(),systemAdminLoginRequest.getCode()); ValidateCode validateCode = new ValidateCode(systemAdminLoginRequest.getKey(),systemAdminLoginRequest.getCode());
boolean codeCheckResult = validateCodeService.check(validateCode); boolean codeCheckResult = validateCodeService.check(validateCode);
@@ -69,7 +70,7 @@ public class adminUser {
SystemAdminRequest systemAdminRequest = new SystemAdminRequest(); SystemAdminRequest systemAdminRequest = new SystemAdminRequest();
systemAdminRequest.setAccount(systemAdminLoginRequest.getAccount()); systemAdminRequest.setAccount(systemAdminLoginRequest.getAccount());
systemAdminRequest.setPwd(systemAdminLoginRequest.getPwd()); systemAdminRequest.setPwd(systemAdminLoginRequest.getPwd());
SystemAdminResponse systemAdminResponse = systemAdminService.login(systemAdminRequest); SystemAdminResponse systemAdminResponse = systemAdminService.login(systemAdminRequest, CrmebUtil.getClientIp(request));
if(null == systemAdminResponse){ if(null == systemAdminResponse){
return CommonResult.failed(ExceptionCodeEnum.FAILED, "login failed"); return CommonResult.failed(ExceptionCodeEnum.FAILED, "login failed");
} }

View File

@@ -30,7 +30,7 @@ public class StoreOrderRefundRequest {
private Integer orderId; private Integer orderId;
@ApiModelProperty(value = "退款金额") @ApiModelProperty(value = "退款金额")
@DecimalMin(value = "0.01", message = "退款金额不能少于0.01") @DecimalMin(value = "0.00", message = "退款金额不能少于0.00")
private BigDecimal amount; private BigDecimal amount;
@ApiModelProperty(value = "status 1 = 直接退款, 2 = 退款后,返回原状态", allowableValues = "range[1,2]") @ApiModelProperty(value = "status 1 = 直接退款, 2 = 退款后,返回原状态", allowableValues = "range[1,2]")

View File

@@ -9,9 +9,7 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* <p> * <p>
@@ -44,11 +42,11 @@ public class StoreProductReplyAddRequest implements Serializable {
private String unique; private String unique;
@ApiModelProperty(value = "商品分数", example = "5", required = true) @ApiModelProperty(value = "商品分数", example = "5", required = true)
@Min(1) @Min(value = 1, message = "商品分数必须大于1")
private Integer productScore; private Integer productScore;
@ApiModelProperty(value = "服务分数", example = "5", required = true) @ApiModelProperty(value = "服务分数", example = "5", required = true)
@Min(1) @Min(value = 1, message = "服务分数必须大于1")
private Integer serviceScore; private Integer serviceScore;
@ApiModelProperty(value = "评论内容", required = true) @ApiModelProperty(value = "评论内容", required = true)

View File

@@ -193,7 +193,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
if(StringUtils.isNotBlank(request.getCateId())){ if(StringUtils.isNotBlank(request.getCateId())){
lambdaQueryWrapper.eq(StoreProduct::getCateId, request.getCateId()); lambdaQueryWrapper.eq(StoreProduct::getCateId, request.getCateId());
} }
lambdaQueryWrapper.orderByDesc(StoreProduct::getSort).orderByDesc(StoreProduct::getId);
List<StoreProduct> storeProducts = dao.selectList(lambdaQueryWrapper); List<StoreProduct> storeProducts = dao.selectList(lambdaQueryWrapper);
List<StoreProductResponse> storeProductResponses = new ArrayList<>(); List<StoreProductResponse> storeProductResponses = new ArrayList<>();
for (StoreProduct product : storeProducts) { for (StoreProduct product : storeProducts) {

View File

@@ -114,7 +114,7 @@ public class SystemAttachmentController {
@RequestMapping(value = "/move", method = RequestMethod.POST) @RequestMapping(value = "/move", method = RequestMethod.POST)
public CommonResult<String> updateAttrId(@RequestBody @Validated SystemAttachmentMoveRequest move){ public CommonResult<String> updateAttrId(@RequestBody @Validated SystemAttachmentMoveRequest move){
LambdaUpdateWrapper<SystemAttachment> lup = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<SystemAttachment> lup = new LambdaUpdateWrapper<>();
lup.eq(SystemAttachment::getAttId,move.getAttrId()); lup.in(SystemAttachment::getAttId, CrmebUtil.stringToArray(move.getAttrId()));
lup.set(SystemAttachment::getPid, move.getPid()); lup.set(SystemAttachment::getPid, move.getPid());
if(systemAttachmentService.update(lup)){ if(systemAttachmentService.update(lup)){
return CommonResult.success(); return CommonResult.success();

View File

@@ -1,17 +1,17 @@
package com.zbkj.crmeb.system.model; package com.zbkj.crmeb.system.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable; import com.baomidou.mybatisplus.annotation.TableName;
import com.zbkj.crmeb.system.response.SystemAdminResponse;
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;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/** /**
* <p> * <p>
* 后台管理员表 * 后台管理员表
@@ -49,13 +49,10 @@ public class SystemAdmin implements Serializable {
private String lastIp; private String lastIp;
@ApiModelProperty(value = "后台管理员最后一次登录时间") @ApiModelProperty(value = "后台管理员最后一次登录时间")
private Integer lastTime; private Date updateTime;
@ApiModelProperty(value = "后台管理员添加时间") @ApiModelProperty(value = "后台管理员添加时间")
private Integer addTime; private Date createTime;
@ApiModelProperty(value = "登录次数")
private Integer loginCount;
@ApiModelProperty(value = "后台管理员级别") @ApiModelProperty(value = "后台管理员级别")
private Integer level; private Integer level;
@@ -63,7 +60,10 @@ public class SystemAdmin implements Serializable {
@ApiModelProperty(value = "后台管理员状态 1有效0无效") @ApiModelProperty(value = "后台管理员状态 1有效0无效")
private Boolean status; private Boolean status;
@ApiModelProperty(value = "是否删除 1是0否")
private Boolean isDel; private Boolean isDel;
@ApiModelProperty(value = "登录次数")
private Integer loginCount;
} }

View File

@@ -3,16 +3,14 @@ package com.zbkj.crmeb.system.request;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
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;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* <p> * <p>
@@ -51,10 +49,10 @@ public class SystemAdminRequest implements Serializable {
private String lastIp; private String lastIp;
@ApiModelProperty(value = "后台管理员最后一次登录时间") @ApiModelProperty(value = "后台管理员最后一次登录时间")
private Integer lastTime; private Date updateTime;
@ApiModelProperty(value = "后台管理员添加时间") @ApiModelProperty(value = "后台管理员添加时间")
private Integer addTime; private Date createTime;
@ApiModelProperty(value = "登录次数") @ApiModelProperty(value = "登录次数")
private Integer loginCount; private Integer loginCount;

View File

@@ -1,9 +1,18 @@
package com.zbkj.crmeb.system.request; package com.zbkj.crmeb.system.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data @Data
public class SystemAttachmentMoveRequest { public class SystemAttachmentMoveRequest {
@ApiModelProperty(value = "父级id")
private Integer pid; private Integer pid;
private Integer attrId;
@ApiModelProperty(value = "附件id")
@NotBlank(message = "请选择附件")
private String attrId;
} }

View File

@@ -2,7 +2,6 @@ package com.zbkj.crmeb.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.common.PageParamRequest; import com.common.PageParamRequest;
import com.zbkj.crmeb.category.vo.CategoryTreeVo;
import com.zbkj.crmeb.system.model.SystemAdmin; import com.zbkj.crmeb.system.model.SystemAdmin;
import com.zbkj.crmeb.system.request.SystemAdminAddRequest; import com.zbkj.crmeb.system.request.SystemAdminAddRequest;
import com.zbkj.crmeb.system.request.SystemAdminRequest; import com.zbkj.crmeb.system.request.SystemAdminRequest;
@@ -20,7 +19,7 @@ public interface SystemAdminService extends IService<SystemAdmin> {
SystemAdminResponse getInfo(SystemAdminRequest request) throws Exception; SystemAdminResponse getInfo(SystemAdminRequest request) throws Exception;
SystemAdminResponse login(SystemAdminRequest request) throws Exception; SystemAdminResponse login(SystemAdminRequest request, String ip) throws Exception;
/** /**
* 根据Token获取对应用户信息 * 根据Token获取对应用户信息

View File

@@ -49,9 +49,7 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
if(StringUtils.isNotBlank(systemAdmin.getAccount())){ if(StringUtils.isNotBlank(systemAdmin.getAccount())){
lambdaQueryWrapper.eq(SystemAdmin::getAccount, systemAdmin.getAccount()); lambdaQueryWrapper.eq(SystemAdmin::getAccount, systemAdmin.getAccount());
} }
if(null != systemAdmin.getAddTime()){
lambdaQueryWrapper.eq(SystemAdmin::getAddTime, systemAdmin.getAddTime());
}
if(null != systemAdmin.getId()){ if(null != systemAdmin.getId()){
lambdaQueryWrapper.eq(SystemAdmin::getId, systemAdmin.getId()); lambdaQueryWrapper.eq(SystemAdmin::getId, systemAdmin.getId());
} }
@@ -61,9 +59,7 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
if(StringUtils.isNotBlank(systemAdmin.getLastIp())){ if(StringUtils.isNotBlank(systemAdmin.getLastIp())){
lambdaQueryWrapper.eq(SystemAdmin::getLastIp, systemAdmin.getLastIp()); lambdaQueryWrapper.eq(SystemAdmin::getLastIp, systemAdmin.getLastIp());
} }
if(null != systemAdmin.getLastTime()){
lambdaQueryWrapper.eq(SystemAdmin::getLastTime, systemAdmin.getLastTime());
}
if(null != systemAdmin.getLevel()){ if(null != systemAdmin.getLevel()){
lambdaQueryWrapper.eq(SystemAdmin::getLevel, systemAdmin.getLevel()); lambdaQueryWrapper.eq(SystemAdmin::getLevel, systemAdmin.getLevel());
} }
@@ -84,7 +80,7 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
} }
@Override @Override
public SystemAdminResponse login(SystemAdminRequest request) throws Exception { public SystemAdminResponse login(SystemAdminRequest request, String ip) {
LambdaQueryWrapper<SystemAdmin> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SystemAdmin> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SystemAdmin::getAccount, request.getAccount()); lambdaQueryWrapper.eq(SystemAdmin::getAccount, request.getAccount());
SystemAdmin systemAdmin = dao.selectOne(lambdaQueryWrapper); SystemAdmin systemAdmin = dao.selectOne(lambdaQueryWrapper);
@@ -93,6 +89,15 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
if(null == systemAdmin){ if(null == systemAdmin){
throw new CrmebException("用户不存在"); throw new CrmebException("用户不存在");
} }
if(!systemAdmin.getStatus()){
throw new CrmebException("用户已经被禁用");
}
if(systemAdmin.getIsDel()){
throw new CrmebException("用户已经被删除");
}
if(!systemAdmin.getPwd().equals(encryptPassword)){ if(!systemAdmin.getPwd().equals(encryptPassword)){
throw new CrmebException("账号或者密码不正确"); throw new CrmebException("账号或者密码不正确");
} }
@@ -100,6 +105,12 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
SystemAdminResponse systemAdminResponse = new SystemAdminResponse(); SystemAdminResponse systemAdminResponse = new SystemAdminResponse();
systemAdminResponse.setToken(tokenModel.getToken()); systemAdminResponse.setToken(tokenModel.getToken());
BeanUtils.copyProperties(systemAdmin, systemAdminResponse); BeanUtils.copyProperties(systemAdmin, systemAdminResponse);
//更新最后登录信息
systemAdmin.setLoginCount(systemAdmin.getLoginCount() + 1);
systemAdmin.setLastIp(ip);
updateById(systemAdmin);
return systemAdminResponse; return systemAdminResponse;
} }
@@ -137,26 +148,37 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
* @return * @return
*/ */
@Override @Override
public SystemAdminResponse saveAdmin(SystemAdminAddRequest systemAdminAddRequest) throws Exception { public SystemAdminResponse saveAdmin(SystemAdminAddRequest systemAdminAddRequest) {
// 管理员名称唯一校验 try {
SystemAdminRequest systemAdminRequest = new SystemAdminRequest(); // 管理员名称唯一校验
BeanUtils.copyProperties(systemAdminAddRequest, systemAdminRequest); Integer result = checkAccount(systemAdminAddRequest.getAccount());
SystemAdminResponse systemAdminResponseExsit = getInfo(systemAdminRequest); if (result > 0) {
if(null != systemAdminResponseExsit){ throw new CrmebException("管理员已存在");
throw new CrmebException("管理员已存在"); }
}
// 执行新增管理员操作 SystemAdminRequest systemAdminRequest = new SystemAdminRequest();
String pwd = CrmebUtil.encryptPassword(systemAdminAddRequest.getPwd(), systemAdminAddRequest.getAccount()); BeanUtils.copyProperties(systemAdminAddRequest, systemAdminRequest);
systemAdminAddRequest.setPwd(pwd);
SystemAdmin systemAdmin = new SystemAdmin(); // 执行新增管理员操作
BeanUtils.copyProperties(systemAdminAddRequest, systemAdmin); String pwd = CrmebUtil.encryptPassword(systemAdminAddRequest.getPwd(), systemAdminAddRequest.getAccount());
if(dao.insert(systemAdmin) > 0){ systemAdminAddRequest.setPwd(pwd);
SystemAdmin systemAdmin = new SystemAdmin();
BeanUtils.copyProperties(systemAdminAddRequest, systemAdmin);
SystemAdminResponse systemAdminResponse = new SystemAdminResponse(); SystemAdminResponse systemAdminResponse = new SystemAdminResponse();
BeanUtils.copyProperties(systemAdminAddRequest, systemAdminResponse); BeanUtils.copyProperties(systemAdminAddRequest, systemAdminResponse);
return systemAdminResponse; return systemAdminResponse;
}catch (Exception e){
throw new CrmebException("新增管理员异常 " + e.getMessage());
} }
throw new CrmebException("新增管理员异常"); }
private Integer checkAccount(String account) {
LambdaQueryWrapper<SystemAdmin> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SystemAdmin::getAccount, account);
return dao.selectCount(lambdaQueryWrapper);
} }
@Override @Override

View File

@@ -1,21 +1,18 @@
package com.zbkj.crmeb.system.service.impl; package com.zbkj.crmeb.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.common.PageParamRequest; import com.common.PageParamRequest;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.zbkj.crmeb.system.model.SystemUserLevel;
import com.zbkj.crmeb.system.dao.SystemUserLevelDao; import com.zbkj.crmeb.system.dao.SystemUserLevelDao;
import com.zbkj.crmeb.system.model.SystemUserLevel;
import com.zbkj.crmeb.system.request.SystemUserLevelRequest; import com.zbkj.crmeb.system.request.SystemUserLevelRequest;
import com.zbkj.crmeb.system.request.SystemUserLevelSearchRequest; import com.zbkj.crmeb.system.request.SystemUserLevelSearchRequest;
import com.zbkj.crmeb.system.service.SystemAttachmentService; import com.zbkj.crmeb.system.service.SystemAttachmentService;
import com.zbkj.crmeb.system.service.SystemUserLevelService; import com.zbkj.crmeb.system.service.SystemUserLevelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.crmeb.user.model.User;
import com.zbkj.crmeb.user.service.UserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -35,9 +32,6 @@ public class SystemUserLevelServiceImpl extends ServiceImpl<SystemUserLevelDao,
@Autowired @Autowired
private SystemAttachmentService systemAttachmentService; private SystemAttachmentService systemAttachmentService;
@Autowired
private UserService userService;
/** /**
* 分页显示设置用户等级表 * 分页显示设置用户等级表

View File

@@ -22153,8 +22153,8 @@ CREATE TABLE `eb_system_admin` (
`real_name` varchar(16) NOT NULL COMMENT '后台管理员姓名', `real_name` varchar(16) NOT NULL COMMENT '后台管理员姓名',
`roles` varchar(128) NOT NULL COMMENT '后台管理员权限(menus_id)', `roles` varchar(128) NOT NULL COMMENT '后台管理员权限(menus_id)',
`last_ip` varchar(16) DEFAULT NULL COMMENT '后台管理员最后一次登录ip', `last_ip` varchar(16) DEFAULT NULL COMMENT '后台管理员最后一次登录ip',
`last_time` int(10) unsigned DEFAULT NULL COMMENT '后台管理员最后一次登录时间', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`add_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '后台管理员添加时间', `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`login_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数', `login_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
`level` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员级别', `level` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员级别',
`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员状态 1有效0无效', `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员状态 1有效0无效',
@@ -22167,7 +22167,7 @@ CREATE TABLE `eb_system_admin` (
LOCK TABLES `eb_system_admin` WRITE; LOCK TABLES `eb_system_admin` WRITE;
/*!40000 ALTER TABLE `eb_system_admin` DISABLE KEYS */; /*!40000 ALTER TABLE `eb_system_admin` DISABLE KEYS */;
INSERT INTO `eb_system_admin` (`id`, `account`, `pwd`, `real_name`, `roles`, `last_ip`, `last_time`, `add_time`, `login_count`, `level`, `status`, `is_del`) INSERT INTO `eb_system_admin` (`id`, `account`, `pwd`, `real_name`, `roles`, `last_ip`, `update_time`, `create_time`, `login_count`, `level`, `status`, `is_del`)
VALUES VALUES
(1,'admin','L8qdg72wbeQ=','admin','1','127.0.0.1',0,0,0,0,1,0), (1,'admin','L8qdg72wbeQ=','admin','1','127.0.0.1',0,0,0,0,1,0),
(2,'testadmin','sdIqelBleuI=','testadmin','2',NULL,NULL,0,0,111,1,1), (2,'testadmin','sdIqelBleuI=','testadmin','2',NULL,NULL,0,0,111,1,1),