|
|
|
@ -9,7 +9,9 @@ import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.SqlPara;
|
|
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
public class YpModel {
|
|
|
|
|
|
|
|
|
@ -90,6 +92,27 @@ public class YpModel {
|
|
|
|
|
Db.update(sql, task_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:停止任务
|
|
|
|
|
*
|
|
|
|
|
* @param task_id
|
|
|
|
|
*/
|
|
|
|
|
public void stopTask(int task_id) {
|
|
|
|
|
String sql = "update t_yp_task set is_run=0 where task_id=?";
|
|
|
|
|
Db.update(sql, task_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取全局所有班型
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getAllBx() {
|
|
|
|
|
String sql = "select * from t_yp_bx where b_use=1";
|
|
|
|
|
List<Record> list = Db.find(sql);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据身份证号计算班型
|
|
|
|
|
*
|
|
|
|
@ -104,9 +127,7 @@ public class YpModel {
|
|
|
|
|
}
|
|
|
|
|
//解析出出生日期
|
|
|
|
|
String birth = IdcardUtil.getBirthByIdCard(sfzh);
|
|
|
|
|
|
|
|
|
|
String sql = "select * from t_yp_bx where b_use=1";
|
|
|
|
|
List<Record> list = Db.find(sql);
|
|
|
|
|
List<Record> list = getAllBx();
|
|
|
|
|
|
|
|
|
|
//当前年份
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
@ -233,4 +254,29 @@ public class YpModel {
|
|
|
|
|
String sql = "delete from t_yp_task_bx_limit where task_id=? and bx_id=?";
|
|
|
|
|
Db.update(sql, task_id, bx_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定任务下的班型选择情况
|
|
|
|
|
*
|
|
|
|
|
* @param task_id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getBx(int task_id) {
|
|
|
|
|
List<Record> all = getAllBx();
|
|
|
|
|
//本次任务的班型
|
|
|
|
|
String sql = "select * from t_yp_task_bx_limit where task_id=?";
|
|
|
|
|
List<Record> list = Db.find(sql, task_id);
|
|
|
|
|
Set<Integer> set = new HashSet<>();
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
set.add(record.getInt("bx_id"));
|
|
|
|
|
}
|
|
|
|
|
for (Record record : all) {
|
|
|
|
|
if (set.contains(record.getInt("bx_id"))) {
|
|
|
|
|
record.set("selected", true);
|
|
|
|
|
} else {
|
|
|
|
|
record.set("selected", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return all;
|
|
|
|
|
}
|
|
|
|
|
}
|