Commit 54f57442 authored by 赵啸非's avatar 赵啸非

添加巴中经开区windows shell

parent a5a7baf0
package com.mortals.xhx.common.pdu.user;
import com.mortals.framework.exception.AppException;
import lombok.Data;
@Data
public class LoginPdu {
private String loginName;
private String password;
private String securityCode;
private String mark;
/** 加密方式 1不加密,2加密*/
private Integer type;
@Override
public String toString() {
return "loginName:" + this.loginName + " password:" + this.password;
}
public boolean validate() throws AppException {
if (loginName == null || loginName.trim().length() == 0) {
throw new AppException("帐号不能为空!");
}
if (password == null || password.trim().length() == 0) {
throw new AppException("密码不能为空!");
}
return true;
}
}
package com.mortals.xhx.common.pdu.user;
import com.mortals.framework.model.BaseEntityLong;
import java.util.Date;
import java.util.List;
import com.mortals.framework.model.BaseEntityLong;
/**
* 用户信息业务Pdu对象
......@@ -22,7 +24,6 @@ public class UserPdu extends BaseEntityLong {
*/
private String loginPwd;
private String password;
private String securityCode;
/**
......@@ -1344,13 +1345,6 @@ public class UserPdu extends BaseEntityLong {
this.securityCode = securityCode;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public int hashCode() {
......@@ -1368,36 +1362,4 @@ public class UserPdu extends BaseEntityLong {
return false;
}
public void initAttrValue(){
this.loginName = "";
this.loginPwd = "";
this.loginLimitAddress = "";
this.realName = "";
this.mobile = "";
this.phone = "";
this.email = "";
this.qq = "";
this.userType = null;
this.siteIds = "";
this.areaCodes = "";
this.status = 1;
this.createUserName = "";
this.lastLoginTime = null;
this.lastLoginAddress = "";
}
}
\ No newline at end of file
package com.mortals.xhx.feign.user;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.LoginPdu;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -62,7 +62,7 @@ public interface IUserFeign extends IFeign {
@PostMapping(value = "/login/login")
String portalLogin(@RequestBody UserPdu userPdu);
String portalLogin(@RequestBody LoginPdu loginPdu);
/**
* 查询用户列表
......@@ -114,8 +114,8 @@ class UserFeignFallbackFactory implements FallbackFactory<IUserFeign> {
}
@Override
public String portalLogin(UserPdu userPdu) {
return JSON.toJSONString(Rest.fail("登录失败!"));
public String portalLogin(LoginPdu loginPdu) {
return null;
}
@Override
......
......@@ -16,7 +16,7 @@ import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.pdu.user.LoginPdu;
import com.mortals.xhx.common.utils.MenuEncodeUtil;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
......@@ -62,81 +62,16 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
UserPdu userPdu = new UserPdu();
userPdu.setLoginName(loginName);
userPdu.setPassword(password);
userPdu.setSecurityCode("admin");
String resp = userFeign.portalLogin(userPdu);
LoginPdu loginPdu = new LoginPdu();
loginPdu.setLoginName(loginName);
loginPdu.setPassword(password);
loginPdu.setSecurityCode("admin");
String resp = userFeign.portalLogin(loginPdu);
return resp;
/* String securityCode = loginForm.getSecurityCode();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
UserEntity userEntity = null;
try {
loginForm.validate();
// boolean result = validCodeService.doCheckImageValidCode(request.getSession().getId(), ip, securityCode);
// if ("8888".equals(securityCode)) {
// result = true;
// }
// if (!result) {
// recordSysLog(request, userEntity, "登录验证码不正确或已过期!");
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "登录验证码不正确或已过期!");
// return ret.toJSONString();
// }
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
userEntity.setMenuUrl(generateMenuUrlCode(urls));
String token = authTokenService.createToken(userEntity);
data.put("token", token);
//设置token 和过期时间
//data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
generateMenuUrlCode(urls);
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
if (userEntity == null) {
userEntity = new UserEntity();
userEntity.setLoginName(loginName);
}
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}*/
}
@RequestMapping("logout")
......@@ -154,7 +89,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
}
Set<String> urls = resourceService.findUrlSetByUserId(user.getId());
log.info("userId:{},urls:{}", user.getId(),JSON.toJSONString(urls));
log.info("userId:{},urls:{}", user.getId(), JSON.toJSONString(urls));
List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
String currUserName = user.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment