From 041931c60693f693abbfb4aed44ca38c20076f8a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 28 Apr 2022 10:09:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/CommonController.java | 11 +- .../HighTyAgentPriceController.java | 109 +++++++++++++-- .../cweb/controller/HighGasController.java | 112 +++++++++------ .../cweb/controller/HighOrderController.java | 39 +++--- .../com/hai/dao/HighTyAgentPriceMapper.java | 17 ++- .../hai/dao/HighTyAgentPriceSqlProvider.java | 28 ++++ .../java/com/hai/entity/HighTyAgentPrice.java | 32 +++++ .../hai/entity/HighTyAgentPriceExample.java | 130 ++++++++++++++++++ .../hai/service/HighTyAgentPriceService.java | 14 +- .../impl/HighTyAgentPriceServiceImpl.java | 14 +- 10 files changed, 422 insertions(+), 84 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java index d3a77ac7..ae62e3a6 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java @@ -5,6 +5,7 @@ import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.TuanYouConfig; import com.hai.entity.SecConfig; +import com.hai.entity.SecDictionary; import com.hai.model.*; import com.hai.service.CommonService; import com.hai.service.SecConfigService; @@ -16,8 +17,11 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.Comparator; import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @RestController @@ -87,8 +91,11 @@ public class CommonController { @ApiOperation(value = "根据 码值类型 查询数据字典") public ResponseData getDictionaryByCodeType(@RequestParam(name = "codeType", required = true) String codeType) { try { - - return ResponseMsgUtil.success(commonService.getDictionarys(codeType)); + List list = commonService.getDictionarys(codeType); + if (list != null && list.size() > 0) { + list = list.stream().sorted(Comparator.comparingDouble(entry -> entry.getSortId())).collect(Collectors.toList()); + } + return ResponseMsgUtil.success(list); } catch (Exception e) { log.error("CommonController --> getDictionaryByCodeType() error!", e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentPriceController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentPriceController.java index e4dcf5d7..4bc05ef4 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentPriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTyAgentPriceController.java @@ -9,6 +9,7 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.entity.*; +import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.service.*; import io.swagger.annotations.Api; @@ -67,7 +68,8 @@ public class HighTyAgentPriceController { for (Object obj : bodyArray) { JSONObject body = (JSONObject)JSONObject.toJSON(obj); if (body.getInteger("belongType") == null - || body.getLong("tyAgentOilStationId") == null + || body.getLong("oilStationId") == null + || StringUtils.isBlank(body.getString("oilStationName")) || StringUtils.isBlank(body.getString("oilNoName")) || StringUtils.isBlank(body.getString("oilNo")) || body.getBigDecimal("priceRate") == null) { @@ -75,10 +77,12 @@ public class HighTyAgentPriceController { } // 查询油站 - HighTyAgentPrice agentOilStation = tyAgentPriceService.getDetail(body.getInteger("belongType"),body.getLong("tyAgentOilStationId"), body.getString("oilNo")); + HighTyAgentPrice agentOilStation = tyAgentPriceService.getDetail(body.getInteger("belongType"),body.getLong("oilStationId"), body.getString("oilNo")); if (agentOilStation == null) { agentOilStation = new HighTyAgentPrice(); agentOilStation.setBelongType(body.getInteger("belongType")); + agentOilStation.setOilStationId(body.getLong("oilStationId")); + agentOilStation.setOilStationName(body.getString("oilStationName")); agentOilStation.setTyAgentOilStationId(body.getLong("tyAgentOilStationId")); agentOilStation.setOilNoName(body.getString("oilNoName")); agentOilStation.setOilNo(body.getString("oilNo")); @@ -97,6 +101,90 @@ public class HighTyAgentPriceController { } } + @RequestMapping(value = "/batchConfigPrice", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "批量配置价格") + public ResponseData batchConfigPrice(@RequestBody JSONObject body) { + try { + if (body.getInteger("belongType") == null + || body.getInteger("oilNo") == null + || body.getBigDecimal("priceRate") == null + || body.getJSONArray("oilStationList") == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + String oilNoName = commonService.getDictionaryCodeName("GAS_OIL_TYPE", body.getInteger("oilNo").toString()); + if (StringUtils.isBlank(oilNoName)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油品"); + } + + for (Object obj : body.getJSONArray("oilStationList")) { + JSONObject oilStation = (JSONObject)JSONObject.toJSON(obj); + if (oilStation.getLong("oilStationId") == null || StringUtils.isBlank(oilStation.getString("oilStationName"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + // 查询油站 + HighTyAgentPrice agentOilStation = tyAgentPriceService.getDetail(body.getInteger("belongType"), oilStation.getLong("oilStationId"), body.getString("oilNo")); + if (agentOilStation == null) { + agentOilStation = new HighTyAgentPrice(); + agentOilStation.setBelongType(body.getInteger("belongType")); + agentOilStation.setOilStationId(oilStation.getLong("oilStationId")); + agentOilStation.setOilStationName(oilStation.getString("oilStationName")); + agentOilStation.setTyAgentOilStationId(oilStation.getLong("tyAgentOilStationId")); + agentOilStation.setOilNoName(oilNoName); + agentOilStation.setOilNo(body.getString("oilNo")); + agentOilStation.setPriceRate(body.getBigDecimal("priceRate")); + } else { + agentOilStation.setPriceRate(body.getBigDecimal("priceRate")); + } + tyAgentPriceService.editTyAgentPrice(agentOilStation); + } + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighTyAgentPriceController --> editPrice() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/batchConfigOilNo", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "批量油品管理") + public ResponseData batchConfigOilNo(@RequestBody JSONObject body) { + try { + if (body.getInteger("oilNo") == null + || body.getInteger("status") == null + || body.getJSONArray("oilStationList") == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + String oilNoName = commonService.getDictionaryCodeName("GAS_OIL_TYPE", body.getInteger("oilNo").toString()); + if (StringUtils.isBlank(oilNoName)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油品"); + } + for (Object obj : body.getJSONArray("oilStationList")) { + JSONObject oilStation = (JSONObject)JSONObject.toJSON(obj); + if (oilStation.getLong("oilStationId") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + HighGasOilPrice oilNo = gasOilPriceService.getGasOilPriceByStoreAndOilNo(oilStation.getLong("oilStationId"), body.getInteger("oilNo")); + if (oilNo != null) { + oilNo.setStatus(body.getInteger("status")); + gasOilPriceService.editGasOilPrice(oilNo); + } + } + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighTyAgentPriceController --> batchConfigOilNo() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getOilStationPrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油站价格") @@ -104,11 +192,6 @@ public class HighTyAgentPriceController { @RequestParam(name = "oilStationId", required = true) Long oilStationId) { try { - HighTyAgentOilStation station = tyAgentOilStationService.getDetailByOilStationId(oilStationId); - if (station == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油站未分配,无法查看"); - } - List oilPriceList = gasOilPriceService.getGasOilPriceByStore(oilStationId); if (oilPriceList == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此加油站,暂无法配置"); @@ -118,18 +201,24 @@ public class HighTyAgentPriceController { for (HighGasOilPrice price : oilPriceList) { oilPriceMap = new HashMap<>(); - oilPriceMap.put("tyAgentOilStationId", station.getId()); - oilPriceMap.put("oilStationId", price.getMerchantStoreId()); oilPriceMap.put("oilNo", price.getOilNo()); oilPriceMap.put("oilNoName", price.getOilNoName()); oilPriceMap.put("status", price.getStatus()); oilPriceMap.put("lowPrice", commonService.getDictionaryCodeName("TY_AGENT_OIL_STATION_LOW_PRICE", price.getOilNo().toString())); // 价格 - HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(belongType, station.getId(), price.getOilNo().toString()); + HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(belongType, oilStationId, price.getOilNo().toString()); if (priceRate == null) { + // 油站 + HighMerchantStore store = merchantStoreService.getDetailById(price.getMerchantStoreId()); + if (store != null) { + oilPriceMap.put("oilStationId", store.getId()); + oilPriceMap.put("oilStationName", store.getStoreName()); + } oilPriceMap.put("priceRate", gasDiscountOilPriceService.getDetailByOilNo(price.getOilNo().toString()).getPriceRate()); } else { + oilPriceMap.put("oilStationId", priceRate.getOilStationId()); + oilPriceMap.put("oilStationName", priceRate.getOilStationName()); oilPriceMap.put("priceRate", priceRate.getPriceRate()); } oilPriceMapList.add(oilPriceMap); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 8e7c0339..4a89815b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -14,6 +14,7 @@ import com.hai.config.CommonSysConst; import com.hai.config.TuanYouConfig; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; +import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.enum_type.OrderPushType; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; @@ -100,26 +101,33 @@ public class HighGasController { PageInfo> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); for (Map map : mapPageInfo.getList()) { if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { - // 查询是否配置了优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); - if (gasDiscountOilPrice != null) { + + // 查询是否配置了【油站的】优惠比例 + HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); + if (tyAgentPrice != null) { // 优惠比例 / 100 = 最终优惠比例 - BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); // 油品国标价 * 最终优惠比例 map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + } else { + // 查询是否配置了【油品】优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); + if (gasDiscountOilPrice != null) { + // 优惠比例 / 100 = 最终优惠比例 + BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + // 油品国标价 * 最终优惠比例 + map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + } } + // 查询是否配置了【代理商】优惠比例 if (isTyAgent != null && isTyAgent == true) { - // 查询是否配置了优惠比例 - HighTyAgentOilStation tyAgentOilStation = tyAgentOilStationService.getDetailByOilStationId(MapUtils.getLong(map, "id")); - if (tyAgentOilStation != null) { - HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(2,tyAgentOilStation.getId(), MapUtils.getString(map, "oil_no")); - if (tyAgentPrice != null) { - // 优惠比例 / 100 = 最终优惠比例 - BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); - // 油品国标价 * 最终优惠比例 - map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); - } + HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); + if (agentPrice != null) { + // 优惠比例 / 100 = 最终优惠比例 + BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + // 油品国标价 * 最终优惠比例 + map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); } } } @@ -142,20 +150,26 @@ public class HighGasController { @RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) { try { BigDecimal discount = new BigDecimal("1"); + // 查询是否配置了【油站的】优惠比例 + HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, goodsId, oilNo); + if (tyAgentPrice != null) { + discount = tyAgentPrice.getPriceRate(); + } else { + // 查询是否配置了【油品】优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(oilNo); + if (gasDiscountOilPrice != null) { + discount = gasDiscountOilPrice.getPriceRate(); + } + } + if (isTyAgent != null && isTyAgent.equals(true)) { - // 查询加油站 - HighTyAgentOilStation oilStation = tyAgentOilStationService.getDetailByOilStationId(goodsId); - if (oilStation != null) { - // 价格 - HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(1, oilStation.getId(), oilNo); - if (priceRate == null) { - discount = gasDiscountOilPriceService.getDetailByOilNo(oilNo).getPriceRate(); - } else { - discount = priceRate.getPriceRate(); - } + // 价格 + HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(2, goodsId, oilNo); + if (priceRate == null) { + discount = gasDiscountOilPriceService.getDetailByOilNo(oilNo).getPriceRate(); + } else { + discount = priceRate.getPriceRate(); } - } else { - discount = gasDiscountOilPriceService.getDetailByOilNo(oilNo).getPriceRate(); } return ResponseMsgUtil.success(price.multiply(discount.divide(new BigDecimal("100"))).setScale(2,BigDecimal.ROUND_HALF_UP)); } catch (Exception e) { @@ -192,32 +206,42 @@ public class HighGasController { // 处理油品价格 for (Object oilPriceObject : originalOilPriceList) { JSONObject price = JSON.parseObject(JSONObject.toJSONString(oilPriceObject), JSONObject.class); - // 查询是否配置了优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); - if (gasDiscountOilPrice != null) { + + // 查询油站油品状态 + HighGasOilPrice oilNo = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), price.getInteger("oilNo")); + if (oilNo != null && !oilNo.getStatus().equals(GasOilPriceStatusEnum.status1.getStatus())) { + continue; + } + + // 查询是否配置了【油站的】优惠比例 + HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), price.getString("oilNo")); + if (tyAgentPrice != null) { // 优惠比例 / 100 = 最终优惠比例 - BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); // 油品国标价 * 最终优惠比例 price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + } else { + // 查询是否配置了【油品】优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); + if (gasDiscountOilPrice != null) { + // 优惠比例 / 100 = 最终优惠比例 + BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + // 油品国标价 * 最终优惠比例 + price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); + } } + // 查询是否配置了【代理商油站】优惠比例 if (isTyAgent != null && isTyAgent == true) { - // 查询是否配置了优惠比例 - HighTyAgentOilStation tyAgentOilStation = tyAgentOilStationService.getDetailByOilStationId(store.getId()); - if (tyAgentOilStation != null) { - HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, tyAgentOilStation.getId(), price.getString("oilNo")); - if (tyAgentPrice != null) { - // 优惠比例 / 100 = 最终优惠比例 - BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); - // 油品国标价 * 最终优惠比例 - price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); - } + HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, store.getId(), price.getString("oilNo")); + if (agentPrice != null) { + // 优惠比例 / 100 = 最终优惠比例 + BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); + // 油品国标价 * 最终优惠比例 + price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); } } - // 过滤油品,只保留汽油 - if (price.getInteger("oilType") == 1) { - newOilPriceList.add(price); - } + newOilPriceList.add(price); } result.put("oilPriceList", newOilPriceList); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index 507ca929..2d5b980d 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -234,27 +234,26 @@ public class HighOrderController { highOrder.setPayType(2); // 第三方平台 BigDecimal discount = new BigDecimal("1"); - if (highOrder.getIsTyAgent() != null && highOrder.getIsTyAgent() == true) { - // 查询加油站 - HighTyAgentOilStation oilStation = tyAgentOilStationService.getDetailByOilStationId(childOrder.getGoodsId()); - if (oilStation != null) { - childOrder.setGasSalesmanId(oilStation.getTySalesmanId()); - childOrder.setGasSalesmanName(oilStation.getTySalesmanName()); - childOrder.setGasAgentId(oilStation.getTyAgentId()); - childOrder.setGasAgentName(oilStation.getTyAgentName()); - childOrder.setGasOrgId(oilStation.getOrganizationId()); - childOrder.setGasOrgName(oilStation.getOrganizationName()); - - // 价格 - HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(1, oilStation.getId(), childOrder.getGasOilNo()); - if (priceRate == null) { - discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); - } else { - discount = priceRate.getPriceRate(); - } - } + // 查询是否配置了【油站的】优惠比例 + HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, childOrder.getGoodsId(), childOrder.getGasOilNo()); + if (tyAgentPrice != null) { + discount = tyAgentPrice.getPriceRate(); } else { - discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); + // 查询是否配置了【油品】优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()); + if (gasDiscountOilPrice != null) { + discount = gasDiscountOilPrice.getPriceRate(); + } + } + + if (highOrder.getIsTyAgent() != null && highOrder.getIsTyAgent().equals(true)) { + // 价格 + HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(2, childOrder.getGoodsId(), childOrder.getGasOilNo()); + if (priceRate == null) { + discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); + } else { + discount = priceRate.getPriceRate(); + } } // 获取当前加油价格 diff --git a/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceMapper.java b/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceMapper.java index 25285ba3..cd7531a6 100644 --- a/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceMapper.java @@ -39,12 +39,14 @@ public interface HighTyAgentPriceMapper extends HighTyAgentPriceMapperExt { int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_ty_agent_price (belong_type, ty_agent_oil_station_id, ", + "insert into high_ty_agent_price (belong_type, oil_station_id, ", + "oil_station_name, ty_agent_oil_station_id, ", "oil_no_name, oil_no, ", "price_rate, `status`, ", "create_time, update_time, ", "ext_1, ext_2, ext_3)", - "values (#{belongType,jdbcType=INTEGER}, #{tyAgentOilStationId,jdbcType=BIGINT}, ", + "values (#{belongType,jdbcType=INTEGER}, #{oilStationId,jdbcType=BIGINT}, ", + "#{oilStationName,jdbcType=VARCHAR}, #{tyAgentOilStationId,jdbcType=BIGINT}, ", "#{oilNoName,jdbcType=VARCHAR}, #{oilNo,jdbcType=VARCHAR}, ", "#{priceRate,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", @@ -61,6 +63,8 @@ public interface HighTyAgentPriceMapper extends HighTyAgentPriceMapperExt { @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="belong_type", property="belongType", jdbcType=JdbcType.INTEGER), + @Result(column="oil_station_id", property="oilStationId", jdbcType=JdbcType.BIGINT), + @Result(column="oil_station_name", property="oilStationName", jdbcType=JdbcType.VARCHAR), @Result(column="ty_agent_oil_station_id", property="tyAgentOilStationId", jdbcType=JdbcType.BIGINT), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR), @@ -76,14 +80,17 @@ public interface HighTyAgentPriceMapper extends HighTyAgentPriceMapperExt { @Select({ "select", - "id, belong_type, ty_agent_oil_station_id, oil_no_name, oil_no, price_rate, `status`, ", - "create_time, update_time, ext_1, ext_2, ext_3", + "id, belong_type, oil_station_id, oil_station_name, ty_agent_oil_station_id, ", + "oil_no_name, oil_no, price_rate, `status`, create_time, update_time, ext_1, ", + "ext_2, ext_3", "from high_ty_agent_price", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="belong_type", property="belongType", jdbcType=JdbcType.INTEGER), + @Result(column="oil_station_id", property="oilStationId", jdbcType=JdbcType.BIGINT), + @Result(column="oil_station_name", property="oilStationName", jdbcType=JdbcType.VARCHAR), @Result(column="ty_agent_oil_station_id", property="tyAgentOilStationId", jdbcType=JdbcType.BIGINT), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR), @@ -109,6 +116,8 @@ public interface HighTyAgentPriceMapper extends HighTyAgentPriceMapperExt { @Update({ "update high_ty_agent_price", "set belong_type = #{belongType,jdbcType=INTEGER},", + "oil_station_id = #{oilStationId,jdbcType=BIGINT},", + "oil_station_name = #{oilStationName,jdbcType=VARCHAR},", "ty_agent_oil_station_id = #{tyAgentOilStationId,jdbcType=BIGINT},", "oil_no_name = #{oilNoName,jdbcType=VARCHAR},", "oil_no = #{oilNo,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceSqlProvider.java index 266b2c93..82245e6b 100644 --- a/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighTyAgentPriceSqlProvider.java @@ -32,6 +32,14 @@ public class HighTyAgentPriceSqlProvider { sql.VALUES("belong_type", "#{belongType,jdbcType=INTEGER}"); } + if (record.getOilStationId() != null) { + sql.VALUES("oil_station_id", "#{oilStationId,jdbcType=BIGINT}"); + } + + if (record.getOilStationName() != null) { + sql.VALUES("oil_station_name", "#{oilStationName,jdbcType=VARCHAR}"); + } + if (record.getTyAgentOilStationId() != null) { sql.VALUES("ty_agent_oil_station_id", "#{tyAgentOilStationId,jdbcType=BIGINT}"); } @@ -83,6 +91,8 @@ public class HighTyAgentPriceSqlProvider { sql.SELECT("id"); } sql.SELECT("belong_type"); + sql.SELECT("oil_station_id"); + sql.SELECT("oil_station_name"); sql.SELECT("ty_agent_oil_station_id"); sql.SELECT("oil_no_name"); sql.SELECT("oil_no"); @@ -118,6 +128,14 @@ public class HighTyAgentPriceSqlProvider { sql.SET("belong_type = #{record.belongType,jdbcType=INTEGER}"); } + if (record.getOilStationId() != null) { + sql.SET("oil_station_id = #{record.oilStationId,jdbcType=BIGINT}"); + } + + if (record.getOilStationName() != null) { + sql.SET("oil_station_name = #{record.oilStationName,jdbcType=VARCHAR}"); + } + if (record.getTyAgentOilStationId() != null) { sql.SET("ty_agent_oil_station_id = #{record.tyAgentOilStationId,jdbcType=BIGINT}"); } @@ -168,6 +186,8 @@ public class HighTyAgentPriceSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("belong_type = #{record.belongType,jdbcType=INTEGER}"); + sql.SET("oil_station_id = #{record.oilStationId,jdbcType=BIGINT}"); + sql.SET("oil_station_name = #{record.oilStationName,jdbcType=VARCHAR}"); sql.SET("ty_agent_oil_station_id = #{record.tyAgentOilStationId,jdbcType=BIGINT}"); sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}"); @@ -192,6 +212,14 @@ public class HighTyAgentPriceSqlProvider { sql.SET("belong_type = #{belongType,jdbcType=INTEGER}"); } + if (record.getOilStationId() != null) { + sql.SET("oil_station_id = #{oilStationId,jdbcType=BIGINT}"); + } + + if (record.getOilStationName() != null) { + sql.SET("oil_station_name = #{oilStationName,jdbcType=VARCHAR}"); + } + if (record.getTyAgentOilStationId() != null) { sql.SET("ty_agent_oil_station_id = #{tyAgentOilStationId,jdbcType=BIGINT}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighTyAgentPrice.java b/hai-service/src/main/java/com/hai/entity/HighTyAgentPrice.java index 7335748f..1d603a5c 100644 --- a/hai-service/src/main/java/com/hai/entity/HighTyAgentPrice.java +++ b/hai-service/src/main/java/com/hai/entity/HighTyAgentPrice.java @@ -21,6 +21,16 @@ public class HighTyAgentPrice implements Serializable { */ private Integer belongType; + /** + * 加油站id + */ + private Long oilStationId; + + /** + * 加油站名称 + */ + private String oilStationName; + /** * 代理油站id */ @@ -80,6 +90,22 @@ public class HighTyAgentPrice implements Serializable { this.belongType = belongType; } + public Long getOilStationId() { + return oilStationId; + } + + public void setOilStationId(Long oilStationId) { + this.oilStationId = oilStationId; + } + + public String getOilStationName() { + return oilStationName; + } + + public void setOilStationName(String oilStationName) { + this.oilStationName = oilStationName; + } + public Long getTyAgentOilStationId() { return tyAgentOilStationId; } @@ -174,6 +200,8 @@ public class HighTyAgentPrice implements Serializable { HighTyAgentPrice other = (HighTyAgentPrice) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getBelongType() == null ? other.getBelongType() == null : this.getBelongType().equals(other.getBelongType())) + && (this.getOilStationId() == null ? other.getOilStationId() == null : this.getOilStationId().equals(other.getOilStationId())) + && (this.getOilStationName() == null ? other.getOilStationName() == null : this.getOilStationName().equals(other.getOilStationName())) && (this.getTyAgentOilStationId() == null ? other.getTyAgentOilStationId() == null : this.getTyAgentOilStationId().equals(other.getTyAgentOilStationId())) && (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName())) && (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo())) @@ -192,6 +220,8 @@ public class HighTyAgentPrice implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getBelongType() == null) ? 0 : getBelongType().hashCode()); + result = prime * result + ((getOilStationId() == null) ? 0 : getOilStationId().hashCode()); + result = prime * result + ((getOilStationName() == null) ? 0 : getOilStationName().hashCode()); result = prime * result + ((getTyAgentOilStationId() == null) ? 0 : getTyAgentOilStationId().hashCode()); result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode()); result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode()); @@ -213,6 +243,8 @@ public class HighTyAgentPrice implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", belongType=").append(belongType); + sb.append(", oilStationId=").append(oilStationId); + sb.append(", oilStationName=").append(oilStationName); sb.append(", tyAgentOilStationId=").append(tyAgentOilStationId); sb.append(", oilNoName=").append(oilNoName); sb.append(", oilNo=").append(oilNo); diff --git a/hai-service/src/main/java/com/hai/entity/HighTyAgentPriceExample.java b/hai-service/src/main/java/com/hai/entity/HighTyAgentPriceExample.java index a1e1b167..31d48efe 100644 --- a/hai-service/src/main/java/com/hai/entity/HighTyAgentPriceExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighTyAgentPriceExample.java @@ -246,6 +246,136 @@ public class HighTyAgentPriceExample { return (Criteria) this; } + public Criteria andOilStationIdIsNull() { + addCriterion("oil_station_id is null"); + return (Criteria) this; + } + + public Criteria andOilStationIdIsNotNull() { + addCriterion("oil_station_id is not null"); + return (Criteria) this; + } + + public Criteria andOilStationIdEqualTo(Long value) { + addCriterion("oil_station_id =", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdNotEqualTo(Long value) { + addCriterion("oil_station_id <>", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdGreaterThan(Long value) { + addCriterion("oil_station_id >", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdGreaterThanOrEqualTo(Long value) { + addCriterion("oil_station_id >=", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdLessThan(Long value) { + addCriterion("oil_station_id <", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdLessThanOrEqualTo(Long value) { + addCriterion("oil_station_id <=", value, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdIn(List values) { + addCriterion("oil_station_id in", values, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdNotIn(List values) { + addCriterion("oil_station_id not in", values, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdBetween(Long value1, Long value2) { + addCriterion("oil_station_id between", value1, value2, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationIdNotBetween(Long value1, Long value2) { + addCriterion("oil_station_id not between", value1, value2, "oilStationId"); + return (Criteria) this; + } + + public Criteria andOilStationNameIsNull() { + addCriterion("oil_station_name is null"); + return (Criteria) this; + } + + public Criteria andOilStationNameIsNotNull() { + addCriterion("oil_station_name is not null"); + return (Criteria) this; + } + + public Criteria andOilStationNameEqualTo(String value) { + addCriterion("oil_station_name =", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameNotEqualTo(String value) { + addCriterion("oil_station_name <>", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameGreaterThan(String value) { + addCriterion("oil_station_name >", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameGreaterThanOrEqualTo(String value) { + addCriterion("oil_station_name >=", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameLessThan(String value) { + addCriterion("oil_station_name <", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameLessThanOrEqualTo(String value) { + addCriterion("oil_station_name <=", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameLike(String value) { + addCriterion("oil_station_name like", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameNotLike(String value) { + addCriterion("oil_station_name not like", value, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameIn(List values) { + addCriterion("oil_station_name in", values, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameNotIn(List values) { + addCriterion("oil_station_name not in", values, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameBetween(String value1, String value2) { + addCriterion("oil_station_name between", value1, value2, "oilStationName"); + return (Criteria) this; + } + + public Criteria andOilStationNameNotBetween(String value1, String value2) { + addCriterion("oil_station_name not between", value1, value2, "oilStationName"); + return (Criteria) this; + } + public Criteria andTyAgentOilStationIdIsNull() { addCriterion("ty_agent_oil_station_id is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighTyAgentPriceService.java b/hai-service/src/main/java/com/hai/service/HighTyAgentPriceService.java index 840ee274..2a564d53 100644 --- a/hai-service/src/main/java/com/hai/service/HighTyAgentPriceService.java +++ b/hai-service/src/main/java/com/hai/service/HighTyAgentPriceService.java @@ -2,6 +2,8 @@ package com.hai.service; import com.hai.entity.HighTyAgentPrice; +import java.util.List; + /** * 加油价格 * @author hurui @@ -17,10 +19,18 @@ public interface HighTyAgentPriceService { /** * 根据代理油站id 查询详情 * @param belongType - * @param tyAgentOilStationId + * @param oilStationId * @param oilNo * @return */ - HighTyAgentPrice getDetail(Integer belongType, Long tyAgentOilStationId, String oilNo); + HighTyAgentPrice getDetail(Integer belongType, Long oilStationId, String oilNo); + + /** + * 查询油站价格 + * @param belongType + * @param oilStationId + * @return + */ + List getPriceList(Integer belongType, Long oilStationId); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighTyAgentPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighTyAgentPriceServiceImpl.java index 34275f6d..949f7ff2 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighTyAgentPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighTyAgentPriceServiceImpl.java @@ -30,12 +30,12 @@ public class HighTyAgentPriceServiceImpl implements HighTyAgentPriceService { } @Override - public HighTyAgentPrice getDetail(Integer belongType, Long tyAgentOilStationId, String oilNo) { + public HighTyAgentPrice getDetail(Integer belongType, Long oilStationId, String oilNo) { HighTyAgentPriceExample example = new HighTyAgentPriceExample(); example.createCriteria() .andBelongTypeEqualTo(belongType) .andStatusEqualTo(1) - .andTyAgentOilStationIdEqualTo(tyAgentOilStationId) + .andOilStationIdEqualTo(oilStationId) .andOilNoEqualTo(oilNo); List list = tyAgentPriceMapper.selectByExample(example); if (list.size() > 0) { @@ -43,4 +43,14 @@ public class HighTyAgentPriceServiceImpl implements HighTyAgentPriceService { } return null; } + + @Override + public List getPriceList(Integer belongType, Long oilStationId) { + HighTyAgentPriceExample example = new HighTyAgentPriceExample(); + example.createCriteria() + .andBelongTypeEqualTo(belongType) + .andOilStationIdEqualTo(oilStationId) + .andStatusEqualTo(1); + return tyAgentPriceMapper.selectByExample(example); + } }