diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/system/SysUserController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/system/SysUserController.java
index 085786949..409ed2e8f 100644
--- a/jsowell-admin/src/main/java/com/jsowell/web/controller/system/SysUserController.java
+++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/system/SysUserController.java
@@ -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;
}
/**
diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java
index b11ab8038..c548e0660 100644
--- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java
+++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileMerchantInfoServiceImpl.java
@@ -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;
}
/**
diff --git a/jsowell-system/src/main/java/com/jsowell/system/service/SysUserService.java b/jsowell-system/src/main/java/com/jsowell/system/service/SysUserService.java
index ff1c475ed..32388a604 100644
--- a/jsowell-system/src/main/java/com/jsowell/system/service/SysUserService.java
+++ b/jsowell-system/src/main/java/com/jsowell/system/service/SysUserService.java
@@ -112,6 +112,8 @@ public interface SysUserService {
*/
public int insertUser(SysUser user);
+ public int createUser(SysUser user);
+
/**
* 注册用户信息
*
diff --git a/jsowell-system/src/main/java/com/jsowell/system/service/impl/SysUserServiceImpl.java b/jsowell-system/src/main/java/com/jsowell/system/service/impl/SysUserServiceImpl.java
index 0eb094008..37230c378 100644
--- a/jsowell-system/src/main/java/com/jsowell/system/service/impl/SysUserServiceImpl.java
+++ b/jsowell-system/src/main/java/com/jsowell/system/service/impl/SysUserServiceImpl.java
@@ -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);
+ }
+
/**
* 注册用户信息
*
diff --git a/jsowell-ui/src/views/pile/merchant/index.vue b/jsowell-ui/src/views/pile/merchant/index.vue
index bcb28b7d5..7c531dd7d 100644
--- a/jsowell-ui/src/views/pile/merchant/index.vue
+++ b/jsowell-ui/src/views/pile/merchant/index.vue
@@ -134,7 +134,7 @@
-
+
@@ -279,18 +279,19 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+