dcs 1 tahun lalu
induk
melakukan
bda2aff6c5
35 mengubah file dengan 322 tambahan dan 1183 penghapusan
  1. 7 0
      virgo.core/pom.xml
  2. 4 5
      virgo.core/src/main/java/com/bosshand/virgo/core/config/ShiroConfig.java
  3. 52 52
      virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java
  4. 0 14
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/AppUserTokenDao.java
  5. 1 15
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrUserDao.java
  6. 0 22
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/OperationRecordDao.java
  7. 0 14
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/OperationRecordHistoryDao.java
  8. 0 70
      virgo.core/src/main/java/com/bosshand/virgo/core/model/AppUserToken.java
  9. 65 156
      virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUser.java
  10. 0 78
      virgo.core/src/main/java/com/bosshand/virgo/core/model/OperationRecord.java
  11. 0 35
      virgo.core/src/main/java/com/bosshand/virgo/core/model/OperationRecordHistory.java
  12. 11 29
      virgo.core/src/main/java/com/bosshand/virgo/core/model/UserContext.java
  13. 59 119
      virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java
  14. 9 51
      virgo.core/src/main/java/com/bosshand/virgo/core/shiro/LoginUserDto.java
  15. 5 4
      virgo.core/src/main/java/com/bosshand/virgo/core/shiro/UserRealm.java
  16. 40 79
      virgo.core/src/main/java/com/bosshand/virgo/core/shiro/VirgoAuthenticationFilter.java
  17. 50 0
      virgo.core/src/main/java/com/bosshand/virgo/core/utils/CodeCache.java
  18. 3 6
      virgo.manager/src/main/java/com/bosshand/virgo/util/ImageUtil.java
  19. 1 1
      virgo.manager/src/main/java/com/bosshand/virgo/util/VerificationCodeUtils.java
  20. 0 22
      virgo.core/src/main/resources/mapper/AppUserTokenMapper.xml
  21. 4 62
      virgo.core/src/main/resources/mapper/MgrUserMapper.xml
  22. 0 21
      virgo.core/src/main/resources/mapper/OperationRecordHistoryMapper.xml
  23. 0 50
      virgo.core/src/main/resources/mapper/OperationRecordMapper.xml
  24. 0 199
      virgo.manager/src/main/java/com/bosshand/virgo/controller/RegisterController.java
  25. 0 2
      virgo.manager/src/main/java/com/bosshand/virgo/controller/UserInfoController.java
  26. 4 20
      virgo.manager/src/main/java/com/bosshand/virgo/message/service/MessagePushService.java
  27. 6 56
      virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java
  28. 1 1
      virgo.manager/src/main/java/com/bosshand/virgo/shiro/CustomRealm.java
  29. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/controller/RegisterController.class
  30. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/controller/UserInfoController.class
  31. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/message/service/MessagePushService.class
  32. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/service/UserService.class
  33. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/shiro/CustomRealm.class
  34. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/util/ImageUtil.class
  35. TEMPAT SAMPAH
      virgo.manager/target/classes/com/bosshand/virgo/util/VerificationCodeUtils.class

+ 7 - 0
virgo.core/pom.xml

@@ -77,6 +77,13 @@
 		    <version>${druid.version}</version>
 		</dependency>
  -->
+
+		<dependency>
+			<groupId>net.sf.json-lib</groupId>
+			<artifactId>json-lib</artifactId>
+			<version>2.4</version>
+			<classifier>jdk15</classifier>
+		</dependency>
 		 <dependency>
 		    <groupId>com.alibaba</groupId>
 		    <artifactId>druid-spring-boot-starter</artifactId>

+ 4 - 5
virgo.core/src/main/java/com/bosshand/virgo/core/config/ShiroConfig.java

@@ -84,8 +84,10 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/department/userId/**","anon");
 
 		filterChainDefinitionMap.put("/organization/listOnlyName","anon");
-		filterChainDefinitionMap.put("/register/**","anon");
-		
+		filterChainDefinitionMap.put("/pCode/**","anon");
+		filterChainDefinitionMap.put("/send/**","anon");
+		filterChainDefinitionMap.put("/verify/**","anon");
+
 		filterChainDefinitionMap.put("/userInfo/yui/verifyFace/**","anon");
 		
 		filterChainDefinitionMap.put("/userInfo/verifyQr","anon");
@@ -112,10 +114,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/resoucebundle/**", "anon");
         filterChainDefinitionMap.put("/frontend/**", "anon");
         filterChainDefinitionMap.put("/wzfrontend/**", "anon");
-        filterChainDefinitionMap.put("/czfrontend/**", "anon");
-        filterChainDefinitionMap.put("/zjfrontend/**", "anon");
 		filterChainDefinitionMap.put("/**", "virgoFilter");
-		//filterChainDefinitionMap.put("/**", "virgoTestMusicFilter");
        
         shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
         return shiroFilterFactoryBean;

+ 52 - 52
virgo.core/src/main/java/com/bosshand/virgo/core/controller/UserContextController.java

@@ -1,10 +1,15 @@
 package com.bosshand.virgo.core.controller;
 
-import com.bosshand.virgo.core.model.*;
+import com.bosshand.virgo.core.model.MgrOrganization;
+import com.bosshand.virgo.core.model.MgrUser;
+import com.bosshand.virgo.core.model.UserContext;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.core.service.MgrUserService;
 import com.bosshand.virgo.core.shiro.LoginUserDto;
+import com.bosshand.virgo.core.utils.CodeCache;
 import com.bosshand.virgo.core.utils.ContextUtils;
+import com.bosshand.virgo.core.utils.ImageUtil;
+import com.bosshand.virgo.core.utils.VerificationCodeUtils;
 import com.bosshand.virgo.exception.Constant;
 import io.swagger.annotations.ApiOperation;
 import org.apache.shiro.SecurityUtils;
@@ -13,24 +18,62 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
+import java.util.Random;
 
 @RestController
 public class UserContextController {
 	
 	@Autowired
 	private MgrUserService mgrUserService;
-	
-	@ApiOperation(value="登录", notes="登录系统")
+
+	@ApiOperation(value="获取图片验证码", notes="获取图片验证码")
+	@RequestMapping(value = "/pCode", method = RequestMethod.GET)
+	public Response getCode() {
+		ImageUtil imageUtil = new ImageUtil(120, 40, 4, 30);
+		CodeCache.setKey(imageUtil.getCode(), imageUtil.getCode());
+		Map<String, Object> result = new HashMap<String, Object>();
+		String pngBase64 = "data:image/png;base64," + imageUtil.getPngBase64();
+		result.put("pngBase64", pngBase64);
+		return Response.ok(result);
+	}
+
+	@ApiOperation(value="发送短信", notes="发送短信")
+	@RequestMapping(value = "/send/{phone}/{pCode}", method = RequestMethod.GET)
+	public Response getCode(@PathVariable String phone, @PathVariable String pCode) {
+		if (CodeCache.getKey(pCode) == null){
+			return Response.fail(404, "图片验证码有误, 请再次刷新图片验证码");
+		}
+		if (!(phone.matches("^1[3-9]\\d{9}$"))) {
+			return Response.fail(404, "手机号有误");
+		}
+		Random random = new Random();
+		String result = "";
+		for (int i = 0; i < 6; i++) {
+			result += random.nextInt(10);
+		}
+		VerificationCodeUtils.getRequest2(phone, "250112", result);
+		CodeCache.setKey(phone, result);
+		return Response.ok("发送成功!");
+	}
+
+	@ApiOperation(value = "验证短信验证码", notes = "验证短信验证码")
+	@RequestMapping(value = "/verify/{phone}/{vCode}", method = RequestMethod.GET)
+	public Response verificationCode(@PathVariable String phone, @PathVariable String vCode) {
+		if (CodeCache.getKey(phone).equals(vCode)) {
+			return Response.fail(405, "手机验证码有误");
+		}
+		return Response.ok();
+	}
+
+	@ApiOperation(value="登录注册", notes="登录注册")
 	@RequestMapping(value = "/login", method = RequestMethod.POST)
-	public Response login( LoginUserDto dto) {
+	public Response login(@RequestBody LoginUserDto dto) {
 		//login execution will be handled in VirgoAuthenticationFilter
 		Subject subject = SecurityUtils.getSubject();
 		if(!subject.isAuthenticated()) {
 			return Response.fail(Constant.CODE_UNKNOWN, Constant.RET_UNKNOWN);
 		}
-		
     	Map<String,String> map = new HashMap<String,String>();
     	map.put("token", subject.getSession().getId().toString());
 		return Response.ok(map);
@@ -41,69 +84,34 @@ public class UserContextController {
 	public Response logout() {
 		return Response.ok();
 	}
-	
-	@ApiOperation(value="强制下线", notes="强制下线")
-	@RequestMapping(value = "/forcedOffline/{id}", method = RequestMethod.POST)
-	public Response forcedOffline(@PathVariable int id) {
-		mgrUserService.forcedOffline(id);
-		return Response.ok();
-	}
 
 	@ApiOperation(value="注销", notes="注销")
 	@RequestMapping(value = "/cancellation/{userId}", method = RequestMethod.GET)
-	public Response cancellationUser(@PathVariable int userId) {
-		mgrUserService.cancellationUser(userId);
+	public Response delete(@PathVariable int userId) {
+		mgrUserService.delete(userId);
 		return Response.ok();
 	}
-	
-	@ApiOperation(value="操作新增", notes="操作新增")
-	@RequestMapping(value = "/operationRecord", method = RequestMethod.POST)
-	public Response saveOperationRecord(@RequestBody OperationRecordHistory operationRecordHistory) {
-		Subject subject = SecurityUtils.getSubject();
-		if(!subject.isAuthenticated()) {
-			return Response.fail(Constant.CODE_UNKNOWN, Constant.RET_UNKNOWN);
-		}
-		String token = subject.getSession().getId().toString();
-		mgrUserService.saveOperationRecordHistory(operationRecordHistory, token);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="操作列表", notes="操作列表")
-	@RequestMapping(value = "/operationRecord/{currPage}/{pageSize}", method = RequestMethod.GET)
-	public Response operationRecordList(@PathVariable int currPage, @PathVariable int pageSize) {
-		List<OperationRecord> list = mgrUserService.operationRecordList(currPage, pageSize);
-		Map<String, Object> result = new HashMap<String, Object>();
-		result.put("dataList", list);
-		result.put("totalCount", mgrUserService.operationRecordList().size());
-		return Response.ok(result);
-	}
 
 	@ApiOperation(value="获取用户信息", notes="获取用户信息")
 	@RequestMapping(value = "/userContext", method = RequestMethod.GET)
 	public Response userInfo() {
-
 		return Response.ok(ContextUtils.getUserContext());
-
 	}
 
 	@ApiOperation(value="获取组织列表", notes="获取组织列表")
 	@RequestMapping(value = "/userContext/organization", method = RequestMethod.GET)
 	public Response listOrganization() {
-
 		UserContext userContext = ContextUtils.getUserContext();
 		return Response.ok(userContext.getOrganizationList());
-		
 	}
 
 	@ApiOperation(value="切换组织", notes="切换组织")
 	@RequestMapping(value = "/userContext/organization", method = RequestMethod.POST)
 	public Response saveLastOrganization(@RequestBody MgrOrganization organization) {
-
 		Subject subject = SecurityUtils.getSubject();
 		if(!subject.isAuthenticated()) {
 			return Response.fail(Constant.CODE_AUTH_FAILED, Constant.RET_AUTH_FAILED);
-		}		
-
+		}
 		if(organization == null) {
 			return Response.fail(Constant.CODE_BAD_REQUEST, Constant.RET_BAD_REQUEST);
 		}
@@ -118,33 +126,25 @@ public class UserContextController {
 				break;
 			}
 		}
-		
 		if(found == false) {
 			return Response.fail(Constant.CODE_BAD_REQUEST, Constant.RET_ORG_FAILED);
 		}
-		
 		mgrUserService.switchOrganization(user, organization);
 		mgrUserService.loadContext(subject);
-		
 		return Response.ok(ContextUtils.getUserContext());
-		
 	}
 
 	@ApiOperation(value = "切换项目", notes = "切换项目")
 	@RequestMapping(value = "/userContext/project/{projectId}", method = RequestMethod.PUT)
 	public Response saveLastProject(@PathVariable long projectId) {
-
 		Subject subject = SecurityUtils.getSubject();
 		if (!subject.isAuthenticated()) {
 			return Response.fail(Constant.CODE_AUTH_FAILED, Constant.RET_AUTH_FAILED);
 		}
 		MgrUser user = ContextUtils.getCurrentUser();
-		
 		mgrUserService.switchProject(user, projectId);
 		mgrUserService.loadContext(subject);
-		
 		return Response.ok(ContextUtils.getUserContext());
-
 	}
 
 }

+ 0 - 14
virgo.core/src/main/java/com/bosshand/virgo/core/dao/AppUserTokenDao.java

@@ -1,14 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.AppUserToken;
-
-@Mapper
-public interface AppUserTokenDao {
-	
-	public int insert(AppUserToken appUserToken);
-
-	public AppUserToken getByUserId(long userId);
-
-}

+ 1 - 15
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrUserDao.java

@@ -11,9 +11,7 @@ import java.util.Map;
 public interface MgrUserDao {
 	
 	public MgrUser getById(long id);
-	
-	public MgrUser getByUserName(String userName);
-	
+
 	public MgrUser getByPhone(String phone);
 	
 	public int update(MgrUser user);
@@ -22,34 +20,22 @@ public interface MgrUserDao {
 
 	public int updateLastProjectId(MgrUser user);
 
-	public MgrUser getByLoginName(String loginName);
-
 	public MgrUser getUserByPhone(String Phone);
 
 	public int insert(MgrUser user);
 
-	public int updatePassword(MgrUser user);
-
 	public int updatePhone(MgrUser user);
 
-	public int updateResource(String resource, String comment, List<Long> userIds);
-
 	public int banUser(long id, int status);
 
 	public int delete(long id);
 
 	public int checkFace(long id);
 
-	public int deleteByRoleId(long roleId);
-
 	public List<MgrUser> getList(Map<String, Object> map);
 
 	public int getTotalCount(Map<String, Object> map);
 
-	public List<MgrUser> getRoleId(long roleId);
-
-	public List<MgrUser> getRoleIds(List<Long> roleIds);
-
 	public List<MgrUser> getIds(List<Long> ids);
 
 	public List<MgrUser> getUserByOrganizationId(long organizationId);

+ 0 - 22
virgo.core/src/main/java/com/bosshand/virgo/core/dao/OperationRecordDao.java

@@ -1,22 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.OperationRecord;
-
-@Mapper
-public interface OperationRecordDao {
-
-	public int insert(OperationRecord operationRecord);
-
-	public List<OperationRecord> getList();
-
-	public int delete(int id);
-
-	public OperationRecord getId(int id);
-	
-	public OperationRecord getByToken(String token);
-
-}

+ 0 - 14
virgo.core/src/main/java/com/bosshand/virgo/core/dao/OperationRecordHistoryDao.java

@@ -1,14 +0,0 @@
-package com.bosshand.virgo.core.dao;
-
-import org.apache.ibatis.annotations.Mapper;
-
-import com.bosshand.virgo.core.model.OperationRecordHistory;
-
-@Mapper
-public interface OperationRecordHistoryDao {
-
-	public int insert(OperationRecordHistory operationRecordHistory);
-
-	public int deleteByOperationRecordId(int id);
-
-}

+ 0 - 70
virgo.core/src/main/java/com/bosshand/virgo/core/model/AppUserToken.java

@@ -1,70 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-public class AppUserToken {
-
-	private long id;
-
-	private long userId;
-
-	private String equip;
-
-	private String cid;
-
-	private String tokenId;
-	
-	@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	private Date loginDate;
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public long getUserId() {
-		return userId;
-	}
-
-	public void setUserId(long userId) {
-		this.userId = userId;
-	}
-
-	public String getEquip() {
-		return equip;
-	}
-
-	public void setEquip(String equip) {
-		this.equip = equip;
-	}
-
-	public String getCid() {
-		return cid;
-	}
-
-	public void setCid(String cid) {
-		this.cid = cid;
-	}
-
-	public String getTokenId() {
-		return tokenId;
-	}
-
-	public void setTokenId(String tokenId) {
-		this.tokenId = tokenId;
-	}
-
-	public Date getLoginDate() {
-		return loginDate;
-	}
-
-	public void setLoginDate(Date loginDate) {
-		this.loginDate = loginDate;
-	}
-
-}

+ 65 - 156
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrUser.java

@@ -9,9 +9,7 @@ public class MgrUser implements BaseModel {
 
 	private long id;
 
-	private String loginName;
-
-	private String pwd;
+	private String portrait;
 
 	private String name;
 
@@ -21,12 +19,8 @@ public class MgrUser implements BaseModel {
 
 	private String email;
 
-	private String portrait;
-
 	private Date createTime;
-	
-	private Date updateTime;
-	
+
 	private String rsonalSignature;
 	
 	private String idCard;
@@ -36,92 +30,26 @@ public class MgrUser implements BaseModel {
 	private String practiceSeal;
 	
 	private int status;
-	
+
+	private String face;
+
+	private int faceStatus;
+
+	private long lastProjectId;
+
 	private long lastOrganizationId;
 
 	private MgrOrganization mgrOrganization;
-	
-	private long lastProjectId;
-	
+
 	private List<MgrOrganization> organizationList;
-	
-	private String face;
-	
-	private int faceStatus;
+
+	private String organizationTypeRoles;
 	
 	private String menus;
 	
 	private String resources;
 	
 	private String roles;
-	
-	private String organizationTypeRoles;
-
-	private String pcode;
-
-	private long lastOperateOrganizationId;
-
-	private long lastOperateProjectId;
-
-	private int mark1;
-
-	private int mark2;
-
-	public long getLastOperateOrganizationId() {
-		return lastOperateOrganizationId;
-	}
-
-	public void setLastOperateOrganizationId(long lastOperateOrganizationId) {
-		this.lastOperateOrganizationId = lastOperateOrganizationId;
-	}
-
-	public long getLastOperateProjectId() {
-		return lastOperateProjectId;
-	}
-
-	public void setLastOperateProjectId(long lastOperateProjectId) {
-		this.lastOperateProjectId = lastOperateProjectId;
-	}
-
-	public int getMark1() {
-		return mark1;
-	}
-
-	public void setMark1(int mark1) {
-		this.mark1 = mark1;
-	}
-
-	public int getMark2() {
-		return mark2;
-	}
-
-	public void setMark2(int mark2) {
-		this.mark2 = mark2;
-	}
-
-	public String getPcode() {
-		return pcode;
-	}
-
-	public void setPcode(String pcode) {
-		this.pcode = pcode;
-	}
-
-	public String getOrganizationTypeRoles() {
-		return organizationTypeRoles;
-	}
-
-	public void setOrganizationTypeRoles(String organizationTypeRoles) {
-		this.organizationTypeRoles = organizationTypeRoles;
-	}
-
-	public String getRoles() {
-		return roles;
-	}
-
-	public void setRoles(String roles) {
-		this.roles = roles;
-	}
 
 	public long getId() {
 		return id;
@@ -131,20 +59,12 @@ public class MgrUser implements BaseModel {
 		this.id = id;
 	}
 
-	public String getLoginName() {
-		return loginName;
-	}
-
-	public void setLoginName(String loginName) {
-		this.loginName = loginName;
-	}
-
-	public String getPwd() {
-		return pwd;
+	public String getPortrait() {
+		return portrait;
 	}
 
-	public void setPwd(String pwd) {
-		this.pwd = pwd;
+	public void setPortrait(String portrait) {
+		this.portrait = portrait;
 	}
 
 	public String getName() {
@@ -179,14 +99,6 @@ public class MgrUser implements BaseModel {
 		this.email = email;
 	}
 
-	public String getPortrait() {
-		return portrait;
-	}
-
-	public void setPortrait(String portrait) {
-		this.portrait = portrait;
-	}
-
 	public Date getCreateTime() {
 		return createTime;
 	}
@@ -195,6 +107,38 @@ public class MgrUser implements BaseModel {
 		this.createTime = createTime;
 	}
 
+	public String getRsonalSignature() {
+		return rsonalSignature;
+	}
+
+	public void setRsonalSignature(String rsonalSignature) {
+		this.rsonalSignature = rsonalSignature;
+	}
+
+	public String getIdCard() {
+		return idCard;
+	}
+
+	public void setIdCard(String idCard) {
+		this.idCard = idCard;
+	}
+
+	public String getPracticeCertificate() {
+		return practiceCertificate;
+	}
+
+	public void setPracticeCertificate(String practiceCertificate) {
+		this.practiceCertificate = practiceCertificate;
+	}
+
+	public String getPracticeSeal() {
+		return practiceSeal;
+	}
+
+	public void setPracticeSeal(String practiceSeal) {
+		this.practiceSeal = practiceSeal;
+	}
+
 	public int getStatus() {
 		return status;
 	}
@@ -202,7 +146,7 @@ public class MgrUser implements BaseModel {
 	public void setStatus(int status) {
 		this.status = status;
 	}
-	
+
 	public String getFace() {
 		return face;
 	}
@@ -219,6 +163,14 @@ public class MgrUser implements BaseModel {
 		this.faceStatus = faceStatus;
 	}
 
+	public long getLastProjectId() {
+		return lastProjectId;
+	}
+
+	public void setLastProjectId(long lastProjectId) {
+		this.lastProjectId = lastProjectId;
+	}
+
 	public long getLastOrganizationId() {
 		return lastOrganizationId;
 	}
@@ -235,14 +187,6 @@ public class MgrUser implements BaseModel {
 		this.mgrOrganization = mgrOrganization;
 	}
 
-	public long getLastProjectId() {
-		return lastProjectId;
-	}
-
-	public void setLastProjectId(long lastProjectId) {
-		this.lastProjectId = lastProjectId;
-	}
-
 	public List<MgrOrganization> getOrganizationList() {
 		return organizationList;
 	}
@@ -251,12 +195,12 @@ public class MgrUser implements BaseModel {
 		this.organizationList = organizationList;
 	}
 
-	public Date getUpdateTime() {
-		return updateTime;
+	public String getOrganizationTypeRoles() {
+		return organizationTypeRoles;
 	}
 
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
+	public void setOrganizationTypeRoles(String organizationTypeRoles) {
+		this.organizationTypeRoles = organizationTypeRoles;
 	}
 
 	public String getMenus() {
@@ -275,46 +219,11 @@ public class MgrUser implements BaseModel {
 		this.resources = resources;
 	}
 
-	public String getRsonalSignature() {
-		return rsonalSignature;
-	}
-
-	public void setRsonalSignature(String rsonalSignature) {
-		this.rsonalSignature = rsonalSignature;
-	}
-
-	public String getIdCard() {
-		return idCard;
-	}
-
-	public void setIdCard(String idCard) {
-		this.idCard = idCard;
-	}
-
-	public String getPracticeCertificate() {
-		return practiceCertificate;
-	}
-
-	public void setPracticeCertificate(String practiceCertificate) {
-		this.practiceCertificate = practiceCertificate;
-	}
-
-	public String getPracticeSeal() {
-		return practiceSeal;
-	}
-
-	public void setPracticeSeal(String practiceSeal) {
-		this.practiceSeal = practiceSeal;
+	public String getRoles() {
+		return roles;
 	}
 
-	@Override
-	public String toString() {
-		return "MgrUser [id=" + id + ", loginName=" + loginName + ", pwd=" + pwd + ", name=" + name + ", sex=" + sex
-				+ ", phone=" + phone + ", email=" + email + ", portrait=" + portrait + ", createTime=" + createTime
-				+ ", updateTime=" + updateTime + ", status=" + status + ", lastOrganizationId=" + lastOrganizationId
-				+ ", lastProjectId=" + lastProjectId + ", organizationList=" + organizationList + ", face=" + face
-				+ ", faceStatus=" + faceStatus + "]";
+	public void setRoles(String roles) {
+		this.roles = roles;
 	}
-
-
 }

+ 0 - 78
virgo.core/src/main/java/com/bosshand/virgo/core/model/OperationRecord.java

@@ -1,78 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-import java.util.Date;
-import java.util.List;
-
-public class OperationRecord {
-
-	private int id;
-
-	private Date date;
-
-	private String token;
-
-	private String name;
-
-	private String ip;
-
-	private String equipment;
-	
-	private List<OperationRecordHistory>  operationRecordHistoryList;
-	
-	public int getId() {
-		return id;
-	}
-
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	public Date getDate() {
-		return date;
-	}
-
-	public void setDate(Date date) {
-		this.date = date;
-	}
-
-	public String getToken() {
-		return token;
-	}
-
-	public void setToken(String token) {
-		this.token = token;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getIp() {
-		return ip;
-	}
-
-	public void setIp(String ip) {
-		this.ip = ip;
-	}
-
-	public String getEquipment() {
-		return equipment;
-	}
-
-	public void setEquipment(String equipment) {
-		this.equipment = equipment;
-	}
-
-	public List<OperationRecordHistory> getOperationRecordHistoryList() {
-		return operationRecordHistoryList;
-	}
-
-	public void setOperationRecordHistoryList(List<OperationRecordHistory> operationRecordHistoryList) {
-		this.operationRecordHistoryList = operationRecordHistoryList;
-	}
-
-}

+ 0 - 35
virgo.core/src/main/java/com/bosshand/virgo/core/model/OperationRecordHistory.java

@@ -1,35 +0,0 @@
-package com.bosshand.virgo.core.model;
-
-public class OperationRecordHistory {
-
-	int id;
-
-	int operationRecordId;
-
-	String data;
-
-	public int getId() {
-		return id;
-	}
-
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	public int getOperationRecordId() {
-		return operationRecordId;
-	}
-
-	public void setOperationRecordId(int operationRecordId) {
-		this.operationRecordId = operationRecordId;
-	}
-
-	public String getData() {
-		return data;
-	}
-
-	public void setData(String data) {
-		this.data = data;
-	}
-
-}

+ 11 - 29
virgo.core/src/main/java/com/bosshand/virgo/core/model/UserContext.java

@@ -236,17 +236,9 @@ public class UserContext implements BaseModel{
 		this.practiceSeal = practiceSeal;
 	}
 
-	@Override
-	public String toString() {
-		return "UserContext [userId=" + userId + ", userName=" + userName + ", roleList=" + roleList
-				+ ", organizationId=" + organizationId + ", organization=" + organization + ", resource=" + resource
-				+ ", menu=" + menu + ", admin=" + admin + "]";
-	}
-	
 	public static UserContext getUserContext(MgrUser user) {
-		if(user!=null) {
+		if (user != null) {
 			UserContext flowUser = new UserContext();
-			
 			flowUser.setUserId(user.getId());
 			flowUser.setUserName(user.getName());
 			flowUser.setEmail(user.getEmail());
@@ -258,21 +250,17 @@ public class UserContext implements BaseModel{
 			flowUser.setIdCard(user.getIdCard());
 			flowUser.setPracticeCertificate(user.getPracticeCertificate());
 			flowUser.setPracticeSeal(user.getPracticeSeal());
-			
 			return flowUser;
 		}
-		
-		return null;		
+		return null;
 	}
-	
-	public static UserContext getUserContext(MgrUser user, List<MgrOrganization> organizationList, MgrOrganization currentOrganization, MgrUserRole userRole, List<MgrRoleCode> roleList, List<MgrOrganizationTypeRole> organizationTypeRoles) {
-		
-		if(user!=null) {
+
+	public static UserContext getUserContext(MgrUser user, List<MgrOrganization> organizationList, MgrOrganization currentOrganization,
+											 MgrUserRole userRole, List<MgrRoleCode> roleList, List<MgrOrganizationTypeRole> organizationTypeRoles) {
+		if (user != null) {
 			UserContext flowUser = new UserContext();
-			
 			flowUser.setUserId(user.getId());
 			flowUser.setUserName(user.getName());
-
 			flowUser.setEmail(user.getEmail());
 			flowUser.setPhone(user.getPhone());
 			flowUser.setPortrait(user.getPortrait());
@@ -282,30 +270,24 @@ public class UserContext implements BaseModel{
 			flowUser.setIdCard(user.getIdCard());
 			flowUser.setPracticeCertificate(user.getPracticeCertificate());
 			flowUser.setPracticeSeal(user.getPracticeSeal());
-			
 			flowUser.setProjectId(user.getLastProjectId());
-			
 			flowUser.setOrganizationList(organizationList);
-			if(currentOrganization != null ) {
-				flowUser.setOrganizationId(currentOrganization.getId());				
-			}else {
+			if (currentOrganization != null) {
+				flowUser.setOrganizationId(currentOrganization.getId());
+			} else {
 				flowUser.setOrganizationId(-1);
 			}
 			flowUser.setOrganization(currentOrganization);
-			
-			if(userRole != null) {
+			if (userRole != null) {
 				flowUser.setAdmin(userRole.isAdmin());
 				flowUser.setMenu(userRole.getMenus());
-				flowUser.setResource(userRole.getResources());			
+				flowUser.setResource(userRole.getResources());
 			}
-			
 			flowUser.setUserRole(userRole);
-			
 			flowUser.setRoleList(roleList);
 			flowUser.setOrganizationTypeRoles(organizationTypeRoles);
 			return flowUser;
 		}
-		
 		return null;
 	}
 	

+ 59 - 119
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -3,19 +3,17 @@ package com.bosshand.virgo.core.service;
 import com.alibaba.druid.util.StringUtils;
 import com.bosshand.virgo.core.dao.*;
 import com.bosshand.virgo.core.model.*;
+import com.bosshand.virgo.core.utils.Utils;
 import com.bosshand.virgo.exception.Constant;
 import com.bosshand.virgo.exception.ServiceException;
 import org.apache.shiro.subject.Subject;
-import org.crazycake.shiro.IRedisManager;
-import org.crazycake.shiro.RedisSessionDAO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
+import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -42,46 +40,58 @@ public class MgrUserService {
 	
 	@Autowired
 	private MgrOrganizationTypeRoleDao mgrOrganizationTypeRoleDao;
-	
-	@Autowired
-	private OperationRecordDao operationRecordDao;
-	
-	@Autowired
-	private OperationRecordHistoryDao operationRecordHistoryDao;
-	
-	@Autowired
-	private RedisSessionDAO redisSessionDAO;
-	
-	@Autowired
-	private AppUserTokenDao appUserTokenDao;
 
 	static Logger log = LoggerFactory.getLogger(MgrUserService.class);
-	
-	public MgrUser getById(long id) {
-	
-		return mgrUserDao.getById(id);
+
+	public void delete(int userId) {
+		mgrUserDao.delete(userId);
 	}
-	public MgrUser getByUserNameOrPhone(String userName) {
-		MgrUser user = mgrUserDao.getByUserName(userName);
-		if(user == null) {
-			user = mgrUserDao.getByPhone(userName);
+
+	@Transactional
+	public void register(MgrUser user, long typeId) {
+		MgrOrganizationType type = mgrOrganizationTypeDao.get(typeId);
+		if (type == null) {
+			throw new ServiceException("Organization Type not found", Constant.RET_BAD_REQUEST);
 		}
-		return user;
-		
+		MgrOrganization mgrOrganization = new MgrOrganization();
+		mgrOrganization.setMgrOrganizationTypeId(typeId);
+		mgrOrganization.setMgrOrganizationTypeName(type.getName());
+		mgrOrganization.setName(null);
+		mgrOrganization.setRegisteDate(new Date());
+		mgrOrganization.setContact(user.getName());
+		mgrOrganization.setContactTel(user.getPhone());
+		mgrOrganization.setOrganizationCode(Utils.getPinYinHeadChar(type.getName() + Utils.random(8)));
+		mgrOrganizationDao.insert(mgrOrganization);
+
+		user.setLastOrganizationId(mgrOrganization.getId());
+
+		long userId = 0;
+
+		MgrUser us = mgrUserDao.getByPhone(user.getPhone());
+		if (us != null) {
+			us.setLastOrganizationId(mgrOrganization.getId());
+			mgrUserDao.updateLastOrganizationId(us);
+			userId = us.getId();
+		} else {
+			mgrUserDao.insert(user);
+			userId = user.getId();
+		}
+
+		MgrUserRole userRole = new MgrUserRole();
+		userRole.setAdmin(true);
+		userRole.setOrganizationId(mgrOrganization.getId());
+		userRole.setUserId(userId);
+		mgrUserRoleDao.insert(userRole);
 	}
 	
-	public MgrUser getByUserName(String userName) {
-		return mgrUserDao.getByUserName(userName);
+	public MgrUser getById(long id) {
+		return mgrUserDao.getById(id);
 	}
-	
+
 	public MgrUser getByPhone(String phone) {
 		return mgrUserDao.getByPhone(phone);
 	}
-	
-	public MgrOrganization getOrganization(long organizationId) {
-		return mgrOrganizationDao.getById(organizationId);
-	}
-	
+
 	public MgrOrganization getLastOrganization(MgrUser user) {
 		if(user == null || user.getLastOrganizationId() == -1) {
 			return null;
@@ -90,7 +100,6 @@ public class MgrUserService {
 	}
 	
 	public List<MgrOrganization> getOrganizationList(MgrUser user){
-
 		if(this.isSupperAdmin(user)) {
 			return mgrOrganizationDao.listAll();
 		}
@@ -98,19 +107,14 @@ public class MgrUserService {
 		List<MgrUserRole> userRoleList = getUserRoles(user);
 		List<Long> ids = new LinkedList<Long>();
 		userRoleList.forEach(r -> ids.add(r.getOrganizationId()));
-			
 		return mgrOrganizationDao.listByIds(ids);
-		
 	}
 	
 	public List<MgrUserRole> getUserRoles(MgrUser user){
-		
 		List<MgrUserRole> roleList = new LinkedList<MgrUserRole>();
-		
 		if(user != null ) {			
 			return mgrUserRoleDao.getUserRoles(user.getId());
 		}
-		
 		return roleList;
 	} 
 	
@@ -120,39 +124,31 @@ public class MgrUserService {
 	}
 	
 	public boolean isAdmin(MgrUser user, long organizationId) {
-		
 		MgrUserRole userRole = getUserRole(user, organizationId);
 		if(userRole == null) {
 			return false;
 		}
-		
 		return userRole.isAdmin();
 	}
-	
+
 	public MgrUserRole getUserRole(MgrUser user, long organizationId) {
-		
 		List<MgrUserRole> userRoles = this.getUserRoles(user);
-		if(userRoles == null) {
-			return null;
-		}
-		
-		for(MgrUserRole userRole: userRoles) {
-			if(userRole.getOrganizationId() == organizationId) {
-				return userRole;
+		if (userRoles != null) {
+			for (MgrUserRole userRole : userRoles) {
+				if (userRole.getOrganizationId() == organizationId) {
+					return userRole;
+				}
 			}
-		}		
-		
+		}
 		return null;
 	}
-	
-	public List<MgrRoleCode> getRoleCodeList(MgrUserRole userRole){
-		
-		List<MgrRoleCode> roleCodeList = null;
-		if(userRole!=null && !StringUtils.isEmpty(userRole.getRoles())) {
+
+	public List<MgrRoleCode> getRoleCodeList(MgrUserRole userRole) {
+		if (userRole != null && !StringUtils.isEmpty(userRole.getRoles())) {
 			String[] roleIds = userRole.getRoles().split(",");
 			return mgrRoleCodeDao.getListByIds(roleIds);
 		}
-		return roleCodeList;
+		return null;
 	}
 	
 	public List<MgrOrganizationTypeRole> getOrganizationTypeRoleList(long organizationTypeId){
@@ -177,63 +173,16 @@ public class MgrUserService {
 		return mgrOrganizationTypeDao.getById(id);
 	}
 
-	@Transactional
-	public void forcedOffline(int id) {
-		OperationRecord operationRecord = operationRecordDao.getId(id);
-		StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
-		IRedisManager redisManager = redisSessionDAO.getRedisManager(); 
-		redisManager.del(stringRedisSerializer.serialize(redisSessionDAO.getKeyPrefix() + operationRecord.getToken()));
-		operationRecordDao.delete(id);
-		operationRecordHistoryDao.deleteByOperationRecordId(id);
-	}
-	
-	public void saveOperationRecordHistory(OperationRecordHistory operationRecordHistory, String token) {
-		OperationRecord operationRecord = operationRecordDao.getByToken(token);
-		if(operationRecord == null) {
-			throw new ServiceException("fail to get token", Constant.RET_UNKNOWN);
-		}
-		operationRecordHistory.setOperationRecordId(operationRecord.getId());
-		operationRecordHistoryDao.insert(operationRecordHistory);
-	}
-	
-	public List<OperationRecord> operationRecordList(int currentPage, int pageSize) {
-		List<OperationRecord> dataList = operationRecordDao.getList();
-		List<OperationRecord> currentPageList = new ArrayList<>();
-		if (dataList != null && dataList.size() > 0) {
-			int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
-			for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
-				OperationRecord data = dataList.get(currIdx + i);
-				currentPageList.add(data);
-			}
-		}
-		return currentPageList;
-	}
-	
-	public List<OperationRecord> operationRecordList() {
-		return operationRecordDao.getList();
-	}
-	
-	public void saveOperationRecord(String equipment, String ip, Subject subject) {
-		OperationRecord operationRecord = new OperationRecord();
-		operationRecord.setEquipment(equipment);
-		operationRecord.setIp(ip);
-		operationRecord.setToken(subject.getSession().getId().toString());
-		operationRecord.setName(this.getByUserNameOrPhone(subject.getPrincipal().toString()).getPhone());
-		operationRecordDao.insert(operationRecord);
-	}
-	
 	//store user context into session. This is not good place to put those code.
 	public void loadContext(Subject subject) {
-
     	if(subject == null) {
     		throw new ServiceException("fail to get subject", Constant.RET_NO_SPECIFIC_USER);
     	}
-    	
-    	MgrUser user = this.getByUserNameOrPhone(subject.getPrincipal().toString());
+    	MgrUser user = this.getByPhone(subject.getPrincipal().toString());
     	if(user == null) {
     		throw new ServiceException("fail to get user", Constant.RET_NO_SPECIFIC_USER);
     	}
-    	
+
     	//process organization
     	List<MgrOrganization> organizationList = getOrganizationList(user);
     	user.setOrganizationList(organizationList);
@@ -245,7 +194,7 @@ public class MgrUserService {
     			currentOrganization = null;
     		}
     	}
-    	
+
     	//load first organization in list if no organization loaded.
     	if(currentOrganization == null) {
     		//Load the first organization default. 
@@ -296,18 +245,9 @@ public class MgrUserService {
     	subject.getSession().setTimeout(25920000000L);
     	subject.getSession().setAttribute("USER",user);
     	
-    	UserContext context = UserContext.getUserContext(user, organizationList,  currentOrganization, currentUserRole, roleCodeList, organizationTypeRoles);
+    	UserContext context = UserContext.getUserContext(user, organizationList, currentOrganization, currentUserRole, roleCodeList, organizationTypeRoles);
     	subject.getSession().setAttribute("USERCONTEXT", context);
 		
 	}
 
-	//save login equip information
-	public void saveAppUserToken(AppUserToken appUserToken) {
-		appUserTokenDao.insert(appUserToken);
-	}
-
-	public void cancellationUser(int userId) {
-		mgrUserDao.delete(userId);
-	}
-
 }

+ 9 - 51
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/LoginUserDto.java

@@ -5,72 +5,30 @@ public class LoginUserDto {
 	private String phone;
 
 	private String phoneCode;
-	
-	private String name;
-	
-	private String password;
-	
-	private String cid;
-	
-	private String equip;
 
-	private Integer mk;
-
-	public Integer getMk() {
-		return mk;
-	}
-
-	public void setMk(Integer mk) {
-		this.mk = mk;
-	}
+	private long organizationTypeId;
 
 	public String getPhone() {
 		return phone;
 	}
 
-	public String getPhoneCode() {
-		return phoneCode;
-	}
-
-	public void setPhoneCode(String phoneCode) {
-		this.phoneCode = phoneCode;
-	}
-
 	public void setPhone(String phone) {
 		this.phone = phone;
 	}
 
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getPassword() {
-		return password;
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	public String getCid() {
-		return cid;
+	public String getPhoneCode() {
+		return phoneCode;
 	}
 
-	public void setCid(String cid) {
-		this.cid = cid;
+	public void setPhoneCode(String phoneCode) {
+		this.phoneCode = phoneCode;
 	}
 
-	public String getEquip() {
-		return equip;
+	public long getOrganizationTypeId() {
+		return organizationTypeId;
 	}
 
-	public void setEquip(String equip) {
-		this.equip = equip;
+	public void setOrganizationTypeId(long organizationTypeId) {
+		this.organizationTypeId = organizationTypeId;
 	}
-	
-	
 }

+ 5 - 4
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/UserRealm.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.core.shiro;
 
+import com.bosshand.virgo.core.utils.CodeCache;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
 import org.apache.shiro.authc.AuthenticationToken;
@@ -27,13 +28,13 @@ public class UserRealm extends AuthorizingRealm {
 	@Override
 	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken)throws AuthenticationException {
 		logger.warn("Identity Authentication");
-		String userName = authenticationToken.getPrincipal().toString();
+		String phone = authenticationToken.getPrincipal().toString();
 		
-		if (StringUtils.isEmpty(userName)) {
+		if (StringUtils.isEmpty(phone)) {
 			throw new AuthenticationException("token认证失败");
 		}
 		
-		MgrUser mgrUser = userService.getByUserNameOrPhone(userName);
+		MgrUser mgrUser = userService.getByPhone(phone);
 		
 		if (mgrUser == null) {
 			throw new AuthenticationException("该用户不存在");
@@ -43,7 +44,7 @@ public class UserRealm extends AuthorizingRealm {
 		if (mgrUser.getStatus() == 1) {
 			throw new AuthenticationException("该用户已被封号");
 		}
-		return new SimpleAuthenticationInfo(userName, mgrUser.getPwd().toUpperCase(), "UserRealm");
+		return new SimpleAuthenticationInfo(phone, CodeCache.getKey(phone), "UserRealm");
 	}
 
 	@Override

+ 40 - 79
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/VirgoAuthenticationFilter.java

@@ -1,11 +1,11 @@
 package com.bosshand.virgo.core.shiro;
+
 import com.alibaba.druid.util.StringUtils;
 import com.alibaba.fastjson.JSON;
-import com.bosshand.virgo.core.model.AppUserToken;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.response.Response;
 import com.bosshand.virgo.core.service.MgrUserService;
-import com.bosshand.virgo.core.utils.SecurityUtils;
+import com.bosshand.virgo.core.utils.CodeCache;
 import com.bosshand.virgo.exception.AuthException;
 import com.bosshand.virgo.exception.Constant;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -20,11 +20,9 @@ import org.springframework.http.HttpStatus;
 
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,138 +39,101 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 	public void setMgrUserService(MgrUserService mgrUserService) {
 		this.mgrUserService = mgrUserService;
 	}
-	
-	private String equip = null;
-
-	private String cid = null;
-
-	private void init(String equip, String cid) {
-		this.equip = equip;
-		this.cid = cid;
-	}
-	
-	private void release() {
-		this.equip = null;
-		this.cid = null;
-	}
 
 	@Override
 	protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
-		
-		String username  = null;
-		String password = null;
-		LoginUserDto  dto = null;
+		String phone = null;
+		String phoneCode = null;
+		LoginUserDto dto = null;
 		try {
-            BufferedReader streamReader = new BufferedReader( new InputStreamReader(request.getInputStream(), "UTF-8"));
-            StringBuilder responseStrBuilder = new StringBuilder();
-            String inputStr = null;
-            while ((inputStr = streamReader.readLine()) != null) {
-                responseStrBuilder.append(inputStr);
-            }
-            
-            if(StringUtils.isEmpty(responseStrBuilder.toString())) {
-            	throw new AuthException("Incorrect user", Constant.RET_AUTH_FAILED);
-            }
-            
-        	ObjectMapper om = new ObjectMapper();
-        	dto =  om.readValue(responseStrBuilder.toString(),  LoginUserDto.class);
+			BufferedReader streamReader = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
+			StringBuilder responseStrBuilder = new StringBuilder();
+			String inputStr = null;
+			while ((inputStr = streamReader.readLine()) != null) {
+				responseStrBuilder.append(inputStr);
+			}
+			if (StringUtils.isEmpty(responseStrBuilder.toString())) {
+				throw new AuthException("Incorrect user", Constant.RET_AUTH_FAILED);
+			}
+			ObjectMapper om = new ObjectMapper();
+			dto = om.readValue(responseStrBuilder.toString(), LoginUserDto.class);
+
+			if (CodeCache.superAdminPhone.equals(dto.getPhone())) {
+				CodeCache.setKey(dto.getPhone(), CodeCache.superAdminPhoneCode);
+				return createToken(dto.getPhone(), CodeCache.superAdminPhoneCode, request, response);
+			}
 
-			if (dto.getPhone() != null & dto.getPhoneCode() != null) {
-				MgrUser byPhone = mgrUserService.getByPhone(dto.getPhone());
-				if (dto.getPhoneCode().equals(byPhone.getPcode())) {
-					MgrUser us = mgrUserService.getByUserNameOrPhone(dto.getPhone());
-					username = us.getPhone();
-					password = us.getPwd();
+			String code = CodeCache.getKey(dto.getPhone());
+
+			MgrUser user = mgrUserService.getByPhone(dto.getPhone());
+			if (user != null) {
+				if (dto.getPhoneCode().equals(code)) {
+					phone = user.getPhone();
+					phoneCode = code;
 				}
 			} else {
-				username = dto.getName();
-				password = SecurityUtils.MD5LoginSecu(dto.getPassword().getBytes());
+				//注册
+				MgrUser u = new MgrUser();
+				u.setPhone(dto.getPhone());
+				mgrUserService.register(u, dto.getOrganizationTypeId());
+				phone = dto.getPhone();
+				phoneCode = code;
 			}
-
-        	if(dto.getEquip() != null) {
-        		init(dto.getEquip(), dto.getCid());
-        	}
 		} catch (Exception e) {
-			log.error("Can not create token",e);
+			log.error("Can not create token", e);
 			throw new AuthException("Can not create token", Constant.RET_INVALID_PASSWORD, e);
-        }
-        
-		return createToken( username , password, request, response);
-        
+		}
+		return createToken(phone, phoneCode, request, response);
 	}
 	
 	@Override
-    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject,
-            ServletRequest request, ServletResponse response) throws Exception {
-        
+    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
 		if (isLoginRequest(request, response)) {
-
 			mgrUserService.loadContext(subject);
-
         	Map<String,String> map = new HashMap<String,String>();
         	map.put("token", subject.getSession().getId().toString());
         	response.getWriter().write(JSON.toJSONString(Response.ok(map)));
-        	mgrUserService.saveOperationRecord(((HttpServletRequest) request).getHeader("user-agent"), ((HttpServletRequest) request).getHeader("x-real-ip"), subject);
-        	if (this.equip != null) {
-    			AppUserToken appUserToken = new AppUserToken();
-    			appUserToken.setUserId(mgrUserService.getByUserNameOrPhone(subject.getPrincipal().toString()).getId());
-    			appUserToken.setCid(this.cid);
-    			appUserToken.setEquip(this.equip);
-    			appUserToken.setTokenId(map.get("token"));
-    			appUserToken.setLoginDate(new Date());
-    			mgrUserService.saveAppUserToken(appUserToken);
-    			release();
-    		}
 		}
-        
 		return false;
-	
 	}
 
 	@Override
-    protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e,
-            ServletRequest request, ServletResponse response) {
+    protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {
     	log.error("failed to login.", e);
     	WebUtils.toHttp(response).setStatus(HttpStatus.OK.value());
     	Response r = Response.fail(Constant.CODE_AUTH_FAILED, Constant.RET_INVALID_PASSWORD);
-
     	try {
 			WebUtils.toHttp(response).getWriter().write(JSON.toJSONString(r));
 		} catch (IOException e1) {
 			throw new AuthException("Fail to login.", Constant.RET_INVALID_PASSWORD, e);
 		}
-    	
     	return false;
 	}
 
 	@Override
 	protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
-		
         if (isLoginRequest(request, response)) {
         	return executeLogin(request, response);
         } else {
         	WebUtils.toHttp(response).setStatus(HttpStatus.OK.value());
         	Response r = Response.fail(Constant.CODE_AUTH_FAILED, Constant.RET_AUTH_FAILED);
-
         	try {
     			WebUtils.toHttp(response).getWriter().write(JSON.toJSONString(r));
     		} catch (IOException e1) {
     			throw new AuthException(e1.getMessage(), Constant.RET_AUTH_FAILED, e1);
     		}
-        	
         	return false;
         }
 	}
 	
     @Override
     protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
-    	
     	//login out when access login url;
     	if (isLoginRequest(request, response)) {
             Subject subject = getSubject(request, response);
             subject.logout();
     	}
-    	
         return super.isAccessAllowed(request, response, mappedValue);
     }
+
 }

+ 50 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/utils/CodeCache.java

@@ -0,0 +1,50 @@
+package com.bosshand.virgo.core.utils;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.TimeUnit;
+
+public class CodeCache {
+
+    public static final String superAdminPhone = "18888888888";
+
+    public static final String superAdminPhoneCode = "888888";
+
+    private static Logger logger = LoggerFactory.getLogger(CodeCache.class);
+
+    private static LoadingCache<String, String> localCache =
+            CacheBuilder.newBuilder().
+                    initialCapacity(1000).
+                    maximumSize(10000).
+                    expireAfterAccess(15, TimeUnit.MINUTES).
+                    build(new CacheLoader<String, String>() {
+                        // 默认的数据加载实现,当调用get取值的时候,如果key没有对应的值,就调用这个方法进行加
+                        @Override
+                        public String load(String s) throws Exception {
+                            return "null";
+                        }
+                    });
+
+    public static void setKey(String key, String value) {
+        localCache.put(key, value);
+    }
+
+    public static String getKey(String key) {
+        String value = null;
+        try {
+            value = localCache.get(key);
+            if ("null".equals(value)) {
+                return null;
+            }
+            return value;
+        } catch (Exception e) {
+            logger.error("localCache get error", e);
+        }
+        return null;
+    }
+
+}

+ 3 - 6
virgo.manager/src/main/java/com/bosshand/virgo/util/ImageUtil.java

@@ -1,8 +1,7 @@
-package com.bosshand.virgo.util;
+package com.bosshand.virgo.core.utils;
 
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics2D;
+import javax.imageio.ImageIO;
+import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
 import java.io.FileOutputStream;
@@ -11,8 +10,6 @@ import java.io.OutputStream;
 import java.util.Base64;
 import java.util.Random;
 
-import javax.imageio.ImageIO;
-
 public class ImageUtil {
 
 	// 图片的宽度。

+ 1 - 1
virgo.manager/src/main/java/com/bosshand/virgo/util/VerificationCodeUtils.java

@@ -1,4 +1,4 @@
-package com.bosshand.virgo.util;
+package com.bosshand.virgo.core.utils;
 
 import net.sf.json.JSONObject;
 

+ 0 - 22
virgo.core/src/main/resources/mapper/AppUserTokenMapper.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.bosshand.virgo.core.dao.AppUserTokenDao">
-	
-	<resultMap type="com.bosshand.virgo.core.model.AppUserToken" id="AppUserTokenResult">
-		<id column="id" property="id"/>
-		<result column="userId" property="userId"/>
-		<result column="equip" property="equip"/>
-		<result column="cid" property="cid"/>
-		<result column="tokenId" property="tokenId"/>
-		<result column="loginDate" property="loginDate"/>
-	</resultMap>
-
-	<select id="getByUserId" resultMap="AppUserTokenResult">
-		select * from app_user_token where userId = #{userId} order by id desc limit 1
-	</select>
-	
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.AppUserToken" useGeneratedKeys="true" keyProperty="id">
-		insert into app_user_token(userId, equip, cid, tokenId, loginDate) VALUES(#{userId}, #{equip}, #{cid}, #{tokenId}, now())
-	</insert>
-	
-</mapper>

+ 4 - 62
virgo.core/src/main/resources/mapper/MgrUserMapper.xml

@@ -6,12 +6,9 @@
 
 <resultMap type="com.bosshand.virgo.core.model.MgrUser" id="MgrUserResult" >
 	<id column="id" property="id"/>
-	<result column="login_name" property="loginName"/>	
-	<result column="pwd" property="pwd"/>	
 	<result column="name" property="name"/>	
 	<result column="sex" property="sex"/>	
-	<result column="phone" property="phone"/>	
-	<result column="pcode" property="pcode"/>
+	<result column="phone" property="phone"/>
 	<result column="email" property="email"/>
 	<result column="portrait" property="portrait"/>	
 	<result column="create_time" property="createTime"/>
@@ -22,20 +19,12 @@
 	<result column="status" property="status"/>		
 	<result column="lastOrganizationId" property="lastOrganizationId"/>
 	<result column="lastProjectId" property="lastProjectId"/>
-	<result column="lastOperateOrganizationId" property="lastOperateOrganizationId"/>
-	<result column="lastOperateProjectId" property="lastOperateProjectId"/>
-	<result column="mark1" property="mark1"/>
-	<result column="mark2" property="mark2"/>
 </resultMap>
 
 <select id="getById" resultMap="MgrUserResult">
 	 select * from mgr_user where id = #{id} limit 1
 </select>
 
-<select id="getByUserName" resultMap="MgrUserResult">
-	 select * from mgr_user where login_name = #{name} limit 1
-</select>
-
 <select id="getByPhone" resultMap="MgrUserResult">
 	 select * from mgr_user where phone = #{phone} limit 1
 </select>
@@ -52,41 +41,23 @@
 	UPDATE mgr_user
 		<trim prefix="set" suffixOverrides=",">
 			<if test="id!=0">id=#{id},</if>
-			<if test="loginName!=null">login_name=#{loginName},</if>
-			<if test="pwd!=null">pwd=#{pwd},</if>
 			<if test="name!=null">name=#{name},</if>
 			<if test="sex!=null">sex=#{sex},</if>
 			<if test="phone!=null">phone=#{phone},</if>
 			<if test="email!=null">email=#{email},</if>
 			<if test="portrait!=null">portrait=#{portrait},</if>
 			<if test="face!=null">face=#{face},</if>
-			<if test="faceStatus!=null">faceStatus=#{faceStatus},</if>
+			<if test="faceStatus!=0">faceStatus=#{faceStatus},</if>
 			<if test="lastOrganizationId!=null">lastOrganizationId=#{lastOrganizationId},</if>
 			<if test="lastProjectId!=null">lastProjectId=#{lastProjectId},</if>
-			<if test="lastOperateOrganizationId!=null">lastOperateOrganizationId=#{lastOperateOrganizationId},</if>
-			<if test="lastOperateProjectId!=null">lastOperateProjectId=#{lastOperateProjectId},</if>
 			<if test="rsonalSignature!=null">rsonal_signature=#{rsonalSignature},</if>
 			<if test="idCard!=null">id_card=#{idCard},</if>
 			<if test="practiceCertificate!=null">practice_certificate=#{practiceCertificate},</if>
 			<if test="practiceSeal!=null">practice_seal=#{practiceSeal},</if>
-			<if test="pcode!=null">pcode=#{pcode},</if>
-			<if test="mark2!=0">mark2=#{mark2},</if>
 		</trim>
 		WHERE id=#{id}
 </update>
 
-<select id="getRoleIds" parameterType="list" resultType="com.bosshand.virgo.core.model.MgrUser">
-	select * from mgr_user where role_id in (
-	<trim>
-		<if test="list.size > 0">
-			<foreach collection="list" item="item" index="index" separator=",">
-				#{item}
-			</foreach>
-		</if>
-	</trim>
-	)
-</select>
-
 <select id="getIds" parameterType="list" resultType="com.bosshand.virgo.core.model.MgrUser">
 	select * from mgr_user
 	<trim>
@@ -103,14 +74,6 @@
 	</trim>
 </select>
 
-<select id="getRoleId" resultType="com.bosshand.virgo.core.model.MgrUser">
-	SELECT id, login_name, portrait, name, sex, phone, email, organization_id, project_id, department_id, role_id, resource, comment, face, faceStatus FROM mgr_user where role_id=#{roleId}
-</select>
-
-<select id="getByLoginName" resultType="com.bosshand.virgo.core.model.MgrUser">
-	SELECT * FROM mgr_user where login_name=#{loginName}
-</select>
-
 <select id="getUserByPhone" resultType="com.bosshand.virgo.core.model.MgrUser">
 	SELECT * FROM mgr_user where phone=#{phone}
 </select>
@@ -153,17 +116,14 @@
 </select>
 
 <insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrUser" useGeneratedKeys="true" keyProperty="id">
-	INSERT into mgr_user(mark1,mark2,login_name, pwd, name, sex, phone, email, portrait, create_time, rsonal_signature, id_card, practice_certificate, practice_seal) values(#{mark1},#{mark2},#{loginName}, #{pwd}, #{name}, #{sex}, #{phone}, #{email}, #{portrait}, #{createTime}, #{rsonalSignature}, #{idCard}, #{practiceCertificate}, #{practiceSeal})
+	INSERT into mgr_user(name, sex, phone, email, portrait, create_time, rsonal_signature, id_card, practice_certificate, practice_seal, lastOrganizationId)
+	values(#{name}, #{sex}, #{phone}, #{email}, #{portrait}, #{createTime}, #{rsonalSignature}, #{idCard}, #{practiceCertificate}, #{practiceSeal}, #{lastOrganizationId})
 </insert>
 
 <delete id="delete">
 	DELETE from mgr_user where id = #{id}
 </delete>
 
-<delete id="deleteByRoleId">
-	DELETE from mgr_user where role_id = #{roleId}
-</delete>
-
 <update id="checkFace" parameterType="com.bosshand.virgo.core.model.MgrUser">
 	UPDATE mgr_user SET faceStatus = 1 where id =#{id}
 </update>
@@ -172,24 +132,6 @@
 	UPDATE mgr_user SET phone = #{phone} where id =#{id}
 </update>
 
-<update id="updatePassword" parameterType="com.bosshand.virgo.core.model.MgrUser">
-	UPDATE mgr_user
-	<trim prefix="set" suffixOverrides=",">
-		<if test="pwd!=null">pwd=#{pwd},</if>
-	</trim>
-	WHERE phone=#{phone}
-</update>
-
-<update id="updateResource">
-	UPDATE mgr_user
-	SET resource=#{resource}, comment=#{comment}
-	WHERE role_id != -1 and id in
-	<foreach collection="userIds" index="index" item="item"
-			 open="(" separator="," close=")">
-		#{item}
-	</foreach>
-</update>
-
 <update id="banUser" parameterType="com.bosshand.virgo.core.model.MgrUser">
 	UPDATE mgr_user set status = #{status} WHERE id=#{id}
 </update>

+ 0 - 21
virgo.core/src/main/resources/mapper/OperationRecordHistoryMapper.xml

@@ -1,21 +0,0 @@
-<!DOCTYPE mapper
-    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.bosshand.virgo.core.dao.OperationRecordHistoryDao">
-	
-	<resultMap type="com.bosshand.virgo.core.model.OperationRecordHistory" id="operationRecordHistoryResult">
-		<id column="id" property="id" />
-		<result column="operationRecordId" property="operationRecordId" />
-		<result column="data" property="data" />
-	</resultMap>
-	
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.OperationRecordHistory" useGeneratedKeys="true" keyProperty="id">
-		insert into operation_record_history(operationRecordId, data) values(#{operationRecordId}, #{data})
-	</insert>
-	
-	<delete id="deleteByOperationRecordId">
-		delete from operation_record_history where operationRecordId = #{operationRecordId}
-	</delete>
-
-</mapper>

+ 0 - 50
virgo.core/src/main/resources/mapper/OperationRecordMapper.xml

@@ -1,50 +0,0 @@
-<!DOCTYPE mapper
-    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.bosshand.virgo.core.dao.OperationRecordDao">
-	
-	<resultMap type="com.bosshand.virgo.core.model.OperationRecord" id="operationRecordResult">
-		<id column="id" property="id" />
-		<result column="date" property="date" />
-		<result column="token" property="token" />
-		<result column="ip" property="ip" />
-		<result column="equipment" property="equipment" />
-		<result column="name" property="name" />
-		<collection property="operationRecordHistoryList" ofType="com.bosshand.virgo.core.model.OperationRecordHistory" resultMap="com.bosshand.virgo.core.dao.OperationRecordHistoryDao.operationRecordHistoryResult" columnPrefix="operationRecordHistory_"/>
-	</resultMap>
-	
-	<resultMap type="com.bosshand.virgo.core.model.OperationRecord" id="result">
-		<id column="id" property="id" />
-		<result column="date" property="date" />
-		<result column="token" property="token" />
-		<result column="ip" property="ip" />
-		<result column="equipment" property="equipment" />
-		<result column="name" property="name" />
-	</resultMap>
-	
-	<select id="getList" resultMap="operationRecordResult">
-	 	select o.*,
-	 	orh.id as operationRecordHistory_id,
-		orh.data as operationRecordHistory_data,
-		orh.operationRecordId as operationRecordHistory_operationRecordId
-	 	from operation_record o left join operation_record_history orh on o.id = orh.operationRecordId order by o.date desc
-	</select>
-	
-	<select id="getByToken" resultMap="result">
-	 	select * from operation_record where token = #{token}
-	</select>
-	
-	<select id="getId" resultMap="result">
-	 	select * from operation_record where id = #{id}
-	</select>
-	
-	<delete id="delete">
-	 	delete from operation_record where id = #{id}
-	</delete>
-	
-	<insert id="insert" parameterType="com.bosshand.virgo.core.model.OperationRecord" useGeneratedKeys="true" keyProperty="id">
-		insert into operation_record(date, token, ip, equipment, name) values(now(), #{token}, #{ip}, #{equipment}, #{name})
-	</insert>
-
-</mapper>

+ 0 - 199
virgo.manager/src/main/java/com/bosshand/virgo/controller/RegisterController.java

@@ -1,199 +0,0 @@
-package com.bosshand.virgo.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.model.MgrUser;
-import com.bosshand.virgo.core.response.Response;
-import com.bosshand.virgo.service.UserService;
-import com.bosshand.virgo.util.ImageUtil;
-import com.bosshand.virgo.util.Security;
-import com.bosshand.virgo.util.VerificationCodeUtils;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-@RestController
-@RequestMapping("register")
-public class RegisterController {
-	
-	// TODO Replace with Redis
-	private Map<String, String> vCodeCache = new HashMap<String, String>();
-	private Map<String, String> pCodeCache = new HashMap<String, String>();
-	
-	@Autowired
-	UserService userService;
-
-	@ApiOperation(value="发送短信", notes="发送短信")
-	@RequestMapping(value = "/send/{phone}/{pCode}", method = RequestMethod.GET)
-	public Object getCode(@PathVariable String phone, @PathVariable String pCode) {
-		if (pCodeCache.containsKey("pCode")) {
-			if (!pCodeCache.get("pCode").equalsIgnoreCase(pCode)) {
-				return Response.fail(404, "图片验证码错误");
-			}
-		} else {
-			return Response.fail(404, "请再次刷新图片验证码");
-		}
-		Random random = new Random();
-		String result = "";
-		for (int i = 0; i < 6; i++) {
-			result += random.nextInt(10);
-		}
-		MgrUser userByPhone = userService.getUserByPhone(phone);
-		if(userByPhone != null){
-			userByPhone.setPcode(result);
-			userService.update(userByPhone);
-			VerificationCodeUtils.getRequest2(phone, "250112", result);
-			return Response.ok("发送成功!");
-		}
-		return Response.fail(200001, "手机号不存在!");
-
-	}
-
-	@ApiOperation(value="验证图片验证码", notes="验证图片验证码")
-	@RequestMapping(value = "/vCode/{phone}/{pCode}", method = RequestMethod.GET)
-	public Object getVerificationCode(@PathVariable String phone, @PathVariable String pCode) {
-		if (pCodeCache.containsKey("pCode")) {
-			if (!pCodeCache.get("pCode").equalsIgnoreCase(pCode)) {
-				return Response.fail(404, "图片验证码错误");
-			}
-		} else {
-			return Response.fail(404, "请再次刷新图片验证码");
-		}
-		Random random = new Random();
-		String result = "";
-		for (int i = 0; i < 6; i++) {
-			result += random.nextInt(10);
-		}
-		// VerificationCodeUtils.getRequest2(phone, "84685", result);
-		VerificationCodeUtils.getRequest2(phone, "250112", result);
-		if (vCodeCache.containsKey(phone)) {
-			vCodeCache.remove(phone);
-		}
-		vCodeCache.put(phone, result);
-		return Response.ok("发送成功!");
-	}
-
-	@ApiOperation(value = "验证短信验证码", notes = "验证短信验证码")
-	@RequestMapping(value = "/verify/{phone}/{vCode}", method = RequestMethod.GET)
-	public Response verificationCode(@PathVariable String phone, @PathVariable String vCode) {
-		if (!vCodeCache.get(phone).equals(vCode)) {
-			return Response.fail(405, "手机验证码错误");
-		}
-		return Response.ok();
-	}
-
-	@ApiOperation(value="注册", notes="注册")
-	@RequestMapping(value = "", method = RequestMethod.POST)
-	public Response register(@RequestBody JSONObject parameter) {
-		int organizationTypeId = (Integer)parameter.get("organizationTypeId");
-		String vCode = parameter.getString("vCode");
-		MgrUser user = JSONObject.toJavaObject(parameter, MgrUser.class);
-		
-		boolean skip = false;
-		if("888888".equals(vCode)) {
-			skip = true;
-		}
-		
-		if(skip == false) {
-			if (vCodeCache.containsKey(user.getPhone())) {
-				if (parameter.containsKey("vCode")) {
-					if (!vCodeCache.get(user.getPhone()).equals(parameter.getString("vCode"))) {
-						return Response.fail(405, "手机验证码错误");
-					}
-				} else {
-					return Response.fail(405, "手机验证码不存在");
-				}
-			} else {
-				return Response.fail(405, "未获取手机验证码");
-			}
-		}
-		
-		MgrUser userByPhone = userService.getUserByPhone(user.getPhone());
-		if (userByPhone != null) {
-			return Response.fail(405, "该手机号已经注册过了");
-		}
-		MgrUser userByLoginName = userService.getByLoginName(user.getLoginName());
-		if (userByLoginName != null) {
-			return Response.fail(405, "登录名已存在");
-		}
-		user.setPwd(Security.md5(user.getPwd()));
-		
-		userService.registe(user, organizationTypeId);
-		return Response.ok();
-	}
-	
-	@ApiOperation(value="修改密码", notes="修改密码")
-	@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
-	public Response updatePassword(@RequestBody JSONObject parameter) {
-		MgrUser user = JSONObject.toJavaObject(parameter, MgrUser.class);
-		if (vCodeCache.containsKey(user.getPhone())) {
-			if (parameter.containsKey("vCode")) {
-				if (!vCodeCache.get(user.getPhone()).equals(parameter.getString("vCode"))) {
-					return Response.fail(405, "手机验证码错误");
-				}
-			} else {
-				return Response.fail(405, "手机验证码不存在");
-			}
-		} else {
-			return Response.fail(405, "未获取手机验证码");
-		}
-		user.setPwd(Security.md5(user.getPwd()));
-		userService.updatePassword(user);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="修改手机号", notes="修改手机号")
-	@RequestMapping(value = "/updatePhone", method = RequestMethod.POST)
-	public Response updatePhone(@RequestBody JSONObject parameter) {
-		MgrUser user = JSONObject.toJavaObject(parameter, MgrUser.class);
-		if (vCodeCache.containsKey(user.getPhone())) {
-			if (parameter.containsKey("vCode")) {
-				if (!vCodeCache.get(user.getPhone()).equals(parameter.getString("vCode"))) {
-					return Response.fail(405, "手机验证码错误");
-				}
-			} else {
-				return Response.fail(405, "手机验证码不存在");
-			}
-		} else {
-			return Response.fail(405, "未获取手机验证码");
-		}
-		userService.updatePhone(user);
-		return Response.ok();
-	}
-
-	@ApiOperation(value="验证手机号", notes="验证手机号")
-	@RequestMapping(value = "/vPhone/{phone}", method = RequestMethod.GET)
-	public Response verificationPhone(@PathVariable String phone) {
-		MgrUser userByPhone = userService.getUserByPhone(phone);
-		if (userByPhone != null) {
-			return Response.fail(404, "该手机号已注册");
-		}
-		return Response.ok();
-	}
-
-	@ApiOperation(value="验证登录名", notes="验证登录名")
-	@RequestMapping(value = "/vLoginName/{loginName}", method = RequestMethod.GET)
-	public Response verificationLoginName(@PathVariable String loginName) {
-		MgrUser userByLoginName = userService.getByLoginName(loginName);
-		if (userByLoginName != null) {
-			return Response.fail(405, "登录名已存在");
-		}
-		return Response.ok();
-	}
-
-	@ApiOperation(value="获取图片验证码", notes="获取图片验证码")
-	@RequestMapping(value = "/pCode", method = RequestMethod.GET)
-	public Response getCode() {
-		ImageUtil imageUtil = new ImageUtil(120, 40, 4, 30);
-		pCodeCache.clear();
-		pCodeCache.put("pCode", imageUtil.getCode());
-		Map<String, Object> result = new HashMap<String, Object>();
-		String pngBase64 = "data:image/png;base64," + imageUtil.getPngBase64();
-		result.put("pngBase64", pngBase64);
-		return Response.ok(result);
-	}
-	
-}

+ 0 - 2
virgo.manager/src/main/java/com/bosshand/virgo/controller/UserInfoController.java

@@ -54,7 +54,6 @@ public class UserInfoController {
 		MgrUser user = ContextUtils.getCurrentUser();
 		MgrUser mu = mgrUserService.getById(user.getId());
 		UserContext userContext = ContextUtils.getUserContext();
-		user.setPwd(null);
 		user.setName(mu.getName());
 		user.setPhone(mu.getPhone());
 		user.setSex(mu.getSex());
@@ -74,7 +73,6 @@ public class UserInfoController {
 		return Response.ok(map);
 	}
 
-	
 	@ApiOperation(value="个人信息管理", notes="个人信息修改")
 	@RequestMapping(value = "/update", method = RequestMethod.POST)
 	public Response update(@RequestBody MgrUser user) {

+ 4 - 20
virgo.manager/src/main/java/com/bosshand/virgo/message/service/MessagePushService.java

@@ -6,9 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.core.dao.AppUserTokenDao;
 import com.bosshand.virgo.core.dao.MgrUserDao;
-import com.bosshand.virgo.core.model.AppUserToken;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.message.model.NotificationMessage;
 import com.bosshand.virgo.util.GeTui;
@@ -19,9 +17,6 @@ public class MessagePushService {
 	
 	@Autowired
 	private MgrUserDao mgrUserDao;
-	
-	@Autowired
-	private AppUserTokenDao appUserTokenDao;
 
 	private Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -39,9 +34,7 @@ public class MessagePushService {
 			return;
 		}
 		
-		AppUserToken appUserToken = appUserTokenDao.getByUserId(userId);
-		
-		geTui.setCid(appUserToken == null ? "" : appUserToken.getCid());
+		geTui.setCid("");
 
 		JSONObject jb = new JSONObject();
 		jb.put("title", message.getSender());
@@ -49,18 +42,9 @@ public class MessagePushService {
 		
 		geTui.setTransmissionContent(jb.toJSONString());
 
-		if (appUserToken != null) {
-			if (appUserToken.getEquip() == null || appUserToken.getEquip().equals("")) {
-				return;
-			} else {
-				if (appUserToken.getEquip().trim().equals("android")) {
-					pushAndroid(geTui);
-				} else if (appUserToken.getEquip().trim().equals("ios")) {
-					pushIos(geTui);
-				}
-			}
-		}
-		
+		pushAndroid(geTui);
+		pushIos(geTui);
+
 	}
 
 	private void pushIos(GeTui geTui) {

+ 6 - 56
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -2,15 +2,15 @@ package com.bosshand.virgo.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.core.dao.*;
-import com.bosshand.virgo.core.model.*;
-import com.bosshand.virgo.core.utils.Utils;
+import com.bosshand.virgo.core.model.Attendance;
+import com.bosshand.virgo.core.model.MgrRoleCode;
+import com.bosshand.virgo.core.model.MgrUser;
+import com.bosshand.virgo.core.model.MgrUserRole;
 import com.bosshand.virgo.exception.Constant;
 import com.bosshand.virgo.exception.ServiceException;
-import com.bosshand.virgo.util.Security;
 import com.bosshand.virgo.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PathVariable;
 
 import java.util.*;
@@ -30,9 +30,6 @@ public class UserService {
 	@Autowired
 	private MgrOrganizationDao mgrOrganizationDao;
 
-	@Autowired
-	private MgrOrganizationTypeDao mgrOrganizationTypeDao;
-	
 	@Autowired
 	private AttendanceDao attendanceDao;
 
@@ -42,60 +39,14 @@ public class UserService {
 		return user;
 	}
 
-	public MgrUser getByLoginName(String loginName) {
-		return mgrUserDao.getByLoginName(loginName);
-	}
-
-	public MgrUser getUserByPhone(String phone) {
-		return mgrUserDao.getUserByPhone(phone);
-	}
-
-	@Transactional
-	public int registe(MgrUser user, int typeId) {
-
-		MgrOrganizationType type = mgrOrganizationTypeDao.get(typeId);
-
-		if (type == null) {
-			throw new ServiceException("Organization Type not found", Constant.RET_BAD_REQUEST);
-		}
-
-		MgrOrganization mgrOrganization = new MgrOrganization();
-		mgrOrganization.setMgrOrganizationTypeId(typeId);
-		mgrOrganization.setMgrOrganizationTypeName(type.getName());
-		mgrOrganization.setName(null);
-		mgrOrganization.setRegisteDate(new Date());
-		mgrOrganization.setContact(user.getName());
-		mgrOrganization.setContactTel(user.getPhone());
-		mgrOrganization.setOrganizationCode(Utils.getPinYinHeadChar(type.getName() + Utils.random(8)));
-		mgrOrganizationDao.insert(mgrOrganization);
-
-		user.setLastOrganizationId(mgrOrganization.getId());
-		mgrUserDao.insert(user);
-
-		MgrUserRole userRole = new MgrUserRole();
-		userRole.setAdmin(true);
-		userRole.setOrganizationId(mgrOrganization.getId());
-		userRole.setUserId(user.getId());
-		mgrUserRoleDao.insert(userRole);
-
-		return 1;
+	public MgrUser getByPhone(String phone) {
+		return mgrUserDao.getByPhone(phone);
 	}
 
 	public int update(MgrUser user) {
-		if (user.getPwd() != null) {
-			user.setPwd(Security.md5(user.getPwd()));
-		}
 		return mgrUserDao.update(user);
 	}
 
-	public int updatePhone(MgrUser user) {
-		return mgrUserDao.updatePhone(user);
-	}
-
-	public int updatePassword(MgrUser user) {
-		return mgrUserDao.updatePassword(user);
-	}
-
 	public int banUser(long id, int status) {
 		return mgrUserDao.banUser(id, status);
 	}
@@ -105,7 +56,6 @@ public class UserService {
 		if (userByPhone != null) {
 			return userByPhone;
 		}
-		user.setPwd(Security.md5(user.getPwd()));
 		mgrUserDao.insert(user);
 		return user;
 	}

+ 1 - 1
virgo.manager/src/main/java/com/bosshand/virgo/shiro/CustomRealm.java

@@ -38,7 +38,7 @@ public class CustomRealm extends AuthorizingRealm {
 		if (loginName == null || !JWTUtil.verify(token, loginName)) {
 			throw new AuthenticationException("token认证失败");
 		}
-		MgrUser mgrUser = userService.getByLoginName(loginName);
+		MgrUser mgrUser = userService.getByPhone(loginName);
 		if (mgrUser == null) {
 			throw new AuthenticationException("该用户不存在");
 		}

TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/controller/RegisterController.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/controller/UserInfoController.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/message/service/MessagePushService.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/service/UserService.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/shiro/CustomRealm.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/util/ImageUtil.class


TEMPAT SAMPAH
virgo.manager/target/classes/com/bosshand/virgo/util/VerificationCodeUtils.class