From ec607f9a74d528dd06c3c892505f040f420c4646 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 26 Jul 2021 21:43:14 +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 --- .../HighGasDiscountOilPriceController.java | 14 ++-- .../cweb/controller/HighGasController.java | 71 +++++++++---------- .../cweb/controller/HighOrderController.java | 21 +++++- .../dao/HighGasDiscountOilPriceMapper.java | 20 ++++-- .../HighGasDiscountOilPriceSqlProvider.java | 14 ++++ .../hai/entity/HighGasDiscountOilPrice.java | 18 ++++- .../HighGasDiscountOilPriceExample.java | 70 ++++++++++++++++++ .../HighGasDiscountOilPriceService.java | 9 ++- .../HighGasDiscountOilPriceServiceImpl.java | 15 ++++ 9 files changed, 196 insertions(+), 56 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighGasDiscountOilPriceController.java b/hai-bweb/src/main/java/com/bweb/controller/HighGasDiscountOilPriceController.java index 0e08c057..42f01175 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighGasDiscountOilPriceController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighGasDiscountOilPriceController.java @@ -43,21 +43,23 @@ public class HighGasDiscountOilPriceController { @ApiOperation(value = "编辑油品价格") public ResponseData editGasDiscountOilPrice(@RequestBody JSONObject body) { try { - if (StringUtils.isBlank(body.getString("oilNoName")) || body.getBigDecimal("priceRate") == null) { + if (StringUtils.isBlank(body.getString("oilNo")) || body.getBigDecimal("priceRate") == null) { log.error("HighGasDiscountOilPriceController -> editGasDiscountOilPrice() error!",""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - if (StringUtils.isBlank(commonService.getDictionaryCodeName("GAS_OIL_TYPE", body.getString("oilNoName")))) { + String oilNoName = commonService.getDictionaryCodeName("GAS_OIL_TYPE", body.getString("oilNo")); + if (StringUtils.isBlank(oilNoName)) { log.error("HighGasDiscountOilPriceController -> editGasDiscountOilPrice() error!",""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未在系统中找到此油品"); } HighGasDiscountOilPrice detail; - detail = highGasDiscountOilPriceService.getDetailByOilNoName(body.getString("oilNoName")); + detail = highGasDiscountOilPriceService.getDetailByOilNoName(body.getString("oilNo")); if (detail == null) { detail = new HighGasDiscountOilPrice(); - detail.setOilNoName(body.getString("oilNoName")); + detail.setOilNo(body.getString("oilNo")); + detail.setOilNoName(oilNoName); detail.setPriceRate(body.getBigDecimal("priceRate")); detail.setCreateTime(new Date()); detail.setUpdateTime(new Date()); @@ -133,12 +135,14 @@ public class HighGasDiscountOilPriceController { @RequestMapping(value="/getList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") - public ResponseData getList(@RequestParam(name = "oilNoName", required = false) String oilNoName, + public ResponseData getList(@RequestParam(name = "oilNo", required = false) String oilNo, + @RequestParam(name = "oilNoName", required = false) String oilNoName, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); + map.put("oilNo", oilNo); map.put("oilNoName", oilNoName); PageHelper.startPage(pageNum,pageSize); 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 ac3eb05e..fe7196c1 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -1,5 +1,7 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.hai.common.exception.ErrorCode; @@ -11,11 +13,13 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CommonSysConst; import com.hai.config.TuanYouConfig; import com.hai.dao.HighGasOrderPushMapper; +import com.hai.entity.HighGasDiscountOilPrice; import com.hai.entity.HighGasOrderPush; import com.hai.entity.HighOrder; import com.hai.entity.SecRegion; import com.hai.model.ResponseData; import com.hai.service.CommonService; +import com.hai.service.HighGasDiscountOilPriceService; import com.hai.service.HighGasOilPriceService; import com.hai.service.HighOrderService; import io.swagger.annotations.Api; @@ -47,6 +51,9 @@ public class HighGasController { @Resource private CommonService commonService; + @Resource + private HighGasDiscountOilPriceService highGasDiscountOilPriceService; + @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @@ -100,6 +107,27 @@ public class HighGasController { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); + + // 原始油品价格 + JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); + // 新油品价格 + JSONArray newOilPriceList = new JSONArray(); + + // 处理油品价格 + for (Object oilPriceObject : originalOilPriceList) { + JSONObject price = JSON.parseObject(JSONObject.toJSONString(oilPriceObject), JSONObject.class); + // 查询是否配置了优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNoName(price.getString("oilNoName")); + 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(1, BigDecimal.ROUND_DOWN)); + } + newOilPriceList.add(price); + } + result.put("oilPriceList", newOilPriceList); + double distance = CoordCommonUtil.getDistance(Double.valueOf(result.get("gasAddressLatitude").toString()), Double.valueOf(result.get("gasAddressLongitude").toString()), Double.valueOf(latitude), Double.valueOf(longitude)); result.put("distance", Math.round(distance/100d)/10d); return ResponseMsgUtil.success(jsonObject.get("result")); @@ -112,7 +140,7 @@ public class HighGasController { } } - @RequestMapping(value="/getGasPriceDetail",method = RequestMethod.GET) +/* @RequestMapping(value="/getGasPriceDetail",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店key和油号 查询油价") public ResponseData getGasPriceDetail(@RequestParam(name = "storeKey", required = true) String storeKey, @@ -124,7 +152,7 @@ public class HighGasController { if(jsonObject.getJSONArray("result").size() == 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); } - return ResponseMsgUtil.success(jsonObject.get("result")); + return ResponseMsgUtil.success(jsonObject); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到价格信息"); @@ -132,7 +160,7 @@ public class HighGasController { log.error("HighGasController -> getGasPriceDetail() error!",e); return ResponseMsgUtil.exception(e); } - } + }*/ @RequestMapping(value="/refuelingOrderRefund",method = RequestMethod.POST) @ResponseBody @@ -174,7 +202,7 @@ public class HighGasController { @RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "推送订单") + @ApiOperation(value = "手动推送订单") public ResponseData refuelingOrderPush() { try { @@ -221,39 +249,4 @@ public class HighGasController { } } - @RequestMapping(value="/queryThirdOrderDretail",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询订单信息") - public ResponseData queryThirdOrderDretail() { - try { - - - return ResponseMsgUtil.success(TuanYouConfig.queryThirdOrderDretail("1624611159129")); - //return ResponseMsgUtil.success(map); - - - } catch (Exception e) { - log.error("HighGasController -> queryThirdOrderDretail() error!",e); - return ResponseMsgUtil.exception(e); - } - } - - @RequestMapping(value="/test",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "测试") - public ResponseData test() { - try { - - String data = "{\"data\":\"ui2KbK5jpLtw7YaA52uSt1TzDpaE5OjeW5O6xg+saM4nN4aVnpoT1aTgJwQt/DuNSbs7LrX6q1B0cpW5T531ltYl1ERxyKXqZyMKBNWzDFuB5QSww22VGfypchGNm+oW\",\"timestamp\":1624611912047,\"companyCode\":\"208241666939552\"}"; - - JSONObject jsonObject = JSONObject.parseObject(data, JSONObject.class); - //return ResponseMsgUtil.success(AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(jsonObject.getString("data")), SysConst.getSysConfig().getTuanYouAppSecret())); - return ResponseMsgUtil.success(CommonSysConst.getSysConfig().getTuanYouUrl()); - - } catch (Exception e) { - log.error("HighGasController -> queryThirdOrderDretail() error!",e); - return ResponseMsgUtil.exception(e); - } - } - } 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 b0258408..7a8b4755 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -1,5 +1,7 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -187,6 +189,19 @@ public class HighOrderController { if(jsonObject.getJSONArray("result").size() == 0) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到加油价格"); } + /* // 处理油品价格 + for (Object oilPriceObject : originalOilPriceList) { + JSONObject price = JSON.parseObject(JSONObject.toJSONString(oilPriceObject), JSONObject.class); + // 查询是否配置了优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNoName(price.getString("oilNoName")); + 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(1, BigDecimal.ROUND_DOWN)); + } + newOilPriceList.add(price); + }*/ JSONObject priceDetail = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.getJSONArray("result").get(0)), JSONObject.class); childOrder.setGoodsName(store.getStoreName()); childOrder.setGoodsImg(store.getStoreLogo()); @@ -353,7 +368,7 @@ public class HighOrderController { @RequestMapping(value = "/cancelOrder", method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "取消订单") + @ApiOperation(value = "根据订单id 取消订单") public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) { try { @@ -369,8 +384,8 @@ public class HighOrderController { @RequestMapping(value = "/cancelOrderByOrderNo", method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "取消订单") - public ResponseData cancelOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { + @ApiOperation(value = "根据订单号 取消订单") + public ResponseData cancelOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); diff --git a/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceMapper.java b/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceMapper.java index 012381db..a3b2c531 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceMapper.java @@ -39,12 +39,14 @@ public interface HighGasDiscountOilPriceMapper extends HighGasDiscountOilPriceMa int deleteByPrimaryKey(Long id); @Insert({ - "insert into high_gas_discount_oil_price (oil_no_name, price_rate, ", - "create_time, update_time, ", - "ext_1, ext_2, ext_3)", - "values (#{oilNoName,jdbcType=VARCHAR}, #{priceRate,jdbcType=DECIMAL}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "insert into high_gas_discount_oil_price (oil_no_name, oil_no, ", + "price_rate, create_time, ", + "update_time, ext_1, ", + "ext_2, ext_3)", + "values (#{oilNoName,jdbcType=VARCHAR}, #{oilNo,jdbcType=VARCHAR}, ", + "#{priceRate,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighGasDiscountOilPrice record); @@ -57,6 +59,7 @@ public interface HighGasDiscountOilPriceMapper extends HighGasDiscountOilPriceMa @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), + @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR), @Result(column="price_rate", property="priceRate", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -68,13 +71,15 @@ public interface HighGasDiscountOilPriceMapper extends HighGasDiscountOilPriceMa @Select({ "select", - "id, oil_no_name, price_rate, create_time, update_time, ext_1, ext_2, ext_3", + "id, oil_no_name, oil_no, price_rate, create_time, update_time, ext_1, ext_2, ", + "ext_3", "from high_gas_discount_oil_price", "where id = #{id,jdbcType=BIGINT}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), + @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.VARCHAR), @Result(column="price_rate", property="priceRate", jdbcType=JdbcType.DECIMAL), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), @@ -96,6 +101,7 @@ public interface HighGasDiscountOilPriceMapper extends HighGasDiscountOilPriceMa @Update({ "update high_gas_discount_oil_price", "set oil_no_name = #{oilNoName,jdbcType=VARCHAR},", + "oil_no = #{oilNo,jdbcType=VARCHAR},", "price_rate = #{priceRate,jdbcType=DECIMAL},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "update_time = #{updateTime,jdbcType=TIMESTAMP},", diff --git a/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceSqlProvider.java index 4927d709..3b83cc00 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasDiscountOilPriceSqlProvider.java @@ -32,6 +32,10 @@ public class HighGasDiscountOilPriceSqlProvider { sql.VALUES("oil_no_name", "#{oilNoName,jdbcType=VARCHAR}"); } + if (record.getOilNo() != null) { + sql.VALUES("oil_no", "#{oilNo,jdbcType=VARCHAR}"); + } + if (record.getPriceRate() != null) { sql.VALUES("price_rate", "#{priceRate,jdbcType=DECIMAL}"); } @@ -67,6 +71,7 @@ public class HighGasDiscountOilPriceSqlProvider { sql.SELECT("id"); } sql.SELECT("oil_no_name"); + sql.SELECT("oil_no"); sql.SELECT("price_rate"); sql.SELECT("create_time"); sql.SELECT("update_time"); @@ -98,6 +103,10 @@ public class HighGasDiscountOilPriceSqlProvider { sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); } + if (record.getOilNo() != null) { + sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}"); + } + if (record.getPriceRate() != null) { sql.SET("price_rate = #{record.priceRate,jdbcType=DECIMAL}"); } @@ -132,6 +141,7 @@ public class HighGasDiscountOilPriceSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); + sql.SET("oil_no = #{record.oilNo,jdbcType=VARCHAR}"); sql.SET("price_rate = #{record.priceRate,jdbcType=DECIMAL}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); @@ -152,6 +162,10 @@ public class HighGasDiscountOilPriceSqlProvider { sql.SET("oil_no_name = #{oilNoName,jdbcType=VARCHAR}"); } + if (record.getOilNo() != null) { + sql.SET("oil_no = #{oilNo,jdbcType=VARCHAR}"); + } + if (record.getPriceRate() != null) { sql.SET("price_rate = #{priceRate,jdbcType=DECIMAL}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPrice.java b/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPrice.java index a312dc56..9b6916cc 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPrice.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPrice.java @@ -17,10 +17,15 @@ public class HighGasDiscountOilPrice implements Serializable { private Long id; /** - * 油品名称 + * 油号名称 */ private String oilNoName; + /** + * 油号 + */ + private String oilNo; + /** * 优惠比例 */ @@ -60,6 +65,14 @@ public class HighGasDiscountOilPrice implements Serializable { this.oilNoName = oilNoName; } + public String getOilNo() { + return oilNo; + } + + public void setOilNo(String oilNo) { + this.oilNo = oilNo; + } + public BigDecimal getPriceRate() { return priceRate; } @@ -122,6 +135,7 @@ public class HighGasDiscountOilPrice implements Serializable { HighGasDiscountOilPrice other = (HighGasDiscountOilPrice) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName())) + && (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo())) && (this.getPriceRate() == null ? other.getPriceRate() == null : this.getPriceRate().equals(other.getPriceRate())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) @@ -136,6 +150,7 @@ public class HighGasDiscountOilPrice implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode()); + result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode()); result = prime * result + ((getPriceRate() == null) ? 0 : getPriceRate().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); @@ -153,6 +168,7 @@ public class HighGasDiscountOilPrice implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", oilNoName=").append(oilNoName); + sb.append(", oilNo=").append(oilNo); sb.append(", priceRate=").append(priceRate); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPriceExample.java b/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPriceExample.java index 8556e98b..7cb87fc9 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPriceExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasDiscountOilPriceExample.java @@ -256,6 +256,76 @@ public class HighGasDiscountOilPriceExample { return (Criteria) this; } + public Criteria andOilNoIsNull() { + addCriterion("oil_no is null"); + return (Criteria) this; + } + + public Criteria andOilNoIsNotNull() { + addCriterion("oil_no is not null"); + return (Criteria) this; + } + + public Criteria andOilNoEqualTo(String value) { + addCriterion("oil_no =", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotEqualTo(String value) { + addCriterion("oil_no <>", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoGreaterThan(String value) { + addCriterion("oil_no >", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoGreaterThanOrEqualTo(String value) { + addCriterion("oil_no >=", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLessThan(String value) { + addCriterion("oil_no <", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLessThanOrEqualTo(String value) { + addCriterion("oil_no <=", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoLike(String value) { + addCriterion("oil_no like", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotLike(String value) { + addCriterion("oil_no not like", value, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoIn(List values) { + addCriterion("oil_no in", values, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotIn(List values) { + addCriterion("oil_no not in", values, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoBetween(String value1, String value2) { + addCriterion("oil_no between", value1, value2, "oilNo"); + return (Criteria) this; + } + + public Criteria andOilNoNotBetween(String value1, String value2) { + addCriterion("oil_no not between", value1, value2, "oilNo"); + return (Criteria) this; + } + public Criteria andPriceRateIsNull() { addCriterion("price_rate is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java b/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java index 0baaca7c..d6d1e851 100644 --- a/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java +++ b/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java @@ -26,7 +26,14 @@ public interface HighGasDiscountOilPriceService { HighGasDiscountOilPrice getDetail(Long id); /** - * 根据油品名称 查询 + * 根据油号 查询 + * @param oilNoName + * @return + */ + HighGasDiscountOilPrice getDetailByOilNo(String oilNo); + + /** + * 根据油号名称 查询 * @param oilNoName * @return */ diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java index 4df4237c..d61b90e8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java @@ -37,6 +37,17 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri return highGasDiscountOilPriceMapper.selectByPrimaryKey(id); } + @Override + public HighGasDiscountOilPrice getDetailByOilNo(String oilNo) { + HighGasDiscountOilPriceExample example = new HighGasDiscountOilPriceExample(); + example.createCriteria().andOilNoEqualTo(oilNo); + List list = highGasDiscountOilPriceMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public HighGasDiscountOilPrice getDetailByOilNoName(String oilNoName) { HighGasDiscountOilPriceExample example = new HighGasDiscountOilPriceExample(); @@ -53,6 +64,10 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri HighGasDiscountOilPriceExample example = new HighGasDiscountOilPriceExample(); HighGasDiscountOilPriceExample.Criteria criteria = example.createCriteria(); + if (StringUtils.isNotBlank(MapUtils.getString(map, "oilNo"))) { + criteria.andOilNoEqualTo(MapUtils.getString(map, "oilNo")); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "oilNoName"))) { criteria.andOilNoNameEqualTo(MapUtils.getString(map, "oilNoName")); }