提交代码

dev
胡锐 2 months ago
parent 8ae15209ba
commit 48c4d19c36
  1. 26
      cweb/src/main/java/com/cweb/controller/BsDiscountUserController.java

@ -8,14 +8,17 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.BsAgentPrice;
import com.hfkj.entity.BsDiscountUser; import com.hfkj.entity.BsDiscountUser;
import com.hfkj.model.DiscountUserModel; import com.hfkj.model.DiscountUserModel;
import com.hfkj.model.GasListModel; import com.hfkj.model.GasListModel;
import com.hfkj.model.ResponseData; import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject; import com.hfkj.model.UserSessionObject;
import com.hfkj.service.agent.BsAgentPriceService;
import com.hfkj.service.discount.BsDiscountService; import com.hfkj.service.discount.BsDiscountService;
import com.hfkj.service.discount.BsDiscountUserService; import com.hfkj.service.discount.BsDiscountUserService;
import com.hfkj.service.gas.BsGasService; import com.hfkj.service.gas.BsGasService;
import com.hfkj.sysenum.agent.AgentPriceTypeEnum;
import com.hfkj.sysenum.discount.DiscountUserStatusEnum; import com.hfkj.sysenum.discount.DiscountUserStatusEnum;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -47,11 +50,14 @@ public class BsDiscountUserController {
private UserCenter userCenter; private UserCenter userCenter;
@Resource @Resource
private BsGasService gasService; private BsGasService gasService;
@Resource
private BsAgentPriceService agentPriceService;
@RequestMapping(value="/usableMerList",method = RequestMethod.GET) @RequestMapping(value="/usableMerList",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "可用加油站列表") @ApiOperation(value = "可用加油站列表")
public ResponseData usableMerList(@RequestParam(name = "discountNo", required = true) String discountNo, 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 = "gasName", required = false) String gasName,
@RequestParam(name = "distanceLimit", required = false) Integer distanceLimit, @RequestParam(name = "distanceLimit", required = false) Integer distanceLimit,
@RequestParam(name = "oilNo", required = true) String oilNo, @RequestParam(name = "oilNo", required = true) String oilNo,
@ -62,7 +68,25 @@ public class BsDiscountUserController {
try { try {
PageHelper.startPage(pageNum,pageSize); 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) { } catch (Exception e) {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

Loading…
Cancel
Save