|
@@ -57,6 +57,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.mail.MessagingException;
|
|
|
import javax.mail.internet.MimeMessage;
|
|
|
import java.io.IOException;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -247,7 +248,56 @@ public class ReportExportController {
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
+ /**
|
|
|
+ * 个人报告导出状态
|
|
|
+ *
|
|
|
+ * @param wmTask
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @GetMapping("/exportZbReport/status")
|
|
|
+ public R exportZbReportStatus(WmTask wmTask) throws IOException {
|
|
|
+
|
|
|
+ String scorePackageDrugId = wmTask.getScorePackageDrugId();
|
|
|
|
|
|
+ // 判断是否是合并导出
|
|
|
+ if (scorePackageDrugId.contains(StrUtil.COMMA)) {
|
|
|
+ String[] idArr = scorePackageDrugId.split(StrUtil.COMMA);
|
|
|
+ scorePackageDrugId = Arrays.stream(idArr).sorted().collect(Collectors.joining(StrUtil.COMMA));
|
|
|
+ wmTask.setScorePackageDrugId(scorePackageDrugId);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String key = String.format(CacheConstants.EXPORT_ZB_REPORT_CACHE, wmTask.getScorePackageDrugId());
|
|
|
+
|
|
|
+ String o = redisTemplate.opsForValue().get(key);
|
|
|
+ WmReportOpt opt = new WmReportOpt();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(o)) {
|
|
|
+ // 生成中的
|
|
|
+ if ("GENERATING".equals(o)) {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATING);
|
|
|
+ }
|
|
|
+ // 生成失败的
|
|
|
+ else if (o.startsWith("ERROR")) {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.ERROR);
|
|
|
+ opt.setErrorMsg(o.split(StrUtil.UNDERLINE)[1]);
|
|
|
+ }
|
|
|
+ // 成功的
|
|
|
+ else {
|
|
|
+ Long expire = redisTemplate.opsForValue().getOperations().getExpire(key, TimeUnit.SECONDS);
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATED);
|
|
|
+ opt.setTtl(LocalDateTime.now().plusSeconds(expire));
|
|
|
+ opt.setLatestUrl(o);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.NOT_GENERATE);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok(opt);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 个人报告导出--导出汇总或详情 汇总和详情合为一个模版
|