修改取水口信息
This commit is contained in:
parent
405cbab15c
commit
457cb730ea
@ -77,6 +77,7 @@ public class NgInformationWaterUserController extends BaseController
|
|||||||
@ApiOperation("新增用水户信息")
|
@ApiOperation("新增用水户信息")
|
||||||
public AjaxResult add(@RequestBody NgInformationWaterUser ngInformationWaterUser)
|
public AjaxResult add(@RequestBody NgInformationWaterUser ngInformationWaterUser)
|
||||||
{
|
{
|
||||||
|
|
||||||
return toAjax(ngInformationWaterUserService.insertNgInformationWaterUser(ngInformationWaterUser));
|
return toAjax(ngInformationWaterUserService.insertNgInformationWaterUser(ngInformationWaterUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
/** 类型 */
|
/** 类型 */
|
||||||
@Excel(name = "类型")
|
@Excel(name = "类型")
|
||||||
@ApiModelProperty("类型")
|
@ApiModelProperty("类型")
|
||||||
private Long type;
|
private String type;
|
||||||
|
|
||||||
/** 负责人 */
|
/** 负责人 */
|
||||||
@Excel(name = "负责人")
|
@Excel(name = "负责人")
|
||||||
|
@ -5,8 +5,6 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.fastbee.common.annotation.Excel;
|
import com.fastbee.common.annotation.Excel;
|
||||||
import com.fastbee.common.core.domain.BaseEntity;
|
import com.fastbee.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
@ -5,9 +5,13 @@ import com.fastbee.common.utils.DateUtils;
|
|||||||
import com.fastbee.rechargecard.domain.NgInformationWaterUser;
|
import com.fastbee.rechargecard.domain.NgInformationWaterUser;
|
||||||
import com.fastbee.rechargecard.mapper.NgInformationWaterUserMapper;
|
import com.fastbee.rechargecard.mapper.NgInformationWaterUserMapper;
|
||||||
import com.fastbee.rechargecard.service.INgInformationWaterUserService;
|
import com.fastbee.rechargecard.service.INgInformationWaterUserService;
|
||||||
|
import net.bytebuddy.utility.JavaConstant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.MathContext;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +59,19 @@ public class NgInformationWaterUserServiceImpl implements INgInformationWaterUse
|
|||||||
@Override
|
@Override
|
||||||
public int insertNgInformationWaterUser(NgInformationWaterUser ngInformationWaterUser)
|
public int insertNgInformationWaterUser(NgInformationWaterUser ngInformationWaterUser)
|
||||||
{
|
{
|
||||||
ngInformationWaterUser.setCreateTime(DateUtils.getNowDate());
|
BigDecimal waterConsumption = ngInformationWaterUser.getWaterConsumption();
|
||||||
|
BigDecimal waterConsumptionIndex = ngInformationWaterUser.getWaterConsumptionindex();
|
||||||
|
// 使用 divide 方法进行除法运算,并指定精度和舍入模式
|
||||||
|
BigDecimal ngInformationWater = waterConsumption.divide(waterConsumptionIndex, new MathContext(10, RoundingMode.HALF_UP));
|
||||||
|
BigDecimal green = new BigDecimal("0.9");
|
||||||
|
BigDecimal yellow = new BigDecimal("1.0");;
|
||||||
|
if (ngInformationWater.compareTo(green) < 0){
|
||||||
|
ngInformationWaterUser.setWarningStatus(1L);
|
||||||
|
} else if (ngInformationWater.compareTo(yellow)<0) {
|
||||||
|
ngInformationWaterUser.setWarningStatus(2L);
|
||||||
|
}else {
|
||||||
|
ngInformationWaterUser.setWarningStatus(3L);
|
||||||
|
}
|
||||||
return ngInformationWaterUserMapper.insertNgInformationWaterUser(ngInformationWaterUser);
|
return ngInformationWaterUserMapper.insertNgInformationWaterUser(ngInformationWaterUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user