main
HuangHai 3 months ago
parent 37518236bd
commit 935265a682

@ -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 01vue
*/
@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的功能结束*********************************************************/
}
Loading…
Cancel
Save