|  | @@ -9,6 +9,7 @@ import org.slf4j.Logger;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.scheduling.annotation.Async;
 |  |  import org.springframework.scheduling.annotation.Async;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  | 
 |  | +import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import java.io.IOException;
 |  |  import java.io.IOException;
 | 
											
												
													
														|  |  import java.io.InputStream;
 |  |  import java.io.InputStream;
 | 
											
										
											
												
													
														|  | @@ -154,16 +155,53 @@ public class CommSendService {
 | 
											
												
													
														|  |              readOneFaultResistance(s, ref, f);
 |  |              readOneFaultResistance(s, ref, f);
 | 
											
												
													
														|  |          });
 |  |          });
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        // realExamService.updateOneState(re.getExamId(), RealExam.State.SUBMITTED);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        submit(re.getExamId());
 | 
											
												
													
														|  |          {
 |  |          {
 | 
											
												
													
														|  | -            RealExam re1 = realExamService.selectRealExamByExamId(re.getExamId());
 |  | 
 | 
											
												
													
														|  | -            re.setExamStatus(RealExam.State.SUBMITTED);
 |  | 
 | 
											
												
													
														|  | -            re.setEndTime(DateUtils.getNowDate());
 |  | 
 | 
											
												
													
														|  | -            realExamService.updateRealExam(re1);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            calculateScoreAsync(re.getExamId());
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  | 
 |  | +     * @param examId
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    @Transactional
 | 
											
												
													
														|  | 
 |  | +    public void submit(long examId) {
 | 
											
												
													
														|  | 
 |  | +        l.info("submit");
 | 
											
												
													
														|  | 
 |  | +        RealExam re1 = realExamService.selectRealExamByExamId(examId);
 | 
											
												
													
														|  | 
 |  | +        re1.setExamStatus(RealExam.State.SUBMITTED);
 | 
											
												
													
														|  | 
 |  | +        re1.setEndTime(DateUtils.getNowDate());
 | 
											
												
													
														|  | 
 |  | +        realExamService.updateRealExam(re1);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Async("tp-comm")
 | 
											
												
													
														|  | 
 |  | +    public void readOneExamAtLastAsync(RealExam re) {
 | 
											
												
													
														|  | 
 |  | +        readOneExamAtLast(re);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // todo:
 | 
											
												
													
														|  | 
 |  | +    // @Async
 | 
											
												
													
														|  | 
 |  | +    public void calculateScoreAsync(Long realExamId) {
 | 
											
												
													
														|  | 
 |  | +        calculateScore(realExamId);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 计算减分(不包括超时)。汇总到deduction_total_score字段。
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  | 
 |  | +     * @param realExamId
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public void calculateScore(Long realExamId) {
 | 
											
												
													
														|  | 
 |  | +        realExamService.updateOneState(realExamId, RealExam.State.CALCULATING_SCORE);
 | 
											
												
													
														|  | 
 |  | +        int minus = 0;
 | 
											
												
													
														|  | 
 |  | +        // 排除故障部分 + 维修报告选择部分
 | 
											
												
													
														|  | 
 |  | +        realExamFaultService.calculateMinusByRealExamId(realExamId);
 | 
											
												
													
														|  | 
 |  | +        // 超时部分
 | 
											
												
													
														|  | 
 |  | +        int timeoutMinute = 0;
 | 
											
												
													
														|  | 
 |  | +        //
 | 
											
												
													
														|  | 
 |  | +        realExamService.updateOneState(realExamId, RealExam.State.GOT_REPORT);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  |       * todo:????
 |  |       * todo:????
 | 
											
												
													
														|  |       * 定时任务。
 |  |       * 定时任务。
 | 
											
												
													
														|  |       */
 |  |       */
 |