This commit is contained in:
guo 2023-09-06 16:30:46 +08:00
parent 58530d94b3
commit b04f927016
22 changed files with 803 additions and 85 deletions

View File

@ -37,4 +37,16 @@ public class CityAndDistrictDeviceCountVo extends Engineering {
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer completedCount;
@ApiModelProperty("正常")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer normalCount;
@ApiModelProperty("超预警")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer superWarningCount;
@ApiModelProperty("超报警")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer superAlarmCount;
@ApiModelProperty("超控制")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer overControlCount;
}

View File

@ -0,0 +1,20 @@
package com.zhgd.xmgl.base.entity.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 扇形图表
*/
@Data
public class SectorVo {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("数量")
private String count;
@ApiModelProperty("百分比")
private String percent;
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer state;
}

View File

@ -2,6 +2,9 @@ package com.zhgd.xmgl.base.entity.vo;
import lombok.Data;
/**
* 折线和柱形图表
*/
@Data
public class TrendVo {
private String x;

View File

@ -1,9 +1,16 @@
package com.zhgd.xmgl.modules.city.deepexcavation.controller;
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.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.base.entity.vo.CityAndDistrictDeviceCountVo;
import com.zhgd.xmgl.modules.city.deepexcavation.entity.DeepExcavationEngineering;
import com.zhgd.xmgl.modules.city.deepexcavation.service.IDeepExcavationEngineeringService;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -16,6 +23,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
@ -120,5 +128,28 @@ public class DeepExcavationEngineeringController {
return result;
}
@OperLog(operModul = "深基坑管理", operType = "统计", operDesc = "统计市级和区级的深基坑")
@ApiOperation(value = "统计市级和区级的深基坑", notes = "统计市级和区级的深基坑", httpMethod = "POST")
@PostMapping(value = "/countCityAndDistrictDeepExcavationEngineering")
public Result<List<CityAndDistrictDeviceCountVo>> countCityAndDistrictDeepExcavationEngineering() {
List<CityAndDistrictDeviceCountVo> countCityAndDistrictDeepExcavationEngineerings = deepExcavationEngineeringService.countCityAndDistrictDeepExcavationEngineering();
return Result.success(countCityAndDistrictDeepExcavationEngineerings);
}
@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<CityAndDistrictDeviceCountVo>> 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<CityAndDistrictDeviceCountVo> pageList = deepExcavationEngineeringService.queryEngineeringAndStatusPage(page, wrapper);
return Result.success(pageList);
}
}

View File

@ -40,5 +40,4 @@ public interface DeepExcavationCurrentDataMapper extends BaseMapper<DeepExcavati
List<EntityMap> getAlarmCycleTrendGraph(Map<String, Object> map);
List<NumberDifferentTypesAlarmsRadarChartOneMonthVo> getNumberDifferentTypesAlarmsRadarChartOneMonth(Map<String, Object> map);
}

View File

@ -2,7 +2,10 @@ package com.zhgd.xmgl.modules.city.deepexcavation.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.base.entity.vo.CityAndDistrictDeviceCountVo;
import com.zhgd.xmgl.modules.city.deepexcavation.entity.DeepExcavationEngineering;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -16,9 +19,14 @@ import java.util.Map;
* @version V1.0
*/
@Mapper
@DataScope
public interface DeepExcavationEngineeringMapper extends BaseMapper<DeepExcavationEngineering> {
List<DeepExcavationEngineering> selectDeepExcavationEngineeringPage(Page<DeepExcavationEngineering> page, @Param("param")Map<String, Object> map);
List<DeepExcavationEngineering> selectDeepExcavationList(Map<String, Object> map);
List<CityAndDistrictDeviceCountVo> countCityAndDistrictDeepExcavationEngineering();
List<OnlineGroupByProjectBo> countCompleteGroupByProject();
}

View File

@ -194,47 +194,4 @@
GROUP BY time
</select>
<select id="getNumberDifferentTypesAlarmsRadarChartOneMonth"
resultType="com.zhgd.xmgl.modules.highformwork.entity.vo.NumberDifferentTypesAlarmsRadarChartOneMonthVo">
SELECT
demt.monitor_type_name as name,count(*) num
FROM
deep_excavation_plane_figure_coordinate a
INNER JOIN deep_excavation_measure_point b ON a.point_id = b.id
INNER JOIN deep_excavation_sensor des ON b.measure_point_number = des.measure_point_number
INNER JOIN deep_excavation_current_data decd ON decd.sensor_sn = des.sensor_sn
INNER JOIN deep_excavation_monitor_type_rela demtr ON demtr.deep_excavation_id = b.deep_excavation_id AND
demtr.id=b.rela_id
INNER JOIN deep_excavation_monitor_type demt ON demt.id = demtr.monitor_type_id
WHERE a.plane_figure_id = #{planeFigureId}
and decd.project_sn = #{projectSn}
and decd.receive_time >= DATE_SUB(NOW(),INTERVAL 30 day)
and decd.alarm_state in (2,3,4)
group by demt.monitor_type_name
order by num desc
</select>
<!-- <select id="selectDeepExcavationCurrentDataList"
resultType="com.zhgd.xmgl.modules.city.foundation.entity.DeepExcavationCurrentData">
SELECT a.*
from deep_excavation_current_data a LEFT JOIN deep_excavation_measure_point b ON
a.measuring_point_sn=b.measure_point_number
WHERE a.project_sn=#{projectSn}
<if test="monitorTypeId!=null and monitorTypeId!=''">
and b.monitor_type_id=#{monitorTypeId}
</if>
<if test="startTime!=null and startTime!=''">
AND a.receive_time >=#{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and a.receive_time&lt;=#{endTime}
</if>
<if test="listType == '1'.toString()">
and a.measuring_point_sn in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by a.receive_time
</select>-->
</mapper>

View File

@ -18,4 +18,23 @@
order by start_time
</select>
<select id="countCityAndDistrictDeepExcavationEngineering"
resultType="com.zhgd.xmgl.base.entity.vo.CityAndDistrictDeviceCountVo">
SELECT g.government_sn,
g.government_name,
count(*) count,
ifnull(sum(if(md.online = 1, 1, 0)), 0) onlineCount,
ifnull(sum(if(md.online = 0, 1, 0)), 0) offlineCount
FROM deep_excavation_engineering md
INNER JOIN project p ON p.project_sn = md.project_sn
INNER JOIN `government` g ON g.government_sn = p.government_sn
group by g.government_sn
</select>
<select id="countCompleteGroupByProject"
resultType="com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo">
</select>
</mapper>

View File

@ -43,6 +43,5 @@ public interface IDeepExcavationCurrentDataService extends IService<DeepExcavati
DataAlarmVO getDataAlarmNumber();
List<NumberDifferentTypesAlarmsRadarChartOneMonthVo> getNumberDifferentTypesAlarmsRadarChartOneMonth(Map<String, Object> map);
}

View File

@ -1,8 +1,12 @@
package com.zhgd.xmgl.modules.city.deepexcavation.service;
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.base.entity.vo.CityAndDistrictDeviceCountVo;
import com.zhgd.xmgl.modules.city.deepexcavation.entity.DeepExcavationEngineering;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import java.util.List;
import java.util.Map;
@ -24,4 +28,8 @@ public interface IDeepExcavationEngineeringService extends IService<DeepExcavati
List<DeepExcavationEngineering> selectDeepExcavationList(Map<String, Object> map);
DeepExcavationEngineering edit(DeepExcavationEngineering deepExcavationEngineering);
List<CityAndDistrictDeviceCountVo> countCityAndDistrictDeepExcavationEngineering();
IPage<CityAndDistrictDeviceCountVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper);
}

View File

@ -131,14 +131,6 @@ public class DeepExcavationCurrentDataServiceImpl extends ServiceImpl<DeepExcava
return new DataAlarmVO(allList.size(), month, week, day);
}
@Override
public List<NumberDifferentTypesAlarmsRadarChartOneMonthVo> getNumberDifferentTypesAlarmsRadarChartOneMonth(Map<String, Object> map) {
List<NumberDifferentTypesAlarmsRadarChartOneMonthVo> list = deepExcavationCurrentDataMapper.getNumberDifferentTypesAlarmsRadarChartOneMonth(map);
fillData(list);
return list;
}
private void fillData(List<NumberDifferentTypesAlarmsRadarChartOneMonthVo> list) {
Map<String, NumberDifferentTypesAlarmsRadarChartOneMonthVo> nameDataMap = list.stream().collect(Collectors.toMap(NumberDifferentTypesAlarmsRadarChartOneMonthVo::getName, o -> o));
//类型 1电量%2 X轴°3 Y轴°4压力kN5沉降mm

View File

@ -1,20 +1,36 @@
package com.zhgd.xmgl.modules.city.deepexcavation.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
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;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.base.entity.bo.CountExt;
import com.zhgd.xmgl.base.entity.vo.CityAndDistrictDeviceCountVo;
import com.zhgd.xmgl.modules.city.deepexcavation.entity.DeepExcavationEngineering;
import com.zhgd.xmgl.modules.city.deepexcavation.entity.DeepExcavationMonitorTypeRela;
import com.zhgd.xmgl.modules.city.deepexcavation.mapper.DeepExcavationEngineeringMapper;
import com.zhgd.xmgl.modules.city.deepexcavation.mapper.DeepExcavationMeasurePointMapper;
import com.zhgd.xmgl.modules.city.deepexcavation.mapper.DeepExcavationMonitorTypeMapper;
import com.zhgd.xmgl.modules.city.deepexcavation.service.*;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
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.highformwork.mapper.HighFormworkMeasureCurrentAndAlarmDataMapper;
import com.zhgd.xmgl.modules.city.highformwork.mapper.HighFormworkMeasurePointMapper;
import com.zhgd.xmgl.modules.city.highformwork.mapper.HighFormworkMeasurePointThresholdMapper;
import com.zhgd.xmgl.modules.city.highformwork.service.IHighFormworkMeasureCurrentAndAlarmDataService;
import com.zhgd.xmgl.modules.city.monitor.entity.bo.OnlineGroupByProjectBo;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,6 +41,7 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -57,6 +74,18 @@ public class DeepExcavationEngineeringServiceImpl extends ServiceImpl<DeepExcava
@Autowired
private DeepExcavationMonitorTypeRelaService deepExcavationMonitorTypeRelaService;
@Autowired
private HighFormworkMeasurePointMapper highFormworkMeasurePointMapper;
@Autowired
private HighFormworkMeasurePointThresholdMapper highFormworkMeasurePointThresholdMapper;
@Autowired
private IHighFormworkMeasureCurrentAndAlarmDataService highFormworkMeasureCurrentAndAlarmDataService;
@Autowired
private HighFormworkMeasureCurrentAndAlarmDataMapper highFormworkMeasureCurrentAndAlarmDataMapper;
@Autowired
private IEngineeringService engineeringService;
@Autowired
private GovernmentMapper governmentMapper;
@Override
public void saveDeepExcavationEngineering(DeepExcavationEngineering deepExcavationEngineering) {
@ -103,6 +132,45 @@ public class DeepExcavationEngineeringServiceImpl extends ServiceImpl<DeepExcava
return deepExcavationEngineering;
}
@Override
public List<CityAndDistrictDeviceCountVo> countCityAndDistrictDeepExcavationEngineering() {
SecurityUser user = SecurityUtil.getUser();
List<CityAndDistrictDeviceCountVo> list = baseMapper.countCityAndDistrictDeepExcavationEngineering();
Government government = governmentMapper.selectOne(new LambdaQueryWrapper<Government>().eq(Government::getGovernmentSn, user.getSn()));
CityAndDistrictDeviceCountVo vo = new CityAndDistrictDeviceCountVo();
vo.setGovernmentName(government.getGovernmentName());
vo.setCount(list.stream().mapToInt(e -> e.getCount()).sum());
vo.setNotStartedCount(list.stream().mapToInt(e -> e.getNotStartedCount()).sum());
vo.setInProgressCount(list.stream().mapToInt(e -> e.getInProgressCount()).sum());
vo.setCompletedCount(list.stream().mapToInt(e -> e.getCompletedCount()).sum());
list.add(0, vo);
return list;
}
@Override
public IPage<CityAndDistrictDeviceCountVo> queryEngineeringAndStatusPage(Page<Engineering> page, QueryWrapper<Engineering> wrapper) {
Page<Engineering> pageList = engineeringService.page(page, wrapper);
Page<CityAndDistrictDeviceCountVo> rtPage = BeanUtil.toBean(pageList, Page.class);
rtPage.setRecords(BeanUtil.copyToList(pageList.getRecords(), CityAndDistrictDeviceCountVo.class));
List<CountExt> alarms = highFormworkMeasureCurrentAndAlarmDataMapper.countAlarmGroupByEngineeringSn();
Map<String, CountExt> snMap = alarms.stream().collect(Collectors.toMap(CountExt::getEngineeringSn, Function.identity()));
List<OnlineGroupByProjectBo> onlineGroupByProjectBos = baseMapper.countCompleteGroupByProject();
Map<String, OnlineGroupByProjectBo> engineeringMap = onlineGroupByProjectBos.stream().collect(Collectors.toMap(OnlineGroupByProjectBo::getEngineeringSn, onlineGroupByProjectBo -> onlineGroupByProjectBo));
rtPage.getRecords().stream().forEach(s -> {
s.setNotStartedCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getNotStartedCount() : 0);
s.setInProgressCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getInProgressCount() : 0);
s.setCompletedCount(engineeringMap.get(s.getEngineeringSn()) != null ? engineeringMap.get(s.getEngineeringSn()).getCompletedCount() : 0);
CountExt countExt = snMap.get(s.getEngineeringSn());
if (countExt != null) {
s.setAlarmCount(countExt.getCount());
} else {
s.setAlarmCount(0);
}
});
return rtPage;
}
private void checkParams(DeepExcavationEngineering deepExcavationEngineering) {
if (DateUtil.parse(deepExcavationEngineering.getStartTime()).compareTo(DateUtil.parse(deepExcavationEngineering.getEndTime())) > 0) {
throw new OpenAlertException("开工时间不能大于完工时间");

View File

@ -8,11 +8,17 @@ 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.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.basicdata.entity.EngineeringSingle;
import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
import com.zhgd.xmgl.modules.city.engineering.service.IEngineeringService;
import com.zhgd.xmgl.util.ParamEnum;
import com.zhgd.xmgl.valid.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -27,8 +33,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -48,6 +57,7 @@ public class EngineeringController {
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "工程管理", operType = "分页查询", operDesc = "分页列表查询报监记录")
@ -98,9 +108,9 @@ public class EngineeringController {
public Result<Engineering> edit(@RequestBody EngineeringVo engineeringVo) {
Result<Engineering> result = new Result<Engineering>();
Engineering engineering = engineeringService.getById(engineeringVo.getId());
if(engineering==null) {
if (engineering == null) {
result.error500("未找到对应实体");
}else {
} else {
engineeringVo.setExamineState(engineering.getExamineState());
engineeringService.updateInfo(engineeringVo);
result.success("操作成功!");
@ -179,4 +189,95 @@ public class EngineeringController {
public Result<List<EngineeringSingle>> querySingle(@ApiIgnore @RequestBody Engineering engineeringEntity) {
return Result.success(engineeringService.querySingle(engineeringEntity));
}
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程")
@ApiOperation(value = "统计工程", notes = "统计工程", httpMethod = "POST")
@PostMapping(value = "/countEngineering")
public Result<CountEngineeringVo> countEngineering() {
return Result.success(engineeringService.countEngineering());
}
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程进度")
@ApiOperation(value = "统计工程进度", notes = "统计工程进度", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer")
})
@PostMapping(value = "/countEngineeringState")
public Result<List<SectorVo>> countEngineeringState(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.countEngineeringState(paramMap));
}
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程分布区域")
@ApiOperation(value = "统计工程分布区域", notes = "统计工程分布区域", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "progressType", value = "工程进度1新建2竣工", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "newYear", value = "新建年份如2020", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/countEngineeringDistrict")
public Result<List<TrendVo>> countEngineeringDistrict(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.countEngineeringDistrict(paramMap));
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "查询工程类别列表")
@ApiOperation(value = "查询工程类别列表", notes = "查询工程类别列表", httpMethod = "POST")
@PostMapping(value = "/getEngineeringTypeList")
public Result<List<ParamEnum.EngineeringType>> getEngineeringTypeList() {
return Result.success(Arrays.stream(ParamEnum.EngineeringType.values()).collect(Collectors.toList()));
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "查询工程造价趋势")
@ApiOperation(value = "查询工程造价趋势", notes = "查询工程造价趋势", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer")
})
@PostMapping(value = "/getEngineeringCostTrendMonth")
public Result<EngineeringTrendVo> getEngineeringCostTrendMonth(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.getEngineeringCostTrendMonth(paramMap));
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "统计工程造价占比")
@ApiOperation(value = "统计工程造价占比", notes = "统计工程造价占比", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer")
})
@PostMapping(value = "/countEngineeringCostProportion")
public Result<List<SectorVo>> countEngineeringCostProportion(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.countEngineeringCostProportion(paramMap));
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "查询工程趋势(今年和去年)")
@ApiOperation(value = "查询工程趋势(今年和去年)", notes = "查询工程趋势(今年和去年)", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "progressType", value = "工程进度1新建2竣工", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "isImportant", value = "是否重点工程(0:不是;1:是;)", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/getEngineeringTrendMonth")
public Result<EngineeringTrendVo> getEngineeringTrendMonth(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.getEngineeringTrendMonth(paramMap));
}
@OperLog(operModul = "工程管理", operType = "查询", operDesc = "查询工程趋势(新建和在建)")
@ApiOperation(value = "查询工程趋势(新建和在建)", notes = "查询工程趋势(新建和在建)", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "engineeringType", value = "工程类别", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "isImportant", value = "是否重点工程(0:不是;1:是;)", paramType = "body", required = false, dataType = "Integer"),
})
@PostMapping(value = "/getEngineeringTrendProgressMonth")
public Result<EngineeringTrendProgressVo> getEngineeringTrendProgressMonth(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.getEngineeringTrendProgressMonth(paramMap));
}
@OperLog(operModul = "工程管理", operType = "统计", operDesc = "统计工程区域造价")
@ApiOperation(value = "统计工程区域造价", notes = "统计工程区域造价", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "newYear", value = "新建年份如2020", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/countEngineeringDistrictCost")
public Result<List<TrendVo>> countEngineeringDistrictCost(@ApiIgnore @RequestBody HashMap<String, Object> paramMap) {
return Result.success(engineeringService.countEngineeringDistrictCost(paramMap));
}
}

View File

@ -0,0 +1,22 @@
package com.zhgd.xmgl.modules.city.engineering.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CountEngineeringVo {
@ApiModelProperty("在监工程数量")
private Integer projectUnderSupervisionCount;
@ApiModelProperty("工程总造价")
private Double totalProjectCost;
@ApiModelProperty("今年新建数量")
private Integer newThisYearCount;
@ApiModelProperty("今年竣工数量")
private Integer completedThisYearCount;
@ApiModelProperty("重点工程数量")
private Integer keyProjectCount;
@ApiModelProperty(value = "工程总长度(m)")
private Double totalEngineeringLength;
@ApiModelProperty(value = "工程总面积(㎡)")
private Double totalEngineeringArea;
}

View File

@ -0,0 +1,15 @@
package com.zhgd.xmgl.modules.city.engineering.entity.vo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class EngineeringTrendProgressVo {
@ApiModelProperty("新建")
private List<TrendVo> newBuilds;
@ApiModelProperty("在建")
private List<TrendVo> underConstructions;
}

View File

@ -0,0 +1,12 @@
package com.zhgd.xmgl.modules.city.engineering.entity.vo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import lombok.Data;
import java.util.List;
@Data
public class EngineeringTrendVo {
private List<TrendVo> thisYears;
private List<TrendVo> lastYears;
}

View File

@ -5,13 +5,17 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.annotation.DataScope;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -38,4 +42,33 @@ public interface EngineeringMapper extends BaseMapper<Engineering> {
Map<String, Object> appIndexStat();
List<Map<String, Object>> queryDistrict();
Integer getProjectUnderSupervisionCount();
Double getTotalProjectCost();
Integer getNewThisYearCount();
Integer getCompletedThisYearCount();
Integer getKeyProjectCount();
Double getTotalEngineeringArea();
Double getTotalEngineeringLength();
List<SectorVo> countEngineeringState(HashMap<String, Object> paramMap);
List<TrendVo> countEngineeringDistrict(HashMap<String, Object> paramMap);
List<TrendVo> getEngineeringCostTrendMonth(HashMap<String, Object> paramMap);
Integer countEngineeringCost(HashMap<String, Object> paramMap);
List<TrendVo> getEngineeringTrendMonth(HashMap<String, Object> paramMap);
List<Engineering> getList(HashMap<String, Object> paramMap);
List<TrendVo> countEngineeringDistrictCost(HashMap<String, Object> paramMap);
}

View File

@ -1,42 +1,217 @@
<?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.city.engineering.mapper.EngineeringMapper">
<select id="getSnListByGov" resultType="java.lang.String">
SELECT e.engineering_sn FROM engineering e LEFT JOIN project p ON e.project_sn = p.project_sn
where p.government_sn = #{governmentSn}
SELECT e.engineering_sn
FROM engineering e
LEFT JOIN project p ON e.project_sn = p.project_sn
where p.government_sn = #{governmentSn}
</select>
<select id="getSnListByEnterprise" resultType="java.lang.String">
SELECT DISTINCT engineering_sn FROM engineering_main where enterprise_sn = #{enterpriseSn}
SELECT DISTINCT engineering_sn
FROM engineering_main
where enterprise_sn = #{enterpriseSn}
</select>
<select id="pageListForSuperior" resultType="com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto">
SELECT e.engineering_sn, e.engineering_name, e.province, e.city, e.district, e.address, e.state, e.longitude, e.latitude, e.ai_alarm_stat FROM engineering e
SELECT e.engineering_sn,
e.engineering_name,
e.province,
e.city,
e.district,
e.address,
e.state,
e.longitude,
e.latitude,
e.ai_alarm_stat
FROM engineering e
${ew.customSqlSegment}
</select>
<select id="engineeringStat" resultType="com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat">
SELECT e.engineering_sn, e.engineering_name, e.province, e.city, e.district, e.address, e.state, e.engineering_type,
e.engineering_code, e.engineering_area, e.engineering_use, e.start_time, e.end_time
FROM engineering e WHERE e.examine_state = 3
SELECT e.engineering_sn,
e.engineering_name,
e.province,
e.city,
e.district,
e.address,
e.state,
e.engineering_type,
e.engineering_code,
e.engineering_area,
e.engineering_use,
e.start_time,
e.end_time
FROM engineering e
WHERE e.examine_state = 3
${ew.customSqlSegment}
</select>
<select id="getDetail" resultType="com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo">
SELECT e.*, p.project_name FROM engineering e left join project p on e.project_sn = p.project_sn where e.id = #{engineeringId}
SELECT e.*, p.project_name
FROM engineering e
left join project p on e.project_sn = p.project_sn
where e.id = #{engineeringId}
</select>
<select id="appIndexStat" resultType="java.util.Map">
SELECT
SUM(IFNULL(state > 1 AND state != 7,0)) as building,
SUM(IFNULL(YEAR(start_time) = YEAR(NOW()) AND state > 1,0)) as newBuild,
SUM(IFNULL(YEAR(start_time) = YEAR(NOW()) AND state = 7,0)) as finish
SELECT SUM(IFNULL(state > 1 AND state != 7, 0)) as building,
SUM(IFNULL(YEAR(start_time) = YEAR(NOW()) AND state > 1, 0)) as newBuild,
SUM(IFNULL(YEAR(start_time) = YEAR(NOW()) AND state = 7, 0)) as finish
FROM engineering
</select>
<select id="queryDistrict" resultType="java.util.Map">
SELECT district as label, district as value FROM engineering where district != '' AND examine_state = 3 GROUP BY district
SELECT district as label, district as value
FROM engineering
where district != ''
AND examine_state = 3
GROUP BY district
</select>
<select id="getProjectUnderSupervisionCount" resultType="java.lang.Integer">
select count(*)
from engineering
where examine_state = 3
</select>
<select id="getTotalProjectCost" resultType="java.lang.Double">
select sum(engineering_cost)
from engineering
</select>
<select id="getNewThisYearCount" resultType="java.lang.Integer">
select count(*)
from engineering
where year(start_time) = year(now())
</select>
<select id="getCompletedThisYearCount" resultType="java.lang.Integer">
select count(*)
from engineering
where year(end_time) = year(now())
</select>
<select id="getKeyProjectCount" resultType="java.lang.Integer">
select count(*)
from engineering
where is_important = 1
</select>
<select id="getTotalEngineeringArea" resultType="java.lang.Double">
select sum(engineering_area)
from engineering
</select>
<select id="getTotalEngineeringLength" resultType="java.lang.Double">
select sum(engineering_length)
from engineering
</select>
<select id="countEngineeringState" resultType="com.zhgd.xmgl.base.entity.vo.SectorVo">
select state, count(*) count
from engineering
where 1 = 1
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
group by state
</select>
<select id="countEngineeringDistrict" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
select district x, count(*) y
from engineering
where 1 = 1
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
<if test="progressType == '1'.toString()">
and year(start_time) = year(now())
</if>
<if test="progressType == '2'.toString()">
and year(end_time) = year(now())
</if>
<if test="newYear != null and newYear != ''">
and year(start_time) = #{newYear}
</if>
group by province, city, district
</select>
<select id="getEngineeringCostTrendMonth" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
select date_format(examine_time, '%Y%m') x, count(*) y
from engineering
where 1 = 1
and examine_time >= CONCAT(YEAR(date_sub(current_date, interval 1 year)), '-01-01')
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
group by x
</select>
<select id="countEngineeringCost" resultType="java.lang.Integer">
select count(*) y
from engineering
where 1 = 1
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
<if test="engineeringCostBegin != null and engineeringCostBegin != ''">
and engineering_cost >= #{engineeringCostBegin}
</if>
<if test="engineeringCostEnd != null and engineeringCostEnd != ''">
and engineering_cost <![CDATA[<]]> #{engineeringCostEnd}
</if>
</select>
<select id="getEngineeringTrendMonth" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
select
<if test="progressType == '1'.toString()">
date_format(start_time, '%Y%m') x,
</if>
<if test="progressType == '2'.toString()">
date_format(end_time, '%Y%m') x,
</if>
count(*) y
from engineering
where 1 = 1
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
<if test="progressType == '1'.toString()">
and year(start_time) = year(now())
</if>
<if test="progressType == '2'.toString()">
and year(end_time) = year(now())
</if>
<if test="isImportant != null">
and is_important = #{isImportant}
</if>
group by x
</select>
<select id="getList" resultType="com.zhgd.xmgl.modules.city.engineering.entity.Engineering">
select *
from engineering
</select>
<select id="countEngineeringDistrictCost" resultType="com.zhgd.xmgl.base.entity.vo.TrendVo">
select district x, count(*) y
from engineering
where 1 = 1
<if test="engineeringType != null">
and engineering_type = #{engineeringType}
</if>
<if test="progressType == '1'.toString()">
and year(start_time) = year(now())
</if>
<if test="progressType == '2'.toString()">
and year(end_time) = year(now())
</if>
<if test="newYear != null and newYear != ''">
and year(start_time) = #{newYear}
</if>
group by province, city, district
</select>
</mapper>

View File

@ -3,13 +3,19 @@ package com.zhgd.xmgl.modules.city.engineering.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexTopStatDto;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.basicdata.entity.EngineeringSingle;
import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -54,4 +60,20 @@ public interface IEngineeringService extends IService<Engineering> {
List<Engineering> getList(Engineering engineering);
List<EngineeringSingle> querySingle(Engineering engineering);
CountEngineeringVo countEngineering();
List<SectorVo> countEngineeringState(HashMap<String, Object> paramMap);
List<TrendVo> countEngineeringDistrict(HashMap<String, Object> paramMap);
EngineeringTrendVo getEngineeringCostTrendMonth(HashMap<String, Object> paramMap);
List<SectorVo> countEngineeringCostProportion(HashMap<String, Object> paramMap);
EngineeringTrendVo getEngineeringTrendMonth(HashMap<String, Object> paramMap);
EngineeringTrendProgressVo getEngineeringTrendProgressMonth(HashMap<String, Object> paramMap);
List<TrendVo> countEngineeringDistrictCost(HashMap<String, Object> paramMap);
}

View File

@ -1,5 +1,8 @@
package com.zhgd.xmgl.modules.city.engineering.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,22 +13,28 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.base.entity.vo.TrendVo;
import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.dto.AppIndexTopStatDto;
import com.zhgd.xmgl.modules.basicdata.dto.EngineeringPageDto;
import com.zhgd.xmgl.modules.basicdata.entity.*;
import com.zhgd.xmgl.modules.basicdata.service.*;
import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.modules.city.engineering.entity.Engineering;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.CountEngineeringVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendProgressVo;
import com.zhgd.xmgl.modules.city.engineering.entity.vo.EngineeringTrendVo;
import com.zhgd.xmgl.modules.city.engineering.mapper.EngineeringMapper;
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.monitor.mapper.MonitorDevMapper;
import com.zhgd.xmgl.modules.wisdom.service.IAiMonitorAlarmService;
import com.zhgd.xmgl.modules.city.dust.service.IEnvironmentAlarmService;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
import com.zhgd.xmgl.util.CommonUtil;
import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.ParamEnum;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils;
@ -33,9 +42,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -261,6 +269,150 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
return engineeringSingleService.list(Wrappers.<EngineeringSingle>lambdaQuery().eq(EngineeringSingle::getEngineeringSn, engineering.getEngineeringSn()));
}
@Override
public CountEngineeringVo countEngineering() {
CountEngineeringVo vo = new CountEngineeringVo();
vo.setProjectUnderSupervisionCount(baseMapper.getProjectUnderSupervisionCount());
vo.setTotalProjectCost(baseMapper.getTotalProjectCost());
vo.setNewThisYearCount(baseMapper.getNewThisYearCount());
vo.setCompletedThisYearCount(baseMapper.getCompletedThisYearCount());
vo.setKeyProjectCount(baseMapper.getKeyProjectCount());
vo.setTotalEngineeringArea(baseMapper.getTotalEngineeringArea());
vo.setTotalEngineeringLength(baseMapper.getTotalEngineeringLength());
return vo;
}
@Override
public List<SectorVo> countEngineeringState(HashMap<String, Object> paramMap) {
List<SectorVo> queryList = baseMapper.countEngineeringState(paramMap);
Map<Integer, SectorVo> map = queryList.stream().collect(Collectors.toMap(SectorVo::getState, Function.identity()));
ArrayList<SectorVo> list = new ArrayList<>();
for (ParamEnum.EngineeringState es : ParamEnum.EngineeringState.values()) {
SectorVo vo = map.get(es.getValue());
if (vo == null) {
vo = new SectorVo();
vo.setName(es.getDesc());
vo.setCount("0");
}
list.add(vo);
}
return list;
}
@Override
public List<TrendVo> countEngineeringDistrict(HashMap<String, Object> paramMap) {
List<TrendVo> list = baseMapper.countEngineeringDistrict(paramMap);
return list;
}
@Override
public EngineeringTrendVo getEngineeringCostTrendMonth(HashMap<String, Object> paramMap) {
List<TrendVo> list = baseMapper.getEngineeringCostTrendMonth(paramMap);
Map<String, TrendVo> map = list.stream().collect(Collectors.toMap(TrendVo::getX, Function.identity()));
int year = DateUtil.year(new Date());
EngineeringTrendVo vo = new EngineeringTrendVo();
vo.setThisYears(getYearTrend(map, year));
vo.setLastYears(getYearTrend(map, year - 1));
return vo;
}
@Override
public List<SectorVo> countEngineeringCostProportion(HashMap<String, Object> paramMap) {
ArrayList<SectorVo> sectorVos = new ArrayList<>();
sectorVos.add(getEngineeringCost(paramMap, null, 1000, "1千万以下"));
sectorVos.add(getEngineeringCost(paramMap, 1000, 3000, "1-3千万"));
sectorVos.add(getEngineeringCost(paramMap, 3000, 5000, "3-5千万"));
sectorVos.add(getEngineeringCost(paramMap, 5000, 10000, "5千万-1亿"));
sectorVos.add(getEngineeringCost(paramMap, 10000, 30000, "1亿-3亿"));
sectorVos.add(getEngineeringCost(paramMap, 30000, null, "3亿以上"));
int sum = sectorVos.stream().mapToInt(s -> Integer.parseInt(s.getCount())).sum();
for (SectorVo sectorVo : sectorVos) {
sectorVo.setPercent((NumberUtil.formatPercent(Double.parseDouble(sectorVo.getCount()) / sum, 2) + ""));
}
return sectorVos;
}
@Override
public EngineeringTrendVo getEngineeringTrendMonth(HashMap<String, Object> paramMap) {
if (MapUtils.getInteger(paramMap, "progressType") == null) {
throw new CustomException("progressType不能为空");
}
List<TrendVo> list = baseMapper.getEngineeringTrendMonth(paramMap);
Map<String, TrendVo> map = list.stream().collect(Collectors.toMap(TrendVo::getX, Function.identity()));
int year = DateUtil.year(new Date());
EngineeringTrendVo vo = new EngineeringTrendVo();
vo.setThisYears(getYearTrend(map, year));
vo.setLastYears(getYearTrend(map, year - 1));
return vo;
}
@Override
public EngineeringTrendProgressVo getEngineeringTrendProgressMonth(HashMap<String, Object> paramMap) {
paramMap.put("progressType", 1);
Map<String, TrendVo> map = baseMapper.getEngineeringTrendMonth(paramMap).stream().collect(Collectors.toMap(TrendVo::getX, Function.identity()));
int year = DateUtil.year(new Date());
EngineeringTrendProgressVo vo = new EngineeringTrendProgressVo();
vo.setNewBuilds(getYearTrend(map, year));
vo.setUnderConstructions(getUnderConstructions(baseMapper.getList(paramMap)));
return vo;
}
@Override
public List<TrendVo> countEngineeringDistrictCost(HashMap<String, Object> paramMap) {
List<TrendVo> list = baseMapper.countEngineeringDistrictCost(paramMap);
return list;
}
private List<TrendVo> getUnderConstructions(List<Engineering> list) {
List<TrendVo> trendVos = new ArrayList<>();
int year = DateUtil.year(new Date());
List<String> monthList = DateUtils.getAllYearMonthList(year + "");
for (String month : monthList) {
int num = 0;
for (Engineering engineering : list) {
DateTime monthDate = DateUtil.parse(month, "yyyyMM");
if (DateUtil.compare(DateUtil.beginOfMonth(engineering.getStartTime()), monthDate) <= 0 &&
DateUtil.compare(engineering.getEndTime(), monthDate) >= 0
) {
num++;
}
}
TrendVo vo = new TrendVo();
String format = DateUtil.format(DateUtil.parse(month, "yyyyMM"), "M月");
vo.setX(format);
vo.setY(num + "");
trendVos.add(vo);
}
return trendVos;
}
private SectorVo getEngineeringCost(HashMap<String, Object> paramMap, Integer begin, Integer end, String name) {
paramMap.put("engineeringCostBegin", begin);
paramMap.put("engineeringCostEnd", end);
Integer cost = baseMapper.countEngineeringCost(paramMap);
SectorVo vo = new SectorVo();
vo.setName(name);
vo.setCount(String.valueOf(cost));
return vo;
}
private List<TrendVo> getYearTrend(Map<String, TrendVo> map, int year) {
List<String> monthList = DateUtils.getAllYearMonthList(year + "");
ArrayList<TrendVo> trendVos = new ArrayList<TrendVo>();
for (String month : monthList) {
TrendVo vo = map.get(month);
if (vo == null) {
vo = new TrendVo();
vo.setY("0");
vo.setX(month);
}
String format = DateUtil.format(DateUtil.parse(month, "yyyyMM"), "M月");
vo.setX(format);
trendVos.add(vo);
}
return trendVos;
}
private String getEntName(List<EngineeringMain> engineeringMains, Integer type) {
List<EngineeringMain> main = engineeringMains.stream().filter(m -> m.getType() == type).collect(Collectors.toList());

View File

@ -175,12 +175,12 @@ public class DateUtils {
}
/**
* 获取指定年份所有天数
* 获取指定年份所有天数eg202201-202212
*
* @param yearMonth
* @return
*/
public static List<String> getYearAllMonthList(String yearMonth) {
public static List<String> getAllYearMonthList(String yearMonth) {
String year = yearMonth.substring(0, 4);
List<String> list = new ArrayList<>();
for (int i = 1; i <= 12; i++) {
@ -560,6 +560,6 @@ public class DateUtils {
}
public static void main(String[] args) {
System.out.println(getMonthsBetweenLastYear());
System.out.println(getAllYearMonthList("2022"));
}
}

View File

@ -1,12 +1,13 @@
package com.zhgd.xmgl.util;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.experimental.UtilityClass;
@UtilityClass
public class ParamEnum {
/**
* 附件类型枚举
* 附件类型枚举
*/
public enum AnnexFileType {
ENGINEERING(1, "工程附件"),
@ -32,7 +33,7 @@ public class ParamEnum {
/**
* 字典类型
* 字典类型
*/
public enum SysDictType {
MODULE_TYPE("module_type", "模块类型"),
@ -69,7 +70,7 @@ public class ParamEnum {
}
/**
* 扬尘信息枚举
* 扬尘信息枚举
*/
public enum EnvironmentAlarmTypeThreshold {
PM10(1, "PM10"),
@ -103,7 +104,7 @@ public class ParamEnum {
}
/**
* 工程主体枚举
* 工程主体枚举
*/
public enum EngineeringMain {
BUILD(1, "建设单位"),
@ -131,7 +132,7 @@ public class ParamEnum {
}
/**
* 政务配置键名
* 政务配置键名
*/
public enum GovernmentConfig {
EMAIL("email", "邮件配置");
@ -174,4 +175,73 @@ public class ParamEnum {
this.desc = desc;
}
}
public enum EngineeringState {
NOT_STARTED_YET(1, "未开工"),
UNDER_CONSTRUCTION(2, "在建"),
UNDER_CONSTRUCTION_ORDINARY_SHUTDOWN(3, "在建.普通停工"),
UNDER_CONSTRUCTION_PUNISHMENT_SHUTDOWN(4, "在建.处罚停工"),
UNDER_CONSTRUCTION_COMPLETED(5, "在建.完工"),
TO_BE_COMPLETED(6, "待竣工"),
COMPLETED(7, "竣工"),
OTHER(8, "其他");
EngineeringState(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
private Integer value;
private String desc;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum EngineeringType {
CONSTRUCTION(1, "房屋建筑"),
MUNICIPAL_PUBLIC_WORK(2, "市政公用工程"),
RAIL_TRANSIT_ENGINEERING(3, "轨道交通工程"),
PUBLIC_CONSTRUCTION_PROJECT(4, "公共建设项目"),
OTHER(5, "其他");
EngineeringType(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
private Integer value;
private String desc;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
}