|
@@ -62,6 +62,90 @@ public class ExcelReportExportController {
|
|
|
private final RedisTemplate<String,String> redisTemplate;
|
|
|
private final RabbitMqClient rabbitMqClient;
|
|
|
|
|
|
+ /**
|
|
|
+ * 结算报告管理--导出汇总或详情
|
|
|
+ * @param wmReport
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @GetMapping("/exportNbReviewReport")
|
|
|
+ public R exportNbReviewReport(WmReport wmReport) {
|
|
|
+
|
|
|
+
|
|
|
+ String key = String.format(CacheConstants.EXCEL_EXPORT_NB_REVIEW_REPORT_CACHE, wmReport.getId());
|
|
|
+
|
|
|
+ String o = redisTemplate.opsForValue().get(key);
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(o) && WmReportOpt.WmReportOptStatus.GENERATING.name().equals(o)){
|
|
|
+
|
|
|
+ return R.failed("已有在途生成记录,能耐心等待");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ BaseMap map = new BaseMap();
|
|
|
+ map.put("requestBody", JSONUtil.toJsonStr(wmReport));
|
|
|
+ map.put("username",user.getUsername());
|
|
|
+ map.put("deptId",user.getDeptId());
|
|
|
+ map.put("approvalOpinion", null);
|
|
|
+
|
|
|
+ rabbitMqClient.sendMessage(MqConstants.DIRECT_MODE_EXCEL_REPORT_EXPORT_NB_REVIEW_QUEUE,map);
|
|
|
+
|
|
|
+ redisTemplate.opsForValue().set(key, WmReportOpt.WmReportOptStatus.GENERATING.name(),
|
|
|
+ CacheConstants.DEF_REPORT_CREATING_TTL, TimeUnit.MILLISECONDS);
|
|
|
+
|
|
|
+ return R.ok("开始导出,请耐心等待");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 结算报告管理--导出汇总或详情
|
|
|
+ *
|
|
|
+ * @param wmReport
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @GetMapping("/exportNbReviewReport/status")
|
|
|
+ public R exportNbReviewReportStatus(WmReport wmReport) {
|
|
|
+
|
|
|
+ String key = String.format(CacheConstants.EXCEL_EXPORT_NB_REVIEW_REPORT_CACHE, wmReport.getId());
|
|
|
+
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+ // 生成失败的2
|
|
|
+ else if (!o.startsWith("http")) {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.ERROR);
|
|
|
+ opt.setErrorMsg(o);
|
|
|
+ }
|
|
|
+ // 成功的
|
|
|
+ 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);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 结算报告管理--导出汇总或详情
|
|
|
* @param wmReport
|
|
@@ -99,6 +183,111 @@ public class ExcelReportExportController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 个人报告导出状态
|
|
|
+ *
|
|
|
+ * @param wmTask
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @GetMapping("/exportZbReviewReport/status")
|
|
|
+ public R exportZbReviewReportStatus(WmTask wmTask) {
|
|
|
+
|
|
|
+ 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.EXCEL_EXPORT_ZB_REVIEW_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]);
|
|
|
+ }
|
|
|
+ // 生成失败的2
|
|
|
+ else if (!o.startsWith("http")) {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.ERROR);
|
|
|
+ opt.setErrorMsg(o);
|
|
|
+ }
|
|
|
+ // 成功的
|
|
|
+ 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);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 个人报告导出--导出汇总或详情 汇总和详情合为一个模版(只导出待审核的任务)
|
|
|
+ * @param wmTask
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @GetMapping("/exportZbReviewReport")
|
|
|
+ public R<?> exportZbReviewReport(WmTask wmTask) {
|
|
|
+
|
|
|
+ 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.EXCEL_EXPORT_ZB_REVIEW_REPORT_CACHE, wmTask.getScorePackageDrugId());
|
|
|
+
|
|
|
+ String o = redisTemplate.opsForValue().get(key);
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(o) && WmReportOpt.WmReportOptStatus.GENERATING.name().equals(o)){
|
|
|
+
|
|
|
+ return R.failed("已有在途生成记录,能耐心等待");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ HnqzUser user = SecurityUtils.getUser();
|
|
|
+ BaseMap map = new BaseMap();
|
|
|
+ map.put("requestBody", JSONUtil.toJsonStr(wmTask));
|
|
|
+ map.put("username",user.getUsername());
|
|
|
+ map.put("deptId",user.getDeptId());
|
|
|
+ map.put("taskStatus", "2");
|
|
|
+
|
|
|
+// SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
+// map.put("isGuangshengtang", "913500007297027606".equals(dept.getTaxCode()));
|
|
|
+
|
|
|
+ rabbitMqClient.sendMessage(MqConstants.DIRECT_MODE_EXCEL_REPORT_EXPORT_ZB_REVIEW_QUEUE, map);
|
|
|
+
|
|
|
+ redisTemplate.opsForValue().set(key, WmReportOpt.WmReportOptStatus.GENERATING.name(),
|
|
|
+ CacheConstants.DEF_REPORT_CREATING_TTL, TimeUnit.MILLISECONDS);
|
|
|
+
|
|
|
+ return R.ok("开始导出,请耐心等待");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 个人报告导出状态
|
|
|
*
|