main
黄海 2 years ago
parent bd5f146763
commit a7663ee9b2

@ -7,6 +7,7 @@ import com.dsideal.QingLong.Collect.Model.CollectModel;
import com.dsideal.QingLong.Interceptor.EmptyInterface;
import com.dsideal.QingLong.Interceptor.IsLoginInterface;
import com.dsideal.QingLong.Interceptor.IsNumericInterface;
import com.dsideal.QingLong.Interceptor.LayUiPageInfoInterface;
import com.dsideal.QingLong.LoginPerson.Model.LoginPersonModel;
import com.dsideal.QingLong.Util.CommonUtil;
import com.dsideal.QingLong.Util.SessionKit;
@ -485,10 +486,14 @@ public class CollectController extends Controller {
*
*
* @param job_name
* http://10.10.21.20:9000/QingLong/collect/getJobList?page=1&limit=10
*/
@Before({GET.class})
@IsLoginInterface({})
public void getJobList(String job_name, int page, int limit) {
@IsNumericInterface({"page", "limit"})
@LayUiPageInfoInterface({"page", "limit"})
public void getJobList(String job_name, int page, int limit) throws ParseException {
Page<Record> list = cm.getJobList(job_name, page, limit);
renderJson(CommonUtil.renderJsonForLayUI(list));
}

@ -853,7 +853,7 @@ public class CollectModel {
*
* @param job_name
*/
public Page<Record> getJobList(String job_name, int page, int limit) {
public Page<Record> getJobList(String job_name, int page, int limit) throws ParseException {
Kv kv = Kv.create();
if (!StrKit.isBlank(job_name)) kv.set("job_name", job_name);
SqlPara sqlPara = Db.getSqlPara("Collect.getJobList", kv);
@ -873,16 +873,32 @@ public class CollectModel {
long currentTime = System.currentTimeMillis();
Calendar calendar = Calendar.getInstance();
calendar.setTime(record.getDate("deadline_time"));
Date deadline_time = record.getDate("deadline_time");
if (deadline_time == null) {
String dateString = "2100-01-01"; // 假设这是你的初始日期字符串
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
deadline_time = dateFormat.parse(dateString);
}
calendar.setTime(deadline_time);
calendar.add(Calendar.DAY_OF_MONTH, 1);
// 比较 yourDate 和当前时间
if (calendar.getTime().getTime() > currentTime) {
record.set("jiezhi", true);
record.set("jiezhi", calendar.getTime().getTime() < currentTime);
if (record.getStr("create_time") != null) {
record.set("create_time", record.getStr("create_time").split(" ")[0]);
} else {
record.set("create_time", "-");
}
if (record.getStr("publish_time") != null) {
record.set("publish_time", record.getStr("publish_time").split(" ")[0]);
} else {
record.set("jiezhi", false);
record.set("publish_time", "-");
}
if (record.getStr("deadline_time") != null) {
record.set("deadline_time", record.getStr("deadline_time").split(" ")[0]);
} else {
record.set("deadline_time", "-");
}
}
return pageRecord;
}
}
Loading…
Cancel
Save