报表工具

master
Leon 4 years ago
parent fe20048264
commit 845f7a785b

@ -0,0 +1,89 @@
package com.foreverwin.mesnac.common.controller;
import com.foreverwin.mesnac.common.model.CustomReport;
import com.foreverwin.mesnac.common.model.CustomReportConfig;
import com.foreverwin.mesnac.common.service.CustomReportConfigInterface;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* @Title: CustomReportConfigController.java
* @Package com.knsdev.webapi.ws
* @Description: Controller
* @author: Andy
* @date: 20201013 4:18:54
* @version V1.0
*
* @History
* 20201013 4:18:54 Andy add
*
* FDS
* ME-111-
*/
@RestController
@RequestMapping("/customReportConfig")
public class CustomReportConfigController {
@Autowired
private CustomReportConfigInterface configAPI;
//报表作业编号弹出框
@ResponseBody
@GetMapping("/rptiddialog/{site}")
public R rptIDDialogMethod(@PathVariable("site") String site)
{
try{
List<CustomReport> rptIDList = configAPI.GetReportIDList(site);
return R.ok(rptIDList);
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
//查询
@ResponseBody
@GetMapping("/query/{reportid}")
public R queryMethod(@PathVariable("reportid") String reportid)
{
try{
CustomReportConfig config = configAPI.Query(reportid);
return R.ok(config);
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
//保存
@ResponseBody
@PostMapping("/")
public R saveMethod(@RequestBody CustomReportConfig config)
{
try{
configAPI.Save(config);
return R.ok("Success");
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
//删除
@ResponseBody
@GetMapping("/del//{site}/{reportid}")
public R deleteMethod(@PathVariable("site") String site, @PathVariable("reportid") String reportid)
{
try{
configAPI.Delete(site, reportid);
return R.ok("Success");
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
}

@ -0,0 +1,64 @@
package com.foreverwin.mesnac.common.controller;
import com.foreverwin.mesnac.common.model.CustomReportConfig;
import com.foreverwin.mesnac.common.service.CustomReportInterface;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
*
* @Title: CustomReportController.java
* @Package com.knsdev.webapi.ws
* @Description: controller
* @author: Andy
* @date: 20201015 1:16:55
* @version V1.0
*
* @History
* 20201015 1:16:55 Andy add
*
* FDS
* MD-ME-112-
*
*/
@RestController
@RequestMapping("/customReport")
public class CustomReportController {
@Autowired
private CustomReportInterface reportAPI;
//页面载入
@ResponseBody
@GetMapping("/load/{site}/{reportid}")
public R loadMethod(@PathVariable("site") String site, @PathVariable("reportid") String reportid)
{
try{
CustomReportConfig config = reportAPI.Load(site, reportid);
return R.ok(config);
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
//查询
@ResponseBody
@PostMapping("/")
public R queryMethod(@RequestBody String condition)
{
try{
List<Map<String, Object>> res=reportAPI.Query(condition);
return R.ok(res);
} catch (Exception ex) {
return R.failed(ex.getMessage());
}
}
}

@ -0,0 +1,40 @@
package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.common.model.CustomReportMainmodel;
import com.foreverwin.mesnac.common.model.CustomReportSearchConditionConfig;
import com.foreverwin.mesnac.common.model.CustomReportSearchConditionDynSQLConfig;
import com.foreverwin.mesnac.common.model.CustomReportSearchResultColumnConfig;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CustomReportConfigMapper {
List<CustomReportMainmodel> selectReportIdDialog(String site);
List<CustomReportMainmodel> selectMain(@Param("site") String site, @Param("reportId") String reportId);
List<CustomReportSearchConditionConfig> selectSearchConditionConfig(String mainhandle);
List<CustomReportSearchConditionDynSQLConfig> selectDynSqlConfig(String mainhandle);
List<CustomReportSearchResultColumnConfig> selectResultColumnConfig(String mainhandle);
int deleteDynSqlConfig(String mainhandle);
int deleteResultColumnConfig(String mainhandle);
int deleteSearchConditionConfig(String mainhandle);
int deleteMainmodel(String mainhandle);
int insertDynSqlConfig(CustomReportSearchConditionDynSQLConfig customReportSearchConditionDynSQLConfig);
int insertResultColumnConfig(CustomReportSearchResultColumnConfig customReportSearchResultColumnConfig);
int insertSearchConditionConfig(CustomReportSearchConditionConfig customReportSearchConditionConfig);
int insertInsertMainmodel(CustomReportMainmodel customReportMainmodel);
}

@ -0,0 +1,17 @@
package com.foreverwin.mesnac.common.mapper;
import com.foreverwin.mesnac.common.model.CustomReportMainmodel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public interface CustomReportMapper {
List<Map<String, Object>> executeSqlQuery(@Param("sql") String sql);
List<CustomReportMainmodel> selectQuerySentence(@Param("site") String site, @Param("reportId") String reportId);
}

@ -0,0 +1,47 @@
package com.foreverwin.mesnac.common.model;
/**
*
* @Title: CustomReport.java
* @Package com.knsdev.service.domain
* @Description:
* @author: Andy
* @date: 20201015 2:29:25
* @version V1.0
*
* @History
* 20201015 2:29:25 Andy add
*
*/
public class CustomReport {
private String site;
private String reportID;
private String reportDESC;
private String conditionString;
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getReportID() {
return reportID;
}
public void setReportID(String reportID) {
this.reportID = reportID;
}
public String getConditionString() {
return conditionString;
}
public void setConditionString(String conditionString) {
this.conditionString = conditionString;
}
public String getReportDESC() {
return reportDESC;
}
public void setReportDESC(String reportDESC) {
this.reportDESC = reportDESC;
}
}

@ -0,0 +1,165 @@
package com.foreverwin.mesnac.common.model;
import java.util.List;
/**
*
* @Title: CustomReport.java
* @Package com.knsdev.service.domain
* @Description:
* @author: Andy
* @date: 20201013 3:33:42
* @version V1.0
*
* @History
* 20201013 3:33:42 Andy add
*
* FDS
* ME-111-
*/
public class CustomReportConfig {
private String handle;
private String site;
private String reportID;
private String reportTitle;
private String reportDESC;
//检索语句配置
private String conditionSQLConfig;
private String displayType;
private String timeRefresh;
private String backgroundColor;
private String fontColor;
private String pageSize;
private String user;
//自定义报表_检索条件配置 数据
private List<CustomReportSearchConditionConfig> searchConditionConfigList;
//自定义报表_检索条件动态SQL配置 数据
private List<CustomReportSearchConditionDynSQLConfig> searchConditionDynSQLConfigList;
//自定义报表_检索结果列配置
private List<CustomReportSearchResultColumnConfig> searchResultColumnList;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getReportID() {
return reportID;
}
public void setReportID(String reportID) {
this.reportID = reportID;
}
public String getReportTitle() {
return reportTitle;
}
public void setReportTitle(String reportTitle) {
this.reportTitle = reportTitle;
}
public String getReportDESC() {
return reportDESC;
}
public void setReportDESC(String reportDESC) {
this.reportDESC = reportDESC;
}
public String getConditionSQLConfig() {
return conditionSQLConfig;
}
public void setConditionSQLConfig(String conditionSQLConfig) {
this.conditionSQLConfig = conditionSQLConfig;
}
public String getDisplayType() {
return displayType;
}
public void setDisplayType(String displayType) {
this.displayType = displayType;
}
public String getTimeRefresh() {
return timeRefresh;
}
public void setTimeRefresh(String timeRefresh) {
this.timeRefresh = timeRefresh;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public String getPageSize() {
return pageSize;
}
public void setPageSize(String pageSize) {
this.pageSize = pageSize;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public List<CustomReportSearchConditionConfig> getSearchConditionConfigList() {
return searchConditionConfigList;
}
public void setSearchConditionConfigList(List<CustomReportSearchConditionConfig> searchConditionConfigList) {
this.searchConditionConfigList = searchConditionConfigList;
}
public List<CustomReportSearchConditionDynSQLConfig> getSearchConditionDynSQLConfigList() {
return searchConditionDynSQLConfigList;
}
public void setSearchConditionDynSQLConfigList(List<CustomReportSearchConditionDynSQLConfig> searchConditionDynSQLConfigList) {
this.searchConditionDynSQLConfigList = searchConditionDynSQLConfigList;
}
public List<CustomReportSearchResultColumnConfig> getSearchResultColumnList() {
return searchResultColumnList;
}
public void setSearchResultColumnList(List<CustomReportSearchResultColumnConfig> searchResultColumnList) {
this.searchResultColumnList = searchResultColumnList;
}
}

@ -0,0 +1,146 @@
package com.foreverwin.mesnac.common.model;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author Max
* @since 2021-07-09
*/
public class CustomReportMainmodel {
private static final long serialVersionUID = 1L;
private String handle;
private String site;
private String reportId;
private String reportTitle;
private String reportDesc;
private String conditionSqlConfig;
private String displayType;
private Integer timeRefresh;
private String backgroundColor;
private String fontColor;
private Integer pageSize;
private LocalDateTime modifyDateTime;
private String modifyUser;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getReportId() {
return reportId;
}
public void setReportId(String reportId) {
this.reportId = reportId;
}
public String getReportTitle() {
return reportTitle;
}
public void setReportTitle(String reportTitle) {
this.reportTitle = reportTitle;
}
public String getReportDesc() {
return reportDesc;
}
public void setReportDesc(String reportDesc) {
this.reportDesc = reportDesc;
}
public String getConditionSqlConfig() {
return conditionSqlConfig;
}
public void setConditionSqlConfig(String conditionSqlConfig) {
this.conditionSqlConfig = conditionSqlConfig;
}
public String getDisplayType() {
return displayType;
}
public void setDisplayType(String displayType) {
this.displayType = displayType;
}
public Integer getTimeRefresh() {
return timeRefresh;
}
public void setTimeRefresh(Integer timeRefresh) {
this.timeRefresh = timeRefresh;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public LocalDateTime getModifyDateTime() {
return modifyDateTime;
}
public void setModifyDateTime(LocalDateTime modifyDateTime) {
this.modifyDateTime = modifyDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
}

@ -0,0 +1,186 @@
package com.foreverwin.mesnac.common.model;
import java.util.Date;
import java.util.List;
/**
*
* @Title: CustomReportSearchCondition.java
* @Package com.knsdev.service.domain
* @Description:
* @author: Andy
* @date: 20201013 3:43:41
* @version V1.0
*
* @History
* 20201013 3:43:41 Andy add
*
* FDS
* ME-111-
*/
public class CustomReportSearchConditionConfig {
private Integer seq;
private String conditionName;
private String conditionField;
//栏位类别 弹出框DAILOG|输入框(TEXT)|日期输入框(DATETEXT)|复选框(CHECKBOX)
private String fieldType;
//弹出复选框数据获取SQL
private String dailogCheckboxSQL;
//REQ(必填)|NO_REQ(非必填)|GROUP_REQ(组合必填)
private String requiredType;
private Integer rowID;
private Integer columnID;
private Integer columnWidthPercent;
//自定义报表 Load后需赋上初值
private List<String> fieldValueList;
//增加insert所需字段
private String site;
private String customReportMainModelBo;
private Date modifyDateTime;
private String modifyUser;
private String handle;
public Integer getSeq() {
return seq;
}
public void setSeq(Integer seq) {
this.seq = seq;
}
public Integer getRowID() {
return rowID;
}
public void setRowID(Integer rowID) {
this.rowID = rowID;
}
public Integer getColumnID() {
return columnID;
}
public void setColumnID(Integer columnID) {
this.columnID = columnID;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getCustomReportMainModelBo() {
return customReportMainModelBo;
}
public void setCustomReportMainModelBo(String customReportMainModelBo) {
this.customReportMainModelBo = customReportMainModelBo;
}
/*public String getModifyDateTime() {
return modifyDateTime;
}
public void setModifyDateTime(String modifyDateTime) {
this.modifyDateTime = modifyDateTime;
}*/
public Date getModifyDateTime() {
return modifyDateTime;
}
public void setModifyDateTime(Date modifyDateTime) {
this.modifyDateTime = modifyDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
/*public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}*/
public String getConditionName() {
return conditionName;
}
public void setConditionName(String conditionName) {
this.conditionName = conditionName;
}
public String getConditionField() {
return conditionField;
}
public void setConditionField(String conditionField) {
this.conditionField = conditionField;
}
public String getFieldType() {
return fieldType;
}
public void setFieldType(String fieldType) {
this.fieldType = fieldType;
}
public String getDailogCheckboxSQL() {
return dailogCheckboxSQL;
}
public void setDailogCheckboxSQL(String dailogCheckboxSQL) {
this.dailogCheckboxSQL = dailogCheckboxSQL;
}
public String getRequiredType() {
return requiredType;
}
public void setRequiredType(String requiredType) {
this.requiredType = requiredType;
}
/*public String getRowID() {
return rowID;
}
public void setRowID(String rowID) {
this.rowID = rowID;
}
public String getColumnID() {
return columnID;
}
public void setColumnID(String columnID) {
this.columnID = columnID;
}*/
/*public String getColumnWidthPercent() {
return columnWidthPercent;
}
public void setColumnWidthPercent(String columnWidthPercent) {
this.columnWidthPercent = columnWidthPercent;
}*/
public Integer getColumnWidthPercent() {
return columnWidthPercent;
}
public void setColumnWidthPercent(Integer columnWidthPercent) {
this.columnWidthPercent = columnWidthPercent;
}
public List<String> getFieldValueList() {
return fieldValueList;
}
public void setFieldValueList(List<String> fieldValueList) {
this.fieldValueList = fieldValueList;
}
}

@ -0,0 +1,96 @@
package com.foreverwin.mesnac.common.model;
import java.time.LocalDateTime;
/**
*
* @Title: CustomReportSearchConditionDynSQLConfig.java
* @Package com.knsdev.service.domain
* @Description: SQL
* @author: Andy
* @date: 20201016 9:42:01
* @version V1.0
*
* @History
* 20201016 9:42:01 Andy add
*
*/
public class CustomReportSearchConditionDynSQLConfig {
private String seq;
private String dynConditionReplaceField;
private String dynamicConditionSQL;
private String conditionField;
//增加insert所需字段
private String site;
private String customReportMainModelBo;
private LocalDateTime modifyDateTime;
private String modifyUser;
private String handle;
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getCustomReportMainModelBo() {
return customReportMainModelBo;
}
public void setCustomReportMainModelBo(String customReportMainModelBo) {
this.customReportMainModelBo = customReportMainModelBo;
}
public LocalDateTime getModifyDateTime() {
return modifyDateTime;
}
public void setModifyDateTime(LocalDateTime modifyDateTime) {
this.modifyDateTime = modifyDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getDynConditionReplaceField() {
return dynConditionReplaceField;
}
public void setDynConditionReplaceField(String dynConditionReplaceField) {
this.dynConditionReplaceField = dynConditionReplaceField;
}
public String getDynamicConditionSQL() {
return dynamicConditionSQL;
}
public void setDynamicConditionSQL(String dynamicConditionSQL) {
this.dynamicConditionSQL = dynamicConditionSQL;
}
public String getConditionField() {
return conditionField;
}
public void setConditionField(String conditionField) {
this.conditionField = conditionField;
}
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
}

@ -0,0 +1,103 @@
package com.foreverwin.mesnac.common.model;
import java.time.LocalDateTime;
/**
*
* @Title: CustomReportSearchResultColumnConfig.java
* @Package com.knsdev.service.domain
* @Description: _
* @author: Andy
* @date: 20201016 9:45:03
* @version V1.0
*
* @History
* 20201016 9:45:03 Andy add
*
*/
public class CustomReportSearchResultColumnConfig {
private String seq;
private String columnField;
private String columnName;
private String columnWidthPercent;
//增加insert所需字段
private String handle;
private String site;
private String customReportMainModelBo;
private LocalDateTime modifyDateTime;
private String modifyUser;
public String getSeq() {
return seq;
}
public void setSeq(String seq) {
this.seq = seq;
}
public String getColumnField() {
return columnField;
}
public void setColumnField(String columnField) {
this.columnField = columnField;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getColumnWidthPercent() {
return columnWidthPercent;
}
public void setColumnWidthPercent(String columnWidthPercent) {
this.columnWidthPercent = columnWidthPercent;
}
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getCustomReportMainModelBo() {
return customReportMainModelBo;
}
public void setCustomReportMainModelBo(String customReportMainModelBo) {
this.customReportMainModelBo = customReportMainModelBo;
}
public LocalDateTime getModifyDateTime() {
return modifyDateTime;
}
public void setModifyDateTime(LocalDateTime modifyDateTime) {
this.modifyDateTime = modifyDateTime;
}
public String getModifyUser() {
return modifyUser;
}
public void setModifyUser(String modifyUser) {
this.modifyUser = modifyUser;
}
}

@ -0,0 +1,55 @@
package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.model.CustomReport;
import com.foreverwin.mesnac.common.model.CustomReportConfig;
import java.util.List;
/**
*
* @Title: CustomReportConfigInterface.java
* @Package com.knsdev.service
* @Description: interface
* @author: Andy
* @date: 20201014 9:48:58
* @version V1.0
*
* @History
* 20201014 9:48:58 Andy add
*
*/
public interface CustomReportConfigInterface {
/**
*
* @param site
* @return
* @throws Exception
*/
List<CustomReport> GetReportIDList(String site) throws Exception;
/**
*
* @param reportid
* @return
* @throws Exception
*/
CustomReportConfig Query(String reportid) throws Exception;
/**
*
* @param config
* @throws Exception
*/
void Save(CustomReportConfig config) throws Exception;
/**
*
*
* @param reportid
* @throws Exception
*/
void Delete(String site, String reportid) throws Exception;
}

@ -0,0 +1,41 @@
package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.model.CustomReportConfig;
import java.util.List;
import java.util.Map;
/**
*
* @Title: CustomReportInterface.java
* @Package com.knsdev.service
* @Description:
* @author: Andy
* @date: 20201015 1:20:01
* @version V1.0
*
* @History
* 20201015 1:20:01 Andy add
*
*/
public interface CustomReportInterface {
/**
*
* @param site
* @param reportid
* @return
* @throws Exception
*/
CustomReportConfig Load(String site, String reportid) throws Exception;
/**
*
* @param condition
* @return
* @throws Exception
*/
List<Map<String,Object>> Query(String condition) throws Exception;
}

@ -0,0 +1,301 @@
package com.foreverwin.mesnac.common.service.impl;
import com.foreverwin.mesnac.common.mapper.CustomReportConfigMapper;
import com.foreverwin.mesnac.common.model.*;
import com.foreverwin.mesnac.common.service.CustomReportConfigInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/**
*
* @Title: CustomReportConfigImpl.java
* @Package com.knsdev.service.impl
* @Description: Interface
* @author: Andy
* @date: 20201014 9:57:38
* @version V1.0
*
* @History
* 20201014 9:57:38 Andy add
*
*/
@Service
public class CustomReportConfigImpl implements CustomReportConfigInterface {
@Autowired
private CustomReportConfigMapper customReportConfigMapper;
@Override
public CustomReportConfig Query(String reportid) throws Exception {
//2020-11-6 andy, 因所有的 site共用配置所以此处site直接给*
String site="*";
CustomReportConfig config=new CustomReportConfig();
String mainHandle="CustomReportBO:"+site+","+reportid;
Map<String, Object> param = new HashMap<String, Object>();
param.put("SITE", site);
param.put("REPORT_ID", reportid);
//自定义报表_主要模块 数据
List<CustomReportMainmodel> map = customReportConfigMapper.selectMain( site,reportid );
if(map.size()<1)
{
throw new RuntimeException("查询无资料");
} else
{
//获取 Z_CUSTOM_REPORT_MAINMODEL 表中相关字段
config.setHandle(map.get(0).getHandle()==null?"":map.get(0).getHandle().toString());
config.setSite(site);
config.setReportID(reportid);
config.setReportTitle(map.get(0).getReportTitle()==null?"":map.get(0).getReportTitle().toString().trim());
config.setReportDESC(map.get(0).getReportDesc()==null?"":map.get(0).getReportDesc().toString().trim());
config.setConditionSQLConfig(map.get(0).getConditionSqlConfig()==null?"":map.get(0).getConditionSqlConfig().toString().trim());
config.setDisplayType(map.get(0).getDisplayType()==null?"":map.get(0).getDisplayType().toString().trim());
config.setTimeRefresh(map.get(0).getTimeRefresh()==null?"0":map.get(0).getTimeRefresh().toString());
config.setBackgroundColor(map.get(0).getBackgroundColor()==null?"":map.get(0).getBackgroundColor().toString().trim());
config.setFontColor(map.get(0).getFontColor()==null?"":map.get(0).getFontColor().toString().trim());
config.setPageSize(map.get(0).getPageSize()==null?"0":map.get(0).getPageSize().toString());
config.setUser(map.get(0).getModifyUser()==null?"":map.get(0).getModifyUser().toString().trim());//map.get(0).get("USER")
}
//自定义报表_检索条件配置 数据
List<CustomReportSearchConditionConfig> conditionConfigList=new ArrayList<CustomReportSearchConditionConfig>();
List<CustomReportSearchConditionConfig> searchConditionMap = customReportConfigMapper.selectSearchConditionConfig( mainHandle );
for(int i=0;i<searchConditionMap.size();i++)
{
CustomReportSearchConditionConfig searchConditionConfig=new CustomReportSearchConditionConfig();
searchConditionConfig.setSeq(searchConditionMap.get(i).getSeq()==null?0:searchConditionMap.get(i).getSeq());
searchConditionConfig.setConditionName(searchConditionMap.get(i).getConditionName()==null?"":searchConditionMap.get(i).getConditionName().toString());
searchConditionConfig.setConditionField(searchConditionMap.get(i).getConditionField()==null?"":searchConditionMap.get(i).getConditionField().toString());
searchConditionConfig.setFieldType(searchConditionMap.get(i).getFieldType()==null?"":searchConditionMap.get(i).getFieldType().toString());
searchConditionConfig.setDailogCheckboxSQL(searchConditionMap.get(i).getDailogCheckboxSQL()==null?"":searchConditionMap.get(i).getDailogCheckboxSQL().toString());
searchConditionConfig.setRequiredType(searchConditionMap.get(i).getRequiredType()==null?"":searchConditionMap.get(i).getRequiredType().toString());
searchConditionConfig.setRowID(searchConditionMap.get(i).getRowID()==null?1:searchConditionMap.get(i).getRowID());
searchConditionConfig.setColumnID(searchConditionMap.get(i).getColumnID()==null?1:searchConditionMap.get(i).getColumnID());
searchConditionConfig.setColumnWidthPercent(searchConditionMap.get(i).getColumnWidthPercent()==null?1:searchConditionMap.get(i).getColumnWidthPercent());
conditionConfigList.add(searchConditionConfig);
}
config.setSearchConditionConfigList(conditionConfigList);
//自定义报表_检索条件动态SQL配置
List<CustomReportSearchConditionDynSQLConfig> dynSQLConfigList=new ArrayList<CustomReportSearchConditionDynSQLConfig>();
List<CustomReportSearchConditionDynSQLConfig> dynSqlConfigMap = customReportConfigMapper.selectDynSqlConfig( mainHandle );
for(int i=0;i<dynSqlConfigMap.size();i++)
{
CustomReportSearchConditionDynSQLConfig dynSQLConfig=new CustomReportSearchConditionDynSQLConfig();
dynSQLConfig.setSeq(dynSqlConfigMap.get(i).getSeq()==null?"0":dynSqlConfigMap.get(i).getSeq().toString());
dynSQLConfig.setDynConditionReplaceField(dynSqlConfigMap.get(i).getDynConditionReplaceField()==null?"":dynSqlConfigMap.get(i).getDynConditionReplaceField().toString());
dynSQLConfig.setDynamicConditionSQL(dynSqlConfigMap.get(i).getDynamicConditionSQL()==null?"":dynSqlConfigMap.get(i).getDynamicConditionSQL().toString());
dynSQLConfig.setConditionField(dynSqlConfigMap.get(i).getConditionField()==null?"":dynSqlConfigMap.get(i).getConditionField().toString());
dynSQLConfigList.add(dynSQLConfig);
}
config.setSearchConditionDynSQLConfigList(dynSQLConfigList);
//自定义报表_检索结果列配置
List<CustomReportSearchResultColumnConfig> resultColumnConfigList=new ArrayList<CustomReportSearchResultColumnConfig>();
List<CustomReportSearchResultColumnConfig> resultColumnMap = customReportConfigMapper.selectResultColumnConfig( mainHandle );
for(int i=0;i<resultColumnMap.size();i++)
{
CustomReportSearchResultColumnConfig resultColumnConfig=new CustomReportSearchResultColumnConfig();
resultColumnConfig.setSeq(resultColumnMap.get(i).getSeq()==null?"0":resultColumnMap.get(i).getSeq().toString());
resultColumnConfig.setColumnField(resultColumnMap.get(i).getColumnField()==null?"":resultColumnMap.get(i).getColumnField().toString());
resultColumnConfig.setColumnName(resultColumnMap.get(i).getColumnName()==null?"":resultColumnMap.get(i).getColumnName().toString().trim());
resultColumnConfig.setColumnWidthPercent(resultColumnMap.get(i).getColumnWidthPercent()==null?"1":resultColumnMap.get(i).getColumnWidthPercent().toString().trim());
resultColumnConfigList.add(resultColumnConfig);
}
config.setSearchResultColumnList(resultColumnConfigList);
return config;
}
/* (non-Javadoc)
* @see com.knsdev.service.CustomReportConfigInterface#Save(com.knsdev.service.domain.CustomReportConfig)
*/
@Override
public void Save(CustomReportConfig config) throws Exception {
//2020-11-6 andy, 因所有的 site共用配置所以此处site直接给*
//String site=config.getSite().trim();
String site="*";
String reportID=config.getReportID().trim();
if(site.length()<1 || reportID.length()<1)
{
//70501.simple=站点、报表作业编号均不能为空
//throw Exceptions.convert(new BasicBOBeanException(70501,new Data()));
throw new RuntimeException("站点、报表作业编号均不能为空");
}
//1.删除 资料
Delete(site, reportID);
LocalDateTime dateTime = LocalDateTime.now();
String user=config.getUser();
String customReportBO="CustomReportBO:"+site+","+reportID;
//2.保存资料至 Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG
List<CustomReportSearchConditionConfig> configList=config.getSearchConditionConfigList();
if(configList!=null && configList.size() > 0) {
CustomReportSearchConditionConfig customReportSearchConditionConfig = new CustomReportSearchConditionConfig();
customReportSearchConditionConfig.setSite( site );
customReportSearchConditionConfig.setCustomReportMainModelBo( customReportBO );
customReportSearchConditionConfig.setModifyDateTime( new Date() );
customReportSearchConditionConfig.setModifyUser( user );
for(int i=0;i<configList.size();i++)
{
customReportSearchConditionConfig.setHandle( "CustomReportSearchConditonBO:"+UUID.randomUUID().toString() );
customReportSearchConditionConfig.setSeq( configList.get(i).getSeq()==null?0:configList.get(i).getSeq() );
customReportSearchConditionConfig.setConditionName( configList.get(i).getConditionName()==null?"":configList.get(i).getConditionName().trim() );
customReportSearchConditionConfig.setConditionField( configList.get(i).getConditionField()==null?"":configList.get(i).getConditionField().trim() );
customReportSearchConditionConfig.setFieldType( configList.get(i).getFieldType()==null?"":configList.get(i).getFieldType().trim() );
customReportSearchConditionConfig.setDailogCheckboxSQL( configList.get(i).getDailogCheckboxSQL()==null?"":configList.get(i).getDailogCheckboxSQL().trim() );
customReportSearchConditionConfig.setRequiredType( configList.get(i).getRequiredType()==null?"":configList.get(i).getRequiredType().trim() );
customReportSearchConditionConfig.setRowID( configList.get(i).getRowID()==null?1:configList.get(i).getRowID() );
customReportSearchConditionConfig.setColumnID( configList.get(i).getColumnID()==null?1:configList.get(i).getColumnID() );
customReportSearchConditionConfig.setColumnWidthPercent( configList.get(i).getColumnWidthPercent()==null?1:configList.get(i).getColumnWidthPercent() );
customReportConfigMapper.insertSearchConditionConfig( customReportSearchConditionConfig );
}
}
//3.保存资料至 Z_CUSTOM_REPORT_SEARCHCONDITION_DYNSQL_CONFIG
List<CustomReportSearchConditionDynSQLConfig> searchConditionDynSQLConfigList=config.getSearchConditionDynSQLConfigList();
if(searchConditionDynSQLConfigList!=null && searchConditionDynSQLConfigList.size() > 0) {
CustomReportSearchConditionDynSQLConfig customReportSearchConditionDynSQLConfig = new CustomReportSearchConditionDynSQLConfig();
customReportSearchConditionDynSQLConfig.setSite( site );
customReportSearchConditionDynSQLConfig.setCustomReportMainModelBo( customReportBO );
customReportSearchConditionDynSQLConfig.setModifyDateTime( dateTime );
customReportSearchConditionDynSQLConfig.setModifyUser( user );
for(int i=0;i<searchConditionDynSQLConfigList.size();i++)
{
customReportSearchConditionDynSQLConfig.setHandle( "CustomReportSearchConditonDynSQLBO:"+UUID.randomUUID().toString() );
customReportSearchConditionDynSQLConfig.setSeq( searchConditionDynSQLConfigList.get(i).getSeq()==null?"0":searchConditionDynSQLConfigList.get(i).getSeq().trim() );
customReportSearchConditionDynSQLConfig.setDynConditionReplaceField( searchConditionDynSQLConfigList.get(i).getDynConditionReplaceField()==null?"":searchConditionDynSQLConfigList.get(i).getDynConditionReplaceField().trim() );
customReportSearchConditionDynSQLConfig.setDynamicConditionSQL( searchConditionDynSQLConfigList.get(i).getDynamicConditionSQL()==null?"":searchConditionDynSQLConfigList.get(i).getDynamicConditionSQL().trim() );
customReportSearchConditionDynSQLConfig.setConditionField( searchConditionDynSQLConfigList.get(i).getConditionField()==null?"":searchConditionDynSQLConfigList.get(i).getConditionField().trim() );
customReportConfigMapper.insertDynSqlConfig( customReportSearchConditionDynSQLConfig );
}
}
//4.保存资料至 Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG
List<CustomReportSearchResultColumnConfig> searchResultColumnList=config.getSearchResultColumnList();
if(searchResultColumnList!=null && searchResultColumnList.size() > 0) {
CustomReportSearchResultColumnConfig customReportSearchResultColumnConfig = new CustomReportSearchResultColumnConfig();
customReportSearchResultColumnConfig.setSite( site );
customReportSearchResultColumnConfig.setCustomReportMainModelBo( customReportBO );
customReportSearchResultColumnConfig.setModifyDateTime( dateTime );
customReportSearchResultColumnConfig.setModifyUser( user );
for(int i=0;i<searchResultColumnList.size();i++)
{
customReportSearchResultColumnConfig.setHandle( "CustomReportSearchResultColumnBO"+UUID.randomUUID().toString() );
customReportSearchResultColumnConfig.setSeq( searchResultColumnList.get(i).getSeq()==null?"0":searchResultColumnList.get(i).getSeq().trim() );
customReportSearchResultColumnConfig.setColumnField( searchResultColumnList.get(i).getColumnField()==null?"":searchResultColumnList.get(i).getColumnField().trim());
customReportSearchResultColumnConfig.setColumnName( searchResultColumnList.get(i).getColumnName()==null?"":searchResultColumnList.get(i).getColumnName().trim() );
customReportSearchResultColumnConfig.setColumnWidthPercent( searchResultColumnList.get(i).getColumnWidthPercent()==null?"1":searchResultColumnList.get(i).getColumnWidthPercent().trim() );
customReportConfigMapper.insertResultColumnConfig( customReportSearchResultColumnConfig );
}
}
//5.保存资料至 Z_CUSTOM_REPORT_MAINMODEL
CustomReportMainmodel customReportMainmodel = new CustomReportMainmodel();
customReportMainmodel.setHandle( customReportBO );
customReportMainmodel.setSite( site );
customReportMainmodel.setReportId( reportID );
customReportMainmodel.setReportTitle( config.getReportTitle().trim() );
customReportMainmodel.setReportDesc( config.getReportDESC().trim() );
customReportMainmodel.setConditionSqlConfig( config.getConditionSQLConfig().trim() );
customReportMainmodel.setDisplayType( config.getDisplayType().trim() );
customReportMainmodel.setTimeRefresh( config.getTimeRefresh().trim().length()<1?0:Integer.parseInt( config.getTimeRefresh().trim()) );
customReportMainmodel.setBackgroundColor( config.getBackgroundColor().trim() );
customReportMainmodel.setFontColor( config.getFontColor().trim() );
customReportMainmodel.setPageSize( config.getPageSize().trim().length()<1?0:Integer.parseInt( config.getPageSize().trim() ) );
customReportMainmodel.setModifyDateTime( dateTime );
customReportMainmodel.setModifyUser( user );
customReportConfigMapper.insertInsertMainmodel( customReportMainmodel );
}
/* (non-Javadoc)
* @see com.knsdev.service.CustomReportConfigInterface#Delete(java.lang.String, java.lang.String)
*/
@Override
public void Delete(String site, String reportid) throws Exception {
site="*";
String handle="CustomReportBO:"+site+","+reportid;
//删除 Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG 数据
customReportConfigMapper.deleteSearchConditionConfig(handle);
//删除 Z_CUSTOM_REPORT_SEARCHCONDITION_DYNSQL_CONFIG 数据
customReportConfigMapper.deleteDynSqlConfig( handle );
//删除 Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG 数据
customReportConfigMapper.deleteResultColumnConfig( handle );
//删除 Z_CUSTOM_REPORT_MAINMODEL 数据
customReportConfigMapper.deleteMainmodel( handle );
}
/* (non-Javadoc)
* @see com.knsdev.service.CustomReportConfigInterface#GetReportIDList(java.lang.String)
*/
@Override
public List<CustomReport> GetReportIDList(String site) throws Exception {
List<CustomReport> customReportList=null;
site="*";
Map<String, Object> param = new HashMap<String, Object>();
param.put("SITE", site);
//List<Map<String,Object>> map=logicService.executeQuery(site, REPORTID_DIALOG_SQL, param);
List<CustomReportMainmodel> map = customReportConfigMapper.selectReportIdDialog( site );
if(map.size()>0)
{
customReportList=new ArrayList<CustomReport>();
CustomReport cr=null;
for(int i=0;i<map.size();i++)
{
cr=new CustomReport();
cr.setReportID(map.get(i).getReportId().trim());
cr.setReportDESC(map.get(i).getReportTitle()==null?"":map.get(i).getReportTitle().trim());
customReportList.add(cr);
}
}else
{
throw new RuntimeException("没有报表作业编号信息");
}
return customReportList;
}
}

@ -0,0 +1,295 @@
package com.foreverwin.mesnac.common.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.mapper.CustomReportConfigMapper;
import com.foreverwin.mesnac.common.mapper.CustomReportMapper;
import com.foreverwin.mesnac.common.model.*;
import com.foreverwin.mesnac.common.service.CustomReportInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* @Title: CustomReportImpl.java
* @Package com.knsdev.service.impl
* @Description:
* @author: Andy
* @date: 20201015 1:21:56
* @version V1.0
*
* @History
* 20201015 1:21:56 Andy add
*
*/
@Service
public class CustomReportImpl implements CustomReportInterface {
@Autowired
private CustomReportConfigMapper customReportConfigMapper;
@Autowired
private CustomReportMapper customReportMapper;
@Override
public CustomReportConfig Load(String site, String reportid) throws Exception {
CustomReportConfig config=new CustomReportConfig();
//2020-11-6 andy, 因所有的 site共用配置所以此处site直接给*
//String mainHandle="CustomReportBO:"+site+","+reportid;
String mainHandle="CustomReportBO:*,"+reportid;
Map<String, Object> param = new HashMap<String, Object>();
param.put("SITE", "*");
param.put("REPORT_ID", reportid);
//2020-11-6 andy, 因所有的 site共用配置所以此处site直接给*
//自定义报表_主要模块 数据
//List<Map<String,Object>> map=logicService.executeQuery(site, QUERY_MAIN_SQL, param);
//List<Map<String,Object>> map=logicService.executeQuery("*", QUERY_MAIN_SQL, param);
List<CustomReportMainmodel> map = customReportConfigMapper.selectMain("*", reportid);
if(map.size()<1)
{
//40025.simple = 查询无资料
//throw Exceptions.convert(new BasicBOBeanException(40025,new Data()));
throw new RuntimeException("查询无资料");
}else
{
if(map.get(0).getConditionSqlConfig()==null || map.get(0).getConditionSqlConfig().trim().length()<1)
{
//70502.simple=请在检索语句配置栏填写 SQL语句
//throw Exceptions.convert(new BasicBOBeanException(70502,new Data()));
throw new RuntimeException("请在检索语句配置栏填写 SQL语句 ");
}
//获取 Z_CUSTOM_REPORT_MAINMODEL 表中相关字段
config.setHandle(map.get(0).getHandle()==null?"":map.get(0).getHandle());
config.setSite(site);
config.setReportID(reportid);
config.setReportTitle(map.get(0).getReportTitle()==null?"":map.get(0).getReportTitle().trim());
config.setReportDESC(map.get(0).getReportDesc()==null?"":map.get(0).getReportDesc().toString().trim());
config.setConditionSQLConfig(map.get(0).getConditionSqlConfig()==null?"":map.get(0).getConditionSqlConfig().toString().trim());
config.setDisplayType(map.get(0).getDisplayType()==null?"":map.get(0).getDisplayType().toString().trim());
config.setTimeRefresh(map.get(0).getTimeRefresh()==null?"0":map.get(0).getTimeRefresh().toString());
config.setBackgroundColor(map.get(0).getBackgroundColor()==null?"":map.get(0).getBackgroundColor().toString().trim());
config.setFontColor(map.get(0).getFontColor()==null?"":map.get(0).getFontColor().toString().trim());
config.setPageSize(map.get(0).getPageSize()==null?"0":map.get(0).getPageSize().toString());
config.setUser(map.get(0).getModifyUser()==null?"":map.get(0).getModifyUser().toString().trim());
}
param=null;
//自定义报表_检索条件配置 数据
List<CustomReportSearchConditionConfig> conditionConfigList=new ArrayList<CustomReportSearchConditionConfig>();
param=new HashMap<String, Object>();
param.put("MAINHANDLE", mainHandle);
//map=logicService.executeQuery(site, QUERY_SEARCHCONDITIONCONFIG_SQL, param);
List<CustomReportSearchConditionConfig> searchConditionMap = customReportConfigMapper.selectSearchConditionConfig( mainHandle );
for(int i=0;i<searchConditionMap.size();i++)
{
CustomReportSearchConditionConfig searchConditionConfig=new CustomReportSearchConditionConfig();
searchConditionConfig.setSeq(searchConditionMap.get(i).getSeq()==null?0:searchConditionMap.get(i).getSeq());
searchConditionConfig.setConditionName(searchConditionMap.get(i).getConditionName()==null?"":searchConditionMap.get(i).getConditionName().toString());
searchConditionConfig.setConditionField(searchConditionMap.get(i).getConditionField()==null?"":searchConditionMap.get(i).getConditionField().toString());
searchConditionConfig.setFieldType(searchConditionMap.get(i).getFieldType()==null?"":searchConditionMap.get(i).getFieldType().toString());
searchConditionConfig.setDailogCheckboxSQL(searchConditionMap.get(i).getDailogCheckboxSQL()==null?"":searchConditionMap.get(i).getDailogCheckboxSQL().toString());
searchConditionConfig.setRequiredType(searchConditionMap.get(i).getRequiredType()==null?"":searchConditionMap.get(i).getRequiredType().toString());
searchConditionConfig.setRowID(searchConditionMap.get(i).getRowID()==null?1:searchConditionMap.get(i).getRowID());
searchConditionConfig.setColumnID(searchConditionMap.get(i).getColumnID()==null?1:searchConditionMap.get(i).getColumnID());
searchConditionConfig.setColumnWidthPercent(searchConditionMap.get(i).getColumnWidthPercent()==null?1:searchConditionMap.get(i).getColumnWidthPercent());
conditionConfigList.add(searchConditionConfig);
}
//更新检索条件栏位的值
int k=0;
for(CustomReportSearchConditionConfig searchConditionConfig:conditionConfigList)
{
if(searchConditionConfig.getDailogCheckboxSQL().trim().isEmpty())
{
conditionConfigList.get(k).setFieldValueList(new ArrayList());
}else
{
//当 弹出复选框数据获取SQL 有值时依SQL获取相应的字段值列表
//List<Map<String, Object>> result=logicService.executeQuery(site, searchConditionConfig.getDailogCheckboxSQL().trim(), new HashMap<String,Object>());
List<Map<String, Object>> result = customReportMapper.executeSqlQuery( searchConditionConfig.getDailogCheckboxSQL().trim() );
if(result.size()>0)
{
List<String> lst=new ArrayList<String>();
for(Map<String,Object> m:result)
{
for(String key:m.keySet())
{
lst.add(m.get(key).toString());
}
}
conditionConfigList.get(k).setFieldValueList(lst);
}
}
k++;
}
config.setSearchConditionConfigList(conditionConfigList);
//自定义报表_检索结果列配置
List<CustomReportSearchResultColumnConfig> resultColumnConfigList=new ArrayList<CustomReportSearchResultColumnConfig>();
//map=logicService.executeQuery(site, QUERY_RESULTCOLUMNCONFIG_SQL, param);
List<CustomReportSearchResultColumnConfig> resultColumnMap = customReportConfigMapper.selectResultColumnConfig( mainHandle );
for(int i=0;i<resultColumnMap.size();i++)
{
CustomReportSearchResultColumnConfig resultColumnConfig=new CustomReportSearchResultColumnConfig();
resultColumnConfig.setSeq(resultColumnMap.get(i).getSeq()==null?"0":resultColumnMap.get(i).getSeq().toString());
resultColumnConfig.setColumnField(resultColumnMap.get(i).getColumnField()==null?"":resultColumnMap.get(i).getColumnField().toString().trim());
resultColumnConfig.setColumnName(resultColumnMap.get(i).getColumnName()==null?"":resultColumnMap.get(i).getColumnName().toString().trim());
resultColumnConfig.setColumnWidthPercent(resultColumnMap.get(i).getColumnWidthPercent()==null?"1":resultColumnMap.get(i).getColumnWidthPercent().toString().trim());
resultColumnConfigList.add(resultColumnConfig);
}
config.setSearchResultColumnList(resultColumnConfigList);
param=null;
map=null;
return config;
}
/* (non-Javadoc)
* @see com.knsdev.service.CustomReportInterface#Query(java.lang.String)
*/
@Override
public List<Map<String, Object>> Query(String condition) throws Exception {
JSONObject object = JSONObject.parseObject(condition);
String site=object.getString("site");
String reportID=object.getString("reportID");
if((site==null || site.trim().isEmpty()) || (reportID==null || reportID.trim().isEmpty()))
{
//70501.simple=站点、报表作业编号均不能为空
//throw Exceptions.convert(new BasicBOBeanException(70501,new Data()));
throw new RuntimeException("站点、报表作业编号均不能为空");
}
//1.获取检索语句配置
String querySentence="";
Map<String, Object> param = new HashMap<String, Object>();
param.put("SITE", "*");
param.put("REPORT_ID", reportID);
//List<Map<String,Object>> map=logicService.executeQuery("*", GET_QUERY_SENTENCE_SQL, param);
List<CustomReportMainmodel> map= customReportMapper.selectQuerySentence("*",reportID);
if(map.size()>0)
{
querySentence=map.get(0).getConditionSqlConfig()==null?"":map.get(0).getConditionSqlConfig();
}
if(querySentence.trim().isEmpty())
{
//70502.simple=请在检索语句配置栏填写 SQL语句
//throw Exceptions.convert(new BasicBOBeanException(70502,new Data()));
throw new RuntimeException("请在检索语句配置栏填写 SQL语句");
}
param=null;
//2.依定的规则 检索语句中需替换的内容 以 :开头,所以此处依:先做下判断是否有需替换的内容
if(querySentence.indexOf(":")>1)
{
//处理需替换的数据
//自定义报表_检索条件动态SQL配置
List<CustomReportSearchConditionDynSQLConfig> dynSQLConfigList=new ArrayList<CustomReportSearchConditionDynSQLConfig>();
param = new HashMap<String, Object>();
param.put("MAINHANDLE", "CustomReportBO:*,"+reportID);
//map=logicService.executeQuery(site, QUERY_DYNSQLCONFIG_SQL, param);
List<CustomReportSearchConditionDynSQLConfig> dynSqlConfigMap = customReportConfigMapper.selectDynSqlConfig( "CustomReportBO:*,"+reportID );
for(int i=0;i<dynSqlConfigMap.size();i++)
{
if(dynSqlConfigMap.get(i).getDynConditionReplaceField()==null || dynSqlConfigMap.get(i).getDynConditionReplaceField().trim().isEmpty() || dynSqlConfigMap.get(i).getDynamicConditionSQL()==null || dynSqlConfigMap.get(i).getDynamicConditionSQL().trim().isEmpty() || dynSqlConfigMap.get(i).getConditionField()==null || dynSqlConfigMap.get(i).getConditionField().trim().isEmpty())
{
//70503.simple=自定义报表配置的检索条件动态SQL配置模块 各栏位均需填写有效值
//throw Exceptions.convert(new BasicBOBeanException(70503,new Data()));
throw new RuntimeException("自定义报表配置的检索条件动态SQL配置模块 各栏位均需填写有效值");
}
if(object.getString(dynSqlConfigMap.get(i).toString())==null || object.getString(dynSqlConfigMap.get(i).getConditionField()).isEmpty())
{
//当前台的json格式字串中没有 依赖条件的值时,即表示查询条件中无此项,可直接赋空字串
//queryMap.put(map.get(i).get("DYN_CONDITION_REPLACE_FIELD").toString().trim(), "");
querySentence=querySentence.replaceAll(dynSqlConfigMap.get(i).getDynConditionReplaceField().trim(), " ");
}else
{
// 2020-11-5 andy ,
//因在 检索条件动态SQL配置 时输入的动态条件SQL为 AND SFC=@SFC 或 AND SFC IN(@SFC) 所以跟前台商定 当有多个值时,中间用 , 分隔;后台接收后做处理
String[] vlsp=object.getString(dynSqlConfigMap.get(i).getConditionField().trim()).split(",");
StringBuilder sb=new StringBuilder();
int j=0;
for(int k=0;k<vlsp.length;k++)
{
j++;
if(j<vlsp.length)
{
sb.append("'"+vlsp[k].toString().trim()+"',");
}else
{
sb.append("'"+vlsp[k].toString().trim()+"'");
}
}
querySentence=querySentence.replaceAll(dynSqlConfigMap.get(i).getDynConditionReplaceField().trim(), dynSqlConfigMap.get(i).getDynamicConditionSQL().trim().replace("@"+dynSqlConfigMap.get(i).getConditionField().trim(), sb.toString())
.replace("#"+dynSqlConfigMap.get(i).getConditionField().toString().trim(), "'%"+sb.toString().substring(1, sb.toString().length()-1)+"%'"));
// queryMap.put(map.get(i).get("DYN_CONDITION_REPLACE_FIELD").toString().trim(), map.get(i).get("DYNAMIC_CONDITION_SQL").toString().trim().replace("@"+map.get(i).get("CONDITION_FIELD").toString().trim(), object.optString(map.get(i).get("CONDITION_FIELD").toString().trim())));
}
}
}
//3.执行查询
Map<String,Object> siteParam=new HashMap<String, Object>();
//siteParam.put("SITE", site);
//替换站点 2021/08/19
querySentence = querySentence.replace(":SITE","\'"+site+"\'");
//List<Map<String, Object>> result=logicService.executeQuery(site, querySentence,siteParam);
List<Map<String, Object>> result= customReportMapper.executeSqlQuery( querySentence );
//2020-11-17 andy add;解决value值为null时转json会被移除的问题
for(int i=0;i<result.size();i++)
{
for(Map.Entry<String, Object> entry:result.get(i).entrySet())
{
if(entry.getValue()==null)
{
result.get(i).put(entry.getKey(), " ");
}
}
}
return result;
}
}

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.common.mapper.CustomReportConfigMapper">
<resultMap type="com.foreverwin.mesnac.common.model.CustomReportMainmodel" id="CustomReportMainmodelResult">
<result property="handle" column="HANDLE" />
<result property="site" column="SITE" />
<result property="reportId" column="REPORT_ID" />
<result property="reportTitle" column="REPORT_TITLE" />
<result property="reportDesc" column="REPORT_DESC" />
<result property="conditionSqlConfig" column="CONDITION_SQL_CONFIG" />
<result property="displayType" column="DISPLAY_TYPE" />
<result property="timeRefresh" column="TIME_REFRESH" />
<result property="backgroundColor" column="BACKGROUND_COLOR" />
<result property="fontColor" column="FONT_COLOR" />
<result property="pageSize" column="PAGE_SIZE" />
<result property="modifyDateTime" column="MODIFY_DATE_TIME" />
<result property="modifyUser" column="MODIFY_USER" />
</resultMap>
<resultMap type="com.foreverwin.mesnac.common.model.CustomReportSearchConditionConfig" id="CustomReportSearchConditionConfigResult">
<result property="handle" column="HANDLE" />
<result property="site" column="SITE" />
<result property="customReportMainModelBo" column="CUSTOM_REPORT_MAIN_MODEL_BO" />
<result property="seq" column="SEQ" />
<result property="conditionName" column="CONDITION_NAME" />
<result property="conditionField" column="CONDITION_FIELD" />
<result property="fieldType" column="FIELD_TYPE" />
<result property="dailogCheckboxSQL" column="DIALOG_CHKBOX_SQL" />
<result property="requiredType" column="REQUIRED_TYPE" />
<result property="rowID" column="ROW_ID" />
<result property="columnID" column="COLUMN_ID" />
<result property="columnWidthPercent" column="COLUMN_WIDTH_PERCENT" />
<result property="modifyDateTime" column="MODIFY_DATE_TIME" />
<result property="modifyUser" column="MODIFY_USER" />
</resultMap>
<resultMap type="com.foreverwin.mesnac.common.model.CustomReportSearchConditionDynSQLConfig" id="CustomReportSearchConditionDynSQLConfigResult">
<result property="handle" column="HANDLE" />
<result property="site" column="SITE" />
<result property="customReportMainModelBo" column="CUSTOM_REPORT_MAIN_MODEL_BO" />
<result property="seq" column="SEQ" />
<result property="dynConditionReplaceField" column="DYN_CONDITION_REPLACE_FIELD" />
<result property="dynamicConditionSQL" column="DYNAMIC_CONDITION_SQL" />
<result property="conditionField" column="CONDITION_FIELD" />
<result property="modifyDateTime" column="MODIFY_DATE_TIME" />
<result property="modifyUser" column="MODIFY_USER" />
</resultMap>
<resultMap type="com.foreverwin.mesnac.common.model.CustomReportSearchResultColumnConfig" id="CustomReportSearchResultColumnConfigResult">
<result property="handle" column="HANDLE" />
<result property="site" column="SITE" />
<result property="customReportMainModelBo" column="CUSTOM_REPORT_MAIN_MODEL_BO" />
<result property="seq" column="SEQ" />
<result property="columnField" column="COLUMN_FIELD" />
<result property="columnName" column="COLUMN_NAME" />
<result property="columnWidthPercent" column="COLUMN_WIDTH_PERCENT" />
<result property="modifyDateTime" column="MODIFY_DATE_TIME" />
<result property="modifyUser" column="MODIFY_USER" />
</resultMap>
<select id="selectReportIdDialog" resultMap="CustomReportMainmodelResult">
SELECT REPORT_ID,REPORT_TITLE
FROM Z_CUSTOM_REPORT_MAINMODEL
WHERE SITE=#{SITE}
</select>
<select id="selectMain" resultMap="CustomReportMainmodelResult">
SELECT HANDLE, SITE, REPORT_ID, REPORT_TITLE, REPORT_DESC, CONDITION_SQL_CONFIG, DISPLAY_TYPE, TIME_REFRESH,
BACKGROUND_COLOR, FONT_COLOR, PAGE_SIZE, MODIFY_DATE_TIME, MODIFY_USER
FROM Z_CUSTOM_REPORT_MAINMODEL
WHERE SITE='*' AND REPORT_ID=#{reportId}
</select>
<select id="selectSearchConditionConfig" resultMap="CustomReportSearchConditionConfigResult">
SELECT SEQ, CONDITION_NAME, CONDITION_FIELD, FIELD_TYPE, DIALOG_CHKBOX_SQL, REQUIRED_TYPE,
ROW_ID, COLUMN_ID, COLUMN_WIDTH_PERCENT
FROM Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
</select>
<select id="selectDynSqlConfig" resultMap="CustomReportSearchConditionDynSQLConfigResult">
SELECT SEQ, DYN_CONDITION_REPLACE_FIELD, DYNAMIC_CONDITION_SQL, CONDITION_FIELD
FROM Z_CUSTOM_REPORT_SEARCHCONDITION_DYNSQL_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
</select>
<select id="selectResultColumnConfig" resultMap="CustomReportSearchResultColumnConfigResult">
SELECT SEQ, COLUMN_FIELD, COLUMN_NAME, COLUMN_WIDTH_PERCENT
FROM Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
ORDER BY TO_NUMBER(SEQ)
</select>
<delete id="deleteDynSqlConfig" parameterType="String">
DELETE FROM Z_CUSTOM_REPORT_SEARCHCONDITION_DYNSQL_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
</delete>
<delete id="deleteResultColumnConfig" parameterType="String">
DELETE FROM Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
</delete>
<delete id="deleteSearchConditionConfig" parameterType="String">
DELETE FROM Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG
WHERE CUSTOM_REPORT_MAIN_MODEL_BO=#{mainhandle}
</delete>
<delete id="deleteMainmodel" parameterType="String">
DELETE FROM Z_CUSTOM_REPORT_MAINMODEL
WHERE HANDLE=#{mainhandle}
</delete>
<insert id="insertDynSqlConfig" parameterType="com.foreverwin.mesnac.common.model.CustomReportSearchConditionDynSQLConfig">
INSERT INTO Z_CUSTOM_REPORT_SEARCHCONDITION_DYNSQL_CONFIG (HANDLE, CUSTOM_REPORT_MAIN_MODEL_BO, SEQ,
DYN_CONDITION_REPLACE_FIELD, DYNAMIC_CONDITION_SQL, CONDITION_FIELD, MODIFY_DATE_TIME, MODIFY_USER)
VALUES(#{handle}, #{customReportMainModelBo}, #{seq}, #{dynConditionReplaceField}, #{dynamicConditionSQL},
#{conditionField}, #{modifyDateTime}, #{modifyUser})
</insert>
<!--<insert id="insertResultColumnConfig" parameterType="CustomReportSearchResultColumnConfig">
INSERT INTO Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG (HANDLE, CUSTOM_REPORT_MAIN_MODEL_BO, SEQ,
COLUMN_NAME, COLUMN_WIDTH_PERCENT, MODIFY_DATE_TIME, MODIFY_USER)
VALUES(#{handle}, #{customReportMainModelBo}, #{seq}, #{columnName}, #{columnWidthPercent}, #{modifyDateTime}, #{modifyUser})
</insert>-->
<insert id="insertResultColumnConfig" parameterType="com.foreverwin.mesnac.common.model.CustomReportSearchResultColumnConfig">
insert into Z_CUSTOM_REPORT_SEARCHRESULT_COLUMN_CONFIG
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="handle != null ">HANDLE,</if>
<if test="customReportMainModelBo != null and customReportMainModelBo != '' ">CUSTOM_REPORT_MAIN_MODEL_BO,</if>
<if test="seq != null and seq != '' ">SEQ,</if>
<if test="columnField != null and columnField != '' ">COLUMN_FIELD,</if>
<if test="columnName != null and columnName != '' ">COLUMN_NAME,</if>
<if test="columnWidthPercent != null and columnWidthPercent != '' ">COLUMN_WIDTH_PERCENT,</if>
<if test="modifyDateTime != null ">MODIFY_DATE_TIME,</if>
<if test="modifyUser != null ">MODIFY_USER,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="handle != null ">#{handle},</if>
<if test="customReportMainModelBo != null and customReportMainModelBo != '' ">#{customReportMainModelBo},</if>
<if test="seq != null and seq != '' ">#{seq},</if>
<if test="columnField != null and columnField != '' ">#{columnField},</if>
<if test="columnName != null and columnName != '' ">#{columnName},</if>
<if test="columnWidthPercent != null and columnWidthPercent != '' ">#{columnWidthPercent},</if>
<if test="modifyDateTime != null ">#{modifyDateTime},</if>
<if test="modifyUser != null ">#{modifyUser},</if>
</trim>
</insert>
<!--<insert id="insertSearchConditionConfig" parameterType="CustomReportSearchConditionConfig">
INSERT INTO Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG
(HANDLE, SITE, CUSTOM_REPORT_MAIN_MODEL_BO, SEQ, CONDITION_NAME, CONDITION_FIELD, FIELD_TYPE, DIALOG_CHKBOX_SQL, REQUIRED_TYPE, ROW_ID, COLUMN_ID, COLUMN_WIDTH_PERCENT, MODIFY_DATE_TIME, MODIFY_USER)
VALUES(#{handle}, #{site}, #{customReportMainModelBo}, #{seq}, #{conditionName}, #{conditionField}, #{fieldType}, #{dailogCheckboxSQL}, #{requiredType}, #{rowID}, #{columnID}, #{columnWidthPercent}, #{modifyDateTime}, #{modifyUser})
</insert>-->
<!-- <insert id="insertSearchConditionConfig" >
insert into Z_CUSTOM_REPORT_MAINMODEL
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="_parameter != null ">HANDLE,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="_parameter != null ">#{handle},</if>
</trim>
</insert>-->
<insert id="insertSearchConditionConfig" parameterType="com.foreverwin.mesnac.common.model.CustomReportSearchConditionConfig">
insert into Z_CUSTOM_REPORT_SEARCHCONDITION_CONFIG
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="handle != null ">HANDLE,</if>
<if test="site != null and site != '' ">SITE,</if>
<if test="customReportMainModelBo != null and customReportMainModelBo != '' ">CUSTOM_REPORT_MAIN_MODEL_BO,</if>
<if test="seq != null">SEQ,</if>
<if test="conditionName != null and conditionName != '' ">CONDITION_NAME,</if>
<if test="conditionField != null and conditionField != '' ">CONDITION_FIELD,</if>
<if test="fieldType != null and fieldType != '' ">FIELD_TYPE,</if>
<if test="dailogCheckboxSQL != null and dailogCheckboxSQL != '' ">DIALOG_CHKBOX_SQL,</if>
<if test="requiredType != null and requiredType != '' ">REQUIRED_TYPE,</if>
<if test="rowID != null">ROW_ID,</if>
<if test="columnID != null ">COLUMN_ID,</if>
<if test="columnWidthPercent != null ">COLUMN_WIDTH_PERCENT,</if>
<if test="modifyDateTime != null ">MODIFY_DATE_TIME,</if>
<if test="modifyUser != null ">MODIFY_USER,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="handle != null ">#{handle},</if>
<if test="site != null and site != '' ">#{site},</if>
<if test="customReportMainModelBo != null and customReportMainModelBo != '' ">#{customReportMainModelBo},</if>
<if test="seq != null ">#{seq},</if>
<if test="conditionName != null and conditionName != '' ">#{conditionName},</if>
<if test="conditionField != null and conditionField != '' ">#{conditionField},</if>
<if test="fieldType != null and fieldType != '' ">#{fieldType},</if>
<if test="dailogCheckboxSQL != null and dailogCheckboxSQL != '' ">#{dailogCheckboxSQL},</if>
<if test="requiredType != null and requiredType != '' ">#{requiredType},</if>
<if test="rowID != null ">#{rowID},</if>
<if test="columnID != null ">#{columnID},</if>
<if test="columnWidthPercent != null ">#{columnWidthPercent},</if>
<if test="modifyDateTime != null ">#{modifyDateTime},</if>
<if test="modifyUser != null ">#{modifyUser},</if>
</trim>
</insert>
<insert id="insertInsertMainmodel" parameterType="com.foreverwin.mesnac.common.model.CustomReportMainmodel">
INSERT INTO Z_CUSTOM_REPORT_MAINMODEL
(HANDLE, SITE, REPORT_ID, REPORT_TITLE, REPORT_DESC, CONDITION_SQL_CONFIG, DISPLAY_TYPE, TIME_REFRESH, BACKGROUND_COLOR, FONT_COLOR, PAGE_SIZE, MODIFY_DATE_TIME, MODIFY_USER)
VALUES(#{handle}, #{site}, #{reportId}, #{reportTitle}, #{reportDesc}, #{conditionSqlConfig}, #{displayType}, #{timeRefresh}, #{backgroundColor}, #{fontColor}, #{pageSize}, #{modifyDateTime}, #{modifyUser})
</insert>
</mapper>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.foreverwin.mesnac.common.mapper.CustomReportMapper">
<resultMap type="com.foreverwin.mesnac.common.model.CustomReportMainmodel" id="CustomReportMainmodelResult">
<result property="handle" column="HANDLE" />
<result property="site" column="SITE" />
<result property="reportId" column="REPORT_ID" />
<result property="reportTitle" column="REPORT_TITLE" />
<result property="reportDesc" column="REPORT_DESC" />
<result property="conditionSqlConfig" column="CONDITION_SQL_CONFIG" />
<result property="displayType" column="DISPLAY_TYPE" />
<result property="timeRefresh" column="TIME_REFRESH" />
<result property="backgroundColor" column="BACKGROUND_COLOR" />
<result property="fontColor" column="FONT_COLOR" />
<result property="pageSize" column="PAGE_SIZE" />
<result property="modifyDateTime" column="MODIFY_DATE_TIME" />
<result property="modifyUser" column="MODIFY_USER" />
</resultMap>
<select id="selectQuerySentence" resultMap="CustomReportMainmodelResult">
SELECT CONDITION_SQL_CONFIG
FROM Z_CUSTOM_REPORT_MAINMODEL
WHERE SITE=#{site} AND REPORT_ID=#{reportId}
</select>
<select id="executeSqlQuery" resultType="java.util.Map">
${sql}
</select>
</mapper>

@ -9,7 +9,7 @@ spring:
jndi-name: jdbc/jts/wipPool
activemq:
enabled: false
brokerUrl: tcp://121.36.58.109:61616?wireFormat.maxInactivityDuration=0
brokerUrl: tcp://172.16.251.166:61616?wireFormat.maxInactivityDuration=0
password: admin
user: admin
pool:
@ -25,17 +25,18 @@ ws:
pwd: a123456
valid: N
#ftp
ftp:
host:
host: 172.16.251.165
port: 21
username:
password:
#打印服务器配置
#打印服务
print:
server: http://10.10.170.32:8022/print/mesnacprint
#文件模板路径
exportDocument:
filePath: /usr/word/
outputPath: /usr/word/outputWord/

@ -20,7 +20,6 @@ public class TmdMc {
@Test
public void callErpWebService() throws RemoteException {
String shopOrder = "SO20210714";

@ -67,7 +67,7 @@ public class SfcDispatchController {
*/
@ResponseBody
@GetMapping("getSfcDispatch")
public R getSfcDispatch(String workCenter, String dispatchStatus, String item, String itemNumber, String workOrder, String shopOrder,
public R getSfcDispatch(String workCenter, String dispatchStatus, String item, String itemNumber, String workOrder, String shopOrder, String blankingSize,
String resrce, String resourceType, String operation, String operationDescription, String sfc, String component, String componentDescription, String turnOperation,
String isDispatch, String startFromDate_S, String startToDate_S, String completeFromDate_S, String completeToDate_S) {
List<SfcDispatchDto> list;
@ -85,6 +85,7 @@ public class SfcDispatchController {
sfcDispatchDto.setResourceType(resourceType);
sfcDispatchDto.setOperation(operation);
sfcDispatchDto.setSfc(sfc);
sfcDispatchDto.setBlankingSize(blankingSize);
sfcDispatchDto.setComponent(component);
sfcDispatchDto.setComponentDescription(componentDescription);
sfcDispatchDto.setTurnOperation(turnOperation);

@ -391,13 +391,13 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
}
if (StringUtil.notBlank(itemGroup) && "GB".equals(itemGroup)) {
if (!blankingSize.contains("*") || blankingSize.split("\\*").length < 2) {
if (!blankingSize.contains("×") || blankingSize.split("×").length < 2) {
callItem.setSizeReqQty(callItem.getRequiredQty());
compQtyMap.put(component, callItem.getRequiredQty());
continue;
}
String []size = blankingSize.split("\\*");
String []size = blankingSize.split("×");
if (size != null && size.length >= 2) {
int sizeLength = size.length;
BigDecimal length = new BigDecimal(size[sizeLength-1]);
@ -410,8 +410,8 @@ public class CallItemServiceImpl extends ServiceImpl<CallItemMapper, CallItem> i
}
} else {
String[] size = new String[1];
if (blankingSize.contains("*")) {
size = blankingSize.split("\\*");
if (blankingSize.contains("×")) {
size = blankingSize.split("×");
} else {
size[0] = blankingSize;
}

@ -740,6 +740,9 @@
<if test="isDispatch != null and isDispatch != ''">
AND SD.IS_DISPATCH = #{isDispatch}
</if>
<if test="blankingSize != null and blankingSize != ''">
AND SD.BLANKING_SIZE LIKE '%'||#{blankingSize}||'%'
</if>
<if test="startFromDate != null">
AND SO.PLANNED_START_DATE >= #{startFromDate}
</if>

@ -1,5 +1,7 @@
package com.foreverwin.mesnac.listener.util;
import java.math.BigDecimal;
public class ConstantsUtil {
public static String Y = "Y";
public static String N = "N";

Loading…
Cancel
Save