| 
					
				 | 
			
			
				@@ -16,6 +16,8 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -206,7 +208,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public int batchUpdateTransportPriceByOilPrice(Map<String,Object> map) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public int batchUpdateTransportPriceByOilPrice(Map<String,Object> map){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String flag= (String) map.get("flag"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -218,21 +220,26 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Map<String, Object>> PriceValueList = amsContractTruckPriceMapper.getPriceValueList(oilTypeId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (Map<String, Object> stringObjectMap : PriceValueList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            stringObjectMap.put("priceDate",map.get("priceDate")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal oilpriceBase = DataChange.dataToBigDecimal(stringObjectMap.get("oilpriceBase")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BigDecimal oilpriceChangeThreshold = DataChange.dataToBigDecimal(stringObjectMap.get("oilpriceChangeThreshold")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            BigDecimal n = (newOilPrice.subtract(oilpriceBase)).divide(oilpriceBase,4,4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal n = (oilpriceBase.subtract(newOilPrice)).divide(newOilPrice,4,4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(n.abs().doubleValue()>oilpriceChangeThreshold.doubleValue()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(newOilPrice.compareTo(oilpriceBase)==-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else if (newOilPrice.compareTo(oilpriceBase)==1 && "1".equals(flag)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(newOilPrice.compareTo(oilpriceBase)==-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }else if (newOilPrice.compareTo(oilpriceBase)==1 && "1".equals(flag)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -272,7 +279,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public int addANewAmsContractTransportPrice(Map<String, Object> stringObjectMap,BigDecimal n,BigDecimal newOilPrice){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public int addANewAmsContractTransportPrice(Map<String, Object> stringObjectMap,BigDecimal n,BigDecimal newOilPrice) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal nowPriceValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -291,7 +298,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal i = amsContractTruckPriceMapper.selectMaxId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         amsContractTransportPrice.setPriceId(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        amsContractTransportPrice.setPriceDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        amsContractTransportPrice.setPriceDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) stringObjectMap.get("priceDate"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         amsContractTransportPrice.setInsertUsername("admin"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         amsContractTransportPrice.setInsertTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -340,13 +347,14 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             nowPriceValue = UpdatePureBenzenePriceValueByOilPrice(n.toString(),amsContractTransportPrice.getPriceValue(),formulaId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            nowPriceValue = nowPriceValue.divide(new BigDecimal(1),2,4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            nowPriceValue = nowPriceValue.divide(new BigDecimal(1),3,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             amsContractTransportPrice.setPriceValue(nowPriceValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             amsContractTransportPrice.setOilpriceBase(newOilPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int insert = amsContractTruckPriceMapper.insert(amsContractTransportPrice); 
			 |