|
@@ -4,9 +4,7 @@ import cn.hutool.json.JSONUtil;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.CacheConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.constant.MqConstants;
|
|
|
import com.qunzhixinxi.hnqz.admin.api.entity.WmReport;
|
|
|
-import com.qunzhixinxi.hnqz.admin.api.constant.enums.ReportTypeEnum;
|
|
|
-import com.qunzhixinxi.hnqz.report.service.ExcelReportExportService;
|
|
|
-import com.qunzhixinxi.hnqz.report.service.ReportHandlerDeptRelationService;
|
|
|
+import com.qunzhixinxi.hnqz.report.service.ReportExportService;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.entity.BaseMap;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
@@ -33,10 +31,7 @@ import java.util.Map;
|
|
|
@RabbitMqComponent(value = "excelNbReportExportReceiver")
|
|
|
public class ExcelReportExportNbReceiver extends BaseRabbiMqHandler<BaseMap> {
|
|
|
|
|
|
-// private final ReportExportService reportExportService;
|
|
|
-// private final WmReportExportRecordService wmReportExportRecordService;
|
|
|
-
|
|
|
- private final ReportHandlerDeptRelationService reportHandlerDeptRelationService;
|
|
|
+ private final ReportExportService reportExportService;
|
|
|
|
|
|
@RabbitHandler
|
|
|
public void onMessage(BaseMap baseMap, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
|
@@ -46,19 +41,11 @@ public class ExcelReportExportNbReceiver extends BaseRabbiMqHandler<BaseMap> {
|
|
|
String requestBody = map.get("requestBody").toString();
|
|
|
String username = map.get("username").toString();
|
|
|
Integer deptId = Integer.valueOf(map.get("deptId").toString());
|
|
|
-// Integer exportRecordId = Integer.valueOf(map.get("recordId").toString());
|
|
|
WmReport wmReport = JSONUtil.toBean(requestBody, WmReport.class);
|
|
|
String key = String.format(CacheConstants.EXCEL_EXPORT_NB_REPORT_CACHE, wmReport.getId());
|
|
|
String resStr = "ERROR_未知错误,请联系管理员";
|
|
|
|
|
|
-// int exportStatus = WmReportOpt.WmReportOptStatus.GENERATED.ordinal();
|
|
|
-// String name = "无";
|
|
|
-// String title = "无";
|
|
|
-
|
|
|
try {
|
|
|
- // 根据企业获取对应报告处理类
|
|
|
- ExcelReportExportService reportExportService =
|
|
|
- reportHandlerDeptRelationService.getExcelHandlerClass(ReportTypeEnum.EXCEL_NB.getType(), deptId);
|
|
|
|
|
|
R r = reportExportService.newExportNb(wmReport, deptId, username);
|
|
|
if (r.getCode() == CommonConstants.SUCCESS){
|
|
@@ -66,12 +53,9 @@ public class ExcelReportExportNbReceiver extends BaseRabbiMqHandler<BaseMap> {
|
|
|
Map<String,String> data = (Map<String, String>) r.getData();
|
|
|
log.info("result-map:{}",data);
|
|
|
resStr = data.get("url") ;
|
|
|
-// name = data.get("fileName");
|
|
|
-// title = data.get("orgFileNmae");
|
|
|
} else {
|
|
|
// error msg
|
|
|
resStr = r.getMsg();
|
|
|
-// exportStatus = WmReportOpt.WmReportOptStatus.ERROR.ordinal();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("excel_nb报告导出异常", e);
|
|
@@ -79,15 +63,6 @@ public class ExcelReportExportNbReceiver extends BaseRabbiMqHandler<BaseMap> {
|
|
|
Map<String,String> res = new HashMap<>(2);
|
|
|
res.put("key",key);
|
|
|
res.put("res",resStr);
|
|
|
-
|
|
|
-
|
|
|
-// WmReportExportRecord byId = wmReportExportRecordService.getById(exportRecordId);
|
|
|
-// byId.setExportStatus(exportStatus);
|
|
|
-// byId.setUrl(resStr);
|
|
|
-// byId.setTitle(title);
|
|
|
-// byId.setReportNum(name);
|
|
|
-// byId.setFinishTime(LocalDateTime.now());
|
|
|
-// wmReportExportRecordService.updateById(byId);
|
|
|
return res;
|
|
|
}
|
|
|
});
|