|
@@ -6,10 +6,14 @@ import com.mooctest.dao.FinalReportDao;
|
|
|
import com.mooctest.data.FinalReportDTO;
|
|
|
import com.mooctest.data.TaskDTO;
|
|
|
import com.mooctest.model.FinalReport;
|
|
|
+import com.mooctest.util.HttpUtil;
|
|
|
import com.mooctest.util.ReportUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
import java.util.Date;
|
|
@@ -23,6 +27,9 @@ public class FinalReportService {
|
|
|
@Autowired
|
|
|
FinalReportDao finalReportDao;
|
|
|
|
|
|
+ @Value("${report.export.addr}")
|
|
|
+ String reportExportAddr;
|
|
|
+
|
|
|
public FinalReportDTO save(FinalReportDTO dto) {
|
|
|
|
|
|
FinalReport finalReport = new FinalReport();
|
|
@@ -70,7 +77,10 @@ public class FinalReportService {
|
|
|
public String getExportReportAddr(TaskDTO task) {
|
|
|
List<FinalReport> finalReports = finalReportDao.findByExamIdAndCaseId(task.getExamId(), task.getCaseId());
|
|
|
|
|
|
- return genJsonForExport(task, finalReports).toJSONString();
|
|
|
+ RestTemplate rt = HttpUtil.getRestTemplate();
|
|
|
+ JSONObject reportJson = genJsonForExport(task, finalReports);
|
|
|
+ String url = rt.postForObject(reportExportAddr, reportJson.toJSONString(), String.class);
|
|
|
+ return url;
|
|
|
}
|
|
|
|
|
|
private JSONObject genJsonForExport(TaskDTO task, List<FinalReport> finalReports) {
|