Commit ad141bc5 authored by 胡斌's avatar 胡斌

Merge remote-tracking branch 'origin/liuna'

# Conflicts: # .idea/workspace.xml # target/classes/com/hp/cmsz/repository/TSWB_YZDetailDataDao.class # target/classes/com/hp/cmsz/service/analysissupport/TSWBAnalysisService.class
parents f08dc434 7959a444
<component name="ArtifactManager"> <component name="ArtifactManager">
<artifact type="exploded-war" build-on-make="true" name="CmszMonitorAnalysis"> <artifact type="exploded-war" name="CmszMonitorAnalysis">
<output-path>$PROJECT_DIR$/out/artifacts/CmszMonitorAnalysis</output-path> <output-path>$PROJECT_DIR$/out/artifacts/CmszMonitorAnalysis</output-path>
<root id="root"> <root id="root">
<element id="directory" name="WEB-INF"> <element id="directory" name="WEB-INF">
...@@ -151,6 +151,7 @@ ...@@ -151,6 +151,7 @@
<element id="library" level="module" name="XmlSchema-1.1.jar" module-name="CmszMonitorAnalysis" /> <element id="library" level="module" name="XmlSchema-1.1.jar" module-name="CmszMonitorAnalysis" />
<element id="library" level="module" name="xmlsec-1.3.0-1.0.0.jar" module-name="CmszMonitorAnalysis" /> <element id="library" level="module" name="xmlsec-1.3.0-1.0.0.jar" module-name="CmszMonitorAnalysis" />
<element id="file-copy" path="$PROJECT_DIR$/lib/freemarker.jar" /> <element id="file-copy" path="$PROJECT_DIR$/lib/freemarker.jar" />
<element id="library" level="project" name="lib" />
<element id="library" level="application" name="servlet-api" /> <element id="library" level="application" name="servlet-api" />
</element> </element>
</element> </element>
......
package com.hp.cmsz.entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* dim_province_all_info_t表对应的实体类
*
*
*
*/
@Entity
@Table(name = "dim_province_all_info_t")
public class ProvinceAll implements Serializable{
private Long provinceId;//省份ID
private String provinceName;//省份名称
private String provinceCode;//省份编码
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ProvinceSequence")
@SequenceGenerator(name = "ProvinceSequence", sequenceName = "dim_province_info_t_seq", allocationSize=1)
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public String getProvinceName() {
return provinceName;
}
public void setProvinceName(String provinceName) {
this.provinceName = provinceName;
}
public String getProvinceCode() {
return provinceCode;
}
public void setProvinceCode(String provinceCode) {
this.provinceCode = provinceCode;
}
}
\ No newline at end of file
package com.hp.cmsz.repository;
import com.hp.cmsz.entity.ProvinceAll;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ProvinceAllDao extends JpaSpecificationExecutor<ProvinceAll>,
PagingAndSortingRepository<ProvinceAll, Long> {
List<ProvinceAll> findByProvinceName(String provinceName);
List<ProvinceAll> findByProvinceIdIn(List<Long> provinceIds);
List<ProvinceAll> findByProvinceId(Long provinceId);
@Query("from ProvinceAll p where p.provinceId>=0 order by p.provinceId")
List<ProvinceAll> findProvince();
}
...@@ -25,10 +25,10 @@ public interface QualityRuleInfoDao extends JpaSpecificationExecutor<QualityRule ...@@ -25,10 +25,10 @@ public interface QualityRuleInfoDao extends JpaSpecificationExecutor<QualityRule
QualityRuleInfo findByQualityRuleId(Long qualityRuleId); QualityRuleInfo findByQualityRuleId(Long qualityRuleId);
//根据筛选项查找 //根据筛选项查找
Page<QualityRuleInfo> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndWarningTypeInAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province, List<Long> ifFilter,List<String> ifWarning,Timestamp startTime, Timestamp endTime,Pageable pageable); Page<QualityRuleInfo> findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndWarningTypeIsNotAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long> province, List<Long> ifFilter,String ifWarning,Timestamp startTime, Timestamp endTime,Pageable pageable);
//List<QualityRuleInfo> findByProvinceIdAndKpiIdAndWarningTypeIsNotAndBusinessTimeBetween(Long provinceId, Long kpiId,String type, Timestamp startTime, Timestamp endTime); List<QualityRuleInfo> findByProvinceIdAndKpiIdAndWarningTypeIsNotAndBusinessTimeBetween(Long provinceId, Long kpiId,String type, Timestamp startTime, Timestamp endTime);
List<QualityRuleReport> findByProvinceIdAndKpiIdAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime); // List<QualityRuleReport> findByProvinceIdAndKpiIdAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime);
} }
package com.hp.cmsz.service;
import java.util.List;
import com.hp.cmsz.entity.ProvinceAll;
import com.hp.cmsz.repository.ProvinceAllDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.hp.cmsz.repository.YwglTagDao;
/**
*
*
*/
@Component
@Transactional(readOnly = true)
public class ProvinceAllService {
@Autowired
private ProvinceAllDao provinceAllDao;
@Autowired
private YwglTagDao ywglTagDao;
public long getProvinceSize() {
return provinceAllDao.count();
}
public List<ProvinceAll> getProvinceList() {
return (List<ProvinceAll>) provinceAllDao.findAll();
}
//业务规律省份地市 author Sophia
public List<Object[]> getCityByProvince(List<Long> pro){
return (List<Object[]>) ywglTagDao.findCityByProvince(pro);
}
//有省份ID号得到省份的名称
public String getProvinceNameByProvinceIds(List<Long> provinceIds){
List<ProvinceAll> provinces = provinceAllDao.findByProvinceIdIn(provinceIds);
String provinceStr="";
for(int i=0;i<provinces.size();i++){
if(i==(provinces.size()-1)){
provinceStr += provinces.get(i).getProvinceName();
}
else{
provinceStr += provinces.get(i).getProvinceName()+" ";
}
}
return provinceStr;
}
}
...@@ -39,20 +39,20 @@ public class QualityRuleInfoService { ...@@ -39,20 +39,20 @@ public class QualityRuleInfoService {
} }
//根据筛选项获取质量规则 //根据筛选项获取质量规则
public Page<QualityRuleInfo> getQualityRuleInfoBy(QualityRuleInfo qualityRuleInfo,int pageNumber, int pageSize, String sortType,List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province, List<Long> ifFilter,List<String> ifWarning,Timestamp startTime, Timestamp endTime){ public Page<QualityRuleInfo> getQualityRuleInfoBy(QualityRuleInfo qualityRuleInfo,int pageNumber, int pageSize, String sortType,List<Long> dataSource, List<Long> chnnal, List<Long> busines, List<Long>province, List<Long> ifFilter,String ifWarning,Timestamp startTime, Timestamp endTime){
PageRequest pageRequest = buildPageRequest(pageNumber, pageSize, sortType, "qualityRuleId"); PageRequest pageRequest = buildPageRequest(pageNumber, pageSize, sortType, "qualityRuleId");
return qualityRuleInfoDao.findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndWarningTypeInAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(dataSource,chnnal,busines,province,ifFilter,ifWarning,startTime, endTime,pageRequest); return qualityRuleInfoDao.findByDataSourceIdInAndChannelIdInAndBusinessIdInAndProvinceIdInAndIfFilterInAndWarningTypeIsNotAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(dataSource,chnnal,busines,province,ifFilter,ifWarning,startTime, endTime,pageRequest);
} }
// //根据省份ID、指标ID和业务时间查询质量规则运营明细 //根据省份ID、指标ID和业务时间查询质量规则运营明细
// public List<QualityRuleInfo> findBy(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime){ public List<QualityRuleInfo> findBy(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime){
// return qualityRuleInfoDao.findByProvinceIdAndKpiIdAndWarningTypeIsNotAndBusinessTimeBetween(provinceId,kpiId,"正常",startTime,endTime); return qualityRuleInfoDao.findByProvinceIdAndKpiIdAndWarningTypeIsNotAndBusinessTimeBetween(provinceId,kpiId,"正常",startTime,endTime);
// }
public List<QualityRuleReport> findBy(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime){
return qualityRuleInfoDao.findByProvinceIdAndKpiIdAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(provinceId,kpiId,startTime,endTime);
} }
// public List<QualityRuleReport> findBy(Long provinceId, Long kpiId, Timestamp startTime, Timestamp endTime){
// return qualityRuleInfoDao.findByProvinceIdAndKpiIdAndBusinessTimeBetweenOrderByBusinessTimeDescProvinceIdDescWarningNumAsc(provinceId,kpiId,startTime,endTime);
// }
/** /**
* 创建分页请求. * 创建分页请求.
*/ */
......
...@@ -13,6 +13,8 @@ import java.util.Map; ...@@ -13,6 +13,8 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.analysissupport.AccuracyRuleService; import com.hp.cmsz.service.analysissupport.AccuracyRuleService;
import com.hp.cmsz.service.analysissupport.QualityRuleService; import com.hp.cmsz.service.analysissupport.QualityRuleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,22 +22,6 @@ import org.springframework.stereotype.Controller; ...@@ -20,22 +22,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.hp.cmsz.entity.Channel;
import com.hp.cmsz.entity.DataSource;
import com.hp.cmsz.entity.DataType;
import com.hp.cmsz.entity.QualityRule;
import com.hp.cmsz.entity.Kpi;
import com.hp.cmsz.entity.Province;
import com.hp.cmsz.entity.AccuracyRule;
import com.hp.cmsz.repository.AccuracyRuleDao;
import com.hp.cmsz.repository.BusinessDao;
import com.hp.cmsz.repository.ChannelDao;
import com.hp.cmsz.repository.ChannelDataSourceMapDao;
import com.hp.cmsz.repository.DataSourceDao;
import com.hp.cmsz.repository.DataTypeDao;
import com.hp.cmsz.repository.KpiDao;
import com.hp.cmsz.repository.ProvinceDao;
import com.hp.cmsz.repository.QualityRuleDao;
import com.hp.cmsz.service.BusinessService; import com.hp.cmsz.service.BusinessService;
import com.hp.cmsz.service.CmszOperationLogService; import com.hp.cmsz.service.CmszOperationLogService;
import com.hp.cmsz.web.PageURLController; import com.hp.cmsz.web.PageURLController;
...@@ -52,7 +38,7 @@ import com.hp.cmsz.web.PageURLController; ...@@ -52,7 +38,7 @@ import com.hp.cmsz.web.PageURLController;
public class QualityRuleMaintainController { public class QualityRuleMaintainController {
@Autowired @Autowired
private ProvinceDao provinceDao; private ProvinceAllDao provinceAllDao;
@Autowired @Autowired
private ChannelDao channelDao; private ChannelDao channelDao;
...@@ -94,7 +80,7 @@ public class QualityRuleMaintainController { ...@@ -94,7 +80,7 @@ public class QualityRuleMaintainController {
public String ruleMaintainHome(Map model){ public String ruleMaintainHome(Map model){
//查询出所有的省份 //查询出所有的省份
List<Province> provinceList=(List<Province>)provinceDao.findProvince(); List<ProvinceAll> provinceList=(List<ProvinceAll>)provinceAllDao.findProvince();
//查询出所有的渠道信息 //查询出所有的渠道信息
List<Channel> channelList=(List<Channel>)channelDao.findChannel(); List<Channel> channelList=(List<Channel>)channelDao.findChannel();
//查询出所有的指标 //查询出所有的指标
......
...@@ -2,6 +2,7 @@ package com.hp.cmsz.web.analysissupport; ...@@ -2,6 +2,7 @@ package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.ExportExcelUtil;
import com.hp.cmsz.entity.*; import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.*; import com.hp.cmsz.repository.*;
import com.hp.cmsz.service.BusinessService; import com.hp.cmsz.service.BusinessService;
...@@ -9,6 +10,7 @@ import com.hp.cmsz.service.ChannelService; ...@@ -9,6 +10,7 @@ import com.hp.cmsz.service.ChannelService;
import com.hp.cmsz.service.CmszOperationLogService; import com.hp.cmsz.service.CmszOperationLogService;
import com.hp.cmsz.service.analysissupport.QualityRuleInfoService; import com.hp.cmsz.service.analysissupport.QualityRuleInfoService;
import com.hp.cmsz.web.PageURLController; import com.hp.cmsz.web.PageURLController;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -22,9 +24,7 @@ import org.springframework.web.util.HtmlUtils; ...@@ -22,9 +24,7 @@ import org.springframework.web.util.HtmlUtils;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.*;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -68,6 +68,7 @@ public class QualityRuleOperationController { ...@@ -68,6 +68,7 @@ public class QualityRuleOperationController {
@Autowired @Autowired
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
//返回到质量规则运营页面 //返回到质量规则运营页面
@RequestMapping(value = "/home") @RequestMapping(value = "/home")
public ModelAndView crawlDataManageHome(String selectTab) { public ModelAndView crawlDataManageHome(String selectTab) {
...@@ -109,7 +110,6 @@ public class QualityRuleOperationController { ...@@ -109,7 +110,6 @@ public class QualityRuleOperationController {
@RequestParam(value = "bussines") String bussines,//业务 @RequestParam(value = "bussines") String bussines,//业务
@RequestParam(value = "province") String province,//省份 @RequestParam(value = "province") String province,//省份
@RequestParam(value = "ifFilter") String ifFilter,//是否过滤 @RequestParam(value = "ifFilter") String ifFilter,//是否过滤
@RequestParam(value = "ifWarning") String ifWarning,//是否告警
@RequestParam(value = "sortType", defaultValue = "parameterId") String sortType, @RequestParam(value = "sortType", defaultValue = "parameterId") String sortType,
@RequestParam(value = "page", defaultValue = "1") int pageNumber, @RequestParam(value = "page", defaultValue = "1") int pageNumber,
@RequestParam(value = "pageSize", defaultValue = "30") int pageSize, @RequestParam(value = "pageSize", defaultValue = "30") int pageSize,
...@@ -124,7 +124,8 @@ public class QualityRuleOperationController { ...@@ -124,7 +124,8 @@ public class QualityRuleOperationController {
String[] bussinesS =bussines.split(","); String[] bussinesS =bussines.split(",");
String[] provinceS=province.split(","); String[] provinceS=province.split(",");
String[] ifFilterS=ifFilter.split(","); String[] ifFilterS=ifFilter.split(",");
String[] ifWarningS=ifWarning.split(","); // String[] ifWarningS=ifWarning.split(",");
Timestamp startTime= Timestamp.valueOf(dates[0]); Timestamp startTime= Timestamp.valueOf(dates[0]);
Timestamp endTime=Timestamp.valueOf(dates[1]); Timestamp endTime=Timestamp.valueOf(dates[1]);
List<Long> dataSourceList=changeStrToList(dataSourceS); List<Long> dataSourceList=changeStrToList(dataSourceS);
...@@ -132,10 +133,10 @@ public class QualityRuleOperationController { ...@@ -132,10 +133,10 @@ public class QualityRuleOperationController {
List<Long> bussinesList=changeStrToList(bussinesS); List<Long> bussinesList=changeStrToList(bussinesS);
List<Long> provinceList=changeStrToList(provinceS); List<Long> provinceList=changeStrToList(provinceS);
List<Long> ifFilterList=changeStrToList(ifFilterS); List<Long> ifFilterList=changeStrToList(ifFilterS);
List<String> ifWarningList=changeStrToListstr(ifWarningS); String ifWarning="正常";
sortType = HtmlUtils.htmlEscape(sortType); sortType = HtmlUtils.htmlEscape(sortType);
// Page<QualityRuleInfo> qualityRuleInfoPage = qualityRuleInfoService.getQualityRuleInfoPage(qualityRuleInfo,pageNumber,pageSize,sortType); // Page<QualityRuleInfo> qualityRuleInfoPage = qualityRuleInfoService.getQualityRuleInfoPage(qualityRuleInfo,pageNumber,pageSize,sortType);
Page<QualityRuleInfo> qualityRuleInfoPage = qualityRuleInfoService.getQualityRuleInfoBy(qualityRuleInfo, pageNumber, pageSize, sortType,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList,ifWarningList,startTime,endTime); Page<QualityRuleInfo> qualityRuleInfoPage = qualityRuleInfoService.getQualityRuleInfoBy(qualityRuleInfo, pageNumber, pageSize, sortType,dataSourceList,chnnalList,bussinesList,provinceList,ifFilterList,ifWarning,startTime,endTime);
modelAndView.addObject("qualityRuleInfoPage", qualityRuleInfoPage); modelAndView.addObject("qualityRuleInfoPage", qualityRuleInfoPage);
modelAndView.addObject("pageSize", pageSize); modelAndView.addObject("pageSize", pageSize);
modelAndView.addObject("sortType", sortType); modelAndView.addObject("sortType", sortType);
...@@ -185,4 +186,134 @@ public class QualityRuleOperationController { ...@@ -185,4 +186,134 @@ public class QualityRuleOperationController {
} }
} }
//导出Excel
@RequestMapping(value = "/uploadOperation",method = RequestMethod.POST)
public void uploadModel(HttpServletRequest request,HttpServletResponse response){
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date =new Date();
String fileName = "质量规则运营列表"+"_"+formatDate.format(date);
try {
fileName = new String(fileName.getBytes("gb2312"), "ISO-8859-1");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// 创建工作薄
HSSFWorkbook wb = new HSSFWorkbook();
// 创建sheet
HSSFSheet sheet = wb.createSheet();
ExportExcelUtil exportExcel = new ExportExcelUtil(wb, sheet);
// 创建列标头LIST
List<String> fialList = new ArrayList<String>();
fialList.add("质量规则ID");
fialList.add("省份");
fialList.add("数据来源");
fialList.add("渠道");
fialList.add("业务");
fialList.add("指标名称");
fialList.add("指标编码");
fialList.add("告警类型");
fialList.add("告警原因");
fialList.add("指标业务时间");
fialList.add("指标延迟时间");
// 该报表的列数
int number = fialList.size();
// 给工作表列定义列宽
for (int i = 0; i < number; i++) {
sheet.setColumnWidth(i, 5500);
}
// 创建单元格样式
HSSFCellStyle cellStyle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyle.setWrapText(true);
// 设置单元格字体
HSSFFont font = wb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontName("宋体");
font.setFontHeight((short) 220);
cellStyle.setFont(font);
// 创建报表头部
exportExcel.createNormalHead("运营明细列表", number - 1);
// 创建第二行
HSSFRow row2 = sheet.createRow(1);
// 设置行高
row2.setHeight((short) 500);
// 单元格
HSSFCell row2Cell = null;
// 创建不同的LIST的列标题
for (int i = 0; i < number; i++) {
row2Cell = row2.createCell(i);
row2Cell.setCellStyle(cellStyle);
row2Cell.setCellValue(new HSSFRichTextString(fialList.get(i).toString()));
}
List<Long> ruleOperationIds = new ArrayList<Long>();
List<QualityRuleInfo> list = null;
int rowNum=list.size();
// 设置列表数据
for (int i = 2; i < (rowNum+2); i++) {
HSSFRow row = sheet.createRow(i);
// 设置行高
row.setHeight((short) 350);
//报表数据
QualityRuleInfo qualityRuleInfo = list.get(i-2);
row.createCell(0).setCellValue(qualityRuleInfo.getQualityRuleId());
ruleOperationIds.add(qualityRuleInfo.getQualityRuleId());
row.createCell(1).setCellValue(qualityRuleInfo.getProvinceName());
row.createCell(2).setCellValue(qualityRuleInfo.getDataSourceName());
row.createCell(3).setCellValue(qualityRuleInfo.getChannelName());
row.createCell(4).setCellValue(qualityRuleInfo.getBusinessName());
row.createCell(5).setCellValue(qualityRuleInfo.getKpiName());
row.createCell(6).setCellValue(qualityRuleInfo.getKpiCode());
row.createCell(7).setCellValue(qualityRuleInfo.getWarningType());
row.createCell(8).setCellValue(qualityRuleInfo.getWarningReason());
row.createCell(9).setCellValue(formatDate.format(qualityRuleInfo.getBusinessTime()));
row.createCell(10).setCellValue(formatDate.format(qualityRuleInfo.getKpiMonitorRunTime()));
}
cmszOperationLogService.createLog("导出","质量规则运营","导出质量规则运营信息");
// 下载文件时要设置的头信息
response.setHeader("Content-Disposition", "attachment;fileName="
+ fileName + ".xls");
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
wb.write(os);
} catch (IOException e) {
e.printStackTrace();
}
byte[] content = os.toByteArray();
OutputStream ops = null;
try {
ops = response.getOutputStream();// 用于下载的输出流
ops.write(content);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
ops.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }
package com.hp.cmsz.web.analysissupport; package com.hp.cmsz.web.analysissupport;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.hp.cmsz.commons.utils.ExportExcelUtil;
import com.hp.cmsz.entity.*; import com.hp.cmsz.entity.*;
import com.hp.cmsz.repository.DataSourceDao; import com.hp.cmsz.repository.DataSourceDao;
import com.hp.cmsz.repository.KpiDao; import com.hp.cmsz.repository.KpiDao;
...@@ -13,6 +14,7 @@ import com.hp.cmsz.service.analysissupport.QualityRuleInfoService; ...@@ -13,6 +14,7 @@ import com.hp.cmsz.service.analysissupport.QualityRuleInfoService;
import com.hp.cmsz.service.analysissupport.QualityRuleReportInfoService; import com.hp.cmsz.service.analysissupport.QualityRuleReportInfoService;
import com.hp.cmsz.service.analysissupport.QualityRuleReportService; import com.hp.cmsz.service.analysissupport.QualityRuleReportService;
import com.hp.cmsz.web.PageURLController; import com.hp.cmsz.web.PageURLController;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -23,10 +25,9 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -23,10 +25,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.HtmlUtils; import org.springframework.web.util.HtmlUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.*;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -70,6 +71,8 @@ public class QualityRuleReportController { ...@@ -70,6 +71,8 @@ public class QualityRuleReportController {
@Autowired @Autowired
private CmszOperationLogService cmszOperationLogService; private CmszOperationLogService cmszOperationLogService;
List<QualityRuleReport> staticRuleReportList = new ArrayList<QualityRuleReport>();
@RequestMapping(value = "") @RequestMapping(value = "")
public String ruleResultHome( public String ruleResultHome(
@RequestParam(value = "rulePageNum", defaultValue="1") String rulePageNum, @RequestParam(value = "rulePageNum", defaultValue="1") String rulePageNum,
...@@ -131,6 +134,7 @@ public class QualityRuleReportController { ...@@ -131,6 +134,7 @@ public class QualityRuleReportController {
List<Long> provinceList = changeStrToList(provinceS); List<Long> provinceList = changeStrToList(provinceS);
List<String> reportTypeList = changeStrToListstr(reportTypeS); List<String> reportTypeList = changeStrToListstr(reportTypeS);
qualityRuleReportList = qualityRuleReportService.getQualityRuleReportBy(dataSourceList, chnnalList, bussinesList, provinceList,reportTypeList, startTime, endTime); qualityRuleReportList = qualityRuleReportService.getQualityRuleReportBy(dataSourceList, chnnalList, bussinesList, provinceList,reportTypeList, startTime, endTime);
staticRuleReportList = qualityRuleReportList;
cmszOperationLogService.createLog("查询", "数据质量报告", "由筛选项得到数据质量报告"); cmszOperationLogService.createLog("查询", "数据质量报告", "由筛选项得到数据质量报告");
Gson gson = new Gson(); Gson gson = new Gson();
response.setContentType("text/Xml;charset=gbk"); response.setContentType("text/Xml;charset=gbk");
...@@ -191,4 +195,140 @@ public class QualityRuleReportController { ...@@ -191,4 +195,140 @@ public class QualityRuleReportController {
return modelAndView; return modelAndView;
} }
//导出Excel
@RequestMapping(value = "/uploadReport",method = RequestMethod.POST)
public void uploadModel(HttpServletRequest request, HttpServletResponse response){
SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date =new Date();
String fileName = "质量规则报告列表"+"_"+formatDate.format(date);
try {
fileName = new String(fileName.getBytes("gb2312"), "ISO-8859-1");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
// 创建工作薄
HSSFWorkbook wb = new HSSFWorkbook();
// 创建sheet
HSSFSheet sheet = wb.createSheet();
ExportExcelUtil exportExcel = new ExportExcelUtil(wb, sheet);
// 创建列标头LIST
List<String> fialList = new ArrayList<String>();
fialList.add("报告类型");
fialList.add("省份");
fialList.add("数据来源");
fialList.add("渠道");
fialList.add("业务");
fialList.add("指标名称");
fialList.add("指标编码");
fialList.add("完整性数量");
fialList.add("完整性占比");
fialList.add("及时性数量");
fialList.add("及时性占比");
fialList.add("准确性数量");
fialList.add("准确性占比");
fialList.add("是否预测");
fialList.add("报告时间");
// 该报表的列数
int number = fialList.size();
// 给工作表列定义列宽
for (int i = 0; i < number; i++) {
sheet.setColumnWidth(i, 5500);
}
// 创建单元格样式
HSSFCellStyle cellStyle = wb.createCellStyle();
// 指定单元格居中对齐
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
// 指定单元格垂直居中对齐
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
// 指定当单元格内容显示不下时自动换行
cellStyle.setWrapText(true);
// 设置单元格字体
HSSFFont font = wb.createFont();
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
font.setFontName("宋体");
font.setFontHeight((short) 220);
cellStyle.setFont(font);
// 创建报表头部
exportExcel.createNormalHead("运营明细列表", number - 1);
// 创建第二行
HSSFRow row2 = sheet.createRow(1);
// 设置行高
row2.setHeight((short) 500);
// 单元格
HSSFCell row2Cell = null;
// 创建不同的LIST的列标题
for (int i = 0; i < number; i++) {
row2Cell = row2.createCell(i);
row2Cell.setCellStyle(cellStyle);
row2Cell.setCellValue(new HSSFRichTextString(fialList.get(i).toString()));
}
List<QualityRuleReport> list = staticRuleReportList;
int rowNum=list.size();
// 设置列表数据
for (int i = 2; i < (rowNum+2); i++) {
HSSFRow row = sheet.createRow(i);
// 设置行高
row.setHeight((short) 350);
//报表数据
QualityRuleReport qualityRuleReport = list.get(i-2);
row.createCell(0).setCellValue(qualityRuleReport.getReportName());
row.createCell(1).setCellValue(qualityRuleReport.getProvinceName());
row.createCell(2).setCellValue(qualityRuleReport.getDataSourceName());
row.createCell(3).setCellValue(qualityRuleReport.getChannelName());
row.createCell(4).setCellValue(qualityRuleReport.getBusinessName());
row.createCell(5).setCellValue(qualityRuleReport.getKpiName());
row.createCell(6).setCellValue(qualityRuleReport.getKpiCode());
row.createCell(7).setCellValue(qualityRuleReport.getIntegralityNum());
row.createCell(8).setCellValue(qualityRuleReport.getIntegralityPro());
row.createCell(9).setCellValue(qualityRuleReport.getTimelyNum());
row.createCell(10).setCellValue(qualityRuleReport.getTimelyPro());
row.createCell(11).setCellValue(qualityRuleReport.getAccuracyNum());
row.createCell(12).setCellValue(qualityRuleReport.getAccuracyPro());
row.createCell(13).setCellValue(qualityRuleReport.getIfPredicted());
row.createCell(14).setCellValue(formatDate.format(qualityRuleReport.getReportSumEndTime()));
}
cmszOperationLogService.createLog("导出","质量规则报告","导出质量规则报告信息");
// 下载文件时要设置的头信息
response.setHeader("Content-Disposition", "attachment;fileName="
+ fileName + ".xls");
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
wb.write(os);
} catch (IOException e) {
e.printStackTrace();
}
byte[] content = os.toByteArray();
OutputStream ops = null;
try {
ops = response.getOutputStream();// 用于下载的输出流
ops.write(content);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
ops.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!-- 质量报告状态-->
<div id="ws" class="slide-menu-option">
<label>报告状态</label>
<select class="slide-menu-select" id="reportState" name="reportState">
<option value="0,1" title="全部"selected><a href="#">全部</a></option>
<option value="1" title="正常"><a href="#">正常</a></option>
<option value="0" title="异常"><a href="#">异常</a></option>
</select>
</div>
<script type="text/javascript">
function getReportState(){
return $("#reportState").val();
}
function getReportStateTitle(){
return $("#reportState").find("option:selected").attr("title");
}
function RelStateRest() {
$("#reportState").val("0,1");
}
</script>
\ No newline at end of file
...@@ -47,9 +47,11 @@ ...@@ -47,9 +47,11 @@
<table id="ruleMaintainTable" class="table-null"> <table id="ruleMaintainTable" class="table-null">
<tr><td>省份(<font color="red">必填</font>):</td> <tr><td>省份(<font color="red">必填</font>):</td>
<td> <td>
<div class="checkbox-inline"><label><input type="checkbox" id="allProvince" name="allProvince" checked>全选</label></div><br/>
<c:forEach var="province" items="${provinceList}"> <c:forEach var="province" items="${provinceList}">
<input type="checkbox" name="province" class="province" id="province" value="${province.provinceId}" checked>${province.provinceName} <c:if test="${province.provinceId == '32'}">
<input type="checkbox" name="province" class="province" id="province" onclick="return false;" value="${province.provinceId}" checked>${province.provinceName}
</c:if>
</c:forEach> </c:forEach>
</td> </td>
</tr> </tr>
...@@ -101,7 +103,7 @@ ...@@ -101,7 +103,7 @@
</td> </td>
</tr> </tr>
<tr><td>监控延迟时间(<font color="red">必填</font>):</td> <tr><td>监控延迟时间(<font color="red">必填</font>):</td>
<td> <td id="monitorTime">
<input type="text" name="frequencyValue" id="frequencyValue" style="display: inline;" /> <input type="text" name="frequencyValue" id="frequencyValue" style="display: inline;" />
<select name="frequencyType" id="frequencyType"> <select name="frequencyType" id="frequencyType">
<option value="0">分钟</option> <option value="0">分钟</option>
...@@ -110,9 +112,9 @@ ...@@ -110,9 +112,9 @@
<option value="3"></option> <option value="3"></option>
</select></td> </select></td>
</tr> </tr>
<tr><td>指标采集时间<font color="red">必填</font>):</td> <tr><td>启动日期<font color="red">必填</font>):</td>
<td id="businessTimetd"> <td id="businessTimetd">
<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:"yyyy-MM-dd HH:mm:00",startDate:"%y-%M-%d 00:00:00",readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]},alwaysUseStartDate:true})'/> <input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:"yyyy-MM-dd",defaultDate:new Date()})'/>
</td> </td>
</tr> </tr>
<tr><td>添加准确性规则:</td> <tr><td>添加准确性规则:</td>
...@@ -306,6 +308,7 @@ $("#addParam").click(function(){ ...@@ -306,6 +308,7 @@ $("#addParam").click(function(){
if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";} if(ifRepeatedCheckSeries =="无"){ifRepeatedCheckSeries ="";}
if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";} if(repeatedCheckMaxTime =="无"){repeatedCheckMaxTime ="";}
if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";} if(ifRepeatedCheckSummation =="无"){ifRepeatedCheckSummation ="";}
$.ajax({ $.ajax({
type : "GET", type : "GET",
contentType : "application/json", contentType : "application/json",
...@@ -375,6 +378,7 @@ $("#addParam").click(function(){ ...@@ -375,6 +378,7 @@ $("#addParam").click(function(){
} }
} }
}); });
}); });
} }
} }
...@@ -485,15 +489,14 @@ updateBusiness($("#dataSource").val(),$("#channel").val()); ...@@ -485,15 +489,14 @@ updateBusiness($("#dataSource").val(),$("#channel").val());
function updateBusinessTime(calCycleValue) { function updateBusinessTime(calCycleValue) {
$("#businessTimetd").empty()
if(calCycleValue == "30MI"){ if(calCycleValue == "30MI"){
$("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd HH:mm:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 30, 2 ], s : [ 60, 0 ]}})'/>"); $("#monitorTime");
}else if(calCycleValue == "01HR"){ }else if(calCycleValue == "01HR"){
$("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd HH:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 1, 6 ], m : [ 60, 0 ], s : [ 60, 0 ]}})'/>"); $("#monitorTime");
}else if(calCycleValue == "01DY"){ }else if(calCycleValue == "01DY"){
$("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-dd 00:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 24, 0 ], m : [ 60, 0 ], s : [ 60, 0 ]}})'/>"); $("#monitorTime");
}else if(calCycleValue == "01MO"){ }else if(calCycleValue == "01MO"){
$("#businessTimetd").append("<input type='text' class='form-control' id='businessTime' name='businessTime' onfocus='WdatePicker({dateFmt:\"yyyy-MM-01 00:00:00\",startDate:\"%y-%M-%d 00:00:00\",alwaysUseStartDate:true,readOnly:false,hmsMenuCfg : {H : [ 24, 0 ], m : [ 60, 0 ], s : [ 60, 0 ]}})' />"); $("#monitorTime");
} }
} }
......
...@@ -68,7 +68,9 @@ ...@@ -68,7 +68,9 @@
<span id="ReportTypeTag" class="label label-info" data-placement="bottom" ></span> <span id="ReportTypeTag" class="label label-info" data-placement="bottom" ></span>
</div> </div>
<div class="bt-list-import"> <div class="bt-list-import">
<a href="#" id="uploadExcel" class=""> <span
class="glyphicon glyphicon-import"></span> <span
class="glyphicon-class">导出Excel</span> </a>
</div> </div>
</div> </div>
...@@ -167,6 +169,14 @@ ...@@ -167,6 +169,14 @@
RelReportTypeRest(); RelReportTypeRest();
} }
$("#uploadExcel").click(function(){
var listForm=$("#listForm");
listForm.attr("method","post");
listForm.attr("action","${ctx}/AnalysisSupport/QualityRuleReport/uploadReport");
listForm.submit();
listForm.attr("action","#");
});
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -106,15 +106,7 @@ if(receiveRulePageNum!=1){ ...@@ -106,15 +106,7 @@ if(receiveRulePageNum!=1){
$("#createRule").click(function(){ $("#createRule").click(function(){
$.dialog({ location.href="${ctx}/AnalysisSupport/QualityRuleMaintain";
title: "提醒",
content:"确定新建质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/QualityRuleMaintain";},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
}); });
function ruleResultSubmit(){ function ruleResultSubmit(){
...@@ -171,28 +163,12 @@ $("#createRule").click(function(){ ...@@ -171,28 +163,12 @@ $("#createRule").click(function(){
} }
$("#updateRule").click(function(){ $("#updateRule").click(function(){
var pageNum = $("#goPageNo").val(); var pageNum = $("#goPageNo").val();
$.dialog({ location.href="${ctx}/AnalysisSupport/QualityRuleConfiguration?qualityRuleId="+qualityRuleId;
title: "提醒",
content:"确定修改质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/QualityRuleConfiguration?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
}); });
$("#deleteRule").click(function(){ $("#deleteRule").click(function(){
var pageNum = $("#goPageNo").val(); var pageNum = $("#goPageNo").val();
$.dialog({ location.href="${ctx}/AnalysisSupport/RuleDelete?qualityRuleId="+qualityRuleId;
title: "提醒",
content:"确定删除质量规则?",
ok: function(){location.href="${ctx}/AnalysisSupport/RuleDelete?qualityRuleId="+qualityRuleId;},
okValue:"确定",
cancel: function(){},
cancelValue:"取消",
lock:true
});
}); });
</script> </script>
......
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
<table class="table table-hover table-striped"> <table class="table table-hover table-striped">
<thead> <thead>
<tr> <tr>
<th width="6.4%">省份</th> <%--<th width="6.4%">省份</th>--%>
<th width="6.4%">数据来源</th> <%--<th width="6.4%">数据来源</th>--%>
<th width="6.4%">渠道</th> <%--<th width="6.4%">渠道</th>--%>
<th width="6.4%">业务</th> <%--<th width="6.4%">业务</th>--%>
<th width="6.4%">指标名称</th> <%--<th width="6.4%">指标名称</th>--%>
<th width="6.4%">指标编码</th> <%--<th width="6.4%">指标编码</th>--%>
<th width="6.4%">告警类型</th> <th width="6.4%">告警类型</th>
<th width="6.4%">告警原因</th> <th width="6.4%">告警原因</th>
<th width="6.4%">指标监控范围</th> <th width="6.4%">监控延迟时间</th>
<th width="6.4%">指标采集时间</th> <th width="6.4%">指标采集时间</th>
</tr> </tr>
</thead> </thead>
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
<c:forEach items="${qualityRuleOperationDetailPage.content}" var="qualityRuleOperationDetail"> <c:forEach items="${qualityRuleOperationDetailPage.content}" var="qualityRuleOperationDetail">
<tr> <tr>
<td>${qualityRuleOperationDetail.provinceName} </td> <%--<td>${qualityRuleOperationDetail.provinceName} </td>--%>
<td>${qualityRuleOperationDetail.dataSourceName}</td> <%--<td>${qualityRuleOperationDetail.dataSourceName}</td>--%>
<td>${qualityRuleOperationDetail.channelName}</td> <%--<td>${qualityRuleOperationDetail.channelName}</td>--%>
<td>${qualityRuleOperationDetail.businessName}</td> <%--<td>${qualityRuleOperationDetail.businessName}</td>--%>
<td>${qualityRuleOperationDetail.kpiName}</td> <%--<td>${qualityRuleOperationDetail.kpiName}</td>--%>
<td>${qualityRuleOperationDetail.kpiCode}</td> <%--<td>${qualityRuleOperationDetail.kpiCode}</td>--%>
<td>${qualityRuleOperationDetail.warningType}</td> <td>${qualityRuleOperationDetail.warningType}</td>
<td>${qualityRuleOperationDetail.warningReason}</td> <td>${qualityRuleOperationDetail.warningReason}</td>
<td><fmt:formatDate value="${qualityRuleOperationDetail.kpiMonitorRunTime}" pattern="yyyy-MM-dd hh:mm:ss" /> </td> <td><fmt:formatDate value="${qualityRuleOperationDetail.kpiMonitorRunTime}" pattern="yyyy-MM-dd hh:mm:ss" /> </td>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<tags:ProvinceTag/> <tags:ProvinceTag/>
<tags:GJFX_datasource_channle_business/> <tags:GJFX_datasource_channle_business/>
<tags:QualityRule_IfFilter /> <tags:QualityRule_IfFilter />
<tags:QualityRuleInfo_IfWarning />
</div> </div>
<div class="slide-menu-option"> <div class="slide-menu-option">
<button type="input" class="btn btn-primary" onclick="searchData();return false;">提交</button> <button type="input" class="btn btn-primary" onclick="searchData();return false;">提交</button>
...@@ -67,8 +67,13 @@ ...@@ -67,8 +67,13 @@
<span id="ChannelTag3" class="label label-info" data-placement="bottom"></span> <span id="ChannelTag3" class="label label-info" data-placement="bottom"></span>
<span id="BusinessTag" class="label label-info" data-placement="bottom" ></span> <span id="BusinessTag" class="label label-info" data-placement="bottom" ></span>
<span id="ifFilterTag" class="label label-info" data-placement="bottom" ></span> <span id="ifFilterTag" class="label label-info" data-placement="bottom" ></span>
<span id="ifWarningTag" class="label label-info" data-placement="bottom" ></span>
</div>
<div class="bt-list-import">
<a href="#" id="uploadExcel" class=""> <span
class="glyphicon glyphicon-import"></span> <span
class="glyphicon-class">导出Excel</span> </a>
</div> </div>
</div> </div>
<!-- Top Navigation --> <!-- Top Navigation -->
...@@ -95,7 +100,7 @@ ...@@ -95,7 +100,7 @@
$('#BusinessTag').text("业务").append($("<span class='badge'></span>").text(getStatsBusinessCheckedValues().length)).attr('data-original-title',getStatsBusinessCheckedTitlesString()).tooltip(); $('#BusinessTag').text("业务").append($("<span class='badge'></span>").text(getStatsBusinessCheckedValues().length)).attr('data-original-title',getStatsBusinessCheckedTitlesString()).tooltip();
$('#ProvinceTag').text("省份").append($("<span class='badge'></span>").text(getProvinceCheckedValues().length)).attr('data-original-title',getProvinceCheckedTitles()).tooltip(); $('#ProvinceTag').text("省份").append($("<span class='badge'></span>").text(getProvinceCheckedValues().length)).attr('data-original-title',getProvinceCheckedTitles()).tooltip();
$('#ifFilterTag').text("是否过滤").attr('data-original-title', getIfFilterTitle()).tooltip(); $('#ifFilterTag').text("是否过滤").attr('data-original-title', getIfFilterTitle()).tooltip();
$('#ifWarningTag').text("是否告警").attr('data-original-title', getIfWarningTitle()).tooltip();
queryResult(1); queryResult(1);
} }
...@@ -104,7 +109,7 @@ ...@@ -104,7 +109,7 @@
$.ajax({ $.ajax({
type : 'post', type : 'post',
'url' : '${ctx}/AnalysisSupport/QualityRuleOperation/queryOperationFrame', 'url' : '${ctx}/AnalysisSupport/QualityRuleOperation/queryOperationFrame',
data : "page=" + page +"&period="+getPeriodStr()+"&province="+getProvinceCheckedValues()+"&dataSource="+getStatsDataSourceCheckedValuesString()+"&chnnal="+getStatsChannelCheckedValuesString()+"&bussines="+getStatsBusinessCheckedValuesString()+"&ifFilter="+getIfFilter()+"&ifWarning="+getIfWarning(), data : "page=" + page +"&period="+getPeriodStr()+"&province="+getProvinceCheckedValues()+"&dataSource="+getStatsDataSourceCheckedValuesString()+"&chnnal="+getStatsChannelCheckedValuesString()+"&bussines="+getStatsBusinessCheckedValuesString()+"&ifFilter="+getIfFilter(),
success : function(data) { success : function(data) {
$('#resultList').html(data); $('#resultList').html(data);
disable(); disable();
...@@ -112,6 +117,14 @@ ...@@ -112,6 +117,14 @@
}); });
} }
$("#uploadExcel").click(function(){
var listForm=$("#listForm");
listForm.attr("method","post");
listForm.attr("action","${ctx}/AnalysisSupport/QualityRuleOperation/uploadOperation");
listForm.submit();
listForm.attr("action","#");
});
</script> </script>
</body> </body>
</html> </html>
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
<th width="6.4%">指标CODE</th> <th width="6.4%">指标CODE</th>
<th width="6.4%">告警类型</th> <th width="6.4%">告警类型</th>
<th width="6.4%">告警原因</th> <th width="6.4%">告警原因</th>
<th width="6.4%">指标业务时间</th> <th width="6.4%">数据时间</th>
<th width="6.4%">指标监控时间</th> <th width="6.4%">告警时间</th>
<%--<th width="6.4%">是否过滤</th>--%> <%--<th width="6.4%">是否过滤</th>--%>
</tr> </tr>
</thead> </thead>
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
<td>${qualityRuleInfo.kpiCode}</td> <td>${qualityRuleInfo.kpiCode}</td>
<td>${qualityRuleInfo.warningType}</td> <td>${qualityRuleInfo.warningType}</td>
<td>${qualityRuleInfo.warningReason}</td> <td>${qualityRuleInfo.warningReason}</td>
<td><fmt:formatDate value="${qualityRuleInfo.kpiMonitorRunTime}" pattern="yyyy-MM-dd hh:mm:ss" /></td> <td><fmt:formatDate value="${qualityRuleInfo.kpiMonitorRunTime}" pattern="yyyy-MM-dd hh:mm" /></td>
<td><fmt:formatDate value="${qualityRuleInfo.businessTime}" pattern="yyyy-MM-dd hh:mm:ss" /></td> <td><fmt:formatDate value="${qualityRuleInfo.businessTime}" pattern="yyyy-MM-dd hh:mm" /></td>
<%--<td>--%> <%--<td>--%>
<%--<c:if test="${qualityRuleInfo.ifFilter == '1'}">无过滤规则</c:if>--%> <%--<c:if test="${qualityRuleInfo.ifFilter == '1'}">无过滤规则</c:if>--%>
<%--<c:if test="${qualityRuleInfo.ifFilter == '0'}">过滤</c:if>--%> <%--<c:if test="${qualityRuleInfo.ifFilter == '0'}">过滤</c:if>--%>
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
$.dialog({ $.dialog({
title: "数据质量规则", title: "数据质量规则",
content: "<div id='ruleList'>" + content: "<div id='ruleList'>" +
"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'></div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>省份</th> <th width=''>数据来源</th> <th width=''>渠道</th> <th width=''>业务</th> <th width=''>指标名称</th> <th width=''>指标编码</th> <th width=''>数据类型</th> <th width=''>数据采集频率</th> <th width=''>指标监控范围</th> <th width=''>指标采集时间</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>" + "<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'></div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>省份</th> <th width=''>数据来源</th> <th width=''>渠道</th> <th width=''>业务</th> <th width=''>指标名称</th> <th width=''>指标编码</th> <th width=''>数据类型</th> <th width=''>数据采集频率</th> <th width=''>监控延迟时间</th> <th width=''>指标采集时间</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>" +
"</div>", "</div>",
lock: true, lock: true,
width: 800, width: 800,
...@@ -208,7 +208,6 @@ ...@@ -208,7 +208,6 @@
if (data.businessTime != null) { if (data.businessTime != null) {
data.businessTime = df.format(new Date(data.businessTime)); data.businessTime = df.format(new Date(data.businessTime));
} }
console.log(data.businessTime)
ruleTbody.append($("<tr></tr>") ruleTbody.append($("<tr></tr>")
.append("<td>" + data.provinceName + "</td>") .append("<td>" + data.provinceName + "</td>")
.append("<td>" + data.dataSourceName + "</td>") .append("<td>" + data.dataSourceName + "</td>")
......
...@@ -134,7 +134,7 @@ function ruleOperationDetailTable(){ ...@@ -134,7 +134,7 @@ function ruleOperationDetailTable(){
header[6] = ["指标名称","kpiName","7%","15"]; header[6] = ["指标名称","kpiName","7%","15"];
header[7] = ["指标CODE","kpiCode","7%","15"]; header[7] = ["指标CODE","kpiCode","7%","15"];
header[8] = ["告警类型","warningType","7%","15"]; header[8] = ["告警类型","warningType","7%","15"];
header[9] = ["指标监控时间","kpiMonitorRunTime","7%","15"]; header[9] = ["监控延迟时间","kpiMonitorRunTime","7%","15"];
header[10] = ["指标业务时间","businessTime","7%","15"]; header[10] = ["指标业务时间","businessTime","7%","15"];
header[11] = ["是否过滤","ifFilter","7%",""]; header[11] = ["是否过滤","ifFilter","7%",""];
...@@ -525,7 +525,7 @@ function selectRule(qualityRuleId){ ...@@ -525,7 +525,7 @@ function selectRule(qualityRuleId){
$.dialog({ $.dialog({
title:"数据质量规则", title:"数据质量规则",
content:"<div id='ruleList'>"+ content:"<div id='ruleList'>"+
"<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>规则参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>省份</th> <th width=''>数据来源</th> <th width=''>渠道</th> <th width=''>业务</th> <th width=''>指标名称</th> <th width=''>指标编码</th> <th width=''>数据类型</th> <th width=''>数据采集频率</th> <th width=''>指标监控范围</th> <th width=''>指标采集时间</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+ "<div class='col-xs-12'><div class='panel panel-default'><div class='panel-heading'>规则参数列表</div><div class='panel-body'> <table class='table table-hover table-striped'> <thead> <tr> <th width=''>省份</th> <th width=''>数据来源</th> <th width=''>渠道</th> <th width=''>业务</th> <th width=''>指标名称</th> <th width=''>指标编码</th> <th width=''>数据类型</th> <th width=''>数据采集频率</th> <th width=''>监控延迟时间</th> <th width=''>指标采集时间</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>"+
"</div>", "</div>",
lock:true, lock:true,
width:800, width:800,
......
...@@ -331,7 +331,7 @@ table_pagging.prototype = { ...@@ -331,7 +331,7 @@ table_pagging.prototype = {
} }
if(k==1){ if(k==1){
tdContext = "<a href='javascript:;' onclick='selectOperation(\""+this.getData(this.objectlist[i],"provinceId")+"\",\""+this.getData(this.objectlist[i],"kpiId")+"\",\""+this.getData(this.objectlist[i],"reportSumStartTime")+"\",\""+this.getData(this.objectlist[i],"reportSumEndTime")+"\")'>"+this.getData(this.objectlist[i],this.header[k][1])+"</a>"; tdContext = "<a href='javascript:;' onclick=\"selectOperation("+i+")\" alt='\"+i+\"'>"+this.getData(this.objectlist[i],this.header[k][1])+"</a>";
} }
} }
...@@ -555,14 +555,89 @@ function queryResult(page) { ...@@ -555,14 +555,89 @@ function queryResult(page) {
} }
//查看数据质量运营 //查看数据质量运营
function selectOperation(provinceId,kpiId,reportSumStartTime,reportSumEndTime){ function selectOperation(i){
console.log(jsonData[i])
if(jsonData[i].integralityNum==undefined){
jsonData[i].integralityNum="";
}
if(jsonData[i].integralityPro==undefined){
jsonData[i].integralityPro="";
}else{
jsonData[i].integralityPro=(jsonData[i].integralityPro*100).toFixed(0)+"%";
}
if(jsonData[i].timelyNum==undefined){
jsonData[i].timelyNum="";
}
if(jsonData[i].timelyPro==undefined){
jsonData[i].timelyPro="";
}else {
jsonData[i].timelyPro=(jsonData[i].timelyPro*100).toFixed(0)+"%";
}
if(jsonData[i].accuracyNum==undefined){
jsonData[i].accuracyNum="";
}
if(jsonData[i].accuracyPro==undefined){
jsonData[i].accuracyPro="";
}else {
jsonData[i].accuracyPro=(jsonData[i].accuracyPro*100).toFixed(0)+"%";
}
$.dialog({ $.dialog({
title:"数据质量运营明细", title:"数据质量运营明细",
content:"<div style='width: 800px; height: 500px;overflow-y: scroll' id='dataForm'></div>", content:"<div class='dialog-p' style='max-height: 560px; overflow-y: scroll; overflow-x: auto;'>" +
" <div class='col-xs-12'>" +
" <div class='panel panel-default'>" +
" <div class='panel-heading'>质量规则报告预览</div>" +
" <div class='panel-body'>"+
" <table class='table table-vertical'>"+
" <tr><td>"+
" <table class='table table-vertical'>" +
" <tr>" +
" <td width='10%'>省份</td>" +
" <td>"+jsonData[i].provinceName+"</td>" +
" <td width='10%'>数据来源</td>" +
" <td>"+jsonData[i].dataSourceName+"</td>" +
" <td width='10%'>业务</td>" +
" <td>"+jsonData[i].businessName+"</td>" +
" </tr>" +
" <tr>" +
" <td width='10%'>渠道</td>" +
" <td>"+jsonData[i].channelName+"</td>" +
" <td>指标名称</td>" +
" <td>"+jsonData[i].kpiName+"</td>" +
" <td>指标编码</td>" +
" <td>"+jsonData[i].kpiCode+"</td>" +
" </tr>" +
" <tr>" +
" <td>完整性数量</td>" +
" <td>"+jsonData[i].integralityNum+"</td>" +
" <td>完整性占比</td>" +
" <td>"+jsonData[i].integralityPro+"</td>" +
" <td>及时性数量</td>" +
" <td>"+jsonData[i].timelyNum+"</td>" +
" </tr>" +
" <tr>" +
" <td>及时性占比</td>" +
" <td>"+jsonData[i].timelyPro+"</td>" +
" <td>准确性数量</td>" +
" <td>"+jsonData[i].accuracyNum+"</td>" +
" <td>准确性占比</td>" +
" <td>"+jsonData[i].accuracyPro+"</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8' align='center'>质量异常明细展示</td>" +
" </tr>" +
" <tr>" +
" <td colspan='8'>" +
" <div class='panel-body'>" +
" <div style='width: 800px; height: 500px;overflow-y: scroll' id='dataForm' ></div>"+
" </div>" +
" </td>" +
" </tr>" +
"</table>",
lock:true, lock:true,
width:800, width:800,
initialize:function() { initialize:function() {
queryOperation(1,provinceId,kpiId,reportSumStartTime,reportSumEndTime); queryOperation(1,jsonData[i].provinceId,jsonData[i].kpiId,jsonData[i].reportSumStartTime,jsonData[i].reportSumEndTime);
} }
}); });
} }
\ No newline at end of file
...@@ -127,18 +127,18 @@ function ruleResultDetailTable(){ ...@@ -127,18 +127,18 @@ function ruleResultDetailTable(){
var header = new Array(); var header = new Array();
header[0] = ["","<input type='radio' name='update'id='update' onclick='javascript:radioChoose(this);'/>","1%",""]; header[0] = ["","<input type='radio' name='update'id='update' onclick='javascript:radioChoose(this);'/>","1%",""];
header[1] = ["质量规则ID","qualityRuleId","7%","15"]; // header[1] = ["质量规则ID","qualityRuleId","7%","15"];
header[2] = ["省份","provinceName","7%","15"]; // header[2] = ["省份","provinceName","7%","15"];
header[3] = ["数据来源","dataSourceName","7%","15"]; // header[3] = ["数据来源","dataSourceName","7%","15"];
header[4] = ["渠道","channelName","7%","15"]; header[1] = ["渠道","channelName","7%","15"];
header[5] = ["业务","businessName","7%","15"]; header[2] = ["业务","businessName","7%","15"];
header[6] = ["指标名称","kpiName","7%","15"]; header[3] = ["指标名称","kpiName","7%","15"];
header[7] = ["指标编码","kpiCode","7%","15"]; header[4] = ["指标编码","kpiCode","7%","15"];
header[8] = ["数据类型","kpiTypeName","7%","15"]; header[5] = ["数据类型","kpiTypeName","7%","15"];
header[9] = ["数据采集频率","calCycle","7%","15"]; header[6] = ["数据采集频率","calCycle","7%","15"];
header[10] = ["监控延迟时间","kpiMonitorTime","7%","15"]; header[7] = ["监控延迟时间","kpiMonitorTime","7%","15"];
header[11] = ["指标采集时间","businessTime","7%","15"]; // header[11] = ["指标采集时间","businessTime","7%","15"];
header[12] = ["准确性规则","accuracyRuleId","7%","15"]; header[8] = ["准确性规则","accuracyRuleId","7%","15"];
window.pagging = new table_pagging({limit:12,tableId:'ruleResultTable',header:header}); window.pagging = new table_pagging({limit:12,tableId:'ruleResultTable',header:header});
pagging.pagging(jsonData); pagging.pagging(jsonData);
...@@ -301,7 +301,7 @@ table_pagging.prototype = { ...@@ -301,7 +301,7 @@ table_pagging.prototype = {
tdContext = "&nbsp;"; tdContext = "&nbsp;";
} }
if(k==10){ if(k==7){
if(tdContext.indexOf("/")!=-1){ if(tdContext.indexOf("/")!=-1){
var a = new Array(); var a = new Array();
a = tdContext.split("/"); a = tdContext.split("/");
...@@ -319,13 +319,13 @@ table_pagging.prototype = { ...@@ -319,13 +319,13 @@ table_pagging.prototype = {
} }
} }
if(k==11){ // if(k==11){
//
if(tdContext!="&nbsp;"){ // if(tdContext!="&nbsp;"){
tdContext = df.format(new Date(tdContext)); // tdContext = df.format(new Date(tdContext));
} // }
} // }
if(k==12){ if(k==8){
tdContext = "<a href='javascript:;' onclick='selectRule(\""+this.getData(this.objectlist[i],"qualityRuleId")+"\")'>查看规则</a>"; tdContext = "<a href='javascript:;' onclick='selectRule(\""+this.getData(this.objectlist[i],"qualityRuleId")+"\")'>查看规则</a>";
} }
...@@ -535,6 +535,7 @@ table_pagging.prototype = { ...@@ -535,6 +535,7 @@ table_pagging.prototype = {
//alert(clickObj); //alert(clickObj);
//alert(clickObj.nextSibling.innerHTML); //alert(clickObj.nextSibling.innerHTML);
$("#updateRule").attr("disabled", false); $("#updateRule").attr("disabled", false);
$("#deleteRule").attr("disabled", false);
qualityRuleId=parseInt(obj[parseInt(clickObj.nextSibling.innerHTML)].qualityRuleId); qualityRuleId=parseInt(obj[parseInt(clickObj.nextSibling.innerHTML)].qualityRuleId);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment