移动代码

This commit is contained in:
guo 2023-08-31 09:47:46 +08:00
parent 85801197b2
commit db5304c707
94 changed files with 1052 additions and 493 deletions

View File

@ -0,0 +1,7 @@
package com.zhgd.xmgl.constant;
public interface TimeFormatConstant {
public static final String HOUR = "%Y-%m-%d %H";
public static final String DAY = "%Y-%m-%d";
public static final String MONTH = "%Y-%m";
}

View File

@ -18,6 +18,22 @@ import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterWorkCycleService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneWorkCycleService;
import com.zhgd.xmgl.modules.wisdom.entity.*;
import com.zhgd.xmgl.modules.wisdom.service.*;
import com.zhgd.xmgl.util.CommonUtil;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.LifterAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -12,11 +12,11 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.LifterOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.wisdom.service.ILifterWorkCycleService;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterWorkCycleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -11,8 +11,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.TowerCraneAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -14,10 +14,10 @@ import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneCurrentDataDto;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneWorkCycleService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneWorkCycleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.LifterAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -9,8 +9,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -12,11 +12,11 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.LifterOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -8,8 +8,8 @@ import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.TowerCraneAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -9,8 +9,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -11,10 +11,10 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneCurrentDataDto;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.city.dust.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -25,14 +26,16 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
/**
* @Title: Controller
* @Description: 扬尘实时数据管理
* @author pds
* @date 2023-03-01
* @date 2023-03-01
* @version V1.0
*/
@RestController
@ -40,36 +43,63 @@ import java.util.Map;
@Slf4j
@Api(tags = "扬尘实时数据")
public class DustNoiseDataController {
@Autowired
private IDustNoiseDataService dustNoiseDataService;
@Autowired
private IDustNoiseDataService dustNoiseDataService;
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "扬尘实时数据管理", operType = "分页查询", operDesc = "分页列表查询扬尘实时数据管理信息")
@ApiOperation(value = " 分页列表查询扬尘实时数据管理信息", notes = "分页列表查询扬尘实时数据管理信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "扬尘名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<DustNoiseData>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
String name = MapUtils.getString(map, "name");
QueryWrapper<DustNoiseData> wrapper = Wrappers.<DustNoiseData>query();
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.eq("d.engineering_sn", StrUtil.EMPTY);
}
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.ENGINEERING_SN))) {
wrapper.eq("d.engineering_sn", MapUtils.getString(map, ParamConstants.ENGINEERING_SN));
}
if (StringUtils.isNotBlank(name)) {
wrapper.like("ed.name", name);
}
wrapper.orderByDesc("d.create_time");
Page<DustNoiseData> page = PageUtil.getPage(map);
IPage<DustNoiseData> pageList = dustNoiseDataService.pageList(page, wrapper);
return Result.success(pageList);
}
@OperLog(operModul = "扬尘实时数据管理", operType = "查询", operDesc = "查询最新扬尘实时数据")
@ApiOperation(value = "查询最新扬尘实时数据", notes = "查询最新扬尘实时数据", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "扬尘名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/newest/one")
public Result<DustNoiseData> queryNewestOne(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<IPage<DustNoiseData>> result = queryPageList(map);
List<DustNoiseData> list = Optional.of(result.getResult()).map(s -> s.getRecords()).orElse(null);
return Result.success(CollUtil.isNotEmpty(list) ? list.get(0) : null);
}
@OperLog(operModul = "扬尘实时数据管理", operType = "查询", operDesc = "查询扬尘趋势")
@ApiOperation(value = "查询扬尘趋势", notes = "查询扬尘趋势", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "1:日2:月3", paramType = "body", dataType = "String"),
})
@PostMapping(value = "/queryTrend")
public Result<List<DustNoiseData>> queryTrend(@ApiIgnore @RequestBody Map<String, Object> map) {
return Result.success(dustNoiseDataService.queryTrend(map));
}
/**
* 分页列表查询
* @return
*/
@OperLog(operModul = "扬尘实时数据管理", operType = "分页查询", operDesc = "分页列表查询扬尘实时数据管理信息")
@ApiOperation(value = " 分页列表查询扬尘实时数据管理信息", notes = "分页列表查询扬尘实时数据管理信息", httpMethod="POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "扬尘名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<DustNoiseData>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
String name = MapUtils.getString(map, "name");
QueryWrapper<DustNoiseData> wrapper = Wrappers.<DustNoiseData>query();
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.eq("d.engineering_sn", StrUtil.EMPTY);
}
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.ENGINEERING_SN))) {
wrapper.eq("d.engineering_sn", MapUtils.getString(map, ParamConstants.ENGINEERING_SN));
}
if (StringUtils.isNotBlank(name)) {
wrapper.like("ed.name", name);
}
wrapper.orderByDesc("d.create_time");
Page<DustNoiseData> page = PageUtil.getPage(map);
IPage<DustNoiseData> pageList = dustNoiseDataService.pageList(page, wrapper);
return Result.success(pageList);
}
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentAlarmTypeVo;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -24,7 +25,7 @@ import java.util.Map;
* @Title: Controller
* @Description: 扬尘报警台账表
* @author pengj
* @date 2023-03-01
* @date 2023-03-01
* @version V1.0
*/
@RestController
@ -37,10 +38,11 @@ public class EnvironmentAlarmController {
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "扬尘报警管理", operType = "分页查询", operDesc = "分页列表查询扬尘报警台账表信息")
@ApiOperation(value = " 分页列表查询扬尘报警台账表信息", notes = "分页列表查询扬尘报警台账表信息", httpMethod="POST")
@ApiOperation(value = " 分页列表查询扬尘报警台账表信息", notes = "分页列表查询扬尘报警台账表信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "设备名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "type", value = "报警类型", paramType = "body", dataType = "String"),
@ -57,24 +59,33 @@ public class EnvironmentAlarmController {
}
/**
* 编辑
* 编辑
*
* @param environmentAlarm
* @return
*/
@OperLog(operModul = "扬尘报警管理", operType = "修改", operDesc = "编辑扬尘报警台账表信息")
@ApiOperation(value = "编辑扬尘报警台账表信息", notes = "编辑扬尘报警台账表信息" , httpMethod="POST")
@ApiOperation(value = "编辑扬尘报警台账表信息", notes = "编辑扬尘报警台账表信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<EnvironmentAlarm> edit(@RequestBody EnvironmentAlarm environmentAlarm) {
Result<EnvironmentAlarm> result = new Result<EnvironmentAlarm>();
EnvironmentAlarm environmentAlarmEntity = environmentAlarmService.getById(environmentAlarm.getId());
if(environmentAlarmEntity==null) {
if (environmentAlarmEntity == null) {
result.error500("未找到对应实体");
}else {
} else {
boolean ok = environmentAlarmService.updateById(environmentAlarm);
if(ok) {
if (ok) {
result.success("修改成功!");
}
}
return result;
}
@OperLog(operModul = "扬尘报警管理", operType = "统计", operDesc = "按类型统计今日预警")
@ApiOperation(value = " 按类型统计今日预警", notes = "按类型统计今日预警", httpMethod = "POST")
@PostMapping(value = "/countTodayEnvironmentAlarmGroupByType")
public Result<EnvironmentAlarmTypeVo> countTodayEnvironmentAlarmGroupByType() {
EnvironmentAlarmTypeVo list = environmentAlarmService.countTodayEnvironmentAlarmGroupByType();
return Result.success(list);
}
}

View File

@ -12,9 +12,12 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EngineeringAndEnvironmentDevVo;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
@ -46,150 +49,176 @@ import java.util.Map;
@Slf4j
@Api(tags = "扬尘管理")
public class EnvironmentDevController {
@Autowired
private IEnvironmentDevService environmentDevService;
@Autowired
private IEnvironmentDevService environmentDevService;
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "分页查询", operDesc = "分页列表查询扬尘设备管理信息")
@ApiOperation(value = " 分页列表查询扬尘设备管理信息", notes = "分页列表查询扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "扬尘名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<EnvironmentDev>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<EnvironmentDev> wrapper = QueryGenerator.initPageQueryWrapper(EnvironmentDev.class, map);
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.lambda().eq(EnvironmentDev::getEngineeringSn, StrUtil.EMPTY);
}
Page<EnvironmentDev> page = PageUtil.getPage(map);
IPage<EnvironmentDev> pageList = environmentDevService.page(page, wrapper);
return Result.success(pageList);
}
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "分页查询", operDesc = "分页列表查询扬尘设备管理信息")
@ApiOperation(value = " 分页列表查询扬尘设备管理信息", notes = "分页列表查询扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "扬尘名称", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<EnvironmentDev>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<EnvironmentDev> wrapper = QueryGenerator.initPageQueryWrapper(EnvironmentDev.class, map);
if (StringUtils.isNotBlank(MapUtils.getString(map, ParamConstants.PROJECT_SN))) {
wrapper.lambda().eq(EnvironmentDev::getEngineeringSn, StrUtil.EMPTY);
}
Page<EnvironmentDev> page = PageUtil.getPage(map);
IPage<EnvironmentDev> pageList = environmentDevService.page(page, wrapper);
return Result.success(pageList);
}
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "列表查询", operDesc = "列表查询扬尘设备管理信息")
@ApiOperation(value = " 列表查询扬尘设备管理信息", notes = "列表查询扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringSn", value = "工程sn", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", dataType = "String")
})
@PostMapping(value = "/list")
public Result<List<EnvironmentDev>> queryList(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
LambdaQueryWrapper<EnvironmentDev> wrapper = Wrappers.<EnvironmentDev>lambdaQuery();
if (environmentDev.getEngineeringSn() != null) {
wrapper.eq(EnvironmentDev::getEngineeringSn, environmentDev.getEngineeringSn());
}
if (environmentDev.getProjectSn() != null) {
wrapper.eq(EnvironmentDev::getEngineeringSn, StrUtil.EMPTY);
}
List<EnvironmentDev> list = environmentDevService.list(wrapper);
return Result.success(list);
}
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "列表查询", operDesc = "列表查询扬尘设备管理信息")
@ApiOperation(value = " 列表查询扬尘设备管理信息", notes = "列表查询扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringSn", value = "工程sn", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", dataType = "String")
})
@PostMapping(value = "/list")
public Result<List<EnvironmentDev>> queryList(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
LambdaQueryWrapper<EnvironmentDev> wrapper = Wrappers.<EnvironmentDev>lambdaQuery();
if (environmentDev.getEngineeringSn() != null) {
wrapper.eq(EnvironmentDev::getEngineeringSn, environmentDev.getEngineeringSn());
}
if (environmentDev.getProjectSn() != null) {
wrapper.eq(EnvironmentDev::getEngineeringSn, StrUtil.EMPTY);
}
List<EnvironmentDev> list = environmentDevService.list(wrapper);
return Result.success(list);
}
/**
* 添加
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "新增", operDesc = "添加扬尘设备管理信息")
@ApiOperation(value = " 添加扬尘设备管理信息", notes = "添加扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<EnvironmentDev> add(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
environmentDevService.saveInfo(environmentDev);
result.success("添加成功!");
return result;
}
/**
* 添加
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "新增", operDesc = "添加扬尘设备管理信息")
@ApiOperation(value = " 添加扬尘设备管理信息", notes = "添加扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<EnvironmentDev> add(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
environmentDevService.saveInfo(environmentDev);
result.success("添加成功!");
return result;
}
/**
* 编辑
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "修改", operDesc = "编辑扬尘设备管理信息")
@ApiOperation(value = "编辑扬尘设备管理信息", notes = "编辑扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<EnvironmentDev> edit(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev environmentDevEntity = environmentDevService.getById(environmentDev.getId());
if (environmentDevEntity == null) {
result.error500("未找到对应实体");
} else {
SecurityUser user = SecurityUtil.getUser();
environmentDev.setProjectSn(user.getSn());
boolean ok = environmentDevService.updateInfo(environmentDev);
if (ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 编辑
*
* @param environmentDev
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "修改", operDesc = "编辑扬尘设备管理信息")
@ApiOperation(value = "编辑扬尘设备管理信息", notes = "编辑扬尘设备管理信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<EnvironmentDev> edit(@RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev environmentDevEntity = environmentDevService.getById(environmentDev.getId());
if (environmentDevEntity == null) {
result.error500("未找到对应实体");
} else {
SecurityUser user = SecurityUtil.getUser();
environmentDev.setProjectSn(user.getSn());
boolean ok = environmentDevService.updateInfo(environmentDev);
if (ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "删除", operDesc = "删除扬尘设备管理信息")
@ApiOperation(value = "删除扬尘设备管理信息", notes = "删除扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "扬尘设备管理ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<EnvironmentDev> delete(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev iEnvironmentDev = environmentDevService.getById(environmentDev.getId());
if (iEnvironmentDev == null) {
result.error500("未找到对应实体");
} else {
boolean ok = environmentDevService.removeById(environmentDev.getId());
if (ok) {
result.success("删除成功!");
}
}
return result;
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "删除", operDesc = "删除扬尘设备管理信息")
@ApiOperation(value = "删除扬尘设备管理信息", notes = "删除扬尘设备管理信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "扬尘设备管理ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<EnvironmentDev> delete(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDev> result = new Result<EnvironmentDev>();
EnvironmentDev iEnvironmentDev = environmentDevService.getById(environmentDev.getId());
if (iEnvironmentDev == null) {
result.error500("未找到对应实体");
} else {
boolean ok = environmentDevService.removeById(environmentDev.getId());
if (ok) {
result.success("删除成功!");
}
}
return result;
}
/**
* 列表查询
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "列表查询", operDesc = "列表查询设备信息以及详细参数")
@ApiOperation(value = " 列表查询设备信息以及详细参数", notes = "列表查询设备信息以及详细参数", httpMethod = "POST")
@PostMapping(value = "/detailList")
public Result<List<EnvironmentDevDto>> detailList(@RequestBody EnvironmentDev environmentDev) {
List<EnvironmentDevDto> list = environmentDevService.detailList(environmentDev);
return Result.success(list);
}
/**
* 通过设备编码查询设备详细信息
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "查询", operDesc = "通过设备ID查询设备详细信息")
@ApiOperation(value = "通过设备ID查询设备详细信息", notes = "通过设备ID查询设备详细信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "扬尘设备id", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/queryDetailById")
public Result<EnvironmentDevDto> queryById(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDevDto> result = new Result<EnvironmentDevDto>();
EnvironmentDevDto detail = environmentDevService.getDetail(environmentDev.getId());
if (detail == null) {
result.error500("未找到对应实体");
} else {
result.setResult(detail);
result.setSuccess(true);
}
return result;
}
@OperLog(operModul = "扬尘管理", operType = "分页查询", operDesc = "分页查询工程信息和扬尘设备数量列表")
@ApiOperation(value = "分页查询工程信息和扬尘设备数量列表", notes = "分页查询工程信息和扬尘设备数量列表", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/queryEngineeringAndEnvironmentDevPage")
public Result<IPage<EngineeringAndEnvironmentDevVo>> queryEngineeringAndEnvironmentDevPage(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<Engineering> wrapper = QueryGenerator.initPageQueryWrapper(Engineering.class, map);
Page<Engineering> page = PageUtil.getPage(map);
wrapper.lambda().orderByDesc(Engineering::getCreateTime);
IPage<EngineeringAndEnvironmentDevVo> pageList = environmentDevService.queryEngineeringAndEnvironmentDevPage(page, wrapper);
return Result.success(pageList);
}
@OperLog(operModul = "扬尘管理", operType = "统计", operDesc = "扬尘统计")
@ApiOperation(value = "扬尘统计", notes = "扬尘统计", httpMethod = "POST")
@PostMapping(value = "/countEnvironmentDev")
public Result<EnvironmentDevCountVo> countEnvironmentDev() {
return Result.success(environmentDevService.countEnvironmentDev());
}
/**
* 列表查询
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "列表查询", operDesc = "列表查询设备信息以及详细参数")
@ApiOperation(value = " 列表查询设备信息以及详细参数", notes = "列表查询设备信息以及详细参数", httpMethod = "POST")
@PostMapping(value = "/detailList")
public Result<List<EnvironmentDevDto>> detailList(@RequestBody EnvironmentDev environmentDev) {
List<EnvironmentDevDto> list = environmentDevService.detailList(environmentDev);
return Result.success(list);
}
/**
* 通过设备编码查询设备详细信息
*
* @return
*/
@OperLog(operModul = "扬尘管理", operType = "查询", operDesc = "通过设备ID查询设备详细信息")
@ApiOperation(value = "通过设备ID查询设备详细信息", notes = "通过设备ID查询设备详细信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "扬尘设备id", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/queryDetailById")
public Result<EnvironmentDevDto> queryById(@ApiIgnore @RequestBody EnvironmentDev environmentDev) {
Result<EnvironmentDevDto> result = new Result<EnvironmentDevDto>();
EnvironmentDevDto detail = environmentDevService.getDetail(environmentDev.getId());
if (detail == null) {
result.error500("未找到对应实体");
} else {
result.setResult(detail);
result.setSuccess(true);
}
return result;
}
}

View File

@ -191,6 +191,8 @@ public class DustNoiseData implements Serializable {
@ApiModelProperty(value = "板载湿度是否预警(false:否;true:是)")
private Boolean plateHumidityAlarm;
@TableField(exist = false)
@ApiModelProperty(value = "时间")
private String time;
}

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.city.dust.entity.vo;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class EngineeringAndEnvironmentDevVo extends Engineering {
@ApiModelProperty("扬尘设备数量")
private Integer environmentDevCount;
}

View File

@ -0,0 +1,17 @@
package com.zhgd.xmgl.modules.city.dust.entity.vo;
import lombok.Data;
import java.util.List;
@Data
public class EnvironmentAlarmTypeVo {
private Integer count;
private List<TypeNum> list;
@Data
public static class TypeNum {
private String type;
private Integer count;
}
}

View File

@ -0,0 +1,17 @@
package com.zhgd.xmgl.modules.city.dust.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EnvironmentDevCountVo {
@ApiModelProperty("已监管工程数量")
private Integer supervisedEngineeringCount;
@ApiModelProperty("已监管生产单位数量")
private Integer supervisedProductionUnitCount;
@ApiModelProperty("扬尘噪声设备数量")
private Integer dustNoiseEquipmentCount;
@ApiModelProperty("扬尘噪声预警数量")
private Integer dustAndNoiseWarningCount;
}

View File

@ -9,6 +9,9 @@ import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @Description: 扬尘实时数据管理
* @author pds
@ -22,4 +25,6 @@ public interface DustNoiseDataMapper extends BaseMapper<DustNoiseData> {
Page<DustNoiseData> pageList(Page page, @Param(Constants.WRAPPER)Wrapper<DustNoiseData> wrapper);
DustNoiseData getNewData(@Param("deviceCode") String deviceCode);
List<DustNoiseData> queryTrend(Map<String, Object> map);
}

View File

@ -6,9 +6,13 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentAlarmTypeVo;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 扬尘报警台账表
* @author pengj
@ -24,4 +28,8 @@ public interface EnvironmentAlarmMapper extends BaseMapper<EnvironmentAlarm> {
Integer statByState();
Integer statByEngineering();
EnvironmentDevCountVo count();
List<EnvironmentAlarmTypeVo.TypeNum > countTodayEnvironmentAlarmGroupByType();
}

View File

@ -6,9 +6,13 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Description: 扬尘设备管理
* @author pds
@ -29,4 +33,10 @@ public interface EnvironmentDevMapper extends BaseMapper<EnvironmentDev> {
String getAllDeviceNameBySn(String projectSn, String engineeringSn);
EnvironmentDev getByCode(String code, String ignore);
List<OnlineGroupByProjectBo> countGroupByProject();
EnvironmentDevCountVo countInstallEngineering();
EnvironmentDevCountVo count();
}

View File

@ -2,13 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.city.dust.mapper.DustNoiseDataMapper">
<select id="getNewData" resultType="com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData">
SELECT * FROM dust_noise_data WHERE device_code = #{deviceCode} ORDER BY upload_date DESC LIMIT 1
SELECT *
FROM dust_noise_data
WHERE device_code = #{deviceCode}
ORDER BY upload_date DESC
LIMIT 1
</select>
<select id="pageList" resultType="com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData">
SELECT d.*, ed.`name` as deviceName, e.engineering_name FROM dust_noise_data d
LEFT JOIN environment_dev ed ON d.device_code = ed.`code`
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
SELECT d.*, ed.`name` as deviceName, e.engineering_name
FROM dust_noise_data d
LEFT JOIN environment_dev ed ON d.device_code = ed.`code`
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
${ew.customSqlSegment}
</select>
<select id="queryTrend" resultType="com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData">
SELECT avg(pm10) pm10,
avg(pm25) pm25,
avg(noise) noise,
avg(tsp) tsp,
date_format(create_time, CASE #{type}
WHEN 1 THEN '%H:00'
WHEN 2 THEN #{timeFormat}
WHEN 3 THEN #{timeFormat}
ELSE '' END) time
FROM dust_noise_data
where create_time >= #{startTime}
and create_time <![CDATA[<=]]> #{endTime}
group by date_format(create_time, #{timeFormat})
</select>
</mapper>

View File

@ -2,16 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentAlarmMapper">
<select id="pageList" resultType="com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm">
SELECT a.*, d.name as deviceName FROM environment_alarm a
LEFT JOIN environment_dev d ON d.code = a.device_code
SELECT a.*, d.name as deviceName
FROM environment_alarm a
LEFT JOIN environment_dev d ON d.code = a.device_code
${ew.customSqlSegment}
</select>
<select id="statByState" resultType="java.lang.Integer">
SELECT COUNT(1) AS environmentAlarmNum FROM environment_alarm WHERE state = 0
SELECT COUNT(1) AS environmentAlarmNum
FROM environment_alarm
WHERE state = 0
</select>
<select id="statByEngineering" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT engineering_sn) AS environmentAlarmNum FROM environment_alarm WHERE engineering_sn != ''
SELECT COUNT(DISTINCT engineering_sn) AS environmentAlarmNum
FROM environment_alarm
WHERE engineering_sn != ''
</select>
<select id="count" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) dustAndNoiseWarningCount
from environment_alarm
</select>
<select id="countTodayEnvironmentAlarmGroupByType"
resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentAlarmTypeVo$TypeNum">
select ea.type, count(*) count
from environment_alarm ea
where ea.create_time >= CURDATE()
group by ea.type
</select>
</mapper>

View File

@ -2,31 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentDevMapper">
<select id="pageList" resultType="com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev">
SELECT d.*, p.project_name, e.engineering_name FROM environment_dev d
LEFT JOIN project p ON d.project_sn = p.project_sn
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
SELECT d.*, p.project_name, e.engineering_name
FROM environment_dev d
LEFT JOIN project p ON d.project_sn = p.project_sn
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
${ew.customSqlSegment}
</select>
<select id="statByEngineering" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT engineering_sn) AS environmentDevNum FROM environment_dev WHERE engineering_sn != ''
SELECT COUNT(DISTINCT engineering_sn) AS environmentDevNum
FROM environment_dev
WHERE engineering_sn != ''
</select>
<select id="statByDevNum" resultType="java.lang.Integer">
SELECT COUNT(1) AS aiMonitorDevNum FROM environment_dev
SELECT COUNT(1) AS aiMonitorDevNum
FROM environment_dev
</select>
<select id="getDetail" resultType="com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev">
SELECT d.*, p.project_name, e.engineering_name FROM environment_dev d
LEFT JOIN project p ON d.project_sn = p.project_sn
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
SELECT d.*, p.project_name, e.engineering_name
FROM environment_dev d
LEFT JOIN project p ON d.project_sn = p.project_sn
LEFT JOIN engineering e ON d.engineering_sn = e.engineering_sn
WHERE d.id = #{id}
</select>
<select id="getAllDeviceNameBySn" resultType="java.lang.String">
SELECT GROUP_CONCAT(`name`) FROM environment_dev WHERE 1 = 1
SELECT GROUP_CONCAT(`name`)
FROM environment_dev WHERE 1 = 1
<if test="projectSn != '' and projectSn != null">
AND project_sn = #{projectSn} AND engineering_sn = ''
AND project_sn = #{projectSn}
AND engineering_sn = ''
</if>
<if test="engineeringSn != '' and engineeringSn != null">
AND engineering_sn = #{engineeringSn}
@ -34,6 +41,28 @@
</select>
<select id="getByCode" resultType="com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev">
SELECT * FROM environment_dev WHERE code = #{code}
SELECT *
FROM environment_dev
WHERE code = #{code}
</select>
<select id="countGroupByProject" resultType="com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo">
SELECT md.engineering_sn,
count(*) count,
ifnull(sum(if(md.state = 1, 1, 0)), 0) onlineCount,
ifnull(sum(if(md.state = 0, 1, 0)), 0) offlineCount
FROM environment_dev md
group by md.engineering_sn
</select>
<select id="countInstallEngineering" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) supervisedEngineeringCount
from engineering e
where exists(select * from environment_dev ed where ed.engineering_sn = e.engineering_sn)
</select>
<select id="count" resultType="com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo">
select count(*) dustNoiseEquipmentCount
from engineering e
</select>
</mapper>

View File

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import java.util.List;
import java.util.Map;
/**
* @Description: 扬尘实时数据管理
* @author pds
@ -29,4 +32,6 @@ public interface IDustNoiseDataService extends IService<DustNoiseData> {
* @return
*/
DustNoiseData setAlarm(DustNoiseData dustNoiseData);
List<DustNoiseData> queryTrend(Map<String, Object> map);
}

View File

@ -2,9 +2,11 @@ package com.zhgd.xmgl.modules.city.dust.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentAlarmTypeVo;
import com.zhgd.xmgl.modules.wisdom.dto.MapEnvironAlarmDto;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm;
import java.util.List;
import java.util.Map;
/**
@ -20,4 +22,6 @@ public interface IEnvironmentAlarmService extends IService<EnvironmentAlarm> {
MapEnvironAlarmDto queryMapEnvironAlarmBySn(String projectSn, String engineeringSn);
boolean checkAlarm(String sn);
EnvironmentAlarmTypeVo countTodayEnvironmentAlarmGroupByType();
}

View File

@ -1,10 +1,15 @@
package com.zhgd.xmgl.modules.city.dust.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectDeviceDto;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EngineeringAndEnvironmentDevVo;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
@ -39,4 +44,8 @@ public interface IEnvironmentDevService extends IService<EnvironmentDev> {
boolean updateInfo(EnvironmentDev environmentDev);
EnvironmentDevStatDto statistics();
IPage<EngineeringAndEnvironmentDevVo> queryEngineeringAndEnvironmentDevPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper);
EnvironmentDevCountVo countEnvironmentDev();
}

View File

@ -1,24 +1,29 @@
package com.zhgd.xmgl.modules.city.dust.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import com.zhgd.xmgl.constant.TimeFormatConstant;
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import com.zhgd.xmgl.modules.city.dust.mapper.DustNoiseDataMapper;
import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.ParamEnum;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description: 扬尘实时数据管理
* @author pds
* @date 2023-03-01
* @date 2023-03-01
* @version V1.0
*/
@Service
@ -54,12 +59,63 @@ public class DustNoiseDataServiceImpl extends ServiceImpl<DustNoiseDataMapper, D
return dustNoiseData;
}
@Override
public List<DustNoiseData> queryTrend(Map<String, Object> map) {
Integer type = MapUtils.getInteger(map, "type");
Date date = new Date();
//1:2:3
if (Objects.equals(type, 1)) {
map.put("startTime", DateUtil.offsetDay(date, -1));
map.put("endTime", DateUtil.now());
map.put("timeFormat", TimeFormatConstant.HOUR);
} else if (Objects.equals(type, 2)) {
map.put("startTime", DateUtil.offsetMonth(date, -1));
map.put("endTime", DateUtil.now());
map.put("timeFormat", TimeFormatConstant.DAY);
} else if (Objects.equals(type, 3)) {
map.put("startTime", DateUtil.offsetMonth(date, -12));
map.put("endTime", DateUtil.now());
map.put("timeFormat", TimeFormatConstant.MONTH);
}
List<DustNoiseData> dustNoiseDatas = baseMapper.queryTrend(map);
dustNoiseDatas = fillDate(dustNoiseDatas, map);
return dustNoiseDatas;
}
private List<DustNoiseData> fillDate(List<DustNoiseData> dustNoiseDatas, Map<String, Object> map) {
List<DustNoiseData> list = new ArrayList<>();
Integer type = MapUtils.getInteger(map, "type");
List<String> times = null;
Map<String, DustNoiseData> timeMap = dustNoiseDatas.stream().collect(Collectors.toMap(DustNoiseData::getTime, Function.identity()));
if (Objects.equals(type, 1)) {
times = DateUtils.getHoursListLastDay();
} else if (Objects.equals(type, 2)) {
times = DateUtils.getDaysBetweenLastMonth();
} else if (Objects.equals(type, 3)) {
times = DateUtils.getMonthsBetweenLastYear();
}
for (String time : times) {
DustNoiseData dustNoiseData = timeMap.get(time);
if (dustNoiseData == null) {
dustNoiseData = new DustNoiseData();
dustNoiseData.setPm10(0F);
dustNoiseData.setPm25(0F);
dustNoiseData.setNoise(0F);
dustNoiseData.setTsp(0F);
dustNoiseData.setTime(time);
}
list.add(dustNoiseData);
}
return list;
}
private Float dictValue(List<SystemDictData> systemDictDataList, Integer type) {
String thresholdValue = "0";
List<SystemDictData> systemDictData = systemDictDataList.stream().filter(d -> d.getDictLabel().equals(type)).collect(Collectors.toList());
if (systemDictData.size() > 0) {
thresholdValue = systemDictData.get(0).getDictValue();
thresholdValue = systemDictData.get(0).getDictValue();
}
return Float.valueOf(thresholdValue);
}
}

View File

@ -13,26 +13,31 @@ import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.MapEnvironAlarmDto;
import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentAlarmTypeVo;
import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentAlarmMapper;
import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.wisdom.dto.MapEnvironAlarmDto;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.ParamEnum;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Description: 扬尘报警台账表
* @author pengj
* @date 2023-03-01
* @date 2023-03-01
* @version V1.0
*/
@Service
@ -112,4 +117,29 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
return environAlarmFlag;
}
@Override
public EnvironmentAlarmTypeVo countTodayEnvironmentAlarmGroupByType() {
List<EnvironmentAlarmTypeVo.TypeNum> environmentAlarmTypeVos = baseMapper.countTodayEnvironmentAlarmGroupByType();
List<String> typeList = new ArrayList<>();
typeList.add(ParamEnum.EnvironmentAlarmTypeThreshold.PM10.name());
typeList.add(ParamEnum.EnvironmentAlarmTypeThreshold.PM25.name());
typeList.add(ParamEnum.EnvironmentAlarmTypeThreshold.NOISE.name());
typeList.add(ParamEnum.EnvironmentAlarmTypeThreshold.TSP.name());
List<EnvironmentAlarmTypeVo.TypeNum> list = environmentAlarmTypeVos.stream().filter(vo -> typeList.contains(vo.getType())).collect(Collectors.toList());
Map<String, EnvironmentAlarmTypeVo.TypeNum> typeMap = list.stream().collect(Collectors.toMap(EnvironmentAlarmTypeVo.TypeNum::getType, Function.identity()));
for (String type : typeList) {
if (typeMap.get(type) == null) {
EnvironmentAlarmTypeVo.TypeNum typeNum = new EnvironmentAlarmTypeVo.TypeNum();
typeNum.setType(type);
typeNum.setCount(0);
list.add(typeNum);
}
}
list.stream().sorted((o1, o2) -> o2.getCount().compareTo(o1.getCount()));
EnvironmentAlarmTypeVo vo = new EnvironmentAlarmTypeVo();
vo.setCount(environmentAlarmTypeVos.stream().mapToInt(e -> e.getCount()).sum());
vo.setList(list);
return vo;
}
}

View File

@ -6,6 +6,8 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,18 +18,22 @@ import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectDeviceDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.project.service.IProjectService;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
import com.zhgd.xmgl.modules.city.dust.entity.DustNoiseData;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentAlarm;
import com.zhgd.xmgl.modules.city.dust.entity.EnvironmentDev;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EngineeringAndEnvironmentDevVo;
import com.zhgd.xmgl.modules.city.dust.entity.vo.EnvironmentDevCountVo;
import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentAlarmMapper;
import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentDevMapper;
import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import com.zhgd.xmgl.modules.city.project.service.IProjectService;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevDto;
import com.zhgd.xmgl.modules.wisdom.dto.EnvironmentDevStatDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,11 +42,12 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description: 扬尘设备管理
* @author pds
* @date 2023-03-01
* @date 2023-03-01
* @version V1.0
*/
@Service
@ -61,6 +68,8 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
@Autowired
private IEnvironmentAlarmService environmentAlarmService;
@Autowired
private EnvironmentAlarmMapper environmentAlarmMapper;
@Override
public Page<EnvironmentDev> pageList(Page page, Wrapper<EnvironmentDev> wrapper) {
@ -162,13 +171,34 @@ public class EnvironmentDevServiceImpl extends ServiceImpl<EnvironmentDevMapper,
environmentDev.setUseRate(projectNum == 0 ? 0 : NumberUtil.round(installNum * 100F / projectNum, 2).floatValue());
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getProjectSn)));
} else {*/
int installNum = this.statByEngineering();
Integer engineeringNum = engineeringService.list(Wrappers.<Engineering>lambdaQuery().eq(Engineering::getExamineState, 3)).size();
environmentDev.setInstallNum(installNum);
environmentDev.setUseRate(engineeringNum == 0 ? 0 : NumberUtil.round(installNum * 100F / engineeringNum, 2).floatValue());
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getEngineeringSn)));
int installNum = this.statByEngineering();
Integer engineeringNum = engineeringService.list(Wrappers.<Engineering>lambdaQuery().eq(Engineering::getExamineState, 3)).size();
environmentDev.setInstallNum(installNum);
environmentDev.setUseRate(engineeringNum == 0 ? 0 : NumberUtil.round(installNum * 100F / engineeringNum, 2).floatValue());
environmentDev.setTotalAlarm(environmentAlarmService.count(Wrappers.<EnvironmentAlarm>lambdaQuery().isNotNull(EnvironmentAlarm::getEngineeringSn)));
// }
return environmentDev;
}
@Override
public IPage<EngineeringAndEnvironmentDevVo> queryEngineeringAndEnvironmentDevPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper) {
Page<Engineering> pageList = engineeringService.page(page, wrapper);
Page<EngineeringAndEnvironmentDevVo> rtPage = BeanUtil.toBean(pageList, Page.class);
rtPage.setRecords(BeanUtil.copyToList(pageList.getRecords(), EngineeringAndEnvironmentDevVo.class));
List<OnlineGroupByProjectBo> onlineGroupByProjectBos = baseMapper.countGroupByProject();
Map<String, OnlineGroupByProjectBo> engineeringMap = onlineGroupByProjectBos.stream().collect(Collectors.toMap(OnlineGroupByProjectBo::getEngineeringSn, onlineGroupByProjectBo -> onlineGroupByProjectBo));
rtPage.getRecords().stream().forEach(s -> {
s.setEnvironmentDevCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getCount() : 0);
});
return rtPage;
}
@Override
public EnvironmentDevCountVo countEnvironmentDev() {
EnvironmentDevCountVo vo = baseMapper.countInstallEngineering();
vo.setDustNoiseEquipmentCount(baseMapper.count().getDustNoiseEquipmentCount());
vo.setDustAndNoiseWarningCount(environmentAlarmMapper.count().getDustAndNoiseWarningCount());
return vo;
}
}

View File

@ -335,11 +335,5 @@ public class Engineering implements Serializable {
@ApiModelProperty(value = "单体工程")
private List<EngineeringSingle> engineeringSingleList;
@TableField(exist = false)
@ApiModelProperty(value = "视频监控在线数量")
private Integer monitorDevOnlineCount;
@TableField(exist = false)
@ApiModelProperty(value = "视频监控离线数量")
private Integer monitorDevOfflineCount;
}

View File

@ -76,13 +76,9 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
Page<Engineering> pageList = this.page(page, wrapper);
List<SystemDictData> engineeringTypes = systemDictDataService.getByType(ParamEnum.SysDictType.ENGINEERING_TYPE.getValue());
List<SystemDictData> engineeringStates = systemDictDataService.getByType(ParamEnum.SysDictType.ENGINEERING_STATE.getValue());
List<OnlineGroupByProjectBo> onlineGroupByProjectBos = monitorDevMapper.countOnlineGroupByProject();
Map<String, OnlineGroupByProjectBo> projectMap = onlineGroupByProjectBos.stream().collect(Collectors.toMap(OnlineGroupByProjectBo::getProjectSn, onlineGroupByProjectBo -> onlineGroupByProjectBo));
pageList.getRecords().stream().forEach(s -> {
s.setEngineeringTypeName(CommonUtil.getDictValue(engineeringTypes, s.getEngineeringType()));
s.setStateName(CommonUtil.getDictValue(engineeringStates, s.getState()));
s.setMonitorDevOnlineCount(projectMap.get(s.getProjectSn()) != null ? projectMap.get(s.getProjectSn()).getOnlineCount() : 0);
s.setMonitorDevOfflineCount(projectMap.get(s.getProjectSn()) != null ? projectMap.get(s.getProjectSn()).getOfflineCount() : 0);
});
return pageList;
}

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.lifter.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.LifterAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.lifter.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.lifter.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -12,11 +12,11 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.LifterOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.lifter.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.wisdom.service.ILifterWorkCycleService;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterWorkCycleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.lifter.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.lifter.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.lifter.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.lifter.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,10 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
import java.util.List;
package com.zhgd.xmgl.modules.city.lifter.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**

View File

@ -1,10 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
import java.util.List;
package com.zhgd.xmgl.modules.city.lifter.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**

View File

@ -1,10 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
import java.util.List;
package com.zhgd.xmgl.modules.city.lifter.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**

View File

@ -1,10 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
import java.util.List;
package com.zhgd.xmgl.modules.city.lifter.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.wisdom.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.LifterAlarmMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.lifter.mapper.LifterAlarmMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.LifterCurrentDataMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.lifter.mapper.LifterCurrentDataMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.LifterMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.lifter.mapper.LifterMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.LifterWorkCycleMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.lifter.mapper.LifterWorkCycleMapper">
</mapper>
</mapper>

View File

@ -1,7 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.lifter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.wisdom.statistics.LifterAlarmStat;
import java.util.Map;

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.lifter.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.dto.LifterOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
/**
* @Description: 升降机实时数据

View File

@ -1,10 +1,10 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.lifter.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import java.util.Map;

View File

@ -1,6 +1,6 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.lifter.service;
import com.zhgd.xmgl.modules.wisdom.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.baomidou.mybatisplus.extension.service.IService;
/**

View File

@ -1,14 +1,14 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.lifter.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterAlarm;
import com.zhgd.xmgl.modules.wisdom.mapper.LifterAlarmMapper;
import com.zhgd.xmgl.modules.wisdom.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterAlarm;
import com.zhgd.xmgl.modules.city.lifter.mapper.LifterAlarmMapper;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterAlarmService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import com.zhgd.xmgl.modules.wisdom.statistics.LifterAlarmStat;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.lifter.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
import com.zhgd.xmgl.modules.wisdom.dto.LifterOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.wisdom.mapper.LifterCurrentDataMapper;
import com.zhgd.xmgl.modules.wisdom.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterCurrentData;
import com.zhgd.xmgl.modules.city.lifter.mapper.LifterCurrentDataMapper;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterCurrentDataService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,13 +1,13 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.lifter.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.project.service.IProjectService;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.mapper.LifterMapper;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.mapper.LifterMapper;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,13 +1,10 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.lifter.service.impl;
import com.zhgd.xmgl.modules.wisdom.entity.Lifter;
import com.zhgd.xmgl.modules.wisdom.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.wisdom.mapper.LifterWorkCycleMapper;
import com.zhgd.xmgl.modules.wisdom.service.ILifterService;
import com.zhgd.xmgl.modules.wisdom.service.ILifterWorkCycleService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.lifter.entity.Lifter;
import com.zhgd.xmgl.modules.city.lifter.entity.LifterWorkCycle;
import com.zhgd.xmgl.modules.city.lifter.mapper.LifterWorkCycleMapper;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterService;
import com.zhgd.xmgl.modules.city.lifter.service.ILifterWorkCycleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -16,6 +16,7 @@ import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.CityAndDistrictMonitorVo;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.EngineeringAndStatusVo;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
@ -174,6 +175,7 @@ public class MonitorDevController {
/**
* 通过id查询
*
* @return
*/
@OperLog(operModul = "项目视频管理", operType = "查询", operDesc = "通过id查询视频管理表信息")
@ -194,6 +196,7 @@ public class MonitorDevController {
/**
* 监控点树形列表
*
* @return
*/
@OperLog(operModul = "项目视频管理", operType = "查询", operDesc = "监控点树形列表")
@ -215,5 +218,20 @@ public class MonitorDevController {
return Result.success(countCityAndDistrictMonitors);
}
@OperLog(operModul = "工程信息和视频在线状态列表", operType = "分页查询", operDesc = "分页查询工程信息和视频在线状态列表")
@ApiOperation(value = "分页查询工程信息和视频在线状态列表", notes = "分页查询工程信息和视频在线状态列表", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/queryEngineeringAndStatusPage")
public Result<IPage<EngineeringAndStatusVo>> queryEngineeringAndStatusPage(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<Engineering> wrapper = QueryGenerator.initPageQueryWrapper(Engineering.class, map);
Page<Engineering> page = PageUtil.getPage(map);
wrapper.lambda().orderByDesc(Engineering::getCreateTime);
IPage<EngineeringAndStatusVo> pageList = monitorDevService.queryEngineeringAndStatusPage(page, wrapper);
return Result.success(pageList);
}
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
@Data
public class OnlineGroupByProjectBo {
private String projectSn;
private String engineeringSn;
private Integer count;
private Integer onlineCount;
private Integer offlineCount;

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.city.monitor.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EngineeringAndStatusVo extends Engineering {
@ApiModelProperty(value = "视频监控在线数量")
private Integer monitorDevOnlineCount;
@ApiModelProperty(value = "视频监控离线数量")
private Integer monitorDevOfflineCount;
}

View File

@ -49,11 +49,11 @@
<select id="countOnlineGroupByProject"
resultType="com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo">
SELECT md.project_sn,
SELECT md.engineering_sn,
count(*) count,
ifnull(sum(if(md.state = 1, 1, 0)), 0) onlineCount,
ifnull(sum(if(md.state = 0, 1, 0)), 0) offlineCount
FROM monitor_dev md
group by md.project_sn
group by md.engineering_sn
</select>
</mapper>

View File

@ -1,12 +1,15 @@
package com.zhgd.xmgl.modules.city.monitor.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.EngineeringAndStatusVo;
import com.zhgd.xmgl.modules.city.project.entity.Project;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.CityAndDistrictMonitorVo;
@ -39,4 +42,6 @@ public interface IMonitorDevService extends IService<MonitorDev> {
boolean updateInfo(MonitorDev monitorDev);
List<CityAndDistrictMonitorVo> countCityAndDistrictMonitor();
IPage<EngineeringAndStatusVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper);
}

View File

@ -1,35 +1,46 @@
package com.zhgd.xmgl.modules.city.monitor.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.api.camera.MonitorApi;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexDeviceDto;
import com.zhgd.xmgl.modules.basicdata.dto.MonitorTreeDto;
import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData;
import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService;
import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentDevMapper;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.mapper.EngineeringMapper;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.government.entity.Government;
import com.zhgd.xmgl.modules.city.government.mapper.GovernmentMapper;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.CityAndDistrictMonitorVo;
import com.zhgd.xmgl.modules.city.monitor.entity.vo.EngineeringAndStatusVo;
import com.zhgd.xmgl.modules.city.monitor.mapper.MonitorDevMapper;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.modules.city.project.entity.Project;
import com.zhgd.xmgl.modules.wisdom.mapper.AiMonitorDevMapper;
import com.zhgd.xmgl.modules.city.dust.mapper.EnvironmentDevMapper;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import com.zhgd.xmgl.util.CommonUtil;
import com.zhgd.xmgl.util.ParamEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -51,7 +62,9 @@ public class MonitorDevServiceImpl extends ServiceImpl<MonitorDevMapper, Monitor
private AiMonitorDevMapper aiMonitorDevMapper;
@Autowired
private MonitorApi monitorApi;
private IEngineeringService engineeringService;
@Autowired
private ISystemDictDataService systemDictDataService;
@Autowired
private GovernmentMapper governmentMapper;
@ -197,4 +210,18 @@ public class MonitorDevServiceImpl extends ServiceImpl<MonitorDevMapper, Monitor
list.add(0, vo);
return list;
}
@Override
public IPage<EngineeringAndStatusVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper) {
Page<Engineering> pageList = engineeringService.page(page, wrapper);
Page<EngineeringAndStatusVo> rtPage = BeanUtil.toBean(pageList, Page.class);
rtPage.setRecords(BeanUtil.copyToList(pageList.getRecords(), EngineeringAndStatusVo.class));
List<OnlineGroupByProjectBo> onlineGroupByProjectBos = baseMapper.countOnlineGroupByProject();
Map<String, OnlineGroupByProjectBo> engineeringMap = onlineGroupByProjectBos.stream().collect(Collectors.toMap(OnlineGroupByProjectBo::getEngineeringSn, onlineGroupByProjectBo -> onlineGroupByProjectBo));
rtPage.getRecords().stream().forEach(s -> {
s.setMonitorDevOnlineCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getOnlineCount() : 0);
s.setMonitorDevOfflineCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getOfflineCount() : 0);
});
return rtPage;
}
}

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.towercrane.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
@ -11,8 +11,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.wisdom.statistics.TowerCraneAlarmStat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.towercrane.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import com.zhgd.xmgl.security.SecurityUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.towercrane.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
@ -14,10 +14,10 @@ import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneCurrentDataDto;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.basicdata.controller.project;
package com.zhgd.xmgl.modules.city.towercrane.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,8 +10,8 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.modules.basicdata.constant.ParamConstants;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneWorkCycleService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneWorkCycleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.towercrane.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.towercrane.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.towercrane.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.entity;
package com.zhgd.xmgl.modules.city.towercrane.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
package com.zhgd.xmgl.modules.city.towercrane.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
package com.zhgd.xmgl.modules.city.towercrane.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
package com.zhgd.xmgl.modules.city.towercrane.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.mapper;
package com.zhgd.xmgl.modules.city.towercrane.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
import org.apache.ibatis.annotations.Mapper;
/**

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.TowerCraneAlarmMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneAlarmMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.TowerCraneCurrentDataMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneCurrentDataMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.TowerCraneMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneMapper">
</mapper>
</mapper>

View File

@ -1,5 +1,5 @@
<?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.wisdom.mapper.TowerCraneWorkCycleMapper">
<mapper namespace="com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneWorkCycleMapper">
</mapper>
</mapper>

View File

@ -1,7 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.towercrane.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.wisdom.statistics.TowerCraneAlarmStat;
import java.util.Map;

View File

@ -1,8 +1,8 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.towercrane.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
/**
* @Description: 塔吊实时数据

View File

@ -1,9 +1,9 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.towercrane.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;

View File

@ -1,7 +1,7 @@
package com.zhgd.xmgl.modules.wisdom.service;
package com.zhgd.xmgl.modules.city.towercrane.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
/**
* @Description: 塔吊工作循环数据

View File

@ -1,14 +1,14 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.towercrane.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.wisdom.mapper.TowerCraneAlarmMapper;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneAlarm;
import com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneAlarmMapper;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneAlarmService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import com.zhgd.xmgl.modules.wisdom.statistics.TowerCraneAlarmStat;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.towercrane.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.constant.CacheConstants;
import com.zhgd.xmgl.modules.wisdom.dto.TowerCraneOperationDto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.wisdom.mapper.TowerCraneCurrentDataMapper;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneCurrentDataMapper;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,13 +1,13 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.towercrane.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.dto.ProjectPageDto;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.modules.city.project.service.IProjectService;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.mapper.TowerCraneMapper;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneMapper;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,10 +1,10 @@
package com.zhgd.xmgl.modules.wisdom.service.impl;
package com.zhgd.xmgl.modules.city.towercrane.service.impl;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCrane;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.wisdom.mapper.TowerCraneWorkCycleMapper;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneService;
import com.zhgd.xmgl.modules.wisdom.service.ITowerCraneWorkCycleService;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneWorkCycle;
import com.zhgd.xmgl.modules.city.towercrane.mapper.TowerCraneWorkCycleMapper;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneWorkCycleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,6 +1,6 @@
package com.zhgd.xmgl.modules.wisdom.dto;
import com.zhgd.xmgl.modules.wisdom.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@ -11,8 +11,10 @@ import com.zhgd.xmgl.modules.city.dust.service.IDustNoiseDataService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentDevService;
import com.zhgd.xmgl.modules.city.monitor.entity.MonitorDev;
import com.zhgd.xmgl.modules.city.monitor.service.IMonitorDevService;
import com.zhgd.xmgl.modules.wisdom.entity.*;
import com.zhgd.xmgl.modules.wisdom.service.*;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCrane;
import com.zhgd.xmgl.modules.city.towercrane.entity.TowerCraneCurrentData;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneCurrentDataService;
import com.zhgd.xmgl.modules.city.towercrane.service.ITowerCraneService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,5 +1,10 @@
package com.zhgd.xmgl.util;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
@ -29,11 +34,9 @@ public class DateUtils {
return cn.hutool.core.date.DateUtil.format(endOfDay, "yyyy-MM-dd HH:mm:ss");
}
public static void main(String[] args) {
System.out.println(end("2023-03-04"));
}
/**
* 时间格式化
*
* @param oldDate
* @return
*/
@ -43,7 +46,7 @@ public class DateUtils {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = df.parse(oldDate);
Calendar beijingcal=Calendar.getInstance();
Calendar beijingcal = Calendar.getInstance();
beijingcal.setTime(date);
//SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
//date1 = df1.parse(date.toString());
@ -74,7 +77,7 @@ public class DateUtils {
String formatStr2 = null;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");//注意格式化的表达式
try {
Date time = format.parse(createTime );
Date time = format.parse(createTime);
String date = time.toString();
//将西方形式的日期字符串转换成java.util.Date对象
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", java.util.Locale.US);
@ -89,9 +92,10 @@ public class DateUtils {
/**
* 查询本周所有天数
*
* @return
*/
public static List<String> getNowWeekAllDayList(){
public static List<String> getNowWeekAllDayList() {
Calendar cal = Calendar.getInstance();
// 判断要计算的日期是否是周日如果是则减一天计算周六的否则会出问题计算到下一周去了
// 获得当前日期是一个星期的第几天
@ -106,46 +110,50 @@ public class DateUtils {
int day = cal.get(Calendar.DAY_OF_WEEK);
// 根据日历的规则给当前日期减去星期几与一个星期第一天的差值
cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
return findDates(cal.getTime(),new Date());
return findDates(cal.getTime(), new Date());
}
/**
* 查询现在时间几天前到现在之间的所有日期
*
* @param days
* @return
*/
public static List<String> getOtherDayAllDayList(int days){
public static List<String> getOtherDayAllDayList(int days) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE,-days);
return findDates(cal.getTime(),new Date());
cal.add(Calendar.DATE, -days);
return findDates(cal.getTime(), new Date());
}
/**
* 查询本月所有天数
*
* @return
*/
public static List<String> getNowMonthAllDayList(){
public static List<String> getNowMonthAllDayList() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 1);
return findDates(cal.getTime(),new Date());
return findDates(cal.getTime(), new Date());
}
/**
* 获取两个时间段所有天数
*
* @param beginTime
* @param endTime
* @return
*/
public static List<String> getDiffTimeDayList(String beginTime,String endTime){
public static List<String> getDiffTimeDayList(String beginTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
return findDates(sdf.parse(beginTime),sdf.parse(endTime));
return findDates(sdf.parse(beginTime), sdf.parse(endTime));
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static List<String> findDates(Date dBegin, Date dEnd){
public static List<String> findDates(Date dBegin, Date dEnd) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List lDate = new ArrayList();
lDate.add(sdf.format(dBegin));
@ -156,10 +164,10 @@ public class DateUtils {
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 测试此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())){
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则为给定的日历字段添加或减去指定的时间量
calBegin.add(Calendar.DAY_OF_MONTH, 1);
if(calBegin.getTimeInMillis()<=dEnd.getTime()) {
if (calBegin.getTimeInMillis() <= dEnd.getTime()) {
lDate.add(sdf.format(calBegin.getTime()));
}
}
@ -168,36 +176,37 @@ public class DateUtils {
/**
* 获取指定年份所有天数
*
* @param yearMonth
* @return
*/
public static List<String> getYearAllMonthList(String yearMonth) {
String year=yearMonth.substring(0,4);
List<String> list=new ArrayList<>();
for (int i = 1; i <=12 ; i++) {
if(i<10){
list.add(year+"0"+i);
}else{
list.add(year+i);
String year = yearMonth.substring(0, 4);
List<String> list = new ArrayList<>();
for (int i = 1; i <= 12; i++) {
if (i < 10) {
list.add(year + "0" + i);
} else {
list.add(year + i);
}
}
return list;
}
/**
*
* @param yearMonth 月份格式yyyy-MM
* @param yearMonth 月份格式yyyy-MM
* @return
*/
public static List<String> getMonthDayList(String yearMonth) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
//判断是否是当月
if(yearMonth.equals(sdf.format(new Date()))){
if (yearMonth.equals(sdf.format(new Date()))) {
return getNowMonthAllDayList();
}else{
} else {
return getDayListOfMonth(yearMonth);
}
}
public static List<String> getDayListOfMonth(String yearMonth) {
int year = Integer.parseInt(yearMonth.split("-")[0]); //
int month = Integer.parseInt(yearMonth.split("-")[1]); //
@ -220,14 +229,15 @@ public class DateUtils {
int firstDay = startCal.getActualMinimum(Calendar.DAY_OF_MONTH);
//设置日历中月份的最小天数
startCal.set(Calendar.DAY_OF_MONTH, firstDay);
return findDates(startCal.getTime(),endCal.getTime());
return findDates(startCal.getTime(), endCal.getTime());
}
/**
* 获取当前周第一天日期
*
* @return
*/
public static String getNowWeekStartTime(){
public static String getNowWeekStartTime() {
Calendar cal = Calendar.getInstance();
// 判断要计算的日期是否是周日如果是则减一天计算周六的否则会出问题计算到下一周去了
// 获得当前日期是一个星期的第几天
@ -245,16 +255,18 @@ public class DateUtils {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
public static List<String> getDiffTimeYearList(String beginTime,String endTime){
public static List<String> getDiffTimeYearList(String beginTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
return findYear(sdf.parse(beginTime),sdf.parse(endTime));
return findYear(sdf.parse(beginTime), sdf.parse(endTime));
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static List<String> findYear(Date dBegin, Date dEnd){
public static List<String> findYear(Date dBegin, Date dEnd) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
List lDate = new ArrayList();
lDate.add(sdf.format(dBegin));
@ -265,25 +277,27 @@ public class DateUtils {
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 测试此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())){
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则为给定的日历字段添加或减去指定的时间量
calBegin.add(Calendar.YEAR, 1);
if(calBegin.getTimeInMillis()<=dEnd.getTime()) {
if (calBegin.getTimeInMillis() <= dEnd.getTime()) {
lDate.add(sdf.format(calBegin.getTime()));
}
}
return lDate;
}
public static List<String> getDiffTimeMonthList(String beginTime,String endTime){
public static List<String> getDiffTimeMonthList(String beginTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
return findMonth(sdf.parse(beginTime),sdf.parse(endTime));
return findMonth(sdf.parse(beginTime), sdf.parse(endTime));
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static List<String> findMonth(Date dBegin, Date dEnd){
public static List<String> findMonth(Date dBegin, Date dEnd) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
List lDate = new ArrayList();
lDate.add(sdf.format(dBegin));
@ -294,10 +308,10 @@ public class DateUtils {
// 使用给定的 Date 设置此 Calendar 的时间
calEnd.setTime(dEnd);
// 测试此日期是否在指定日期之后
while (dEnd.after(calBegin.getTime())){
while (dEnd.after(calBegin.getTime())) {
// 根据日历的规则为给定的日历字段添加或减去指定的时间量
calBegin.add(Calendar.MONTH, 1);
if(calBegin.getTimeInMillis()<=dEnd.getTime()) {
if (calBegin.getTimeInMillis() <= dEnd.getTime()) {
lDate.add(sdf.format(calBegin.getTime()));
}
}
@ -305,16 +319,16 @@ public class DateUtils {
}
public static List<String> getDiffTimeWeekList(String beginTime,String endTime){
public static List<String> getDiffTimeWeekList(String beginTime, String endTime) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate startDate = LocalDate.parse(beginTime,formatter);
LocalDate endDate = LocalDate.parse(endTime,formatter);
LocalDate startDate = LocalDate.parse(beginTime, formatter);
LocalDate endDate = LocalDate.parse(endTime, formatter);
List<String> lDate = new ArrayList();
while (endDate.isAfter(startDate)){
String start=startDate.format(formatter);
if(startDate.getDayOfWeek()==DayOfWeek.SUNDAY) {
while (endDate.isAfter(startDate)) {
String start = startDate.format(formatter);
if (startDate.getDayOfWeek() == DayOfWeek.SUNDAY) {
lDate.add(start + "/" + start);
}else{
} else {
LocalDate sunday = startDate.with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
if (sunday.isAfter(endDate)) {
lDate.add(start + "/" + endDate.format(formatter));
@ -322,7 +336,7 @@ public class DateUtils {
lDate.add(start + "/" + sunday.format(formatter));
}
}
startDate=startDate.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)).plusDays(1);
startDate = startDate.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)).plusDays(1);
}
return lDate;
@ -330,15 +344,16 @@ public class DateUtils {
/**
* 获取当前时间和当天时间几天前之间的所有天数
* @param dayNum 当天时间以前具体几天
*
* @param dayNum 当天时间以前具体几天
* @return
*/
public static List<String> getNowFewDaysAgoList(int dayNum){
public static List<String> getNowFewDaysAgoList(int dayNum) {
try {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -dayNum);
Date date = calendar.getTime();
return findDates(date,new Date());
return findDates(date, new Date());
} catch (Exception e) {
e.printStackTrace();
}
@ -346,22 +361,20 @@ public class DateUtils {
}
/**
*
* @param type 1 今日24 小时2本周所有天3本月所有天
* @return
*/
public static List<String> getDayList(Integer type) {
if(type==1){
List<String> list=new ArrayList<>();
for(int i=0;i<=23;i++){
list.add(i+"");
if (type == 1) {
List<String> list = new ArrayList<>();
for (int i = 0; i <= 23; i++) {
list.add(i + "");
}
return list;
}else if(type==2){
} else if (type == 2) {
return getNowWeekAllDayList();
}else if(type==3){
} else if (type == 3) {
return getNowMonthAllDayList();
}
return null;
@ -369,48 +382,184 @@ public class DateUtils {
/**
* 比较两个日期大小
*
* @param time1
* @param time2
* @return
* @throws ParseException
*/
public static boolean compareTime(String time1,String time2){
public static boolean compareTime(String time1, String time2) {
try {
//如果想比较日期则写成"yyyy-MM-dd"就可以了
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//将字符串形式的时间转化为Date类型的时间
Date a=sdf.parse(time1);
Date b=sdf.parse(time2);
Date a = sdf.parse(time1);
Date b = sdf.parse(time2);
//Date类的一个方法如果a早于b返回true否则返回false
//a时间下雨b时间返回true,否正返回false
if(a.before(b)) {
if (a.before(b)) {
return true;
}else {
} else {
return false;
}
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* 查询当前时间指定天数之前的日期
* @Title: getBeginDayTime
* @Description: TODO(这里用一句话描述这个方法的作用)
* @param @param days
* @param @return 参数
*
* @param @param days
* @param @return 参数
* @return String 返回类型
* @throws
* @Title: getBeginDayTime
*/
public static String getBeginDayTime(int days){
public static String getBeginDayTime(int days) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE,-days);
cal.add(Calendar.DATE, -days);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(cal.getTime());
}
// public static void main(String[] args) {
// //log.info(dealDateFormat("2021-08-25T04:22:20+0000"));
// System.out.println(getOtherDayAllDayList(10));
// }
/**
* 获取一天内的小时列表
*
* @return
*/
public static List<String> getAllHourInDay() {
return Arrays.asList("00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00");
}
/**
* 转成GMT时间
*
* @param date
*/
public static String getGMTTime(Date date) {
DateFormat dateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.ENGLISH);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
return dateFormat.format(date);
}
/**
* 查询本月所有天数Fix2023-06-01到2023-06-30
*
* @return
*/
public static List<String> getCurrentMonthAllDayList() {
ArrayList<String> rtList = new ArrayList<>();
Date now = new Date();
DateTime beginDate = cn.hutool.core.date.DateUtil.beginOfMonth(now);
DateTime endDate = cn.hutool.core.date.DateUtil.endOfMonth(now);
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询一个月前内所有天数2023-06-10到2023-07-10
*
* @return
*/
public static List<String> getDaysBetweenLastMonth() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.lastMonth();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询一个年内所有月份2022-06到2023-06
*
* @return
*/
public static List<String> getMonthsBetweenLastYear() {
ArrayList<String> rtList = new ArrayList<>();
DateTime endDate = DateTime.now();
DateTime beginDate = cn.hutool.core.date.DateUtil.offsetMonth(endDate, -12);
for (int i = 0; i <= 12; i++) {
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMonth(beginDate, i),"yyyy-MM"));
}
return rtList;
}
/**
* 查询一个周前内所有天数2023-06-10到2023-06-17
*
* @return
*/
public static List<String> getDaysBetweenLastWeek() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询指定天数内所有天数列表, 返回[07-30, 07-31]
*
* @param queryStartTime 2023-07-31
* @param queryEndTime 2023-07-31
* @return
*/
public static List<String> getBetweenDays(String queryStartTime, String queryEndTime) {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = DateUtil.parseDate(queryStartTime);
DateTime endDate = DateUtil.parseDate(queryEndTime);
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i), "MM-dd"));
}
return rtList;
}
/**
* 查询一个周前内所有天数06-10到06-17
*
* @return
*/
public static List<String> getDaysBetweenLastWeekWithoutYear() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i), "MM-dd"));
}
return rtList;
}
/**
* 查询一天前内所有小时12:00 > 11:00
*
* @return
*/
public static List<String> getHoursListLastDay() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.yesterday();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.between(beginDate, endDate, DateUnit.HOUR);
for (int i = 1; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetHour(beginDate, i), "HH:00"));
}
return rtList;
}
public static void main(String[] args) {
System.out.println(getMonthsBetweenLastYear());
}
}