Commit d69a2b69 authored by neo.wang's avatar neo.wang

Merge branch 'dev_oracle_neo' into 'dev_oracle'

Dev oracle neo

See merge request root/atms!187
parents ef3d5130 a42f6e00
...@@ -53,8 +53,8 @@ public class ReportController { ...@@ -53,8 +53,8 @@ public class ReportController {
@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)
@ResponseBody @ResponseBody
public PeriodJob getJobStatus(@PathVariable String projectId, @PathVariable Integer period, @PathVariable String jobId) { public PeriodJobDto getJobStatus(@PathVariable String projectId, @PathVariable Integer period, @PathVariable String jobId) {
return reportService.getJobStatus(projectId, period, jobId); return new PeriodJobDto().copyFromPeriodJob(reportService.getJobStatus(projectId, period, jobId));
} }
@RequestMapping(value = "templateReferences/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "templateReferences/{period}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
......
package pwc.taxtech.atms.dto.vatdto;
import io.jsonwebtoken.lang.Collections;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.entity.PeriodJob;
import java.util.Date;
import java.util.List;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
@Getter
@Setter
public class PeriodJobDto {
private String id;
private String name;
private String currentStep;
private String projectId;
private Integer period;
private String stepsCode;
private Date createTime;
private String status;
private String errorMsg;
private String jobStatus;
public PeriodJobDto copyFromPeriodJob(PeriodJob job) {
this.id = job.getId();
this.name = job.getName();
this.currentStep = job.getCurrentStep();
this.projectId = job.getProjectId();
this.period = job.getPeriod();
this.stepsCode = job.getStepsCode();
this.createTime = job.getCreateTime();
this.status = job.getStatus();
this.errorMsg = job.getErrorMsg();
MyAsserts.assertNotEmpty(stepsCode, Exceptions.SERVER_ERROR_EXCEPTION);
if (StringUtils.isBlank(status)) this.jobStatus = STATUS_BEGIN;
else {
List<WrapPeriodJobDto.Task> tasks = WrapPeriodJobDto.fromJson(status);
if (Collections.isEmpty(tasks)) this.jobStatus = STATUS_BEGIN;
else {
String[] codes = stepsCode.split(",");
if (tasks.size() < codes.length) this.jobStatus = STATUS_RUNNING;
else {
this.jobStatus = tasks.stream().anyMatch(m -> m.status.equals(STATUS_ERROR)) ? STATUS_ERROR : STATUS_END;
}
}
}
return this;
}
}
...@@ -20,6 +20,7 @@ import java.util.UUID; ...@@ -20,6 +20,7 @@ import java.util.UUID;
public class WrapPeriodJobDto { public class WrapPeriodJobDto {
public static final String STATUS_BEGIN = "Begin"; public static final String STATUS_BEGIN = "Begin";
public static final String STATUS_RUNNING = "Running";
public static final String STATUS_CANCEL = "Cancel"; public static final String STATUS_CANCEL = "Cancel";
public static final String STATUS_ERROR = "Error"; public static final String STATUS_ERROR = "Error";
public static final String STATUS_END = "End"; public static final String STATUS_END = "End";
......
...@@ -95,6 +95,7 @@ public class ReportGeneratorImpl { ...@@ -95,6 +95,7 @@ public class ReportGeneratorImpl {
String code = sheet.getSheetName(); String code = sheet.getSheetName();
logger.info("-------------------------------------Begin Job [{}]------------------------------------------------------", code); logger.info("-------------------------------------Begin Job [{}]------------------------------------------------------", code);
setStatus(job,code,STATUS_BEGIN); setStatus(job,code,STATUS_BEGIN);
job.setCurrentStep(code);
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream() Optional<PeriodTemplate> periodTemplate = resources.getPeriodTemplates().stream()
......
...@@ -516,7 +516,7 @@ public class ReportServiceImpl { ...@@ -516,7 +516,7 @@ public class ReportServiceImpl {
} }
} }
}).start(); }).start();
operationResultDto.setData(genJob); operationResultDto.setData(new PeriodJobDto().copyFromPeriodJob(genJob));
operationResultDto.setResult(true); operationResultDto.setResult(true);
} catch (Exception ex) { } catch (Exception ex) {
operationResultDto.setResult(false); operationResultDto.setResult(false);
......
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
$scope.readonly = true; $scope.readonly = true;
if(data && data.result) if(data && data.result)
updateTasksStatus(data.data); updateTasksStatus(data.data);
if(data.data.status=='Begin'){ if(data.data.jobStatus=='Begin'||data.data.jobStatus=='Running'){
$scope.timer= $interval(function(){ $scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){ vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){
if(result.data && result.status == 200){ if(result.data && result.status == 200){
...@@ -299,6 +299,12 @@ ...@@ -299,6 +299,12 @@
} }
}); });
}
function isAllEnd(stepCode,status){
var statusList = JSON.parse(status);
var stepCodes = stepCode.split(",");
} }
var startCaculate = function () { var startCaculate = function () {
...@@ -551,43 +557,47 @@ ...@@ -551,43 +557,47 @@
}else{ }else{
$scope.tasks[0].items[0].status = 'completed'; $scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed'); $scope.tasks[0].items[0].text= $translate.instant('completed');
var items = $scope.tasks[1].items; var items = $scope.tasks[1].items;
var currentIndex = 0; if(job.jobStatus == 'End'){
items.forEach(function(item,index){ items.forEach(function(item,index){
if((job).currentStep == item.code){ item.status = 'completed';
currentIndex = index; });
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
} }
}else if(job.jobStatus=='Running'|| job.jobStatus=='Error'){
var tasks = JSON.parse(job)
items.forEach(function(item,index){
tasks.forEach(function(task){
if(task.code==item.code){
if(task.status == 'Error'){
item.status = 'error';
}else if(task.status == 'End'){
item.status = 'completed';
}else if(task.status == 'Begin'){
item.status = 'processing';
}
item.text = $translate.instant(item.status);
}
})
});
}); if(job.jobStatus == 'Error'){
if($scope.timer)$interval.cancel($scope.timer);
items.forEach(function(item,index){ }
if(index < currentIndex){
item.status ='completed';
}else if(index == currentIndex){
if(job.status == 'Error'){
item.status = 'error';
}else if(job.status == 'End'){
item.status = 'completed';
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
}else if(job.status == 'Begin'){
item.status = 'processing';
}
}
item.text = $translate.instant(item.status);
});
} }
}
} }
var getInitTaskStatus = function(){ var getInitTaskStatus = function(){
vatReportService.getRunningJob(vatSessionService.project.id,vatSessionService.month).then(function (result) { vatReportService.getRunningJob(vatSessionService.project.id,vatSessionService.month).then(function (result) {
if(result.data && result.status == 200){ if(result.data && result.status == 200){
updateTasksStatus(result.data); updateTasksStatus(result.data);
if(result.data.status=='Begin'){ if(result.data.jobStatus=='Begin'||result.data.jobStatus=='Running'){
$scope.timer= $interval(function(){ $scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id) vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id)
.success(function(result){ .success(function(result){
......
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