Commit a53b3ae4 authored by neo's avatar neo

[Bugfix] fixed init formual status

parent 833f7caa
...@@ -47,8 +47,11 @@ public class ReportController { ...@@ -47,8 +47,11 @@ public class ReportController {
@RequestMapping(value = "getRunningJob/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getRunningJob/{projectId}/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody @ResponseBody
public PeriodJob getRunningJob(@PathVariable String projectId, @PathVariable Integer period) { public PeriodJobDto getRunningJob(@PathVariable String projectId, @PathVariable Integer period) {
return reportService.getRunningJob(projectId, period); PeriodJob job = reportService.getRunningJob(projectId, period);
if (job != null)
return new PeriodJobDto().copyFromPeriodJob(job);
else return null;
} }
@RequestMapping(value = "getJobStatus/{projectId}//{period}/{jobId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getJobStatus/{projectId}//{period}/{jobId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......
...@@ -46,10 +46,9 @@ public class PeriodJobDto { ...@@ -46,10 +46,9 @@ public class PeriodJobDto {
if (Collections.isEmpty(tasks)) this.jobStatus = STATUS_BEGIN; if (Collections.isEmpty(tasks)) this.jobStatus = STATUS_BEGIN;
else { else {
String[] codes = stepsCode.split(","); String[] codes = stepsCode.split(",");
if (tasks.size() < codes.length) this.jobStatus = STATUS_RUNNING; if (tasks.stream().anyMatch(m -> m.status.equals(STATUS_ERROR))) this.jobStatus = STATUS_ERROR;
else { else if (tasks.size() < codes.length) this.jobStatus = STATUS_RUNNING;
this.jobStatus = tasks.stream().anyMatch(m -> m.status.equals(STATUS_ERROR)) ? STATUS_ERROR : STATUS_END; else this.jobStatus = STATUS_END;
}
} }
} }
......
...@@ -120,7 +120,7 @@ public interface PeriodJobMapper extends MyVatMapper { ...@@ -120,7 +120,7 @@ public interface PeriodJobMapper extends MyVatMapper {
"FROM " + "FROM " +
" PERIOD_JOB " + " PERIOD_JOB " +
"WHERE " + "WHERE " +
" STATUS = 'Begin' " + " STATUS LIKE '%Begin%' " +
" AND PROJECT_ID = #{projectId} " + " AND PROJECT_ID = #{projectId} " +
" AND PERIOD =#{period}") " AND PERIOD =#{period}")
PeriodJob getRunningJob(@Param("projectId") String projectId, @Param("period") Integer period); PeriodJob getRunningJob(@Param("projectId") String projectId, @Param("period") Integer period);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment