From 03d7cfe1ac71d1a0ef2a95e6b52ec747c64e7c8f Mon Sep 17 00:00:00 2001 From: Administrator <1923636941@qq.com> Date: Sat, 6 May 2023 18:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=B1=9F-=E6=A0=87=E5=87=86=E7=89=88-?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/system/query/QueryGenerator.java | 2 +- .../AmmeterMonthRecordController.java | 26 +- .../service/IAmmeterMonthRecordService.java | 8 +- .../impl/AmmeterMonthRecordServiceImpl.java | 104 ++++++-- ...BigDevicesMaintenanceRecordController.java | 45 ++-- .../entity/BigDevicesMaintenanceRecord.java | 141 ++++++----- .../xml/BigDevicesMaintenanceRecordMapper.xml | 11 +- .../controller/DustNoiseDataController.java | 30 +++ .../environment/entity/DustNoiseData.java | 224 +++++++++++------- .../mapper/DustNoiseDataMapper.java | 4 + .../mapper/xml/DustNoiseDataMapper.xml | 111 +++++---- .../service/IDustNoiseDataService.java | 5 + .../impl/DustNoiseDataServiceImpl.java | 36 +++ .../gt/entity/GtMaterialAcceptanceCheck.java | 2 +- .../controller/ProjectFileController.java | 139 ++++++----- .../project/service/IProjectFileService.java | 4 + .../service/impl/ProjectFileServiceImpl.java | 87 ++++--- .../WaterMeterMonthRecordController.java | 24 +- .../IWaterMeterMonthRecordService.java | 1 + .../WaterMeterMonthRecordServiceImpl.java | 108 ++++++--- .../modules/worker/entity/DepartmentInfo.java | 66 ++++-- .../worker/mapper/xml/WorkerInfoMapper.xml | 6 + 22 files changed, 762 insertions(+), 422 deletions(-) diff --git a/src/main/java/com/zhgd/jeecg/common/system/query/QueryGenerator.java b/src/main/java/com/zhgd/jeecg/common/system/query/QueryGenerator.java index 86d25ac2b..e2f9f2419 100644 --- a/src/main/java/com/zhgd/jeecg/common/system/query/QueryGenerator.java +++ b/src/main/java/com/zhgd/jeecg/common/system/query/QueryGenerator.java @@ -85,7 +85,7 @@ public class QueryGenerator { public static QueryWrapper initQueryWrapper(T searchObj, Map parameterMap, List excludeFields, List likeFields) { - return initQueryWrapper(searchObj, parameterMap, excludeFields, null, false, null); + return initQueryWrapper(searchObj, parameterMap, excludeFields, likeFields, false, null); } /** diff --git a/src/main/java/com/zhgd/xmgl/modules/ammeter/controller/AmmeterMonthRecordController.java b/src/main/java/com/zhgd/xmgl/modules/ammeter/controller/AmmeterMonthRecordController.java index 8bd9accc7..0454da171 100644 --- a/src/main/java/com/zhgd/xmgl/modules/ammeter/controller/AmmeterMonthRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/ammeter/controller/AmmeterMonthRecordController.java @@ -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> selectAmmeterStatisticsList(@RequestBody Map map) { + public Result> selectAmmeterStatisticsList(@RequestBody Map 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> selectAmmeterStatisticsListByYear(@RequestBody Map map) { + return Result.success(ammeterMonthRecordService.selectAmmeterStatisticsListByYear(map)); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/IAmmeterMonthRecordService.java b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/IAmmeterMonthRecordService.java index a806434df..65255a73b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/IAmmeterMonthRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/IAmmeterMonthRecordService.java @@ -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 { - Map getCurrentMonthMeterRecord(Map map); + Map getCurrentMonthMeterRecord(Map map); - Map selectAmmeterStatisticsList(Map map); + Map selectAmmeterStatisticsList(Map map); + + Map selectAmmeterStatisticsListByYear(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterMonthRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterMonthRecordServiceImpl.java index a7035d869..11eff864f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterMonthRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/ammeter/service/impl/AmmeterMonthRecordServiceImpl.java @@ -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 getCurrentMonthMeterRecord(Map map) { - Map data=new HashMap<>(); - QueryWrapper 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 data = new HashMap<>(); + QueryWrapper 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 selectAmmeterStatisticsList(Map map) { - Map data=new HashMap<>(); + Map 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> monthWaterList=ammeterMonthRecordMapper.selectAmmeterMonthList(map); - map.put("yearTime",yearTime); - if(currentYear.equals(yearTime)){ - Map currentMap=ammeterMonthRecordMapper.selectCurrentAmmeterMontRecord(map); - if(monthWaterList!=null&¤tMap!=null){ + List> monthWaterList = ammeterMonthRecordMapper.selectAmmeterMonthList(map); + map.put("yearTime", yearTime); + if (currentYear.equals(yearTime)) { + Map currentMap = ammeterMonthRecordMapper.selectCurrentAmmeterMontRecord(map); + if (monthWaterList != null && currentMap != null) { monthWaterList.add(currentMap); } } - data.put("monthWaterList",monthWaterList); - List> alarmList=ammeterAlarmMapper.selectAmmeterAlarmTotalList(map); - data.put("alarmList",alarmList); + data.put("monthWaterList", monthWaterList); + List> alarmList = ammeterAlarmMapper.selectAmmeterAlarmTotalList(map); + data.put("alarmList", alarmList); return data; } + + @Override + public Map selectAmmeterStatisticsListByYear(Map map) { + Map 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> monthWaterList = ammeterMonthRecordMapper.selectAmmeterMonthList(map); + map.put("yearTime", yearTime); + data.put("monthWaterList", waterSequenceMonthOneYear(monthWaterList, yearTime)); + List> alarmList = ammeterAlarmMapper.selectAmmeterAlarmTotalList(map); + data.put("alarmList", alarmSequenceMonthOneYear(alarmList, yearTime)); + return data; + } + + + private List> alarmSequenceMonthOneYear(List> alarmList, String yearTime) { + ArrayList sequenceMonth = new ArrayList<>(); + for (int i = 1; i <= 12; i++) { + sequenceMonth.add(yearTime + "-" + String.format("%02d", i)); + } + String monthTime = "titleTime"; + String num = "num"; + List> listMap = new ArrayList<>(); + Map dataMap = alarmList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, num))); + for (String s : sequenceMonth) { + HashMap 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> waterSequenceMonthOneYear(List> monthWaterList, String yearTime) { + ArrayList sequenceMonth = new ArrayList<>(); + for (int i = 1; i <= 12; i++) { + sequenceMonth.add(yearTime + "-" + String.format("%02d", i)); + } + String monthTime = "monthTime"; + String useDegree = "useDegree"; + List> listMap = new ArrayList<>(); + Map dataMap = monthWaterList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, useDegree))); + for (String s : sequenceMonth) { + HashMap m = new HashMap<>(); + m.put(monthTime, s); + m.put(useDegree, dataMap.get(s) != null ? dataMap.get(s) : 0.0); + listMap.add(m); + } + return listMap; + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/BigDevicesMaintenanceRecordController.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/BigDevicesMaintenanceRecordController.java index b9426382e..1ae0ff211 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/BigDevicesMaintenanceRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/BigDevicesMaintenanceRecordController.java @@ -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> queryPageList(@RequestBody Map 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 diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/BigDevicesMaintenanceRecord.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/BigDevicesMaintenanceRecord.java index 157478770..403b67442 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/BigDevicesMaintenanceRecord.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/entity/BigDevicesMaintenanceRecord.java @@ -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; } diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/BigDevicesMaintenanceRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/BigDevicesMaintenanceRecordMapper.xml index 36f59a910..5fb4154ee 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/BigDevicesMaintenanceRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/mapper/xml/BigDevicesMaintenanceRecordMapper.xml @@ -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} - + and a.dev_sn=#{param.devSn} - + + and a.maintenance_time >= #{param.maintenanceStartTime} + + + and a.maintenance_time <= #{param.maintenanceEndTime} + - \ No newline at end of file + diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/controller/DustNoiseDataController.java b/src/main/java/com/zhgd/xmgl/modules/environment/controller/DustNoiseDataController.java index a318bbad0..08e1be891 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/controller/DustNoiseDataController.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/controller/DustNoiseDataController.java @@ -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 queryWrapper = QueryGenerator.initQueryWrapper(dustNoiseData, request.getParameterMap(), "dnd."); + + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List 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; + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/entity/DustNoiseData.java b/src/main/java/com/zhgd/xmgl/modules/environment/entity/DustNoiseData.java index b8fc5b35a..598e2e7b8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/entity/DustNoiseData.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/entity/DustNoiseData.java @@ -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; } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/mapper/DustNoiseDataMapper.java b/src/main/java/com/zhgd/xmgl/modules/environment/mapper/DustNoiseDataMapper.java index ce2b54bbe..6000ebf7a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/mapper/DustNoiseDataMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/mapper/DustNoiseDataMapper.java @@ -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 { List selectDustNoisePageList(Page page, @Param("param") Map map); List getRealTimeDustNoiseDataList(Map map); + + List listExportXls(@Param(Constants.WRAPPER) QueryWrapper queryWrapper, DustNoiseData dustNoiseData); } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/mapper/xml/DustNoiseDataMapper.xml b/src/main/java/com/zhgd/xmgl/modules/environment/mapper/xml/DustNoiseDataMapper.xml index acf5b67f4..4538035c6 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/mapper/xml/DustNoiseDataMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/environment/mapper/xml/DustNoiseDataMapper.xml @@ -1,92 +1,115 @@ - - delete from dust_noise_data + delete + from dust_noise_data where 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 - select * from - dust_noise_data + dust_noise_data dust_noise_history_data - 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') - - - + 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') + + + ORDER BY upload_date DESC - 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 - \ No newline at end of file + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/IDustNoiseDataService.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/IDustNoiseDataService.java index f11234cdd..0d5cf297f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/IDustNoiseDataService.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/IDustNoiseDataService.java @@ -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 { void insertDustNoiseData(DustNoiseData dustNoiseData, EnvironmentDev environmentDev); IPage selectDustNoisePageList(Map map); + } diff --git a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/DustNoiseDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/DustNoiseDataServiceImpl.java index f3a34ae3a..5c7913a2f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/DustNoiseDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/environment/service/impl/DustNoiseDataServiceImpl.java @@ -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 diff --git a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialAcceptanceCheck.java b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialAcceptanceCheck.java index 64edf6210..cbe707d42 100644 --- a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialAcceptanceCheck.java +++ b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialAcceptanceCheck.java @@ -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; /** * 检测报告 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/project/controller/ProjectFileController.java b/src/main/java/com/zhgd/xmgl/modules/project/controller/ProjectFileController.java index 44ed32b21..6555f6a71 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/controller/ProjectFileController.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/controller/ProjectFileController.java @@ -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> getFileList(@RequestBody Map map) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map,"projectSn")) - .eq(ProjectFile::getFilePath, MapUtils.getString(map,"filePath")); - queryWrapper.orderByAsc("is_dir"); - List 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 add(@RequestBody ProjectFile projectFile) { + @PostMapping(value = "/list") + public Result> 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 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 edit(@RequestBody ProjectFile projectFile) { + /** + * 编辑 + * + * @param projectFile + * @return + */ + @OperLog(operModul = "项目文件管理", operType = "文件重命名", operDesc = "文件重命名") + @ApiOperation(value = "文件重命名", notes = "文件重命名", httpMethod = "POST") + @PostMapping(value = "/renameFile") + public Result 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 batchDeleteFile(@RequestBody List 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 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 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 batchMoveFile(@RequestBody List 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 getFileTree(@RequestBody Map map){ + public Result getFileTree(@RequestBody Map map) { Result result = new Result(); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map,"projectSn")) - .eq(ProjectFile::getIsDir,"1"); - List filePathList=projectFileService.list(queryWrapper); + queryWrapper.lambda().eq(ProjectFile::getProjectSn, MapUtils.getString(map, "projectSn")) + .eq(ProjectFile::getIsDir, "1"); + List 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 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 nodeNameQueue,long treeid){ + public TreeNode insertTreeNode(TreeNode treeNode, String filePath, Queue nodeNameQueue, long treeid) { List childrenTreeNodes = treeNode.getChildren(); String currentNodeName = nodeNameQueue.peek(); - if (currentNodeName == null){ + if (currentNodeName == null) { return treeNode; } Map 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 childrenTreeNodes, String path){ + public boolean isExistPath(List 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; diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/IProjectFileService.java b/src/main/java/com/zhgd/xmgl/modules/project/service/IProjectFileService.java index 50a877e0b..a07bf2fd4 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/IProjectFileService.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/IProjectFileService.java @@ -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 { void deleteFile(ProjectFile projectFile); void moveFile(ProjectFile projectFile); + + Result> getFileList(ProjectFile projectFile, HttpServletRequest request); } diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectFileServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectFileServiceImpl.java index 75da1beaf..ace501833 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectFileServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProjectFileServiceImpl.java @@ -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 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 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 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 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 queryWrapper=new QueryWrapper<>(); - queryWrapper.lambda().eq(ProjectFile::getProjectSn,oldProjectFile.getProjectSn()) + QueryWrapper 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 queryWrapper = QueryGenerator.initQueryWrapper(projectFile, request.getParameterMap(), null, + ReflectionUtil.getFieldNameList(ProjectFile::getFileName)); + queryWrapper.orderByAsc("is_dir"); + List list = list(queryWrapper); + return Result.success(list); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/water/controller/WaterMeterMonthRecordController.java b/src/main/java/com/zhgd/xmgl/modules/water/controller/WaterMeterMonthRecordController.java index f3569e5d8..1cf3f8924 100644 --- a/src/main/java/com/zhgd/xmgl/modules/water/controller/WaterMeterMonthRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/water/controller/WaterMeterMonthRecordController.java @@ -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> selectWaterMeterStatistics(@RequestBody Map map) { + public Result> selectWaterMeterStatistics(@RequestBody Map 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> selectWaterMeterStatisticsByYear(@RequestBody Map map) { + return Result.success(waterMeterMonthRecordService.selectWaterMeterStatisticsByYear(map)); + } + + } diff --git a/src/main/java/com/zhgd/xmgl/modules/water/service/IWaterMeterMonthRecordService.java b/src/main/java/com/zhgd/xmgl/modules/water/service/IWaterMeterMonthRecordService.java index ba08d161b..bc8e6469b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/water/service/IWaterMeterMonthRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/water/service/IWaterMeterMonthRecordService.java @@ -17,4 +17,5 @@ public interface IWaterMeterMonthRecordService extends IService selectWaterMeterStatistics(Map map); + Map selectWaterMeterStatisticsByYear(Map map); } diff --git a/src/main/java/com/zhgd/xmgl/modules/water/service/impl/WaterMeterMonthRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/water/service/impl/WaterMeterMonthRecordServiceImpl.java index 9c29f0316..a3629374a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/water/service/impl/WaterMeterMonthRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/water/service/impl/WaterMeterMonthRecordServiceImpl.java @@ -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 getCurrentMonthMeterRecord(Map map) { - Map data=new HashMap<>(); - QueryWrapper 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 data = new HashMap<>(); + QueryWrapper 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 selectWaterMeterStatistics(Map map) { - Map data=new HashMap<>(); + Map 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> monthWaterList=waterMeterMonthRecordMapper.selectWaterMeterMonthList(map); - map.put("yearTime",yearTime); - if(currentYear.equals(yearTime)){ - Map currentMap=waterMeterMonthRecordMapper.selectCurrentWaterMeterMontRecord(map); - if(monthWaterList!=null&¤tMap!=null){ + List> monthWaterList = waterMeterMonthRecordMapper.selectWaterMeterMonthList(map); + map.put("yearTime", yearTime); + if (currentYear.equals(yearTime)) { + Map currentMap = waterMeterMonthRecordMapper.selectCurrentWaterMeterMontRecord(map); + if (monthWaterList != null && currentMap != null) { monthWaterList.add(currentMap); } } - data.put("monthWaterList",monthWaterList); - List> alarmList=waterMeterAlarmMapper.selectAlarmTotalList(map); - data.put("alarmList",alarmList); + data.put("monthWaterList", monthWaterList); + List> alarmList = waterMeterAlarmMapper.selectAlarmTotalList(map); + data.put("alarmList", alarmList); return data; } + + @Override + public Map selectWaterMeterStatisticsByYear(Map map) { + Map 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> monthWaterList = waterMeterMonthRecordMapper.selectWaterMeterMonthList(map); + map.put("yearTime", yearTime); + data.put("monthWaterList", waterSequenceMonthOneYear(monthWaterList, yearTime)); + List> alarmList = waterMeterAlarmMapper.selectAlarmTotalList(map); + data.put("alarmList", alarmSequenceMonthOneYear(alarmList, yearTime)); + + return data; + } + + private List> alarmSequenceMonthOneYear(List> alarmList, String yearTime) { + ArrayList sequenceMonth = new ArrayList<>(); + for (int i = 1; i <= 12; i++) { + sequenceMonth.add(yearTime + "-" + String.format("%02d", i)); + } + String monthTime = "titleTime"; + String num = "num"; + List> listMap = new ArrayList<>(); + Map dataMap = alarmList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, num))); + for (String s : sequenceMonth) { + HashMap 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> waterSequenceMonthOneYear(List> monthWaterList, String yearTime) { + ArrayList sequenceMonth = new ArrayList<>(); + for (int i = 1; i <= 12; i++) { + sequenceMonth.add(yearTime + "-" + String.format("%02d", i)); + } + String monthTime = "monthTime"; + String waterTonnage = "waterTonnage"; + List> listMap = new ArrayList<>(); + Map dataMap = monthWaterList.stream().collect(Collectors.toMap(m -> MapUtils.getString(m, monthTime), m -> MapUtils.getDouble(m, waterTonnage))); + for (String s : sequenceMonth) { + HashMap m = new HashMap<>(); + m.put(monthTime, s); + m.put("waterTonnage", dataMap.get(s) != null ? dataMap.get(s) : 0.0); + listMap.add(m); + } + return listMap; + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/entity/DepartmentInfo.java b/src/main/java/com/zhgd/xmgl/modules/worker/entity/DepartmentInfo.java index c10a270c4..205590bcc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/entity/DepartmentInfo.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/entity/DepartmentInfo.java @@ -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; } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/mapper/xml/WorkerInfoMapper.xml b/src/main/java/com/zhgd/xmgl/modules/worker/mapper/xml/WorkerInfoMapper.xml index 7943a3b90..3353000ca 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/mapper/xml/WorkerInfoMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/worker/mapper/xml/WorkerInfoMapper.xml @@ -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 + + and c.charge_person_name like CONCAT(CONCAT('%',#{param.chargePersonName}),'%') + + + and c.belonging_section like CONCAT(CONCAT('%',#{param.belongingSection}),'%') + and a.project_sn = #{param.projectSn}