kgdxpr 1 year ago
commit 49764d0e53

@ -82,7 +82,7 @@ public class TeacherYdController extends Controller {
//客户端ip_address
String ip_address = IpUtil.getIpAddr(getRequest());
boolean result = model.updateTeacherStatus(person_id, status_code, operator, ip_address);
boolean result = model.updateTeacherStatus(person_id, status_code, operator, IpUtil.ipToLong(ip_address));
if (result) {
renderJson(CommonUtil.returnMessageJson(true, "修改成功!"));
} else {
@ -268,16 +268,16 @@ public class TeacherYdController extends Controller {
public void deleteTransferInfoById(int id) {
//1、是登录人员本单位申请的
List<Record> records = model.getTeacherTransferInfoById(id);
if (records == null || records.size() == 0) {
if (records == null || records.isEmpty()) {
renderJson(CommonUtil.returnMessageJson(false, "没有找到此教师调动的业务ID!"));
return;
}
String source_bureau_id = records.get(0).getStr("source_bureau_id");
String source_bureau_id = records.getFirst().getStr("source_bureau_id");
String personId = SessionKit.get(getRequest(), getResponse(), "person_id");
String identity_id = SessionKit.get(getRequest(), getResponse(), "identity_id");
LoginPersonModel _loginPersonModel = new LoginPersonModel();
Record obj = _loginPersonModel.getLoginInfoByPersonId(personId);
if (identity_id.equals("4") && !obj.get("bureau_id").equals(source_bureau_id)) {
if (identity_id != null && identity_id.equals("4") && !obj.get("bureau_id").equals(source_bureau_id)) {
renderJson(CommonUtil.returnMessageJson(false, "此ID不是您所在单位范围内的申请ID!"));
return;
}
@ -288,7 +288,7 @@ public class TeacherYdController extends Controller {
return;
}
//3、是不是对方还没有审核
int status_id = records.get(0).getInt("status_id");
int status_id = records.getFirst().getInt("status_id");
if (status_id > 1) {
renderJson(CommonUtil.returnMessageJson(false, "此记录已被对方审核处理,不能删除!"));
return;

@ -2,7 +2,6 @@ package com.dsideal.QingLong.TeacherYd.Model;
import cn.hutool.core.date.DateTime;
import com.dsideal.QingLong.LoginPerson.Model.LoginPersonModel;
import com.dsideal.QingLong.Util.CommonUtil;
import com.dsideal.QingLong.Util.IpUtil;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
@ -34,13 +33,13 @@ public class TeacherYdModel {
*
* @return
*/
public boolean updateTeacherStatus(String person_id, String status_code, String operator, String ip_address) {
public boolean updateTeacherStatus(String person_id, String status_code, String operator, long ip_address) {
List<Record> rs = get_dm_status_teacher_by_code(status_code);
if (rs != null && !rs.isEmpty()) {
int change_person_b_use = rs.getFirst().getInt("change_person_b_use");
//修改人员主表
String sql = Db.getSql("teacherYd.updateTeacherStatus");
Db.update(sql, change_person_b_use, status_code, operator, IpUtil.ipToLong(ip_address), person_id);
Db.update(sql, change_person_b_use, status_code, operator, ip_address, person_id);
return true;
} else {
return false;
@ -125,7 +124,7 @@ public class TeacherYdModel {
record.set("ip_address", IpUtil.ipToLong(ip_address));
Db.save("t_transfer_apply", record);
//设置为更换单位的状态(系统内)
updateTeacherStatus(person_id, "03", operator, ip_address);
updateTeacherStatus(person_id, "03", operator, IpUtil.ipToLong(ip_address));
return record.getInt("id");
}
@ -211,10 +210,10 @@ public class TeacherYdModel {
*/
public void deleteTransferInfoById(int id, String operator, String ip_address) {
String sql = Db.getSql("teacherYd.deleteTransferInfoById");
Db.update(sql, operator, ip_address, id);
Db.update(sql, operator, IpUtil.ipToLong(ip_address), id);
//修改为正常状态
List<Record> records = getTeacherTransferInfoById(id);
updateTeacherStatus(records.get(0).getStr("person_id"), "01", operator, ip_address);
updateTeacherStatus(records.getFirst().getStr("person_id"), "01", operator, IpUtil.ipToLong(ip_address));
}
/**

@ -35,13 +35,13 @@ public class IpUtil {
//IP转换为Long
public static long ipToLong(String ip) {
String[] ipArray = ip.split("\\.");
List ipNums = new ArrayList();
List<Long> ipNums = new ArrayList<>();
for (int i = 0; i < 4; ++i) {
ipNums.add(Long.valueOf(Long.parseLong(ipArray[i].trim())));
ipNums.add(Long.parseLong(ipArray[i].trim()));
}
long ZhongIPNumTotal = ((Long) ipNums.get(0)).longValue() * 256L * 256L * 256L
+ ((Long) ipNums.get(1)).longValue() * 256L * 256L + ((Long) ipNums.get(2)).longValue() * 256L
+ ((Long) ipNums.get(3)).longValue();
long ZhongIPNumTotal = ipNums.get(0) * 256L * 256L * 256L
+ ipNums.get(1) * 256L * 256L + ipNums.get(2) * 256L
+ ipNums.get(3);
return ZhongIPNumTotal;
}

Loading…
Cancel
Save