diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserService.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserService.java index 929e2c5f..e413003e 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserService.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserService.java @@ -10,5 +10,6 @@ import com.zheng.upms.dao.model.UpmsUserExample; */ public interface UpmsUserService extends BaseService { - UpmsUser insert2(UpmsUser upmsUser); + UpmsUser createUser(UpmsUser upmsUser); + } \ No newline at end of file diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserServiceMock.java index 65982260..10956086 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserServiceMock.java @@ -12,7 +12,8 @@ import com.zheng.upms.dao.model.UpmsUserExample; public class UpmsUserServiceMock extends BaseServiceMock implements UpmsUserService { @Override - public UpmsUser insert2(UpmsUser upmsUser) { + public UpmsUser createUser(UpmsUser upmsUser) { return null; } + } diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java index ab05c74d..85022996 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java @@ -27,8 +27,16 @@ public class UpmsUserServiceImpl extends BaseServiceImpl 0) { + return null; + } upmsUserMapper.insert(upmsUser); return upmsUser; } + } \ No newline at end of file diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java index 0aa624c1..87377ba7 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java @@ -1,7 +1,6 @@ package com.zheng.upms.server.controller.manage; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.baidu.unbiz.fluentvalidator.ComplexResult; import com.baidu.unbiz.fluentvalidator.FluentValidator; import com.baidu.unbiz.fluentvalidator.ResultCollectors; @@ -16,7 +15,6 @@ import com.zheng.upms.rpc.api.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +24,10 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; /** * 用户controller @@ -189,10 +190,12 @@ public class UpmsUserController extends BaseController { upmsUser.setSalt(salt); upmsUser.setPassword(MD5Util.MD5(upmsUser.getPassword() + upmsUser.getSalt())); upmsUser.setCtime(time); - int count = upmsUserService.insertSelective(upmsUser); - //upmsUser = upmsUserService.insert2(upmsUser); - //_log.info("新增用户,主键:userId={}", upmsUser.getUserId()); - return new UpmsResult(UpmsResultConstant.SUCCESS, count); + upmsUser = upmsUserService.createUser(upmsUser); + if (null == upmsUser) { + return new UpmsResult(UpmsResultConstant.FAILED, "帐号名已存在!"); + } + _log.info("新增用户,主键:userId={}", upmsUser.getUserId()); + return new UpmsResult(UpmsResultConstant.SUCCESS, 1); } @ApiOperation(value = "删除用户") diff --git a/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/create.jsp b/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/create.jsp index 0c54a042..1dfdd777 100644 --- a/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/create.jsp +++ b/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/create.jsp @@ -96,7 +96,7 @@ function createSubmit() { animation: 'rotateX', closeAnimation: 'rotateX', title: false, - content: result.data.errorMsg, + content: result.data.errorMsg || result.data, buttons: { confirm: { text: '确认', diff --git a/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/update.jsp b/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/update.jsp index 98c41269..8a04c44a 100644 --- a/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/update.jsp +++ b/zheng-upms/zheng-upms-server/src/main/webapp/WEB-INF/jsp/manage/user/update.jsp @@ -10,7 +10,7 @@
- +