Authored by 王涛

公司50环境

package com.anjiplus.template.gaea.business.base;
import com.anji.plus.gaea.bean.ResponseBean;
import com.anjiplus.template.gaea.business.config.SystemConfig;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Wang
* @description 描述
* @create 2022-04-13 11:43
*/
@RestController
public class ConfigController {
private final SystemConfig systemConfig;
public ConfigController(SystemConfig systemConfig) {
this.systemConfig = systemConfig;
}
@GetMapping("getConfig")
public ResponseBean getConfig() {
return ResponseBean.builder().data(systemConfig).build();
}
}
... ...
package com.anjiplus.template.gaea.business.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "hg.config")
@Data
public class SystemConfig {
// AJ服务地址
private String serverAddr;
// 监控网关地址
private String monitorGateWay;
@Override
public String toString() {
return "配置信息: {" + "服务地址 = '" + serverAddr + '\'' + ", 监控网关地址 = '" + monitorGateWay + '\'' + '}';
}
}
... ...
package com.anjiplus.template.gaea.business.modules.dashboard.controller;
import com.anji.plus.gaea.annotation.Permission;
import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
import com.anji.plus.gaea.bean.ResponseBean;
import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;
import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ChartDto;
import com.anjiplus.template.gaea.business.modules.dashboard.controller.dto.ReportDashboardObjectDto;
import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
... ... @@ -17,11 +17,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @desc 大屏设计 controller
* @website https://gitee.com/anji-plus/gaea
* @author Raod
* @date 2021-04-12 14:52:21.761
**/
* @author Raod
* @desc 大屏设计 controller
* @website https://gitee.com/anji-plus/gaea
* @date 2021-04-12 14:52:21.761
**/
@Slf4j
@RestController
@Api(tags = "大屏设计管理")
@Permission(code = "bigScreenManage", name = "大屏报表")
... ... @@ -33,6 +34,7 @@ public class ReportDashboardController {
/**
* 预览、查询大屏详情
*
* @param reportCode
* @return
*/
... ... @@ -44,6 +46,7 @@ public class ReportDashboardController {
/**
* 保存大屏设计
*
* @param dto
* @return
*/
... ... @@ -58,31 +61,36 @@ public class ReportDashboardController {
/**
* 获取去单个图层数据
*
* @param dto
* @return
*/
@PostMapping("/getData")
@Permission(code = "view", name = "查看大屏")
public ResponseBean getData(@RequestBody ChartDto dto) {
log.info(" ******************************************************* /n******************************************************* /n");
log.info("请求参数:{}", dto);
log.info(" ******************************************************* /n******************************************************* /n");
return ResponseBean.builder().data(reportDashboardService.getChartData(dto)).build();
}
/**
* 导出大屏
*
* @param reportCode
* @return
*/
@GetMapping("/export")
@Permission(code = "export", name = "导出大屏")
public ResponseEntity<byte[]> exportDashboard(HttpServletRequest request, HttpServletResponse response,
@RequestParam("reportCode") String reportCode, @RequestParam(value = "showDataSet",required = false, defaultValue = "1") Integer showDataSet) {
public ResponseEntity<byte[]> exportDashboard(HttpServletRequest request, HttpServletResponse response, @RequestParam("reportCode") String reportCode, @RequestParam(value = "showDataSet", required = false, defaultValue = "1") Integer showDataSet) {
return reportDashboardService.exportDashboard(request, response, reportCode, showDataSet);
}
/**
* 导入大屏
* @param file 导入的zip文件
*
* @param file 导入的zip文件
* @param reportCode
* @return
*/
... ...
package com.anjiplus.template.gaea.business.modules.dashboard.service.impl;
import com.alibaba.fastjson.JSONObject;
... ... @@ -101,11 +100,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
}
GaeaBeanUtils.copyAndFormatter(reportDashboard, reportDashboardDto);
List<ReportDashboardWidget> list = reportDashboardWidgetService.list(
new QueryWrapper<ReportDashboardWidget>().lambda()
.eq(ReportDashboardWidget::getReportCode, reportCode)
.orderByAsc(ReportDashboardWidget::getSort)
);
List<ReportDashboardWidget> list = reportDashboardWidgetService.list(new QueryWrapper<ReportDashboardWidget>().lambda().eq(ReportDashboardWidget::getReportCode, reportCode).orderByAsc(ReportDashboardWidget::getSort));
List<ReportDashboardWidgetDto> reportDashboardWidgetDtoList = new ArrayList<>();
list.forEach(reportDashboardWidget -> {
ReportDashboardWidgetDto reportDashboardWidgetDto = new ReportDashboardWidgetDto();
... ... @@ -155,8 +150,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
}
//删除reportDashboardWidget
reportDashboardWidgetService.delete(new QueryWrapper<ReportDashboardWidget>()
.lambda().eq(ReportDashboardWidget::getReportCode, reportCode));
reportDashboardWidgetService.delete(new QueryWrapper<ReportDashboardWidget>().lambda().eq(ReportDashboardWidget::getReportCode, reportCode));
List<ReportDashboardWidgetDto> widgets = dto.getWidgets();
// List<ReportDashboardWidget> reportDashboardWidgetList = new ArrayList<>();
... ... @@ -191,6 +185,9 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
DataSetDto setDto = new DataSetDto();
setDto.setSetCode(dto.getSetCode());
setDto.setContextData(dto.getContextData());
log.info("请求数据参数:{}", setDto);
OriginalDataDto result = dataSetService.getData(setDto);
List<JSONObject> data = result.getData();
//处理时间轴
... ... @@ -224,12 +221,10 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
//将涉及到的图片保存下来(1.背景图,2.组件为图片的)
String backgroundImage = detail.getDashboard().getBackgroundImage();
zipLoadImage(backgroundImage, path);
detail.getWidgets().stream()
.filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType()))
.forEach(reportDashboardWidgetDto -> {
String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
zipLoadImage(imageAddress, path);
});
detail.getWidgets().stream().filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType())).forEach(reportDashboardWidgetDto -> {
String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
zipLoadImage(imageAddress, path);
});
//showDataSet == 0 代表不包含数据集
if (0 == showDataSet) {
... ... @@ -332,14 +327,12 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
//将涉及到的图片路径替换(1.背景图,2.组件为图片的)
String backgroundImage = detail.getDashboard().getBackgroundImage();
detail.getDashboard().setBackgroundImage(replaceUrl(backgroundImage, fileMap));
detail.getWidgets().stream()
.filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType()))
.forEach(reportDashboardWidgetDto -> {
String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
String address = replaceUrl(imageAddress, fileMap);
reportDashboardWidgetDto.getValue().getSetup().put("imageAdress", address);
reportDashboardWidgetDto.getOptions().getJSONArray("setup").getJSONObject(4).put("value", address);
});
detail.getWidgets().stream().filter(reportDashboardWidgetDto -> "widget-image".equals(reportDashboardWidgetDto.getType())).forEach(reportDashboardWidgetDto -> {
String imageAddress = reportDashboardWidgetDto.getValue().getSetup().getString("imageAdress");
String address = replaceUrl(imageAddress, fileMap);
reportDashboardWidgetDto.getValue().getSetup().put("imageAdress", address);
reportDashboardWidgetDto.getOptions().getJSONArray("setup").getJSONObject(4).put("value", address);
});
//将新的大屏编码赋值
detail.setReportCode(reportCode);
... ... @@ -365,6 +358,7 @@ public class ReportDashboardServiceImpl implements ReportDashboardService, Initi
/**
* 将大屏涉及到的图片存入指定文件夹
*
* @param imageAddress
* @param path
*/
... ...
... ... @@ -242,6 +242,7 @@ public class DataSetServiceImpl implements DataSetService {
String setCode = dto.getSetCode();
//1.获取数据集、参数替换、数据转换
DataSetDto dataSetDto = detailSet(setCode);
log.info("数据集详情:{}",dataSetDto);
String dynSentence = dataSetDto.getDynSentence();
//2.获取数据源
DataSource dataSource;
... ... @@ -262,15 +263,17 @@ public class DataSetServiceImpl implements DataSetService {
dataSource = dataSourceService.selectOne("source_code", dataSetDto.getSourceCode());
}
log.info("数据源详情:{}",dataSource);
//3.参数替换
//3.1参数校验
log.debug("参数校验替换前:{}", dto.getContextData());
log.info("参数校验替换前:{}", dto.getContextData());
boolean verification = dataSetParamService.verification(dataSetDto.getDataSetParamDtoList(), dto.getContextData());
if (!verification) {
throw BusinessExceptionBuilder.build(ResponseCode.RULE_FIELDS_CHECK_ERROR);
}
dynSentence = dataSetParamService.transform(dto.getContextData(), dynSentence);
log.debug("参数校验替换后:{}", dto.getContextData());
log.info("参数校验替换后:{}", dynSentence);
//4.获取数据
DataSourceDto dataSourceDto = new DataSourceDto();
BeanUtils.copyProperties(dataSource, dataSourceDto);
... ... @@ -283,6 +286,7 @@ public class DataSetServiceImpl implements DataSetService {
long total = dataSourceService.total(dataSourceDto, dto);
originalDataDto.setTotal(total);
}
log.info("获取的数据:{}", dataSourceDto);
List<JSONObject> data = dataSourceService.execute(dataSourceDto);
//5.数据转换
List<JSONObject> transform = dataSetTransformService.transform(dataSetDto.getDataSetTransformDtoList(), data);
... ...
package com.anjiplus.template.gaea.business.runner;
import com.anjiplus.template.gaea.business.config.SystemConfig;
import com.anjiplus.template.gaea.business.modules.accessauthority.service.AccessAuthorityService;
import com.anjiplus.template.gaea.business.modules.dict.service.GaeaDictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
... ... @@ -11,6 +13,7 @@ import org.springframework.boot.ApplicationRunner;
* @author WongBin <abc13579d@163.com>
* @date 2019-02-17 08:50:10.009
**/
@Slf4j
public class ApplicationInitRunner implements ApplicationRunner {
@Autowired
... ... @@ -19,6 +22,9 @@ public class ApplicationInitRunner implements ApplicationRunner {
@Autowired
private AccessAuthorityService accessAuthorityService;
@Autowired
private SystemConfig systemConfig;
@Override
public void run(ApplicationArguments args) throws Exception {
... ... @@ -27,5 +33,9 @@ public class ApplicationInitRunner implements ApplicationRunner {
//2. 建立url权限拦截体系
accessAuthorityService.scanGaeaSecurityAuthorities();
// 打印配置信息:
log.info(systemConfig.toString());
}
}
... ...
... ... @@ -9,3 +9,7 @@ customer:
file:
dist-path: D:\Workspace\AJ-Report\report-core\upload
downloadPath: http://127.0.0.1:9095/file/download
hg:
config:
server-addr: http://127.0.0.1:9095
monitor-gate-way: http://192.168.0.75:8080
... ...
... ... @@ -75,7 +75,7 @@ customer:
downloadPath: http://127.0.0.1:9095/file/download
# 跳过token验证和权限验证的url清单
skip-authenticate-urls: /gaeaDict/all, /login, /static, /file/download/, /index.html, /favicon.ico, /reportShare/detailByCode
skip-authenticate-urls: /gaeaDict/all, /login, /static, /file/download/, /index.html, /favicon.ico, /reportShare/detailByCode,/getConfig
user:
##新增用户默认密码
default:
... ...
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"gz"',
BASE_API: '"http://89.12.88.128:9095"',
MONITOR_GATEWAY: '"http://89.12.88.128:8080"'
// BASE_API: '"http://192.168.1.50:9095"',
// MONITOR_GATEWAY: '"http://192.168.1.50:8080"'
})
... ...
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"dev151"',
BASE_API: '"http://192.168.0.75:9095"',
MONITOR_GATEWAY: '"http://192.168.0.75:8080"'
// BASE_API: '"http://192.168.1.50:9095"',
// MONITOR_GATEWAY: '"http://192.168.1.50:8080"'
})
... ...
... ... @@ -4,5 +4,6 @@ const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"testing"',
BASE_API: '"./"'
BASE_API: '"./"',
MONITOR_GATEWAY: '"./"'
})
... ...
... ... @@ -9,6 +9,8 @@
"build": "cross-env NODE_ENV=production node build/build.js",
"build:dev": "cross-env NODE_ENV=development node build/build.js",
"build:dev50": "cross-env NODE_ENV=dev50 node build/build.js",
"build:dev151": "cross-env NODE_ENV=dev151 node build/build.js",
"build:devgz": "cross-env NODE_ENV=gz node build/build.js",
"build:test": "cross-env NODE_ENV=testing node build/build.js",
"build:prod": "cross-env NODE_ENV=production node build/build.js"
},
... ...