15f94f5b 康伟

kangwei:修改bug,以及完善代码

1 个父辈 36cfe130
...@@ -54,6 +54,12 @@ public class DangerInspectionRecord { ...@@ -54,6 +54,12 @@ public class DangerInspectionRecord {
54 @ApiModelProperty(value = "风险点类型") 54 @ApiModelProperty(value = "风险点类型")
55 @Dict(dicCode = "dangerType") 55 @Dict(dicCode = "dangerType")
56 private String dangerType; 56 private String dangerType;
57
58
59 @ApiModelProperty(value = "巡检类型")
60 @Dict(dicCode = "inspection_type")
61 private String inspectionType;
62
57 /**上报人(用户id)*/ 63 /**上报人(用户id)*/
58 @Excel(name = "上报人(用户id)", width = 15) 64 @Excel(name = "上报人(用户id)", width = 15)
59 @ApiModelProperty(value = "上报人(用户id)") 65 @ApiModelProperty(value = "上报人(用户id)")
......
...@@ -204,10 +204,10 @@ public class EquipmentStatisticsController { ...@@ -204,10 +204,10 @@ public class EquipmentStatisticsController {
204 if( StringUtils.isNotEmpty(equipmentInfo.getDepartId())){ 204 if( StringUtils.isNotEmpty(equipmentInfo.getDepartId())){
205 departIds = departService.getChildDepartId(equipmentInfo.getDepartId()); 205 departIds = departService.getChildDepartId(equipmentInfo.getDepartId());
206 } 206 }
207 equipmentInfo.setDepartIds(departIds); 207 equipmentInfo.setDepartIds(JSUtils.quoteEach(departIds,","));
208 Page<EquipmentInfoDuration> page = new Page<EquipmentInfoDuration>(pageNo, pageSize); 208 Page<EquipmentInfoDuration> page = new Page<EquipmentInfoDuration>(pageNo, pageSize);
209 // queryWrapper.orderByDesc("create_time"); 209 // queryWrapper.orderByDesc("create_time");
210 IPage<EquipmentInfoDuration> pageList = equipmentInfoDurationService.queryPageList(page,equipmentInfo); 210 IPage<EquipmentInfoDuration> pageList = equipmentInfoDurationService.queryEquipmentInfoDurationByPage(page,equipmentInfo);
211 result.setSuccess(true); 211 result.setSuccess(true);
212 result.setResult(pageList); 212 result.setResult(pageList);
213 return result; 213 return result;
......
...@@ -35,6 +35,11 @@ public class EquipmentInfoDuration { ...@@ -35,6 +35,11 @@ public class EquipmentInfoDuration {
35 @ApiModelProperty(value = "设备编号") 35 @ApiModelProperty(value = "设备编号")
36 @Dict(dicCode = "id",dictTable="equipment_info",dicText="equipment_name") 36 @Dict(dicCode = "id",dictTable="equipment_info",dicText="equipment_name")
37 private String infoId; 37 private String infoId;
38
39 @Dict(dicCode = "id",dicText = "des",dictTable = "equipment_category")
40 @ApiModelProperty(value = "设备类别")
41 private String equipmentType;
42
38 /**日期*/ 43 /**日期*/
39 @Excel(name = "日期", width = 15) 44 @Excel(name = "日期", width = 15)
40 @ApiModelProperty(value = "日期") 45 @ApiModelProperty(value = "日期")
......
...@@ -20,4 +20,6 @@ public interface EquipmentInfoDurationMapper extends BaseMapper<EquipmentInfoDur ...@@ -20,4 +20,6 @@ public interface EquipmentInfoDurationMapper extends BaseMapper<EquipmentInfoDur
20 20
21 @Anonymous 21 @Anonymous
22 IPage<EquipmentInfoDuration> queryPageList(Page page, @Param("param") EquipmentInfoDuration equipmentInfoDuration); 22 IPage<EquipmentInfoDuration> queryPageList(Page page, @Param("param") EquipmentInfoDuration equipmentInfoDuration);
23
24 IPage<EquipmentInfoDuration> queryEquipmentInfoDurationByPage(Page<EquipmentInfoDuration> page,@Param("param") EquipmentInfoDuration equipmentInfo);
23 } 25 }
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
9 <if test="param.departIds !=null and param.departIds !=''"> 9 <if test="param.departIds !=null and param.departIds !=''">
10 and eid.depart_id in(${param.departIds}) 10 and eid.depart_id in(${param.departIds})
11 </if> 11 </if>
12 <if test="param.infoId !=null and param.infoId !=''">
13 and eid.info_id in(${param.departIds})
14 </if>
12 <if test="param.startTime !=null and param.startTime !=''"> 15 <if test="param.startTime !=null and param.startTime !=''">
13 AND eid.data_time &gt;= #{param.startTime} 16 AND eid.data_time &gt;= #{param.startTime}
14 </if> 17 </if>
...@@ -18,4 +21,22 @@ ...@@ -18,4 +21,22 @@
18 21
19 </select> 22 </select>
20 23
24 <select id="queryEquipmentInfoDurationByPage" resultType="com.skua.modules.statistics.entity.EquipmentInfoDuration">
25 select ei.equipment_type,ei.equipment_name, eid.depart_id ,eid.info_id ,sum(eid.yz_duration) 'yz_duration',max(eid.total_duration) 'total_duration',
26 round(100*sum(eid.yz_duration)/max(eid.total_duration),2) 'sbyxRate' from equipment_info_duration eid
27
28 left join equipment_info ei on ei.id = eid.info_id
29 where 1=1
30 <if test="param.departIds !=null and param.departIds !=''">
31 and eid.depart_id in(${param.departIds})
32 </if>
33 <if test="param.startTime !=null and param.startTime !=''">
34 AND eid.data_time &gt;= #{param.startTime}
35 </if>
36 <if test="param.endTime !=null and param.endTime !=''">
37 AND eid.data_time &lt;= #{param.endTime}
38 </if>
39 group by eid.depart_id ,eid.info_id
40 </select>
41
21 </mapper> 42 </mapper>
......
...@@ -27,4 +27,6 @@ public interface IEquipmentInfoDurationService extends IService<EquipmentInfoDur ...@@ -27,4 +27,6 @@ public interface IEquipmentInfoDurationService extends IService<EquipmentInfoDur
27 * @throws Exception 27 * @throws Exception
28 */ 28 */
29 public boolean fillOutEquipmentInfoDuration(String departId,String startTime,String endTime) throws Exception; 29 public boolean fillOutEquipmentInfoDuration(String departId,String startTime,String endTime) throws Exception;
30
31 IPage<EquipmentInfoDuration> queryEquipmentInfoDurationByPage(Page<EquipmentInfoDuration> page, EquipmentInfoDuration equipmentInfo);
30 } 32 }
......
...@@ -32,8 +32,6 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD ...@@ -32,8 +32,6 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD
32 32
33 @Autowired 33 @Autowired
34 private ICommonSqlService commonSqlService; 34 private ICommonSqlService commonSqlService;
35 @Autowired
36 private IPgCommonService pgCommonService;
37 /*** 35 /***
38 * 分页列表 36 * 分页列表
39 * @param page 37 * @param page
...@@ -43,6 +41,9 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD ...@@ -43,6 +41,9 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD
43 public IPage<EquipmentInfoDuration> queryPageList(Page page, EquipmentInfoDuration equipmentInfoDuration){ 41 public IPage<EquipmentInfoDuration> queryPageList(Page page, EquipmentInfoDuration equipmentInfoDuration){
44 return this.baseMapper.queryPageList(page,equipmentInfoDuration); 42 return this.baseMapper.queryPageList(page,equipmentInfoDuration);
45 } 43 }
44 public IPage<EquipmentInfoDuration> queryEquipmentInfoDurationByPage(Page<EquipmentInfoDuration> page, EquipmentInfoDuration equipmentInfo){
45 return this.baseMapper.queryEquipmentInfoDurationByPage(page,equipmentInfo);
46 }
46 47
47 /*** 48 /***
48 * 设备运行时长填报数据 49 * 设备运行时长填报数据
...@@ -86,22 +87,29 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD ...@@ -86,22 +87,29 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD
86 List<Object[]> batchArgs=new ArrayList<Object[]>(); 87 List<Object[]> batchArgs=new ArrayList<Object[]>();
87 if(metricMapList != null && !metricMapList.isEmpty()){ 88 if(metricMapList != null && !metricMapList.isEmpty()){
88 for(Map<String, Object> metricMap : metricMapList){ //遍历设备记录以及metric 标签 89 for(Map<String, Object> metricMap : metricMapList){ //遍历设备记录以及metric 标签
89 pgSql = "select aaaaa.time , aaaaa.yx_duration ,bbbbb.gz_duration from ( "; 90 pgSql = "select aaaaa.time , aaaaa.yx_duration ,bbbbb.gz_duration ,ddddd.zt_duration,ccccc.total_duration from ( ";
90 91
91 pgSql += " select '11111111' info_id , aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as yx_duration from ( "; 92 pgSql += " select '11111111' info_id , aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as yx_duration from ( ";
92 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from TCSWSCLC_count where nm ='"+metricMap.get("yxExpress")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' "; 93 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from "+countTableName+"_count where nm ='"+metricMap.get("yxExpress")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' ";
93 pgSql += " ) aaa group by aaa.time order by aaa.time asc "; 94 pgSql += " ) aaa group by aaa.time order by aaa.time asc ";
94 pgSql += " ) aaaaa "; 95 pgSql += " ) aaaaa ";
95 96
96 pgSql += " left join ( "; 97 pgSql += " left join ( ";
97 pgSql += " select aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as gz_duration from ( "; 98 pgSql += " select aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as gz_duration from ( ";
98 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from TCSWSCLC_count where nm ='"+ ConvertUtils.getString(metricMap.get("gzExpress"),"-")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' "; 99 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from "+countTableName+"_count where nm ='"+ ConvertUtils.getString(metricMap.get("gzExpress"),"-")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' ";
99 pgSql += " ) aaa group by aaa.time order by aaa.time asc "; 100 pgSql += " ) aaa group by aaa.time order by aaa.time asc ";
100 pgSql += " )bbbbb on aaaaa.time = bbbbb.time "; 101 pgSql += " )bbbbb on aaaaa.time = bbbbb.time ";
101 102
102 pgSql += " left join ( "; 103 pgSql += " left join ( ";
104 pgSql += " select aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as zt_duration from ( ";
105 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from "+countTableName+"_count where nm ='"+ ConvertUtils.getString(metricMap.get("tzExpress"),"-")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' ";
106 pgSql += " ) aaa group by aaa.time order by aaa.time asc ";
107 pgSql += " )ddddd on aaaaa.time = ddddd.time ";
108
109
110 pgSql += " left join ( ";
103 pgSql += " select '11111111' info_id , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as total_duration from ( "; 111 pgSql += " select '11111111' info_id , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as total_duration from ( ";
104 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from TCSWSCLC_count where nm in('"+metricMap.get("yxExpress")+"','"+ConvertUtils.getString(metricMap.get("gzExpress"),"-")+"','"+ConvertUtils.getString(metricMap.get("tzExpress"),"-")+"') and ts <'"+tsEndTime+"' "; 112 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from "+countTableName+"_count where nm in('"+metricMap.get("yxExpress")+"','"+ConvertUtils.getString(metricMap.get("gzExpress"),"-")+"','"+ConvertUtils.getString(metricMap.get("tzExpress"),"-")+"') and ts <'"+tsEndTime+"' ";
105 pgSql += " ) aaa "; 113 pgSql += " ) aaa ";
106 pgSql += ")ccccc on aaaaa.info_id = ccccc.info_id "; 114 pgSql += ")ccccc on aaaaa.info_id = ccccc.info_id ";
107 115
...@@ -109,7 +117,8 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD ...@@ -109,7 +117,8 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD
109 //总时间长 117 //总时间长
110 if(dataList != null && !dataList.isEmpty()){ 118 if(dataList != null && !dataList.isEmpty()){
111 for(Map<String,Object > dataMap : dataList){ 119 for(Map<String,Object > dataMap : dataList){
112 Object[] obj = { UniqIdUtils.getInstance().getUniqID() ,departId ,metricMap.get("info_id"),dataMap.get("time"),dataMap.get("yx_duration"),dataMap.get("gz_duration"),dataMap.get("total_duration"),DateUtils.now()}; 120 Object[] obj = { UniqIdUtils.getInstance().getUniqID() ,departId ,metricMap.get("info_id"),dataMap.get("time"),ConvertUtils.getString(dataMap.get("yx_duration"),"0"),ConvertUtils.getString(dataMap.get("gz_duration"),"0")
121 ,ConvertUtils.getString(dataMap.get("zt_duration"),"0"),ConvertUtils.getString(dataMap.get("total_duration"),"0"),DateUtils.now()};
113 batchArgs.add(obj); 122 batchArgs.add(obj);
114 } 123 }
115 } 124 }
...@@ -118,7 +127,7 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD ...@@ -118,7 +127,7 @@ public class EquipmentInfoDurationServiceImpl extends ServiceImpl<EquipmentInfoD
118 } 127 }
119 // this.getJdbcTemplate().batchUpdate(); 128 // this.getJdbcTemplate().batchUpdate();
120 if(batchArgs != null && !batchArgs.isEmpty()){ 129 if(batchArgs != null && !batchArgs.isEmpty()){
121 this.getJdbcTemplate().batchUpdate("insert into equipment_info_duration (id,depart_id,info_id,data_time,gz_duration,yz_duration,total_duration,create_time) value(?,?,?,?,?,?,?,?)",batchArgs); 130 this.getJdbcTemplate().batchUpdate("insert into equipment_info_duration (id,depart_id,info_id,data_time,yz_duration,gz_duration,zt_duration,total_duration,create_time) value(?,?,?,?,?,?,?,?,?)",batchArgs);
122 } 131 }
123 132
124 //计算总时长 133 //计算总时长
......
...@@ -75,7 +75,7 @@ public class EquipmentStatisticsServiceImpl implements IEquipmentStatisticsServ ...@@ -75,7 +75,7 @@ public class EquipmentStatisticsServiceImpl implements IEquipmentStatisticsServ
75 */ 75 */
76 public List<EquipmentRepairMaintainTaskCostDetailVO> repairMaintainTaskCostDetailList(String departId, String startTime, String endTime){ 76 public List<EquipmentRepairMaintainTaskCostDetailVO> repairMaintainTaskCostDetailList(String departId, String startTime, String endTime){
77 String sql = "select d.depart_name, aaa.* from ( "; 77 String sql = "select d.depart_name, aaa.* from ( ";
78 sql +=" select er.depart_id , ei.equipment_name 'name' , '维修费用' as 'cost_type',er.total_cost 'cost',\tDATE_FORMAT( er.repair_date, '%Y-%m-%d' ) 'time' from equipment_repair er , equipment_info ei "; 78 sql +=" select er.depart_id , ei.equipment_name 'name' , '维修费用' as 'cost_type',er.total_cost 'cost',DATE_FORMAT( er.repair_date, '%Y-%m-%d' ) 'time' from equipment_repair er , equipment_info ei ";
79 sql += " where er.info_id = ei.id and er.total_cost > 0 and er.repair_date >= '"+startTime+" 00:00:00' and er.repair_date <='"+endTime+" 23:59:59' and er.depart_id = '"+departId+"' "; 79 sql += " where er.info_id = ei.id and er.total_cost > 0 and er.repair_date >= '"+startTime+" 00:00:00' and er.repair_date <='"+endTime+" 23:59:59' and er.depart_id = '"+departId+"' ";
80 sql += " UNION " ; 80 sql += " UNION " ;
81 sql += " select emt.depart_id, emt.maintain_plan_name 'name',"; 81 sql += " select emt.depart_id, emt.maintain_plan_name 'name',";
...@@ -167,67 +167,7 @@ public class EquipmentStatisticsServiceImpl implements IEquipmentStatisticsServ ...@@ -167,67 +167,7 @@ public class EquipmentStatisticsServiceImpl implements IEquipmentStatisticsServ
167 return dataList; 167 return dataList;
168 } 168 }
169 169
170 /***
171 * 设备运行时长填报数据
172 * @param departId
173 * @param startTime
174 * @param endTime
175 * @return
176 */
177 @Transactional
178 public boolean fillOutEquipmentInfoDuration(String departId,String startTime,String endTime) throws Exception{
179 //清理数据
180 String deleteSql = " delete from equipment_info_duration where depart_id = '"+departId+"' and date_time >= '"+startTime+"' and date_time <='"+endTime+"' ";
181 commonSqlService.delete(deleteSql);
182 //2
183 String countTableName = commonSqlService.queryForString("select device_id from sys_factory_device where depart_id = '" + departId + "'");
184
185 // 步骤3
186 String metric_sql = "select t.equipment_code as 'info_id', ei.equipment_name , t.metric_express1 'gzExpress' , t.metric_express2 'yxExpress' ,t.metric_express3 'tzExpress' from sys_monitor_metric_info t ";
187 metric_sql += " left join equipment_info ei on ei.id = t.equipment_code where t.metric_type = 1 and t.depart_id = '"+departId+"' and t.equipment_code > 0 ";
188 170
189 List<Map<String, Object>> metricMapList = commonSqlService.queryForList(metric_sql);
190
191
192 if(startTime.length() < 11 ){
193 startTime = startTime +" 00:00:00";
194 }
195 if(endTime.length() < 11 ){
196 endTime = endTime +" 23:59:59";
197 }
198 String tsStartTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss")) / 1000L);
199 String tsEndTime = String.valueOf(DateUtils.getMillis(DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss")) / 1000L);
200
201
202 String pgSql = null;
203 //步骤4 查询 pg数据库
204 List<Map<String, Object>> dataList = null;
205 String insertSql = null;
206 if(metricMapList != null && !metricMapList.isEmpty()){
207 for(Map<String, Object> metricMap : metricMapList){ //遍历设备记录以及metric 标签
208
209 pgSql = "select aaaaa.depart_id, aaaaa.info_id, aaaaa.time data_time, aaaaa.yx_duration ,bbbbb.gz_duration from (";
210 pgSql += " select '"+departId+"' depart_id, '"+metricMap.get("info_id")+"' info_id , aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as yx_duration from ( ";
211 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from TCSWSCLC_count where nm ='"+metricMap.get("yxExpress")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' ";
212 pgSql += " ) aaa group by aaa.time order by aaa.time asc ";
213 pgSql += " ) aaaaa ";
214 if(metricMap.get("gzExpress") != null ){
215 pgSql += " left join ( ";
216 pgSql += " select aaa.time , ROUND(SUM( to_number ( aaa.monitorValue, '9999999999999999.99' ) ) / 60 ,2)as gz_duration from ( ";
217 pgSql += " select TO_TIMESTAMP(ts ::BIGINT)::DATE AS time,nm as monitorId,v as monitorValue from TCSWSCLC_count where nm ='"+metricMap.get("yxExpress")+"' and ts>='"+tsStartTime+"' and ts <'"+tsEndTime+"' ";
218 pgSql += " ) aaa group by aaa.time order by aaa.time asc ";
219 pgSql += " )bbbbb on aaaaa.time = bbbbb.time ";
220 }
221
222 dataList = pgCommonService.queryForList(pgSql);
223 //总时间长
224
225 }
226 }
227
228
229 return false;
230 }
231 171
232 172
233 173
......
...@@ -45,8 +45,8 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -45,8 +45,8 @@ public class OperationReportServiceImpl implements IOperationReportService {
45 * @return 45 * @return
46 */ 46 */
47 public ProductDataVO handeReportMonthData(String departId,Integer year, Integer season,String startDate,String endDate){ 47 public ProductDataVO handeReportMonthData(String departId,Integer year, Integer season,String startDate,String endDate){
48 ProductDataVO productDataVO = new ProductDataVO();//返回结果 48 ProductDataVO productDataVO = new ProductDataVO(year,season,startDate,endDate);//返回结果
49 if(year != null ){ 49 /* if(year != null ){ //前端传递
50 int lastYear = year - 1;//去年 50 int lastYear = year - 1;//去年
51 productDataVO.setLastYear(lastYear); 51 productDataVO.setLastYear(lastYear);
52 productDataVO.setYear( year ); 52 productDataVO.setYear( year );
...@@ -64,7 +64,10 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -64,7 +64,10 @@ public class OperationReportServiceImpl implements IOperationReportService {
64 } 64 }
65 if(StringUtils.isNotEmpty(endDate)){ 65 if(StringUtils.isNotEmpty(endDate)){
66 productDataVO.setEndTime( endDate);//结束时间 66 productDataVO.setEndTime( endDate);//结束时间
67 } 67 }*/
68
69 String startMonth = DateUtils.formatDate(productDataVO.getStartTime(),"yyyy-MM");//开始月份
70 String endMonth = DateUtils.formatDate(productDataVO.getEndTime(),"yyyy-MM");//结束月份
68 71
69 //水务公司总数 72 //水务公司总数
70 String sql = "select count(1) from sys_depart where depart_type = 1 and id in ("+JSUtils.quoteEach(departId,",")+")"; 73 String sql = "select count(1) from sys_depart where depart_type = 1 and id in ("+JSUtils.quoteEach(departId,",")+")";
...@@ -87,6 +90,8 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -87,6 +90,8 @@ public class OperationReportServiceImpl implements IOperationReportService {
87 productDataVO.setChargeWaterVolume( ysfsl ); //收费水量 90 productDataVO.setChargeWaterVolume( ysfsl ); //收费水量
88 productDataVO.setYsjslWaterVolume(ysjsl );//实际处理水量 91 productDataVO.setYsjslWaterVolume(ysjsl );//实际处理水量
89 } 92 }
93
94
90 //目标水量 95 //目标水量
91 sql = "select sum(ifnull(target_water,0)) target_water from report_target_config where 1=1 "; 96 sql = "select sum(ifnull(target_water,0)) target_water from report_target_config where 1=1 ";
92 if(StringUtils.isNotEmpty(departId)){ 97 if(StringUtils.isNotEmpty(departId)){
...@@ -117,7 +122,7 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -117,7 +122,7 @@ public class OperationReportServiceImpl implements IOperationReportService {
117 productDataVO.setYsjslWaterRatio( JSUtils.executeExpression(expression,"0"));//实际处理水量--同比增长 122 productDataVO.setYsjslWaterRatio( JSUtils.executeExpression(expression,"0"));//实际处理水量--同比增长
118 123
119 /***************** 实际水量同比下降水务公司原因分析一览表************************/ 124 /***************** 实际水量同比下降水务公司原因分析一览表************************/
120 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); 125 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ysjsl,tqysjsl,ysjsldyqntqyy", departId, startMonth,endMonth);
121 sql = " select aaa.depart_id , d.depart_name departName, round(100*(sum(ifnull(aaa.ysjsl,0)) - sum(ifnull(aaa.tqysjsl,0)) )/ sum(ifnull(aaa.tqysjsl,0)),2) 'ratio', "; 126 sql = " select aaa.depart_id , d.depart_name departName, round(100*(sum(ifnull(aaa.ysjsl,0)) - sum(ifnull(aaa.tqysjsl,0)) )/ sum(ifnull(aaa.tqysjsl,0)),2) 'ratio', ";
122 sql += " round( sum(ifnull(aaa.ysjsl,0)),2 ) 'ysjsl' ,round( sum(ifnull(aaa.tqysjsl,0)),2 ) 'tqysjsl' ,GROUP_CONCAT(aaa.ysjsldyqntqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa"; 127 sql += " round( sum(ifnull(aaa.ysjsl,0)),2 ) 'ysjsl' ,round( sum(ifnull(aaa.tqysjsl,0)),2 ) 'tqysjsl' ,GROUP_CONCAT(aaa.ysjsldyqntqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";
123 sql += " left join sys_depart d on d.id = aaa.depart_id"; 128 sql += " left join sys_depart d on d.id = aaa.depart_id";
...@@ -125,8 +130,8 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -125,8 +130,8 @@ public class OperationReportServiceImpl implements IOperationReportService {
125 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class)); 130 List<FReportWaterMonthDataVO> waterMonthDataList = getJdbcTemplate().query(sql,new BeanPropertyRowMapper<FReportWaterMonthDataVO>(FReportWaterMonthDataVO.class));
126 productDataVO.setWaterDeptartList(waterMonthDataList); 131 productDataVO.setWaterDeptartList(waterMonthDataList);
127 132
128 //水电耗高于控制目标--水务公司列表 133 //水电耗高于控制目标--水务公司列表 YYYY-MM
129 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); 134 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"ydh,dhcmbzyy", departId, startMonth,endMonth);
130 sql = "select * from ( "; 135 sql = "select * from ( ";
131 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";; 136 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.ydh),2) realConsume , IFNULL(tc.target_power,2) 'targetConsume' ,GROUP_CONCAT(aaa.dhcmbzyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
132 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')"; 137 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
...@@ -136,8 +141,8 @@ public class OperationReportServiceImpl implements IOperationReportService { ...@@ -136,8 +141,8 @@ public class OperationReportServiceImpl implements IOperationReportService {
136 productDataVO.setPowerDeptartList(dhMonthDataList); 141 productDataVO.setPowerDeptartList(dhMonthDataList);
137 142
138 /** ysjsl:月实际水量 ; 月药耗 yyh; 去年同期药耗 qntqyh; 月药费 yyf;药耗高于去年同期原因 yhgyqntqyy;药耗超预期原因 yhcyqyy; 本年实际药耗 bnsjyh; 本年药耗目标 bnyhmb*/ 143 /** ysjsl:月实际水量 ; 月药耗 yyh; 去年同期药耗 qntqyh; 月药费 yyf;药耗高于去年同期原因 yhgyqntqyy;药耗超预期原因 yhcyqyy; 本年实际药耗 bnsjyh; 本年药耗目标 bnyhmb*/
139 //药剂成本高于控制目标--水务公司列表 144 //药剂成本高于控制目标--水务公司列表 YYYY-MM
140 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, productDataVO.getStartTime(), productDataVO.getEndTime()); 145 dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"yyh,yhcyqyy", departId, startMonth,endMonth);
141 sql = "select * from ( "; 146 sql = "select * from ( ";
142 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";; 147 sql += " select d.depart_name 'departName', aaa.depart_id , round(avg(aaa.yyh),2) realConsume , IFNULL(tc.target_drug,2) 'targetConsume' ,GROUP_CONCAT(aaa.yhcyqyy SEPARATOR '') 'causeAnalysis' from "+ dataViewName4411+" aaa";;
143 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')"; 148 sql += " left join report_target_config tc on (tc.depart_id = aaa.depart_id and tc.target_year='2024')";
......
...@@ -166,7 +166,8 @@ public class EquipmentInfoMonthReportController { ...@@ -166,7 +166,8 @@ public class EquipmentInfoMonthReportController {
166 String plan_cost = commonSqlService.queryForString(sql); 166 String plan_cost = commonSqlService.queryForString(sql);
167 dataMap.put("planCost",plan_cost);//月度计划维修费合计XX万元 167 dataMap.put("planCost",plan_cost);//月度计划维修费合计XX万元
168 //执行XX万元 168 //执行XX万元
169 sql = "select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'"; 169 // sql = "select round(ifnull(sum(total_cost),0)/10000,2) 'repair_cost' from equipment_repair where reality_maintenance_end_time >= '"+startDate+" 00:00:00' and reality_maintenance_end_time <='"+endDate+" 23:59:59'";
170 sql = "select round(ifnull(sum(maintenance_cost),0)/10000,2) 'repair_cost' from equipment_maintain_task where real_end_time >= '"+startDate+" 00:00:00' and real_end_time <='"+endDate+" 23:59:59'";
170 String repair_cost = commonSqlService.queryForString(sql); 171 String repair_cost = commonSqlService.queryForString(sql);
171 dataMap.put("repairCost",repair_cost);//执行XX万元 172 dataMap.put("repairCost",repair_cost);//执行XX万元
172 String expression = "100 * "+ repair_cost +" /"+plan_cost; 173 String expression = "100 * "+ repair_cost +" /"+plan_cost;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!