You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
3.0 KiB
82 lines
3.0 KiB
package com.hai.service.impl;
|
|
|
|
import com.hai.dao.HighGasOilPriceMapper;
|
|
import com.hai.entity.HighGasOilGunNoExample;
|
|
import com.hai.entity.HighGasOilPrice;
|
|
import com.hai.entity.HighGasOilPriceExample;
|
|
import com.hai.enum_type.GasOilPriceStatusEnum;
|
|
import com.hai.service.HighGasOilPriceService;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Service("highGasOilPriceService")
|
|
public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
|
|
|
|
@Resource
|
|
private HighGasOilPriceMapper highGasOilPriceMapper;
|
|
|
|
@Override
|
|
public void editGasOilPrice(HighGasOilPrice highGasOilPrice) {
|
|
if (highGasOilPrice.getId() != null) {
|
|
highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice);
|
|
} else {
|
|
highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus());
|
|
highGasOilPriceMapper.insert(highGasOilPrice);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public HighGasOilPrice getGasOilPriceById(Long id) {
|
|
return highGasOilPriceMapper.selectByPrimaryKey(id);
|
|
}
|
|
|
|
@Override
|
|
public HighGasOilPrice getGasOilPriceByStoreAndOilNo(Long storeId, String oilNo) {
|
|
HighGasOilPriceExample example = new HighGasOilPriceExample();
|
|
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andOilNoEqualTo(oilNo).andStatusNotEqualTo(0);
|
|
List<HighGasOilPrice> list = highGasOilPriceMapper.selectByExample(example);
|
|
if (list.size() > 0) {
|
|
return list.get(0);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public List<HighGasOilPrice> getGasOilPriceByStore(Long storeId) {
|
|
HighGasOilPriceExample example = new HighGasOilPriceExample();
|
|
example.createCriteria().andMerchantStoreIdEqualTo(storeId).andStatusNotEqualTo(0);
|
|
return highGasOilPriceMapper.selectByExample(example);
|
|
}
|
|
|
|
@Override
|
|
public List<HighGasOilPrice> getPriceListByRegionAndOilNo(Long regionId, String oilNo) {
|
|
return highGasOilPriceMapper.selectPriceListByRegionAndOilNo(regionId,oilNo);
|
|
}
|
|
|
|
@Override
|
|
public List<Map<String,Object>> getStoreListByOilNo(String storeName,Long regionId, String oilNoName , String sourceType) {
|
|
return highGasOilPriceMapper.selectStoreListByOilNo(storeName,regionId,oilNoName , sourceType);
|
|
}
|
|
|
|
@Override
|
|
public Map<String, Object> recentGasStation(String longitude, String latitude) {
|
|
return highGasOilPriceMapper.recentGasStation(longitude, latitude);
|
|
}
|
|
|
|
@Override
|
|
public List<HighGasOilPrice> getGasOilPriceList(Map<String, Object> map) {
|
|
HighGasOilPriceExample example = new HighGasOilPriceExample();
|
|
HighGasOilPriceExample.Criteria criteria = example.createCriteria();
|
|
|
|
if (MapUtils.getInteger(map, "oilType") != null) {
|
|
criteria.andOilTypeEqualTo(MapUtils.getInteger(map, "oilType"));
|
|
}
|
|
criteria.andStatusEqualTo(1);
|
|
|
|
return highGasOilPriceMapper.selectByExample(example);
|
|
}
|
|
}
|
|
|