b1748fcf 康伟

kangwei: 电耗分析:药剂浓度、药剂去除率使用平均值计算

          修改通用方法:法律法规等的导出,
1 个父辈 87af3e9e
...@@ -77,7 +77,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -77,7 +77,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
77 public List<WaterTreatmentVO> statisticsCLSLXQ(String startDate,String endDate, String departIds){ 77 public List<WaterTreatmentVO> statisticsCLSLXQ(String startDate,String endDate, String departIds){
78 List<WaterTreatmentVO> dateList = null; 78 List<WaterTreatmentVO> dateList = null;
79 DateVO dateVO = new DateVO(startDate);//转换后的时间参数 79 DateVO dateVO = new DateVO(startDate);//转换后的时间参数
80 long differenceDay = DateUtils.differenceDay(startDate, endDate);
81 String departIdssss = BaseUtil.quoteEach(departIds , ","); 80 String departIdssss = BaseUtil.quoteEach(departIds , ",");
82 //String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; 81 //String factorySql = "select fi.depart_id ,d.depart_name, fi.pro_scale*10000 'pro_scale' from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")";
83 String factorySql = "select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")"; 82 String factorySql = "select group_concat(fi.depart_id) from sys_factory_info fi , sys_depart d where fi.depart_id = d.id and d.depart_type =1 and d.id in("+departIdssss+")";
...@@ -87,11 +86,16 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -87,11 +86,16 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
87 //月产水量 86 //月产水量
88 Map<String,String> cslMap = commonQueryCsl(departIds, startDate, endDate); 87 Map<String,String> cslMap = commonQueryCsl(departIds, startDate, endDate);
89 88
90 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate()); 89 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119,"CSL", departIds, dateVO.getNowMonthStartDate(),dateVO.getNowMonthEndDate());
91 String sql = "select aaa.CSL 'csl' ,aaa.depart_id , d.depart_name, fi.pro_scale*10000 'pro_scale' from "+ dataViewName2119 +" aaa"; 90 /* String sql = "select aaa.CSL 'csl' ,aaa.depart_id , d.depart_name, fi.pro_scale*10000 'pro_scale' from "+ dataViewName2119 +" aaa";
92 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id"; 91 sql += " left join sys_factory_info fi on fi.depart_id = aaa.depart_id";
93 sql += " left join sys_depart d on d.id = aaa.depart_id"; 92 sql += " left join sys_depart d on d.id = aaa.depart_id";
94 sql += " order by aaa.CSL desc "; 93 sql += " order by aaa.CSL desc ";*/
94 String sql = " select d.depart_name , bbb.* , f.pro_scale *10000 'pro_scale', ROUND( 100 * bbb.CSL/( f.pro_scale *10000 ) , 2 ) AS fhl from ( ";
95 sql += " select sum(aaa.CSL) CSL, avg(aaa.CSL) dayCsl ,aaa.depart_id from "+dataViewName2119+ " aaa group by aaa.depart_id";
96 sql += " ) bbb LEFT JOIN sys_factory_info f ON f.depart_id = bbb.depart_id ";
97 sql += " left join sys_depart d on d.id = bbb.depart_id ";
98 sql += " order by bbb.CSL desc ";
95 dateList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WaterTreatmentVO>(WaterTreatmentVO.class)); 99 dateList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<WaterTreatmentVO>(WaterTreatmentVO.class));
96 100
97 101
...@@ -104,9 +108,7 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -104,9 +108,7 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
104 if(dateList != null ){ 108 if(dateList != null ){
105 for(WaterTreatmentVO waterTreatmentVO : dateList){ 109 for(WaterTreatmentVO waterTreatmentVO : dateList){
106 waterTreatmentVO.setRank(index++);//设置排名 110 waterTreatmentVO.setRank(index++);//设置排名
107 waterTreatmentVO.setMonthDayNum(differenceDay);
108 if(waterTreatmentVO.getCSL() != null ){ 111 if(waterTreatmentVO.getCSL() != null ){
109 waterTreatmentVO.setDayCsl(Double.parseDouble(JSUtils.divide( waterTreatmentVO.getCSL() ,differenceDay )) );
110 waterTreatmentVO.setCSL(Double.parseDouble(JSUtils.format(waterTreatmentVO.getCSL()) ));//格式化 112 waterTreatmentVO.setCSL(Double.parseDouble(JSUtils.format(waterTreatmentVO.getCSL()) ));//格式化
111 } 113 }
112 /* waterTreatmentVO.setRank( index++);//设置排名 114 /* waterTreatmentVO.setRank( index++);//设置排名
......
...@@ -36,14 +36,8 @@ public class WaterTreatmentVO { ...@@ -36,14 +36,8 @@ public class WaterTreatmentVO {
36 @ApiModelProperty(value = "排名") 36 @ApiModelProperty(value = "排名")
37 private Integer rank; 37 private Integer rank;
38 38
39 private long monthDayNum = 30; 39 // private long monthDayNum = 30;
40 40
41 public String getFhl() {
42 if(this.getCSL() != null && this.getProScale() != null && this.getProScale().doubleValue() > 0 ){
43 fhl = JSUtils.format( this.getCSL()*100 / (this.getProScale() * this.getMonthDayNum() ) );
44 }
45 return fhl;
46 }
47 41
48 public String getHbcslbl() { 42 public String getHbcslbl() {
49 if(this.getCSL() != null && this.getHbcsl() != null && this.getHbcsl().doubleValue() > 0){ 43 if(this.getCSL() != null && this.getHbcsl() != null && this.getHbcsl().doubleValue() > 0){
......
...@@ -22,6 +22,7 @@ import com.skua.tool.util.JoinSqlUtils; ...@@ -22,6 +22,7 @@ import com.skua.tool.util.JoinSqlUtils;
22 import io.swagger.annotations.Api; 22 import io.swagger.annotations.Api;
23 import io.swagger.annotations.ApiOperation; 23 import io.swagger.annotations.ApiOperation;
24 import lombok.extern.slf4j.Slf4j; 24 import lombok.extern.slf4j.Slf4j;
25 import org.apache.commons.lang.StringUtils;
25 import org.apache.poi.xwpf.usermodel.ParagraphAlignment; 26 import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
26 import org.apache.poi.xwpf.usermodel.XWPFDocument; 27 import org.apache.poi.xwpf.usermodel.XWPFDocument;
27 import org.apache.poi.xwpf.usermodel.XWPFParagraph; 28 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
...@@ -179,7 +180,9 @@ public class UserPaperController { ...@@ -179,7 +180,9 @@ public class UserPaperController {
179 */ 180 */
180 181
181 Page<Paper> page = new Page<Paper>(pageNo, pageSize); 182 Page<Paper> page = new Page<Paper>(pageNo, pageSize);
183 if(StringUtils.isEmpty(paper.getUserId())){
182 paper.setUserId(BaseContextHandler.getUserId());//获取当前用户编号 184 paper.setUserId(BaseContextHandler.getUserId());//获取当前用户编号
185 }
183 IPage<Paper> paperList = paperService.queryMyPaperRecoredByList(page,paper); 186 IPage<Paper> paperList = paperService.queryMyPaperRecoredByList(page,paper);
184 187
185 result.setResult(paperList); 188 result.setResult(paperList);
......
...@@ -9,6 +9,7 @@ import com.skua.core.aspect.annotation.AutoLog; ...@@ -9,6 +9,7 @@ import com.skua.core.aspect.annotation.AutoLog;
9 import com.skua.core.context.BaseContextHandler; 9 import com.skua.core.context.BaseContextHandler;
10 import com.skua.core.context.SpringContextUtils; 10 import com.skua.core.context.SpringContextUtils;
11 import com.skua.core.query.QueryGenerator; 11 import com.skua.core.query.QueryGenerator;
12 import com.skua.core.util.ConvertUtils;
12 import com.skua.core.util.DateUtils; 13 import com.skua.core.util.DateUtils;
13 import com.skua.modules.erp.entity.ErpSettlement; 14 import com.skua.modules.erp.entity.ErpSettlement;
14 import com.skua.modules.erp.vo.PurchaseContractVO; 15 import com.skua.modules.erp.vo.PurchaseContractVO;
...@@ -114,13 +115,13 @@ public class MaterialInfoController { ...@@ -114,13 +115,13 @@ public class MaterialInfoController {
114 queryWrapper.like("fac_information_name",materialInfo.getFacInformationName()); 115 queryWrapper.like("fac_information_name",materialInfo.getFacInformationName());
115 } 116 }
116 if(StringUtils.isNotEmpty(materialInfo.getRulesType())){ 117 if(StringUtils.isNotEmpty(materialInfo.getRulesType())){
117 queryWrapper.eq("rules_type",materialInfo.getRulesType()); 118 queryWrapper.like("rules_type",materialInfo.getRulesType());
118 } 119 }
119 if(StringUtils.isNotEmpty(materialInfo.getLawsType())){ 120 if(StringUtils.isNotEmpty(materialInfo.getLawsType())){
120 queryWrapper.like("laws_type",materialInfo.getLawsType()); 121 queryWrapper.like("laws_type",materialInfo.getLawsType());
121 } 122 }
122 if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){ 123 if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){
123 queryWrapper.eq("standards_type",materialInfo.getStandardsType()); 124 queryWrapper.like("standards_type",materialInfo.getStandardsType());
124 } 125 }
125 queryWrapper.eq("status","3"); 126 queryWrapper.eq("status","3");
126 IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper); 127 IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
...@@ -178,6 +179,10 @@ public class MaterialInfoController { ...@@ -178,6 +179,10 @@ public class MaterialInfoController {
178 queryWrapper.eq("del_flag","0"); 179 queryWrapper.eq("del_flag","0");
179 // queryWrapper.eq("depart_id",materialInfo.getDepartId()); 180 // queryWrapper.eq("depart_id",materialInfo.getDepartId());
180 //queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,",")); 181 //queryWrapper.in("depart_id", JSUtils.quoteEach(departIds,","));
182
183 if(StringUtils.isNotEmpty(materialInfo.getStatus())){
184 queryWrapper.eq("status",materialInfo.getStatus());
185 }
181 if(StringUtils.isNotEmpty(materialInfo.getFacInformationtype())){ 186 if(StringUtils.isNotEmpty(materialInfo.getFacInformationtype())){
182 queryWrapper.eq("fac_informationtype",materialInfo.getFacInformationtype()); 187 queryWrapper.eq("fac_informationtype",materialInfo.getFacInformationtype());
183 } 188 }
...@@ -186,13 +191,13 @@ public class MaterialInfoController { ...@@ -186,13 +191,13 @@ public class MaterialInfoController {
186 queryWrapper.like("fac_information_name",materialInfo.getFacInformationName()); 191 queryWrapper.like("fac_information_name",materialInfo.getFacInformationName());
187 } 192 }
188 if(StringUtils.isNotEmpty(materialInfo.getRulesType())){ 193 if(StringUtils.isNotEmpty(materialInfo.getRulesType())){
189 queryWrapper.eq("rules_type",materialInfo.getRulesType()); 194 queryWrapper.like("rules_type",materialInfo.getRulesType());
190 } 195 }
191 if(StringUtils.isNotEmpty(materialInfo.getLawsType())){ 196 if(StringUtils.isNotEmpty(materialInfo.getLawsType())){
192 queryWrapper.like("laws_type",materialInfo.getLawsType()); 197 queryWrapper.like("laws_type",materialInfo.getLawsType());
193 } 198 }
194 if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){ 199 if(StringUtils.isNotEmpty(materialInfo.getStandardsType())){
195 queryWrapper.eq("standards_type",materialInfo.getStandardsType()); 200 queryWrapper.like("standards_type",materialInfo.getStandardsType());
196 } 201 }
197 queryWrapper.orderByDesc("create_time"); 202 queryWrapper.orderByDesc("create_time");
198 return queryWrapper; 203 return queryWrapper;
...@@ -377,12 +382,12 @@ public class MaterialInfoController { ...@@ -377,12 +382,12 @@ public class MaterialInfoController {
377 /** 382 /**
378 * 导出excel 383 * 导出excel
379 * 384 *
380 * @param request
381 * @param response
382 */ 385 */
383 @RequestMapping(value = "/exportXls") 386 @RequestMapping(value = "/exportXls")
384 public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { 387 public ModelAndView exportXls(MaterialInfo materialInfo) {
385 // Step.1 组装查询条件 388 // Step.1 组装查询条件
389
390 /*
386 QueryWrapper<MaterialInfo> queryWrapper = null; 391 QueryWrapper<MaterialInfo> queryWrapper = null;
387 try { 392 try {
388 String paramsStr = request.getParameter("paramsStr"); 393 String paramsStr = request.getParameter("paramsStr");
...@@ -393,15 +398,20 @@ public class MaterialInfoController { ...@@ -393,15 +398,20 @@ public class MaterialInfoController {
393 } 398 }
394 } catch (UnsupportedEncodingException e) { 399 } catch (UnsupportedEncodingException e) {
395 e.printStackTrace(); 400 e.printStackTrace();
396 } 401 }*/
397 402
403 QueryWrapper<MaterialInfo> queryWrapper = getMaterialInfoQueryWrapper(materialInfo);
398 //Step.2 AutoPoi 导出Excel 404 //Step.2 AutoPoi 导出Excel
399 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); 405 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
400 List<MaterialInfo> pageList = materialInfoService.list(queryWrapper); 406 List<MaterialInfo> pageList = materialInfoService.list(queryWrapper);
407
401 //导出文件名称 408 //导出文件名称
402 mv.addObject(NormalExcelConstants.FILE_NAME, "厂区资料管理列表"); 409 Map<String,String> nameMap = new HashMap<>();
403 mv.addObject(NormalExcelConstants.CLASS, MaterialInformation.class); 410 nameMap.put("bzgf","标准规范");nameMap.put("flfg","法律法规");nameMap.put("gzzd","公司制度章程");
404 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("厂区资料管理列表数据", "导出人:Jeecg", "导出信息")); 411 String fileName = ConvertUtils.getString( nameMap.get( materialInfo.getFacInformationtype() ) , "厂区资料管理列表数据");
412 mv.addObject(NormalExcelConstants.FILE_NAME,fileName );
413 mv.addObject(NormalExcelConstants.CLASS, MaterialInfo.class);
414 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(fileName, "导出人:", "导出信息"));
405 mv.addObject(NormalExcelConstants.DATA_LIST, pageList); 415 mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
406 return mv; 416 return mv;
407 } 417 }
...@@ -500,14 +510,14 @@ public class MaterialInfoController { ...@@ -500,14 +510,14 @@ public class MaterialInfoController {
500 @AutoLog(value = "厂区资料管理-流量统计") 510 @AutoLog(value = "厂区资料管理-流量统计")
501 @ApiOperation(value = "厂区资料管理-流量统计", notes = "厂区资料管理-流量统计") 511 @ApiOperation(value = "厂区资料管理-流量统计", notes = "厂区资料管理-流量统计")
502 @GetMapping(value = "/flowStatistics") 512 @GetMapping(value = "/flowStatistics")
503 public Result<List<Map<String, Object>>> flowStatistics(String departId,String startTime,String endTime,String facInformationtype) { 513 public Result<List<Map<String, Object>>> flowStatistics(String departId,String startTime,String endTime,String facInformationtype,String status) {
504 Result<List<Map<String, Object>>> result = new Result<>(); 514 Result<List<Map<String, Object>>> result = new Result<>();
505 if (StringUtils.isBlank(departId)&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) { 515 if (StringUtils.isBlank(departId)&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) {
506 departId = departService.getChildDepartId(BaseContextHandler.getDeparts()); 516 departId = departService.getChildDepartId(BaseContextHandler.getDeparts());
507 }else{ 517 }else{
508 departId = departService.getChildDepartId(departId); 518 departId = departService.getChildDepartId(departId);
509 } 519 }
510 List<Map<String, Object>> pageList = materialInfoService.flowStatistics(departId,startTime,endTime,facInformationtype); 520 List<Map<String, Object>> pageList = materialInfoService.flowStatistics(departId,startTime,endTime,facInformationtype,status);
511 result.setSuccess(true); 521 result.setSuccess(true);
512 result.setResult(pageList); 522 result.setResult(pageList);
513 return result; 523 return result;
......
...@@ -30,12 +30,12 @@ public class MaterialInfo { ...@@ -30,12 +30,12 @@ public class MaterialInfo {
30 @ApiModelProperty(value = "id") 30 @ApiModelProperty(value = "id")
31 private String id; 31 private String id;
32 /**厂区资料文件名*/ 32 /**厂区资料文件名*/
33 @Excel(name = "厂区资料文件名", width = 15 , orderNum = "3") 33 @Excel(name = "文件标题", width = 15 , orderNum = "1")
34 @ApiModelProperty(value = "厂区资料文件名") 34 @ApiModelProperty(value = "文件标题")
35 private String facInformationName; 35 private String facInformationName;
36 /**厂区资料文件名类型*/ 36 /**厂区资料文件名类型*/
37 @Excel(name = "厂区资料文件名类型", width = 15,dicCode = "fac_information_type",orderNum = "4") 37 //@Excel(name = "文件类型", width = 15,dicCode = "fac_information_type",orderNum = "2")
38 @ApiModelProperty(value = "厂区资料文件名类型") 38 @ApiModelProperty(value = "文件类型")
39 @Dict(dicCode = "fac_information_type") 39 @Dict(dicCode = "fac_information_type")
40 private String facInformationtype; 40 private String facInformationtype;
41 /**删除状态(0,正常,1已删除)*/ 41 /**删除状态(0,正常,1已删除)*/
...@@ -45,12 +45,11 @@ public class MaterialInfo { ...@@ -45,12 +45,11 @@ public class MaterialInfo {
45 @ApiModelProperty(value = "用户编号") 45 @ApiModelProperty(value = "用户编号")
46 private String userId; 46 private String userId;
47 /**创建人*/ 47 /**创建人*/
48 @Excel(name = "创建人", width = 15,dictTable = "sys_user",dicCode = "username",dicText = "realname" ,orderNum = "6") 48 //@Excel(name = "创建人", width = 15,dictTable = "sys_user",dicCode = "username",dicText = "realname" ,orderNum = "6")
49 @ApiModelProperty(value = "创建人" ) 49 @ApiModelProperty(value = "创建人" )
50 @Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname") 50 @Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
51 private String createBy; 51 private String createBy;
52 /**创建时间*/ 52 /**创建时间*/
53 @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
54 @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") 53 @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
55 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 54 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
56 @ApiModelProperty(value = "创建时间") 55 @ApiModelProperty(value = "创建时间")
...@@ -67,7 +66,7 @@ public class MaterialInfo { ...@@ -67,7 +66,7 @@ public class MaterialInfo {
67 @ApiModelProperty(value = "附件地址") 66 @ApiModelProperty(value = "附件地址")
68 private String docuAddr; 67 private String docuAddr;
69 /**所属厂区*/ 68 /**所属厂区*/
70 @Excel(name = "所属厂区", width = 15,dictTable = "sys_depart", dicCode="id", dicText = "depart_name" ,orderNum = "1") 69 @Excel(name = "所属厂区", width = 15,dictTable = "sys_depart", dicCode="id", dicText = "depart_name" ,orderNum = "3")
71 @ApiModelProperty(value = "所属厂区") 70 @ApiModelProperty(value = "所属厂区")
72 @Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name") 71 @Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name")
73 private String departId; 72 private String departId;
...@@ -87,12 +86,12 @@ public class MaterialInfo { ...@@ -87,12 +86,12 @@ public class MaterialInfo {
87 private String rulesType; 86 private String rulesType;
88 /**法律法规类型*/ 87 /**法律法规类型*/
89 @Dict(dicCode = "laws_type") 88 @Dict(dicCode = "laws_type")
90 @Excel(name = "法律法规类型", width = 15,dicCode = "laws_type" ,orderNum = "2") 89 @Excel(name = "文件类型", width = 15,dicCode = "laws_type" ,orderNum = "2")
91 @ApiModelProperty(value = "法律法规类型") 90 @ApiModelProperty(value = "文件类型")
92 private String lawsType; 91 private String lawsType;
93 /**法律法规归属*/ 92 /**法律法规归属*/
94 @Dict(dicCode = "laws_source") 93 @Dict(dicCode = "laws_source")
95 @ApiModelProperty(value = "法律法规归属") 94 @ApiModelProperty(value = "文件归属")
96 private String lawsSource; 95 private String lawsSource;
97 /**标准规范类型*/ 96 /**标准规范类型*/
98 @Dict(dicCode = "standards_type") 97 @Dict(dicCode = "standards_type")
...@@ -103,24 +102,20 @@ public class MaterialInfo { ...@@ -103,24 +102,20 @@ public class MaterialInfo {
103 @ApiModelProperty(value = "标准规范来源") 102 @ApiModelProperty(value = "标准规范来源")
104 private String standardsSource; 103 private String standardsSource;
105 /**发布时间*/ 104 /**发布时间*/
106 @Excel(name = "发布时间", width = 15) 105 @Excel(name = "发布时间", width = 15 ,orderNum = "4")
107 @ApiModelProperty(value = "发布时间") 106 @ApiModelProperty(value = "发布时间")
108 private String releaseTime; 107 private String releaseTime;
109 /**有效时间*/ 108 /**有效时间*/
110 @Excel(name = "有效时间", width = 15) 109 @Excel(name = "有效时间", width = 15 ,orderNum = "6")
111 @ApiModelProperty(value = "有效时间") 110 @ApiModelProperty(value = "有效时间")
112 private String effectiveTime; 111 private String effectiveTime;
113 /**版本号*/ 112 /**版本号*/
114 @Excel(name = "版本号", width = 15)
115 @ApiModelProperty(value = "版本号") 113 @ApiModelProperty(value = "版本号")
116 private String fileVersion; 114 private String fileVersion;
117 /**所属部门*/ 115 /**所属部门*/
118 @Excel(name = "所属部门", width = 15)
119 @ApiModelProperty(value = "所属部门") 116 @ApiModelProperty(value = "所属部门")
120 private String fileDepart; 117 private String fileDepart;
121 /**修订过程*/ 118 /**修订过程*/
122 @Excel(name = "修订过程", width = 15)
123 @ApiModelProperty(value = "修订过程")
124 private String updateHistory; 119 private String updateHistory;
125 120
126 @ApiModelProperty(value = "文件号") 121 @ApiModelProperty(value = "文件号")
......
...@@ -27,7 +27,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> { ...@@ -27,7 +27,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
27 * @author Li Yuanyuan, 2022年6月22日 下午3:10:31 27 * @author Li Yuanyuan, 2022年6月22日 下午3:10:31
28 * @Description: TODO(这里描述这个方法的需求变更情况) 28 * @Description: TODO(这里描述这个方法的需求变更情况)
29 */ 29 */
30 List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime, String facInformationtype); 30 List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime, String facInformationtype,String status);
31 31
32 List<MaterialInfo> getList(@Param("materialInfo") MaterialInfo materialInfo, @Param("departIds") String departIds); 32 List<MaterialInfo> getList(@Param("materialInfo") MaterialInfo materialInfo, @Param("departIds") String departIds);
33 } 33 }
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
30 material_info a 30 material_info a
31 INNER JOIN material_info_handle_record b ON a.id = b.info_id 31 INNER JOIN material_info_handle_record b ON a.id = b.info_id
32 WHERE 32 WHERE
33 b.create_time &gt;= #{startTime} 33 del_flag = 0
34 AND b.create_time &gt;= #{startTime}
34 AND b.create_time &lt;= #{endTime} 35 AND b.create_time &lt;= #{endTime}
35 <if test="departId!=null and departId!=''"> 36 <if test="departId!=null and departId!=''">
36 and a.depart_id in 37 and a.depart_id in
...@@ -41,6 +42,9 @@ ...@@ -41,6 +42,9 @@
41 <if test="facInformationtype!=null and facInformationtype!=''"> 42 <if test="facInformationtype!=null and facInformationtype!=''">
42 AND a.fac_informationtype = #{facInformationtype} 43 AND a.fac_informationtype = #{facInformationtype}
43 </if> 44 </if>
45 <if test="status!=null and status!=''">
46 and a.status = #{status}
47 </if>
44 GROUP BY 48 GROUP BY
45 b.create_time,b.handle_type 49 b.create_time,b.handle_type
46 </select> 50 </select>
...@@ -53,6 +57,9 @@ ...@@ -53,6 +57,9 @@
53 '${item}' 57 '${item}'
54 </foreach> 58 </foreach>
55 </if> 59 </if>
60 <if test="materialInfo.status!=null and materialInfo.status!=''">
61 and status = #{materialInfo.status}
62 </if>
56 <if test="materialInfo.facInformationtype!=null and materialInfo.facInformationtype!=''"> 63 <if test="materialInfo.facInformationtype!=null and materialInfo.facInformationtype!=''">
57 and fac_informationtype = #{materialInfo.facInformationtype} 64 and fac_informationtype = #{materialInfo.facInformationtype}
58 </if> 65 </if>
......
...@@ -41,7 +41,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> { ...@@ -41,7 +41,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
41 * @author Li Yuanyuan, 2022年6月22日 下午3:00:25 41 * @author Li Yuanyuan, 2022年6月22日 下午3:00:25
42 * @Description: TODO(这里描述这个方法的需求变更情况) 42 * @Description: TODO(这里描述这个方法的需求变更情况)
43 */ 43 */
44 List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime,String facInformationtype); 44 List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime,String facInformationtype,String status);
45 45
46 IPage<MaterialInfo> getList(Page<MaterialInfo> page, MaterialInfo materialInfo, String departIds); 46 IPage<MaterialInfo> getList(Page<MaterialInfo> page, MaterialInfo materialInfo, String departIds);
47 } 47 }
......
...@@ -83,12 +83,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat ...@@ -83,12 +83,12 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
83 } 83 }
84 84
85 @Override 85 @Override
86 public List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime, String facInformationtype) { 86 public List<Map<String, Object>> flowStatistics(String departId, String startTime, String endTime, String facInformationtype,String status) {
87 //日期切片 87 //日期切片
88 List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>(); 88 List<Map<String,Object>> resultList = new ArrayList<Map<String,Object>>();
89 List<String> timeList = DateUtils.sliceUpDateRange(startTime,endTime,"month"); 89 List<String> timeList = DateUtils.sliceUpDateRange(startTime,endTime,"month");
90 //获取统计结果 90 //获取统计结果
91 List<Map<String,Object>> dataList = baseMapper.flowStatistics(departId,startTime,endTime,facInformationtype); 91 List<Map<String,Object>> dataList = baseMapper.flowStatistics(departId,startTime,endTime,facInformationtype,status);
92 Map<String,Map<String,Object>> resultMap = new HashMap<String,Map<String,Object>>(); 92 Map<String,Map<String,Object>> resultMap = new HashMap<String,Map<String,Object>>();
93 for(Map<String,Object> map : dataList) { 93 for(Map<String,Object> map : dataList) {
94 resultMap.put(ConvertUtils.getString(map.get("create_time"))+"_"+ConvertUtils.getString(map.get("handle_type")), map); 94 resultMap.put(ConvertUtils.getString(map.get("create_time"))+"_"+ConvertUtils.getString(map.get("handle_type")), map);
......
...@@ -32,7 +32,7 @@ public class PowerConsumptionAnalysisController { ...@@ -32,7 +32,7 @@ public class PowerConsumptionAnalysisController {
32 @RequestMapping(value = "/data/display", method = RequestMethod.GET) 32 @RequestMapping(value = "/data/display", method = RequestMethod.GET)
33 public Result<Map<String, Object>> dataDisplay(AnysisParamsVO anysisParamsVO) { 33 public Result<Map<String, Object>> dataDisplay(AnysisParamsVO anysisParamsVO) {
34 Result<Map<String, Object>> result = new Result<>(); 34 Result<Map<String, Object>> result = new Result<>();
35 anysisParamsVO.setFactoryId(BaseContextHandler.getDeparts()); 35 //anysisParamsVO.setFactoryId(BaseContextHandler.getDeparts());
36 Map<String, Object> data = powerConsumptionAnalysisService.dataDisplay(anysisParamsVO); 36 Map<String, Object> data = powerConsumptionAnalysisService.dataDisplay(anysisParamsVO);
37 result.setResult(data); 37 result.setResult(data);
38 result.setSuccess(true); 38 result.setSuccess(true);
......
...@@ -14,6 +14,7 @@ import com.skua.modules.equipment.vo.AnysisParamsVO; ...@@ -14,6 +14,7 @@ import com.skua.modules.equipment.vo.AnysisParamsVO;
14 import com.skua.modules.equipment.vo.MetricVo; 14 import com.skua.modules.equipment.vo.MetricVo;
15 import com.skua.tool.util.JSUtils; 15 import com.skua.tool.util.JSUtils;
16 import lombok.extern.slf4j.Slf4j; 16 import lombok.extern.slf4j.Slf4j;
17 import org.apache.commons.lang.StringUtils;
17 import org.apache.shiro.dao.DataAccessException; 18 import org.apache.shiro.dao.DataAccessException;
18 import org.springframework.jdbc.core.BeanPropertyRowMapper; 19 import org.springframework.jdbc.core.BeanPropertyRowMapper;
19 import org.springframework.jdbc.core.JdbcTemplate; 20 import org.springframework.jdbc.core.JdbcTemplate;
...@@ -280,7 +281,7 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna ...@@ -280,7 +281,7 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna
280 //吨水电耗数据 281 //吨水电耗数据
281 List<ReportItemVO> dsdhTrendListList =queryDSDHTrendList( factoryId, startTime, endTime,false); 282 List<ReportItemVO> dsdhTrendListList =queryDSDHTrendList( factoryId, startTime, endTime,false);
282 //查询数据:水质水量报表 283 //查询数据:水质水量报表
283 List<DataViewVO> dataViewVO2119List = queryDataView2119( factoryId, startTime, endTime); 284 List<DataViewVO> dataViewVO2119List = queryDataView2119( factoryId, startTime, endTime,"avg");
284 285
285 //吨水电耗 286 //吨水电耗
286 List<TonOfWaterTrendDto> trend_dsdh = new ArrayList<>(); 287 List<TonOfWaterTrendDto> trend_dsdh = new ArrayList<>();
...@@ -356,7 +357,8 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna ...@@ -356,7 +357,8 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna
356 //吨水电耗数据 357 //吨水电耗数据
357 List<ReportItemVO> dsdhTrendListList =queryDSDHTrendList( factoryId, startTime, endTime,false); 358 List<ReportItemVO> dsdhTrendListList =queryDSDHTrendList( factoryId, startTime, endTime,false);
358 //查询数据:水质水量报表 359 //查询数据:水质水量报表
359 List<DataViewVO> dataViewVO2119List = queryDataView2119( factoryId, startTime, endTime); 360 List<DataViewVO> dataViewVO2119List = queryDataView2119( factoryId, startTime, endTime,"avg");
361
360 362
361 //吨水电耗 363 //吨水电耗
362 List<TonOfWaterTrendDto> trend_dsdh = new ArrayList<>(); 364 List<TonOfWaterTrendDto> trend_dsdh = new ArrayList<>();
...@@ -413,12 +415,13 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna ...@@ -413,12 +415,13 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna
413 415
414 /**************************************/ 416 /**************************************/
415 // 水质水量报表 417 // 水质水量报表
416 private List<DataViewVO> queryDataView2119(String departIds, String startTime, String endTime) { 418 private List<DataViewVO> queryDataView2119(String departIds, String startTime, String endTime,String singOperator) {
417 //ReportConstant.fieldSz = JSZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN,JSPH,JSSS,CSPH,CSSS"; 419 //ReportConstant.fieldSz = JSZL,CSZL,JSCOD,CSCOD,JSAD,CSAD,JSZD,CSTN,JSPH,JSSS,CSPH,CSSS";
420 if(StringUtils.isNotEmpty(singOperator)) singOperator = "sum";
418 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119, ReportConstant.fieldSz, departIds, startTime, endTime); 421 String dataViewName2119 = ReportViewUtil.buildView(ReportConstant.view2119, ReportConstant.fieldSz, departIds, startTime, endTime);
419 String sql = " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' , ROUND( SUM( IFNULL(aaa.JSCOD,0) ), 2 ) AS JSCOD, ROUND( SUM( IFNULL(aaa.CSCOD,0) ), 2 ) AS CSCOD,"; 422 String sql = " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' , ROUND( "+singOperator+"( IFNULL(aaa.JSCOD,0) ), 2 ) AS JSCOD, ROUND( "+singOperator+"( IFNULL(aaa.CSCOD,0) ), 2 ) AS CSCOD,";
420 sql += " ROUND( SUM( IFNULL(aaa.JSZL,0) ), 2 ) AS JSZL, ROUND( SUM( IFNULL(aaa.CSZL,0) ), 2 ) AS CSZL,"; 423 sql += " ROUND( "+singOperator+"( IFNULL(aaa.JSZL,0) ), 2 ) AS JSZL, ROUND( "+singOperator+"( IFNULL(aaa.CSZL,0) ), 2 ) AS CSZL,";
421 sql += "ROUND( SUM( IFNULL(aaa.JSAD,0) ), 2 ) AS JSAD, ROUND( SUM( IFNULL(aaa.CSAD,0) ), 2 ) AS CSAD "; 424 sql += "ROUND( "+singOperator+"( IFNULL(aaa.JSAD,0) ), 2 ) AS JSAD, ROUND( "+singOperator+"( IFNULL(aaa.CSAD,0) ), 2 ) AS CSAD ";
422 sql += "from "+ dataViewName2119 +" aaa "; 425 sql += "from "+ dataViewName2119 +" aaa ";
423 sql += " group by DATE_FORMAT(aaa.time,'%Y-%m') "; 426 sql += " group by DATE_FORMAT(aaa.time,'%Y-%m') ";
424 427
...@@ -429,11 +432,20 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna ...@@ -429,11 +432,20 @@ public class PowerConsumptionAnalusisServiceImpl implements IPowerConsumptionAna
429 // 负荷率 432 // 负荷率
430 private List<ReportItemVO> queryFhlTrendList(String departIds, String startTime, String endTime) { 433 private List<ReportItemVO> queryFhlTrendList(String departIds, String startTime, String endTime) {
431 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_CSL, departIds, startTime, endTime); 434 String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view2119,ReportConstant.field_CSL, departIds, startTime, endTime);
432 String sql = " select bbb.time,ROUND(avg(bbb.wsfhl),2) 'value' from ( "; 435 /*String sql = " select bbb.time,ROUND(avg(bbb.wsfhl),2) 'value' from ( ";
433 sql += " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' ,aaa.depart_id , sum(aaa.CSL) CSL, ROUND( IFNULL( 100 * ( sum(aaa.CSL)/( f.pro_scale * 31*10000 ) ),0), 2 ) AS wsfhl from "+ dataViewName3a24 +" aaa "; 436 sql += " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' ,aaa.depart_id , sum(aaa.CSL) CSL, ROUND( IFNULL( 100 * ( avg(aaa.CSL)/( f.pro_scale *10000 ) ),0), 2 ) AS wsfhl from "+ dataViewName3a24 +" aaa ";
434 sql += " LEFT JOIN sys_factory_info f ON f.depart_id = aaa.depart_id " ; 437 sql += " LEFT JOIN sys_factory_info f ON f.depart_id = aaa.depart_id " ;
435 sql += " group by DATE_FORMAT(aaa.time,'%Y-%m') , aaa.depart_id "; 438 sql += " group by DATE_FORMAT(aaa.time,'%Y-%m') , aaa.depart_id ";
436 sql += ")bbb group by bbb.time "; 439 sql += ")bbb group by bbb.time ";*/
440
441 String sql = "select bbb.* , f.pro_scale *10000 , ROUND( 100 * bbb.CSL/( f.pro_scale *10000 ) , 2 ) AS 'value' from (";
442 sql += " select DATE_FORMAT(aaa.time,'%Y-%m') 'time' ,aaa.depart_id , avg(aaa.CSL) CSL from " +dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m') , aaa.depart_id " ;
443 sql += " )bbb ";
444 sql += " LEFT JOIN sys_factory_info f ON f.depart_id = bbb.depart_id ";
445
446
447
448
437 //查询数据 449 //查询数据
438 List<ReportItemVO> trendVOList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class)); 450 List<ReportItemVO> trendVOList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportItemVO>(ReportItemVO.class));
439 451
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!