|
@@ -22,6 +22,7 @@ import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -80,18 +81,32 @@ public class CostModelXmxqClServiceImpl extends ServiceImpl<CostModelXmxqClMappe
|
|
|
int num2 = 0; //导入的材料费缺少必填的条数
|
|
|
String msg =""; //最终返回的提示信息
|
|
|
String msg2 ="";
|
|
|
+ BigDecimal initValue = new BigDecimal(0).setScale(2, RoundingMode.HALF_UP);
|
|
|
for(CostModelXmxqCl cl:list){
|
|
|
if(cl.getGgxh()!=null){
|
|
|
cl.setXiangmuName(xmName);
|
|
|
cl.setXiangmuId(xmId);
|
|
|
CostModelXmxqCl clxq = costModelClPriceService.selectClPriceValue(cl);
|
|
|
+ System.out.println(clxq);
|
|
|
if(clxq != null){
|
|
|
- list1.add(clxq);
|
|
|
- clfMax = clfMax.add(new BigDecimal(clxq.getMaxPrice()));
|
|
|
- clfMin = clfMin.add(new BigDecimal(clxq.getMinPrice()));
|
|
|
- clfAve = clfAve.add(new BigDecimal(clxq.getAvePrice()));
|
|
|
- clfRecent = clfRecent.add(new BigDecimal(clxq.getRecentPrice()));
|
|
|
- }else {
|
|
|
+ if((new BigDecimal(clxq.getMaxPrice())).setScale(2, RoundingMode.HALF_UP).equals(initValue) && (new BigDecimal(clxq.getMinPrice())).setScale(2, RoundingMode.HALF_UP).equals(initValue) && (new BigDecimal(clxq.getAvePrice())).setScale(2, RoundingMode.HALF_UP).equals(initValue) && (new BigDecimal(clxq.getRecentPrice())).setScale(2, RoundingMode.HALF_UP).equals(initValue)){
|
|
|
+ num1++;
|
|
|
+ String msg1 = "材料价格库内——规格型号:"+cl.getGgxh() + " 未找到!";
|
|
|
+ CostModelMsg costModelMsg = new CostModelMsg();
|
|
|
+ costModelMsg.setXiangmuId(xmId);
|
|
|
+ costModelMsg.setXiangmuName(xmName);
|
|
|
+ costModelMsg.setXiangmuMsg(msg1);
|
|
|
+ modelMsgList.add(costModelMsg);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ list1.add(clxq);
|
|
|
+ clfMax = clfMax.add(new BigDecimal(clxq.getMaxPrice()));
|
|
|
+ clfMin = clfMin.add(new BigDecimal(clxq.getMinPrice()));
|
|
|
+ clfAve = clfAve.add(new BigDecimal(clxq.getAvePrice()));
|
|
|
+ clfRecent = clfRecent.add(new BigDecimal(clxq.getRecentPrice()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
num1++;
|
|
|
String msg1 = "材料价格库内——规格型号:"+cl.getGgxh() + " 未找到!";
|
|
|
CostModelMsg costModelMsg = new CostModelMsg();
|
|
@@ -105,6 +120,7 @@ public class CostModelXmxqClServiceImpl extends ServiceImpl<CostModelXmxqClMappe
|
|
|
num2++;
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println(num2);
|
|
|
if(num2>0){
|
|
|
msg2 = "导入的材料Excel表中有"+num2+"条规格型号未填写!";
|
|
|
CostModelMsg costModelMsg = new CostModelMsg();
|
|
@@ -113,6 +129,7 @@ public class CostModelXmxqClServiceImpl extends ServiceImpl<CostModelXmxqClMappe
|
|
|
costModelMsg.setXiangmuMsg(msg2);
|
|
|
modelMsgList.add(costModelMsg);
|
|
|
}
|
|
|
+ System.out.println(num1);
|
|
|
if(num1>0) msg = "材料价格库中有"+num1+"条数据未找到!"+msg2;
|
|
|
else msg = msg2;
|
|
|
|