|
@@ -363,7 +363,6 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
}else if(type.compareTo(new BigDecimal(2)) == 0) {
|
|
}else if(type.compareTo(new BigDecimal(2)) == 0) {
|
|
PriceValueList = amsContractTruckPriceMapper.getPriceValueListInward(oilTypeId);
|
|
PriceValueList = amsContractTruckPriceMapper.getPriceValueListInward(oilTypeId);
|
|
}
|
|
}
|
|
-
|
|
|
|
for (Map<String, Object> stringObjectMap : PriceValueList) {
|
|
for (Map<String, Object> stringObjectMap : PriceValueList) {
|
|
//有距离则是销售钢材
|
|
//有距离则是销售钢材
|
|
if (stringObjectMap.get("haulDistance")!=null) {
|
|
if (stringObjectMap.get("haulDistance")!=null) {
|
|
@@ -381,17 +380,17 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
BigDecimal distance = DataChange.dataToBigDecimal(stringObjectMap.get("haulDistance"));
|
|
BigDecimal distance = DataChange.dataToBigDecimal(stringObjectMap.get("haulDistance"));
|
|
if (zbDistance != null && distance != null && zbDistance.intValue()!=0 && distance.intValue()!=0){
|
|
if (zbDistance != null && distance != null && zbDistance.intValue()!=0 && distance.intValue()!=0){
|
|
BigDecimal subtract = zbDistance.subtract(distance);
|
|
BigDecimal subtract = zbDistance.subtract(distance);
|
|
- if (subtract.intValue()>10 || subtract.intValue()<-10){
|
|
|
|
- //大于正负10km重新计算价格
|
|
|
|
- //跳过
|
|
|
|
- continue;
|
|
|
|
- }else{
|
|
|
|
- //小于10km取中标价格
|
|
|
|
- Map<String,Object> updatePrice=new HashMap<>();
|
|
|
|
- updatePrice.put("priceId",DataChange.dataToBigDecimal(stringObjectMap.get("priceId")));
|
|
|
|
- updatePrice.put("priceValue",DataChange.dataToBigDecimal(zb.get("priceValue")));
|
|
|
|
- return amsContractTruckPriceMapper.updateByPriceId(updatePrice);
|
|
|
|
- }
|
|
|
|
|
|
+// if (subtract.intValue()>10 || subtract.intValue()<-10){
|
|
|
|
+// //大于正负10km重新计算价格
|
|
|
|
+// //跳过
|
|
|
|
+// continue;
|
|
|
|
+// }else{
|
|
|
|
+// //小于10km取中标价格
|
|
|
|
+// /*Map<String,Object> updatePrice=new HashMap<>();
|
|
|
|
+// updatePrice.put("priceId",DataChange.dataToBigDecimal(stringObjectMap.get("priceId")));
|
|
|
|
+// updatePrice.put("priceValue",DataChange.dataToBigDecimal(zb.get("priceValue")));
|
|
|
|
+// return amsContractTruckPriceMapper.updateByPriceId(updatePrice);*/
|
|
|
|
+// }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -410,10 +409,10 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
try{
|
|
try{
|
|
if(newOilPrice.compareTo(oilpriceBase)==-1){
|
|
if(newOilPrice.compareTo(oilpriceBase)==-1){
|
|
//直接降低油价
|
|
//直接降低油价
|
|
- i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
|
|
|
+ i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice,type);
|
|
}else if (newOilPrice.compareTo(oilpriceBase)==1 && "1".equals(flag)){
|
|
}else if (newOilPrice.compareTo(oilpriceBase)==1 && "1".equals(flag)){
|
|
//加上两个判断之后
|
|
//加上两个判断之后
|
|
- i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
|
|
|
+ i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice,type);
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -456,7 +455,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
- public int addANewAmsContractTransportPrice(Map<String, Object> stringObjectMap,BigDecimal n,BigDecimal newOilPrice) throws ParseException {
|
|
|
|
|
|
+ public int addANewAmsContractTransportPrice(Map<String, Object> stringObjectMap,BigDecimal n,BigDecimal newOilPrice,BigDecimal type) throws ParseException {
|
|
//定义将要改变的执行价
|
|
//定义将要改变的执行价
|
|
BigDecimal nowPriceValue;
|
|
BigDecimal nowPriceValue;
|
|
//存储原运输单价实绩对象
|
|
//存储原运输单价实绩对象
|
|
@@ -473,6 +472,15 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
AmsContractTransportPrice amsContractTransportPrice = amsContractTruckPriceMapper.selectByPrimaryKey(priceId);
|
|
AmsContractTransportPrice amsContractTransportPrice = amsContractTruckPriceMapper.selectByPrimaryKey(priceId);
|
|
//生成主键
|
|
//生成主键
|
|
BigDecimal i = amsContractTruckPriceMapper.selectMaxId();
|
|
BigDecimal i = amsContractTruckPriceMapper.selectMaxId();
|
|
|
|
+ //内转的话复制子表信息并新增
|
|
|
|
+ if(type.compareTo(new BigDecimal(2)) == 0){
|
|
|
|
+ List<Map<String, Object>> amsContractMaterialData = amsContractTruckPriceMapper.getAmsContractMaterialData(priceId);
|
|
|
|
+ for (Map<String, Object> amsContractMaterialDatum : amsContractMaterialData) {
|
|
|
|
+ amsContractMaterialDatum.put("i",i);
|
|
|
|
+ amsContractMaterialDatum.put("priceMaterialId",amsContractTruckPriceMapper.selectPriceMaterialMaxId());
|
|
|
|
+ amsContractTruckPriceMapper.insertIntoAmsContractForMaterial(amsContractMaterialDatum);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//如果是钢材的单价那么就需要改变吨公里
|
|
//如果是钢材的单价那么就需要改变吨公里
|
|
amsContractTransportPrice.setPriceId(i);
|
|
amsContractTransportPrice.setPriceId(i);
|
|
//生成执行日期
|
|
//生成执行日期
|
|
@@ -525,7 +533,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
try {
|
|
try {
|
|
nowPriceValue = UpdatePureBenzenePriceValueByOilPrice(n.toString(),amsContractTransportPrice.getPriceValue(),formulaId);
|
|
nowPriceValue = UpdatePureBenzenePriceValueByOilPrice(n.toString(),amsContractTransportPrice.getPriceValue(),formulaId);
|
|
//保留两位小数
|
|
//保留两位小数
|
|
- nowPriceValue = nowPriceValue.divide(new BigDecimal(1),2,0);
|
|
|
|
|
|
+ nowPriceValue = nowPriceValue.divide(new BigDecimal(1),2,BigDecimal.ROUND_HALF_UP);
|
|
//调整纯苯运价
|
|
//调整纯苯运价
|
|
amsContractTransportPrice.setPriceValue(nowPriceValue);
|
|
amsContractTransportPrice.setPriceValue(nowPriceValue);
|
|
//修改基准油价
|
|
//修改基准油价
|