Commit b3b9aa50 by java-李谡

bug修改,微会议密码encode,航线论证统计算法修改

parent c50ec7d5
......@@ -61,7 +61,7 @@ public class StatisticalService extends BaseService<StatisticalDao> {
} else {
Integer day = dao.getDay(e);
if (day != null) {
if (day > 180) {
if (day > 180 && Integer.parseInt(e.getExpiryDate()) > 180) {
day = 180 - day;
e.setExpiryDate(day + "");
} else {
......
......@@ -41,7 +41,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 通过CODE获取用户ID
*
*
* @param userCode
* @return
*/
......@@ -60,7 +60,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 注册用户
*
*
* @param entity
* @return
*/
......@@ -71,7 +71,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 插入验证码
*
*
* @param telephone
* @param verifyCode
* @return
......@@ -83,7 +83,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 用户登录
*
*
* @param entity
* @return
*/
......@@ -91,12 +91,14 @@ public class UserService extends CurdService<UserDao, UserEntity> {
UserEntity UserEntity = dao.getUser(entity);
return UserEntity;
}
public LoginUserEntity findUserByLoginName(String loginName) {
LoginBean bean = new LoginBean();
bean.setLoginName(loginName);
LoginUserEntity userEntity = dao.findUserByLoginName(bean);
return userEntity;
}
public LoginUserEntity findUserByLoginName(LoginBean bean) {
LoginUserEntity userEntity = dao.findUserByLoginName(bean);
return userEntity;
......@@ -118,13 +120,14 @@ public class UserService extends CurdService<UserDao, UserEntity> {
// HASH_INTERATIONS);
// return Encodes.encodeHex(salt) + Encodes.encodeHex(hashPassword);
// }
/**
* 根据用户类型查询用户列表
*
* @author renmb
* @time 2016年8月31日
*
* @param userType
* @return
* @author renmb
* @time 2016年8月31日
*/
public List<UserListEntity> findUserByType(String userType, String keywords) {
UserByTypeBean bean = new UserByTypeBean();
......@@ -135,14 +138,14 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 获取指定条数的用户列表
*
* @author renmb
* @time 2016年10月28日
*
* @param userType
* @param pageSize
* @param keywords
* @param huaweiStatus
* @return
* @author renmb
* @time 2016年10月28日
*/
public List<UserListEntity> findTopUserByType(String userType, int pageSize, String keywords, String huaweiStatus) {
UserByTypeBean bean = new UserByTypeBean();
......@@ -155,13 +158,13 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 分页查询用户列表
*
* @author renmb
* @time 2016年9月9日
*
* @param userType
* @param pageNo
* @param pageSize
* @return
* @author renmb
* @time 2016年9月9日
*/
public PageEntity<UserListEntity> findUserByType(String userType, int pageNo, int pageSize, String huaweiStatus) {
UserByTypeBean bean = new UserByTypeBean();
......@@ -193,30 +196,30 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 分页查询用户列表(通过用户Id)
*
* @author renmb
* @time 2016年9月9日
*
* @param userType
* @param pageNo
* @param pageSize
* @return
* @author renmb
* @time 2016年9月9日
*/
public PageEntity<UserListEntity> findUserByTypeAndOffice(String userType,int pageNo, int pageSize,
String huaweiStatus, List<String> officeIds, String companyId,Integer type) {
public PageEntity<UserListEntity> findUserByTypeAndOffice(String userType, int pageNo, int pageSize,
String huaweiStatus, List<String> officeIds, String companyId, Integer type) {
UserByTypeBean bean = new UserByTypeBean();
bean.setHuaweiStatus(huaweiStatus);
bean.setUserType(userType);
PageInfo<UserListEntity> pageInfo = null;
// 必须紧贴dao的查询方法
if(type == 0){// 分级第一个接口
if (type == 0) {// 分级第一个接口
bean.setCompanyId(companyId);
PageHelper.startPage(pageNo, pageSize);
pageInfo = new PageInfo<UserListEntity>(dao.findOuterUser(bean));
}else{
if(checkIsCompany(companyId) && "0".equals(userType)){// 判断 companyId是否为公司id
pageInfo = new PageInfo<UserListEntity>(dao.findOuterUser(bean));
} else {
if (checkIsCompany(companyId) && "0".equals(userType)) {// 判断 companyId是否为公司id
officeIds.add("0");
bean.setCompanyId(companyId);
bean.setCompanyId(companyId);
}
bean.setOfficeId(officeIds);
PageHelper.startPage(pageNo, pageSize);
......@@ -240,11 +243,11 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 修改某个席位的登录信息
*
* @author renmb
* @time 2017年3月22日
*
* @param seatloginBean
* @return
* @author renmb
* @time 2017年3月22日
*/
@Transactional(readOnly = false)
public boolean updateUserSeat(SeatLoginBean seatloginBean) {
......@@ -252,13 +255,14 @@ public class UserService extends CurdService<UserDao, UserEntity> {
Integer count = dao.updateUserSeat(seatloginBean);
return count != null && count != 0;
}
/**
* 退出席位登录
*
* @author renmb
* @time 2017年3月29日
*
* @param seatloginBean
* @return
* @author renmb
* @time 2017年3月29日
*/
@Transactional(readOnly = false)
public boolean updateSeatUserLogout(SeatLoginBean seatloginBean) {
......@@ -266,26 +270,28 @@ public class UserService extends CurdService<UserDao, UserEntity> {
Integer count = dao.updateSeatUserLogout(seatloginBean);
return count != null && count != 0;
}
/**
* 清空用户之前的席位登录信息
*
* @author renmb
* @time 2017年3月22日
*
* @param seatloginBean
* @return
* @author renmb
* @time 2017年3月22日
*/
@Transactional(readOnly = false)
public boolean updateUserSeatLoginEmpty(SeatLoginBean seatloginBean) {
Integer count = dao.updateUserSeatLoginEmpty(seatloginBean);
return count != null && count != 0;
}
/**
* 修改用户头像
*
* @author renmb
* @time 2016年9月7日
*
* @param bean
* @return
* @author renmb
* @time 2016年9月7日
*/
@Transactional(readOnly = false)
public boolean updateUserPhoto(UserPhotoBean bean) {
......@@ -299,12 +305,12 @@ public class UserService extends CurdService<UserDao, UserEntity> {
seatloginBean.setSeatId(seatId);
return dao.getUserSeat(seatloginBean);
}
public UserSeatEntity getSeatsEntity(SeatLoginBean seatloginBean) {
return dao.getUserSeat(seatloginBean);
}
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean){
public UserSeatMobileBean getUserSeatMobileBean(SeatLoginBean seatloginBean) {
return dao.getUserSeatMobileBean(seatloginBean);
}
......@@ -320,12 +326,12 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public boolean validateServerPassword(LoginBean loginBean) {
long startTime = System.nanoTime();// 开始计时时间
try {
if(GConstants.getBoolean("use.new.login.api", false)){// 使用新的登录地址,默认使用旧地址
if (GConstants.getBoolean("use.new.login.api", false)) {// 使用新的登录地址,默认使用旧地址
boolean isSuccess = HTTPClientUtil.callLogin(loginBean.getLoginName(), loginBean.getPassword());// 进行秘密校验
long endTime = System.nanoTime();// 结束计时时间
long duration = endTime - startTime;
LOG.debug("[UserService login][validateServerPassword]["+isSuccess+"]总共用时:" + Util.getDurationTime(duration));
LOG.info("[UserService login][validateServerPassword][" + isSuccess + "]总共用时:" + Util.getDurationTime(duration));
return isSuccess;
}
StringBuilder buf = new StringBuilder(GConstants.getValue("hn.api.base.url", "https://dsp.jdair.net"));
......@@ -334,24 +340,24 @@ public class UserService extends CurdService<UserDao, UserEntity> {
buf.append("&loginId=");
buf.append(URLEncoder.encode(loginBean.getLoginName(), "UTF-8"));
buf.append("&password=");
buf.append(loginBean.getPassword());
LOG.debug("[UserService login][validateServerPassword][URL]:" + buf.toString());
buf.append(URLEncoder.encode(loginBean.getPassword(), "UTF-8"));
LOG.info("密码encode后;"+URLEncoder.encode(loginBean.getPassword(),"UTF-8"));
LOG.info("[UserService login][validateServerPassword][URL]:" + buf.toString());
HCFetcher fetcher = HCFetcher.getInstance();
FetchEntity entity = fetcher.get(buf.toString());
if (entity == null) {// 再次重新尝试获取内容
entity = fetcher.get(buf.toString());
}
if (entity != null) {
String text = entity.getContent("UTF-8");
LOG.debug("[UserService validateServerPassword][result]:" + text);
LOG.info("[UserService validateServerPassword][result]:" + text);
JSONObject response = JSON.parseObject(text);
if (response.get("result") == null) {
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserService login][validateServerPassword][FAILD]总共用时:" + Util.getDurationTime(duration));
LOG.info("[UserService login][validateServerPassword][FAILD]总共用时:" + Util.getDurationTime(duration));
return false;
}
JSONObject result = response.getJSONObject("result");
......@@ -359,24 +365,25 @@ public class UserService extends CurdService<UserDao, UserEntity> {
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserService login][validateServerPassword][SUCCESS]总共用时:" + Util.getDurationTime(duration));
LOG.info("[UserService login][validateServerPassword][SUCCESS]总共用时:" + Util.getDurationTime(duration));
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (fetcher != null) {fetcher.shutdown();}
}
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserService validateServerPassword][FAILD]总共用时:" + Util.getDurationTime(duration));
LOG.info("[UserService validateServerPassword][FAILD]总共用时:" + Util.getDurationTime(duration));
return false;
}
/**
* 验证远程Server密码 ,如果登陆成功,则更新数据库的字段
*
*
* @return 验证成功返回true
*/
@Transactional(readOnly = false)
......@@ -390,12 +397,12 @@ public class UserService extends CurdService<UserDao, UserEntity> {
// DESPlus desPlus = new DESPlus();
// buf.append(loginBean.getLoginName()).append("&password=").append(desPlus.encrypt(loginBean.getPassword()));
if(GConstants.getBoolean("use.new.login.api", false)){// 使用新的登录地址,默认使用旧地址
if (GConstants.getBoolean("use.new.login.api", false)) {// 使用新的登录地址,默认使用旧地址
boolean isSuccess = HTTPClientUtil.callLogin(loginBean.getLoginName(), loginBean.getPassword());// 进行秘密校验
long endTime = System.nanoTime();// 结束计时时间
long duration = endTime - startTime;
LOG.debug("[UserService login][validateServerPassword]["+isSuccess+"]总共用时:" + Util.getDurationTime(duration));
LOG.debug("[UserService login][validateServerPassword][" + isSuccess + "]总共用时:" + Util.getDurationTime(duration));
return isSuccess;
}
StringBuilder buf = new StringBuilder(GConstants.JDAIR_BASE_API
......@@ -406,15 +413,15 @@ public class UserService extends CurdService<UserDao, UserEntity> {
buf.append("&loginId=").append(URLEncoder.encode(loginBean.getLoginName(), "UTF-8")).append("&password=").append(encrypt);
LOG.debug("[UserService login][validateServerPassword][URL]:" + buf.toString());
HCFetcher fetcher = HCFetcher.getInstance();
FetchEntity entity = fetcher.get(buf.toString());
if (entity == null) {// 再次重新尝试获取内容
entity = fetcher.get(buf.toString());
}
if (entity != null) {
// {"result":{"message":"succ","viewMessage":"成功","resultCode":"1000"},"data":{"messageCount":0,"mess":"用户chl.zhou登录成功"}}
// {"result":{"message":"succ","viewMessage":"成功","resultCode":"1000"},"data":{"messageCount":0,"mess":"用户chl.zhou登录成功"}}
// Map<String, Object> response = JSON.parseObject(entity.getContent("UTF-8"),
// new TypeReference<Map<String, Object>>() {
// });
......@@ -429,7 +436,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
}
// @SuppressWarnings("unchecked")
// Map<String, String> result = (Map<String, String>) response.get("result");
JSONObject result = response.getJSONObject("result");
if ("1000".equals(result.getString("resultCode"))) { // 远程服务器登陆成功,更改数据库密码
/*
......@@ -449,7 +456,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (fetcher != null) {fetcher.shutdown();}
......@@ -460,7 +467,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
return false;
}
public PageEntity<UserListEntity> getUserList(UserListBean bean) {
PageInfo<UserListEntity> pageInfo = null;
// 必须紧贴dao的查询方法
......@@ -485,7 +492,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public PageEntity<UserListEntity> searchUserInfo(SearchUserBean bean) {
PageInfo<UserListEntity> pageInfo = null;
// if(bean.getOfficeIds() != null &&
// checkIsCompany(bean.getOfficeId()) &&
// "0".equals(bean.getType())){// 判断 companyId是否为公司id
......@@ -495,7 +502,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<UserListEntity>(dao.getUserInfo(bean));
if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
return null;
}
......@@ -515,7 +522,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
/**
* 得到用户席位相关信息,为用户的时候,席位相关的信息为空,type为USER,反正也是
*
*
* @param bean
* @return
*/
......@@ -580,7 +587,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
buf.append("&loginId=").append("yan_zhang3").append("&password=").append(miwen);
System.out.println(buf.toString());
// FetchEntity entity = HCFetcher.getInstance().post(buf.toString(), null);
// if (entity.isSuccess()) {
// System.out.println(entity.getContent("UTF-8"));
......@@ -630,8 +637,8 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public Integer updateUserDeviceInfo(UserLoginLogEntity deviceInfoEntity) {
if(StringUtils.isNotEmpty(deviceInfoEntity.getDeviceToken())){// 解绑非空的设备绑定
if (StringUtils.isNotEmpty(deviceInfoEntity.getDeviceToken())) {// 解绑非空的设备绑定
dao.unBindDeviceUserInfo(deviceInfoEntity);// 解绑绑定此设备的用户
}
return dao.insertUserDeviceInfo(deviceInfoEntity);
......@@ -646,34 +653,36 @@ public class UserService extends CurdService<UserDao, UserEntity> {
}
public Integer addLoginLog(UserLoginLogEntity loginInfoEntity) {
if(StringUtils.isEmpty(loginInfoEntity.getSeatId()))
if (StringUtils.isEmpty(loginInfoEntity.getSeatId()))
loginInfoEntity.setSeatId("");
loginInfoEntity.setId(IdWorker.getNextNumId());
return dao.addLoginLog(loginInfoEntity);
}
public Integer updateUserLoginInfo(UserLoginLogEntity loginInfoEntity) {
return dao.updateUserLoginInfo(loginInfoEntity);
}
private boolean checkIsCompany(String companyId){
private boolean checkIsCompany(String companyId) {
boolean flag = false;
UserByTypeBean bean = new UserByTypeBean();
bean.setCompanyId(companyId);
String parentsId = dao.checkIsCompany(bean);
if("0".equals(parentsId)){
flag = true;
if ("0".equals(parentsId)) {
flag = true;
}
return flag;
}
/**
* 修改用户的修为值班电话
*
* @author renmb
* @time 2017年1月18日
*
* @param seatloginBean
* @return
* @author renmb
* @time 2017年1月18日
*/
@Transactional(readOnly = false)
public boolean updateUserSeatMobile(UserSeatMobileBean seatloginBean) {
......@@ -682,15 +691,14 @@ public class UserService extends CurdService<UserDao, UserEntity> {
}
/**
*
* @author zhanglg
* @time 2017年2月22日
* @param bean
* @author zhanglg
* @time 2017年2月22日
*/
public void updateOuterUser(OuterUserBean bean) {
dao.updateOuterUser( bean);
dao.updateOuterUser(bean);
}
/**
......
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