|
|
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.base.Base.Model.BaseModel;
|
|
|
|
|
import com.dsideal.base.BaseApplication;
|
|
|
|
|
import com.dsideal.base.Util.*;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Page;
|
|
|
|
@ -16,16 +15,16 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
public class LoginPersonModel {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:修改用户密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2018-11-21
|
|
|
|
|
*
|
|
|
|
|
* @param newpwd
|
|
|
|
|
* @param person_id
|
|
|
|
|
* @param newpwd 新密码
|
|
|
|
|
* @param person_id 被重置密码的人
|
|
|
|
|
* @param ipaddress ip地址
|
|
|
|
|
* @param operator 操作人
|
|
|
|
|
*/
|
|
|
|
|
public void changePwd(String operator, String ipaddress, String newpwd, String person_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.changePwd");
|
|
|
|
@ -37,17 +36,12 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2019-01-19
|
|
|
|
|
*
|
|
|
|
|
* @param pwd
|
|
|
|
|
* @return
|
|
|
|
|
* @param pwd 输入的密码
|
|
|
|
|
*/
|
|
|
|
|
public boolean checkPwdByPersonId(String person_id, String pwd) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.checkPwdByPersonId");
|
|
|
|
|
int count = Db.findFirst(sql, person_id, CommonUtil.getLdapPassword(pwd)).getInt("c");
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return count > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -55,7 +49,7 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2018-12-05
|
|
|
|
|
*
|
|
|
|
|
* @param person_id
|
|
|
|
|
* @param person_id 指定的人员id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getLoginPersonAreaInfo(String person_id) {
|
|
|
|
@ -69,23 +63,12 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2018-11-29
|
|
|
|
|
*
|
|
|
|
|
* @param personId
|
|
|
|
|
* @param person_id 人员id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Record getLoginInfoByPersonId(String personId) {
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getLoginInfoByPersonId");
|
|
|
|
|
List<Record> list = Db.find(sql, personId);
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
return list.get(0);
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
public Record getLoginInfoByPersonId(String person_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getLoginInfoByPersonId");
|
|
|
|
|
return Db.findFirst(sql, person_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -93,10 +76,9 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
*/
|
|
|
|
|
public Page<?> getPrintCityManager(int page_number, int page_size) {
|
|
|
|
|
public Page<Record> getPrintCityManager(int page_number, int page_size) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("loginPerson.getPrintCityManager");
|
|
|
|
|
Page<?> dataPage = Db.paginate(page_number, page_size, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page_number, page_size, sp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -104,10 +86,9 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
*/
|
|
|
|
|
public Page<?> getPrintCityBureau(int page_number, int page_size) {
|
|
|
|
|
public Page<Record> getPrintCityBureau(int page_number, int page_size) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("loginPerson.getPrintCityBureau");
|
|
|
|
|
Page<?> dataPage = Db.paginate(page_number, page_size, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page_number, page_size, sp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -115,10 +96,9 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
*/
|
|
|
|
|
public Page<?> getPrintAreaManager(int page_number, int page_size) {
|
|
|
|
|
public Page<Record> getPrintAreaManager(int page_number, int page_size) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("loginPerson.getPrintAreaManager");
|
|
|
|
|
Page<?> dataPage = Db.paginate(page_number, page_size, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page_number, page_size, sp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -126,10 +106,9 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
*/
|
|
|
|
|
public Page<?> getPrintAreaBureau(int page_number, int page_size, String area_id) {
|
|
|
|
|
public Page<Record> getPrintAreaBureau(int page_number, int page_size, String area_id) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("loginPerson.getPrintAreaBureau", area_id);
|
|
|
|
|
Page<?> dataPage = Db.paginate(page_number, page_size, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page_number, page_size, sp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -140,19 +119,10 @@ public class LoginPersonModel {
|
|
|
|
|
* @param id_card
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getIdCardIsExist(String id_card) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getIdCardIsExist");
|
|
|
|
|
List<Record> list = Db.find(sql, id_card);
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public boolean getIdCardIsExist(String id_card) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getIdCardIsExist");
|
|
|
|
|
Record record = Db.findFirst(sql, id_card);
|
|
|
|
|
return record != null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -163,19 +133,10 @@ public class LoginPersonModel {
|
|
|
|
|
* @param id_card
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getIdCardIsExist(String id_card, String person_id) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getIdCardIsExistByPersonId");
|
|
|
|
|
List<Record> list = Db.find(sql, id_card, person_id);
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public boolean getIdCardIsExist(String id_card, String person_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getIdCardIsExistByPersonId");
|
|
|
|
|
Record record = Db.findFirst(sql, id_card, person_id);
|
|
|
|
|
return record != null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -183,24 +144,13 @@ public class LoginPersonModel {
|
|
|
|
|
* 作者:吴缤
|
|
|
|
|
* 日期:2018-12-11
|
|
|
|
|
*
|
|
|
|
|
* @param telephone
|
|
|
|
|
* @param telephone 手机号
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getTelephoneIsExist(String telephone) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTelephoneIsExist");
|
|
|
|
|
//检查加密后的手机号是不是重复
|
|
|
|
|
String aes_telephone = telephone;
|
|
|
|
|
List<Record> list = Db.find(sql, aes_telephone);
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public int getTelephoneIsExist(String telephone) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTelephoneIsExist");
|
|
|
|
|
Record record = Db.findFirst(sql, telephone);
|
|
|
|
|
return record == null ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -211,21 +161,10 @@ public class LoginPersonModel {
|
|
|
|
|
* @param telephone
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getTelephoneIsExist(String telephone, String person_id) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTelephoneIsExistByPersonId");
|
|
|
|
|
//检查加密后的手机号是不是重复
|
|
|
|
|
String aes_telephone = telephone;
|
|
|
|
|
List<Record> list = Db.find(sql, aes_telephone, person_id);
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public int getTelephoneIsExist(String telephone, String person_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTelephoneIsExistByPersonId");
|
|
|
|
|
Record record = Db.findFirst(sql, telephone, person_id);
|
|
|
|
|
return record == null ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -236,19 +175,10 @@ public class LoginPersonModel {
|
|
|
|
|
* @param email
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getEmailIsExist(String email) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getEmailIsExist");
|
|
|
|
|
List<Record> list = Db.find(sql, email);
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public int getEmailIsExist(String email) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getEmailIsExist");
|
|
|
|
|
Record record = Db.findFirst(sql, email);
|
|
|
|
|
return record == null ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -259,19 +189,10 @@ public class LoginPersonModel {
|
|
|
|
|
* @param email
|
|
|
|
|
* @return 0:不存在 1:已存在 2:异常
|
|
|
|
|
*/
|
|
|
|
|
public static int getEmailIsExist(String email, String person_id) {
|
|
|
|
|
int flag = 0;
|
|
|
|
|
try {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getEmailIsExistByPersonId");
|
|
|
|
|
List<Record> list = Db.find(sql, email, person_id);
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
flag = 2;
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
public int getEmailIsExist(String email, String person_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getEmailIsExistByPersonId");
|
|
|
|
|
Record record = Db.findFirst(sql, email, person_id);
|
|
|
|
|
return record == null ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONObject doLogin(String username, String password, String platform, HttpServletResponse response) {
|
|
|
|
@ -333,7 +254,7 @@ public class LoginPersonModel {
|
|
|
|
|
//去掉限制
|
|
|
|
|
RedisKit.del(PassWordKey);
|
|
|
|
|
//防止用户攻击修改Cookie
|
|
|
|
|
Map _map = new HashMap<String, Object>();
|
|
|
|
|
Map<String, Object> _map = new HashMap<>();
|
|
|
|
|
_map.put("identity_id", loginMap.get("identity_id"));
|
|
|
|
|
_map.put("person_id", loginMap.get("person_id"));
|
|
|
|
|
_map.put("bureau_id", loginMap.get("bureau_id"));
|
|
|
|
|