报表基础模块:代码规范修复

This commit is contained in:
gaoqr
2024-07-23 11:31:17 +08:00
parent c37b198611
commit 915e038219
2 changed files with 15 additions and 13 deletions
@@ -8,20 +8,20 @@ import com.cf.imes.framework.common.exception.ErrorCode;
* <p> * <p>
* report 系统,使用 1-003-000-000 段 * report 系统,使用 1-003-000-000 段
*/ */
public interface ErrorCodeConstants { public final class ErrorCodeConstants {
// ========== UREPORT template模块 1-003-001-000 ========== // ========== UREPORT template模块 1-003-001-000 ==========
ErrorCode TEMPLATE_NOT_EXISTS = new ErrorCode(1_003_001_001, "报表模板信息不存在"); public static ErrorCode TEMPLATE_NOT_EXISTS = new ErrorCode(1_003_001_001, "报表模板信息不存在");
ErrorCode TEMPLATE_GENERATE_EXCEL_ERROR = new ErrorCode(1_003_001_002, "模板excel生成异常"); public static ErrorCode TEMPLATE_GENERATE_EXCEL_ERROR = new ErrorCode(1_003_001_002, "模板excel生成异常");
// ========== UREPORT datasource模块 1-003-002-000 ========== // ========== UREPORT datasource模块 1-003-002-000 ==========
ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在"); public static ErrorCode DATASOURCE_NOT_EXISTS = new ErrorCode(1_003_002_001, "报表数据源不存在");
ErrorCode DATASOURCE_CONNECT_FAIL = new ErrorCode(1_003_002_001, "报表数据源连接失败"); public static ErrorCode DATASOURCE_CONNECT_FAIL = new ErrorCode(1_003_002_001, "报表数据源连接失败");
// ========== UREPORT dataset模块 1-003-003-000 ========== // ========== UREPORT dataset模块 1-003-003-000 ==========
ErrorCode DATASET_NOT_EXISTS = new ErrorCode(1_003_003_001, "报表数据集不存在"); public static ErrorCode DATASET_NOT_EXISTS = new ErrorCode(1_003_003_001, "报表数据集不存在");
ErrorCode DATASET_SQL_INJECTION_RISK = new ErrorCode(1_003_003_002, "存在SQL注入风险"); public static ErrorCode DATASET_SQL_INJECTION_RISK = new ErrorCode(1_003_003_002, "存在SQL注入风险");
ErrorCode DATASET_SQL_REQUIRED = new ErrorCode(1_003_003_003, "SQL语句不能为空"); public static ErrorCode DATASET_SQL_REQUIRED = new ErrorCode(1_003_003_003, "SQL语句不能为空");
ErrorCode DATASET_SQL_ILLEGAL = new ErrorCode(1_003_003_004, "SQL语句非法"); public static ErrorCode DATASET_SQL_ILLEGAL = new ErrorCode(1_003_003_004, "SQL语句非法");
ErrorCode DATASET_GET_FIELDS_ERROR = new ErrorCode(1_003_003_005, "获取表字段"); public static ErrorCode DATASET_GET_FIELDS_ERROR = new ErrorCode(1_003_003_005, "获取表字段");
} }
@@ -33,6 +33,8 @@ public class OrderSummaryBeanDatasource {
@Resource @Resource
private OrderDatasourceApi orderDatasourceApi; private OrderDatasourceApi orderDatasourceApi;
private static final String ORDER_ID_FIELD_NAME = "orderId";
/** /**
* 生产单信息 * 生产单信息
* *
@@ -44,7 +46,7 @@ public class OrderSummaryBeanDatasource {
public List<Map<String, Object>> orderInfo(String dsName, String datasetName, Map<String, Object> parameters) { public List<Map<String, Object>> orderInfo(String dsName, String datasetName, Map<String, Object> parameters) {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
Object orderId = parameters.get("orderId"); Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
if (ObjectUtil.isNull(orderId)) { if (ObjectUtil.isNull(orderId)) {
return resultList; return resultList;
@@ -58,7 +60,7 @@ public class OrderSummaryBeanDatasource {
// 把orderInfo转map并put到resultList中 // 把orderInfo转map并put到resultList中
resultList.add(new HashMap<>() {{ resultList.add(new HashMap<>() {{
// 构造报表所需结构 // 构造报表所需结构
put("orderId", orderDTO.getId()); put(ORDER_ID_FIELD_NAME, orderDTO.getId());
put("customOrderNo", orderDTO.getCustomOrderNo()); put("customOrderNo", orderDTO.getCustomOrderNo());
put("dealer", orderDTO.getDealer()); put("dealer", orderDTO.getDealer());
LocalDateTime orderDate = orderDTO.getOrderDate(); LocalDateTime orderDate = orderDTO.getOrderDate();
@@ -83,7 +85,7 @@ public class OrderSummaryBeanDatasource {
public List<Map<String, Object>> orderPlateSummaryByPlate(String dsName, String datasetName, Map<String, Object> parameters) { public List<Map<String, Object>> orderPlateSummaryByPlate(String dsName, String datasetName, Map<String, Object> parameters) {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
Object orderId = parameters.get("orderId"); Object orderId = parameters.get(ORDER_ID_FIELD_NAME);
// 查询统计信息 // 查询统计信息
CommonResult<List<PlateGoodsRespDTO>> commonResult = orderPlateDatasourceApi.selectPlateGoodsListSummary(Long.parseLong(orderId.toString())); CommonResult<List<PlateGoodsRespDTO>> commonResult = orderPlateDatasourceApi.selectPlateGoodsListSummary(Long.parseLong(orderId.toString()));
List<PlateGoodsRespDTO> plateGoodsRespDTOS = commonResult.getData(); List<PlateGoodsRespDTO> plateGoodsRespDTOS = commonResult.getData();