2d603ae0 张雷

Merge remote-tracking branch 'origin/master' into master

2 个父辈 f674f251 c4bdaba0
正在显示 22 个修改的文件 包含 121 行增加438 行删除
...@@ -79,9 +79,13 @@ public class ReportViewUtil { ...@@ -79,9 +79,13 @@ public class ReportViewUtil {
79 if(StringUtils.isNotEmpty(departIds)){ 79 if(StringUtils.isNotEmpty(departIds)){
80 sb.append(" and depart_id in ("+inSqlPart+") "); 80 sb.append(" and depart_id in ("+inSqlPart+") ");
81 } 81 }
82 if(!StringUtils.isEmpty(startTime)) { 82 if(StringUtils.isNotEmpty(startTime)) {
83 sb.append(" and data_time>='"+startTime+"' and data_time<='"+endTime+"' "); 83 sb.append(" and data_time>='"+startTime+"' ");
84 }
85 if(StringUtils.isNotEmpty(endTime)) {
86 sb.append(" and data_time<='"+endTime+"' ");
84 } 87 }
88
85 sb.append(" and reit_id in ("+itemIds+")) `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)"); 89 sb.append(" and reit_id in ("+itemIds+")) `a` left join `f_report_item` `d` on((`a`.`reit_id` = `d`.`id`))) where 1=1 group by `a`.`data_id`,`a`.`depart_id`,`a`.`data_time` order by `a`.`data_time`)");
86 return sb.toString(); 90 return sb.toString();
87 } 91 }
......
1 package com.skua.tool.util; 1 package com.skua.tool.util;
2 2
3 import org.apache.commons.lang3.StringUtils;
4
3 import javax.script.ScriptEngine; 5 import javax.script.ScriptEngine;
4 import javax.script.ScriptEngineManager; 6 import javax.script.ScriptEngineManager;
5 import javax.script.ScriptException; 7 import javax.script.ScriptException;
...@@ -36,9 +38,14 @@ public class JSUtils { ...@@ -36,9 +38,14 @@ public class JSUtils {
36 return executeExpression(expression,"0.00"); 38 return executeExpression(expression,"0.00");
37 } 39 }
38 public static String divide(Object obj1 , Object obj2){ 40 public static String divide(Object obj1 , Object obj2){
41 if(obj1!= null && obj2!=null && StringUtils.isNotEmpty(obj1.toString())){
42 if(StringUtils.isNotEmpty(obj2.toString()) && Double.parseDouble(obj2.toString())!=0){
39 String expression = obj1+ "/" + obj2; 43 String expression = obj1+ "/" + obj2;
40 return executeExpression(expression,"0.00"); 44 return executeExpression(expression,"0.00");
41 } 45 }
46 }
47 return "0";
48 }
42 49
43 /*** 50 /***
44 * 格式化结果,保留两位小数 51 * 格式化结果,保留两位小数
......
...@@ -62,8 +62,6 @@ public class AlarmCustomRecordHistoryController { ...@@ -62,8 +62,6 @@ public class AlarmCustomRecordHistoryController {
62 @Autowired 62 @Autowired
63 private AlarmCustomRecordHistoryService alarmCustomRecordHistoryService; 63 private AlarmCustomRecordHistoryService alarmCustomRecordHistoryService;
64 @Autowired 64 @Autowired
65 private ISysDepartService sysDepartService;
66 @Autowired
67 private RealTimeAlarmJob xtRealTimeAlarmJob; 65 private RealTimeAlarmJob xtRealTimeAlarmJob;
68 /** 66 /**
69 * <pre> 67 * <pre>
......
...@@ -93,11 +93,11 @@ public class AjhWasteSolidTransportController { ...@@ -93,11 +93,11 @@ public class AjhWasteSolidTransportController {
93 }*/ 93 }*/
94 String startDate = req.getParameter("startDate"); 94 String startDate = req.getParameter("startDate");
95 if(StringUtils.isNotEmpty(startDate)){ 95 if(StringUtils.isNotEmpty(startDate)){
96 queryWrapper.ge("create_time",startDate+" 00:00:00"); 96 queryWrapper.ge("transport_time",startDate+" 00:00:00");
97 } 97 }
98 String endDate = req.getParameter("endDate"); 98 String endDate = req.getParameter("endDate");
99 if(StringUtils.isNotEmpty(startDate)){ 99 if(StringUtils.isNotEmpty(startDate)){
100 queryWrapper.le("create_time",endDate+" 23:59:59"); 100 queryWrapper.le("transport_time",endDate+" 23:59:59");
101 } 101 }
102 IPage<AjhWasteSolidTransport> pageList = ajhWasteSolidTransportService.page(page, queryWrapper); 102 IPage<AjhWasteSolidTransport> pageList = ajhWasteSolidTransportService.page(page, queryWrapper);
103 result.setSuccess(true); 103 result.setSuccess(true);
......
...@@ -58,6 +58,7 @@ public class AjhWasteSolidContract { ...@@ -58,6 +58,7 @@ public class AjhWasteSolidContract {
58 /**合同状态:生效、失效*/ 58 /**合同状态:生效、失效*/
59 @Excel(name = "合同状态:生效、失效", width = 15) 59 @Excel(name = "合同状态:生效、失效", width = 15)
60 @ApiModelProperty(value = "合同状态:生效、失效") 60 @ApiModelProperty(value = "合同状态:生效、失效")
61 @Dict(dicCode = "contract_status")
61 private String contractStatus; 62 private String contractStatus;
62 /**联系人*/ 63 /**联系人*/
63 @Excel(name = "联系人", width = 15) 64 @Excel(name = "联系人", width = 15)
......
...@@ -2,9 +2,11 @@ package com.skua.modules.algorithm.controller; ...@@ -2,9 +2,11 @@ package com.skua.modules.algorithm.controller;
2 2
3 3
4 import com.skua.common.constant.ReportConstant; 4 import com.skua.common.constant.ReportConstant;
5 import com.skua.common.report.ReportViewUtil;
5 import com.skua.core.api.vo.Result; 6 import com.skua.core.api.vo.Result;
6 import com.skua.core.aspect.annotation.AutoLog; 7 import com.skua.core.aspect.annotation.AutoLog;
7 import com.skua.core.context.BaseContextHandler; 8 import com.skua.core.context.BaseContextHandler;
9 import com.skua.core.context.SpringContextUtils;
8 import com.skua.core.util.ConvertUtils; 10 import com.skua.core.util.ConvertUtils;
9 import com.skua.modules.algorithm.service.ICommandCentreService; 11 import com.skua.modules.algorithm.service.ICommandCentreService;
10 import com.skua.modules.algorithm.service.impl.ReportItemvService; 12 import com.skua.modules.algorithm.service.impl.ReportItemvService;
...@@ -22,6 +24,7 @@ import io.swagger.annotations.Api; ...@@ -22,6 +24,7 @@ import io.swagger.annotations.Api;
22 import io.swagger.annotations.ApiOperation; 24 import io.swagger.annotations.ApiOperation;
23 import lombok.extern.slf4j.Slf4j; 25 import lombok.extern.slf4j.Slf4j;
24 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.jdbc.core.JdbcTemplate;
25 import org.springframework.web.bind.annotation.GetMapping; 28 import org.springframework.web.bind.annotation.GetMapping;
26 import org.springframework.web.bind.annotation.RequestMapping; 29 import org.springframework.web.bind.annotation.RequestMapping;
27 import org.springframework.web.bind.annotation.RequestParam; 30 import org.springframework.web.bind.annotation.RequestParam;
...@@ -44,8 +47,6 @@ public class SysCommandCentreController { ...@@ -44,8 +47,6 @@ public class SysCommandCentreController {
44 @Autowired 47 @Autowired
45 private ICommandCentreService commandCentreService; 48 private ICommandCentreService commandCentreService;
46 @Autowired 49 @Autowired
47 private ISysConfigService sysConfigService;
48 @Autowired
49 private ReportItemvService reportItemvService; 50 private ReportItemvService reportItemvService;
50 51
51 /** 52 /**
...@@ -177,53 +178,47 @@ public class SysCommandCentreController { ...@@ -177,53 +178,47 @@ public class SysCommandCentreController {
177 @ApiOperation(value="指挥中心-水量电耗趋势", notes="指挥中心-水量电耗趋势") 178 @ApiOperation(value="指挥中心-水量电耗趋势", notes="指挥中心-水量电耗趋势")
178 @GetMapping(value = "/statisticsBySewage") 179 @GetMapping(value = "/statisticsBySewage")
179 public Result<StackedAreaChartDataVO> statisticsBySewage(ReportItemvParam reportItemvParam) throws Exception { 180 public Result<StackedAreaChartDataVO> statisticsBySewage(ReportItemvParam reportItemvParam) throws Exception {
180 //报表数据项值
181 String reitId = sysConfigService.queryValueByKey("REIT_ID_DLHJ");
182 //reportItemvParam.setReportId(reportId);
183 reportItemvParam.setReitId( reitId );
184 //电
185 List<ReportDateTrendVO> electricityMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
186 //reportItemCode = "CSL";//查询字段
187 reitId = sysConfigService.queryValueByKey("REIT_ID_CSL");
188 //水集合
189 reportItemvParam.setReitId( reitId );
190 List<ReportDateTrendVO> waterMapList = commandCentreService.getReportItemvByReitIdAndDate7Day(reportItemvParam );
191
192 List<String > dateList = new ArrayList<>();//日期数据 181 List<String > dateList = new ArrayList<>();//日期数据
193 List<String> electricityList = new ArrayList<>();//电能数据数据; 182 List<String> electricityList = new ArrayList<>();//电能数据数据;
194 List<String> waterList = new ArrayList<>();// 水集合 183 List<String> waterList = new ArrayList<>();// 水集合
195 List<String> consumeList = new ArrayList<>();//电小号集合 184 List<String> consumeList = new ArrayList<>();//电耗集合
185
186 String departIds = BaseContextHandler.getDeparts();
187 List<ReportDateTrendVO> dlhjDateList = reportItemvService.getDayDateFieldList(ReportConstant.view3a24, "DLHJ", departIds, reportItemvParam.getStartDate(), reportItemvParam.getEndDate());
188 List<ReportDateTrendVO> cslDateList = reportItemvService.getDayDateFieldList(ReportConstant.view2119, "CSL", departIds, reportItemvParam.getStartDate(), reportItemvParam.getEndDate());
196 189
197 List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null); 190 List<String > dateTimeList = DateUtil.getInstance().getBetweenDate(reportItemvParam.getStartDate(),reportItemvParam.getEndDate(),null);
198 Map<String,String > electricityMap = new HashMap<String,String >();//电能数据数据; 191 String dlhj = null; String csl = null; String dh = null;
199 Map<String,String > waterMap = new HashMap<String,String >();//水 192 if(dateTimeList != null){
200 if(electricityMapList != null){ 193
201 for( ReportDateTrendVO reportDateTrendVO : electricityMapList){ 194 for(String dateTime : dateTimeList){
202 electricityMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() ); 195 csl = null;
196 dlhj = null;
197 dateList.add( DateUtil.getInstance().formatDate(dateTime,"MM-dd") ) ;
198 //水
199 if( cslDateList != null ){
200 for(ReportDateTrendVO cslVo : cslDateList){
201 if(dateTime.equals(cslVo.getTime())){
202 csl = cslVo.getValue();
203 break;
203 } 204 }
204 } 205 }
205 if(waterMapList != null){
206 for( ReportDateTrendVO reportDateTrendVO : waterMapList){
207 waterMap.put(reportDateTrendVO.getTime(),reportDateTrendVO.getValue() );
208 } 206 }
207 waterList.add(JSUtils.divide(csl,10000));
208 //电
209 if( dlhjDateList != null ){
210 for(ReportDateTrendVO dlhjVo : dlhjDateList){
211 if(dateTime.equals(dlhjVo.getTime())){
212 dlhj = dlhjVo.getValue();
213 break;
209 } 214 }
210
211 String electricity = null; String water = null; String consume = null;
212 for(String dateTime : dateTimeList){
213 electricity = electricityMap.get(dateTime ) ;
214 water = waterMap.get(dateTime ) ;
215
216 consume = "0";
217 if(electricity == null ) electricity = "0";
218 if(water == null ){
219 water = "0";
220 }else{
221 consume = DigitalUtils.division( electricity ,water );
222 } 215 }
223 electricityList.add( electricity ) ; waterList.add(water) ; consumeList.add( consume);
224 dateList.add( DateUtil.getInstance().formatDate(dateTime,"MM-dd") ) ;
225 } 216 }
226 217 electricityList.add(JSUtils.divide(dlhj,10000));
218 //电耗
219 consumeList.add(JSUtils.divide(JSUtils.divide(dlhj,csl),10000) );
220 }
221 }
227 StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO(); 222 StackedAreaChartDataVO stackedAreaChartDataVO = new StackedAreaChartDataVO();
228 stackedAreaChartDataVO.setElectricityList(electricityList);//电集合 223 stackedAreaChartDataVO.setElectricityList(electricityList);//电集合
229 stackedAreaChartDataVO.setWaterList(waterList);//水集合 224 stackedAreaChartDataVO.setWaterList(waterList);//水集合
...@@ -244,32 +239,6 @@ public class SysCommandCentreController { ...@@ -244,32 +239,6 @@ public class SysCommandCentreController {
244 return result; 239 return result;
245 } 240 }
246 241
247 /***
248 * 整理数据: 月统计数据、日统计数据,添加去年月数据、日数据、年数据
249 * @param currenteportItemv
250 * @param lastMonthReportItemv
251 * @param lastYearReportItemv
252 * @return
253 */
254 private List<FRportlCommandCenterVO> arrangeFRportlCommandCenterVO(FReportItemv currenteportItemv, FReportItemv lastMonthReportItemv ,FReportItemv lastYearReportItemv ){
255 List<FRportlCommandCenterVO> commandCenterVOList = new ArrayList<FRportlCommandCenterVO>();
256 FRportlCommandCenterVO monthData = new FRportlCommandCenterVO();//当月数据
257 FRportlCommandCenterVO dayData = new FRportlCommandCenterVO();//日数据
258 //FRportlCommandCenterVO yearData = new FRportlCommandCenterVO();//年数据
259
260 monthData.setValue( DigitalUtils.division(currenteportItemv.getSumValue() ,"10000") );
261 monthData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getSumValue(),"10000"));//上月同期;
262 monthData.setValueTb( DigitalUtils.division( lastYearReportItemv.getSumValue(),"10000") );//去年同期
263
264 dayData.setValue( DigitalUtils.division( currenteportItemv.getAvgValue(),"10000"));
265 dayData.setValueHb( DigitalUtils.division( lastMonthReportItemv.getAvgValue(),"10000"));//上月同期;
266 dayData.setValueTb( DigitalUtils.division( lastYearReportItemv.getAvgValue(),"10000") );//去年同期
267 //dayData.setValue(currenteportItemv.getAvgValue());lastMonthReportItemv.getAvgValue(); lastYearReportItemv.getAvgValue();
268 // yearData.setValue();yearData.setValueHb(); yearData.setValueTb();
269 commandCenterVOList.add( monthData ) ;
270 commandCenterVOList.add( dayData );
271 return commandCenterVOList;
272 }
273 242
274 @AutoLog(value = "指挥中心-费用趋势") 243 @AutoLog(value = "指挥中心-费用趋势")
275 @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势") 244 @ApiOperation(value="指挥中心-费用趋势", notes="指挥中心-费用趋势")
......
1 package com.skua.modules.algorithm.service; 1 package com.skua.modules.algorithm.service;
2 2
3 import com.skua.modules.algorithm.vo.WaterTreatmentVO; 3 import com.skua.modules.algorithm.vo.WaterTreatmentVO;
4 import com.skua.modules.report.entity.FReportItemv;
5 import com.skua.modules.report.vo.*; 4 import com.skua.modules.report.vo.*;
6
7 import java.util.List; 5 import java.util.List;
8 import java.util.Map;
9
10 /** 6 /**
11 * <pre> 7 * <pre>
12 * 指挥中心实现逻辑 8 * 指挥中心实现逻辑
...@@ -16,53 +12,6 @@ import java.util.Map; ...@@ -16,53 +12,6 @@ import java.util.Map;
16 */ 12 */
17 public interface ICommandCentreService { 13 public interface ICommandCentreService {
18 14
19
20 /**
21 * 指挥中心---运行负荷率分析
22 * @param reportItemvParam
23 * @return
24 */
25 public List<DepartLoadRateVO> statisticsByLoadRate(ReportItemvParam reportItemvParam);
26
27 /**
28 * 指挥中心---运行负荷率分析 总数查询
29 * @param loadRateType
30 * @return
31 */
32 public int statisticsByLoadRateNum(int loadRateType,String reitId,String startDate, String endDate);
33
34
35 /**
36 * 根据reitId与时间查询
37 * @param reportId
38 * @param startDate
39 * @param endDate
40 * @return
41 */
42 public FReportItemv getReportItemvByReitIdAndDate(String reportId, String reportItemCode, String startDate, String endDate);
43
44 /**
45 * 根据reitId查询近几天数据
46 * @param reportItemvParam
47 * @return
48 */
49 public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam);
50
51
52 /***
53 * 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
54 * @param reportItemvParam
55 * @return
56 */
57 public FRportlCommandCenterVO getReportItemvMonthDataByReitId(ReportItemvParam reportItemvParam);
58
59 /***
60 * 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
61 * @param reportItemvParam
62 * @return
63 */
64 public FRportlCommandCenterVO getReportItemvDayDataByReitId( ReportItemvParam reportItemvParam);
65
66 /** 15 /**
67 * 查询费用 16 * 查询费用
68 * @param reportItemvParam 17 * @param reportItemvParam
...@@ -71,19 +20,11 @@ public interface ICommandCentreService { ...@@ -71,19 +20,11 @@ public interface ICommandCentreService {
71 public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam); 20 public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam);
72 21
73 /** 22 /**
74 * 查询月度水量
75 * @param reportItemvParam
76 * @return
77 */
78 List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam);
79
80 /**
81 * 获取药剂 23 * 获取药剂
82 * @param month 24 * @param month
83 * @return 25 * @return
84 */ 26 */
85 DepartDrugResult getYhTotal(String month); 27 DepartDrugResult getYhTotal(String month);
86
87 /*** 28 /***
88 * 指挥中心----运行负荷率分析----处理水量详情 29 * 指挥中心----运行负荷率分析----处理水量详情
89 * @param 30 * @param
......
...@@ -8,9 +8,6 @@ import com.skua.modules.algorithm.service.ICommandCentreService; ...@@ -8,9 +8,6 @@ import com.skua.modules.algorithm.service.ICommandCentreService;
8 import com.skua.modules.algorithm.vo.WaterTreatmentVO; 8 import com.skua.modules.algorithm.vo.WaterTreatmentVO;
9 import com.skua.modules.common.vo.DateVO; 9 import com.skua.modules.common.vo.DateVO;
10 import com.skua.modules.quartz.util.BaseUtil; 10 import com.skua.modules.quartz.util.BaseUtil;
11 import com.skua.modules.report.entity.FReportItem;
12 import com.skua.modules.report.entity.FReportItemv;
13 import com.skua.modules.report.mapper.FReportItemMapper;
14 import com.skua.modules.report.vo.*; 11 import com.skua.modules.report.vo.*;
15 import com.skua.modules.report.mapper.FReportItemvMapper; 12 import com.skua.modules.report.mapper.FReportItemvMapper;
16 import com.skua.tool.util.DateUtils; 13 import com.skua.tool.util.DateUtils;
...@@ -37,83 +34,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -37,83 +34,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
37 @Resource 34 @Resource
38 private FReportItemvMapper fReportItemvMapper; 35 private FReportItemvMapper fReportItemvMapper;
39 36
40 @Resource
41 private FReportItemMapper reportItemMapper;
42
43 /**
44 * 指挥中心---运行负荷率分析
45 * @param reportItemvParam
46 * @return
47 */
48 public List<DepartLoadRateVO> statisticsByLoadRate(ReportItemvParam reportItemvParam){
49 return fReportItemvMapper.statisticsByLoadRate(reportItemvParam.getLoadRateType(),reportItemvParam.getReitId(),reportItemvParam.getStartDate(),reportItemvParam.getEndDate());
50 }
51
52 /**
53 * 指挥中心---运行负荷率分析 总数查询
54 * @param loadRateType
55 * @return
56 */
57 public int statisticsByLoadRateNum(int loadRateType, String reitId, String startDate, String endDate){
58 return fReportItemvMapper.statisticsByLoadRateNum(loadRateType ,reitId ,startDate, endDate );
59 }
60
61 /**
62 * 根据reitId与时间查询
63 * @param reportId
64 * @param startDate
65 * @param endDate
66 * @return
67 */
68 public FReportItemv getReportItemvByReitIdAndDate(String reportId, String reportItemCode, String startDate, String endDate){
69
70 //根据reportId 与reportItemCode 查询reitId;
71 //String reitId = reportItemMapper.getReportItemId(reportId,reportItemCode);
72 FReportItemv reportItemv = null;
73 List<FReportItem> reportItemList = reportItemMapper.getItemInfoByItemCode(reportItemCode,reportId);
74 if(reportItemList != null && !reportItemList.isEmpty() ){
75 reportItemv = fReportItemvMapper.getReportItemvByReitIdAndDate(reportItemList.get(0).getId() , startDate , endDate);
76 }
77 return reportItemv;
78 }
79
80 /**
81 * 根据reitId查询近7天数据
82 * @param reportItemvParam
83 * @return
84 */
85 public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam){
86 List<ReportDateTrendVO> dataList = null;
87 dataList = fReportItemvMapper.getReportItemvByReitIdAndDate7Day(reportItemvParam);
88 return dataList;
89 }
90
91
92 /***
93 * 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
94 * @param reportItemvParam
95 * @return
96 */
97 public FRportlCommandCenterVO getReportItemvMonthDataByReitId(ReportItemvParam reportItemvParam){
98 FRportlCommandCenterVO fRportlCommandCenterVO = null;
99 fRportlCommandCenterVO = fReportItemvMapper.getReportItemvMonthDataByReitId(reportItemvParam);
100
101 return fRportlCommandCenterVO;
102
103 }
104
105 /***
106 * 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
107 * @param reportItemvParam
108 * @return
109 */
110 public FRportlCommandCenterVO getReportItemvDayDataByReitId( ReportItemvParam reportItemvParam){
111 FRportlCommandCenterVO fRportlCommandCenterVO = null;
112 //根据reportId 与reportItemCode 查询reitId;
113 fRportlCommandCenterVO = fReportItemvMapper.getReportItemvDayDataByReitId(reportItemvParam);
114 return fRportlCommandCenterVO;
115 }
116
117 @Override 37 @Override
118 public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam) { 38 public List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam) {
119 List<ReportDateTrendVO> dataList = null; 39 List<ReportDateTrendVO> dataList = null;
...@@ -122,13 +42,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -122,13 +42,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
122 } 42 }
123 43
124 @Override 44 @Override
125 public List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam) {
126 List<ReportDateTrendVO> dataList = null;
127 dataList = fReportItemvMapper.getClslData(reportItemvParam);
128 return dataList;
129 }
130
131 @Override
132 public DepartDrugResult getYhTotal(String month) { 45 public DepartDrugResult getYhTotal(String month) {
133 String monthTb = DateUtils.getTbMonth(month);//同比时间 46 String monthTb = DateUtils.getTbMonth(month);//同比时间
134 String monthHb = DateUtils.getHbMonth(month);//环比时间 47 String monthHb = DateUtils.getHbMonth(month);//环比时间
...@@ -156,19 +69,14 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -156,19 +69,14 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
156 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); 69 JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
157 return masterDB; 70 return masterDB;
158 } 71 }
159
160
161
162 /*** 72 /***
163 * 指挥中心----运行负荷率分析----处理水量详情 73 * 指挥中心----运行负荷率分析----处理水量详情
164 * @param time 74 * @param
165 * @return 75 * @return
166 */ 76 */
167 public List<WaterTreatmentVO> statisticsCLSLXQ(String startDate,String endDate, String departIds){ 77 public List<WaterTreatmentVO> statisticsCLSLXQ(String startDate,String endDate, String departIds){
168 List<WaterTreatmentVO> dateList = null; 78 List<WaterTreatmentVO> dateList = null;
169 DateVO dateVO = new DateVO(startDate);//转换后的时间参数 79 DateVO dateVO = new DateVO(startDate);//转换后的时间参数
170
171
172 long differenceDay = DateUtils.differenceDay(startDate, endDate); 80 long differenceDay = DateUtils.differenceDay(startDate, endDate);
173 String departIdssss = BaseUtil.quoteEach(departIds , ","); 81 String departIdssss = BaseUtil.quoteEach(departIds , ",");
174 //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+")"; 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+")";
...@@ -229,10 +137,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService { ...@@ -229,10 +137,6 @@ public class CommandCentreServiceImpl implements ICommandCentreService {
229 } 137 }
230 return cslMap; 138 return cslMap;
231 } 139 }
232
233
234
235
236 /** 140 /**
237 * 同比 141 * 同比
238 * @param month 142 * @param month
......
...@@ -29,7 +29,7 @@ import java.util.Map; ...@@ -29,7 +29,7 @@ import java.util.Map;
29 * @auther kangwei 29 * @auther kangwei
30 * @create 2024-11-01-10:09 30 * @create 2024-11-01-10:09
31 */ 31 */
32 @Service("reportItemvService") 32 @Service
33 public class ReportItemvService { 33 public class ReportItemvService {
34 34
35 private JdbcTemplate getJdbcTemplate(){ 35 private JdbcTemplate getJdbcTemplate(){
...@@ -262,6 +262,13 @@ public class ReportItemvService { ...@@ -262,6 +262,13 @@ public class ReportItemvService {
262 String sql = "select DATE_FORMAT( aaa.time, '%Y-%m' ) time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from " + dataViewName2119+ "aaa group by DATE_FORMAT( aaa.time, '%Y-%m' ) "; 262 String sql = "select DATE_FORMAT( aaa.time, '%Y-%m' ) time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from " + dataViewName2119+ "aaa group by DATE_FORMAT( aaa.time, '%Y-%m' ) ";
263 return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class)); 263 return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class));
264 } 264 }
265
266 public List<ReportDateTrendVO> getDayDateFieldList(String reportId, String field, String departId , String startTime , String endTime){
267 String dataViewName2119 = ReportViewUtil.buildView(reportId,field, departId, startTime,endTime);
268
269 String sql = "select aaa.time , ROUND(SUM(IFNULL(aaa."+field+",0)),2) AS 'value' from " + dataViewName2119+ "aaa group by aaa.time order by aaa.time";
270 return getJdbcTemplate().query(sql,new BeanPropertyRowMapper<ReportDateTrendVO>(ReportDateTrendVO.class));
271 }
265 public String getSumCSL(String departId ,String startTime ,String endTime){ 272 public String getSumCSL(String departId ,String startTime ,String endTime){
266 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime); 273 String dataViewName2119 = ReportViewUtil.buildViewLike(ReportConstant.view2119,"CSL", departId, startTime,endTime);
267 String sql = "select ROUND( sum( IFNULL( aaa.CSL,0) ),2) from " + dataViewName2119+ "aaa"; 274 String sql = "select ROUND( sum( IFNULL( aaa.CSL,0) ),2) from " + dataViewName2119+ "aaa";
......
...@@ -2,20 +2,13 @@ package com.skua.modules.erp.controller; ...@@ -2,20 +2,13 @@ package com.skua.modules.erp.controller;
2 2
3 import java.util.Arrays; 3 import java.util.Arrays;
4 import java.util.List; 4 import java.util.List;
5 import java.util.Map; 5
6 import java.io.IOException;
7 import java.io.UnsupportedEncodingException;
8 import java.net.URLDecoder;
9 import javax.servlet.http.HttpServletRequest; 6 import javax.servlet.http.HttpServletRequest;
10 import javax.servlet.http.HttpServletResponse;
11 import com.skua.core.api.vo.Result; 7 import com.skua.core.api.vo.Result;
12 import com.skua.core.aspect.annotation.AutoLog; 8 import com.skua.core.aspect.annotation.AutoLog;
13 import com.skua.core.context.BaseContextHandler; 9 import com.skua.core.context.BaseContextHandler;
14 import com.skua.core.query.QueryGenerator; 10 import com.skua.core.query.QueryGenerator;
15 import com.skua.core.service.ISequenceService;
16 import com.skua.core.util.ConvertUtils;
17 import com.skua.modules.erp.entity.DistributContract; 11 import com.skua.modules.erp.entity.DistributContract;
18 import com.skua.modules.erp.entity.DistributMaterial;
19 import com.skua.modules.erp.entity.ERPPurchaseContract; 12 import com.skua.modules.erp.entity.ERPPurchaseContract;
20 import com.skua.modules.erp.entity.PurchaseMaterial; 13 import com.skua.modules.erp.entity.PurchaseMaterial;
21 import com.skua.modules.erp.service.IDistributContractService; 14 import com.skua.modules.erp.service.IDistributContractService;
...@@ -26,23 +19,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -26,23 +19,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
26 import com.skua.modules.erp.service.IDistributMaterialService; 19 import com.skua.modules.erp.service.IDistributMaterialService;
27 import com.skua.modules.erp.service.IPurchaseMaterialService; 20 import com.skua.modules.erp.service.IPurchaseMaterialService;
28 import com.skua.modules.erp.vo.DistributContractVO; 21 import com.skua.modules.erp.vo.DistributContractVO;
29 import com.skua.modules.erp.vo.PurchaseContractVO; 22 import com.skua.modules.erp.vo.MaterialSearchVO;
30 import com.skua.modules.guest.util.DateUtil; 23 import com.skua.modules.guest.util.DateUtil;
31 import lombok.extern.slf4j.Slf4j; 24 import lombok.extern.slf4j.Slf4j;
32
33 import org.apache.commons.lang3.StringUtils; 25 import org.apache.commons.lang3.StringUtils;
34 import org.jeecgframework.poi.excel.ExcelImportUtil;
35 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
36 import org.jeecgframework.poi.excel.entity.ExportParams;
37 import org.jeecgframework.poi.excel.entity.ImportParams;
38 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
39
40 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
41 import org.springframework.web.bind.annotation.*; 27 import org.springframework.web.bind.annotation.*;
42 import org.springframework.web.multipart.MultipartFile;
43 import org.springframework.web.multipart.MultipartHttpServletRequest;
44 import org.springframework.web.servlet.ModelAndView;
45 import com.alibaba.fastjson.JSON;
46 import io.swagger.annotations.Api; 28 import io.swagger.annotations.Api;
47 import io.swagger.annotations.ApiOperation; 29 import io.swagger.annotations.ApiOperation;
48 30
...@@ -242,13 +224,13 @@ public class DistributContractController { ...@@ -242,13 +224,13 @@ public class DistributContractController {
242 @ApiOperation(value="erp分销合同-采购物料列表", notes="erp分销合同-采购物料列表") 224 @ApiOperation(value="erp分销合同-采购物料列表", notes="erp分销合同-采购物料列表")
243 @GetMapping(value = "/purchaseMaterialList") 225 @GetMapping(value = "/purchaseMaterialList")
244 public Result<IPage<PurchaseMaterial>> queryPageByPurchaseMaterialList( 226 public Result<IPage<PurchaseMaterial>> queryPageByPurchaseMaterialList(
245 @RequestParam(name="goodCode") String goodCode, 227 MaterialSearchVO materialSearchVO,
246 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, 228 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
247 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, 229 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
248 HttpServletRequest req) { 230 HttpServletRequest req) {
249 Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>(); 231 Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
250 Page<PurchaseMaterial> page = new Page<>(pageNo, pageSize); 232 Page<PurchaseMaterial> page = new Page<>(pageNo, pageSize);
251 IPage<PurchaseMaterial> pageList = purchaseMaterialService.queryByPage(page,goodCode,BaseContextHandler.getRealDepartId()); 233 IPage<PurchaseMaterial> pageList = purchaseMaterialService.queryByPage(page,materialSearchVO.getGoodCode(),BaseContextHandler.getRealDepartId());
252 result.setSuccess(true); 234 result.setSuccess(true);
253 result.setResult(pageList); 235 result.setResult(pageList);
254 return result; 236 return result;
...@@ -258,9 +240,9 @@ public class DistributContractController { ...@@ -258,9 +240,9 @@ public class DistributContractController {
258 @AutoLog(value = "erp分销合同-根据货号查询采购合同物料清单") 240 @AutoLog(value = "erp分销合同-根据货号查询采购合同物料清单")
259 @ApiOperation(value="erp分销合同-根据货号查询采购合同物料清单", notes="erp分销合同-根据货号查询采购合同物料清单") 241 @ApiOperation(value="erp分销合同-根据货号查询采购合同物料清单", notes="erp分销合同-根据货号查询采购合同物料清单")
260 @GetMapping(value = "/queryMaterialByGoodCode") 242 @GetMapping(value = "/queryMaterialByGoodCode")
261 public Result<PurchaseMaterial> queryMaterialByGoodCode(@RequestParam(name="goodCode") String goodCode,@RequestParam(name="departId") String departId) { 243 public Result<PurchaseMaterial> queryMaterialByGoodCode(MaterialSearchVO materialSearchVO) {
262 Result<PurchaseMaterial> result = new Result<PurchaseMaterial>(); 244 Result<PurchaseMaterial> result = new Result<PurchaseMaterial>();
263 List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(goodCode,departId); 245 List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.queryMaterialByGoodCode(materialSearchVO.getGoodCode(),materialSearchVO.getDepartId());
264 246
265 if(purchaseMaterialList != null && !purchaseMaterialList.isEmpty()){ 247 if(purchaseMaterialList != null && !purchaseMaterialList.isEmpty()){
266 result.setSuccess(true); 248 result.setSuccess(true);
......
...@@ -292,18 +292,23 @@ public class MaterialINController { ...@@ -292,18 +292,23 @@ public class MaterialINController {
292 public Result<MaterialIN> queryById(@RequestParam(name="id",required=true) String id) { 292 public Result<MaterialIN> queryById(@RequestParam(name="id",required=true) String id) {
293 Result<MaterialIN> result = new Result<MaterialIN>(); 293 Result<MaterialIN> result = new Result<MaterialIN>();
294 294
295 MaterialIN materialIN = materialINService.getById(id);
296 295
296 MaterialIN materialIN = materialINService.getById(id);
297 /**/
298 if(materialIN==null) {
299 result.error500("未找到对应实体");
300 }else {
301 SupplierManage supplier = supplierManageService.getById(materialIN.getSupplierId());
302 if(supplier != null ){
303 materialIN.setSupplierName( supplier.getSuppName() );
304 }
297 EquipmentSparepartType sparepartType = sparepartTypeService.getById(materialIN.getSparepartType()); 305 EquipmentSparepartType sparepartType = sparepartTypeService.getById(materialIN.getSparepartType());
298 if(sparepartType != null ){ 306 if(sparepartType != null ){
299 materialIN.setSparepartTypeName( sparepartType.getItemText() ); 307 materialIN.setSparepartTypeName( sparepartType.getItemText() );
300 } 308 }
301 if(materialIN==null) {
302 result.error500("未找到对应实体");
303 }else {
304 result.setResult(materialIN); 309 result.setResult(materialIN);
305 result.setSuccess(true); 310 result.setSuccess(true);
306 } 311 }*/
307 return result; 312 return result;
308 } 313 }
309 314
......
...@@ -191,17 +191,6 @@ public class MaterialIN { ...@@ -191,17 +191,6 @@ public class MaterialIN {
191 @ApiModelProperty(value = "删除标识,0:正常,1:删除") 191 @ApiModelProperty(value = "删除标识,0:正常,1:删除")
192 private Integer delFlag; 192 private Integer delFlag;
193 193
194 @TableField(exist = false)
195 @ApiModelProperty(value = "结束时间")
196 private String endTime;
197 @TableField(exist = false)
198 @ApiModelProperty(value = "开始时间")
199 private String startTime;
200
201 @TableField(exist = false)
202 @ApiModelProperty(value = "物料类别")
203 private String sparepartTypeName;
204
205 @ApiModelProperty(value = "入库编号") 194 @ApiModelProperty(value = "入库编号")
206 private String equipmentInId; 195 private String equipmentInId;
207 196
...@@ -214,4 +203,19 @@ public class MaterialIN { ...@@ -214,4 +203,19 @@ public class MaterialIN {
214 @ApiModelProperty(value = "水厂结算,0:未结算,1:已申请,2:已结算") 203 @ApiModelProperty(value = "水厂结算,0:未结算,1:已申请,2:已结算")
215 private Integer waterDepartSettlementFlag; 204 private Integer waterDepartSettlementFlag;
216 205
206 @TableField(exist = false)
207 @ApiModelProperty(value = "结束时间")
208 private String endTime;
209 @TableField(exist = false)
210 @ApiModelProperty(value = "开始时间")
211 private String startTime;
212
213 @TableField(exist = false)
214 @ApiModelProperty(value = "物料类别")
215 private String sparepartTypeName;
216
217 @TableField(exist = false)
218 @ApiModelProperty(value = "供应商名称")
219 private String supplierName;
220
217 } 221 }
......
...@@ -29,4 +29,5 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> { ...@@ -29,4 +29,5 @@ public interface MaterialINMapper extends BaseMapper<MaterialIN> {
29 */ 29 */
30 List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN); 30 List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
31 31
32 public MaterialIN queryById(String id);
32 } 33 }
......
...@@ -55,17 +55,16 @@ ...@@ -55,17 +55,16 @@
55 </select> 55 </select>
56 <!-- 药剂入库查询结果:物料清单--> 56 <!-- 药剂入库查询结果:物料清单-->
57 <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO"> 57 <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO">
58 select pc.id 'purchase_contract_id', pc.contract_code 'purchase_contract_code' , st.item_text as 'sparepart_type_name', 58 select dc.contract_code 'distribut_contract_code', st.item_text as 'sparepart_type_name', aaa.* from
59 (select sum(mi.material_num) from erp_material_in mi where mi.audit_status = 3 and mi.good_code = aaa.good_code) 'storeNum',aaa.* 59 (select pc.start_time ,pc.end_time , dm.distribut_price ,dm.distribut_total_price,dm.material_num ,pc.id 'purchase_contract_id', pc.contract_code 'purchase_contract_code' ,dm.contract_id 'distribut_contract_id', pm.*
60 from ( 60 from erp_distribut_material dm , erp_purchase_material pm ,erp_purchase_contract pc
61 select dc.contract_code 'distribut_contract_code', dc.id 'distribut_contract_id', dm.distribut_price ,dm.distribut_total_price,dm.material_num ,pm.* 61 where dm.good_code = pm.good_code and pm.contract_id = pc.id and pc.use_flag = '0' and dm.del_flag = '0' and pm.del_flag = '0' and pc.start_time &lt;= now() and pc.end_time &gt;= now()
62 from erp_distribut_contract dc , erp_distribut_material dm , erp_purchase_material pm 62 and dm.contract_id = #{param.distributContractId }
63 where dc.id = dm.contract_id and dc.id = #{param.distributContractId } and dm.good_code = pm.good_code and pm.del_flag = '0' and dc.use_flag = '0' and dm.del_flag = '0'
64 <if test="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if> 63 <if test="param.sparepartCode != null and param.sparepartCode !=''">and pm.sparepart_code =#{param.sparepartCode}</if>
65 <if test="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if> 64 <if test="param.sparepartType != null and param.sparepartType !=''">and pm.sparepart_type in (${param.sparepartType}) </if>
66 <if test="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if> 65 <if test="param.sparepartName != null and param.sparepartName !=''">and pm.sparepart_name like '%${param.sparepartName}%'</if>
67 )aaa 66 ) aaa
68 left join erp_purchase_contract pc on pc.id = aaa.contract_id 67 left join erp_distribut_contract dc on dc.id = aaa.distribut_contract_id
69 left join equipment_sparepart_type st on st.id = aaa.sparepart_type 68 left join equipment_sparepart_type st on st.id = aaa.sparepart_type
70 </select> 69 </select>
71 <!-- 根据id或code校验合同编号是否唯一--> 70 <!-- 根据id或code校验合同编号是否唯一-->
......
...@@ -44,4 +44,6 @@ public interface IMaterialINService extends IService<MaterialIN> { ...@@ -44,4 +44,6 @@ public interface IMaterialINService extends IService<MaterialIN> {
44 * @param materialIN 44 * @param materialIN
45 */ 45 */
46 String updateMaterialIN(MaterialIN materialIN); 46 String updateMaterialIN(MaterialIN materialIN);
47
48
47 } 49 }
......
...@@ -12,7 +12,10 @@ import lombok.experimental.Accessors; ...@@ -12,7 +12,10 @@ import lombok.experimental.Accessors;
12 @Accessors(chain = true) 12 @Accessors(chain = true)
13 @ApiModel(value="Material物料查询对象", description="Material物料查询对象") 13 @ApiModel(value="Material物料查询对象", description="Material物料查询对象")
14 public class MaterialSearchVO { 14 public class MaterialSearchVO {
15 15 @ApiModelProperty(value = "厂站编号")
16 private String departId;
17 @ApiModelProperty(value = "货号")
18 private String goodCode;
16 @ApiModelProperty(value = "采购合同编号") 19 @ApiModelProperty(value = "采购合同编号")
17 private String purchaseContractId; 20 private String purchaseContractId;
18 21
...@@ -31,8 +34,6 @@ public class MaterialSearchVO { ...@@ -31,8 +34,6 @@ public class MaterialSearchVO {
31 @ApiModelProperty(value = "物料类型") 34 @ApiModelProperty(value = "物料类型")
32 private String sparepartType; 35 private String sparepartType;
33 36
34 @ApiModelProperty(value = "所属厂站")
35 private String departId;
36 37
37 @ApiModelProperty(value = "是否药剂") 38 @ApiModelProperty(value = "是否药剂")
38 private boolean medicament = false; 39 private boolean medicament = false;
......
1 package com.skua.modules.erp.vo; 1 package com.skua.modules.erp.vo;
2 2
3 import cn.hutool.core.util.RandomUtil;
4 import com.skua.common.util.ChineseInital;
5 import io.swagger.annotations.ApiModel; 3 import io.swagger.annotations.ApiModel;
6 import io.swagger.annotations.ApiModelProperty; 4 import io.swagger.annotations.ApiModelProperty;
7 import lombok.Data; 5 import lombok.Data;
......
...@@ -4,11 +4,9 @@ import com.skua.modules.report.vo.*; ...@@ -4,11 +4,9 @@ import com.skua.modules.report.vo.*;
4 import org.apache.ibatis.annotations.Param; 4 import org.apache.ibatis.annotations.Param;
5 import com.skua.modules.report.entity.FReportItemv; 5 import com.skua.modules.report.entity.FReportItemv;
6 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
7
8 import java.util.Date; 7 import java.util.Date;
9 import java.util.List; 8 import java.util.List;
10 import java.util.Map; 9 import java.util.Map;
11
12 /** 10 /**
13 * 报表数据项值 11 * 报表数据项值
14 */ 12 */
...@@ -22,7 +20,6 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> { ...@@ -22,7 +20,6 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
22 @Param("dataTime") String dataTime,@Param("departId") String departId,@Param("createTime") Date createTime); 20 @Param("dataTime") String dataTime,@Param("departId") String departId,@Param("createTime") Date createTime);
23 21
24 List<FReportItemv> getBean(@Param("dataId") String dataId, @Param("reitId") String reitId); 22 List<FReportItemv> getBean(@Param("dataId") String dataId, @Param("reitId") String reitId);
25
26 List<Map<String,Object>> getListByTime(@Param("sql") String sql); 23 List<Map<String,Object>> getListByTime(@Param("sql") String sql);
27 /** 24 /**
28 * <pre> 25 * <pre>
...@@ -33,75 +30,18 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> { ...@@ -33,75 +30,18 @@ public interface FReportItemvMapper extends BaseMapper<FReportItemv> {
33 * @author Li Yuanyuan, 2021年5月25日 上午10:34:37 30 * @author Li Yuanyuan, 2021年5月25日 上午10:34:37
34 */ 31 */
35 List<FReportItemv> getReportItemvByDataId(String dataId); 32 List<FReportItemv> getReportItemvByDataId(String dataId);
36
37
38 /** 33 /**
39 * 据reit_id 查询视图表数据 返回总数,平均数 34 * 据reit_id 查询视图表数据 返回总数,平均数
40 * @param reportItemvParam 35 * @param reportItemvParam
41 * @return 36 * @return
42 */ 37 */
43 List<FReportItemv> getReportItemvByReitId(ReportItemvParam reportItemvParam); 38 List<FReportItemv> getReportItemvByReitId(ReportItemvParam reportItemvParam);
44
45 /**
46 * 根据reitId与时间查询
47 * @param reitId
48 * @param startDate
49 * @param endDate
50 * @return
51 */
52 public FReportItemv getReportItemvByReitIdAndDate(@Param("reitId") String reitId, @Param("startDate") String startDate,@Param("endDate") String endDate);
53
54
55 /**
56 * 根据类型查询:指挥中心---运行负荷率分析
57 * @param loadRateType
58 * @return
59 */
60 public List<DepartLoadRateVO> statisticsByLoadRate(@Param("loadRateType") Integer loadRateType, @Param("reitId") String reitId ,@Param("startDate") String startDate,@Param("endDate") String endDate);
61
62 /**
63 * 指挥中心---运行负荷率分析 总数查询
64 * @param loadRateType
65 * @return
66 */
67 public int statisticsByLoadRateNum(@Param("loadRateType") Integer loadRateType, @Param("reitId") String reitId , @Param("startDate") String startDate,@Param("endDate") String endDate);
68
69 /**
70 * 根据reitId查询近7天数据
71 * @param reportItemvParam
72 * @return
73 */
74 public List<ReportDateTrendVO> getReportItemvByReitIdAndDate7Day(ReportItemvParam reportItemvParam);
75
76
77 /***
78 * 查询报表数据,当前月统计、上个月统计、去年当月统计(求和)
79 * @param reportItemvParam
80 * @return
81 */
82 public FRportlCommandCenterVO getReportItemvMonthDataByReitId( ReportItemvParam reportItemvParam);
83
84 /***
85 * 查询报表数据,当日平均、上月同期、去年同期统计(求均值)
86 * @param reportItemvParam
87 * @return
88 */
89 public FRportlCommandCenterVO getReportItemvDayDataByReitId(ReportItemvParam reportItemvParam);
90
91 /** 39 /**
92 * 查询费用 40 * 查询费用
93 * @param reportItemvParam 41 * @param reportItemvParam
94 * @return 42 * @return
95 */ 43 */
96 List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam); 44 List<ReportDateTrendVO> getFyData(ReportItemvParam reportItemvParam);
97
98 /**
99 * 查询水量信息
100 * @param reportItemvParam
101 * @return
102 */
103 List<ReportDateTrendVO> getClslData(ReportItemvParam reportItemvParam);
104
105 /** 45 /**
106 * 药量信息 46 * 药量信息
107 * @param month 47 * @param month
......
...@@ -51,90 +51,6 @@ ...@@ -51,90 +51,6 @@
51 51
52 </select> 52 </select>
53 53
54 <!-- 根据reit_id 查询视图表数据 返回总数,平均数 -->
55 <select id="getReportItemvByReitIdAndDate" resultType="com.skua.modules.report.entity.FReportItemv">
56 SELECT sum(item_value) 'sum_value' , avg(item_value) 'avg_value' FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
57 </select>
58
59
60
61 <!-- 根据类型查询:指挥中心-运行负荷率分析 -->
62 <select id="statisticsByLoadRate" resultType="com.skua.modules.report.vo.DepartLoadRateVO">
63 SELECT ri.depart_id ,d.depart_name as 'departName',
64 fi.pro_scale ,
65 avg(ri.item_value)/(100*fi.pro_scale) as 'loadRate' ,
66 sum( ri.item_value ) as 'waterYieldMonth'
67 FROM f_report_itemv ri
68 left join sys_factory_info fi on ri.depart_id = fi.depart_id
69 left join sys_depart d on d.id = ri.depart_id
70
71 where ri.reit_id=#{reitId} and ri.data_time &gt;= #{startDate} and ri.data_time &lt;= #{endDate}
72
73 group by ri.depart_id
74 <trim prefix="having" prefixOverrides="and">
75 <if test="loadRateType != null and loadRateType == 1">
76 avg(ri.item_value)/(100*fi.pro_scale) &gt;= 60 and avg(ri.item_value)/(100*fi.pro_scale) &lt;= 120
77 </if>
78 <if test="loadRateType != null and loadRateType == 3">
79 avg(ri.item_value)/(100*fi.pro_scale) &lt; 60
80 </if>
81 <if test="loadRateType != null and loadRateType == 2">
82 avg(ri.item_value)/(100*fi.pro_scale) &gt; 120
83 </if>
84 </trim>
85 </select>
86
87
88 <!-- 根据类型查询:指挥中心-运行负荷率分析 -->
89 <select id="statisticsByLoadRateNum" resultType="java.lang.Integer">
90 select count(1) from (
91 SELECT ri.depart_id , fi.pro_scale
92 FROM f_report_itemv ri
93 left join sys_factory_info fi on ri.depart_id = fi.depart_id
94
95 where ri.reit_id=#{reitId} and ri.data_time &gt;= #{startDate} and ri.data_time &lt;= #{endDate}
96
97 group by ri.depart_id
98 <trim prefix="having" prefixOverrides="and">
99 <if test="loadRateType != null and loadRateType == 1">
100 avg(ri.item_value)/(100*fi.pro_scale) &gt;= 60 and avg(ri.item_value)/(100*fi.pro_scale) &lt;= 120
101 </if>
102 <if test="loadRateType != null and loadRateType == 3">
103 avg(ri.item_value)/(100*fi.pro_scale) &lt; 60
104 </if>
105 <if test="loadRateType != null and loadRateType == 2">
106 avg(ri.item_value)/(100*fi.pro_scale) &gt; 120
107 </if>
108 </trim>
109 ) aaa
110 </select>
111
112 <!-- 根据reitId查询近7天数据-->
113 <select id="getReportItemvByReitIdAndDate7Day" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
114 SELECT sum(item_value) as 'value' , data_time as 'date' FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
115 group by data_time
116 </select>
117
118
119 <!--查询报表数据,当前月统计、上个月统计、去年当月统计(求和) -->
120 <select id="getReportItemvMonthDataByReitId" resultType="com.skua.modules.report.vo.FRportlCommandCenterVO">
121 select
122 IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}),0) as 'value',
123 IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastMonthStartDate} and data_time &lt;= #{lastMonthEndDate}),0) as 'valueTb',
124 IFNULL(( SELECT sum(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastYearStartDate} and data_time &lt;= #{lastYearEndDate} ),0) as 'valueHb'
125 from dual
126 </select>
127
128
129 <!--查询报表数据,当日平均、上月同期、去年同期统计(求均值) -->
130 <select id="getReportItemvDayDataByReitId" resultType="com.skua.modules.report.vo.FRportlCommandCenterVO">
131 select
132 IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}),0) as 'value',
133 IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastMonthStartDate} and data_time &lt;= #{lastMonthEndDate}),0) as 'valueTb',
134 IFNULL(( SELECT avg(item_value) FROM f_report_itemv where reit_id=#{reitId} and data_time &gt;= #{lastYearStartDate} and data_time &lt;= #{lastYearEndDate} ),0) as 'valueHb'
135 from dual
136 </select>
137
138 <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> 54 <select id="getFyData" resultType="com.skua.modules.report.vo.ReportDateTrendVO">
139 SELECT 55 SELECT
140 t.month AS time, 56 t.month AS time,
...@@ -147,11 +63,7 @@ ...@@ -147,11 +63,7 @@
147 GROUP BY t.month 63 GROUP BY t.month
148 </select> 64 </select>
149 65
150 <select id="getClslData" resultType="com.skua.modules.report.vo.ReportDateTrendVO"> 66
151 SELECT sum(item_value) as 'value' , left(data_time,7) as 'date' FROM f_report_itemv
152 where reit_id=#{reitId} and data_time &gt;= #{startDate} and data_time &lt;= #{endDate}
153 group by left(data_time,7)
154 </select>
155 67
156 <select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO"> 68 <select id="getYhList" resultType="com.skua.modules.report.vo.DepartDrugDataVO">
157 SELECT 69 SELECT
......
...@@ -60,7 +60,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -60,7 +60,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
60 String departId = null; 60 String departId = null;
61 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量 61 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
62 String dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()); 62 String dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl,yyf", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
63 sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water', sum(tc.target_drug ) 'target_drug' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa"; 63 sql = "select round(sum( aaa.ysfsl ),2) 'ysfsl' , round(sum( aaa.ysjsl ),2) 'ysjsl' , round(sum(tc.target_water ),2) 'target_water', round(sum(tc.target_drug ),2) 'target_drug' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
64 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year = '"+year+"')"; 64 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year = '"+year+"')";
65 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql); 65 List<Map<String, Object>> mapList = getJdbcTemplate().queryForList(sql);
66 productDataVO.setDayNum( DateUtils.differenceDay(seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()) );//相差天数 66 productDataVO.setDayNum( DateUtils.differenceDay(seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()) );//相差天数
...@@ -91,7 +91,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -91,7 +91,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
91 // 去年水数据:月收费水量、月实际水量 91 // 去年水数据:月收费水量、月实际水量
92 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量 92 // ysfsl:月收费水量 ; yyf:月药费 ; ysjsl:月实际水量
93 dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl", departId, lastSeasonTimeVO.getStartTime(),lastSeasonTimeVO.getEndTime()); 93 dataViewName4411 = ReportViewUtil.buildViewLike(ReportConstant.view4411,"ysfsl,ysjsl", departId, lastSeasonTimeVO.getStartTime(),lastSeasonTimeVO.getEndTime());
94 sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' from "+dataViewName4411+" aaa"; 94 sql = "select round(sum( aaa.ysfsl ),2) 'ysfsl' , round(sum( aaa.ysjsl ),2) 'ysjsl' from "+dataViewName4411+" aaa";
95 95
96 if(mapList != null ){ 96 if(mapList != null ){
97 for(Map<String,Object> map : mapList){ 97 for(Map<String,Object> map : mapList){
...@@ -113,7 +113,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -113,7 +113,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
113 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime()); 113 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, seasonTimeVO.getStartTime(),seasonTimeVO.getEndTime());
114 // sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water' , sum(tc.target_power) 'target_power' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa"; 114 // sql = "select sum( aaa.ysfsl ) 'ysfsl' , sum( aaa.ysjsl ) 'ysjsl' , sum(tc.target_water ) 'target_water' , sum(tc.target_power) 'target_power' ,round((sum( aaa.ysfsl ) *100 / sum(tc.target_water )),2) as 'completeRatio' from "+dataViewName4411+" aaa";
115 sql = "select round( (aaa.tqysjsl - aaa.ysjsl ) / aaa.tqysjsl ,2 ) 'ratio' , aaa.tqysjsl , aaa.ysjsl , aaa.ysjsldyqntqyy 'causeAnalysis' , d.depart_name from "+dataViewName4411 +" aaa"; 115 sql = "select round( (aaa.tqysjsl - aaa.ysjsl ) / aaa.tqysjsl ,2 ) 'ratio' , aaa.tqysjsl , aaa.ysjsl , aaa.ysjsldyqntqyy 'causeAnalysis' , d.depart_name from "+dataViewName4411 +" aaa";
116 sql += " left join sys_depart d on d.id = aaa.depart_id where aaa.tqysjsl > aaa.ysjsl"; 116 sql += " left join sys_depart d on d.id = aaa.depart_id where aaa.tqysjsl > aaa.ysjsl ";
117 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class)); 117 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
118 productDataVO.setWaterDeptartList(waterMonthDataList); 118 productDataVO.setWaterDeptartList(waterMonthDataList);
119 119
......
1 package com.skua.modules.report.vo; 1 package com.skua.modules.report.vo;
2 2
3 import com.skua.core.util.ConvertUtils; 3 import com.skua.core.util.ConvertUtils;
4 import com.skua.tool.util.JSUtils;
4 import io.swagger.annotations.ApiModel; 5 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty; 6 import io.swagger.annotations.ApiModelProperty;
6 import lombok.Data; 7 import lombok.Data;
8 import org.apache.commons.lang3.StringUtils;
7 9
8 import java.util.ArrayList; 10 import java.util.ArrayList;
9 import java.util.List; 11 import java.util.List;
...@@ -30,7 +32,7 @@ public class ProductDataVO { ...@@ -30,7 +32,7 @@ public class ProductDataVO {
30 @ApiModelProperty(value = "收费水量") 32 @ApiModelProperty(value = "收费水量")
31 private String chargeWaterVolume;//收费水量9854.012552万吨 33 private String chargeWaterVolume;//收费水量9854.012552万吨
32 @ApiModelProperty(value = "收费水量-日均值") 34 @ApiModelProperty(value = "收费水量-日均值")
33 private Double avgDayWaterVolume;//平均108.29万吨/天 35 private String avgDayWaterVolume;//平均108.29万吨/天
34 @ApiModelProperty(value = "收费水量-同比增长") 36 @ApiModelProperty(value = "收费水量-同比增长")
35 private Double chargeWaterRatio; 37 private Double chargeWaterRatio;
36 @ApiModelProperty(value = "收费水量-完成率") 38 @ApiModelProperty(value = "收费水量-完成率")
...@@ -43,7 +45,7 @@ public class ProductDataVO { ...@@ -43,7 +45,7 @@ public class ProductDataVO {
43 @ApiModelProperty(value = "实际处理水量") 45 @ApiModelProperty(value = "实际处理水量")
44 private String ysjslWaterVolume; 46 private String ysjslWaterVolume;
45 @ApiModelProperty(value = "实际处理水量-日均值") 47 @ApiModelProperty(value = "实际处理水量-日均值")
46 private Double avgYsjslWaterVolume;//平均99.76万吨/天 48 private String avgYsjslWaterVolume;//平均99.76万吨/天
47 @ApiModelProperty(value = "实际处理水量--同比增长") 49 @ApiModelProperty(value = "实际处理水量--同比增长")
48 private Double ysjslWaterRatio; 50 private Double ysjslWaterRatio;
49 51
...@@ -81,13 +83,14 @@ public class ProductDataVO { ...@@ -81,13 +83,14 @@ public class ProductDataVO {
81 private String dangerDeptNames; 83 private String dangerDeptNames;
82 84
83 //收费水量-日均值 85 //收费水量-日均值
84 public Double getAvgDayWaterVolume() { 86 public String getAvgDayWaterVolume() {
85 avgDayWaterVolume = ConvertUtils.getDouble(chargeWaterVolume,0) / dayNum ; 87 avgDayWaterVolume = JSUtils.divide(chargeWaterVolume , dayNum ) ;
86 return avgDayWaterVolume; 88 return avgDayWaterVolume;
87 } 89 }
88 //实际处理水量-日均值 90 //实际处理水量-日均值
89 public Double getAvgYsjslWaterVolume() { 91 public String getAvgYsjslWaterVolume() {
90 avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum; 92 // avgYsjslWaterVolume = ConvertUtils.getDouble(ysjslWaterVolume,0) / dayNum;
93 avgYsjslWaterVolume = JSUtils.divide(ysjslWaterVolume , dayNum ) ;
91 return avgYsjslWaterVolume; 94 return avgYsjslWaterVolume;
92 } 95 }
93 96
...@@ -108,8 +111,11 @@ public class ProductDataVO { ...@@ -108,8 +111,11 @@ public class ProductDataVO {
108 if( deptartList != null && !deptartList.isEmpty() ){ 111 if( deptartList != null && !deptartList.isEmpty() ){
109 for(FReportWaterMonthDataVO dataVO : deptartList){ 112 for(FReportWaterMonthDataVO dataVO : deptartList){
110 if(deptName.length() > 0 ) deptName+="、"; 113 if(deptName.length() > 0 ) deptName+="、";
114 if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
111 deptName += dataVO.getDeptartName(); 115 deptName += dataVO.getDeptartName();
112 } 116 }
117
118 }
113 } 119 }
114 return deptName; 120 return deptName;
115 } 121 }
...@@ -118,9 +124,11 @@ public class ProductDataVO { ...@@ -118,9 +124,11 @@ public class ProductDataVO {
118 if( deptartList != null && !deptartList.isEmpty() ){ 124 if( deptartList != null && !deptartList.isEmpty() ){
119 for(FReportPowerMonthDataVO dataVO : deptartList){ 125 for(FReportPowerMonthDataVO dataVO : deptartList){
120 if(deptName.length() > 0 ) deptName+="、"; 126 if(deptName.length() > 0 ) deptName+="、";
127 if(StringUtils.isNotEmpty(dataVO.getDeptartName())){
121 deptName += dataVO.getDeptartName(); 128 deptName += dataVO.getDeptartName();
122 } 129 }
123 } 130 }
131 }
124 return deptName; 132 return deptName;
125 } 133 }
126 } 134 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!