mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-20 15:19:52 +08:00
update
This commit is contained in:
@@ -8,6 +8,7 @@ import com.jsowell.common.core.domain.entity.SysRole;
|
|||||||
import com.jsowell.common.core.domain.entity.SysUser;
|
import com.jsowell.common.core.domain.entity.SysUser;
|
||||||
import com.jsowell.common.core.page.TableDataInfo;
|
import com.jsowell.common.core.page.TableDataInfo;
|
||||||
import com.jsowell.common.enums.BusinessType;
|
import com.jsowell.common.enums.BusinessType;
|
||||||
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.SecurityUtils;
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.poi.ExcelUtil;
|
import com.jsowell.common.util.poi.ExcelUtil;
|
||||||
@@ -106,18 +107,34 @@ public class SysUserController extends BaseController {
|
|||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
// if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
} else if (StringUtils.isNotEmpty(user.getPhone())
|
// } else if (StringUtils.isNotEmpty(user.getPhone())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
// && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
// } else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
// && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
// }
|
||||||
|
// user.setCreateBy(getUsername());
|
||||||
|
// user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
|
||||||
|
AjaxResult result;
|
||||||
|
try {
|
||||||
|
int i = userService.createUser(user);
|
||||||
|
if (i > 0) {
|
||||||
|
result = AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
result = AjaxResult.error();
|
||||||
|
}
|
||||||
|
} catch (BusinessException e) {
|
||||||
|
logger.error("新增用户失败warn", e);
|
||||||
|
result = AjaxResult.error(e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("新增用户失败error", e);
|
||||||
|
result = AjaxResult.error();
|
||||||
}
|
}
|
||||||
user.setCreateBy(getUsername());
|
return result;
|
||||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
|
||||||
return toAjax(userService.insertUser(user));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
// ? appid
|
// ? appid
|
||||||
// : pileMerchantInfo.getAppId();
|
// : pileMerchantInfo.getAppId();
|
||||||
pileMerchantInfo.setAppId(pileMerchantInfo.getAppId());
|
pileMerchantInfo.setAppId(pileMerchantInfo.getAppId());
|
||||||
return pileMerchantInfoMapper.insertPileMerchantInfo(pileMerchantInfo);
|
int i = pileMerchantInfoMapper.insertPileMerchantInfo(pileMerchantInfo);
|
||||||
|
|
||||||
|
// 3 创建运营商管理员
|
||||||
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ public interface SysUserService {
|
|||||||
*/
|
*/
|
||||||
public int insertUser(SysUser user);
|
public int insertUser(SysUser user);
|
||||||
|
|
||||||
|
public int createUser(SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.jsowell.common.annotation.DataScope;
|
|||||||
import com.jsowell.common.constant.UserConstants;
|
import com.jsowell.common.constant.UserConstants;
|
||||||
import com.jsowell.common.core.domain.entity.SysRole;
|
import com.jsowell.common.core.domain.entity.SysRole;
|
||||||
import com.jsowell.common.core.domain.entity.SysUser;
|
import com.jsowell.common.core.domain.entity.SysUser;
|
||||||
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.exception.ServiceException;
|
import com.jsowell.common.exception.ServiceException;
|
||||||
import com.jsowell.common.util.SecurityUtils;
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
@@ -239,6 +240,23 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int createUser(SysUser user) {
|
||||||
|
// 校验
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(this.checkUserNameUnique(user.getUserName()))) {
|
||||||
|
throw new BusinessException("", "新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getPhone())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(this.checkPhoneUnique(user))) {
|
||||||
|
throw new BusinessException("", "新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
|
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(this.checkEmailUnique(user))) {
|
||||||
|
throw new BusinessException("", "新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
|
}
|
||||||
|
user.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||||
|
return insertUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -279,18 +279,19 @@
|
|||||||
<!-- <el-input v-model="form.logoUrl" placeholder="" /> -->
|
<!-- <el-input v-model="form.logoUrl" placeholder="" /> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<!-- <el-row>
|
<el-row>
|
||||||
<el-col span="12">
|
<el-col :span="12">
|
||||||
|
<el-form-item label="运营商管理员账号" prop="servicePhone">
|
||||||
</el-col>
|
<el-input v-model="form.servicePhone" placeholder="请输入客服电话号码"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row> -->
|
<el-col :span="12">
|
||||||
|
<el-form-item label="运营商管理员密码" prop="appId">
|
||||||
<!--<el-form-item label="删除标识" prop="delFlag">
|
<el-input v-model="form.appId" placeholder="请输入小程序APPID"/>
|
||||||
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
|
</el-form-item>
|
||||||
</el-form-item>-->
|
</el-col>
|
||||||
</el-form>
|
</el-row>
|
||||||
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm" >确 定</el-button>
|
<el-button type="primary" @click="submitForm" >确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
|||||||
Reference in New Issue
Block a user