Commit 836900fd authored by tianyiming's avatar tianyiming

气瓶总览单个企业页面气瓶/标签数量比计算值错误修改

parent 7979d6cc
......@@ -22,7 +22,7 @@ public class CylinderTagsDataUnitDto extends BaseDto {
@ApiModelProperty(value = "气瓶标签比")
private Double tagPercent;
private String tagPercent;
@ApiModelProperty(value = "气瓶数量")
private Long cylinderSum;
......
......@@ -26,7 +26,7 @@ public class CylinderTagsDataUnit extends BaseEntity {
* 气瓶标签比
*/
@TableField("tag_percent")
private Double tagPercent;
private String tagPercent;
/**
* 气瓶数量
......
......@@ -52,6 +52,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -490,15 +491,19 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
double percent = 0d;
String percent = "";
if (tags != 0) {
percent = (double) cylinder / (double) tags;
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
double zz = (double) cylinder /(double) tags;
DecimalFormat df = new DecimalFormat("##.00%");
if (Math.abs(zz) < 0.0000000000001) {
percent = "0.00%";
} else {
percent = df.format(zz);
}
}
temp.setCylinderSum((long) cylinder);
temp.setTagsSum((long) tags);
temp.setTagPercent(percent * 100);
temp.setTagPercent(percent);
cylinderTagsDataUnitServiceImpl.createWithModel(temp);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment