main
黄海 2 years ago
parent 0cfc289b21
commit 424b82e6d0

@ -106,6 +106,20 @@ public class YpController extends Controller {
renderJson(kv);
}
/**
*
*
* @param task_id
*/
@Before(POST.class)
@IsNumericInterface({"task_id"})
public void stopTask(int task_id) {
model.stopTask(task_id);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
/**
*
* http://www.chineseidcard.com/?region=110101&birthday=20210307&sex=1&num=5&r=28
@ -275,4 +289,14 @@ public class YpController extends Controller {
kv.set("message", "保存成功!");
renderJson(kv);
}
/**
*/
@Before(GET.class)
@IsNumericInterface({"task_id"})
public void getBx(int task_id) {
List<Record> list = model.getBx(task_id);
renderJson(CommonUtil.renderJsonForLayUI(list));
}
}

@ -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;
}
}
Loading…
Cancel
Save