main
黄海 10 months ago
parent f163e02a63
commit 0434530a2d

@ -58,6 +58,15 @@
{{# }); }}
</script>
</div>
<div class="layui-form-item">
<label for="name" class="layui-form-label">
<span class="we-red">*</span>手机:
</label>
<div class="layui-input-inline ">
<input type="text" id="telephone" name="telephone" lay-verify="required|contentLength" min="11" max="11"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
<span class="we-red">*</span>民族:
@ -541,7 +550,8 @@
zc_id: f.zc,
t_teaching_date: f.rjrq,
t_duty_charge: JSON.stringify(jsonData),
zzmm: f.zzmm
zzmm: f.zzmm,
telephone:f.telephone
},
success: function (data) {
if (data.success) {

@ -57,6 +57,15 @@
{{# }); }}
</script>
</div>
<div class="layui-form-item">
<label for="name" class="layui-form-label">
<span class="we-red">*</span>手机:
</label>
<div class="layui-input-inline ">
<input type="text" id="telephone" name="telephone" lay-verify="required|contentLength" min="11" max="11"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="" class="layui-form-label">
<span class="we-red">*</span>民族:
@ -410,7 +419,7 @@
birthday: data.birthday.substr(0, 10),
rjrq: data.t_teaching_date,
sort_id: data.sort_id,
telephone:data.telephone
})
$("#xl option[value='" + data.t_xl_id + "']").attr("selected", true);
$("#sel3 option[value='" + data.t_stage_id + "']").attr("selected", true);
@ -587,7 +596,8 @@
zc_id: f.zc,
t_teaching_date: f.rjrq,
t_duty_charge: JSON.stringify(jsonData),
zzmm:f.zzmm
zzmm:f.zzmm,
telephone:f.telephone
},
success: function (data) {
if (data.success) {

@ -1,5 +1,6 @@
package com.dsideal.base.Teacher.Controller;
import cn.hutool.core.util.PhoneUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dsideal.base.ExcelImportTemplate.TeacherImportExcelUtil;
@ -14,7 +15,6 @@ import com.jfinal.ext.interceptor.GET;
import com.jfinal.ext.interceptor.POST;
import com.jfinal.kit.PathKit;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.upload.UploadFile;
@ -27,7 +27,7 @@ import java.util.UUID;
@SuppressWarnings("unchecked")
public class TeacherController extends Controller {
TeacherModel _teacherModel = new TeacherModel();
TeacherModel tm = new TeacherModel();
/**
@ -38,20 +38,20 @@ public class TeacherController extends Controller {
@Before({POST.class})
@IsLoginInterface({})
@IsGuidInterface({"org_id"})
@EmptyInterface({"org_id", "person_name", "t_teaching_date", "xl_id", "zc_id", "xb", "mz", "t_duty_charge", "zzmm"})
@EmptyInterface({"org_id", "person_name", "t_teaching_date", "xl_id", "zc_id", "xb", "mz", "t_duty_charge", "zzmm", "telephone"})
@IsSysAdminInterface({"1", "4"})
@IsNumericInterface({"stage_id", "subject_id", "sort_id"})
@AuthorityInterface({})
@LengthInterface({"person_name,2,64", "xl_id,2,2", "zc_id,2,2"})
public void addTeacher(String org_id, String person_name, String t_teaching_date, String xl_id,
String zc_id, String xb, String mz, String t_duty_charge, String zzmm, String id_card, String birthday, int sort_id
String zc_id, String xb, String mz, String t_duty_charge, String zzmm, String id_card, String birthday, int sort_id, String telephone
, int stage_id, int subject_id) {
JSONObject resultJson = new JSONObject();
try {
//判断姓名长度
if (person_name.length() > 36) {
resultJson.put("success", false);
resultJson.put("message", "教师姓名长度不正确!");
resultJson.put("message", "职工姓名长度不正确!");
renderJson(resultJson);
return;
}
@ -108,6 +108,23 @@ public class TeacherController extends Controller {
renderJson(resultJson);
return;
}
//判断是不是合法的手机号
boolean isValid = PhoneUtil.isMobile(telephone);
if (!isValid) {
resultJson.put("success", false);
resultJson.put("message", "手机号码不正确!");
renderJson(resultJson);
return;
}
//检查手机号码是不是唯一
Record rPerson = tm.getPersonByTelephone(telephone);
if (rPerson != null) {
resultJson.put("success", false);
resultJson.put("message", "手机号码已存在!");
renderJson(resultJson);
return;
}
//获取部门所在单位ID
String bureauId = rs.get(0).get("bureau_id").toString();
String cityId = rs.get(0).get("city_id").toString();
@ -123,22 +140,19 @@ public class TeacherController extends Controller {
//客户端ip_address
String ip_address = IpUtil.getIpAddr(getRequest());
if (_teacherModel.addTeacherInfo(pwd, person_name, org_id, xb, mz, id_card, birthday, originalPwd, cityId, areaId, mainSchoolId, bureauId, xl_id, stage_id, subject_id, zc_id, t_teaching_date, sort_id, t_duty_charge, zzmm, operator, ip_address)) {
if (tm.addTeacherInfo(pwd, person_name, org_id, xb, mz, id_card, birthday, originalPwd, cityId, areaId, mainSchoolId, bureauId, xl_id, stage_id, subject_id, zc_id, t_teaching_date, sort_id, t_duty_charge, zzmm, operator, ip_address, telephone)) {
resultJson.put("success", true);
renderJson(resultJson);
return;
} else {
resultJson.put("success", false);
resultJson.put("message", "增加教师异常!");
resultJson.put("message", "增加职工异常!");
renderJson(resultJson);
return;
}
} catch (Exception e) {
e.printStackTrace();
resultJson.put("success", false);
resultJson.put("message", "增加教师异常!");
resultJson.put("message", "增加职工异常!");
renderJson(resultJson);
return;
}
}
@ -159,25 +173,22 @@ public class TeacherController extends Controller {
try {
Page<?> dt;
if (person_name == null || person_name == "") {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByOrgId(org_id, page, limit));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByOrgId(org_id, page, limit));
} else {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByOrgIdPersonName(org_id, person_name, page, limit));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByOrgIdPersonName(org_id, person_name, page, limit));
}
if (dt == null) {
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
} else {
renderJson(CommonUtil.renderJsonForLayUI(dt));
return;
}
} catch (Exception e) {
e.printStackTrace();
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
}
}
@ -197,13 +208,13 @@ public class TeacherController extends Controller {
try {
Page<?> dt;
if (person_name == null || person_name == "") {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByBureauId(bureau_id, page, limit));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByBureauId(bureau_id, page, limit));
} else {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByPersonNameAndBureauId(bureau_id, person_name, page, limit));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByPersonNameAndBureauId(bureau_id, person_name, page, limit));
}
if (dt == null) {
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
} else {
@ -213,7 +224,7 @@ public class TeacherController extends Controller {
} catch (Exception e) {
e.printStackTrace();
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
}
@ -234,13 +245,13 @@ public class TeacherController extends Controller {
try {
Page<?> dt;
if (person_name == null || person_name == "") {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByBureauId(bureau_id, 1, 10000));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByBureauId(bureau_id, 1, 10000));
} else {
dt = CommonUtil.ConvertLoginRs(_teacherModel.getTeacherListByPersonNameAndBureauId(bureau_id, person_name, 1, 10000));
dt = CommonUtil.ConvertLoginRs(tm.getTeacherListByPersonNameAndBureauId(bureau_id, person_name, 1, 10000));
}
if (dt == null) {
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
} else {
@ -253,14 +264,14 @@ public class TeacherController extends Controller {
String excelFile = excelPath + "excelTemp/" + UUID.randomUUID().toString().toUpperCase() + ".xls";
ExcelExportUtil.export(dt, jo, excelFile);
//提供下载
String filename = "教师账号.xls";
String filename = "职工账号.xls";
renderFile(new File(excelFile), filename);
return;
}
} catch (Exception e) {
e.printStackTrace();
resultJson.put("success", false);
resultJson.put("message", "获取教师列表异常!");
resultJson.put("message", "获取职工列表异常!");
renderJson(resultJson);
return;
}
@ -278,7 +289,7 @@ public class TeacherController extends Controller {
@AuthorityInterface({})
public void getTeacherInfoByTeacherId(String person_id) {
try {
Record record = _teacherModel.getTeacherInfoByTeacherId(person_id);
Record record = tm.getTeacherInfoByTeacherId(person_id);
if (record != null) {
//替换掉职务与分管工作为JSON对象
@ -315,7 +326,7 @@ public class TeacherController extends Controller {
return;
} else {
record.set("success", false);
record.set("message", "获取教师信息异常,人员不存在!");
record.set("message", "获取职工信息异常,人员不存在!");
renderJson(record);
return;
}
@ -323,9 +334,8 @@ public class TeacherController extends Controller {
e.printStackTrace();
Record record = new Record();
record.set("success", false);
record.set("message", "获取教师信息异常!");
record.set("message", "获取职工信息异常!");
renderJson(record);
return;
}
}
@ -336,7 +346,7 @@ public class TeacherController extends Controller {
*/
@Before({POST.class})
@IsLoginInterface({})
@EmptyInterface({"person_id", "person_name", "org_id", "t_duty_charge", "xl_id", "zc_id", "xb", "mz", "zzmm"})
@EmptyInterface({"person_id", "person_name", "org_id", "t_duty_charge", "xl_id", "zc_id", "xb", "mz", "zzmm", "telephone"})
@IsNumericInterface({"sort_id", "stage_id", "subject_id"})
@IsSysAdminInterface({"1", "4"})
@AuthorityInterface({})
@ -345,14 +355,14 @@ public class TeacherController extends Controller {
String t_duty_charge, String xl_id,
String xb, String mz, String zzmm,
int sort_id, String zc_id, String org_id, String id_card, String birthday, String t_teaching_date,
int stage_id, int subject_id) {
int stage_id, int subject_id, String telephone) {
JSONObject resultJson = new JSONObject();
try {
//判断姓名长度
if (person_name.length() > 36) {
resultJson.put("success", false);
resultJson.put("message", "教师姓名长度不正确!");
resultJson.put("message", "职工姓名长度不正确!");
renderJson(resultJson);
return;
}
@ -401,28 +411,42 @@ public class TeacherController extends Controller {
return;
}
//判断是不是合法的手机号
boolean isValid = PhoneUtil.isMobile(telephone);
if (!isValid) {
resultJson.put("success", false);
resultJson.put("message", "手机号码不正确!");
renderJson(resultJson);
return;
}
//检查手机号码是不是唯一
Record rPerson = tm.getPersonByTelephone(telephone);
if (rPerson != null && !rPerson.getStr("person_id").equals(person_id)) {
resultJson.put("success", false);
resultJson.put("message", "手机号码已存在!");
renderJson(resultJson);
return;
}
//操作人
String operator = getCookie("person_id");
//客户端ip_address
String ip_address = IpUtil.getIpAddr(getRequest());
if (_teacherModel.updateTeacher(person_id, person_name, xb, mz, id_card, birthday, xl_id, stage_id, subject_id, zc_id, t_teaching_date, sort_id, t_duty_charge, org_id, zzmm, operator, ip_address)) {
if (tm.updateTeacher(person_id, person_name, xb, mz, id_card, birthday, xl_id, stage_id, subject_id, zc_id, t_teaching_date, sort_id, t_duty_charge, org_id, zzmm, operator, ip_address,telephone)) {
resultJson.put("success", true);
renderJson(resultJson);
return;
} else {
resultJson.put("success", false);
resultJson.put("message", "修改教师信息异常!");
resultJson.put("message", "修改职工信息异常!");
renderJson(resultJson);
return;
}
} catch (Exception e) {
e.printStackTrace();
resultJson.put("success", false);
resultJson.put("message", "修改教师信息异常!");
resultJson.put("message", "修改职工信息异常!");
renderJson(resultJson);
return;
}
}
@ -448,7 +472,7 @@ public class TeacherController extends Controller {
for (int i = 0; i < teacherArr.length; i++) {
String teacherId = teacherArr[i];
if (!_teacherModel.deleteTeacher(teacherId, operator, ip_address)) {
if (!tm.deleteTeacher(teacherId, operator, ip_address)) {
resultJson.put("success", false);
resultJson.put("message", "删除教师异常!");
renderJson(resultJson);
@ -485,7 +509,7 @@ public class TeacherController extends Controller {
String ip_address = IpUtil.getIpAddr(getRequest());
for (int i = 0; i < personIdArray.length; i++) {
_teacherModel.changeOrgByPersonIdAndOrgId(personIdArray[i], org_id, operator, ip_address);
tm.changeOrgByPersonIdAndOrgId(personIdArray[i], org_id, operator, ip_address);
}
JSONObject resultJson = new JSONObject();
resultJson.put("success", true);

@ -23,7 +23,7 @@ public class TeacherModel {
*
* @return
*/
public boolean addTeacherInfo(String personId, String pwd, String person_name, String org_id, String xb, String mz, String id_card, String birthday, String original_pwd, String city_id, String area_id, String main_school_id, String bureau_id, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String zzmm, String operator, String ip_address) {
public boolean addTeacherInfo(String personId, String pwd, String person_name, String org_id, String xb, String mz, String id_card, String birthday, String original_pwd, String city_id, String area_id, String main_school_id, String bureau_id, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String zzmm, String operator, String ip_address,String telephone) {
boolean flag = false;
try {
long pk = PkUtil.GetPersonNumPk(5, 1);
@ -61,6 +61,7 @@ public class TeacherModel {
record.set("t_teaching_date", t_teaching_date);
record.set("operator", operator);
record.set("ip_address", IpUtil.ipToLong(ip_address));
record.set("telephone",telephone);
Db.save("t_sys_loginperson", record);
//继续保存人员职务与分管工作
JSONArray jsonArray = JSONArray.parseArray(t_duty_charge);
@ -86,11 +87,12 @@ public class TeacherModel {
}
return flag;
}
public boolean addTeacherInfo(String pwd, String person_name, String org_id, String xb, String mz, String id_card, String birthday, String original_pwd, String city_id, String area_id, String main_school_id, String bureau_id, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String zzmm, String operator, String ip_address) {
public boolean addTeacherInfo(String pwd, String person_name, String org_id, String xb, String mz, String id_card, String birthday, String original_pwd, String city_id, String area_id, String main_school_id, String bureau_id, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String zzmm, String operator, String ip_address,String telephone) {
String personId = UUID.randomUUID().toString().toUpperCase();
return addTeacherInfo(personId, pwd, person_name, org_id, xb, mz, id_card, birthday, original_pwd, city_id,
area_id, main_school_id, bureau_id, xl_id, stage_id, subject_id, zc_id, t_teaching_date,
sort_id, t_duty_charge, zzmm, operator, ip_address);
sort_id, t_duty_charge, zzmm, operator, ip_address,telephone);
}
/**
@ -106,7 +108,7 @@ public class TeacherModel {
* @param birthday
* @return
*/
public boolean updateTeacher(String person_id, String person_name, String xb, String mz, String id_card, String birthday, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String org_id, String zzmm, String operator, String ip_address) {
public boolean updateTeacher(String person_id, String person_name, String xb, String mz, String id_card, String birthday, String xl_id, int stage_id, int subject_id, String zc_id, String t_teaching_date, int sort_id, String t_duty_charge, String org_id, String zzmm, String operator, String ip_address,String telephone) {
boolean flag = false;
try {
@ -145,6 +147,7 @@ public class TeacherModel {
record.set("zzmm", zzmm);
record.set("operator", operator);
record.set("ip_address", IpUtil.ipToLong(ip_address));
record.set("telephone",telephone);
record.remove("update_ts");
Db.update("t_sys_loginperson", "person_id", record);
//继续保存人员职务与分管工作
@ -309,4 +312,14 @@ public class TeacherModel {
flag = true;
return flag;
}
/**
*
* @param telephone
* @return
*/
public Record getPersonByTelephone(String telephone) {
String sql = "select * from t_sys_loginperson where telephone=?";
return Db.findFirst(sql, telephone);
}
}

@ -86,7 +86,7 @@
-- 根据人员的ID获取此人员的登录信息
#sql("getLoginInfoByPersonId")
select person_id,person_name,identity_id,login_name,pwd,original_pwd,xb,zzmm,mz,idcard_code,birthday,create_time,sort_id,telephone,wx_openid,qq_openid,email,status_code,b_use,identity_pk_num,city_id,area_id,main_school_id,bureau_id,org_id,s_class_id,s_xjh,s_xjfh,s_source,
t_duty_charge,t_xl_id,t_zc_id,t_stage_id,t_subject_id,date_format(t_teaching_date,'%Y-%m-%d') as t_teaching_date,p_child_id,
t_duty_charge,t_xl_id,t_zc_id,t_stage_id,t_subject_id,telephone,date_format(t_teaching_date,'%Y-%m-%d') as t_teaching_date,p_child_id,
update_ts from t_sys_loginperson where person_id =?
#end

@ -2,7 +2,7 @@
driverClassName=com.mysql.cj.jdbc.Driver
user=root
password=DsideaL147258369
jdbcUrl=jdbc:mysql://10.10.14.210:22066/dsexam_db?rewriteBatchedStatements=true&useUnicode=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
jdbcUrl=jdbc:mysql://10.10.14.210:22066/ds_db?rewriteBatchedStatements=true&useUnicode=true&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
# redis
redis_ip=10.10.14.210
redis_port=6379

@ -2,7 +2,7 @@
driverClassName=com.mysql.cj.jdbc.Driver
user=ylt
password=Ycharge666
jdbcUrl=jdbc:mysql://rm-bp1ux6tuk49er80t9.mysql.rds.aliyuncs.com:3306/dsexam_db?useUnicode=true&characterEncoding=UTF-8
jdbcUrl=jdbc:mysql://rm-bp1ux6tuk49er80t9.mysql.rds.aliyuncs.com:3306/ds_db?useUnicode=true&characterEncoding=UTF-8
# redis
redis_ip=r-bp14c1p5j5lkpw1jc2.redis.rds.aliyuncs.com
redis_port=6379

Loading…
Cancel
Save