|
@@ -358,18 +358,12 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
|
BigDecimal type = DataChange.dataToBigDecimal(map.get("type"));
|
|
|
//根据油品名称ID和非历史油价筛选出符合条件的运价合集
|
|
|
List<Map<String, Object>> PriceValueList = new ArrayList<>();
|
|
|
- PriceValueList = amsContractTruckPriceMapper.getPriceValueList(oilTypeId);
|
|
|
-// if (type.compareTo(new BigDecimal(1)) == 0) {
|
|
|
-//
|
|
|
-// }else if(type.compareTo(new BigDecimal(2)) == 0) {
|
|
|
-// PriceValueList = amsContractTruckPriceMapper.getPriceValueListInward(oilTypeId);
|
|
|
-// }
|
|
|
+ if (type.compareTo(new BigDecimal(1)) == 0) {
|
|
|
+ PriceValueList = amsContractTruckPriceMapper.getPriceValueList(oilTypeId);
|
|
|
+ }else if(type.compareTo(new BigDecimal(2)) == 0) {
|
|
|
+ PriceValueList = amsContractTruckPriceMapper.getPriceValueListInward(oilTypeId);
|
|
|
+ }
|
|
|
for (Map<String, Object> stringObjectMap : PriceValueList) {
|
|
|
- //内转的话复制子表信息并新增
|
|
|
-// if(type.compareTo(new BigDecimal(2)) == 0){
|
|
|
-// stringObjectMap.get("priceId");
|
|
|
-// amsContractTruckPriceMapper.
|
|
|
-// }
|
|
|
//有距离则是销售钢材
|
|
|
if (stringObjectMap.get("haulDistance")!=null) {
|
|
|
//中标价格或者收货地址(库存)则重新计算价格
|
|
@@ -386,17 +380,17 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
|
BigDecimal distance = DataChange.dataToBigDecimal(stringObjectMap.get("haulDistance"));
|
|
|
if (zbDistance != null && distance != null && zbDistance.intValue()!=0 && distance.intValue()!=0){
|
|
|
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);*/
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -415,10 +409,10 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
|
try{
|
|
|
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)){
|
|
|
//加上两个判断之后
|
|
|
- i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice);
|
|
|
+ i+=addANewAmsContractTransportPrice(stringObjectMap,n,newOilPrice,type);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
@@ -461,7 +455,7 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@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;
|
|
|
//存储原运输单价实绩对象
|
|
@@ -478,6 +472,15 @@ public class AmsContractTruckPriceServiceImpl implements IAmsContractTruckPriceS
|
|
|
AmsContractTransportPrice amsContractTransportPrice = amsContractTruckPriceMapper.selectByPrimaryKey(priceId);
|
|
|
//生成主键
|
|
|
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);
|
|
|
//生成执行日期
|