main
HuangHai 3 months ago
parent 37518236bd
commit 935265a682

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