parent
2d13835ab0
commit
1adc37c728
File diff suppressed because one or more lines are too long
@ -0,0 +1,55 @@ |
||||
package com.v1.config; |
||||
|
||||
import com.hai.entity.ApiMchProduct; |
||||
import com.hai.entity.HighGasOilGunNo; |
||||
import com.hai.openApi.service.ApiMchProductService; |
||||
import com.hai.service.ApiMerchantsService; |
||||
import com.hai.service.HighGasOilGunNoService; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Configuration |
||||
public class ApiCommonConfig { |
||||
|
||||
@Resource |
||||
private ApiMchProductService ApiMchProductService; |
||||
|
||||
@Resource |
||||
private HighGasOilGunNoService highGasOilGunNoService; |
||||
|
||||
public BigDecimal computationPriceCost(String mchId , Integer productType , BigDecimal price) { |
||||
|
||||
Map<String , Object> map = new HashMap<>(); |
||||
map.put("mchId" , mchId); |
||||
map.put("productType" , productType); |
||||
|
||||
ApiMchProduct apiMchProduct = ApiMchProductService.findByMap(map); |
||||
|
||||
return price.multiply(apiMchProduct.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
|
||||
} |
||||
|
||||
|
||||
public List<String> assemblyGasOilGunNo(Long oilPriceId) { |
||||
|
||||
List<String> gasOilGunNos = new ArrayList<>(); |
||||
|
||||
List<HighGasOilGunNo> list = highGasOilGunNoService.getGunNoListByOilPrice(oilPriceId); |
||||
|
||||
|
||||
for (HighGasOilGunNo gasOilGunNo : list) { |
||||
gasOilGunNos.add(gasOilGunNo.getGunNo()); |
||||
} |
||||
|
||||
|
||||
return gasOilGunNos; |
||||
|
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue