三江-标准版-修改
This commit is contained in:
parent
26eeab83d5
commit
03d7cfe1ac
@ -85,7 +85,7 @@ public class QueryGenerator {
|
||||
|
||||
|
||||
public static <T> QueryWrapper<T> initQueryWrapper(T searchObj, Map<String, String[]> parameterMap, List<String> excludeFields, List<String> likeFields) {
|
||||
return initQueryWrapper(searchObj, parameterMap, excludeFields, null, false, null);
|
||||
return initQueryWrapper(searchObj, parameterMap, excludeFields, likeFields, false, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -33,10 +33,9 @@ import java.util.Map;
|
||||
public class AmmeterMonthRecordController {
|
||||
@Autowired
|
||||
private IAmmeterMonthRecordService ammeterMonthRecordService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param ammeterMonthRecord
|
||||
* @return
|
||||
@ -67,15 +66,26 @@ public class AmmeterMonthRecordController {
|
||||
return Result.success(ammeterMonthRecordService.getCurrentMonthMeterRecord(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = " 查询电表报警和每月实时数据列表", notes = "查询电表报警和每月实时数据列表" , httpMethod="POST")
|
||||
@ApiOperation(value = " 查询电表报警和每月实时数据列表", notes = "查询电表报警和每月实时数据列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="ammeterNo",value="电表号",dataType = "String",paramType = "query",required =true),
|
||||
@ApiImplicitParam(name="yearTime",value="年份",dataType = "String",paramType = "query",required =true),
|
||||
@ApiImplicitParam(name = "ammeterNo", value = "电表号", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "yearTime", value = "年份", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectAmmeterStatisticsList")
|
||||
public Result<Map<String,Object>> selectAmmeterStatisticsList(@RequestBody Map<String,Object> map) {
|
||||
public Result<Map<String, Object>> selectAmmeterStatisticsList(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(ammeterMonthRecordService.selectAmmeterStatisticsList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = " 查询某年电表用电量和报警(按月份统计)", notes = "查询某年电表用电量和报警(按月份统计)", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ammeterNo", value = "电表号", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "yearTime", value = "年份", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectAmmeterStatisticsListByYear")
|
||||
public Result<Map<String, Object>> selectAmmeterStatisticsListByYear(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(ammeterMonthRecordService.selectAmmeterStatisticsListByYear(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,12 +8,14 @@ import java.util.Map;
|
||||
/**
|
||||
* @Description: 电表每月用电记录
|
||||
* @author: pds
|
||||
* @date: 2020-12-10
|
||||
* @date: 2020-12-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IAmmeterMonthRecordService extends IService<AmmeterMonthRecord> {
|
||||
|
||||
Map<String,Object> getCurrentMonthMeterRecord(Map<String, Object> map);
|
||||
Map<String, Object> getCurrentMonthMeterRecord(Map<String, Object> map);
|
||||
|
||||
Map<String,Object> selectAmmeterStatisticsList(Map<String, Object> map);
|
||||
Map<String, Object> selectAmmeterStatisticsList(Map<String, Object> map);
|
||||
|
||||
Map<String, Object> selectAmmeterStatisticsListByYear(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -16,15 +16,13 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 电表每月用电记录
|
||||
* @author: pds
|
||||
* @date: 2020-12-10
|
||||
* @date: 2020-12-10
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -39,37 +37,91 @@ public class AmmeterMonthRecordServiceImpl extends ServiceImpl<AmmeterMonthRecor
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCurrentMonthMeterRecord(Map<String, Object> map) {
|
||||
Map<String, Object> data=new HashMap<>();
|
||||
QueryWrapper<Ammeter> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(Ammeter::getProjectSn, MapUtils.getString(map,"projectSn"))
|
||||
.eq(Ammeter::getAmmeterNo,MapUtils.getString(map,"ammeterNo"));
|
||||
Ammeter ammeter=ammeterMapper.selectOne(queryWrapper);
|
||||
data.put("ammeter",ammeter);
|
||||
EntityMap count=ammeterMonthRecordMapper.getCurrentMonthMeterRecord(map);
|
||||
data.put("count",count);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
QueryWrapper<Ammeter> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(Ammeter::getProjectSn, MapUtils.getString(map, "projectSn"))
|
||||
.eq(Ammeter::getAmmeterNo, MapUtils.getString(map, "ammeterNo"));
|
||||
Ammeter ammeter = ammeterMapper.selectOne(queryWrapper);
|
||||
data.put("ammeter", ammeter);
|
||||
EntityMap count = ammeterMonthRecordMapper.getCurrentMonthMeterRecord(map);
|
||||
data.put("count", count);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectAmmeterStatisticsList(Map<String, Object> map) {
|
||||
Map<String, Object> data=new HashMap<>();
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy");
|
||||
String currentYear=sft.format(new Date());
|
||||
String yearTime=MapUtils.getString(map,"yearTime");
|
||||
if(StringUtils.isEmpty(yearTime)){
|
||||
yearTime=currentYear;
|
||||
String currentYear = sft.format(new Date());
|
||||
String yearTime = MapUtils.getString(map, "yearTime");
|
||||
if (StringUtils.isEmpty(yearTime)) {
|
||||
yearTime = currentYear;
|
||||
}
|
||||
List<Map<String, Object>> monthWaterList=ammeterMonthRecordMapper.selectAmmeterMonthList(map);
|
||||
map.put("yearTime",yearTime);
|
||||
if(currentYear.equals(yearTime)){
|
||||
Map<String, Object> currentMap=ammeterMonthRecordMapper.selectCurrentAmmeterMontRecord(map);
|
||||
if(monthWaterList!=null&¤tMap!=null){
|
||||
List<Map<String, Object>> monthWaterList = ammeterMonthRecordMapper.selectAmmeterMonthList(map);
|
||||
map.put("yearTime", yearTime);
|
||||
if (currentYear.equals(yearTime)) {
|
||||
Map<String, Object> currentMap = ammeterMonthRecordMapper.selectCurrentAmmeterMontRecord(map);
|
||||
if (monthWaterList != null && currentMap != null) {
|
||||
monthWaterList.add(currentMap);
|
||||
}
|
||||
}
|
||||
data.put("monthWaterList",monthWaterList);
|
||||
List<Map<String, Object>> alarmList=ammeterAlarmMapper.selectAmmeterAlarmTotalList(map);
|
||||
data.put("alarmList",alarmList);
|
||||
data.put("monthWaterList", monthWaterList);
|
||||
List<Map<String, Object>> alarmList = ammeterAlarmMapper.selectAmmeterAlarmTotalList(map);
|
||||
data.put("alarmList", alarmList);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectAmmeterStatisticsListByYear(Map<String, Object> map) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy");
|
||||
String currentYear = sft.format(new Date());
|
||||
String yearTime = MapUtils.getString(map, "yearTime");
|
||||
if (StringUtils.isEmpty(yearTime)) {
|
||||
yearTime = currentYear;
|
||||
}
|
||||
List<Map<String, Object>> monthWaterList = ammeterMonthRecordMapper.selectAmmeterMonthList(map);
|
||||
map.put("yearTime", yearTime);
|
||||
data.put("monthWaterList", waterSequenceMonthOneYear(monthWaterList, yearTime));
|
||||
List<Map<String, Object>> alarmList = ammeterAlarmMapper.selectAmmeterAlarmTotalList(map);
|
||||
data.put("alarmList", alarmSequenceMonthOneYear(alarmList, yearTime));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
private List<Map<String, Object>> alarmSequenceMonthOneYear(List<Map<String, Object>> alarmList, String yearTime) {
|
||||
ArrayList<String> sequenceMonth = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
sequenceMonth.add(yearTime + "-" + String.format("%02d", i));
|
||||
}
|
||||
String monthTime = "titleTime";
|
||||
String num = "num";
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
Map<String, Double> dataMap = alarmList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, num)));
|
||||
for (String s : sequenceMonth) {
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put(monthTime, s);
|
||||
m.put(num, dataMap.get(s) != null ? dataMap.get(s) : 0.0);
|
||||
listMap.add(m);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> waterSequenceMonthOneYear(List<Map<String, Object>> monthWaterList, String yearTime) {
|
||||
ArrayList<String> sequenceMonth = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
sequenceMonth.add(yearTime + "-" + String.format("%02d", i));
|
||||
}
|
||||
String monthTime = "monthTime";
|
||||
String useDegree = "useDegree";
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
Map<String, Double> dataMap = monthWaterList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, useDegree)));
|
||||
for (String s : sequenceMonth) {
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put(monthTime, s);
|
||||
m.put(useDegree, dataMap.get(s) != null ? dataMap.get(s) : 0.0);
|
||||
listMap.add(m);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,18 +34,20 @@ import java.util.Map;
|
||||
public class BigDevicesMaintenanceRecordController {
|
||||
@Autowired
|
||||
private IBigDevicesMaintenanceRecordService bigDevicesMaintenanceRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 分页列表查询大型设备-维保记录表信息", notes = "分页列表查询大型设备-维保记录表信息", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="devSn",value="设备编号",dataType = "String",paramType = "query",required =false),
|
||||
@ApiImplicitParam(name = "devSn", value = "设备编号", dataType = "String", paramType = "query", required = false),
|
||||
@ApiImplicitParam(name = "devType", value = "设备类型,1塔吊,2升降机,3龙门吊", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "maintenanceStartTime", value = "维保开始时间", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "maintenanceEndTime", value = "维保结束时间", paramType = "query", required = false, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/list")
|
||||
public Result<IPage<EntityMap>> queryPageList(@RequestBody Map<String,Object> map) {
|
||||
@ -76,12 +78,12 @@ public class BigDevicesMaintenanceRecordController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param bigDevicesMaintenanceRecord
|
||||
* @return
|
||||
*/
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param bigDevicesMaintenanceRecord
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "设备维保管理",operType = "编辑大型设备-维保记录",operDesc = "编辑大型设备-维保记录表信息")
|
||||
@ApiOperation(value = "编辑大型设备-维保记录表信息", notes = "编辑大型设备-维保记录表信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/edit")
|
||||
@ -97,15 +99,15 @@ public class BigDevicesMaintenanceRecordController {
|
||||
result.successMsg(MessageUtil.get("editSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "设备维保管理",operType = "删除大型设备-维保记录",operDesc = "删除大型设备-维保记录表信息")
|
||||
@ApiOperation(value = "删除大型设备-维保记录表信息", notes = "删除大型设备-维保记录表信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "大型设备-维保记录表ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@ -121,13 +123,12 @@ public class BigDevicesMaintenanceRecordController {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param
|
||||
* @return
|
||||
|
||||
@ -1,78 +1,101 @@
|
||||
package com.zhgd.xmgl.modules.bigdevice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 塔吊升降机设备维保记录表
|
||||
* @author: pds
|
||||
* @date: 2020-12-24
|
||||
* @date: 2020-12-24
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("big_devices_maintenance_record")
|
||||
@ApiModel(value="BigDevicesMaintenanceRecord实体类",description="BigDevicesMaintenanceRecord")
|
||||
@ApiModel(value = "BigDevicesMaintenanceRecord实体类", description = "BigDevicesMaintenanceRecord")
|
||||
public class BigDevicesMaintenanceRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
private java.lang.Long id ;
|
||||
/**设备编号*/
|
||||
@Excel(name = "设备编号", width = 15)
|
||||
@ApiModelProperty(value="设备编号")
|
||||
private java.lang.String devSn ;
|
||||
/**设备类型,1塔吊,2升降机,3龙门吊*/
|
||||
@Excel(name = "设备类型,1塔吊,2升降机,3龙门吊", width = 15)
|
||||
@ApiModelProperty(value="设备类型,1塔吊,2升降机,3龙门吊")
|
||||
private java.lang.Integer devType ;
|
||||
/**项目sn*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value="项目sn")
|
||||
private java.lang.String projectSn ;
|
||||
/**维保单位*/
|
||||
@Excel(name = "维保单位", width = 15)
|
||||
@ApiModelProperty(value="维保单位")
|
||||
private java.lang.String maintenanceUnit ;
|
||||
/**维保时间*/
|
||||
@Excel(name = "维保时间", width = 15)
|
||||
@ApiModelProperty(value="维保时间")
|
||||
private java.lang.String maintenanceTime ;
|
||||
/**添加时间*/
|
||||
@Excel(name = "添加时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value="添加时间")
|
||||
private java.util.Date addTime ;
|
||||
/**维保状态 0表示不正常,1表示正常*/
|
||||
@Excel(name = "维保状态 0表示不正常,1表示正常", width = 15)
|
||||
@ApiModelProperty(value="维保状态 0表示不正常,1表示正常")
|
||||
private java.lang.Integer maintenanceStatus ;
|
||||
/**维保记录*/
|
||||
@Excel(name = "维保记录", width = 15)
|
||||
@ApiModelProperty(value="维保记录")
|
||||
private java.lang.String maintenanceRecord ;
|
||||
/**维保责任人id*/
|
||||
@Excel(name = "维保责任人id", width = 15)
|
||||
@ApiModelProperty(value="维保责任人id")
|
||||
private java.lang.String personLiable ;
|
||||
/**维保图片*/
|
||||
@Excel(name = "维保图片", width = 15)
|
||||
@ApiModelProperty(value="维保图片")
|
||||
private java.lang.String maintenanceImage ;
|
||||
/**描述,备注*/
|
||||
@Excel(name = "描述,备注", width = 15)
|
||||
@ApiModelProperty(value="描述,备注")
|
||||
private java.lang.String remark ;
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@Excel(name = "设备编号", width = 15)
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private java.lang.String devSn;
|
||||
/**
|
||||
* 设备类型,1塔吊,2升降机,3龙门吊
|
||||
*/
|
||||
@Excel(name = "设备类型,1塔吊,2升降机,3龙门吊", width = 15)
|
||||
@ApiModelProperty(value = "设备类型,1塔吊,2升降机,3龙门吊")
|
||||
private java.lang.Integer devType;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 维保单位
|
||||
*/
|
||||
@Excel(name = "维保单位", width = 15)
|
||||
@ApiModelProperty(value = "维保单位")
|
||||
private java.lang.String maintenanceUnit;
|
||||
/**
|
||||
* 维保时间
|
||||
*/
|
||||
@Excel(name = "维保时间", width = 15)
|
||||
@ApiModelProperty(value = "维保时间")
|
||||
private java.lang.String maintenanceTime;
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
@Excel(name = "添加时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private java.util.Date addTime;
|
||||
/**
|
||||
* 维保状态 0表示不正常,1表示正常
|
||||
*/
|
||||
@Excel(name = "维保状态 0表示不正常,1表示正常", width = 15)
|
||||
@ApiModelProperty(value = "维保状态 0表示不正常,1表示正常")
|
||||
private java.lang.Integer maintenanceStatus;
|
||||
/**
|
||||
* 维保记录
|
||||
*/
|
||||
@Excel(name = "维保记录", width = 15)
|
||||
@ApiModelProperty(value = "维保记录")
|
||||
private java.lang.String maintenanceRecord;
|
||||
/**
|
||||
* 维保责任人id
|
||||
*/
|
||||
@Excel(name = "维保责任人id", width = 15)
|
||||
@ApiModelProperty(value = "维保责任人id")
|
||||
private java.lang.String personLiable;
|
||||
/**
|
||||
* 维保图片
|
||||
*/
|
||||
@Excel(name = "维保图片", width = 15)
|
||||
@ApiModelProperty(value = "维保图片")
|
||||
private java.lang.String maintenanceImage;
|
||||
/**
|
||||
* 描述,备注
|
||||
*/
|
||||
@Excel(name = "描述,备注", width = 15)
|
||||
@ApiModelProperty(value = "描述,备注")
|
||||
private java.lang.String remark;
|
||||
}
|
||||
|
||||
@ -7,10 +7,15 @@
|
||||
SELECT a.*,b.dev_name
|
||||
from big_devices_maintenance_record a LEFT JOIN tower b ON a.dev_sn=b.dev_sn
|
||||
WHERE a.dev_type=1 and a.project_sn=#{param.projectSn}
|
||||
<if test="param.devSn!=null and param.devSn!=''">
|
||||
<if test="param.devSn != null and param.devSn != ''">
|
||||
and a.dev_sn=#{param.devSn}
|
||||
</if>
|
||||
|
||||
<if test="param.maintenanceStartTime != null and param.maintenanceStartTime != ''">
|
||||
and a.maintenance_time >= #{param.maintenanceStartTime}
|
||||
</if>
|
||||
<if test="param.maintenanceEndTime != null and param.maintenanceEndTime != ''">
|
||||
and a.maintenance_time <= #{param.maintenanceEndTime}
|
||||
</if>
|
||||
</select>
|
||||
<select id="queryLifterMaintenanceRecordPageList"
|
||||
resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
@ -32,4 +37,4 @@
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -1,22 +1,32 @@
|
||||
package com.zhgd.xmgl.modules.environment.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.environment.entity.DustNoiseData;
|
||||
import com.zhgd.xmgl.modules.environment.mapper.DustNoiseDataMapper;
|
||||
import com.zhgd.xmgl.modules.environment.service.IDustNoiseDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -35,6 +45,8 @@ import java.util.Map;
|
||||
public class DustNoiseDataController {
|
||||
@Autowired
|
||||
private IDustNoiseDataService dustNoiseDataService;
|
||||
@Autowired
|
||||
private DustNoiseDataMapper dustNoiseDataMapper;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
@ -102,4 +114,22 @@ public class DustNoiseDataController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导出excel绿色设备扬尘噪声实时数据", notes = "导出excel绿色设备扬尘噪声实时数据", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, DustNoiseData dustNoiseData) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<DustNoiseData> queryWrapper = QueryGenerator.initQueryWrapper(dustNoiseData, request.getParameterMap(), "dnd.");
|
||||
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<DustNoiseData> pageList = dustNoiseDataMapper.listExportXls(queryWrapper, dustNoiseData);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "绿色设备扬尘噪声实时数据");
|
||||
mv.addObject(NormalExcelConstants.CLASS, DustNoiseData.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("绿色设备扬尘噪声实时数据", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,121 +1,161 @@
|
||||
package com.zhgd.xmgl.modules.environment.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 扬尘噪声实时数据
|
||||
* @author: pds
|
||||
* @date: 2020-09-27
|
||||
* @date: 2020-09-27
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dust_noise_data")
|
||||
@ApiModel(value="DustNoiseData实体类",description="DustNoiseData")
|
||||
@ApiModel(value = "DustNoiseData实体类", description = "DustNoiseData")
|
||||
public class DustNoiseData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**扬尘噪声实时数据*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="扬尘噪声实时数据")
|
||||
private java.lang.Long id ;
|
||||
/**项目sn*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value="项目sn")
|
||||
private java.lang.String projectSn ;
|
||||
/**设备Id*/
|
||||
@Excel(name = "设备Id", width = 15)
|
||||
@ApiModelProperty(value="设备Id")
|
||||
private java.lang.String deviceId ;
|
||||
/**crc校验值*/
|
||||
@Excel(name = "crc校验值", width = 15)
|
||||
@ApiModelProperty(value="crc校验值")
|
||||
private java.lang.String crc ;
|
||||
/**数据上传时间*/
|
||||
@Excel(name = "数据上传时间", width = 15)
|
||||
@ApiModelProperty(value="数据上传时间")
|
||||
private java.lang.String uploadDate ;
|
||||
/**扬尘*/
|
||||
@Excel(name = "扬尘", width = 15)
|
||||
@ApiModelProperty(value="扬尘")
|
||||
private java.lang.Float pm10 ;
|
||||
/**pm25*/
|
||||
@Excel(name = "pm25", width = 15)
|
||||
@ApiModelProperty(value="pm25")
|
||||
private java.lang.Float pm25 ;
|
||||
/**噪音*/
|
||||
@Excel(name = "噪音", width = 15)
|
||||
@ApiModelProperty(value="噪音")
|
||||
private java.lang.Float noise ;
|
||||
/**tsp测试值*/
|
||||
@Excel(name = "tsp测试值", width = 15)
|
||||
@ApiModelProperty(value="tsp测试值")
|
||||
private java.lang.Float tsp ;
|
||||
/**温度*/
|
||||
@Excel(name = "温度", width = 15)
|
||||
@ApiModelProperty(value="温度")
|
||||
private java.lang.Float temperature ;
|
||||
/**湿度*/
|
||||
@Excel(name = "湿度", width = 15)
|
||||
@ApiModelProperty(value="湿度")
|
||||
private java.lang.Float humidity ;
|
||||
/**风速*/
|
||||
@Excel(name = "风速", width = 15)
|
||||
@ApiModelProperty(value="风速")
|
||||
private java.lang.Float windspeed ;
|
||||
/**风向*/
|
||||
@Excel(name = "风向", width = 15)
|
||||
@ApiModelProperty(value="风向")
|
||||
private java.lang.String winddirection ;
|
||||
/**大气压*/
|
||||
@Excel(name = "大气压", width = 15)
|
||||
@ApiModelProperty(value="大气压")
|
||||
private java.lang.Float pressure ;
|
||||
/**电压*/
|
||||
@Excel(name = "电压", width = 15)
|
||||
@ApiModelProperty(value="电压")
|
||||
private java.lang.Float voltage ;
|
||||
/**板载温度*/
|
||||
@Excel(name = "板载温度", width = 15)
|
||||
@ApiModelProperty(value="板载温度")
|
||||
private java.lang.Float plateTemperature ;
|
||||
/**板载湿度*/
|
||||
@Excel(name = "板载湿度", width = 15)
|
||||
@ApiModelProperty(value="板载湿度")
|
||||
private java.lang.Float plateHumidity ;
|
||||
|
||||
@ApiModelProperty(value="风向名称")
|
||||
/**
|
||||
* 扬尘噪声实时数据
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "扬尘噪声实时数据")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 设备Id
|
||||
*/
|
||||
@Excel(name = "设备Id", width = 15)
|
||||
@ApiModelProperty(value = "设备Id")
|
||||
private java.lang.String deviceId;
|
||||
/**
|
||||
* crc校验值
|
||||
*/
|
||||
@Excel(name = "crc校验值", width = 15)
|
||||
@ApiModelProperty(value = "crc校验值")
|
||||
private java.lang.String crc;
|
||||
/**
|
||||
* 数据上传时间
|
||||
*/
|
||||
@Excel(name = "数据上传时间", width = 15)
|
||||
@ApiModelProperty(value = "数据上传时间")
|
||||
private java.lang.String uploadDate;
|
||||
/**
|
||||
* 扬尘
|
||||
*/
|
||||
@Excel(name = "扬尘", width = 15)
|
||||
@ApiModelProperty(value = "扬尘")
|
||||
private java.lang.Float pm10;
|
||||
/**
|
||||
* pm25
|
||||
*/
|
||||
@Excel(name = "pm25", width = 15)
|
||||
@ApiModelProperty(value = "pm25")
|
||||
private java.lang.Float pm25;
|
||||
/**
|
||||
* 噪音
|
||||
*/
|
||||
@Excel(name = "噪音", width = 15)
|
||||
@ApiModelProperty(value = "噪音")
|
||||
private java.lang.Float noise;
|
||||
/**
|
||||
* tsp测试值
|
||||
*/
|
||||
@Excel(name = "tsp测试值", width = 15)
|
||||
@ApiModelProperty(value = "tsp测试值")
|
||||
private java.lang.Float tsp;
|
||||
/**
|
||||
* 温度
|
||||
*/
|
||||
@Excel(name = "温度", width = 15)
|
||||
@ApiModelProperty(value = "温度")
|
||||
private java.lang.Float temperature;
|
||||
/**
|
||||
* 湿度
|
||||
*/
|
||||
@Excel(name = "湿度", width = 15)
|
||||
@ApiModelProperty(value = "湿度")
|
||||
private java.lang.Float humidity;
|
||||
/**
|
||||
* 风速
|
||||
*/
|
||||
@Excel(name = "风速", width = 15)
|
||||
@ApiModelProperty(value = "风速")
|
||||
private java.lang.Float windspeed;
|
||||
/**
|
||||
* 风向
|
||||
*/
|
||||
@Excel(name = "风向", width = 15)
|
||||
@ApiModelProperty(value = "风向")
|
||||
private java.lang.String winddirection;
|
||||
/**
|
||||
* 大气压
|
||||
*/
|
||||
@Excel(name = "大气压", width = 15)
|
||||
@ApiModelProperty(value = "大气压")
|
||||
private java.lang.Float pressure;
|
||||
/**
|
||||
* 电压
|
||||
*/
|
||||
@Excel(name = "电压", width = 15)
|
||||
@ApiModelProperty(value = "电压")
|
||||
private java.lang.Float voltage;
|
||||
/**
|
||||
* 板载温度
|
||||
*/
|
||||
@Excel(name = "板载温度", width = 15)
|
||||
@ApiModelProperty(value = "板载温度")
|
||||
private java.lang.Float plateTemperature;
|
||||
/**
|
||||
* 板载湿度
|
||||
*/
|
||||
@Excel(name = "板载湿度", width = 15)
|
||||
@ApiModelProperty(value = "板载湿度")
|
||||
private java.lang.Float plateHumidity;
|
||||
|
||||
@ApiModelProperty(value = "风向名称")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String winddirectionName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="tsp是否报警,0否,1是")
|
||||
private java.lang.Integer tspAlarmType ;
|
||||
@ApiModelProperty(value = "tsp是否报警,0否,1是")
|
||||
private java.lang.Integer tspAlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="PM25是否报警,0否,1是")
|
||||
private java.lang.Integer pm25AlarmType ;
|
||||
@ApiModelProperty(value = "PM25是否报警,0否,1是")
|
||||
private java.lang.Integer pm25AlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="pm10是否报警,0否,1是")
|
||||
private java.lang.Integer pm10AlarmType ;
|
||||
@ApiModelProperty(value = "pm10是否报警,0否,1是")
|
||||
private java.lang.Integer pm10AlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="噪音是否报警,0否,1是")
|
||||
private java.lang.Integer noiseAlarmType ;
|
||||
@ApiModelProperty(value = "噪音是否报警,0否,1是")
|
||||
private java.lang.Integer noiseAlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="湿度是否报警,0否,1是")
|
||||
private java.lang.Integer humidityAlarmType ;
|
||||
@ApiModelProperty(value = "湿度是否报警,0否,1是")
|
||||
private java.lang.Integer humidityAlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="温度是否报警,0否,1是")
|
||||
private java.lang.Integer temperatureAlarmType ;
|
||||
@ApiModelProperty(value = "温度是否报警,0否,1是")
|
||||
private java.lang.Integer temperatureAlarmType;
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="风速是否报警,0否,1是")
|
||||
private java.lang.Integer windSpeedAlarmType ;
|
||||
@ApiModelProperty(value = "风速是否报警,0否,1是")
|
||||
private java.lang.Integer windSpeedAlarmType;
|
||||
/**
|
||||
* 设备名字
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "设备名字", width = 15)
|
||||
@ApiModelProperty(value = "设备名字")
|
||||
private java.lang.String deviceName;
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.zhgd.xmgl.modules.environment.mapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -32,4 +34,6 @@ public interface DustNoiseDataMapper extends BaseMapper<DustNoiseData> {
|
||||
List<EntityMap> selectDustNoisePageList(Page<EntityMap> page, @Param("param") Map<String, Object> map);
|
||||
|
||||
List<DustNoiseData> getRealTimeDustNoiseDataList(Map<String, Object> map);
|
||||
|
||||
List<DustNoiseData> listExportXls(@Param(Constants.WRAPPER) QueryWrapper<DustNoiseData> queryWrapper, DustNoiseData dustNoiseData);
|
||||
}
|
||||
|
||||
@ -1,92 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.environment.mapper.DustNoiseDataMapper">
|
||||
|
||||
<select id="selectAvgPm25Value" resultType="double">
|
||||
SELECT round(AVG(pm25Value),2) pm25Value
|
||||
from
|
||||
(SELECT device_id,round(AVG(pm25),2) pm25Value
|
||||
SELECT round(AVG(pm25Value), 2) pm25Value
|
||||
from (SELECT device_id, round(AVG(pm25), 2) pm25Value
|
||||
from dust_noise_data
|
||||
WHERE project_sn=#{projectSn}
|
||||
and upload_date >=CONCAT(DATE_FORMAT(#{dayTime},'%Y-%m-%d'),' 00:00:00')
|
||||
and upload_date <=CONCAT(DATE_FORMAT(#{dayTime},'%Y-%m-%d'),' 23:59:59')
|
||||
WHERE project_sn = #{projectSn}
|
||||
and upload_date >= CONCAT(DATE_FORMAT(#{dayTime}, '%Y-%m-%d'), ' 00:00:00')
|
||||
and upload_date <= CONCAT(DATE_FORMAT(#{dayTime}, '%Y-%m-%d'), ' 23:59:59')
|
||||
GROUP BY device_id) tp
|
||||
</select>
|
||||
|
||||
<delete id="deleteDustNoiseDataToHistory">
|
||||
delete from dust_noise_data
|
||||
delete
|
||||
from dust_noise_data
|
||||
where
|
||||
<![CDATA[
|
||||
upload_date<date_format(now(),'%Y-%m-%d 00:00:00')
|
||||
upload_date < date_format(now(), '%Y-%m-%d 00:00:00')
|
||||
]]>
|
||||
</delete>
|
||||
<insert id="insertDustNoiseHistoryData">
|
||||
insert dust_noise_history_data
|
||||
(id,project_sn,device_id, crc,
|
||||
(id, project_sn, device_id, crc,
|
||||
upload_date, pm10, pm25, noise,
|
||||
tsp, temperature, humidity,
|
||||
windspeed, winddirection, pressure,
|
||||
voltage, plate_temperature, plate_humidity)
|
||||
select
|
||||
id,project_sn,device_id, crc,
|
||||
upload_date, pm10, pm25, noise,
|
||||
tsp, temperature, humidity,
|
||||
windspeed, winddirection, pressure,
|
||||
voltage, plate_temperature, plate_humidity
|
||||
select id,
|
||||
project_sn,
|
||||
device_id,
|
||||
crc,
|
||||
upload_date,
|
||||
pm10,
|
||||
pm25,
|
||||
noise,
|
||||
tsp,
|
||||
temperature,
|
||||
humidity,
|
||||
windspeed,
|
||||
winddirection,
|
||||
pressure,
|
||||
voltage,
|
||||
plate_temperature,
|
||||
plate_humidity
|
||||
from dust_noise_data
|
||||
where
|
||||
<![CDATA[
|
||||
upload_date<date_format(now(),'%Y-%m-%d 00:00:00')
|
||||
upload_date < date_format(now(), '%Y-%m-%d 00:00:00')
|
||||
]]>
|
||||
</insert>
|
||||
<select id="selectDustNoiseData" resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData" parameterType="map">
|
||||
<select id="selectDustNoiseData" resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData"
|
||||
parameterType="map">
|
||||
select * from
|
||||
<if test="searchType == '1'.toString()">
|
||||
dust_noise_data
|
||||
dust_noise_data
|
||||
</if>
|
||||
<if test="searchType == '2'.toString()">
|
||||
dust_noise_history_data
|
||||
</if>
|
||||
where project_sn=#{projectSn}
|
||||
and device_id=#{deviceId}
|
||||
and upload_date >=CONCAT(DATE_FORMAT(#{searchDate},'%Y-%m-%d'),' 00:00:00')
|
||||
and upload_date <=CONCAT(DATE_FORMAT(#{searchDate},'%Y-%m-%d'),' 23:59:59')
|
||||
<!-- GROUP BY-->
|
||||
<!-- DATE(upload_date),-->
|
||||
<!-- HOUR (upload_date)-->
|
||||
where project_sn = #{projectSn}
|
||||
and device_id = #{deviceId}
|
||||
and upload_date >= CONCAT(DATE_FORMAT(#{searchDate}, '%Y-%m-%d'), ' 00:00:00')
|
||||
and upload_date <= CONCAT(DATE_FORMAT(#{searchDate}, '%Y-%m-%d'), ' 23:59:59')
|
||||
<!-- GROUP BY-->
|
||||
<!-- DATE(upload_date),-->
|
||||
<!-- HOUR (upload_date)-->
|
||||
ORDER BY upload_date DESC
|
||||
</select>
|
||||
<select id="getRealTimeDustNoiseData" resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData" parameterType="map">
|
||||
<select id="getRealTimeDustNoiseData" resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData"
|
||||
parameterType="map">
|
||||
select *
|
||||
from dust_noise_data
|
||||
where project_sn=#{projectSn}
|
||||
and device_id=#{deviceId}
|
||||
where project_sn = #{projectSn}
|
||||
and device_id = #{deviceId}
|
||||
ORDER BY upload_date desc
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectDustNoisePageList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
SELECT a.*,c.device_name
|
||||
FROM
|
||||
dust_noise_data a
|
||||
LEFT JOIN environment_dev c ON (a.device_id =c.device_id and a.project_sn=c.project_sn)
|
||||
where a.project_sn=#{param.projectSn}
|
||||
<if test="param.deviceId!=null and param.deviceId!=''">
|
||||
and a.device_id=#{param.deviceId}
|
||||
SELECT a.*, c.device_name
|
||||
FROM dust_noise_data a
|
||||
LEFT JOIN environment_dev c ON (a.device_id = c.device_id and a.project_sn = c.project_sn)
|
||||
where a.project_sn = #{param.projectSn}
|
||||
<if test="param.deviceId != null and param.deviceId != ''">
|
||||
and a.device_id = #{param.deviceId}
|
||||
</if>
|
||||
<if test="param.startTime!=null and param.startTime!=''">
|
||||
AND a.upload_date >=CONCAT(DATE_FORMAT(#{param.startTime},'%Y-%m-%d'),' 00:00:00')
|
||||
<if test="param.startTime != null and param.startTime != ''">
|
||||
AND a.upload_date >= CONCAT(DATE_FORMAT(#{param.startTime}, '%Y-%m-%d'), ' 00:00:00')
|
||||
</if>
|
||||
<if test="param.endTime!=null and param.endTime!=''">
|
||||
AND a.upload_date <=CONCAT(DATE_FORMAT(#{param.endTime},'%Y-%m-%d'),' 23:59:59')
|
||||
<if test="param.endTime != null and param.endTime != ''">
|
||||
AND a.upload_date <= CONCAT(DATE_FORMAT(#{param.endTime}, '%Y-%m-%d'), ' 23:59:59')
|
||||
</if>
|
||||
order by a.upload_date desc
|
||||
</select>
|
||||
|
||||
<select id="getRealTimeDustNoiseDataList"
|
||||
resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData">
|
||||
SELECT dnd.* FROM dust_noise_data dnd,( SELECT device_id, max( id ) maxId FROM `dust_noise_data` where project_sn = #{projectSn} GROUP BY device_id ) temp
|
||||
SELECT dnd.*
|
||||
FROM dust_noise_data dnd,
|
||||
(SELECT device_id, max(id) maxId
|
||||
FROM `dust_noise_data`
|
||||
where project_sn = #{projectSn}
|
||||
and dnd.device_id = temp.device_id
|
||||
AND dnd.id = temp.maxId
|
||||
GROUP BY device_id) temp
|
||||
where project_sn = #{projectSn}
|
||||
and dnd.device_id = temp.device_id
|
||||
AND dnd.id = temp.maxId
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="listExportXls" resultType="com.zhgd.xmgl.modules.environment.entity.DustNoiseData">
|
||||
select dnd.*, ed.device_name
|
||||
from dust_noise_data dnd
|
||||
inner join environment_dev ed on ed.device_id = dnd.device_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,11 +1,15 @@
|
||||
package com.zhgd.xmgl.modules.environment.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.environment.entity.DustNoiseData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -26,4 +30,5 @@ public interface IDustNoiseDataService extends IService<DustNoiseData> {
|
||||
void insertDustNoiseData(DustNoiseData dustNoiseData, EnvironmentDev environmentDev);
|
||||
|
||||
IPage<EntityMap> selectDustNoisePageList(Map<String, Object> map);
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.async.AsyncEnvironment;
|
||||
import com.zhgd.xmgl.modules.environment.entity.DustNoiseData;
|
||||
import com.zhgd.xmgl.modules.environment.entity.EnvironmentDev;
|
||||
@ -20,15 +21,50 @@ import com.zhgd.xmgl.util.MessageUtil;
|
||||
import com.zhgd.xmgl.util.WindDirectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.environment.entity.DustNoiseData;
|
||||
import com.zhgd.xmgl.modules.environment.service.IDustNoiseDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 扬尘噪声实时数据
|
||||
* @author: pds
|
||||
|
||||
@ -61,7 +61,7 @@ public class GtMaterialAcceptanceCheck implements Serializable {
|
||||
*/
|
||||
@Excel(name = "验收状态", width = 15)
|
||||
@ApiModelProperty(value = "验收状态")
|
||||
private java.lang.Integer acceptanceStatus;
|
||||
private java.lang.String acceptanceStatus;
|
||||
/**
|
||||
* 检测报告
|
||||
*/
|
||||
|
||||
@ -15,6 +15,7 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@ -22,7 +23,7 @@ import java.util.*;
|
||||
* @Title: Controller
|
||||
* @Description: 项目文件档案
|
||||
* @author: pds
|
||||
* @date: 2021-01-11
|
||||
* @date: 2021-01-11
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@ -30,82 +31,80 @@ import java.util.*;
|
||||
@Slf4j
|
||||
@Api("ProjectFileController相关Api")
|
||||
public class ProjectFileController {
|
||||
@Autowired
|
||||
private IProjectFileService projectFileService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 列表查询项目文件档案信息", notes = "列表查询项目文件档案信息", httpMethod="POST")
|
||||
@Autowired
|
||||
private IProjectFileService projectFileService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = " 列表查询项目文件档案信息", notes = "列表查询项目文件档案信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "filePath", value = "路径", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "filePath", value = "路径", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/list")
|
||||
public Result<List<ProjectFile>> getFileList(@RequestBody Map<String,Object> map) {
|
||||
QueryWrapper<ProjectFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map,"projectSn"))
|
||||
.eq(ProjectFile::getFilePath, MapUtils.getString(map,"filePath"));
|
||||
queryWrapper.orderByAsc("is_dir");
|
||||
List<ProjectFile> list=projectFileService.list(queryWrapper);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param projectFile
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "项目文件管理",operType = "添加项目文件档案",operDesc = "添加项目文件档案")
|
||||
@ApiOperation(value = " 添加项目文件档案信息", notes = "添加项目文件档案信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<ProjectFile> add(@RequestBody ProjectFile projectFile) {
|
||||
@PostMapping(value = "/list")
|
||||
public Result<List<ProjectFile>> getFileList(@RequestBody ProjectFile projectFile, HttpServletRequest request) {
|
||||
return projectFileService.getFileList(projectFile, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param projectFile
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "项目文件管理", operType = "添加项目文件档案", operDesc = "添加项目文件档案")
|
||||
@ApiOperation(value = " 添加项目文件档案信息", notes = "添加项目文件档案信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<ProjectFile> add(@RequestBody ProjectFile projectFile) {
|
||||
projectFileService.addProjectFile(projectFile);
|
||||
return Result.ok();
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param projectFile
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "项目文件管理",operType = "文件重命名",operDesc = "文件重命名")
|
||||
@ApiOperation(value = "文件重命名", notes = "文件重命名" , httpMethod="POST")
|
||||
@PostMapping(value = "/renameFile")
|
||||
public Result<ProjectFile> edit(@RequestBody ProjectFile projectFile) {
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param projectFile
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "项目文件管理", operType = "文件重命名", operDesc = "文件重命名")
|
||||
@ApiOperation(value = "文件重命名", notes = "文件重命名", httpMethod = "POST")
|
||||
@PostMapping(value = "/renameFile")
|
||||
public Result<ProjectFile> edit(@RequestBody ProjectFile projectFile) {
|
||||
projectFileService.renamefile(projectFile);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperLog(operModul = "项目文件管理",operType = "批量删除文件",operDesc = "批量删除文件")
|
||||
@ApiOperation(value = "批量删除文件", notes = "批量删除文件" , httpMethod="POST")
|
||||
@OperLog(operModul = "项目文件管理", operType = "批量删除文件", operDesc = "批量删除文件")
|
||||
@ApiOperation(value = "批量删除文件", notes = "批量删除文件", httpMethod = "POST")
|
||||
@RequestMapping(value = "/batchDeleteFile", method = RequestMethod.POST)
|
||||
public Result<String> batchDeleteFile(@RequestBody List<ProjectFile> list) {
|
||||
projectFileService.batchDeleteFile(list);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "项目文件管理",operType = "删除文件",operDesc = "删除文件")
|
||||
@ApiOperation(value = "删除文件", notes = "可以删除文件或者目录" , httpMethod="POST")
|
||||
@OperLog(operModul = "项目文件管理", operType = "删除文件", operDesc = "删除文件")
|
||||
@ApiOperation(value = "删除文件", notes = "可以删除文件或者目录", httpMethod = "POST")
|
||||
@RequestMapping(value = "/deleteFile", method = RequestMethod.POST)
|
||||
public Result<String> deleteFile(@RequestBody ProjectFile projectFile) {
|
||||
projectFileService.deleteFile(projectFile);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "项目文件管理",operType = "文件移动",operDesc = "文件移动")
|
||||
@ApiOperation(value = "文件移动", notes = "可以移动文件或者目录" , httpMethod="POST")
|
||||
@OperLog(operModul = "项目文件管理", operType = "文件移动", operDesc = "文件移动")
|
||||
@ApiOperation(value = "文件移动", notes = "可以移动文件或者目录", httpMethod = "POST")
|
||||
@RequestMapping(value = "/moveFile", method = RequestMethod.POST)
|
||||
public Result<String> moveFile(@RequestBody ProjectFile projectFile) {
|
||||
projectFileService.moveFile(projectFile);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "项目文件管理",operType = "批量文件移动",operDesc = "批量文件移动")
|
||||
@ApiOperation(value = "文件移动", notes = "可以移动文件或者目录" , httpMethod="POST")
|
||||
@OperLog(operModul = "项目文件管理", operType = "批量文件移动", operDesc = "批量文件移动")
|
||||
@ApiOperation(value = "文件移动", notes = "可以移动文件或者目录", httpMethod = "POST")
|
||||
@RequestMapping(value = "/batchmovefile", method = RequestMethod.POST)
|
||||
public Result<String> batchMoveFile(@RequestBody List<ProjectFile> list) {
|
||||
for (ProjectFile projectFile : list) {
|
||||
@ -114,36 +113,36 @@ public class ProjectFileController {
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = " 获取文件树", notes = "文件移动的时候需要用到该接口,用来展示目录树,展示机制为饱汉模式", httpMethod="POST")
|
||||
@ApiOperation(value = " 获取文件树", notes = "文件移动的时候需要用到该接口,用来展示目录树,展示机制为饱汉模式", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/getFileTree")
|
||||
public Result<TreeNode> getFileTree(@RequestBody Map<String,Object> map){
|
||||
public Result<TreeNode> getFileTree(@RequestBody Map<String, Object> map) {
|
||||
Result<TreeNode> result = new Result<TreeNode>();
|
||||
QueryWrapper<ProjectFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map,"projectSn"))
|
||||
.eq(ProjectFile::getIsDir,"1");
|
||||
List<ProjectFile> filePathList=projectFileService.list(queryWrapper);
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map, "projectSn"))
|
||||
.eq(ProjectFile::getIsDir, "1");
|
||||
List<ProjectFile> filePathList = projectFileService.list(queryWrapper);
|
||||
|
||||
TreeNode resultTreeNode = new TreeNode();
|
||||
resultTreeNode.setLabel("/");
|
||||
long treeid = 0;
|
||||
for (int i = 0; i < filePathList.size(); i++){
|
||||
for (int i = 0; i < filePathList.size(); i++) {
|
||||
String filePath = filePathList.get(i).getFilePath() + filePathList.get(i).getFileName() + "/";
|
||||
|
||||
Queue<String> queue = new LinkedList<>();
|
||||
|
||||
String[] strArr = filePath.split("/");
|
||||
for (int j = 0; j < strArr.length; j++){
|
||||
if (!"".equals(strArr[j]) && strArr[j] != null){
|
||||
for (int j = 0; j < strArr.length; j++) {
|
||||
if (!"".equals(strArr[j]) && strArr[j] != null) {
|
||||
queue.add(strArr[j]);
|
||||
}
|
||||
}
|
||||
if (queue.size() == 0){
|
||||
if (queue.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
resultTreeNode = insertTreeNode(resultTreeNode,"/", queue,treeid);
|
||||
resultTreeNode = insertTreeNode(resultTreeNode, "/", queue, treeid);
|
||||
|
||||
|
||||
}
|
||||
@ -152,51 +151,51 @@ public class ProjectFileController {
|
||||
return result;
|
||||
}
|
||||
|
||||
public TreeNode insertTreeNode(TreeNode treeNode, String filePath, Queue<String> nodeNameQueue,long treeid){
|
||||
public TreeNode insertTreeNode(TreeNode treeNode, String filePath, Queue<String> nodeNameQueue, long treeid) {
|
||||
|
||||
List<TreeNode> childrenTreeNodes = treeNode.getChildren();
|
||||
String currentNodeName = nodeNameQueue.peek();
|
||||
if (currentNodeName == null){
|
||||
if (currentNodeName == null) {
|
||||
return treeNode;
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
filePath = filePath + currentNodeName + "/";
|
||||
map.put("filePath", filePath);
|
||||
if (!isExistPath(childrenTreeNodes, currentNodeName)){ //1、判断有没有该子节点,如果没有则插入
|
||||
if (!isExistPath(childrenTreeNodes, currentNodeName)) { //1、判断有没有该子节点,如果没有则插入
|
||||
//插入
|
||||
TreeNode resultTreeNode = new TreeNode();
|
||||
resultTreeNode.setAttributes(map);
|
||||
resultTreeNode.setLabel(nodeNameQueue.poll());
|
||||
resultTreeNode.setId(treeid++);
|
||||
childrenTreeNodes.add(resultTreeNode);
|
||||
}else{ //2、如果有,则跳过
|
||||
} else { //2、如果有,则跳过
|
||||
nodeNameQueue.poll();
|
||||
}
|
||||
if (nodeNameQueue.size() != 0) {
|
||||
for (int i = 0; i < childrenTreeNodes.size(); i++) {
|
||||
TreeNode childrenTreeNode = childrenTreeNodes.get(i);
|
||||
if (currentNodeName.equals(childrenTreeNode.getLabel())){
|
||||
childrenTreeNode = insertTreeNode(childrenTreeNode, filePath, nodeNameQueue,treeid);
|
||||
if (currentNodeName.equals(childrenTreeNode.getLabel())) {
|
||||
childrenTreeNode = insertTreeNode(childrenTreeNode, filePath, nodeNameQueue, treeid);
|
||||
childrenTreeNodes.remove(i);
|
||||
childrenTreeNodes.add(childrenTreeNode);
|
||||
treeNode.setChildren(childrenTreeNodes);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
treeNode.setChildren(childrenTreeNodes);
|
||||
}
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
public boolean isExistPath(List<TreeNode> childrenTreeNodes, String path){
|
||||
public boolean isExistPath(List<TreeNode> childrenTreeNodes, String path) {
|
||||
boolean isExistPath = false;
|
||||
try {
|
||||
for (int i = 0; i < childrenTreeNodes.size(); i++){
|
||||
if (path.equals(childrenTreeNodes.get(i).getLabel())){
|
||||
for (int i = 0; i < childrenTreeNodes.size(); i++) {
|
||||
if (path.equals(childrenTreeNodes.get(i).getLabel())) {
|
||||
isExistPath = true;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isExistPath;
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
package com.zhgd.xmgl.modules.project.service;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.xmgl.modules.file.entity.ProjectFile;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -22,4 +24,6 @@ public interface IProjectFileService extends IService<ProjectFile> {
|
||||
void deleteFile(ProjectFile projectFile);
|
||||
|
||||
void moveFile(ProjectFile projectFile);
|
||||
|
||||
Result<List<ProjectFile>> getFileList(ProjectFile projectFile, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@ -2,15 +2,20 @@ package com.zhgd.xmgl.modules.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.file.entity.ProjectFile;
|
||||
import com.zhgd.xmgl.modules.file.mapper.ProjectFileMapper;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectFileService;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import com.zhgd.xmgl.util.ReflectionUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -18,7 +23,7 @@ import java.util.List;
|
||||
/**
|
||||
* @Description: 项目文件档案
|
||||
* @author: pds
|
||||
* @date: 2021-01-11
|
||||
* @date: 2021-01-11
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -29,17 +34,17 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
||||
|
||||
@Override
|
||||
public void addProjectFile(ProjectFile projectFile) {
|
||||
QueryWrapper<ProjectFile> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn,projectFile.getProjectSn())
|
||||
.eq(ProjectFile::getFileName,projectFile.getFileName())
|
||||
.eq(ProjectFile::getFilePath,projectFile.getFilePath())
|
||||
.eq(ProjectFile::getIsDir,projectFile.getIsDir());
|
||||
int count=projectFileMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
if(projectFile.getIsDir()==1){
|
||||
throw new OpenAlertException(MessageUtil.get("nameExistErr"));
|
||||
}else{
|
||||
projectFile.setFileName(projectFile.getFileName()+"(1)");
|
||||
QueryWrapper<ProjectFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, projectFile.getProjectSn())
|
||||
.eq(ProjectFile::getFileName, projectFile.getFileName())
|
||||
.eq(ProjectFile::getFilePath, projectFile.getFilePath())
|
||||
.eq(ProjectFile::getIsDir, projectFile.getIsDir());
|
||||
int count = projectFileMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
if (projectFile.getIsDir() == 1) {
|
||||
throw new OpenAlertException(MessageUtil.get("nameExistErr"));
|
||||
} else {
|
||||
projectFile.setFileName(projectFile.getFileName() + "(1)");
|
||||
}
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -49,32 +54,32 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
||||
|
||||
@Override
|
||||
public void renamefile(ProjectFile projectFile) {
|
||||
ProjectFile oldProjectFile=projectFileMapper.selectById(projectFile.getFileId());
|
||||
QueryWrapper<ProjectFile> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn,oldProjectFile.getProjectSn())
|
||||
.eq(ProjectFile::getFileName,projectFile.getFileName())
|
||||
.eq(ProjectFile::getFilePath,oldProjectFile.getFilePath())
|
||||
.eq(ProjectFile::getIsDir,oldProjectFile.getIsDir());
|
||||
int count=projectFileMapper.selectCount(queryWrapper);
|
||||
if(count>0){
|
||||
if(projectFile.getIsDir()==1){
|
||||
throw new OpenAlertException(MessageUtil.get("nameExistErr"));
|
||||
}else{
|
||||
projectFile.setFileName(projectFile.getFileName()+"(1)");
|
||||
ProjectFile oldProjectFile = projectFileMapper.selectById(projectFile.getFileId());
|
||||
QueryWrapper<ProjectFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, oldProjectFile.getProjectSn())
|
||||
.eq(ProjectFile::getFileName, projectFile.getFileName())
|
||||
.eq(ProjectFile::getFilePath, oldProjectFile.getFilePath())
|
||||
.eq(ProjectFile::getIsDir, oldProjectFile.getIsDir());
|
||||
int count = projectFileMapper.selectCount(queryWrapper);
|
||||
if (count > 0) {
|
||||
if (projectFile.getIsDir() == 1) {
|
||||
throw new OpenAlertException(MessageUtil.get("nameExistErr"));
|
||||
} else {
|
||||
projectFile.setFileName(projectFile.getFileName() + "(1)");
|
||||
}
|
||||
}
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time=df.format(new Date());
|
||||
String time = df.format(new Date());
|
||||
if (1 == oldProjectFile.getIsDir()) {
|
||||
ProjectFile newProjectFile=new ProjectFile();
|
||||
ProjectFile newProjectFile = new ProjectFile();
|
||||
newProjectFile.setFileId(oldProjectFile.getFileId());
|
||||
newProjectFile.setUploadTime(time);
|
||||
newProjectFile.setFileName(projectFile.getFileName());
|
||||
projectFileMapper.updateById(newProjectFile);
|
||||
projectFileMapper.replaceProjectFilePath(oldProjectFile.getFilePath() + projectFile.getFileName() + "/",
|
||||
oldProjectFile.getFilePath() + oldProjectFile.getFileName() + "/", oldProjectFile.getProjectSn());
|
||||
}else{
|
||||
ProjectFile newProjectFile=new ProjectFile();
|
||||
} else {
|
||||
ProjectFile newProjectFile = new ProjectFile();
|
||||
newProjectFile.setFileId(oldProjectFile.getFileId());
|
||||
newProjectFile.setUploadTime(time);
|
||||
newProjectFile.setFileName(projectFile.getFileName());
|
||||
@ -91,22 +96,22 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
||||
|
||||
@Override
|
||||
public void deleteFile(ProjectFile projectFile) {
|
||||
ProjectFile oldProjectFile=projectFileMapper.selectById(projectFile.getFileId());
|
||||
ProjectFile oldProjectFile = projectFileMapper.selectById(projectFile.getFileId());
|
||||
if (1 == oldProjectFile.getIsDir()) {
|
||||
String filePath = oldProjectFile.getFilePath() + oldProjectFile.getFileName() + "/";
|
||||
QueryWrapper<ProjectFile> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn,oldProjectFile.getProjectSn())
|
||||
QueryWrapper<ProjectFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectFile::getProjectSn, oldProjectFile.getProjectSn())
|
||||
.likeRight(ProjectFile::getFilePath, filePath);
|
||||
projectFileMapper.delete(queryWrapper);
|
||||
projectFileMapper.deleteById(projectFile.getFileId());
|
||||
}else{
|
||||
} else {
|
||||
projectFileMapper.deleteById(projectFile.getFileId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveFile(ProjectFile projectFile) {
|
||||
ProjectFile oldProjectFile=projectFileMapper.selectById(projectFile.getFileId());
|
||||
ProjectFile oldProjectFile = projectFileMapper.selectById(projectFile.getFileId());
|
||||
//移动根目录
|
||||
projectFileMapper.updateFilepathByPathAndName(projectFile);
|
||||
if (1 == oldProjectFile.getIsDir()) {
|
||||
@ -120,4 +125,20 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
|
||||
projectFileMapper.updateFilepathByFilepath(oldfilePath, newfilePath, oldProjectFile.getProjectSn());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getFileList(ProjectFile projectFile, HttpServletRequest request) {
|
||||
if (StringUtils.isBlank(projectFile.getProjectSn())) {
|
||||
return Result.error("projectSn不能为空");
|
||||
}
|
||||
//搜索文件名时,不用按目录路径查询
|
||||
if (StringUtils.isNotBlank(projectFile.getFileName())) {
|
||||
projectFile.setFilePath(null);
|
||||
}
|
||||
QueryWrapper<ProjectFile> queryWrapper = QueryGenerator.initQueryWrapper(projectFile, request.getParameterMap(), null,
|
||||
ReflectionUtil.getFieldNameList(ProjectFile::getFileName));
|
||||
queryWrapper.orderByAsc("is_dir");
|
||||
List<ProjectFile> list = list(queryWrapper);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,10 +33,9 @@ import java.util.Map;
|
||||
public class WaterMeterMonthRecordController {
|
||||
@Autowired
|
||||
private IWaterMeterMonthRecordService waterMeterMonthRecordService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param waterMeterMonthRecord
|
||||
* @return
|
||||
@ -70,13 +69,24 @@ public class WaterMeterMonthRecordController {
|
||||
|
||||
@ApiOperation(value = " 查询水表每月实时数据", notes = "查询水表每月实时数据" , httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="waterMeterNo",value="水表号",dataType = "String",paramType = "query",required =true),
|
||||
@ApiImplicitParam(name="yearTime",value="年份",dataType = "String",paramType = "query",required =true),
|
||||
@ApiImplicitParam(name = "waterMeterNo", value = "水表号", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "yearTime", value = "年份", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectWaterMeterStatistics")
|
||||
public Result<Map<String,Object>> selectWaterMeterStatistics(@RequestBody Map<String,Object> map) {
|
||||
public Result<Map<String, Object>> selectWaterMeterStatistics(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(waterMeterMonthRecordService.selectWaterMeterStatistics(map));
|
||||
}
|
||||
|
||||
}
|
||||
@ApiOperation(value = " 查询某年水表用水量和报警(按月份统计)", notes = "查询某年水表用水量和报警(按月份统计)", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "waterMeterNo", value = "水表号", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "yearTime", value = "年份", dataType = "String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
})
|
||||
@PostMapping(value = "/selectWaterMeterStatisticsByYear")
|
||||
public Result<Map<String, Object>> selectWaterMeterStatisticsByYear(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(waterMeterMonthRecordService.selectWaterMeterStatisticsByYear(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,4 +17,5 @@ public interface IWaterMeterMonthRecordService extends IService<WaterMeterMonthR
|
||||
|
||||
Map<String,Object> selectWaterMeterStatistics(Map<String, Object> map);
|
||||
|
||||
Map<String, Object> selectWaterMeterStatisticsByYear(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.water.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.water.entity.WaterMeter;
|
||||
import com.zhgd.xmgl.modules.water.entity.WaterMeterMonthRecord;
|
||||
@ -12,20 +13,16 @@ import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 水表每月用水记录
|
||||
* @author: pds
|
||||
* @date: 2020-12-04
|
||||
* @date: 2020-12-04
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -40,37 +37,92 @@ public class WaterMeterMonthRecordServiceImpl extends ServiceImpl<WaterMeterMont
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCurrentMonthMeterRecord(Map<String, Object> map) {
|
||||
Map<String, Object> data=new HashMap<>();
|
||||
QueryWrapper<WaterMeter> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(WaterMeter::getProjectSn, MapUtils.getString(map,"projectSn"))
|
||||
.eq(WaterMeter::getWaterMeterNo,MapUtils.getString(map,"waterMeterNo"));
|
||||
WaterMeter waterMeter=waterMeterMapper.selectOne(queryWrapper);
|
||||
data.put("waterMeter",waterMeter);
|
||||
EntityMap count=waterMeterMonthRecordMapper.getCurrentMonthMeterRecord(map);
|
||||
data.put("count",count);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
QueryWrapper<WaterMeter> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(WaterMeter::getProjectSn, MapUtils.getString(map, "projectSn"))
|
||||
.eq(WaterMeter::getWaterMeterNo, MapUtils.getString(map, "waterMeterNo"));
|
||||
WaterMeter waterMeter = waterMeterMapper.selectOne(queryWrapper);
|
||||
data.put("waterMeter", waterMeter);
|
||||
EntityMap count = waterMeterMonthRecordMapper.getCurrentMonthMeterRecord(map);
|
||||
data.put("count", count);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectWaterMeterStatistics(Map<String, Object> map) {
|
||||
Map<String, Object> data=new HashMap<>();
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy");
|
||||
String currentYear=sft.format(new Date());
|
||||
String yearTime=MapUtils.getString(map,"yearTime");
|
||||
if(StringUtils.isEmpty(yearTime)){
|
||||
yearTime=currentYear;
|
||||
String currentYear = sft.format(new Date());
|
||||
String yearTime = MapUtils.getString(map, "yearTime");
|
||||
if (StringUtils.isEmpty(yearTime)) {
|
||||
yearTime = currentYear;
|
||||
}
|
||||
List<Map<String, Object>> monthWaterList=waterMeterMonthRecordMapper.selectWaterMeterMonthList(map);
|
||||
map.put("yearTime",yearTime);
|
||||
if(currentYear.equals(yearTime)){
|
||||
Map<String, Object> currentMap=waterMeterMonthRecordMapper.selectCurrentWaterMeterMontRecord(map);
|
||||
if(monthWaterList!=null&¤tMap!=null){
|
||||
List<Map<String, Object>> monthWaterList = waterMeterMonthRecordMapper.selectWaterMeterMonthList(map);
|
||||
map.put("yearTime", yearTime);
|
||||
if (currentYear.equals(yearTime)) {
|
||||
Map<String, Object> currentMap = waterMeterMonthRecordMapper.selectCurrentWaterMeterMontRecord(map);
|
||||
if (monthWaterList != null && currentMap != null) {
|
||||
monthWaterList.add(currentMap);
|
||||
}
|
||||
}
|
||||
data.put("monthWaterList",monthWaterList);
|
||||
List<Map<String, Object>> alarmList=waterMeterAlarmMapper.selectAlarmTotalList(map);
|
||||
data.put("alarmList",alarmList);
|
||||
data.put("monthWaterList", monthWaterList);
|
||||
List<Map<String, Object>> alarmList = waterMeterAlarmMapper.selectAlarmTotalList(map);
|
||||
data.put("alarmList", alarmList);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectWaterMeterStatisticsByYear(Map<String, Object> map) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy");
|
||||
String currentYear = sft.format(new Date());
|
||||
String yearTime = MapUtils.getString(map, "yearTime");
|
||||
if (StringUtils.isEmpty(yearTime)) {
|
||||
yearTime = currentYear;
|
||||
}
|
||||
List<Map<String, Object>> monthWaterList = waterMeterMonthRecordMapper.selectWaterMeterMonthList(map);
|
||||
map.put("yearTime", yearTime);
|
||||
data.put("monthWaterList", waterSequenceMonthOneYear(monthWaterList, yearTime));
|
||||
List<Map<String, Object>> alarmList = waterMeterAlarmMapper.selectAlarmTotalList(map);
|
||||
data.put("alarmList", alarmSequenceMonthOneYear(alarmList, yearTime));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> alarmSequenceMonthOneYear(List<Map<String, Object>> alarmList, String yearTime) {
|
||||
ArrayList<String> sequenceMonth = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
sequenceMonth.add(yearTime + "-" + String.format("%02d", i));
|
||||
}
|
||||
String monthTime = "titleTime";
|
||||
String num = "num";
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
Map<String, Double> dataMap = alarmList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, num)));
|
||||
for (String s : sequenceMonth) {
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put(monthTime, s);
|
||||
m.put("num", dataMap.get(s) != null ? dataMap.get(s) : 0.0);
|
||||
listMap.add(m);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> waterSequenceMonthOneYear(List<Map<String, Object>> monthWaterList, String yearTime) {
|
||||
ArrayList<String> sequenceMonth = new ArrayList<>();
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
sequenceMonth.add(yearTime + "-" + String.format("%02d", i));
|
||||
}
|
||||
String monthTime = "monthTime";
|
||||
String waterTonnage = "waterTonnage";
|
||||
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||
Map<String, Double> dataMap = monthWaterList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, waterTonnage)));
|
||||
for (String s : sequenceMonth) {
|
||||
HashMap<String, Object> m = new HashMap<>();
|
||||
m.put(monthTime, s);
|
||||
m.put("waterTonnage", dataMap.get(s) != null ? dataMap.get(s) : 0.0);
|
||||
listMap.add(m);
|
||||
}
|
||||
return listMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,49 +1,65 @@
|
||||
package com.zhgd.xmgl.modules.worker.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 劳务人员部门
|
||||
* @author: pds
|
||||
* @date: 2020-08-13
|
||||
* @date: 2020-08-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("department_info")
|
||||
@ApiModel(value="DepartmentInfo实体类",description="DepartmentInfo")
|
||||
@ApiModel(value = "DepartmentInfo实体类", description = "DepartmentInfo")
|
||||
public class DepartmentInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
private java.lang.Long id ;
|
||||
/**部门名称*/
|
||||
@Excel(name = "部门名称", width = 15)
|
||||
@ApiModelProperty(value="部门名称")
|
||||
private java.lang.String departmentName ;
|
||||
/**项目Sn*/
|
||||
@Excel(name = "项目Sn", width = 15)
|
||||
@ApiModelProperty(value="项目Sn")
|
||||
private java.lang.String projectSn ;
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@Excel(name = "部门名称", width = 15)
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private java.lang.String departmentName;
|
||||
/**
|
||||
* 项目Sn
|
||||
*/
|
||||
@Excel(name = "项目Sn", width = 15)
|
||||
@ApiModelProperty(value = "项目Sn")
|
||||
private java.lang.String projectSn;
|
||||
|
||||
/**所属企业id*/
|
||||
/**
|
||||
* 所属企业id
|
||||
*/
|
||||
@Excel(name = "所属企业id", width = 15)
|
||||
@ApiModelProperty(value="所属企业id")
|
||||
|
||||
@ApiModelProperty(value = "所属企业id")
|
||||
private java.lang.Long enterpriseId;
|
||||
|
||||
@ApiModelProperty(value = "负责人姓名")
|
||||
private java.lang.String chargePersonName;
|
||||
@ApiModelProperty(value = "负责人身份证")
|
||||
private java.lang.String chargePersonIdcard;
|
||||
@ApiModelProperty(value = "负责人电话")
|
||||
private java.lang.String chargePersonPhone;
|
||||
@ApiModelProperty(value = "所属标段")
|
||||
private java.lang.String belongingSection;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value="人员数量")
|
||||
private java.lang.Integer workerNum ;
|
||||
@ApiModelProperty(value = "人员数量")
|
||||
private java.lang.Integer workerNum;
|
||||
}
|
||||
|
||||
@ -36,6 +36,12 @@
|
||||
LEFT JOIN dictionaries_record e ON a.job_name = e.id
|
||||
LEFT JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||
WHERE 1 = 1
|
||||
<if test="param.chargePersonName != null and param.chargePersonName != ''">
|
||||
and c.charge_person_name like CONCAT(CONCAT('%',#{param.chargePersonName}),'%')
|
||||
</if>
|
||||
<if test="param.belongingSection != null and param.belongingSection != ''">
|
||||
and c.belonging_section like CONCAT(CONCAT('%',#{param.belongingSection}),'%')
|
||||
</if>
|
||||
<if test="param.projectSn != null and param.projectSn != ''">
|
||||
and a.project_sn = #{param.projectSn}
|
||||
</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user