mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +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.page.TableDataInfo;
|
||||
import com.jsowell.common.enums.BusinessType;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
@@ -106,18 +107,34 @@ public class SysUserController extends BaseController {
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhone())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
// if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
|
||||
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
// } else if (StringUtils.isNotEmpty(user.getPhone())
|
||||
// && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
// return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
// } else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
// && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
// 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());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,11 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
||||
// ? appid
|
||||
// : 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 createUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.jsowell.common.annotation.DataScope;
|
||||
import com.jsowell.common.constant.UserConstants;
|
||||
import com.jsowell.common.core.domain.entity.SysRole;
|
||||
import com.jsowell.common.core.domain.entity.SysUser;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.exception.ServiceException;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -239,6 +240,23 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<el-image style="width: 100px; height: 100px"
|
||||
:src="scope.row.logoUrl"></el-image>
|
||||
</template>
|
||||
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@@ -214,7 +214,7 @@
|
||||
</el-form-item>
|
||||
<!-- <el-row>
|
||||
<el-col span="24">
|
||||
|
||||
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
<el-row>
|
||||
@@ -279,18 +279,19 @@
|
||||
<!-- <el-input v-model="form.logoUrl" placeholder="" /> -->
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-row>
|
||||
<el-col span="12">
|
||||
|
||||
</el-col>
|
||||
|
||||
|
||||
</el-row> -->
|
||||
|
||||
<!--<el-form-item label="删除标识" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
|
||||
</el-form-item>-->
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运营商管理员账号" prop="servicePhone">
|
||||
<el-input v-model="form.servicePhone" placeholder="请输入客服电话号码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="运营商管理员密码" prop="appId">
|
||||
<el-input v-model="form.appId" placeholder="请输入小程序APPID"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" >确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
|
||||
Reference in New Issue
Block a user