|
@@ -10,6 +10,7 @@ import com.steerinfo.dil.model.RmsLineNodePoint;
|
|
import com.steerinfo.dil.model.RmsReceivePlace;
|
|
import com.steerinfo.dil.model.RmsReceivePlace;
|
|
import com.steerinfo.dil.service.IAmsContractTruckPriceService;
|
|
import com.steerinfo.dil.service.IAmsContractTruckPriceService;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
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 org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -206,6 +207,8 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public int batchUpdateTransportPriceByOilPrice(Map<String,Object> map) {
|
|
public int batchUpdateTransportPriceByOilPrice(Map<String,Object> map) {
|
|
|
|
+ //正数的判断条件
|
|
|
|
+ String flag= (String) map.get("flag");
|
|
//运输单价变化的条数
|
|
//运输单价变化的条数
|
|
int i = 0;
|
|
int i = 0;
|
|
//获取油品名称ID
|
|
//获取油品名称ID
|
|
@@ -223,7 +226,14 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
BigDecimal n = (newOilPrice.subtract(oilpriceBase)).divide(oilpriceBase,4,4);
|
|
BigDecimal n = (newOilPrice.subtract(oilpriceBase)).divide(oilpriceBase,4,4);
|
|
//若油价变化率超过该条单价的油价变化率阈值,修改原单价为历史数据,新增一条单价
|
|
//若油价变化率超过该条单价的油价变化率阈值,修改原单价为历史数据,新增一条单价
|
|
if(n.abs().doubleValue()>oilpriceChangeThreshold.doubleValue()){
|
|
if(n.abs().doubleValue()>oilpriceChangeThreshold.doubleValue()){
|
|
- i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
|
|
|
+ //加一个判断(如果数据为正数则需要二次判断,如果数据为负数则直接生效)
|
|
|
|
+ if(newOilPrice.compareTo(oilpriceBase)==-1){
|
|
|
|
+ //直接降低油价
|
|
|
|
+ i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
|
+ }else if (newOilPrice.compareTo(oilpriceBase)==1 && "1".equals(flag)){
|
|
|
|
+ //加上两个判断之后
|
|
|
|
+ i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return i;
|
|
return i;
|
|
@@ -322,7 +332,10 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// 得到油价联动公式id
|
|
// 得到油价联动公式id
|
|
- BigDecimal formulaId = DataChange.dataToBigDecimal(stringObjectMap.get("cargonameId"));
|
|
|
|
|
|
+ //BigDecimal formulaId = DataChange.dataToBigDecimal(stringObjectMap.get("cargonameId"));
|
|
|
|
+ //BigDecimal formulaId= (BigDecimal) stringObjectMap.get("cargonameId");
|
|
|
|
+ String s= (String) stringObjectMap.get("cargonameId");
|
|
|
|
+ BigDecimal formulaId = NumberUtils.createBigDecimal(s.trim());
|
|
amsContractTransportPrice.setCargonameId(formulaId);
|
|
amsContractTransportPrice.setCargonameId(formulaId);
|
|
try {
|
|
try {
|
|
nowPriceValue = UpdatePureBenzenePriceValueByOilPrice(n.toString(),amsContractTransportPrice.getPriceValue(),formulaId);
|
|
nowPriceValue = UpdatePureBenzenePriceValueByOilPrice(n.toString(),amsContractTransportPrice.getPriceValue(),formulaId);
|