|
|
|
@ -18,14 +18,20 @@ import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
public class LoginPersonController extends Controller {
|
|
|
|
|
//实例化model
|
|
|
|
|
LoginPersonModel model = new LoginPersonModel();
|
|
|
|
|
LoginPersonModel lm = new LoginPersonModel();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录
|
|
|
|
|
* @param username 用户名
|
|
|
|
|
* @param password 密码
|
|
|
|
|
* @param platform 平台
|
|
|
|
|
* @param forVue 0:普通登录,1:vue登录
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
public void doLogin(String username, String password, String platform, int forVue) {
|
|
|
|
|
JSONObject jo = model.doLogin(username, password, platform, getResponse());
|
|
|
|
|
JSONObject jo = lm.doLogin(username, password, platform, getResponse());
|
|
|
|
|
|
|
|
|
|
if (!jo.getBoolean("success")) {
|
|
|
|
|
renderJson(RetKit.renderFail("用户名或密码错误,无法登录!"));
|
|
|
|
@ -65,6 +71,9 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退出登录功能
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
public void logout() {
|
|
|
|
|
CookieUtil.remove(getRequest(), getResponse(), "identity_id");
|
|
|
|
@ -75,9 +84,8 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:重置密码功能
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2018-11-06
|
|
|
|
|
* 重置密码
|
|
|
|
|
* @param person_id 被重置密码的人的ID
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -89,14 +97,14 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
String operator = getCookie("person_id");
|
|
|
|
|
//客户端ip_address
|
|
|
|
|
String ip_address = IpUtil.getIpAddr(getRequest());
|
|
|
|
|
model.changePwd(operator, ip_address, "123456", person_id);
|
|
|
|
|
lm.changePwd(operator, ip_address, "123456", person_id);
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(true, "重置密码成功完成!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:修改密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2019-01-19
|
|
|
|
|
* 修改密码
|
|
|
|
|
* @param old_pwd 旧密码
|
|
|
|
|
* @param new_pwd 新密码
|
|
|
|
|
*/
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -108,7 +116,7 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
String ip_address = IpUtil.getIpAddr(getRequest());
|
|
|
|
|
|
|
|
|
|
//检查旧密码是不是正确
|
|
|
|
|
boolean success = model.checkPwdByPersonId(person_id, old_pwd);
|
|
|
|
|
boolean success = lm.checkPwdByPersonId(person_id, old_pwd);
|
|
|
|
|
//写入新密码
|
|
|
|
|
if (!success) {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "输入的旧密码不正确!"));
|
|
|
|
@ -118,15 +126,13 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "输入的密码不被接受,应该输入:长度大于6位,并且包含大小字母和数字的组合!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
model.changePwd(person_id, ip_address, new_pwd, person_id);
|
|
|
|
|
lm.changePwd(person_id, ip_address, new_pwd, person_id);
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(true, "修改密码成功完成!"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据当前登录人员的ID获取人员信息
|
|
|
|
|
* 作者:吴缤
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 根据当前登录人员的ID获取人员信息
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -134,7 +140,7 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
|
|
try {
|
|
|
|
|
String personId = getCookie("person_id");
|
|
|
|
|
Record record = model.getLoginInfoByPersonId(personId);
|
|
|
|
|
Record record = lm.getLoginInfoByPersonId(personId);
|
|
|
|
|
if (record == null) {
|
|
|
|
|
resultJson.put("success", false);
|
|
|
|
|
resultJson.put("message", "获取登录信息异常!");
|
|
|
|
@ -152,25 +158,22 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****下面是打印帐号和输出EXCEL的功能*********************************************************/
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取市级管理员的原始帐号和原始密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取市级管理员的原始帐号和原始密码
|
|
|
|
|
* @param page 页码
|
|
|
|
|
* @param limit 每页条数
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsSysAdminInterface({"1"})
|
|
|
|
|
@IsNumericInterface({"page", "limit"})
|
|
|
|
|
public void getPrintCityManager(int page, int limit) {
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintCityManager(page, limit));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintCityManager(page, limit));
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(rs));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取市级管理员的原始帐号和原始密码(excel)
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取市级管理员的原始帐号和原始密码(excel)
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -182,7 +185,7 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
//转成 json对象
|
|
|
|
|
JSONObject jo = FileUtil.readJsonFile(filePath);
|
|
|
|
|
//导出
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintCityManager(1, 10000));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintCityManager(1, 10000));
|
|
|
|
|
String excelFile = excelPath + "excelTemp/" + UUID.randomUUID().toString().toUpperCase() + ".xls";
|
|
|
|
|
ExcelExportUtil.export(rs, jo, excelFile);
|
|
|
|
|
//提供下载
|
|
|
|
@ -191,23 +194,21 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取市级直属单位的帐号和原始密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取市级直属单位的帐号和原始密码
|
|
|
|
|
* @param page 页码
|
|
|
|
|
* @param limit 每页条数
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsSysAdminInterface({"1", "2"})
|
|
|
|
|
@IsNumericInterface({"page", "limit"})
|
|
|
|
|
public void getPrintCityBureau(int page, int limit) {
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintCityBureau(page, limit));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintCityBureau(page, limit));
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(rs));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取市级直属单位的帐号和原始密码(导出excel)
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取市级直属单位的帐号和原始密码(导出excel)
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -219,7 +220,7 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
//转成 json对象
|
|
|
|
|
JSONObject jo = FileUtil.readJsonFile(filePath);
|
|
|
|
|
//导出
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintCityBureau(1, 10000));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintCityBureau(1, 10000));
|
|
|
|
|
String excelFile = excelPath + "excelTemp/" + UUID.randomUUID().toString().toUpperCase() + ".xls";
|
|
|
|
|
ExcelExportUtil.export(rs, jo, excelFile);
|
|
|
|
|
//提供下载
|
|
|
|
@ -228,23 +229,21 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取县区管理员的帐号和原始密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取县区管理员的帐号和原始密码
|
|
|
|
|
* @param page 页码
|
|
|
|
|
* @param limit 每页条数
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsSysAdminInterface({"1", "2", "3"})
|
|
|
|
|
@IsNumericInterface({"page", "limit"})
|
|
|
|
|
public void getPrintAreaManager(int page, int limit) {
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintAreaManager(page, limit));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintAreaManager(page, limit));
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(rs));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取县区管理员的帐号和原始密码(导出EXCEL)
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取县区管理员的帐号和原始密码(导出EXCEL)
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -256,7 +255,7 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
//转成 json对象
|
|
|
|
|
JSONObject jo = FileUtil.readJsonFile(filePath);
|
|
|
|
|
//导出
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintAreaManager(1, 10000));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintAreaManager(1, 10000));
|
|
|
|
|
String excelFile = excelPath + "excelTemp/" + UUID.randomUUID().toString().toUpperCase() + ".xls";
|
|
|
|
|
ExcelExportUtil.export(rs, jo, excelFile);
|
|
|
|
|
//提供下载
|
|
|
|
@ -265,9 +264,10 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取县区下单位及学校的登录帐号和密码
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取县区下单位及学校的登录帐号和密码
|
|
|
|
|
* @param page 页码
|
|
|
|
|
* @param limit 每页条数
|
|
|
|
|
* @param area_id 县区id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -275,14 +275,13 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
@EmptyInterface({"area_id"})
|
|
|
|
|
@IsNumericInterface({"page", "limit"})
|
|
|
|
|
public void getPrintAreaBureau(int page, int limit, String area_id) {
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintAreaBureau(page, limit, area_id));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintAreaBureau(page, limit, area_id));
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(rs));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取县区下单位及学校的登录帐号和密码(导出EXCEL)
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 日期:2018-12-12
|
|
|
|
|
* 获取县区下单位及学校的登录帐号和密码(导出EXCEL)
|
|
|
|
|
* @param area_id 县区id
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -295,16 +294,11 @@ public class LoginPersonController extends Controller {
|
|
|
|
|
//转成 json对象
|
|
|
|
|
JSONObject jo = FileUtil.readJsonFile(filePath);
|
|
|
|
|
//导出
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(model.getPrintAreaBureau(1, 10000, area_id));
|
|
|
|
|
Page<?> rs = CommonUtil.ConvertLoginRs(lm.getPrintAreaBureau(1, 10000, area_id));
|
|
|
|
|
String excelFile = excelPath + "excelTemp/" + UUID.randomUUID().toString().toUpperCase() + ".xls";
|
|
|
|
|
ExcelExportUtil.export(rs, jo, excelFile);
|
|
|
|
|
//提供下载
|
|
|
|
|
String filename = "县区单位账号.xls";
|
|
|
|
|
renderFile(new File(excelFile), filename);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
System.setProperty("java.awt.headless", "true");
|
|
|
|
|
}
|
|
|
|
|
/*****打印帐号和输出EXCEL的功能结束*********************************************************/
|
|
|
|
|
}
|