From 0b16ae4d4bce4b0b61d42a49105cbb7ae7a573f9 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Fri, 12 May 2017 14:46:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E7=9B=B8=E5=90=8C=E5=B8=90=E5=8F=B7?= =?UTF-8?q?=EF=BC=8C=E4=B8=94=E4=B8=8D=E5=85=81=E8=AE=B8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=B8=90=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zheng/upms/rpc/api/UpmsUserService.java | 3 ++- .../zheng/upms/rpc/api/UpmsUserServiceMock.java | 3 ++- .../rpc/service/impl/UpmsUserServiceImpl.java | 10 +++++++++- .../controller/manage/UpmsUserController.java | 17 ++++++++++------- .../webapp/WEB-INF/jsp/manage/user/create.jsp | 2 +- .../webapp/WEB-INF/jsp/manage/user/update.jsp | 2 +- 6 files changed, 25 insertions(+), 12 deletions(-) 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 @@
- +