Browse Source

1、接口bug修改;

dev
mh 4 weeks ago
parent
commit
040437a702
  1. 2
      user-service/src/main/java/com/mh/user/mapper/ScreenMapper.java
  2. 4
      user-service/src/main/java/com/mh/user/mapper/chillers/ChillersMapper.java
  3. 54
      user-service/src/main/java/com/mh/user/service/chillers/impl/ChillersServiceImpl.java
  4. 4
      user-service/src/main/java/com/mh/user/service/impl/ScreenServiceImpl.java

2
user-service/src/main/java/com/mh/user/mapper/ScreenMapper.java

@ -208,7 +208,7 @@ public interface ScreenMapper {
" group by " + " group by " +
" cur_date, elect " + " cur_date, elect " +
") t2 on " + ") t2 on " +
" t1.cur_date = t2.cur_date order by cur_date ") " t1.cur_date = t2.cur_date order by t1.cur_date ")
List<Map<String, Object>> savingYoyEnergyData(@Param("projectId") String projectId, List<Map<String, Object>> savingYoyEnergyData(@Param("projectId") String projectId,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime, @Param("endTime") String endTime,

4
user-service/src/main/java/com/mh/user/mapper/chillers/ChillersMapper.java

@ -184,8 +184,8 @@ public interface ChillersMapper {
List<ChillersEntity> getStopChillers(); List<ChillersEntity> getStopChillers();
@Select("select mt_type, cur_value, cur_time from meter_manage " + @Select("select mt_type, cur_value, cur_time from meter_manage " +
" where system_id = #{systemId} and project_id = #{proId} and device_id = #{deviceId} " + " where system_id = #{systemId} and project_id = #{proId} and device_id = #{deviceId} and mt_type in (1, 2)" +
" and grade between 0 and 9 group by mt_type, cur_value, cur_time ") " and grade between 40 and 49 group by mt_type, cur_value, cur_time ")
List<Map<String, Object>> queryTotalData(@Param("systemId") String systemId, List<Map<String, Object>> queryTotalData(@Param("systemId") String systemId,
@Param("proId") String proId, @Param("proId") String proId,
@Param("deviceId") String deviceId); @Param("deviceId") String deviceId);

54
user-service/src/main/java/com/mh/user/service/chillers/impl/ChillersServiceImpl.java

@ -11,6 +11,7 @@ import com.mh.user.mapper.ProjectInfoMapper;
import com.mh.user.mapper.chillers.ChillersMapper; import com.mh.user.mapper.chillers.ChillersMapper;
import com.mh.user.service.chillers.ChillersService; import com.mh.user.service.chillers.ChillersService;
import com.mh.user.utils.DateUtil; import com.mh.user.utils.DateUtil;
import com.mh.user.utils.ExchangeStringUtil;
import com.mh.user.utils.TimeDifferenceUtil; import com.mh.user.utils.TimeDifferenceUtil;
import com.mh.user.vo.HostListVO; import com.mh.user.vo.HostListVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -345,16 +346,18 @@ public class ChillersServiceImpl implements ChillersService {
List<MeterManageEntity> meterManageEntities = meterManageMapper.selectList( List<MeterManageEntity> meterManageEntities = meterManageMapper.selectList(
new QueryWrapper<MeterManageEntity>() new QueryWrapper<MeterManageEntity>()
.eq("device_id", devicesManageEntity.getId()) .eq("device_id", devicesManageEntity.getId())
.eq("project_id", devicesManageEntity.getProjectId())
.orderByAsc("sort")); .orderByAsc("sort"));
if (meterManageEntities != null && !meterManageEntities.isEmpty()) { if (meterManageEntities == null || meterManageEntities.isEmpty()) {
matchingChillersData(meterManageEntities, hostListVO); continue;
// 额定制冷量
hostListVO.setRatedRef(String.valueOf(devicesManageEntity.getRatedRefrigerationCapacity()));
// 额定功率
hostListVO.setRatedPower(String.valueOf(devicesManageEntity.getRatedInputPower()));
// 额定COP
hostListVO.setRatedCop(String.valueOf(devicesManageEntity.getRatedCop()));
} }
matchingChillersData(meterManageEntities, hostListVO);
// 额定制冷量
hostListVO.setRatedRef(String.valueOf(devicesManageEntity.getRatedRefrigerationCapacity()));
// 额定功率
hostListVO.setRatedPower(String.valueOf(devicesManageEntity.getRatedInputPower()));
// 额定COP
hostListVO.setRatedCop(String.valueOf(devicesManageEntity.getRatedCop()));
mtArray.add(hostListVO); mtArray.add(hostListVO);
deviceJson.put("children", mtArray); deviceJson.put("children", mtArray);
children.add(deviceJson); children.add(deviceJson);
@ -371,66 +374,67 @@ public class ChillersServiceImpl implements ChillersService {
hostListVO.reset(); hostListVO.reset();
for (MeterManageEntity meterManageEntity : meterManageEntities) { for (MeterManageEntity meterManageEntity : meterManageEntities) {
// 匹配HostListVO展示给前端 // 匹配HostListVO展示给前端
String funCode = meterManageEntity.getFuncCode(); String funCode = ExchangeStringUtil.addZeroForNum(meterManageEntity.getFuncCode(), 2);
String curValue = String.valueOf(meterManageEntity.getCurValue());
switch (meterManageEntity.getMtCode()) { String curValue = new BigDecimal(String.valueOf(meterManageEntity.getCurValue() == null ? 0.00 : meterManageEntity.getCurValue())).setScale(1, RoundingMode.HALF_UP).toString();
switch (meterManageEntity.getRegisterAddr()) {
case "0001": case "0001":
if (funCode.equals("1")) { if (funCode.equals("01")) {
hostListVO.setRunningStatus(curValue); hostListVO.setRunningStatus(String.valueOf(new BigDecimal(curValue).intValue()));
} }
break; break;
case "0003": case "0003":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setEnteringTempSet(curValue); hostListVO.setEnteringTempSet(curValue);
} }
break; break;
case "0005": case "0005":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setEvapLeavingChWTemp(curValue); hostListVO.setEvapLeavingChWTemp(curValue);
} }
break; break;
case "0006": case "0006":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setEvapEnteringChWTemp(curValue); hostListVO.setEvapEnteringChWTemp(curValue);
} }
break; break;
case "0015": case "0015":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setEvapApproach(curValue); hostListVO.setEvapApproach(curValue);
} }
break; break;
case "0009": case "0009":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setCondLeavingChWTemp(curValue); hostListVO.setCondLeavingChWTemp(curValue);
} }
break; break;
case "0010": case "0010":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setCondEnteringChWTemp(curValue); hostListVO.setCondEnteringChWTemp(curValue);
} }
break; break;
case "0023": case "0023":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setCondApproach(curValue); hostListVO.setCondApproach(curValue);
} }
break; break;
case "0139": case "0139":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setRealTimeChillerAmps(curValue); hostListVO.setRealTimeChillerAmps(curValue);
} }
break; break;
case "0013": case "0013":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setRealTimePower(curValue); hostListVO.setRealTimePower(curValue);
} }
break; break;
case "0014": case "0014":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setRealTimeCop(curValue); hostListVO.setRealTimeCop(curValue);
} }
break; break;
case "0122": case "0122":
if (funCode.equals("3")) { if (funCode.equals("03")) {
hostListVO.setRealTimeWarning(curValue); hostListVO.setRealTimeWarning(curValue);
hostListVO.setRealTimeFault(curValue); hostListVO.setRealTimeFault(curValue);
} }
@ -471,7 +475,7 @@ public class ChillersServiceImpl implements ChillersService {
BigDecimal ele = resultJson.getBigDecimal("eleUsed") == null ? BigDecimal.ZERO : resultJson.getBigDecimal("eleUsed"); BigDecimal ele = resultJson.getBigDecimal("eleUsed") == null ? BigDecimal.ZERO : resultJson.getBigDecimal("eleUsed");
if (coolingUsed.compareTo(BigDecimal.ZERO) > 0 if (coolingUsed.compareTo(BigDecimal.ZERO) > 0
&& ele.compareTo(BigDecimal.ZERO) > 0) { && ele.compareTo(BigDecimal.ZERO) > 0) {
resultJson.put("coolingUsed", coolingUsed resultJson.put("cop", coolingUsed
.divide(new BigDecimal(String.valueOf(resultJson.getBigDecimal("eleUsed"))), 1, RoundingMode.HALF_UP)); .divide(new BigDecimal(String.valueOf(resultJson.getBigDecimal("eleUsed"))), 1, RoundingMode.HALF_UP));
} else if (ele.compareTo(BigDecimal.ZERO) == 0) { } else if (ele.compareTo(BigDecimal.ZERO) == 0) {
resultJson.put("cop", 0.0); resultJson.put("cop", 0.0);

4
user-service/src/main/java/com/mh/user/service/impl/ScreenServiceImpl.java

@ -65,8 +65,8 @@ public class ScreenServiceImpl implements ScreenService {
String projectId = screenRequestParamDTO.getProjectId(); String projectId = screenRequestParamDTO.getProjectId();
String startTime = screenRequestParamDTO.getStartTime(); String startTime = screenRequestParamDTO.getStartTime();
String endTime = screenRequestParamDTO.getEndTime(); String endTime = screenRequestParamDTO.getEndTime();
String lastStartTime = DateUtil.yoyDate(startTime + "-01 00:00:00").substring(0, 10); String lastStartTime = DateUtil.yoyDate(startTime + " 00:00:00").substring(0, 10);
String lastEndTime = DateUtil.yoyDate(endTime+ "-31 23:59:59").substring(0, 10); String lastEndTime = DateUtil.yoyDate(endTime+ " 23:59:59").substring(0, 10);
List<Map<String, Object>> monthData = screenMapper.savingYoyEnergyData(projectId, startTime, endTime, lastStartTime, lastEndTime); List<Map<String, Object>> monthData = screenMapper.savingYoyEnergyData(projectId, startTime, endTime, lastStartTime, lastEndTime);
resultJson.add(monthData); resultJson.add(monthData);
break; break;

Loading…
Cancel
Save