|
@@ -4,16 +4,21 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.MqConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmReportOpt;
|
|
|
import com.qunzhixinxi.hnqz.admin.config.UpmsConfig;
|
|
|
+import com.qunzhixinxi.hnqz.admin.entity.ReportHandlerDeptRelation;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmReport;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmScorePackage;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.WmTask;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.input.WmPackageExportApiInput;
|
|
|
+import com.qunzhixinxi.hnqz.admin.enums.ReportTypeEnum;
|
|
|
+import com.qunzhixinxi.hnqz.admin.mapper.ReportHandlerDeptRelationMapper;
|
|
|
+import com.qunzhixinxi.hnqz.admin.mapper.WmScorePackageMapper;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.*;
|
|
|
import com.qunzhixinxi.hnqz.common.core.entity.BaseMap;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
@@ -59,6 +64,9 @@ public class ReportExportController {
|
|
|
|
|
|
private final SysDeptService sysDeptService;
|
|
|
|
|
|
+ private final WmScorePackageMapper scorePackageMapper;
|
|
|
+ private final ReportHandlerDeptRelationMapper reportHandlerDeptRelationMapper;
|
|
|
+
|
|
|
private final JavaMailSender sender;
|
|
|
|
|
|
private final UpmsConfig upmsConfig;
|
|
@@ -605,6 +613,14 @@ public class ReportExportController {
|
|
|
*/
|
|
|
@GetMapping("/new-nba-export")
|
|
|
public R<?> newNbaExport(WmScorePackage wmScorePackage) {
|
|
|
+ WmScorePackage scorePackage = scorePackageMapper.selectById(wmScorePackage.getId());
|
|
|
+ // 查询是否配置了模板
|
|
|
+ int count = reportHandlerDeptRelationMapper.selectCount(Wrappers.<ReportHandlerDeptRelation>lambdaQuery()
|
|
|
+ .eq(ReportHandlerDeptRelation::getDetpId, scorePackage.getDeptId())
|
|
|
+ .eq(ReportHandlerDeptRelation::getReportType, ReportTypeEnum.NEW_NBA.getType()));
|
|
|
+ if (count <= 0) {
|
|
|
+ return R.failed("该企业未配置模板");
|
|
|
+ }
|
|
|
|
|
|
String key = String.format(CacheConstants.NEW_NBA_REPORT_CACHE, wmScorePackage.getId());
|
|
|
|
|
@@ -627,4 +643,42 @@ public class ReportExportController {
|
|
|
return R.ok("开始导出,请耐心等待");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新版excel版的导出 TODO 报告部分下个版本实现
|
|
|
+ *
|
|
|
+ * @param wmScorePackage 积分包
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/new-excel-export")
|
|
|
+ public R<?> newExcelExport(WmScorePackage wmScorePackage) {
|
|
|
+ WmScorePackage scorePackage = scorePackageMapper.selectById(wmScorePackage.getId());
|
|
|
+ // 查询是否配置了模板
|
|
|
+ int count = reportHandlerDeptRelationMapper.selectCount(Wrappers.<ReportHandlerDeptRelation>lambdaQuery()
|
|
|
+ .eq(ReportHandlerDeptRelation::getDetpId, scorePackage.getDeptId())
|
|
|
+ .eq(ReportHandlerDeptRelation::getReportType, ReportTypeEnum.NEW_NBA.getType()));
|
|
|
+ if (count <= 0) {
|
|
|
+ return R.failed("该企业未配置模板");
|
|
|
+ }
|
|
|
+
|
|
|
+ String key = String.format(CacheConstants.NEW_EXCEL_NBA_REPORT_CACHE, wmScorePackage.getId());
|
|
|
+
|
|
|
+ String o = redisTemplate.opsForValue().get(key);
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(o) && WmReportOpt.WmReportOptStatus.GENERATING.name().equals(o)){
|
|
|
+
|
|
|
+ return R.failed("已有在途生成记录,能耐心等待");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ BaseMap map = new BaseMap();
|
|
|
+ map.put("requestBody", JSONUtil.toJsonStr(wmScorePackage));
|
|
|
+
|
|
|
+ rabbitMqClient.sendMessage(MqConstants.DIRECT_MODE_NEW_EXCEL_NBA_REPORT_EXPORT_QUEUE, map);
|
|
|
+
|
|
|
+ redisTemplate.opsForValue().set(key, WmReportOpt.WmReportOptStatus.GENERATING.name(),
|
|
|
+ CacheConstants.DEF_REPORT_CREATING_TTL , TimeUnit.MILLISECONDS);
|
|
|
+
|
|
|
+ return R.ok("开始导出,请耐心等待");
|
|
|
+ }
|
|
|
+
|
|
|
}
|