|
@@ -27,9 +27,11 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.dto.UserDTO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysUser;
|
|
|
+import com.qunzhixinxi.hnqz.admin.api.entity.WmReportOpt;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.ErrorInfoVo;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.UserVO;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.vo.WmScorePackageVO;
|
|
@@ -56,6 +58,8 @@ import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -70,6 +74,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.Future;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -103,7 +108,7 @@ public class WmScorePackageController {
|
|
|
private final WmDaDrugEntMapper wmDaDrugEntMapper;
|
|
|
private final WmDaAgentMapper wmDaAgentMapper;
|
|
|
private final SysUserMapper sysUserMapper;
|
|
|
- private final WmReportMapper wmReportMapper;
|
|
|
+ private final StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -1395,6 +1400,8 @@ public class WmScorePackageController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // 封装报告导出状态
|
|
|
+ getReportOpt(finalRecords);
|
|
|
pageAnswer.setRecords(finalRecords);
|
|
|
} catch (ExecutionException | InterruptedException e) {
|
|
|
log.error("获取分页信息失败");
|
|
@@ -1404,6 +1411,48 @@ public class WmScorePackageController {
|
|
|
return R.ok(pageAnswer);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询报告导出状态
|
|
|
+ * @param finalRecords 列表
|
|
|
+ */
|
|
|
+ private void getReportOpt(List<WmScorePackage> finalRecords){
|
|
|
+
|
|
|
+ ValueOperations<String, String> ops = redisTemplate.opsForValue();
|
|
|
+
|
|
|
+ finalRecords.forEach(record ->{
|
|
|
+
|
|
|
+ WmReportOpt opt = new WmReportOpt();
|
|
|
+
|
|
|
+ final String key = String.format(CacheConstants.EXPORT_ZB_REPORT_CACHE,record.getId());
|
|
|
+
|
|
|
+ String url = ops.get(key);
|
|
|
+
|
|
|
+ // 存在key
|
|
|
+ if (redisTemplate.hasKey(key)){
|
|
|
+
|
|
|
+ Long expire = ops.getOperations().getExpire(key, TimeUnit.MINUTES);
|
|
|
+
|
|
|
+ LocalDateTime expiry;
|
|
|
+ // 永久有效为正在生成的状态否则就是生成成功了的
|
|
|
+ if (!Long.valueOf(-1L).equals(expire)){
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATING);
|
|
|
+ } else {
|
|
|
+ expiry = LocalDateTime.now().plusSeconds(expire);
|
|
|
+ opt.setTtl(expiry);
|
|
|
+ opt.setLatestUrl(url);
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.GENERATED);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ opt.setStatus(WmReportOpt.WmReportOptStatus.NOT_GENERATE);
|
|
|
+ }
|
|
|
+
|
|
|
+ record.setReportOpt(opt);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取关联积分包名称 二期 业务平台
|