|
|
@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
@ -55,6 +56,7 @@ public class HealthService implements IHealthService{ |
|
|
|
//1、获取健康信息和userId
|
|
|
|
HealthDto.healthInfo healthInfo = params.getParam(); |
|
|
|
Long userId = params.getUserId(); |
|
|
|
|
|
|
|
//3、保存健康信息
|
|
|
|
HealthRecords healthRecords = new HealthRecords(); |
|
|
|
healthRecords.setId(snowflake.nextId()); |
|
|
@ -78,6 +80,14 @@ public class HealthService implements IHealthService{ |
|
|
|
color.g = "139"; |
|
|
|
color.b = "0"; |
|
|
|
healthInfoVo.setHealthLevel(1); |
|
|
|
}else { |
|
|
|
//如果选择状态正常,检查温度是否正常(36.0°~37.3°)
|
|
|
|
BigDecimal minAnimalHeat = BigDecimal.valueOf(36.0); |
|
|
|
BigDecimal maxAnimalHeat = BigDecimal.valueOf(37.3); |
|
|
|
if(healthInfo.getAnimalHeat().compareTo(minAnimalHeat) == -1 || |
|
|
|
healthInfo.getAnimalHeat().compareTo(maxAnimalHeat) == 1){ |
|
|
|
throw new BaseException(CodeEnum.ANIMAL_HEAT_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
healthInfoVo.setHealthTypeName(healthType.getName()); |
|
|
|
} |
|
|
|