|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
@ -92,14 +91,19 @@ public class QualityDispatchNumberServiceImpl implements QualityDispatchNumberSe
|
|
|
|
|
qualityDispatchTaskVO.setExceptionNum("0"); |
|
|
|
|
} |
|
|
|
|
String exceptionNum = qualityDispatchTaskVO.getExceptionNum(); |
|
|
|
|
if(StrUtil.isNotEmpty(planNum)){ |
|
|
|
|
if (StrUtil.isNotEmpty(planNum)) { |
|
|
|
|
// 计算 ((planNum-exceptionNum)/planNum)*100 保留两位小数
|
|
|
|
|
int planNumInt = Convert.toInt(planNum); |
|
|
|
|
if (planNumInt > 0) { |
|
|
|
|
BigDecimal div = NumberUtil.div(NumberUtil.mul(NumberUtil.sub(planNum, exceptionNum), 100), new BigDecimal(planNum), 2); |
|
|
|
|
String str = Convert.toStr(div); |
|
|
|
|
String s = str.replaceAll(".00", ""); |
|
|
|
|
qualityDispatchTaskVO.setPlanAccuracy(s +"%"); |
|
|
|
|
BigDecimal planNumBD = new BigDecimal(planNumInt); |
|
|
|
|
BigDecimal exceptionNumBD = new BigDecimal(exceptionNum); |
|
|
|
|
BigDecimal sub = planNumBD.subtract(exceptionNumBD); |
|
|
|
|
BigDecimal mul = sub.multiply(new BigDecimal(100)); |
|
|
|
|
BigDecimal div = mul.divide(planNumBD, 2, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
// 格式化结果
|
|
|
|
|
String str = div.toString(); |
|
|
|
|
String s = str.replaceAll("\\.00$", ""); |
|
|
|
|
qualityDispatchTaskVO.setPlanAccuracy(s + "%"); |
|
|
|
|
} else { |
|
|
|
|
qualityDispatchTaskVO.setPlanAccuracy("0%"); |
|
|
|
|
} |
|
|
|
|