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 1b72138d..aa88bb11 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; @@ -49,9 +50,6 @@ public class HighGasController { @Resource private CommonService commonService; - @Resource - private HighGasDiscountOilPriceService highGasDiscountOilPriceService; - @Resource private HighTyAgentOilStationService tyAgentOilStationService; @@ -101,7 +99,6 @@ 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"))) { - map.put("price_gun", MapUtils.getString(map, "price_vip")); // 查询是否配置了【油站的】优惠比例 HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); if (tyAgentPrice != null) { @@ -111,7 +108,7 @@ public class HighGasController { map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); } else { // 查询是否配置了【油品】优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); + HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); if (gasDiscountOilPrice != null) { // 优惠比例 / 100 = 最终优惠比例 BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); @@ -156,7 +153,7 @@ public class HighGasController { discount = tyAgentPrice.getPriceRate(); } else { // 查询是否配置了【油品】优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(oilNo); + HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilNo); if (gasDiscountOilPrice != null) { discount = gasDiscountOilPrice.getPriceRate(); } @@ -178,6 +175,23 @@ public class HighGasController { } } + @RequestMapping(value="/oilPriceDiscountCompute",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "油价优惠计算") + public ResponseData oilPriceDiscountCompute(@RequestParam(name = "price", required = true) BigDecimal price, + @RequestParam(name = "goodsId", required = true) Long goodsId, + @RequestParam(name = "oilNo", required = true) String oilNo, + @RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) { + try { + + return ResponseMsgUtil.success(gasDiscountOilPriceService.oilPriceDiscountCompute(price,goodsId,oilNo,isTyAgent)); + + } catch (Exception e) { + log.error("HighGasController -> oilPriceDiscountCompute() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getGasDetailByStoreKey",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店key 查询") @@ -212,8 +226,6 @@ public class HighGasController { if (oilNo != null && !oilNo.getStatus().equals(GasOilPriceStatusEnum.status1.getStatus())) { continue; } - price.put("priceGun", price.getString("priceVip")); - // 查询是否配置了【油站的】优惠比例 HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), price.getString("oilNo")); if (tyAgentPrice != null) { @@ -223,7 +235,7 @@ public class HighGasController { price.put("priceVip", price.getBigDecimal("priceGun").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); } else { // 查询是否配置了【油品】优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); + HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); if (gasDiscountOilPrice != null) { // 优惠比例 / 100 = 最终优惠比例 BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); 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 23d73086..469ba1e9 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -16,6 +16,7 @@ import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.TuanYouConfig; import com.hai.entity.*; import com.hai.enum_type.DiscountUseScope; +import com.hai.model.GasPayPriceModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; @@ -233,19 +234,6 @@ public class HighOrderController { } highOrder.setPayType(2); // 第三方平台 - BigDecimal discount = new BigDecimal("1"); - // 查询是否配置了【油站的】优惠比例 - HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, childOrder.getGoodsId(), childOrder.getGasOilNo()); - if (tyAgentPrice != null) { - discount = tyAgentPrice.getPriceRate(); - } else { - // 查询是否配置了【油品】优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()); - if (gasDiscountOilPrice != null) { - discount = gasDiscountOilPrice.getPriceRate(); - } - } - if (highOrder.getIsTyAgent() != null && highOrder.getIsTyAgent().equals(true)) { // 查询加油站 HighTyAgentOilStation oilStation = tyAgentOilStationService.getDetailByOilStationId(childOrder.getGoodsId()); @@ -257,38 +245,27 @@ public class HighOrderController { childOrder.setGasOrgId(oilStation.getOrganizationId()); childOrder.setGasOrgName(oilStation.getOrganizationName()); } - // 价格 - HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(2, childOrder.getGoodsId(), childOrder.getGasOilNo()); - if (priceRate == null) { - discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); - } else { - discount = priceRate.getPriceRate(); - } } - // 获取当前加油价格 - JSONObject jsonObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), childOrder.getGasOilNo()); - if (jsonObject == null || !jsonObject.getString("code").equals("200")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到加油价格"); - } - if(jsonObject.getJSONArray("result").size() == 0) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到加油价格"); - } - JSONObject priceDetail = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.getJSONArray("result").get(0)), JSONObject.class); + // 计算价格 + GasPayPriceModel priceModel = gasDiscountOilPriceService.oilPriceDiscountCompute(childOrder.getGoodsPrice(), childOrder.getGoodsId(), childOrder.getGasOilNo(), highOrder.getIsTyAgent()); + // 支付价格 + childOrder.setGoodsActualPrice(priceModel.getPayPrice()); + + // 油价信息 + childOrder.setGasPriceGun(priceModel.getPriceGun()); + childOrder.setGasPriceVip(priceModel.getPriceVip()); + childOrder.setGasPriceOfficial(priceModel.getPriceOfficial()); + childOrder.setGasPricePlatform(priceModel.getPricePlatform()); + childOrder.setExt1(priceModel.getPricePlatform().toString()); + childOrder.setGasOilLiters(priceModel.getOilLiters()); + childOrder.setGasDiscount(priceModel.getDiscount()); + childOrder.setGasOilSubsidy(priceModel.getOilSubsidy()); + childOrder.setGasLitersPreferences(priceModel.getLitersPreferences()); + childOrder.setGasPricePreferences(priceModel.getPricePreferences()); - childOrder.setGoodsName(store.getStoreName()); childOrder.setGoodsImg(store.getStoreLogo()); - - // 平台的价格 - childOrder.setExt1(childOrder.getGasPriceVip().toString()); - // childOrder.setGoodsActualPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP)); - childOrder.setGoodsActualPrice(childOrder.getGoodsPrice().multiply(discount.divide(new BigDecimal("100"))).setScale(2,BigDecimal.ROUND_HALF_UP)); - - // 团油的价格 - childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun")); - childOrder.setGasPriceVip(priceDetail.getBigDecimal("priceVip")); - // childOrder.setGoodsPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP)); - + childOrder.setGoodsName(store.getStoreName()); childOrder.setGoodsSpecName("默认"); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); } diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java index 8b235965..e29f8ce7 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java @@ -95,7 +95,6 @@ public class HighUserCommonController { } } - @RequestMapping(value = "/unionPhoneLogin", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "银联授权手机号登录接口") @@ -153,6 +152,23 @@ public class HighUserCommonController { } } + @RequestMapping(value = "/loginOut", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "退出登录") + public ResponseData loginOut(HttpServletRequest request, HttpServletResponse response) { + try { + // 用户信息 + HighUserModel sessionModel = userCenter.getSessionModel(HighUserModel.class); + if (sessionModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户信息"); + } + userCenter.remove(request, response); + return ResponseMsgUtil.success("退出成功"); + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java index 17a2db28..01b0ad14 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderMapper.java @@ -50,12 +50,16 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "child_orde_status, praise_status, ", "gas_oil_no, gas_gun_no, ", "gas_oil_type, gas_order_no, ", - "gas_price_gun, gas_price_vip, ", - "gas_salesman_id, gas_salesman_name, ", - "gas_agent_id, gas_agent_name, ", - "gas_org_id, gas_org_name, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "gas_price_platform, gas_price_gun, ", + "gas_price_vip, gas_price_official, ", + "gas_oil_liters, gas_discount, ", + "gas_oil_subsidy, gas_liters_preferences, ", + "gas_price_preferences, gas_salesman_id, ", + "gas_salesman_name, gas_agent_id, ", + "gas_agent_name, gas_org_id, ", + "gas_org_name, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{orderId,jdbcType=BIGINT}, #{memId,jdbcType=BIGINT}, ", "#{storeId,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ", "#{storeAddress,jdbcType=VARCHAR}, #{goodsType,jdbcType=INTEGER}, ", @@ -67,12 +71,16 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "#{childOrdeStatus,jdbcType=INTEGER}, #{praiseStatus,jdbcType=INTEGER}, ", "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ", "#{gasOilType,jdbcType=INTEGER}, #{gasOrderNo,jdbcType=VARCHAR}, ", - "#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ", - "#{gasSalesmanId,jdbcType=BIGINT}, #{gasSalesmanName,jdbcType=VARCHAR}, ", - "#{gasAgentId,jdbcType=BIGINT}, #{gasAgentName,jdbcType=VARCHAR}, ", - "#{gasOrgId,jdbcType=BIGINT}, #{gasOrgName,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{gasPricePlatform,jdbcType=DECIMAL}, #{gasPriceGun,jdbcType=DECIMAL}, ", + "#{gasPriceVip,jdbcType=DECIMAL}, #{gasPriceOfficial,jdbcType=DECIMAL}, ", + "#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ", + "#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ", + "#{gasPricePreferences,jdbcType=DECIMAL}, #{gasSalesmanId,jdbcType=BIGINT}, ", + "#{gasSalesmanName,jdbcType=VARCHAR}, #{gasAgentId,jdbcType=BIGINT}, ", + "#{gasAgentName,jdbcType=VARCHAR}, #{gasOrgId,jdbcType=BIGINT}, ", + "#{gasOrgName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", + "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighChildOrder record); @@ -106,8 +114,15 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER), @Result(column="gas_order_no", property="gasOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="gas_price_platform", property="gasPricePlatform", jdbcType=JdbcType.DECIMAL), @Result(column="gas_price_gun", property="gasPriceGun", jdbcType=JdbcType.DECIMAL), @Result(column="gas_price_vip", property="gasPriceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_price_official", property="gasPriceOfficial", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_oil_liters", property="gasOilLiters", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_discount", property="gasDiscount", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_oil_subsidy", property="gasOilSubsidy", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_liters_preferences", property="gasLitersPreferences", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_price_preferences", property="gasPricePreferences", jdbcType=JdbcType.DECIMAL), @Result(column="gas_salesman_id", property="gasSalesmanId", jdbcType=JdbcType.BIGINT), @Result(column="gas_salesman_name", property="gasSalesmanName", jdbcType=JdbcType.VARCHAR), @Result(column="gas_agent_id", property="gasAgentId", jdbcType=JdbcType.BIGINT), @@ -128,9 +143,10 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "id, order_id, mem_id, store_id, store_name, store_address, goods_type, goods_id, ", "goods_name, goods_desc, goods_img, goods_spec_name, goods_price, goods_actual_price, ", "sale_count, total_price, giveaway_type, child_orde_status, praise_status, gas_oil_no, ", - "gas_gun_no, gas_oil_type, gas_order_no, gas_price_gun, gas_price_vip, gas_salesman_id, ", - "gas_salesman_name, gas_agent_id, gas_agent_name, gas_org_id, gas_org_name, ext_1, ", - "ext_2, ext_3, ext_4, ext_5, ext_6", + "gas_gun_no, gas_oil_type, gas_order_no, gas_price_platform, gas_price_gun, gas_price_vip, ", + "gas_price_official, gas_oil_liters, gas_discount, gas_oil_subsidy, gas_liters_preferences, ", + "gas_price_preferences, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ", + "gas_org_id, gas_org_name, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_child_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -158,8 +174,15 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_oil_type", property="gasOilType", jdbcType=JdbcType.INTEGER), @Result(column="gas_order_no", property="gasOrderNo", jdbcType=JdbcType.VARCHAR), + @Result(column="gas_price_platform", property="gasPricePlatform", jdbcType=JdbcType.DECIMAL), @Result(column="gas_price_gun", property="gasPriceGun", jdbcType=JdbcType.DECIMAL), @Result(column="gas_price_vip", property="gasPriceVip", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_price_official", property="gasPriceOfficial", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_oil_liters", property="gasOilLiters", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_discount", property="gasDiscount", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_oil_subsidy", property="gasOilSubsidy", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_liters_preferences", property="gasLitersPreferences", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_price_preferences", property="gasPricePreferences", jdbcType=JdbcType.DECIMAL), @Result(column="gas_salesman_id", property="gasSalesmanId", jdbcType=JdbcType.BIGINT), @Result(column="gas_salesman_name", property="gasSalesmanName", jdbcType=JdbcType.VARCHAR), @Result(column="gas_agent_id", property="gasAgentId", jdbcType=JdbcType.BIGINT), @@ -208,8 +231,15 @@ public interface HighChildOrderMapper extends HighChildOrderMapperExt { "gas_gun_no = #{gasGunNo,jdbcType=VARCHAR},", "gas_oil_type = #{gasOilType,jdbcType=INTEGER},", "gas_order_no = #{gasOrderNo,jdbcType=VARCHAR},", + "gas_price_platform = #{gasPricePlatform,jdbcType=DECIMAL},", "gas_price_gun = #{gasPriceGun,jdbcType=DECIMAL},", "gas_price_vip = #{gasPriceVip,jdbcType=DECIMAL},", + "gas_price_official = #{gasPriceOfficial,jdbcType=DECIMAL},", + "gas_oil_liters = #{gasOilLiters,jdbcType=DECIMAL},", + "gas_discount = #{gasDiscount,jdbcType=DECIMAL},", + "gas_oil_subsidy = #{gasOilSubsidy,jdbcType=DECIMAL},", + "gas_liters_preferences = #{gasLitersPreferences,jdbcType=DECIMAL},", + "gas_price_preferences = #{gasPricePreferences,jdbcType=DECIMAL},", "gas_salesman_id = #{gasSalesmanId,jdbcType=BIGINT},", "gas_salesman_name = #{gasSalesmanName,jdbcType=VARCHAR},", "gas_agent_id = #{gasAgentId,jdbcType=BIGINT},", diff --git a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java index b488da98..bde7e53c 100644 --- a/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighChildOrderSqlProvider.java @@ -116,6 +116,10 @@ public class HighChildOrderSqlProvider { sql.VALUES("gas_order_no", "#{gasOrderNo,jdbcType=VARCHAR}"); } + if (record.getGasPricePlatform() != null) { + sql.VALUES("gas_price_platform", "#{gasPricePlatform,jdbcType=DECIMAL}"); + } + if (record.getGasPriceGun() != null) { sql.VALUES("gas_price_gun", "#{gasPriceGun,jdbcType=DECIMAL}"); } @@ -124,6 +128,30 @@ public class HighChildOrderSqlProvider { sql.VALUES("gas_price_vip", "#{gasPriceVip,jdbcType=DECIMAL}"); } + if (record.getGasPriceOfficial() != null) { + sql.VALUES("gas_price_official", "#{gasPriceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getGasOilLiters() != null) { + sql.VALUES("gas_oil_liters", "#{gasOilLiters,jdbcType=DECIMAL}"); + } + + if (record.getGasDiscount() != null) { + sql.VALUES("gas_discount", "#{gasDiscount,jdbcType=DECIMAL}"); + } + + if (record.getGasOilSubsidy() != null) { + sql.VALUES("gas_oil_subsidy", "#{gasOilSubsidy,jdbcType=DECIMAL}"); + } + + if (record.getGasLitersPreferences() != null) { + sql.VALUES("gas_liters_preferences", "#{gasLitersPreferences,jdbcType=DECIMAL}"); + } + + if (record.getGasPricePreferences() != null) { + sql.VALUES("gas_price_preferences", "#{gasPricePreferences,jdbcType=DECIMAL}"); + } + if (record.getGasSalesmanId() != null) { sql.VALUES("gas_salesman_id", "#{gasSalesmanId,jdbcType=BIGINT}"); } @@ -204,8 +232,15 @@ public class HighChildOrderSqlProvider { sql.SELECT("gas_gun_no"); sql.SELECT("gas_oil_type"); sql.SELECT("gas_order_no"); + sql.SELECT("gas_price_platform"); sql.SELECT("gas_price_gun"); sql.SELECT("gas_price_vip"); + sql.SELECT("gas_price_official"); + sql.SELECT("gas_oil_liters"); + sql.SELECT("gas_discount"); + sql.SELECT("gas_oil_subsidy"); + sql.SELECT("gas_liters_preferences"); + sql.SELECT("gas_price_preferences"); sql.SELECT("gas_salesman_id"); sql.SELECT("gas_salesman_name"); sql.SELECT("gas_agent_id"); @@ -327,6 +362,10 @@ public class HighChildOrderSqlProvider { sql.SET("gas_order_no = #{record.gasOrderNo,jdbcType=VARCHAR}"); } + if (record.getGasPricePlatform() != null) { + sql.SET("gas_price_platform = #{record.gasPricePlatform,jdbcType=DECIMAL}"); + } + if (record.getGasPriceGun() != null) { sql.SET("gas_price_gun = #{record.gasPriceGun,jdbcType=DECIMAL}"); } @@ -335,6 +374,30 @@ public class HighChildOrderSqlProvider { sql.SET("gas_price_vip = #{record.gasPriceVip,jdbcType=DECIMAL}"); } + if (record.getGasPriceOfficial() != null) { + sql.SET("gas_price_official = #{record.gasPriceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getGasOilLiters() != null) { + sql.SET("gas_oil_liters = #{record.gasOilLiters,jdbcType=DECIMAL}"); + } + + if (record.getGasDiscount() != null) { + sql.SET("gas_discount = #{record.gasDiscount,jdbcType=DECIMAL}"); + } + + if (record.getGasOilSubsidy() != null) { + sql.SET("gas_oil_subsidy = #{record.gasOilSubsidy,jdbcType=DECIMAL}"); + } + + if (record.getGasLitersPreferences() != null) { + sql.SET("gas_liters_preferences = #{record.gasLitersPreferences,jdbcType=DECIMAL}"); + } + + if (record.getGasPricePreferences() != null) { + sql.SET("gas_price_preferences = #{record.gasPricePreferences,jdbcType=DECIMAL}"); + } + if (record.getGasSalesmanId() != null) { sql.SET("gas_salesman_id = #{record.gasSalesmanId,jdbcType=BIGINT}"); } @@ -414,8 +477,15 @@ public class HighChildOrderSqlProvider { sql.SET("gas_gun_no = #{record.gasGunNo,jdbcType=VARCHAR}"); sql.SET("gas_oil_type = #{record.gasOilType,jdbcType=INTEGER}"); sql.SET("gas_order_no = #{record.gasOrderNo,jdbcType=VARCHAR}"); + sql.SET("gas_price_platform = #{record.gasPricePlatform,jdbcType=DECIMAL}"); sql.SET("gas_price_gun = #{record.gasPriceGun,jdbcType=DECIMAL}"); sql.SET("gas_price_vip = #{record.gasPriceVip,jdbcType=DECIMAL}"); + sql.SET("gas_price_official = #{record.gasPriceOfficial,jdbcType=DECIMAL}"); + sql.SET("gas_oil_liters = #{record.gasOilLiters,jdbcType=DECIMAL}"); + sql.SET("gas_discount = #{record.gasDiscount,jdbcType=DECIMAL}"); + sql.SET("gas_oil_subsidy = #{record.gasOilSubsidy,jdbcType=DECIMAL}"); + sql.SET("gas_liters_preferences = #{record.gasLitersPreferences,jdbcType=DECIMAL}"); + sql.SET("gas_price_preferences = #{record.gasPricePreferences,jdbcType=DECIMAL}"); sql.SET("gas_salesman_id = #{record.gasSalesmanId,jdbcType=BIGINT}"); sql.SET("gas_salesman_name = #{record.gasSalesmanName,jdbcType=VARCHAR}"); sql.SET("gas_agent_id = #{record.gasAgentId,jdbcType=BIGINT}"); @@ -526,6 +596,10 @@ public class HighChildOrderSqlProvider { sql.SET("gas_order_no = #{gasOrderNo,jdbcType=VARCHAR}"); } + if (record.getGasPricePlatform() != null) { + sql.SET("gas_price_platform = #{gasPricePlatform,jdbcType=DECIMAL}"); + } + if (record.getGasPriceGun() != null) { sql.SET("gas_price_gun = #{gasPriceGun,jdbcType=DECIMAL}"); } @@ -534,6 +608,30 @@ public class HighChildOrderSqlProvider { sql.SET("gas_price_vip = #{gasPriceVip,jdbcType=DECIMAL}"); } + if (record.getGasPriceOfficial() != null) { + sql.SET("gas_price_official = #{gasPriceOfficial,jdbcType=DECIMAL}"); + } + + if (record.getGasOilLiters() != null) { + sql.SET("gas_oil_liters = #{gasOilLiters,jdbcType=DECIMAL}"); + } + + if (record.getGasDiscount() != null) { + sql.SET("gas_discount = #{gasDiscount,jdbcType=DECIMAL}"); + } + + if (record.getGasOilSubsidy() != null) { + sql.SET("gas_oil_subsidy = #{gasOilSubsidy,jdbcType=DECIMAL}"); + } + + if (record.getGasLitersPreferences() != null) { + sql.SET("gas_liters_preferences = #{gasLitersPreferences,jdbcType=DECIMAL}"); + } + + if (record.getGasPricePreferences() != null) { + sql.SET("gas_price_preferences = #{gasPricePreferences,jdbcType=DECIMAL}"); + } + if (record.getGasSalesmanId() != null) { sql.SET("gas_salesman_id = #{gasSalesmanId,jdbcType=BIGINT}"); } diff --git a/hai-service/src/main/java/com/hai/entity/HighChildOrder.java b/hai-service/src/main/java/com/hai/entity/HighChildOrder.java index 3bbddb83..98f4b84f 100644 --- a/hai-service/src/main/java/com/hai/entity/HighChildOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighChildOrder.java @@ -128,6 +128,11 @@ public class HighChildOrder implements Serializable { */ private String gasOrderNo; + /** + * 【加油站】平台价 + */ + private BigDecimal gasPricePlatform; + /** * 【加油站】油枪价 */ @@ -138,6 +143,36 @@ public class HighChildOrder implements Serializable { */ private BigDecimal gasPriceVip; + /** + * 【加油站】国标价 + */ + private BigDecimal gasPriceOfficial; + + /** + * 【加油站】加油升数 + */ + private BigDecimal gasOilLiters; + + /** + * 【加油站】加油折扣 + */ + private BigDecimal gasDiscount; + + /** + * 【加油站】加油补贴 + */ + private BigDecimal gasOilSubsidy; + + /** + * 【加油站】每升优惠 + */ + private BigDecimal gasLitersPreferences; + + /** + * 【加油站】优惠价格 + */ + private BigDecimal gasPricePreferences; + /** * 【加油站】业务员id */ @@ -366,6 +401,14 @@ public class HighChildOrder implements Serializable { this.gasOrderNo = gasOrderNo; } + public BigDecimal getGasPricePlatform() { + return gasPricePlatform; + } + + public void setGasPricePlatform(BigDecimal gasPricePlatform) { + this.gasPricePlatform = gasPricePlatform; + } + public BigDecimal getGasPriceGun() { return gasPriceGun; } @@ -382,6 +425,54 @@ public class HighChildOrder implements Serializable { this.gasPriceVip = gasPriceVip; } + public BigDecimal getGasPriceOfficial() { + return gasPriceOfficial; + } + + public void setGasPriceOfficial(BigDecimal gasPriceOfficial) { + this.gasPriceOfficial = gasPriceOfficial; + } + + public BigDecimal getGasOilLiters() { + return gasOilLiters; + } + + public void setGasOilLiters(BigDecimal gasOilLiters) { + this.gasOilLiters = gasOilLiters; + } + + public BigDecimal getGasDiscount() { + return gasDiscount; + } + + public void setGasDiscount(BigDecimal gasDiscount) { + this.gasDiscount = gasDiscount; + } + + public BigDecimal getGasOilSubsidy() { + return gasOilSubsidy; + } + + public void setGasOilSubsidy(BigDecimal gasOilSubsidy) { + this.gasOilSubsidy = gasOilSubsidy; + } + + public BigDecimal getGasLitersPreferences() { + return gasLitersPreferences; + } + + public void setGasLitersPreferences(BigDecimal gasLitersPreferences) { + this.gasLitersPreferences = gasLitersPreferences; + } + + public BigDecimal getGasPricePreferences() { + return gasPricePreferences; + } + + public void setGasPricePreferences(BigDecimal gasPricePreferences) { + this.gasPricePreferences = gasPricePreferences; + } + public Long getGasSalesmanId() { return gasSalesmanId; } @@ -513,8 +604,15 @@ public class HighChildOrder implements Serializable { && (this.getGasGunNo() == null ? other.getGasGunNo() == null : this.getGasGunNo().equals(other.getGasGunNo())) && (this.getGasOilType() == null ? other.getGasOilType() == null : this.getGasOilType().equals(other.getGasOilType())) && (this.getGasOrderNo() == null ? other.getGasOrderNo() == null : this.getGasOrderNo().equals(other.getGasOrderNo())) + && (this.getGasPricePlatform() == null ? other.getGasPricePlatform() == null : this.getGasPricePlatform().equals(other.getGasPricePlatform())) && (this.getGasPriceGun() == null ? other.getGasPriceGun() == null : this.getGasPriceGun().equals(other.getGasPriceGun())) && (this.getGasPriceVip() == null ? other.getGasPriceVip() == null : this.getGasPriceVip().equals(other.getGasPriceVip())) + && (this.getGasPriceOfficial() == null ? other.getGasPriceOfficial() == null : this.getGasPriceOfficial().equals(other.getGasPriceOfficial())) + && (this.getGasOilLiters() == null ? other.getGasOilLiters() == null : this.getGasOilLiters().equals(other.getGasOilLiters())) + && (this.getGasDiscount() == null ? other.getGasDiscount() == null : this.getGasDiscount().equals(other.getGasDiscount())) + && (this.getGasOilSubsidy() == null ? other.getGasOilSubsidy() == null : this.getGasOilSubsidy().equals(other.getGasOilSubsidy())) + && (this.getGasLitersPreferences() == null ? other.getGasLitersPreferences() == null : this.getGasLitersPreferences().equals(other.getGasLitersPreferences())) + && (this.getGasPricePreferences() == null ? other.getGasPricePreferences() == null : this.getGasPricePreferences().equals(other.getGasPricePreferences())) && (this.getGasSalesmanId() == null ? other.getGasSalesmanId() == null : this.getGasSalesmanId().equals(other.getGasSalesmanId())) && (this.getGasSalesmanName() == null ? other.getGasSalesmanName() == null : this.getGasSalesmanName().equals(other.getGasSalesmanName())) && (this.getGasAgentId() == null ? other.getGasAgentId() == null : this.getGasAgentId().equals(other.getGasAgentId())) @@ -556,8 +654,15 @@ public class HighChildOrder implements Serializable { result = prime * result + ((getGasGunNo() == null) ? 0 : getGasGunNo().hashCode()); result = prime * result + ((getGasOilType() == null) ? 0 : getGasOilType().hashCode()); result = prime * result + ((getGasOrderNo() == null) ? 0 : getGasOrderNo().hashCode()); + result = prime * result + ((getGasPricePlatform() == null) ? 0 : getGasPricePlatform().hashCode()); result = prime * result + ((getGasPriceGun() == null) ? 0 : getGasPriceGun().hashCode()); result = prime * result + ((getGasPriceVip() == null) ? 0 : getGasPriceVip().hashCode()); + result = prime * result + ((getGasPriceOfficial() == null) ? 0 : getGasPriceOfficial().hashCode()); + result = prime * result + ((getGasOilLiters() == null) ? 0 : getGasOilLiters().hashCode()); + result = prime * result + ((getGasDiscount() == null) ? 0 : getGasDiscount().hashCode()); + result = prime * result + ((getGasOilSubsidy() == null) ? 0 : getGasOilSubsidy().hashCode()); + result = prime * result + ((getGasLitersPreferences() == null) ? 0 : getGasLitersPreferences().hashCode()); + result = prime * result + ((getGasPricePreferences() == null) ? 0 : getGasPricePreferences().hashCode()); result = prime * result + ((getGasSalesmanId() == null) ? 0 : getGasSalesmanId().hashCode()); result = prime * result + ((getGasSalesmanName() == null) ? 0 : getGasSalesmanName().hashCode()); result = prime * result + ((getGasAgentId() == null) ? 0 : getGasAgentId().hashCode()); @@ -602,8 +707,15 @@ public class HighChildOrder implements Serializable { sb.append(", gasGunNo=").append(gasGunNo); sb.append(", gasOilType=").append(gasOilType); sb.append(", gasOrderNo=").append(gasOrderNo); + sb.append(", gasPricePlatform=").append(gasPricePlatform); sb.append(", gasPriceGun=").append(gasPriceGun); sb.append(", gasPriceVip=").append(gasPriceVip); + sb.append(", gasPriceOfficial=").append(gasPriceOfficial); + sb.append(", gasOilLiters=").append(gasOilLiters); + sb.append(", gasDiscount=").append(gasDiscount); + sb.append(", gasOilSubsidy=").append(gasOilSubsidy); + sb.append(", gasLitersPreferences=").append(gasLitersPreferences); + sb.append(", gasPricePreferences=").append(gasPricePreferences); sb.append(", gasSalesmanId=").append(gasSalesmanId); sb.append(", gasSalesmanName=").append(gasSalesmanName); sb.append(", gasAgentId=").append(gasAgentId); diff --git a/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java index 2c04d290..219cf522 100644 --- a/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighChildOrderExample.java @@ -1595,6 +1595,66 @@ public class HighChildOrderExample { return (Criteria) this; } + public Criteria andGasPricePlatformIsNull() { + addCriterion("gas_price_platform is null"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformIsNotNull() { + addCriterion("gas_price_platform is not null"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformEqualTo(BigDecimal value) { + addCriterion("gas_price_platform =", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformNotEqualTo(BigDecimal value) { + addCriterion("gas_price_platform <>", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformGreaterThan(BigDecimal value) { + addCriterion("gas_price_platform >", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_platform >=", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformLessThan(BigDecimal value) { + addCriterion("gas_price_platform <", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_platform <=", value, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformIn(List values) { + addCriterion("gas_price_platform in", values, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformNotIn(List values) { + addCriterion("gas_price_platform not in", values, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_platform between", value1, value2, "gasPricePlatform"); + return (Criteria) this; + } + + public Criteria andGasPricePlatformNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_platform not between", value1, value2, "gasPricePlatform"); + return (Criteria) this; + } + public Criteria andGasPriceGunIsNull() { addCriterion("gas_price_gun is null"); return (Criteria) this; @@ -1715,6 +1775,366 @@ public class HighChildOrderExample { return (Criteria) this; } + public Criteria andGasPriceOfficialIsNull() { + addCriterion("gas_price_official is null"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialIsNotNull() { + addCriterion("gas_price_official is not null"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialEqualTo(BigDecimal value) { + addCriterion("gas_price_official =", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialNotEqualTo(BigDecimal value) { + addCriterion("gas_price_official <>", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialGreaterThan(BigDecimal value) { + addCriterion("gas_price_official >", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_official >=", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialLessThan(BigDecimal value) { + addCriterion("gas_price_official <", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_official <=", value, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialIn(List values) { + addCriterion("gas_price_official in", values, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialNotIn(List values) { + addCriterion("gas_price_official not in", values, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_official between", value1, value2, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasPriceOfficialNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_official not between", value1, value2, "gasPriceOfficial"); + return (Criteria) this; + } + + public Criteria andGasOilLitersIsNull() { + addCriterion("gas_oil_liters is null"); + return (Criteria) this; + } + + public Criteria andGasOilLitersIsNotNull() { + addCriterion("gas_oil_liters is not null"); + return (Criteria) this; + } + + public Criteria andGasOilLitersEqualTo(BigDecimal value) { + addCriterion("gas_oil_liters =", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersNotEqualTo(BigDecimal value) { + addCriterion("gas_oil_liters <>", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersGreaterThan(BigDecimal value) { + addCriterion("gas_oil_liters >", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_oil_liters >=", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersLessThan(BigDecimal value) { + addCriterion("gas_oil_liters <", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_oil_liters <=", value, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersIn(List values) { + addCriterion("gas_oil_liters in", values, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersNotIn(List values) { + addCriterion("gas_oil_liters not in", values, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_oil_liters between", value1, value2, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasOilLitersNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_oil_liters not between", value1, value2, "gasOilLiters"); + return (Criteria) this; + } + + public Criteria andGasDiscountIsNull() { + addCriterion("gas_discount is null"); + return (Criteria) this; + } + + public Criteria andGasDiscountIsNotNull() { + addCriterion("gas_discount is not null"); + return (Criteria) this; + } + + public Criteria andGasDiscountEqualTo(BigDecimal value) { + addCriterion("gas_discount =", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountNotEqualTo(BigDecimal value) { + addCriterion("gas_discount <>", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountGreaterThan(BigDecimal value) { + addCriterion("gas_discount >", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_discount >=", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountLessThan(BigDecimal value) { + addCriterion("gas_discount <", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_discount <=", value, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountIn(List values) { + addCriterion("gas_discount in", values, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountNotIn(List values) { + addCriterion("gas_discount not in", values, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_discount between", value1, value2, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasDiscountNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_discount not between", value1, value2, "gasDiscount"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyIsNull() { + addCriterion("gas_oil_subsidy is null"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyIsNotNull() { + addCriterion("gas_oil_subsidy is not null"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyEqualTo(BigDecimal value) { + addCriterion("gas_oil_subsidy =", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyNotEqualTo(BigDecimal value) { + addCriterion("gas_oil_subsidy <>", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyGreaterThan(BigDecimal value) { + addCriterion("gas_oil_subsidy >", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_oil_subsidy >=", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyLessThan(BigDecimal value) { + addCriterion("gas_oil_subsidy <", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_oil_subsidy <=", value, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyIn(List values) { + addCriterion("gas_oil_subsidy in", values, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyNotIn(List values) { + addCriterion("gas_oil_subsidy not in", values, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_oil_subsidy between", value1, value2, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasOilSubsidyNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_oil_subsidy not between", value1, value2, "gasOilSubsidy"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesIsNull() { + addCriterion("gas_liters_preferences is null"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesIsNotNull() { + addCriterion("gas_liters_preferences is not null"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesEqualTo(BigDecimal value) { + addCriterion("gas_liters_preferences =", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesNotEqualTo(BigDecimal value) { + addCriterion("gas_liters_preferences <>", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesGreaterThan(BigDecimal value) { + addCriterion("gas_liters_preferences >", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_liters_preferences >=", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesLessThan(BigDecimal value) { + addCriterion("gas_liters_preferences <", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_liters_preferences <=", value, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesIn(List values) { + addCriterion("gas_liters_preferences in", values, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesNotIn(List values) { + addCriterion("gas_liters_preferences not in", values, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_liters_preferences between", value1, value2, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasLitersPreferencesNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_liters_preferences not between", value1, value2, "gasLitersPreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesIsNull() { + addCriterion("gas_price_preferences is null"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesIsNotNull() { + addCriterion("gas_price_preferences is not null"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesEqualTo(BigDecimal value) { + addCriterion("gas_price_preferences =", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesNotEqualTo(BigDecimal value) { + addCriterion("gas_price_preferences <>", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesGreaterThan(BigDecimal value) { + addCriterion("gas_price_preferences >", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_preferences >=", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesLessThan(BigDecimal value) { + addCriterion("gas_price_preferences <", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_price_preferences <=", value, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesIn(List values) { + addCriterion("gas_price_preferences in", values, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesNotIn(List values) { + addCriterion("gas_price_preferences not in", values, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_preferences between", value1, value2, "gasPricePreferences"); + return (Criteria) this; + } + + public Criteria andGasPricePreferencesNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_price_preferences not between", value1, value2, "gasPricePreferences"); + return (Criteria) this; + } + public Criteria andGasSalesmanIdIsNull() { addCriterion("gas_salesman_id is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/model/GasPayPriceModel.java b/hai-service/src/main/java/com/hai/model/GasPayPriceModel.java new file mode 100644 index 00000000..fe408fa2 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/GasPayPriceModel.java @@ -0,0 +1,166 @@ +package com.hai.model; + +import java.math.BigDecimal; + +/** + * 团购支付价格模型 + * @author hurui + */ +public class GasPayPriceModel { + + /** + * 加油金额 + */ + private BigDecimal oilingPrice; + + /** + * 优惠价 + */ + private BigDecimal priceVip; + + /** + * 枪价 + */ + private BigDecimal priceGun; + + /** + * 国标价 + */ + private BigDecimal priceOfficial; + + /** + * 平台价 + */ + private BigDecimal pricePlatform; + + /** + * 加油升数,计算方式:加油金额 / 国标价 + */ + private BigDecimal oilLiters; + + /** + * 平台折扣,我们平台或者代理商设置的折扣 + */ + private BigDecimal discount; + + /** + * 加油补贴, 计算方式:国标价-团油VIP价 + */ + private BigDecimal oilSubsidy; + + /** + * 每升优惠 + */ + private BigDecimal litersPreferences; + + /** + * 优惠价格 + */ + private BigDecimal pricePreferences; + + /** + * 本次优惠 + */ + private BigDecimal totalPreferences; + + /** + * 支付价格,计算方式:加油金额 - 本次优惠 + */ + private BigDecimal payPrice; + + public BigDecimal getOilingPrice() { + return oilingPrice; + } + + public void setOilingPrice(BigDecimal oilingPrice) { + this.oilingPrice = oilingPrice; + } + + public BigDecimal getPriceVip() { + return priceVip; + } + + public void setPriceVip(BigDecimal priceVip) { + this.priceVip = priceVip; + } + + public BigDecimal getPriceGun() { + return priceGun; + } + + public void setPriceGun(BigDecimal priceGun) { + this.priceGun = priceGun; + } + + public BigDecimal getPriceOfficial() { + return priceOfficial; + } + + public void setPriceOfficial(BigDecimal priceOfficial) { + this.priceOfficial = priceOfficial; + } + + public BigDecimal getPricePlatform() { + return pricePlatform; + } + + public void setPricePlatform(BigDecimal pricePlatform) { + this.pricePlatform = pricePlatform; + } + + public BigDecimal getOilLiters() { + return oilLiters; + } + + public void setOilLiters(BigDecimal oilLiters) { + this.oilLiters = oilLiters; + } + + public BigDecimal getDiscount() { + return discount; + } + + public void setDiscount(BigDecimal discount) { + this.discount = discount; + } + + public BigDecimal getOilSubsidy() { + return oilSubsidy; + } + + public void setOilSubsidy(BigDecimal oilSubsidy) { + this.oilSubsidy = oilSubsidy; + } + + public BigDecimal getLitersPreferences() { + return litersPreferences; + } + + public void setLitersPreferences(BigDecimal litersPreferences) { + this.litersPreferences = litersPreferences; + } + + public BigDecimal getPricePreferences() { + return pricePreferences; + } + + public void setPricePreferences(BigDecimal pricePreferences) { + this.pricePreferences = pricePreferences; + } + + public BigDecimal getTotalPreferences() { + return totalPreferences; + } + + public void setTotalPreferences(BigDecimal totalPreferences) { + this.totalPreferences = totalPreferences; + } + + public BigDecimal getPayPrice() { + return payPrice; + } + + public void setPayPrice(BigDecimal payPrice) { + this.payPrice = payPrice; + } +} 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 d6d1e851..17ea9c52 100644 --- a/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java +++ b/hai-service/src/main/java/com/hai/service/HighGasDiscountOilPriceService.java @@ -1,7 +1,9 @@ package com.hai.service; import com.hai.entity.HighGasDiscountOilPrice; +import com.hai.model.GasPayPriceModel; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -27,7 +29,7 @@ public interface HighGasDiscountOilPriceService { /** * 根据油号 查询 - * @param oilNoName + * @param oilNo * @return */ HighGasDiscountOilPrice getDetailByOilNo(String oilNo); @@ -46,5 +48,14 @@ public interface HighGasDiscountOilPriceService { */ List getList(Map map); + /** + * 计算加油优惠、支付价格 + * @param oilingPrice 加油价格 + * @param goodsId 油站id + * @param oilNo 油品 + * @param isTyAgent 是否代理商模式 + * @return + */ + GasPayPriceModel oilPriceDiscountCompute(BigDecimal oilingPrice, Long goodsId, String oilNo, Boolean isTyAgent) throws Exception; } 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 d61b90e8..587fc584 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 @@ -1,20 +1,45 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.config.TuanYouConfig; import com.hai.dao.HighGasDiscountOilPriceMapper; import com.hai.entity.HighGasDiscountOilPrice; import com.hai.entity.HighGasDiscountOilPriceExample; -import com.hai.service.HighGasDiscountOilPriceService; +import com.hai.entity.HighGasOilPrice; +import com.hai.entity.HighTyAgentPrice; +import com.hai.model.GasPayPriceModel; +import com.hai.model.HighMerchantStoreModel; +import com.hai.service.*; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.HashMap; import java.util.List; import java.util.Map; @Service("highGasDiscountOilPriceService") public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPriceService { + @Resource + private HighMerchantStoreService merchantStoreService; + + @Resource + private HighGasDiscountOilPriceService gasDiscountOilPriceService; + + @Resource + private HighGasOilPriceService gasOilPriceService; + + @Resource + private HighTyAgentPriceService tyAgentPriceService; + @Resource private HighGasDiscountOilPriceMapper highGasDiscountOilPriceMapper; @@ -74,4 +99,106 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri example.setOrderByClause("create_time desc"); return highGasDiscountOilPriceMapper.selectByExample(example); } + + @Override + public GasPayPriceModel oilPriceDiscountCompute(BigDecimal oilingPrice, Long goodsId, String oilNo, Boolean isTyAgent) throws Exception { + // 查询油站信息 + HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(goodsId); + if (store == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); + } + + // 优惠比例 + BigDecimal discount = new BigDecimal("100"); + + // 查询是否配置了【油站的】优惠比例 + HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, goodsId, oilNo); + if (tyAgentPrice != null) { + discount = tyAgentPrice.getPriceRate(); + } else { + // 查询是否配置了【油品】优惠比例 + HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilNo); + if (gasDiscountOilPrice != null) { + discount = gasDiscountOilPrice.getPriceRate(); + } + } + + if (isTyAgent != null && isTyAgent.equals(true)) { + // 价格 + HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(2, goodsId, oilNo); + if (priceRate != null) { + discount = priceRate.getPriceRate(); + } + } + discount = discount.divide(new BigDecimal("100")); + + // 查询油站油品价格 + JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); + if (oilPriceObject == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + } + JSONArray oilPriceObjectArray = oilPriceObject.getJSONArray("result"); + if (oilPriceObjectArray.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + } + HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo)); + if (gasOilPrice == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + } + + JSONObject priceDetail = (JSONObject) oilPriceObjectArray.get(0); + // 团油枪价 + BigDecimal priceGun = priceDetail.getBigDecimal("priceGun"); + // 团油优惠价 + BigDecimal priceVip = priceDetail.getBigDecimal("priceVip"); + // 团油国标价 + BigDecimal priceOfficial = gasOilPrice.getPriceOfficial(); + // 嗨森逛平台价 国标价 * 折扣 + BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); + + GasPayPriceModel payPriceModel = new GasPayPriceModel(); + // 加油金额 + payPriceModel.setOilingPrice(oilingPrice); + + // 团油枪价 + payPriceModel.setPriceGun(priceGun); + + // 团油优惠价 + payPriceModel.setPriceVip(priceVip); + + // 团油国标价 + payPriceModel.setPriceOfficial(priceOfficial); + + // 平台价 + payPriceModel.setPricePlatform(pricePlatform); + + // 加油升数,计算方式:加油金额 / 枪价 + payPriceModel.setOilLiters(oilingPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_DOWN)); + + // 平台折扣,我们平台或者代理商设置的折扣 + payPriceModel.setDiscount(discount.compareTo(new BigDecimal("100")) == 1 ? new BigDecimal("0") : discount); + + // 加油补贴, 计算方式:团油枪价 - 团油VIP价 + payPriceModel.setOilSubsidy(priceGun.subtract(priceVip)); + + // 折扣,1 -平台折扣 + BigDecimal decimal1 = new BigDecimal("1").subtract(discount); + + // 价格差价 团油枪价 - 团油VIP价 + BigDecimal oilPriceDifferences = priceGun.subtract(priceVip); + + // 每升优惠 团油枪价 *(1-平台折扣)+(国标价-团油VIP价 ) + payPriceModel.setLitersPreferences(priceGun.multiply(decimal1).setScale(2, BigDecimal.ROUND_HALF_UP).add(oilPriceDifferences)); + + // 优惠价格 团油枪价 * 平台折扣 -(国标价-团油VIP价 ) + payPriceModel.setPricePreferences(pricePlatform.subtract(oilPriceDifferences)); + + // 本次优惠 + payPriceModel.setTotalPreferences(payPriceModel.getOilLiters().multiply(payPriceModel.getLitersPreferences()).setScale(2, BigDecimal.ROUND_DOWN)); + + // 支付价格 + payPriceModel.setPayPrice(oilingPrice.subtract(payPriceModel.getTotalPreferences())); + + return payPriceModel; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 5ac28c48..b267c21f 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -9,6 +9,7 @@ import com.hai.common.utils.DateUtil; import com.hai.dao.HighGoldRecMapper; import com.hai.dao.HighUserMapper; import com.hai.entity.*; +import com.hai.enum_type.OilCardBindStatusEnum; import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; import com.hai.service.*; @@ -210,7 +211,7 @@ public class HighUserServiceImpl implements HighUserService { if (highUser.getPhone() != null) { HighOilCard oilCard = oilCardService.getOilCardByPhone(highUser.getPhone()); - if (oilCard != null) { + if (oilCard != null && oilCard.getBindStatus().equals(OilCardBindStatusEnum.status0.getStatus())) { highUserCardService.bindCard(UserCardType.type2.getType(), oilCard.getCardNo(), highUser.getId()); } }