|
|
|
@ -1,18 +1,12 @@
|
|
|
|
|
package com.dsideal.FengHuang.Yp.Model;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import com.dsideal.FengHuang.Interceptor.EmptyInterface;
|
|
|
|
|
import com.dsideal.FengHuang.Interceptor.IsNumericInterface;
|
|
|
|
|
import com.dsideal.FengHuang.LoginPerson.Model.LoginPersonModel;
|
|
|
|
|
import com.dsideal.FengHuang.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.FengHuang.Util.IpUtil;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Page;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.SqlPara;
|
|
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class YpModel {
|
|
|
|
@ -77,13 +71,48 @@ public class YpModel {
|
|
|
|
|
String sql = "update t_yp_task set b_use=0 where task_id=?";
|
|
|
|
|
Db.update(sql, task_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:启动任务
|
|
|
|
|
*
|
|
|
|
|
* @param task_id
|
|
|
|
|
*/
|
|
|
|
|
public void startTask(int task_id){
|
|
|
|
|
public void startTask(int task_id) {
|
|
|
|
|
String sql = "update t_yp_task set b_use=1,is_run=1 where task_id=?";
|
|
|
|
|
Db.update(sql, task_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据身份证号计算班型
|
|
|
|
|
*
|
|
|
|
|
* @param sfzh
|
|
|
|
|
*/
|
|
|
|
|
public int evalBx(String sfzh) {
|
|
|
|
|
if (!IdcardUtil.isValidCard(sfzh)) return -1;//-1代表身份证不合法
|
|
|
|
|
//解析出出生日期
|
|
|
|
|
String birth = IdcardUtil.getBirthByIdCard(sfzh);
|
|
|
|
|
|
|
|
|
|
String sql = "select * from t_yp_bx where b_use=1";
|
|
|
|
|
List<Record> list = Db.find(sql);
|
|
|
|
|
|
|
|
|
|
//当前年份
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
int year = calendar.get(Calendar.YEAR);
|
|
|
|
|
int result = -2;
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
int bx_id = record.getInt("bx_id");
|
|
|
|
|
int start_year_num = record.getInt("start_year_num");
|
|
|
|
|
int end_year_num = record.getInt("end_year_num");
|
|
|
|
|
String start_month_day = record.getStr("start_month_day");
|
|
|
|
|
String end_month_day = record.getStr("end_month_day");
|
|
|
|
|
|
|
|
|
|
String st = year - start_year_num + start_month_day;
|
|
|
|
|
String ed = year - end_year_num + end_month_day;
|
|
|
|
|
if (birth.compareTo(st) >= 0 && birth.compareTo(ed) <= 0) {
|
|
|
|
|
result = bx_id;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;//如果result=-2表示不在指定的时间段内
|
|
|
|
|
}
|
|
|
|
|
}
|