Authored by 王涛

公司50环境

  1 +package com.anjiplus.template.gaea.business.base;
  2 +
  3 +import com.anji.plus.gaea.bean.ResponseBean;
  4 +import com.anjiplus.template.gaea.business.config.SystemConfig;
  5 +import org.springframework.web.bind.annotation.GetMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * @author Wang
  10 + * @description 描述
  11 + * @create 2022-04-13 11:43
  12 + */
  13 +@RestController
  14 +public class ConfigController {
  15 +
  16 + private final SystemConfig systemConfig;
  17 +
  18 + public ConfigController(SystemConfig systemConfig) {
  19 + this.systemConfig = systemConfig;
  20 + }
  21 +
  22 + @GetMapping("getConfig")
  23 + public ResponseBean getConfig() {
  24 + return ResponseBean.builder().data(systemConfig).build();
  25 + }
  26 +}
  1 +package com.anjiplus.template.gaea.business.config;
  2 +
  3 +import lombok.Data;
  4 +import org.springframework.boot.context.properties.ConfigurationProperties;
  5 +import org.springframework.stereotype.Component;
  6 +
  7 +@Component
  8 +@ConfigurationProperties(prefix = "hg.config")
  9 +@Data
  10 +public class SystemConfig {
  11 +
  12 + // AJ服务地址
  13 + private String serverAddr;
  14 +
  15 + // 监控网关地址
  16 + private String monitorGateWay;
  17 +
  18 + @Override
  19 + public String toString() {
  20 + return "配置信息: {" + "服务地址 = '" + serverAddr + '\'' + ", 监控网关地址 = '" + monitorGateWay + '\'' + '}';
  21 + }
  22 +}
1 -  
2 package com.anjiplus.template.gaea.business.modules.dashboard.controller; 1 package com.anjiplus.template.gaea.business.modules.dashboard.controller;
3 2
4 import com.anji.plus.gaea.annotation.Permission; 3 import com.anji.plus.gaea.annotation.Permission;
5 import com.anji.plus.gaea.annotation.log.GaeaAuditLog; 4 import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
6 import com.anji.plus.gaea.bean.ResponseBean; 5 import com.anji.plus.gaea.bean.ResponseBean;
7 -import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;  
8 import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ChartDto; 6 import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ChartDto;
9 import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ReportDashboardObjectDto; 7 import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ReportDashboardObjectDto;
  8 +import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;
10 import io.swagger.annotations.Api; 9 import io.swagger.annotations.Api;
  10 +import lombok.extern.slf4j.Slf4j;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.http.ResponseEntity; 12 import org.springframework.http.ResponseEntity;
13 import org.springframework.web.bind.annotation.*; 13 import org.springframework.web.bind.annotation.*;
@@ -17,11 +17,12 @@ import javax.servlet.http.HttpServletRequest; @@ -17,11 +17,12 @@ import javax.servlet.http.HttpServletRequest;
17 import javax.servlet.http.HttpServletResponse; 17 import javax.servlet.http.HttpServletResponse;
18 18
19 /** 19 /**
20 -* @desc 大屏设计 controller  
21 -* @website https://gitee.com/anji-plus/gaea  
22 -* @author Raod  
23 -* @date 2021-04-12 14:52:21.761  
24 -**/ 20 + * @author Raod
  21 + * @desc 大屏设计 controller
  22 + * @website https://gitee.com/anji-plus/gaea
  23 + * @date 2021-04-12 14:52:21.761
  24 + **/
  25 +@Slf4j
25 @RestController 26 @RestController
26 @Api(tags = "大屏设计管理") 27 @Api(tags = "大屏设计管理")
27 @Permission(code = "bigScreenManage", name = "大屏报表") 28 @Permission(code = "bigScreenManage", name = "大屏报表")
@@ -33,6 +34,7 @@ public class ReportDashboardController { @@ -33,6 +34,7 @@ public class ReportDashboardController {
33 34
34 /** 35 /**
35 * 预览、查询大屏详情 36 * 预览、查询大屏详情
  37 + *
36 * @param reportCode 38 * @param reportCode
37 * @return 39 * @return
38 */ 40 */
@@ -44,6 +46,7 @@ public class ReportDashboardController { @@ -44,6 +46,7 @@ public class ReportDashboardController {
44 46
45 /** 47 /**
46 * 保存大屏设计 48 * 保存大屏设计
  49 + *
47 * @param dto 50 * @param dto
48 * @return 51 * @return
49 */ 52 */
@@ -58,30 +61,35 @@ public class ReportDashboardController { @@ -58,30 +61,35 @@ public class ReportDashboardController {
58 61
59 /** 62 /**
60 * 获取去单个图层数据 63 * 获取去单个图层数据
  64 + *
61 * @param dto 65 * @param dto
62 * @return 66 * @return
63 */ 67 */
64 @PostMapping("/getData") 68 @PostMapping("/getData")
65 @Permission(code = "view", name = "查看大屏") 69 @Permission(code = "view", name = "查看大屏")
66 public ResponseBean getData(@RequestBody ChartDto dto) { 70 public ResponseBean getData(@RequestBody ChartDto dto) {
  71 + log.info(" ******************************************************* /n******************************************************* /n");
  72 + log.info("请求参数:{}", dto);
  73 + log.info(" ******************************************************* /n******************************************************* /n");
67 return ResponseBean.builder().data(reportDashboardService.getChartData(dto)).build(); 74 return ResponseBean.builder().data(reportDashboardService.getChartData(dto)).build();
68 } 75 }
69 76
70 77
71 /** 78 /**
72 * 导出大屏 79 * 导出大屏
  80 + *
73 * @param reportCode 81 * @param reportCode
74 * @return 82 * @return
75 */ 83 */
76 @GetMapping("/export") 84 @GetMapping("/export")
77 @Permission(code = "export", name = "导出大屏") 85 @Permission(code = "export", name = "导出大屏")
78 - public ResponseEntity<byte[]> exportDashboard(HttpServletRequest request, HttpServletResponse response,  
79 - @RequestParam("reportCode") String reportCode, @RequestParam(value = "showDataSet",required = false, defaultValue = "1") Integer showDataSet) { 86 + public ResponseEntity<byte[]> exportDashboard(HttpServletRequest request, HttpServletResponse response, @RequestParam("reportCode") String reportCode, @RequestParam(value = "showDataSet", required = false, defaultValue = "1") Integer showDataSet) {
80 return reportDashboardService.exportDashboard(request, response, reportCode, showDataSet); 87 return reportDashboardService.exportDashboard(request, response, reportCode, showDataSet);
81 } 88 }
82 89
83 /** 90 /**
84 * 导入大屏 91 * 导入大屏
  92 + *
85 * @param file 导入的zip文件 93 * @param file 导入的zip文件
86 * @param reportCode 94 * @param reportCode
87 * @return 95 * @return
1 -  
2 package com.anjiplus.template.gaea.business.modules.dashboard.service.impl; 1 package com.anjiplus.template.gaea.business.modules.dashboard.service.impl;
3 2
4 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
@@ -101,11 +100,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -101,11 +100,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
101 } 100 }
102 GaeaBeanUtils.copyAndFormatter(reportDashboard, reportDashboardDto); 101 GaeaBeanUtils.copyAndFormatter(reportDashboard, reportDashboardDto);
103 102
104 - List<ReportDashboardWidget> list = reportDashboardWidgetService.list(  
105 - new QueryWrapper<ReportDashboardWidget>().lambda()  
106 - .eq(ReportDashboardWidget::getReportCode, reportCode)  
107 - .orderByAsc(ReportDashboardWidget::getSort)  
108 - ); 103 + List<ReportDashboardWidget> list = reportDashboardWidgetService.list(new QueryWrapper<ReportDashboardWidget>().lambda().eq(ReportDashboardWidget::getReportCode, reportCode).orderByAsc(ReportDashboardWidget::getSort));
109 List<ReportDashboardWidgetDto> reportDashboardWidgetDtoList = new ArrayList<>(); 104 List<ReportDashboardWidgetDto> reportDashboardWidgetDtoList = new ArrayList<>();
110 list.forEach(reportDashboardWidget -> { 105 list.forEach(reportDashboardWidget -> {
111 ReportDashboardWidgetDto reportDashboardWidgetDto = new ReportDashboardWidgetDto(); 106 ReportDashboardWidgetDto reportDashboardWidgetDto = new ReportDashboardWidgetDto();
@@ -155,8 +150,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -155,8 +150,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
155 } 150 }
156 151
157 //删除reportDashboardWidget 152 //删除reportDashboardWidget
158 - reportDashboardWidgetService.delete(new QueryWrapper<ReportDashboardWidget>()  
159 - .lambda().eq(ReportDashboardWidget::getReportCode, reportCode)); 153 + reportDashboardWidgetService.delete(new QueryWrapper<ReportDashboardWidget>().lambda().eq(ReportDashboardWidget::getReportCode, reportCode));
160 List<ReportDashboardWidgetDto> widgets = dto.getWidgets(); 154 List<ReportDashboardWidgetDto> widgets = dto.getWidgets();
161 155
162 // List<ReportDashboardWidget> reportDashboardWidgetList = new ArrayList<>(); 156 // List<ReportDashboardWidget> reportDashboardWidgetList = new ArrayList<>();
@@ -191,6 +185,9 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -191,6 +185,9 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
191 DataSetDto setDto = new DataSetDto(); 185 DataSetDto setDto = new DataSetDto();
192 setDto.setSetCode(dto.getSetCode()); 186 setDto.setSetCode(dto.getSetCode());
193 setDto.setContextData(dto.getContextData()); 187 setDto.setContextData(dto.getContextData());
  188 +
  189 + log.info("请求数据参数:{}", setDto);
  190 +
194 OriginalDataDto result = dataSetService.getData(setDto); 191 OriginalDataDto result = dataSetService.getData(setDto);
195 List<JSONObject> data = result.getData(); 192 List<JSONObject> data = result.getData();
196 //处理时间轴 193 //处理时间轴
@@ -224,9 +221,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -224,9 +221,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
224 //将涉及到的图片保存下来(1.背景图,2.组件为图片的) 221 //将涉及到的图片保存下来(1.背景图,2.组件为图片的)
225 String backgroundImage = detail.getDashboard().getBackgroundImage(); 222 String backgroundImage = detail.getDashboard().getBackgroundImage();
226 zipLoadImage(backgroundImage, path); 223 zipLoadImage(backgroundImage, path);
227 - detail.getWidgets().stream()  
228 - .filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType()))  
229 - .forEach(reportDashboardWidgetDto -> { 224 + detail.getWidgets().stream().filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType())).forEach(reportDashboardWidgetDto -> {
230 String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress"); 225 String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
231 zipLoadImage(imageAddress, path); 226 zipLoadImage(imageAddress, path);
232 }); 227 });
@@ -332,9 +327,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -332,9 +327,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
332 //将涉及到的图片路径替换(1.背景图,2.组件为图片的) 327 //将涉及到的图片路径替换(1.背景图,2.组件为图片的)
333 String backgroundImage = detail.getDashboard().getBackgroundImage(); 328 String backgroundImage = detail.getDashboard().getBackgroundImage();
334 detail.getDashboard().setBackgroundImage(replaceUrl(backgroundImage, fileMap)); 329 detail.getDashboard().setBackgroundImage(replaceUrl(backgroundImage, fileMap));
335 - detail.getWidgets().stream()  
336 - .filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType()))  
337 - .forEach(reportDashboardWidgetDto -> { 330 + detail.getWidgets().stream().filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType())).forEach(reportDashboardWidgetDto -> {
338 String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress"); 331 String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
339 String address = replaceUrl(imageAddress, fileMap); 332 String address = replaceUrl(imageAddress, fileMap);
340 reportDashboardWidgetDto.getValue().getSetup().put("imageAdress", address); 333 reportDashboardWidgetDto.getValue().getSetup().put("imageAdress", address);
@@ -365,6 +358,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi @@ -365,6 +358,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
365 358
366 /** 359 /**
367 * 将大屏涉及到的图片存入指定文件夹 360 * 将大屏涉及到的图片存入指定文件夹
  361 + *
368 * @param imageAddress 362 * @param imageAddress
369 * @param path 363 * @param path
370 */ 364 */
@@ -242,6 +242,7 @@ public class DataSetServiceImpl implements DataSetService { @@ -242,6 +242,7 @@ public class DataSetServiceImpl implements DataSetService {
242 String setCode = dto.getSetCode(); 242 String setCode = dto.getSetCode();
243 //1.获取数据集、参数替换、数据转换 243 //1.获取数据集、参数替换、数据转换
244 DataSetDto dataSetDto = detailSet(setCode); 244 DataSetDto dataSetDto = detailSet(setCode);
  245 + log.info("数据集详情:{}",dataSetDto);
245 String dynSentence = dataSetDto.getDynSentence(); 246 String dynSentence = dataSetDto.getDynSentence();
246 //2.获取数据源 247 //2.获取数据源
247 DataSource dataSource; 248 DataSource dataSource;
@@ -262,15 +263,17 @@ public class DataSetServiceImpl implements DataSetService { @@ -262,15 +263,17 @@ public class DataSetServiceImpl implements DataSetService {
262 dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode()); 263 dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode());
263 } 264 }
264 265
  266 + log.info("数据源详情:{}",dataSource);
  267 +
265 //3.参数替换 268 //3.参数替换
266 //3.1参数校验 269 //3.1参数校验
267 - log.debug("参数校验替换前:{}", dto.getContextData()); 270 + log.info("参数校验替换前:{}", dto.getContextData());
268 boolean verification = dataSetParamService.verification(dataSetDto.getDataSetParamDtoList(), dto.getContextData()); 271 boolean verification = dataSetParamService.verification(dataSetDto.getDataSetParamDtoList(), dto.getContextData());
269 if (!verification) { 272 if (!verification) {
270 throw BusinessExceptionBuilder.build(ResponseCode.RULE_FIELDS_CHECK_ERROR); 273 throw BusinessExceptionBuilder.build(ResponseCode.RULE_FIELDS_CHECK_ERROR);
271 } 274 }
272 dynSentence = dataSetParamService.transform(dto.getContextData(), dynSentence); 275 dynSentence = dataSetParamService.transform(dto.getContextData(), dynSentence);
273 - log.debug("参数校验替换后:{}", dto.getContextData()); 276 + log.info("参数校验替换后:{}", dynSentence);
274 //4.获取数据 277 //4.获取数据
275 DataSourceDto dataSourceDto = new DataSourceDto(); 278 DataSourceDto dataSourceDto = new DataSourceDto();
276 BeanUtils.copyProperties(dataSource, dataSourceDto); 279 BeanUtils.copyProperties(dataSource, dataSourceDto);
@@ -283,6 +286,7 @@ public class DataSetServiceImpl implements DataSetService { @@ -283,6 +286,7 @@ public class DataSetServiceImpl implements DataSetService {
283 long total = dataSourceService.total(dataSourceDto, dto); 286 long total = dataSourceService.total(dataSourceDto, dto);
284 originalDataDto.setTotal(total); 287 originalDataDto.setTotal(total);
285 } 288 }
  289 + log.info("获取的数据:{}", dataSourceDto);
286 List<JSONObject> data = dataSourceService.execute(dataSourceDto); 290 List<JSONObject> data = dataSourceService.execute(dataSourceDto);
287 //5.数据转换 291 //5.数据转换
288 List<JSONObject> transform = dataSetTransformService.transform(dataSetDto.getDataSetTransformDtoList(), data); 292 List<JSONObject> transform = dataSetTransformService.transform(dataSetDto.getDataSetTransformDtoList(), data);
1 package com.anjiplus.template.gaea.business.runner; 1 package com.anjiplus.template.gaea.business.runner;
2 2
  3 +import com.anjiplus.template.gaea.business.config.SystemConfig;
3 import com.anjiplus.template.gaea.business.modules.accessauthority.service.AccessAuthorityService; 4 import com.anjiplus.template.gaea.business.modules.accessauthority.service.AccessAuthorityService;
4 import com.anjiplus.template.gaea.business.modules.dict.service.GaeaDictService; 5 import com.anjiplus.template.gaea.business.modules.dict.service.GaeaDictService;
  6 +import lombok.extern.slf4j.Slf4j;
5 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.boot.ApplicationArguments; 8 import org.springframework.boot.ApplicationArguments;
7 import org.springframework.boot.ApplicationRunner; 9 import org.springframework.boot.ApplicationRunner;
@@ -11,6 +13,7 @@ import org.springframework.boot.ApplicationRunner; @@ -11,6 +13,7 @@ import org.springframework.boot.ApplicationRunner;
11 * @author WongBin <abc13579d@163.com> 13 * @author WongBin <abc13579d@163.com>
12 * @date 2019-02-17 08:50:10.009 14 * @date 2019-02-17 08:50:10.009
13 **/ 15 **/
  16 +@Slf4j
14 public class ApplicationInitRunner implements ApplicationRunner { 17 public class ApplicationInitRunner implements ApplicationRunner {
15 18
16 @Autowired 19 @Autowired
@@ -19,6 +22,9 @@ public class ApplicationInitRunner implements ApplicationRunner { @@ -19,6 +22,9 @@ public class ApplicationInitRunner implements ApplicationRunner {
19 @Autowired 22 @Autowired
20 private AccessAuthorityService accessAuthorityService; 23 private AccessAuthorityService accessAuthorityService;
21 24
  25 + @Autowired
  26 + private SystemConfig systemConfig;
  27 +
22 @Override 28 @Override
23 public void run(ApplicationArguments args) throws Exception { 29 public void run(ApplicationArguments args) throws Exception {
24 30
@@ -27,5 +33,9 @@ public class ApplicationInitRunner implements ApplicationRunner { @@ -27,5 +33,9 @@ public class ApplicationInitRunner implements ApplicationRunner {
27 33
28 //2. 建立url权限拦截体系 34 //2. 建立url权限拦截体系
29 accessAuthorityService.scanGaeaSecurityAuthorities(); 35 accessAuthorityService.scanGaeaSecurityAuthorities();
  36 +
  37 + // 打印配置信息:
  38 + log.info(systemConfig.toString());
  39 +
30 } 40 }
31 } 41 }
@@ -9,3 +9,7 @@ customer: @@ -9,3 +9,7 @@ customer:
9 file: 9 file:
10 dist-path: D:\Workspace\AJ-Report\report-core\upload 10 dist-path: D:\Workspace\AJ-Report\report-core\upload
11 downloadPath: http://127.0.0.1:9095/file/download 11 downloadPath: http://127.0.0.1:9095/file/download
  12 +hg:
  13 + config:
  14 + server-addr: http://127.0.0.1:9095
  15 + monitor-gate-way: http://192.168.0.75:8080
@@ -75,7 +75,7 @@ customer: @@ -75,7 +75,7 @@ customer:
75 downloadPath: http://127.0.0.1:9095/file/download 75 downloadPath: http://127.0.0.1:9095/file/download
76 76
77 # 跳过token验证和权限验证的url清单 77 # 跳过token验证和权限验证的url清单
78 - skip-authenticate-urls: /gaeaDict/all, /login, /static, /file/download/, /index.html, /favicon.ico, /reportShare/detailByCode 78 + skip-authenticate-urls: /gaeaDict/all, /login, /static, /file/download/, /index.html, /favicon.ico, /reportShare/detailByCode,/getConfig
79 user: 79 user:
80 ##新增用户默认密码 80 ##新增用户默认密码
81 default: 81 default:
  1 +'use strict'
  2 +const merge = require('webpack-merge')
  3 +const prodEnv = require('./prod.env')
  4 +
  5 +module.exports = merge(prodEnv, {
  6 + NODE_ENV: '"gz"',
  7 + BASE_API: '"http://89.12.88.128:9095"',
  8 + MONITOR_GATEWAY: '"http://89.12.88.128:8080"'
  9 + // BASE_API: '"http://192.168.1.50:9095"',
  10 + // MONITOR_GATEWAY: '"http://192.168.1.50:8080"'
  11 +
  12 +})
  1 +'use strict'
  2 +const merge = require('webpack-merge')
  3 +const prodEnv = require('./prod.env')
  4 +
  5 +module.exports = merge(prodEnv, {
  6 + NODE_ENV: '"dev151"',
  7 + BASE_API: '"http://192.168.0.75:9095"',
  8 + MONITOR_GATEWAY: '"http://192.168.0.75:8080"'
  9 + // BASE_API: '"http://192.168.1.50:9095"',
  10 + // MONITOR_GATEWAY: '"http://192.168.1.50:8080"'
  11 +
  12 +})
@@ -4,5 +4,6 @@ const prodEnv = require('./prod.env') @@ -4,5 +4,6 @@ const prodEnv = require('./prod.env')
4 4
5 module.exports = merge(prodEnv, { 5 module.exports = merge(prodEnv, {
6 NODE_ENV: '"testing"', 6 NODE_ENV: '"testing"',
7 - BASE_API: '"./"' 7 + BASE_API: '"./"',
  8 + MONITOR_GATEWAY: '"./"'
8 }) 9 })
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 "build": "cross-env NODE_ENV=production node build/build.js", 9 "build": "cross-env NODE_ENV=production node build/build.js",
10 "build:dev": "cross-env NODE_ENV=development node build/build.js", 10 "build:dev": "cross-env NODE_ENV=development node build/build.js",
11 "build:dev50": "cross-env NODE_ENV=dev50 node build/build.js", 11 "build:dev50": "cross-env NODE_ENV=dev50 node build/build.js",
  12 + "build:dev151": "cross-env NODE_ENV=dev151 node build/build.js",
  13 + "build:devgz": "cross-env NODE_ENV=gz node build/build.js",
12 "build:test": "cross-env NODE_ENV=testing node build/build.js", 14 "build:test": "cross-env NODE_ENV=testing node build/build.js",
13 "build:prod": "cross-env NODE_ENV=production node build/build.js" 15 "build:prod": "cross-env NODE_ENV=production node build/build.js"
14 }, 16 },