|
|
|
@ -8,14 +8,17 @@ import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.entity.BsAgentPrice; |
|
|
|
|
import com.hfkj.entity.BsDiscountUser; |
|
|
|
|
import com.hfkj.model.DiscountUserModel; |
|
|
|
|
import com.hfkj.model.GasListModel; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
import com.hfkj.service.agent.BsAgentPriceService; |
|
|
|
|
import com.hfkj.service.discount.BsDiscountService; |
|
|
|
|
import com.hfkj.service.discount.BsDiscountUserService; |
|
|
|
|
import com.hfkj.service.gas.BsGasService; |
|
|
|
|
import com.hfkj.sysenum.agent.AgentPriceTypeEnum; |
|
|
|
|
import com.hfkj.sysenum.discount.DiscountUserStatusEnum; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@ -47,11 +50,14 @@ public class BsDiscountUserController { |
|
|
|
|
private UserCenter userCenter; |
|
|
|
|
@Resource |
|
|
|
|
private BsGasService gasService; |
|
|
|
|
@Resource |
|
|
|
|
private BsAgentPriceService agentPriceService; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/usableMerList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "可用加油站列表") |
|
|
|
|
public ResponseData usableMerList(@RequestParam(name = "discountNo", required = true) String discountNo, |
|
|
|
|
@RequestParam(name = "agentMerId", required = false) Long agentMerId, |
|
|
|
|
@RequestParam(name = "gasName", required = false) String gasName, |
|
|
|
|
@RequestParam(name = "distanceLimit", required = false) Integer distanceLimit, |
|
|
|
|
@RequestParam(name = "oilNo", required = true) String oilNo, |
|
|
|
@ -62,7 +68,25 @@ public class BsDiscountUserController { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum,pageSize); |
|
|
|
|
return ResponseMsgUtil.success(new PageInfo<>(gasService.getGasListByDiscount(discountNo,longitude, latitude, oilNo, gasName, distanceLimit, true))); |
|
|
|
|
PageInfo<GasListModel> pageInfo = new PageInfo<>(gasService.getGasListByDiscount(discountNo,longitude, latitude, oilNo, gasName, distanceLimit, true)); |
|
|
|
|
for (GasListModel gas : pageInfo.getList()) { |
|
|
|
|
BigDecimal discount = new BigDecimal("100"); |
|
|
|
|
if (agentMerId != null) { |
|
|
|
|
// 查询代理价格
|
|
|
|
|
BsAgentPrice agentPrice = agentPriceService.getDetail(agentMerId, gas.getOilNo()); |
|
|
|
|
if (agentPrice != null) { |
|
|
|
|
discount = agentPrice.getPriceRate(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 查询平台价格
|
|
|
|
|
BsAgentPrice agentPrice = agentPriceService.getDetail(AgentPriceTypeEnum.type1, gas.getMerNo(), gas.getOilNo()); |
|
|
|
|
if (agentPrice != null) { |
|
|
|
|
discount = agentPrice.getPriceRate(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
gas.setPriceVip(gas.getPriceVip().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(pageInfo); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|