|
|
|
@ -1789,163 +1789,6 @@ public class CollectController extends Controller {
|
|
|
|
|
|
|
|
|
|
/*****↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
|
|
|
|
|
/** 以下接口,用于发布到人员的任务,获取选择单位内部门、班级、人员、年级等功能,为了以后与天喻对接,全新实现,方便以后调整*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:填报系统专用登录接口,后期可以扩展支持天喻平台对接
|
|
|
|
|
*
|
|
|
|
|
* @param username
|
|
|
|
|
* @param password
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class, RepeatIntercetpor.class})
|
|
|
|
|
public void doFillLogin(String username, String password) {
|
|
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
|
|
String checkCodeKey = "";
|
|
|
|
|
|
|
|
|
|
if (StrKit.isBlank(username)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (StrKit.isBlank(password)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查缓存中此账号错误了几次
|
|
|
|
|
String PassWordKey = "WrongPassWord_" + username;
|
|
|
|
|
int ErrCnt = 4; //最多允许错几次 4+1
|
|
|
|
|
int cntNum = 0; //错几次了
|
|
|
|
|
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey));
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "账号被停用5分钟,请稍后再试!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//与前端配合RSA通用加密解密
|
|
|
|
|
try {
|
|
|
|
|
password = RsaUtils.decryptDataOnJava(password, RsaUtils.PRIVATEKEY);
|
|
|
|
|
} catch (Exception err) {
|
|
|
|
|
password = "!@#$%^&&*^*&(*)(*_)^%^$%$^%$^%";
|
|
|
|
|
}
|
|
|
|
|
String passwordEncode = CommonUtil.getLdapPassword(password);
|
|
|
|
|
Map loginMap = bm.getLoginInfoByUserName(username);
|
|
|
|
|
if (loginMap == null || !passwordEncode.equals(loginMap.get("password").toString())) {
|
|
|
|
|
//扩展支持连续输入用户名密码错误,停用账号5分钟功能 2022.06.07
|
|
|
|
|
cntNum = 1;
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey)) + cntNum;
|
|
|
|
|
|
|
|
|
|
int finalCntNum = cntNum;
|
|
|
|
|
RedisKit.incrBy(PassWordKey, finalCntNum);
|
|
|
|
|
RedisKit.Expire(PassWordKey, 60 * 5);
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码连续输入" + (ErrCnt + 1) + "次全部错误,账号将被停用5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (cntNum == ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码连续错误,你还有1次机会,再次错误后账号将被封掉5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码错误!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//去掉限制
|
|
|
|
|
RedisKit.Del(PassWordKey);
|
|
|
|
|
RedisKit.Del(checkCodeKey);
|
|
|
|
|
//防止用户攻击修改Cookie
|
|
|
|
|
Map<String, Object> _map = new HashMap<>();
|
|
|
|
|
_map.put("person_id", loginMap.get("person_id"));
|
|
|
|
|
|
|
|
|
|
SessionKit.set(getRequest(), getResponse(), "person_id", loginMap.get("person_id").toString());
|
|
|
|
|
resultJson.put("success", true);
|
|
|
|
|
resultJson.put("person_id", loginMap.get("person_id").toString());
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取登录人员所在学校有哪些年级
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getSchoolNjList() {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
List<Record> list = cm.getSchoolNjList(bureau_id);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前登录人员所有单位的所有部门列表,不带分页
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getOrgList(String keyword) {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
List<Record> list = cm.getOrgList(bureau_id, keyword);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定部门下的人员信息列表,带分页
|
|
|
|
|
*
|
|
|
|
|
* @param org_id 单位id
|
|
|
|
|
* @param keyword 关键字
|
|
|
|
|
* @param page 第几页
|
|
|
|
|
* @param limit 每页多少个
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getOrgPersonList(String org_id, String keyword, int page, int limit) {
|
|
|
|
|
Page<Record> list = cm.getOrgPersonList(org_id, keyword, page, limit);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前登录人员所在单位下的+所在年级下所有班级
|
|
|
|
|
*
|
|
|
|
|
* @param nj_id 年级id
|
|
|
|
|
* @param keyword 关键字
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getClassList(int nj_id, String keyword, int page, int limit) {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
Page<Record> list = cm.getClassList(bureau_id, nj_id, keyword, page, limit);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:填报者保存填报结果
|
|
|
|
|
*
|
|
|
|
@ -2094,5 +1937,189 @@ public class CollectController extends Controller {
|
|
|
|
|
Page<Record> dataPage = cm.getTyBureauList(keyword, page, limit);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(dataPage));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:填报系统专用登录接口
|
|
|
|
|
* 此处是不对接第三方基础数据+统一认证的,因为如果对接了第三方基础数据+统一认证,就直接走了天喻的CAS,这里只处理回调就行了,单独实现吧
|
|
|
|
|
*
|
|
|
|
|
* @param username
|
|
|
|
|
* @param password
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class, RepeatIntercetpor.class})
|
|
|
|
|
public void doFillLogin(String username, String password) {
|
|
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
|
|
String checkCodeKey = "";
|
|
|
|
|
|
|
|
|
|
if (StrKit.isBlank(username)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (StrKit.isBlank(password)) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码不允许为空!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查缓存中此账号错误了几次
|
|
|
|
|
String PassWordKey = "WrongPassWord_" + username;
|
|
|
|
|
int ErrCnt = 4; //最多允许错几次 4+1
|
|
|
|
|
int cntNum = 0; //错几次了
|
|
|
|
|
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey));
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "账号被停用5分钟,请稍后再试!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//与前端配合RSA通用加密解密
|
|
|
|
|
try {
|
|
|
|
|
password = RsaUtils.decryptDataOnJava(password, RsaUtils.PRIVATEKEY);
|
|
|
|
|
} catch (Exception err) {
|
|
|
|
|
password = "!@#$%^&&*^*&(*)(*_)^%^$%$^%$^%";
|
|
|
|
|
}
|
|
|
|
|
String passwordEncode = CommonUtil.getLdapPassword(password);
|
|
|
|
|
Map loginMap = bm.getLoginInfoByUserName(username);
|
|
|
|
|
if (loginMap == null || !passwordEncode.equals(loginMap.get("password").toString())) {
|
|
|
|
|
//扩展支持连续输入用户名密码错误,停用账号5分钟功能 2022.06.07
|
|
|
|
|
cntNum = 1;
|
|
|
|
|
if (RedisKit.Exists(PassWordKey))
|
|
|
|
|
cntNum = Integer.parseInt(RedisKit.Get(PassWordKey)) + cntNum;
|
|
|
|
|
|
|
|
|
|
int finalCntNum = cntNum;
|
|
|
|
|
RedisKit.incrBy(PassWordKey, finalCntNum);
|
|
|
|
|
RedisKit.Expire(PassWordKey, 60 * 5);
|
|
|
|
|
if (cntNum > ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "密码连续输入" + (ErrCnt + 1) + "次全部错误,账号将被停用5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (cntNum == ErrCnt) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码连续错误,你还有1次机会,再次错误后账号将被封掉5分钟!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("msg", "用户名或密码错误!");
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//去掉限制
|
|
|
|
|
RedisKit.Del(PassWordKey);
|
|
|
|
|
RedisKit.Del(checkCodeKey);
|
|
|
|
|
//防止用户攻击修改Cookie
|
|
|
|
|
Map<String, Object> _map = new HashMap<>();
|
|
|
|
|
_map.put("person_id", loginMap.get("person_id"));
|
|
|
|
|
|
|
|
|
|
SessionKit.set(getRequest(), getResponse(), "person_id", loginMap.get("person_id").toString());
|
|
|
|
|
resultJson.put("success", true);
|
|
|
|
|
resultJson.put("person_id", loginMap.get("person_id").toString());
|
|
|
|
|
renderJson(resultJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:未来与天喻系统CAS对接
|
|
|
|
|
*/
|
|
|
|
|
public void doFillLoginCAS() {
|
|
|
|
|
//TODO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取登录人员所在学校有哪些年级
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getSchoolNjList() {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
if (cm.THIRD_PARTY_BASE_DATA == 0) {
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
List<Record> list = cm.getSchoolNjList(bureau_id);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
} else {
|
|
|
|
|
//需要重写根据第三方数据表,获取当前登录人员所在学校有哪些年级
|
|
|
|
|
//TODO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前登录人员所有单位的所有部门列表,不带分页
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getOrgList(String keyword) {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
if (cm.THIRD_PARTY_BASE_DATA == 0) {
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
List<Record> list = cm.getOrgList(bureau_id, keyword);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
} else {
|
|
|
|
|
//需要重写根据第三方数据表,获取当前登录人员所在单位的内部组织机构
|
|
|
|
|
//TODO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定部门下的人员信息列表,带分页
|
|
|
|
|
*
|
|
|
|
|
* @param org_id 单位id
|
|
|
|
|
* @param keyword 关键字
|
|
|
|
|
* @param page 第几页
|
|
|
|
|
* @param limit 每页多少个
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getOrgPersonList(String org_id, String keyword, int page, int limit) {
|
|
|
|
|
if (cm.THIRD_PARTY_BASE_DATA == 0) {
|
|
|
|
|
Page<Record> list = cm.getOrgPersonList(org_id, keyword, page, limit);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
} else {
|
|
|
|
|
//需要重写根据第三方数据表,获取指定部门下有哪些人员
|
|
|
|
|
//TODO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取当前登录人员所在单位下的+所在年级下所有班级
|
|
|
|
|
*
|
|
|
|
|
* @param nj_id 年级id
|
|
|
|
|
* @param keyword 关键字
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getClassList(int nj_id, String keyword, int page, int limit) {
|
|
|
|
|
//操作人员
|
|
|
|
|
String person_id = SessionKit.get(getRequest(), getResponse(), "person_id");
|
|
|
|
|
if (cm.THIRD_PARTY_BASE_DATA == 0) {
|
|
|
|
|
//根据人员ID,获取人员所在的单位ID
|
|
|
|
|
LoginPersonModel personModel = new LoginPersonModel();
|
|
|
|
|
Record rs = personModel.getLoginInfoByPersonId(person_id);
|
|
|
|
|
String bureau_id = rs.get("bureau_id");
|
|
|
|
|
Page<Record> list = cm.getClassList(bureau_id, nj_id, keyword, page, limit);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
} else {
|
|
|
|
|
//需要重写根据第三方数据表,获取指定年级下有哪些班级
|
|
|
|
|
//TODO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|