地市大屏
This commit is contained in:
parent
ec17584681
commit
6edbbe9db3
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.material.cityScreen.DTO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class CityScreenDTO {
|
||||
@ApiModelProperty(value = "公司ID")
|
||||
private String companyId;
|
||||
@ApiModelProperty(value = "年限类型")
|
||||
private Integer year;
|
||||
@ApiModelProperty(value = "类型ID")
|
||||
private Integer typeId;
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "电压等级")
|
||||
private Integer voltageLevel;
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class AlarmVO {
|
||||
|
||||
@ApiModelProperty(value = "工序")
|
||||
private String procedureName;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "情况")
|
||||
private String situation;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:20
|
||||
*/
|
||||
@Data
|
||||
public class BasicTitleVO {
|
||||
|
||||
@ApiModelProperty(value = "装备总数")
|
||||
private String totalCount;
|
||||
|
||||
@ApiModelProperty(value = "装备总价值")
|
||||
private Integer totalValue;
|
||||
|
||||
@ApiModelProperty(value = "装备配置率")
|
||||
private String allocationRate;
|
||||
|
||||
@ApiModelProperty(value = "今日入库")
|
||||
private String enterNum;
|
||||
|
||||
@ApiModelProperty(value = "今日出库")
|
||||
private String outNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class DateVO<T> {
|
||||
@ApiModelProperty(value = "总数")
|
||||
private Integer total;
|
||||
|
||||
@ApiModelProperty(value = "在用数")
|
||||
private Integer useNum;
|
||||
|
||||
@ApiModelProperty(value = "集合")
|
||||
private List<T> list;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class EchartsVO {
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer num;
|
||||
|
||||
@ApiModelProperty(value = "比例")
|
||||
private String rate;
|
||||
|
||||
public EchartsVO(String name, int num, String rate) {
|
||||
this.name = name;
|
||||
this.num = num;
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentQuantityVO {
|
||||
|
||||
@ApiModelProperty(value = "设备数量")
|
||||
private Integer deviceQuantity;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
private String deviceType;
|
||||
|
||||
@ApiModelProperty(value = "设备类型ID")
|
||||
private String deviceTypeId;
|
||||
|
||||
@ApiModelProperty(value = "总价值")
|
||||
private BigDecimal totalValue;
|
||||
|
||||
@ApiModelProperty("5年个数")
|
||||
private Integer fiveYearCount;
|
||||
|
||||
@ApiModelProperty(value = "5年占比")
|
||||
private String fiveYearRatio;
|
||||
|
||||
@ApiModelProperty(value = "5-10年个数")
|
||||
private Integer fiveToTenYearCount;
|
||||
|
||||
@ApiModelProperty(value = "5-10年占比")
|
||||
private String fiveToTenYearRatio;
|
||||
|
||||
@ApiModelProperty(value = "10年以上个数")
|
||||
private Integer aboveTenYearCount;
|
||||
|
||||
@ApiModelProperty(value = "10年以上占比")
|
||||
private String aboveTenYearRatio;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:20
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentTurnoverRateVO {
|
||||
@ApiModelProperty(value = "专业")
|
||||
private String major;
|
||||
|
||||
@ApiModelProperty(value = "主工序")
|
||||
private String mainProcess;
|
||||
|
||||
@ApiModelProperty(value = "子工序")
|
||||
private String subprocess;
|
||||
|
||||
@ApiModelProperty(value = "装备名称")
|
||||
private String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "装备周转率")
|
||||
private String turnoverRate;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:20
|
||||
*/
|
||||
@Data
|
||||
public class EquipmentUseVO {
|
||||
@ApiModelProperty(value = "工程")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "在用装备数")
|
||||
private Integer useNum;
|
||||
|
||||
@ApiModelProperty(value = "投资额")
|
||||
private Integer investAmount;
|
||||
|
||||
@ApiModelProperty(value = "现场人员")
|
||||
private Integer scenePersonNum;
|
||||
|
||||
@ApiModelProperty(value = "风险等级")
|
||||
private Integer riskLevel;
|
||||
|
||||
@ApiModelProperty(value = "地理特征")
|
||||
private String geoFeature;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class MapVO {
|
||||
|
||||
@ApiModelProperty(value = "仓库装备数")
|
||||
private Integer warehouseEquipmentNum;
|
||||
|
||||
@ApiModelProperty(value = "市外装备数")
|
||||
private Integer outCityEquipmentNum;
|
||||
|
||||
@ApiModelProperty(value = "工程集合")
|
||||
private List<ProVO> proList;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.material.cityScreen.VO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class ProVO {
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
@ApiModelProperty(value = "在用数量")
|
||||
private Integer useNum;
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
@ApiModelProperty(value = "区、县")
|
||||
private String county;
|
||||
@ApiModelProperty(value = "经度")
|
||||
private String lon;
|
||||
@ApiModelProperty(value = "纬度")
|
||||
private String lat;
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package com.bonus.material.cityScreen.controller;
|
||||
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.cityScreen.DTO.CityScreenDTO;
|
||||
import com.bonus.material.cityScreen.VO.*;
|
||||
import com.bonus.material.cityScreen.mapper.CityScreenMapper;
|
||||
import com.bonus.material.cityScreen.service.CityScreenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 15:46
|
||||
*/
|
||||
|
||||
@Api(value = "地市大屏", tags = {"地市大屏"})
|
||||
@RestController
|
||||
@RequestMapping("/city_screen")
|
||||
public class CityScreenController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private CityScreenService cityScreenService;
|
||||
@Resource
|
||||
private CityScreenMapper cityScreenMapper;
|
||||
|
||||
@ApiOperation("基础头部数据")
|
||||
@GetMapping("/getBasicHead")
|
||||
public AjaxResult getBasicHead(CityScreenDTO dto) {
|
||||
BasicTitleVO titleVO = cityScreenService.getBasicHead(dto);
|
||||
return AjaxResult.success(titleVO);
|
||||
}
|
||||
|
||||
@ApiOperation("装备数量价值")
|
||||
@GetMapping("/equipmentQuantityValue")
|
||||
public AjaxResult equipmentQuantityValue(CityScreenDTO dto) {
|
||||
List<EquipmentQuantityVO> list = cityScreenService.equipmentQuantityValue(dto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("装备状态")
|
||||
@GetMapping("/equipmentStatus")
|
||||
public AjaxResult equipmentStatus(CityScreenDTO dto) {
|
||||
List<EchartsVO> list = cityScreenService.equipmentStatus(dto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("维修报警")
|
||||
@GetMapping("/maintenanceAlarm")
|
||||
public AjaxResult maintenanceAlarm(CityScreenDTO dto) {
|
||||
startPage();
|
||||
List<AlarmVO> list = cityScreenService.maintenanceAlarm(dto);
|
||||
DateVO<AlarmVO> dateVO = new DateVO<>();
|
||||
dateVO.setList(list);
|
||||
try {
|
||||
int total = cityScreenMapper.countMaintenanceAlarm(dto);
|
||||
dateVO.setTotal(total);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取维修报警数据失败");
|
||||
}
|
||||
return AjaxResult.success(dateVO);
|
||||
}
|
||||
|
||||
@ApiOperation("退役报警")
|
||||
@GetMapping("/retirementAlarm")
|
||||
public AjaxResult retirementAlarm(CityScreenDTO dto) {
|
||||
startPage();
|
||||
List<AlarmVO> list = cityScreenService.retirementAlarm(dto);
|
||||
DateVO<AlarmVO> dateVO = new DateVO<>();
|
||||
dateVO.setList(list);
|
||||
try {
|
||||
int total = cityScreenMapper.countRetirementAlarm(dto);
|
||||
dateVO.setTotal(total);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取退役报警数据失败");
|
||||
}
|
||||
return AjaxResult.success(dateVO);
|
||||
}
|
||||
|
||||
@ApiOperation("装备在用率")
|
||||
@GetMapping("/equipmentInServiceRate")
|
||||
public AjaxResult equipmentInServiceRate(CityScreenDTO dto) {
|
||||
List<EchartsVO> list = cityScreenService.equipmentInServiceRate(dto);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("装备周转率")
|
||||
@GetMapping("/equipmentTurnoverRate")
|
||||
public AjaxResult equipmentTurnoverRate(CityScreenDTO dto) {
|
||||
startPage();
|
||||
List<EquipmentTurnoverRateVO> list = cityScreenService.equipmentTurnoverRate(dto);
|
||||
DateVO<EquipmentTurnoverRateVO> dateVO = new DateVO<>();
|
||||
dateVO.setList(list);
|
||||
try {
|
||||
int total = cityScreenMapper.countEquipmentTurnoverRate(dto);
|
||||
dateVO.setTotal(total);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取装备周转率数据失败");
|
||||
}
|
||||
return AjaxResult.success(dateVO);
|
||||
}
|
||||
|
||||
@ApiOperation("工程在用装备情况")
|
||||
@GetMapping("/equipmentInUseInTheProject")
|
||||
public AjaxResult equipmentInUseInTheProject(CityScreenDTO dto) {
|
||||
startPage();
|
||||
List<EquipmentUseVO> list = cityScreenService.equipmentInUseInTheProject(dto);
|
||||
DateVO<EquipmentUseVO> dateVO = new DateVO<>();
|
||||
dateVO.setList(list);
|
||||
try {
|
||||
int proNum = cityScreenMapper.countProNum(dto);
|
||||
int useNum = cityScreenMapper.countUseNum(dto);
|
||||
dateVO.setTotal(proNum);
|
||||
dateVO.setUseNum(useNum);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取工程在用装备情况数据失败");
|
||||
}
|
||||
return AjaxResult.success(dateVO);
|
||||
}
|
||||
|
||||
@ApiOperation("地图数据")
|
||||
@GetMapping("/mapData")
|
||||
public AjaxResult mapData(CityScreenDTO dto) {
|
||||
// 查询工程列表数据
|
||||
List<ProVO> list = cityScreenService.proList(dto);
|
||||
MapVO mapVO = new MapVO();
|
||||
mapVO.setProList(list);
|
||||
try {
|
||||
//仓库装备数
|
||||
int deviceNum = cityScreenMapper.countDeviceNum(dto);
|
||||
mapVO.setWarehouseEquipmentNum(deviceNum);
|
||||
//市外装备数
|
||||
int outDeviceNum = cityScreenMapper.countOutDeviceNum(dto);
|
||||
mapVO.setOutCityEquipmentNum(outDeviceNum);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("获取地图数据失败");
|
||||
}
|
||||
return AjaxResult.success(mapVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.material.cityScreen.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 16:49
|
||||
*/
|
||||
@Data
|
||||
public class DeviceInfoEntity {
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
@ApiModelProperty(value = "装备总价值")
|
||||
private String buyMoney;
|
||||
@ApiModelProperty(value = "装备总数量")
|
||||
private String totalNum;
|
||||
@ApiModelProperty(value = "装备状态")
|
||||
private String status;
|
||||
@ApiModelProperty(value = "装备类型ID")
|
||||
private String typeId;
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package com.bonus.material.cityScreen.mapper;
|
||||
|
||||
import com.bonus.material.cityScreen.DTO.CityScreenDTO;
|
||||
import com.bonus.material.cityScreen.VO.*;
|
||||
import com.bonus.material.cityScreen.entity.DeviceInfoEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CityScreenMapper {
|
||||
/**
|
||||
* 获取设备数据
|
||||
* @param dto 入参
|
||||
* @return DeviceInfoEntity
|
||||
*/
|
||||
BasicTitleVO getDeviceData(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 获取今日出入库数量
|
||||
* @param dto 入参
|
||||
* @return BasicTitleVO
|
||||
*/
|
||||
BasicTitleVO getTodayDeviceEnterOutNum(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备数量价值
|
||||
* @param dto 入参
|
||||
* @return EquipmentQuantityVO
|
||||
*/
|
||||
EquipmentQuantityVO equipmentQuantityValue(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备状态
|
||||
* @return List<EquipmentQuantityVO>
|
||||
*/
|
||||
List<Integer> selectTypeIdList();
|
||||
|
||||
/**
|
||||
* 获取设备信息
|
||||
* @param dto 入参
|
||||
* @return List<DeviceInfoEntity>
|
||||
*/
|
||||
List<DeviceInfoEntity> getDeviceInfo(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 维修报警
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
List<AlarmVO> maintenanceAlarm(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 退役报警
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
List<AlarmVO> retirementAlarm(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 维修报警总数
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countMaintenanceAlarm(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 退役报警总数
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countRetirementAlarm(CityScreenDTO dto);
|
||||
/**
|
||||
* 装备周转率总数
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
int countEquipmentTurnoverRate(CityScreenDTO dto);
|
||||
/**
|
||||
* 装备周转率
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
List<EquipmentTurnoverRateVO> equipmentTurnoverRate(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 工程在用装备情况
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentUseVO>
|
||||
*/
|
||||
List<EquipmentUseVO> equipmentInUseInTheProject(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 工程数
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countProNum(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备在用数量
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countUseNum(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 获取工程列表
|
||||
* @param dto 入参
|
||||
* @return List<ProVO>
|
||||
*/
|
||||
List<ProVO> proList(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 统计仓库装备数
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countDeviceNum(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 统计市外装备数
|
||||
* @param dto 入参
|
||||
* @return int
|
||||
*/
|
||||
int countOutDeviceNum(CityScreenDTO dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.bonus.material.cityScreen.service;
|
||||
|
||||
import com.bonus.material.cityScreen.DTO.CityScreenDTO;
|
||||
import com.bonus.material.cityScreen.VO.*;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 15:47
|
||||
*/
|
||||
public interface CityScreenService {
|
||||
/**
|
||||
* 基础头部数据
|
||||
* @param dto 入参
|
||||
* @return List<BasicTitleData>
|
||||
*/
|
||||
BasicTitleVO getBasicHead(CityScreenDTO dto);
|
||||
/**
|
||||
* 装备数量价值
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentQuantityVO>
|
||||
*/
|
||||
List<EquipmentQuantityVO> equipmentQuantityValue(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备状态
|
||||
* @param dto 入参
|
||||
* @return List<EchartsVO>
|
||||
*/
|
||||
List<EchartsVO> equipmentStatus(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 维修报警
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
List<AlarmVO> maintenanceAlarm(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 退役报警
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
List<AlarmVO> retirementAlarm(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备在役率
|
||||
* @param dto 入参
|
||||
* @return List<EchartsVO>
|
||||
*/
|
||||
List<EchartsVO> equipmentInServiceRate(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 装备周转率
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentTurnoverRateVO>
|
||||
*/
|
||||
List<EquipmentTurnoverRateVO> equipmentTurnoverRate(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 工程在用装备情况
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentTurnoverRateVO>
|
||||
*/
|
||||
List<EquipmentUseVO> equipmentInUseInTheProject(CityScreenDTO dto);
|
||||
|
||||
/**
|
||||
* 工程列表
|
||||
* @param dto 入参
|
||||
* @return List<ProVO>
|
||||
*/
|
||||
List<ProVO> proList(CityScreenDTO dto);
|
||||
}
|
||||
|
|
@ -0,0 +1,262 @@
|
|||
package com.bonus.material.cityScreen.service;
|
||||
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.material.cityScreen.DTO.CityScreenDTO;
|
||||
import com.bonus.material.cityScreen.VO.*;
|
||||
import com.bonus.material.cityScreen.entity.DeviceInfoEntity;
|
||||
import com.bonus.material.cityScreen.mapper.CityScreenMapper;
|
||||
import com.bonus.material.equipment.domain.DeptConfigRateSummary;
|
||||
import com.bonus.material.equipment.service.ISysDeptService;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:tqzhang
|
||||
* @Date:2025/9/14 - 15:47
|
||||
*/
|
||||
@Service
|
||||
public class CityScreenServiceImpl implements CityScreenService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CityScreenServiceImpl.class);
|
||||
@Resource
|
||||
private CityScreenMapper cityScreenMapper;
|
||||
@Resource
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
/**
|
||||
* 基础头部数据
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<BasicTitleData>
|
||||
*/
|
||||
@Override
|
||||
public BasicTitleVO getBasicHead(CityScreenDTO dto) {
|
||||
try {
|
||||
if (StringHelper.isNullOrEmptyString(dto.getCompanyId())) {
|
||||
throw new ServiceException("公司不能为空");
|
||||
}
|
||||
String companyId = dto.getCompanyId();
|
||||
//根据公司ID查询设备总数、总价值
|
||||
BasicTitleVO titleVO = cityScreenMapper.getDeviceData(dto);
|
||||
if (titleVO == null) {
|
||||
throw new ServiceException("未查询到相关数据");
|
||||
}
|
||||
// 获取装备转换率
|
||||
DeptConfigRateSummary user = new DeptConfigRateSummary();
|
||||
List<DeptConfigRateSummary> list = sysDeptService.selectDeptConfigRatePivot(user);
|
||||
list.forEach(item -> {
|
||||
String deptId = String.valueOf(item.getCompanyId());
|
||||
if (deptId != null && deptId.equals(companyId)) {
|
||||
titleVO.setAllocationRate(StringHelper.isNullOrEmptyString(String.valueOf(item.getConfigRate())) ? "0" : String.valueOf(item.getConfigRate()));
|
||||
}
|
||||
});
|
||||
if (titleVO.getAllocationRate().trim().isEmpty() || "null".equals(titleVO.getAllocationRate())) {
|
||||
titleVO.setAllocationRate("0");
|
||||
}
|
||||
//查询今日出入库设备数
|
||||
BasicTitleVO todayTitleVO = cityScreenMapper.getTodayDeviceEnterOutNum(dto);
|
||||
if (todayTitleVO != null) {
|
||||
titleVO.setEnterNum(todayTitleVO.getEnterNum());
|
||||
titleVO.setOutNum(todayTitleVO.getOutNum());
|
||||
}
|
||||
return titleVO;
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备数量价值
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentQuantityVO>
|
||||
*/
|
||||
@Override
|
||||
public List<EquipmentQuantityVO> equipmentQuantityValue(CityScreenDTO dto) {
|
||||
try {
|
||||
List<EquipmentQuantityVO> list = new ArrayList<>();
|
||||
List<Integer> typeIds = cityScreenMapper.selectTypeIdList();
|
||||
for (int typeId : typeIds) {
|
||||
EquipmentQuantityVO vo = new EquipmentQuantityVO();
|
||||
dto.setTypeId(typeId + 1);
|
||||
dto.setYear(1);
|
||||
EquipmentQuantityVO fiveVO = cityScreenMapper.equipmentQuantityValue(dto);
|
||||
dto.setYear(2);
|
||||
EquipmentQuantityVO fiveToTenVO = cityScreenMapper.equipmentQuantityValue(dto);
|
||||
dto.setYear(3);
|
||||
EquipmentQuantityVO aboveTenVO = cityScreenMapper.equipmentQuantityValue(dto);
|
||||
vo.setDeviceQuantity(fiveVO.getDeviceQuantity() + fiveToTenVO.getDeviceQuantity() + aboveTenVO.getDeviceQuantity());
|
||||
vo.setTotalValue(fiveVO.getTotalValue().add(fiveToTenVO.getTotalValue()).add(aboveTenVO.getTotalValue()));
|
||||
vo.setDeviceType(String.valueOf(typeId));
|
||||
vo.setFiveYearCount(fiveVO.getDeviceQuantity());
|
||||
vo.setFiveToTenYearCount(fiveToTenVO.getDeviceQuantity());
|
||||
vo.setAboveTenYearCount(aboveTenVO.getDeviceQuantity());
|
||||
vo.setFiveYearRatio(vo.getTotalValue().compareTo(BigDecimal.ZERO) == 0 ? "0" : String.format("%.2f", (fiveVO.getTotalValue().divide(vo.getTotalValue(), 2, BigDecimal.ROUND_HALF_UP)).multiply(BigDecimal.valueOf(100))));
|
||||
vo.setFiveYearRatio(vo.getTotalValue().compareTo(BigDecimal.ZERO) == 0 ? "0" : String.format("%.2f", (fiveToTenVO.getTotalValue().divide(vo.getTotalValue(), 2, BigDecimal.ROUND_HALF_UP)).multiply(BigDecimal.valueOf(100))));
|
||||
vo.setFiveYearRatio(vo.getTotalValue().compareTo(BigDecimal.ZERO) == 0 ? "0" : String.format("%.2f", (aboveTenVO.getTotalValue().divide(vo.getTotalValue(), 2, BigDecimal.ROUND_HALF_UP)).multiply(BigDecimal.valueOf(100))));
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取装备数量价值数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备状态
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<EchartsVO>
|
||||
*/
|
||||
@Override
|
||||
public List<EchartsVO> equipmentStatus(CityScreenDTO dto) {
|
||||
try {
|
||||
dto.setStatus(9);
|
||||
List<DeviceInfoEntity> list = cityScreenMapper.getDeviceInfo(dto);
|
||||
List<EchartsVO> resultList = new ArrayList<>();
|
||||
List<DeviceInfoEntity> usingList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getStatus()) && item.getStatus().equals("1")).collect(Collectors.toList());
|
||||
List<DeviceInfoEntity> inTheLibraryList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getStatus()) && (item.getStatus().equals("2") || item.getStatus().equals("3"))).collect(Collectors.toList());
|
||||
List<DeviceInfoEntity> repairAgainList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getStatus()) && item.getStatus().equals("5")).collect(Collectors.toList());
|
||||
List<DeviceInfoEntity> sharingList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getStatus()) && item.getStatus().equals("3")).collect(Collectors.toList());
|
||||
|
||||
double totalSize = usingList.size() + inTheLibraryList.size() + repairAgainList.size();
|
||||
resultList.add(new EchartsVO("在用", usingList.size(), totalSize == 0 ? "0.00" : String.format("%.2f", (usingList.size() / totalSize) * 100)));
|
||||
resultList.add(new EchartsVO("在库", inTheLibraryList.size(), totalSize == 0 ? "0.00" : String.format("%.2f", (inTheLibraryList.size() / totalSize) * 100)));
|
||||
resultList.add(new EchartsVO("在修", repairAgainList.size(), totalSize == 0 ? "0.00" : String.format("%.2f", (repairAgainList.size() / totalSize) * 100)));
|
||||
resultList.add(new EchartsVO("共享", sharingList.size(), "0.00"));
|
||||
return resultList;
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取装备状态数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修报警
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
@Override
|
||||
public List<AlarmVO> maintenanceAlarm(CityScreenDTO dto) {
|
||||
try {
|
||||
return cityScreenMapper.maintenanceAlarm(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取维修报警数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退役报警
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<AlarmVO>
|
||||
*/
|
||||
@Override
|
||||
public List<AlarmVO> retirementAlarm(CityScreenDTO dto) {
|
||||
try {
|
||||
return cityScreenMapper.retirementAlarm(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取退役报警数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备在役率
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<EchartsVO>
|
||||
*/
|
||||
@Override
|
||||
public List<EchartsVO> equipmentInServiceRate(CityScreenDTO dto) {
|
||||
try {
|
||||
dto.setStatus(9);
|
||||
List<DeviceInfoEntity> list = cityScreenMapper.getDeviceInfo(dto);
|
||||
List<EchartsVO> resultList = new ArrayList<>();
|
||||
//每种设备数量
|
||||
List<DeviceInfoEntity> powerList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getTypeId()) && item.getTypeId().equals("1")).collect(Collectors.toList());
|
||||
List<DeviceInfoEntity> lineList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getTypeId()) && item.getTypeId().equals("2")).collect(Collectors.toList());
|
||||
List<DeviceInfoEntity> cableList = list.stream().filter(item -> !StringHelper.isNullOrEmptyString(item.getTypeId()) && item.getTypeId().equals("3")).collect(Collectors.toList());
|
||||
|
||||
int powerNum = calculateInUseCount(powerList);
|
||||
int lineNum = calculateInUseCount(lineList);
|
||||
int cableNum = calculateInUseCount(cableList);
|
||||
|
||||
double totalSize = powerList.size() + lineList.size() + cableList.size();
|
||||
double useSize = powerNum + lineNum + cableNum;
|
||||
System.out.println("totalSize:" + totalSize + ",useSize:" + useSize);
|
||||
resultList.add(new EchartsVO("变电装备在用率", powerNum, calculatePercentage(powerNum, powerList.size())));
|
||||
resultList.add(new EchartsVO("线路装备在用率", lineNum, calculatePercentage(lineNum, lineList.size())));
|
||||
resultList.add(new EchartsVO("电缆装备在用率", cableNum, calculatePercentage(cableNum, cableList.size())));
|
||||
resultList.add(new EchartsVO("总体在用率", (int) useSize, calculatePercentage(useSize / 3, totalSize / 3)));
|
||||
return resultList;
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取装备在役率数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateInUseCount(List<DeviceInfoEntity> list) {
|
||||
return (int) list.stream()
|
||||
.filter(item -> item.getStatus().equals("2") || item.getStatus().equals("3"))
|
||||
.count();
|
||||
}
|
||||
|
||||
private String calculatePercentage(double part, double total) {
|
||||
return total == 0 ? "0.00" : String.format("%.2f", (part / total) * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 装备周转率
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentTurnoverRateVO>
|
||||
*/
|
||||
@Override
|
||||
public List<EquipmentTurnoverRateVO> equipmentTurnoverRate(CityScreenDTO dto) {
|
||||
try {
|
||||
return cityScreenMapper.equipmentTurnoverRate(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取装备周转率数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工程在用装备情况
|
||||
*
|
||||
* @param dto 入参
|
||||
* @return List<EquipmentTurnoverRateVO>
|
||||
*/
|
||||
@Override
|
||||
public List<EquipmentUseVO> equipmentInUseInTheProject(CityScreenDTO dto) {
|
||||
try {
|
||||
return cityScreenMapper.equipmentInUseInTheProject(dto);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new ServiceException("获取工程在用装备情况数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProVO> proList(CityScreenDTO dto) {
|
||||
List<ProVO> list = cityScreenMapper.proList(dto);
|
||||
//根据county进行分组 取每组下面useNum最大的那组数据 组成新的集合
|
||||
return list.stream().collect(Collectors.groupingBy(ProVO::getCounty)).values().stream()
|
||||
.map(list1 -> list1.stream().max(Comparator.comparing(ProVO::getUseNum))
|
||||
.orElse(null)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
<?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.bonus.material.cityScreen.mapper.CityScreenMapper">
|
||||
|
||||
<select id="getDeviceData" resultType="com.bonus.material.cityScreen.VO.BasicTitleVO">
|
||||
SELECT
|
||||
count( 1 ) AS totalCount,
|
||||
IFNULL(sum( buy_price * device_count ),0) AS totalValue
|
||||
FROM
|
||||
ma_dev_info
|
||||
WHERE is_active = 1 and own_co = #{companyId}
|
||||
</select>
|
||||
|
||||
<select id="getTodayDeviceEnterOutNum" resultType="com.bonus.material.cityScreen.VO.BasicTitleVO">
|
||||
select
|
||||
count( type = 1 ) AS enterNum,
|
||||
count( type = 2 ) AS outNum
|
||||
from cs_device_change
|
||||
where del_flag = 0 and use_unit = #{companyId}
|
||||
</select>
|
||||
|
||||
<select id="equipmentQuantityValue" resultType="com.bonus.material.cityScreen.VO.EquipmentQuantityVO">
|
||||
SELECT
|
||||
ifnull(sum(mdi.buy_price * mdi.device_count),0) as totalValue,
|
||||
COUNT(1) as deviceQuantity
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mtv.MaxTypeId = #{typeId} and mdi.own_co = #{companyId}
|
||||
<if test="year == 1">
|
||||
and TIMESTAMPDIFF(YEAR,mdi.production_date, NOW()) <![CDATA[ < ]]> 5
|
||||
</if>
|
||||
<if test="year == 2">
|
||||
and TIMESTAMPDIFF(YEAR, mdi.production_date, NOW()) BETWEEN 5 AND 10
|
||||
</if>
|
||||
<if test="year == 3">
|
||||
and TIMESTAMPDIFF(YEAR, mdi.production_date, NOW()) > 10
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectTypeIdList" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
dict_value
|
||||
from sys_dict_data
|
||||
where dict_type = 'config_type' and dict_label in ('线路','电缆','变电') and status = '0'
|
||||
</select>
|
||||
|
||||
<select id="getDeviceInfo" resultType="com.bonus.material.cityScreen.entity.DeviceInfoEntity">
|
||||
select
|
||||
mdi.device_name as deviceName,
|
||||
mdi.change_status as status,
|
||||
mtv.maxTypeId as typeId
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId}
|
||||
<if test="typeId != null">
|
||||
and mtv.MaxTypeId = #{typeId}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
<if test="status == 9">
|
||||
and mdi.change_status != 4
|
||||
</if>
|
||||
<if test="status != 2 and status != 9">
|
||||
and mdi.change_status = #{status}
|
||||
</if>
|
||||
<if test="status == 2">
|
||||
and mdi.change_status = 2 or mdi.change_status = 3
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="maintenanceAlarm" resultType="com.bonus.material.cityScreen.VO.AlarmVO">
|
||||
select
|
||||
mdi.device_name as deviceName,
|
||||
mtv.devCategory as procedureName,
|
||||
case when TIMESTAMPDIFF(DAY, NOW(),mdq.next_check_time) > 30 then '正常'
|
||||
when TIMESTAMPDIFF(DAY, NOW(),mdq.next_check_time) between 0 and 30 then '1月内到期'
|
||||
when TIMESTAMPDIFF(DAY, NOW(),mdq.next_check_time) <![CDATA[ < ]]> 0 then '已超期'
|
||||
else '未检' end as situation
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
left join ma_dev_qc mdq on mdq.ma_id = mdi.ma_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 4
|
||||
order by TIMESTAMPDIFF(YEAR, NOW(),mdq.next_check_time)
|
||||
</select>
|
||||
<select id="countMaintenanceAlarm" resultType="int">
|
||||
select
|
||||
count(DISTINCT mdi.ma_id)
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
left join ma_dev_qc mdq on mdq.ma_id = mdi.ma_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 4
|
||||
</select>
|
||||
<select id="retirementAlarm" resultType="com.bonus.material.cityScreen.VO.AlarmVO">
|
||||
select
|
||||
mdi.device_name as deviceName,
|
||||
mtv.devCategory as procedureName,
|
||||
concat('差',TIMESTAMPDIFF(DAY, NOW(),mdi.expiration_time),'天退役') as situation
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 4
|
||||
order by TIMESTAMPDIFF(YEAR, NOW(),mdi.expiration_time)
|
||||
</select>
|
||||
|
||||
<select id="countRetirementAlarm" resultType="int">
|
||||
select
|
||||
count(DISTINCT mdi.ma_id)
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 4
|
||||
</select>
|
||||
|
||||
<select id="countEquipmentTurnoverRate" resultType="int">
|
||||
select
|
||||
count(1)
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 3
|
||||
</select>
|
||||
|
||||
<select id="equipmentTurnoverRate" resultType="com.bonus.material.cityScreen.VO.EquipmentTurnoverRateVO">
|
||||
select
|
||||
mtv.proType as major,
|
||||
mtv.mainGx as mainProcess,
|
||||
mtv.childGx as subprocess,
|
||||
mdi.device_name as deviceName,
|
||||
CONCAT(ROUND(count(cdcd.dev_id)/mdi.device_count, 2),'次/年') as turnoverRate
|
||||
from ma_dev_info mdi
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
left join cs_device_change_details cdcd on cdcd.dev_id = mdi.ma_id
|
||||
left join cs_device_change cdc on cdc.id = cdcd.change_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status != 4 and cdc.type = 2 and cdc.del_flag = 0
|
||||
and TIMESTAMPDIFF(MONTH , NOW(),cdc.create_time) between 0 and 12
|
||||
group by mtv.proType, mtv.mainGx, mtv.childGx, mdi.device_name
|
||||
order by turnoverRate desc
|
||||
</select>
|
||||
|
||||
<select id="equipmentInUseInTheProject" resultType="com.bonus.material.cityScreen.VO.EquipmentUseVO">
|
||||
select DISTINCT
|
||||
jsp.pro_name as projectName,
|
||||
sum(mdi.device_count) as useNum,
|
||||
sum(mdi.buy_price * mdi.device_count) as investAmount
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status in (2,3)
|
||||
<if test="voltageLevel != null">
|
||||
and jsp.voltage = #{voltageLevel}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and mtv.maxTypeId = #{typeId}
|
||||
</if>
|
||||
group by jsp.id,jsp.pro_name
|
||||
</select>
|
||||
|
||||
<select id="countProNum" resultType="int">
|
||||
select count(1)
|
||||
from(
|
||||
select DISTINCT count(1)
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1
|
||||
and mdi.own_co = #{companyId}
|
||||
and mdi.change_status in (2, 3)
|
||||
<if test="voltageLevel != null">
|
||||
and jsp.voltage = #{voltageLevel}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and mtv.maxTypeId = #{typeId}
|
||||
</if>
|
||||
group by jsp.id
|
||||
)r
|
||||
</select>
|
||||
|
||||
<select id="countUseNum" resultType="int">
|
||||
select
|
||||
IFNULL(sum(r.num),0) as useNum
|
||||
from(
|
||||
select DISTINCT ifnull(sum(mdi.device_count),0) as num
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1
|
||||
and mdi.own_co = #{companyId}
|
||||
and mdi.change_status in (2, 3)
|
||||
<if test="voltageLevel != null">
|
||||
and jsp.voltage = #{voltageLevel}
|
||||
</if>
|
||||
<if test="typeId != null">
|
||||
and mtv.maxTypeId = #{typeId}
|
||||
</if>
|
||||
group by jsp.id
|
||||
)r
|
||||
</select>
|
||||
|
||||
<select id="proList" resultType="com.bonus.material.cityScreen.VO.ProVO">
|
||||
select DISTINCT
|
||||
jsp.pro_name as projectName,
|
||||
jsp.city as city,
|
||||
jsp.county as county,
|
||||
sum(mdi.device_count) as useNum
|
||||
<!-- cp.lon as lon,-->
|
||||
<!-- cp.lat as lat-->
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
<!-- left join coordinate_point cp on cp.name = jsp.county-->
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status in (2,3)
|
||||
and jsp.city = #{city}
|
||||
group by jsp.id
|
||||
</select>
|
||||
|
||||
<select id="countDeviceNum" resultType="int">
|
||||
select ifnull(sum(r.useNum),0) as useNum
|
||||
from(
|
||||
select DISTINCT
|
||||
ifnull(sum(mdi.device_count),0) as useNum
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1 and mdi.own_co = #{companyId} and mdi.change_status in (1,5)
|
||||
and jsp.city = #{city}
|
||||
)r
|
||||
</select>
|
||||
|
||||
<select id="countOutDeviceNum" resultType="int">
|
||||
select ifnull(sum(r.useNum), 0) as useNum
|
||||
from (select DISTINCT ifnull(sum(mdi.device_count), 0) as useNum
|
||||
from jj_sing_project jsp
|
||||
left join ma_dev_info mdi on mdi.on_project = jsp.id
|
||||
left join ma_type_view mtv on mtv.typeId = mdi.type_id
|
||||
where mdi.is_active = 1
|
||||
and mdi.own_co = #{companyId}
|
||||
and mdi.change_status in (2, 3)
|
||||
and jsp.city != #{city}) r
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue