提交 57c914ae 编写于 作者: xuhui961310148's avatar xuhui961310148

查看报表功能相关内容

上级 c89394ab
......@@ -12,6 +12,10 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@riophae/vue-treeselect": "0.0.38",
"ag-grid-community": "^20.2.0",
"ag-grid-enterprise": "^20.2.0",
"ag-grid-vue": "^20.2.0",
"@fullcalendar/core": "^4.4.0",
"@fullcalendar/daygrid": "^4.4.0",
"@fullcalendar/interaction": "^4.4.0",
......
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-grid.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-balham.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-dark.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-fresh.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-bootstrap.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-blue.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-balham-dark.css";
@import "../../../../node_modules/ag-grid-community/dist/styles/ag-theme-material.css";
.grid {
height: 100%;
overflow: auto;
.ag-theme-material {
height: calc(100% - 50px);
}
}
.ag-theme-material .ag-cell{
line-height: 40px;
}
.selectAndData {
display: flex;
padding: 10px 0;
> .vue-treeselect {
width: 14%;
> .vue-treeselect__control {
height: 40px;
}
}
> .el-select {
width: 9%;
}
}
label:hover{
white-space:normal;
}
.el-range-separator{
width: 30px !important;
}
.ivu-card-body{
overflow-y: hidden !important;
}
.dareport-bbzscustom-view{
position: relative;
}
......
......@@ -8,6 +8,8 @@ import AppFormJsonFieldSet from './components/app-form-json/app-form-json-field
import AppFormJsonDim from './components/app-form-json/app-form-json-dim.vue'
import AppFormJsonMetric from './components/app-form-json/app-form-json-metric.vue'
import AppTreeselectRefreshview from './components/app-treeselect-refreshview/app-treeselect-refreshview.vue'
import {LicenseManager} from "ag-grid-enterprise";
LicenseManager.setLicenseKey("Shanghai_iBizSys_Information_Technology_Co_Ltd__MultiApp_1Devs14_January_2020__MTU3ODk2MDAwMDAwMA==f9f9222e95025fd3f9069f3db4bdd40d");
import 'jquery/dist/jquery.min.js'
import $ from 'jquery'
window["$"] = $
......
......@@ -892,6 +892,54 @@ public class DACoreService {
return new Timestamp(c.getTime().getTime());
}
/**
* 时间转换
* @param strTimp
* @return
*/
public static Timestamp getTimestamp(String strTimp) {
Timestamp timestamp = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat simpleDateFormatTwo = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat simpleDateFormatCST = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);
SimpleDateFormat simpleDateFormatGMT = new SimpleDateFormat("EEE MMM ddHH:mm:ss 'GMT' yyyy",Locale.US);
SimpleDateFormat simpleDateFormatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
try {
if(!StringUtils.isEmpty(strTimp) && !("null".equals(strTimp))) {
Date date = null;
if (strTimp.indexOf("CST") >= 0) {
date = simpleDateFormatCST.parse(strTimp);
timestamp = new Timestamp(date.getTime());
return timestamp;
}
if (strTimp.indexOf("GMT") >= 0) {
date = simpleDateFormatGMT.parse(strTimp);
timestamp = new Timestamp(date.getTime());
return timestamp;
}
if (strTimp.indexOf("UT") >= 0) {
date = simpleDateFormatUTC.parse(strTimp);
timestamp = new Timestamp(date.getTime());
return timestamp;
}
if (strTimp.length() == 19) {
date = simpleDateFormatTwo.parse(strTimp);
timestamp = new Timestamp(date.getTime());
return timestamp;
}
if(StringUtils.countOccurrencesOf("now", strTimp) != 0) {//strTimp等于now表示获取当前时间
date = new Date();
}else {
date = simpleDateFormat.parse(strTimp);
}
timestamp = new Timestamp(date.getTime());
}
} catch (Exception e) {
e.printStackTrace();
}
return timestamp;
}
public Timestamp getLastYear(Timestamp time)
{
Date date=new Date(time.getTime());
......
package cn.ibizlab.api.rest.extensions;
import cn.ibizlab.core.analysis.domain.DAReport;
import cn.ibizlab.core.analysis.service.impl.DAReportServiceImpl;
import cn.ibizlab.core.dict.domain.DictOption;
import cn.ibizlab.core.dict.service.impl.DictOptionServiceImpl;
import cn.ibizlab.core.extensions.service.DACoreService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.sql.Timestamp;
import java.util.List;
@Slf4j
@Api(tags = {"接口" })
@RestController("api-dagridcore")
@RequestMapping("")
public class DAGridCoreResource {
@Autowired
private DACoreService daCoreService;
@Autowired
@Lazy
private DAReportServiceImpl daReportService;
@Autowired
@Lazy
private DictOptionServiceImpl dictOptionService;
@RequestMapping(method = RequestMethod.POST, value = "/ibizutil/reportdatas")
public ResponseEntity<JSONObject> getReportdatas(@RequestBody JSONObject data) {
JSONObject responseJson = new JSONObject();
String id = data.getString("id");
String strLoadDimval = StringUtils.isEmpty(data.getString("domin")) ? "%" : data.getString("domin");
Timestamp strLoadStartTime = StringUtils.isEmpty(data.getString("startTime")) ? daCoreService.getDefaultStartTimestamp() :daCoreService.getTimestamp( data.getString("startTime"));
Timestamp strLoadEndTime = StringUtils.isEmpty(data.getString("endTime")) ? daCoreService.getDefaultEndTimestamp() : daCoreService.getTimestamp(data.getString("endTime"));
//获取表头及表单名称
DAReport daReport = daReportService.getById(id);
Object vmcfg = JSON.parse(daReport.getConfig());
String reportname = daReport.getReportName();
String strDict = "CL_DST_REGION";
if (daReport != null && !StringUtils.isEmpty(daReport.getDict())) {
strDict = daReport.getDict();
}
//获取表格数据
JSONObject jsonObject = daCoreService.getERPortData(daReport, strLoadDimval, strDict, strLoadStartTime, strLoadEndTime, "default");
responseJson.put("vmcfg",vmcfg);
responseJson.put("reportname",reportname);
responseJson.put("resportdata",jsonObject);
responseJson.put("dataDict", daReport.getDict());
return ResponseEntity.ok().body(responseJson);
}
@RequestMapping(method = RequestMethod.POST, value = "/ibizutil/getCodelist")
@Cacheable( value="getCodelist",key = "'getCodelist:'+#p0.getString(\"cid\")")
public ResponseEntity<JSONArray> getCodelist(@RequestBody JSONObject data) {
JSONArray result = new JSONArray();
String cid = data.getString("cid");
if (StringUtils.isEmpty(cid)){
log.error("未指定字典项过滤条件");
return ResponseEntity.ok().body(result);
}
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("cid",cid);
queryWrapper.orderByAsc("val");
List<DictOption> list = dictOptionService.list(queryWrapper);
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = null;
for (DictOption entity: list) {
jsonObject = new JSONObject();
jsonObject.put("id",entity.getValue());
jsonObject.put("value",entity.getValue());
jsonObject.put("text",entity.getLabel());
jsonObject.put("label",entity.getLabel());
jsonObject.put("parentValue",entity.getParent());
jsonObject.put("disabled",entity.getDisabled());
jsonArray.add(jsonObject);
}
result = getTrees(jsonArray,"");
return ResponseEntity.ok().body(result);
}
/**
* 递归创建树结构数据
* @param jsonArray
* @param parentValue
* @return
*/
public JSONArray getTrees(JSONArray jsonArray, Object parentValue) {
JSONArray trees = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
String codeItemParentValue = jsonObject.getString("parentValue");
if (StringUtils.isEmpty(codeItemParentValue)) {
codeItemParentValue = "";
}
if (parentValue.equals(codeItemParentValue)) {
JSONArray childCodeItemArray = getTrees(jsonArray, jsonObject.getString("value"));
if (childCodeItemArray.size() > 0) {
jsonObject.put("children",childCodeItemArray);
}
trees.add(jsonObject);
}
}
return trees;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册