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 " +
" cur_date, elect " +
") 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,
@Param("startTime") String startTime,
@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();
@Select("select mt_type, cur_value, cur_time from meter_manage " +
" where system_id = #{systemId} and project_id = #{proId} and device_id = #{deviceId} " +
" and grade between 0 and 9 group by mt_type, cur_value, cur_time ")
" where system_id = #{systemId} and project_id = #{proId} and device_id = #{deviceId} and mt_type in (1, 2)" +
" and grade between 40 and 49 group by mt_type, cur_value, cur_time ")
List<Map<String, Object>> queryTotalData(@Param("systemId") String systemId,
@Param("proId") String proId,
@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.service.chillers.ChillersService;
import com.mh.user.utils.DateUtil;
import com.mh.user.utils.ExchangeStringUtil;
import com.mh.user.utils.TimeDifferenceUtil;
import com.mh.user.vo.HostListVO;
import org.springframework.stereotype.Service;
@ -345,16 +346,18 @@ public class ChillersServiceImpl implements ChillersService {
List<MeterManageEntity> meterManageEntities = meterManageMapper.selectList(
new QueryWrapper<MeterManageEntity>()
.eq("device_id", devicesManageEntity.getId())
.eq("project_id", devicesManageEntity.getProjectId())
.orderByAsc("sort"));
if (meterManageEntities != null && !meterManageEntities.isEmpty()) {
matchingChillersData(meterManageEntities, hostListVO);
// 额定制冷量
hostListVO.setRatedRef(String.valueOf(devicesManageEntity.getRatedRefrigerationCapacity()));
// 额定功率
hostListVO.setRatedPower(String.valueOf(devicesManageEntity.getRatedInputPower()));
// 额定COP
hostListVO.setRatedCop(String.valueOf(devicesManageEntity.getRatedCop()));
if (meterManageEntities == null || meterManageEntities.isEmpty()) {
continue;
}
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);
deviceJson.put("children", mtArray);
children.add(deviceJson);
@ -371,66 +374,67 @@ public class ChillersServiceImpl implements ChillersService {
hostListVO.reset();
for (MeterManageEntity meterManageEntity : meterManageEntities) {
// 匹配HostListVO展示给前端
String funCode = meterManageEntity.getFuncCode();
String curValue = String.valueOf(meterManageEntity.getCurValue());
switch (meterManageEntity.getMtCode()) {
String funCode = ExchangeStringUtil.addZeroForNum(meterManageEntity.getFuncCode(), 2);
String curValue = new BigDecimal(String.valueOf(meterManageEntity.getCurValue() == null ? 0.00 : meterManageEntity.getCurValue())).setScale(1, RoundingMode.HALF_UP).toString();
switch (meterManageEntity.getRegisterAddr()) {
case "0001":
if (funCode.equals("1")) {
hostListVO.setRunningStatus(curValue);
if (funCode.equals("01")) {
hostListVO.setRunningStatus(String.valueOf(new BigDecimal(curValue).intValue()));
}
break;
case "0003":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setEnteringTempSet(curValue);
}
break;
case "0005":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setEvapLeavingChWTemp(curValue);
}
break;
case "0006":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setEvapEnteringChWTemp(curValue);
}
break;
case "0015":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setEvapApproach(curValue);
}
break;
case "0009":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setCondLeavingChWTemp(curValue);
}
break;
case "0010":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setCondEnteringChWTemp(curValue);
}
break;
case "0023":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setCondApproach(curValue);
}
break;
case "0139":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setRealTimeChillerAmps(curValue);
}
break;
case "0013":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setRealTimePower(curValue);
}
break;
case "0014":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setRealTimeCop(curValue);
}
break;
case "0122":
if (funCode.equals("3")) {
if (funCode.equals("03")) {
hostListVO.setRealTimeWarning(curValue);
hostListVO.setRealTimeFault(curValue);
}
@ -471,7 +475,7 @@ public class ChillersServiceImpl implements ChillersService {
BigDecimal ele = resultJson.getBigDecimal("eleUsed") == null ? BigDecimal.ZERO : resultJson.getBigDecimal("eleUsed");
if (coolingUsed.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));
} else if (ele.compareTo(BigDecimal.ZERO) == 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 startTime = screenRequestParamDTO.getStartTime();
String endTime = screenRequestParamDTO.getEndTime();
String lastStartTime = DateUtil.yoyDate(startTime + "-01 00:00:00").substring(0, 10);
String lastEndTime = DateUtil.yoyDate(endTime+ "-31 23:59:59").substring(0, 10);
String lastStartTime = DateUtil.yoyDate(startTime + " 00:00:00").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);
resultJson.add(monthData);
break;

Loading…
Cancel
Save