提交代码

dev-discount
胡锐 2 years ago
parent 0bdbf61225
commit ddb54d37cd
  1. 67
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceController.java
  2. 8
      hai-bweb/src/main/java/com/bweb/controller/HighGasOilPriceTaskController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  4. 8
      hai-service/src/main/java/com/hai/config/ZkcPrinterTemplate.java
  5. 27
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapper.java
  6. 3
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceMapperExt.java
  7. 14
      hai-service/src/main/java/com/hai/dao/HighGasOilPriceSqlProvider.java
  8. 18
      hai-service/src/main/java/com/hai/entity/HighGasOilPrice.java
  9. 60
      hai-service/src/main/java/com/hai/entity/HighGasOilPriceExample.java
  10. 3
      hai-service/src/main/java/com/hai/enum_type/GasTaskPriceTypeEnum.java
  11. 39
      hai-service/src/main/java/com/hai/model/GasPayPriceModel.java
  12. 47
      hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java
  13. 4
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceOfficialServiceImpl.java
  14. 20
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceTaskServiceImpl.java

@ -25,6 +25,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@ -37,9 +38,15 @@ public class HighGasOilPriceController {
@Resource @Resource
private HighGasOilPriceService gasOilPriceService; private HighGasOilPriceService gasOilPriceService;
@Resource
private HighTyAgentPriceService tyAgentPriceService;
@Resource @Resource
private HighGasOilPriceOfficialService gasOilPriceOfficialService; private HighGasOilPriceOfficialService gasOilPriceOfficialService;
@Resource
private HighGasDiscountOilPriceService gasDiscountOilPriceService;
@Resource @Resource
private HighMerchantStoreService merchantStoreService; private HighMerchantStoreService merchantStoreService;
@ -51,23 +58,10 @@ public class HighGasOilPriceController {
@ApiOperation(value = "编辑油品价格") @ApiOperation(value = "编辑油品价格")
public ResponseData editGasOilPrice(@RequestBody JSONObject body) { public ResponseData editGasOilPrice(@RequestBody JSONObject body) {
try { try {
if (body.getLong("storeId") == null if (body.getLong("storeId") == null || body.getInteger("oilNo") == null) {
|| body.getInteger("oilNo") == null
|| body.getBigDecimal("priceGun") == null
|| body.getBigDecimal("preferentialMargin") == null
) {
log.error("HighGasDiscountOilPriceController -> editGasOilPrice() error!",""); log.error("HighGasDiscountOilPriceController -> editGasOilPrice() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
if (body.getBigDecimal("preferentialMargin").compareTo(body.getBigDecimal("priceGun")) == 0) {
log.error("HighGasDiscountOilPriceController -> editGasOilPrice() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "优惠幅度不能与油枪价相同");
}
if (body.getBigDecimal("preferentialMargin").compareTo(body.getBigDecimal("priceGun")) == 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "优惠幅度不能大于枪价");
}
// 查询门店详情 // 查询门店详情
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(body.getLong("storeId")); HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(body.getLong("storeId"));
if (store == null) { if (store == null) {
@ -87,25 +81,28 @@ public class HighGasOilPriceController {
HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(body.getLong("storeId"), Integer.valueOf(body.getString("oilNo"))); HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(body.getLong("storeId"), Integer.valueOf(body.getString("oilNo")));
if (price == null) { if (price == null) {
price = new HighGasOilPrice(); price = new HighGasOilPrice();
// 查询国标价格
HighGasOilPriceOfficial priceOfficial = gasOilPriceOfficialService.getPrice(store.getRegionId(), body.getInteger("oilNo"));
if (priceOfficial == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法添加,系统未配置"+body.getInteger("oilNo")+"油号的国标价");
} }
price.setMerchantStoreId(body.getLong("storeId")); price.setMerchantStoreId(body.getLong("storeId"));
price.setOilType(Integer.parseInt(oilNo.getExt1()));
price.setOilTypeName(oilNo.getExt2());
price.setOilNo(Integer.parseInt(oilNo.getCodeValue())); price.setOilNo(Integer.parseInt(oilNo.getCodeValue()));
price.setOilNoName(oilNo.getCodeName()); price.setOilNoName(oilNo.getCodeName());
price.setPriceVip(body.getBigDecimal("priceGun").subtract(body.getBigDecimal("preferentialMargin")));
price.setPreferentialMargin(body.getBigDecimal("preferentialMargin"));
price.setPriceGun(body.getBigDecimal("priceGun"));
// 查询国标价格
HighGasOilPriceOfficial priceOfficial = gasOilPriceOfficialService.getPrice(store.getRegionId(), body.getInteger("oilNo"));
if (priceOfficial != null) {
price.setPriceOfficial(priceOfficial.getPriceOfficial()); price.setPriceOfficial(priceOfficial.getPriceOfficial());
} price.setPriceGun(priceOfficial.getPriceOfficial());
price.setPriceVip(priceOfficial.getPriceOfficial());
price.setOilType(Integer.parseInt(oilNo.getExt1())); price.setGasStationDrop(new BigDecimal("0"));
price.setOilTypeName(oilNo.getExt2()); price.setPreferentialMargin(new BigDecimal("0"));
gasOilPriceService.editGasOilPrice(price);
gasOilPriceService.editGasOilPrice(price);
return ResponseMsgUtil.success("操作成功"); return ResponseMsgUtil.success("操作成功");
}
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已添加" + body.getInteger("oilNo") + "油号");
} catch (Exception e) { } catch (Exception e) {
log.error("HighGasDiscountOilPriceController -> getGasDetailByStoreKey() error!",e); log.error("HighGasDiscountOilPriceController -> getGasDetailByStoreKey() error!",e);
@ -178,7 +175,27 @@ public class HighGasOilPriceController {
public ResponseData getOilPriceListByStore(@RequestParam(name = "storeId", required = true) Long storeId) { public ResponseData getOilPriceListByStore(@RequestParam(name = "storeId", required = true) Long storeId) {
try { try {
return ResponseMsgUtil.success(gasOilPriceService.getGasOilPriceByStore(storeId)); List<HighGasOilPrice> gasOilPriceList = gasOilPriceService.getGasOilPriceByStore(storeId);
for (HighGasOilPrice gasOilPrice : gasOilPriceList) {
BigDecimal discount = new BigDecimal("100");
// 查询是否配置了【油站的】优惠比例
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, gasOilPrice.getMerchantStoreId(), gasOilPrice.getOilNo().toString());
if (tyAgentPrice != null) {
discount = tyAgentPrice.getPriceRate();
} else {
// 查询是否配置了【油品】优惠比例
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(gasOilPrice.getOilNo().toString());
if (gasDiscountOilPrice != null) {
discount = gasDiscountOilPrice.getPriceRate();
}
}
// 油枪价 - 优惠幅度
BigDecimal price = gasOilPrice.getPriceGun().subtract(gasOilPrice.getPreferentialMargin());
gasOilPrice.setPriceVip(price.multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP));
gasOilPrice.setExt1(discount.toString());
}
return ResponseMsgUtil.success(gasOilPriceList);
} catch (Exception e) { } catch (Exception e) {
log.error("HighGasDiscountOilPriceController -> getOilPriceListByStore() error!",e); log.error("HighGasDiscountOilPriceController -> getOilPriceListByStore() error!",e);

@ -80,7 +80,7 @@ public class HighGasOilPriceTaskController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置执行时间"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置执行时间");
} }
// 价格类型 1. 国标价 2. 油站价 3. 优惠幅度 // 价格类型 1. 国标价 2. 油站价 3. 平台优惠 4. 油站直降
if (task.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) { if (task.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) {
if (task.getRegionId() == null) { if (task.getRegionId() == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!",""); log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");
@ -96,9 +96,11 @@ public class HighGasOilPriceTaskController {
task.setRegionName(region.getRegionName()); task.setRegionName(region.getRegionName());
} }
// 价格类型 1. 国标价 2. 油站价 3. 优惠幅度 // 价格类型 1. 国标价 2. 油站价 3. 平台优惠 4. 油站直降
if (task.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus()) if (task.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())
|| task.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) { || task.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())
|| task.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())
) {
if (task.getMerStoreId() == null) { if (task.getMerStoreId() == null) {
log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!",""); log.error("HighGasDiscountOilPriceController -> updateOilPriceOfficial() error!","");

@ -321,7 +321,7 @@ public class HighOrderController {
childOrder.setGasOilLiters(priceModel.getOilLiters()); childOrder.setGasOilLiters(priceModel.getOilLiters());
childOrder.setGasDiscount(priceModel.getDiscount()); childOrder.setGasDiscount(priceModel.getDiscount());
childOrder.setExt1(priceModel.getPricePlatform().toString()); childOrder.setExt1(priceModel.getPricePlatform().toString());
childOrder.setGasOilSubsidy(priceModel.getOilSubsidy()); childOrder.setGasOilSubsidy(priceModel.getPreferentialMargin());
childOrder.setGasLitersPreferences(priceModel.getLitersPreferences()); childOrder.setGasLitersPreferences(priceModel.getLitersPreferences());
childOrder.setGasPricePreferences(priceModel.getPricePreferences()); childOrder.setGasPricePreferences(priceModel.getPricePreferences());

@ -142,10 +142,10 @@ public class ZkcPrinterTemplate {
stream.write("来源:嗨森逛".getBytes("UTF-8")); stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("油枪:" + gunNo).getBytes("UTF-8")); stream.write(("油枪:" + gunNo + "号").getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("油品:" + oilNo).getBytes("UTF-8")); stream.write(("油品:" + oilNo + "#").getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8")); stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8"));
@ -216,10 +216,10 @@ public class ZkcPrinterTemplate {
stream.write("来源:嗨森逛".getBytes("UTF-8")); stream.write("来源:嗨森逛".getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("油枪:" + gunNo).getBytes("UTF-8")); stream.write(("油枪:" + gunNo + "号").getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("油品:" + oilNo).getBytes("UTF-8")); stream.write(("油品:" + oilNo + "#").getBytes("UTF-8"));
stream.write(0x0A); stream.write(0x0A);
stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8")); stream.write(("升数:" + oilLiters + "升").getBytes("UTF-8"));

@ -41,16 +41,18 @@ public interface HighGasOilPriceMapper extends HighGasOilPriceMapperExt {
@Insert({ @Insert({
"insert into high_gas_oil_price (merchant_store_id, oil_no, ", "insert into high_gas_oil_price (merchant_store_id, oil_no, ",
"oil_no_name, preferential_margin, ", "oil_no_name, preferential_margin, ",
"price_vip, price_gun, ", "gas_station_drop, price_vip, ",
"price_official, oil_type, ", "price_gun, price_official, ",
"oil_type_name, `status`, ", "oil_type, oil_type_name, ",
"ext_1, ext_2, ext_3)", "`status`, ext_1, ext_2, ",
"ext_3)",
"values (#{merchantStoreId,jdbcType=BIGINT}, #{oilNo,jdbcType=INTEGER}, ", "values (#{merchantStoreId,jdbcType=BIGINT}, #{oilNo,jdbcType=INTEGER}, ",
"#{oilNoName,jdbcType=VARCHAR}, #{preferentialMargin,jdbcType=DECIMAL}, ", "#{oilNoName,jdbcType=VARCHAR}, #{preferentialMargin,jdbcType=DECIMAL}, ",
"#{priceVip,jdbcType=DECIMAL}, #{priceGun,jdbcType=DECIMAL}, ", "#{gasStationDrop,jdbcType=DECIMAL}, #{priceVip,jdbcType=DECIMAL}, ",
"#{priceOfficial,jdbcType=DECIMAL}, #{oilType,jdbcType=INTEGER}, ", "#{priceGun,jdbcType=DECIMAL}, #{priceOfficial,jdbcType=DECIMAL}, ",
"#{oilTypeName,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", "#{oilType,jdbcType=INTEGER}, #{oilTypeName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{status,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighGasOilPrice record); int insert(HighGasOilPrice record);
@ -66,6 +68,7 @@ public interface HighGasOilPriceMapper extends HighGasOilPriceMapperExt {
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER), @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL), @Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_station_drop", property="gasStationDrop", jdbcType=JdbcType.DECIMAL),
@Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL),
@Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL),
@Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL),
@ -80,9 +83,9 @@ public interface HighGasOilPriceMapper extends HighGasOilPriceMapperExt {
@Select({ @Select({
"select", "select",
"id, merchant_store_id, oil_no, oil_no_name, preferential_margin, price_vip, ", "id, merchant_store_id, oil_no, oil_no_name, preferential_margin, gas_station_drop, ",
"price_gun, price_official, oil_type, oil_type_name, `status`, ext_1, ext_2, ", "price_vip, price_gun, price_official, oil_type, oil_type_name, `status`, ext_1, ",
"ext_3", "ext_2, ext_3",
"from high_gas_oil_price", "from high_gas_oil_price",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -92,6 +95,7 @@ public interface HighGasOilPriceMapper extends HighGasOilPriceMapperExt {
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER), @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL), @Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_station_drop", property="gasStationDrop", jdbcType=JdbcType.DECIMAL),
@Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL),
@Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL),
@Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL),
@ -119,6 +123,7 @@ public interface HighGasOilPriceMapper extends HighGasOilPriceMapperExt {
"oil_no = #{oilNo,jdbcType=INTEGER},", "oil_no = #{oilNo,jdbcType=INTEGER},",
"oil_no_name = #{oilNoName,jdbcType=VARCHAR},", "oil_no_name = #{oilNoName,jdbcType=VARCHAR},",
"preferential_margin = #{preferentialMargin,jdbcType=DECIMAL},", "preferential_margin = #{preferentialMargin,jdbcType=DECIMAL},",
"gas_station_drop = #{gasStationDrop,jdbcType=DECIMAL},",
"price_vip = #{priceVip,jdbcType=DECIMAL},", "price_vip = #{priceVip,jdbcType=DECIMAL},",
"price_gun = #{priceGun,jdbcType=DECIMAL},", "price_gun = #{priceGun,jdbcType=DECIMAL},",
"price_official = #{priceOfficial,jdbcType=DECIMAL},", "price_official = #{priceOfficial,jdbcType=DECIMAL},",

@ -49,11 +49,12 @@ public interface HighGasOilPriceMapperExt {
" and a.region_id = #{regionId} " + " and a.region_id = #{regionId} " +
" and b.oil_no = #{oilNo} "}) " and b.oil_no = #{oilNo} "})
@Results({ @Results({
@Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true), @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT), @Result(column="merchant_store_id", property="merchantStoreId", jdbcType=JdbcType.BIGINT),
@Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER), @Result(column="oil_no", property="oilNo", jdbcType=JdbcType.INTEGER),
@Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR), @Result(column="oil_no_name", property="oilNoName", jdbcType=JdbcType.VARCHAR),
@Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL), @Result(column="preferential_margin", property="preferentialMargin", jdbcType=JdbcType.DECIMAL),
@Result(column="gas_station_drop", property="gasStationDrop", jdbcType=JdbcType.DECIMAL),
@Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL), @Result(column="price_vip", property="priceVip", jdbcType=JdbcType.DECIMAL),
@Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL), @Result(column="price_gun", property="priceGun", jdbcType=JdbcType.DECIMAL),
@Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL), @Result(column="price_official", property="priceOfficial", jdbcType=JdbcType.DECIMAL),

@ -44,6 +44,10 @@ public class HighGasOilPriceSqlProvider {
sql.VALUES("preferential_margin", "#{preferentialMargin,jdbcType=DECIMAL}"); sql.VALUES("preferential_margin", "#{preferentialMargin,jdbcType=DECIMAL}");
} }
if (record.getGasStationDrop() != null) {
sql.VALUES("gas_station_drop", "#{gasStationDrop,jdbcType=DECIMAL}");
}
if (record.getPriceVip() != null) { if (record.getPriceVip() != null) {
sql.VALUES("price_vip", "#{priceVip,jdbcType=DECIMAL}"); sql.VALUES("price_vip", "#{priceVip,jdbcType=DECIMAL}");
} }
@ -94,6 +98,7 @@ public class HighGasOilPriceSqlProvider {
sql.SELECT("oil_no"); sql.SELECT("oil_no");
sql.SELECT("oil_no_name"); sql.SELECT("oil_no_name");
sql.SELECT("preferential_margin"); sql.SELECT("preferential_margin");
sql.SELECT("gas_station_drop");
sql.SELECT("price_vip"); sql.SELECT("price_vip");
sql.SELECT("price_gun"); sql.SELECT("price_gun");
sql.SELECT("price_official"); sql.SELECT("price_official");
@ -140,6 +145,10 @@ public class HighGasOilPriceSqlProvider {
sql.SET("preferential_margin = #{record.preferentialMargin,jdbcType=DECIMAL}"); sql.SET("preferential_margin = #{record.preferentialMargin,jdbcType=DECIMAL}");
} }
if (record.getGasStationDrop() != null) {
sql.SET("gas_station_drop = #{record.gasStationDrop,jdbcType=DECIMAL}");
}
if (record.getPriceVip() != null) { if (record.getPriceVip() != null) {
sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}"); sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}");
} }
@ -189,6 +198,7 @@ public class HighGasOilPriceSqlProvider {
sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}"); sql.SET("oil_no = #{record.oilNo,jdbcType=INTEGER}");
sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}"); sql.SET("oil_no_name = #{record.oilNoName,jdbcType=VARCHAR}");
sql.SET("preferential_margin = #{record.preferentialMargin,jdbcType=DECIMAL}"); sql.SET("preferential_margin = #{record.preferentialMargin,jdbcType=DECIMAL}");
sql.SET("gas_station_drop = #{record.gasStationDrop,jdbcType=DECIMAL}");
sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}"); sql.SET("price_vip = #{record.priceVip,jdbcType=DECIMAL}");
sql.SET("price_gun = #{record.priceGun,jdbcType=DECIMAL}"); sql.SET("price_gun = #{record.priceGun,jdbcType=DECIMAL}");
sql.SET("price_official = #{record.priceOfficial,jdbcType=DECIMAL}"); sql.SET("price_official = #{record.priceOfficial,jdbcType=DECIMAL}");
@ -224,6 +234,10 @@ public class HighGasOilPriceSqlProvider {
sql.SET("preferential_margin = #{preferentialMargin,jdbcType=DECIMAL}"); sql.SET("preferential_margin = #{preferentialMargin,jdbcType=DECIMAL}");
} }
if (record.getGasStationDrop() != null) {
sql.SET("gas_station_drop = #{gasStationDrop,jdbcType=DECIMAL}");
}
if (record.getPriceVip() != null) { if (record.getPriceVip() != null) {
sql.SET("price_vip = #{priceVip,jdbcType=DECIMAL}"); sql.SET("price_vip = #{priceVip,jdbcType=DECIMAL}");
} }

@ -34,10 +34,15 @@ public class HighGasOilPrice implements Serializable {
private String oilNoName; private String oilNoName;
/** /**
* 优惠幅度 * 平台优惠
*/ */
private BigDecimal preferentialMargin; private BigDecimal preferentialMargin;
/**
* 油站直降
*/
private BigDecimal gasStationDrop;
/** /**
* 优惠价 * 优惠价
*/ */
@ -116,6 +121,14 @@ public class HighGasOilPrice implements Serializable {
this.preferentialMargin = preferentialMargin; this.preferentialMargin = preferentialMargin;
} }
public BigDecimal getGasStationDrop() {
return gasStationDrop;
}
public void setGasStationDrop(BigDecimal gasStationDrop) {
this.gasStationDrop = gasStationDrop;
}
public BigDecimal getPriceVip() { public BigDecimal getPriceVip() {
return priceVip; return priceVip;
} }
@ -205,6 +218,7 @@ public class HighGasOilPrice implements Serializable {
&& (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo())) && (this.getOilNo() == null ? other.getOilNo() == null : this.getOilNo().equals(other.getOilNo()))
&& (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName())) && (this.getOilNoName() == null ? other.getOilNoName() == null : this.getOilNoName().equals(other.getOilNoName()))
&& (this.getPreferentialMargin() == null ? other.getPreferentialMargin() == null : this.getPreferentialMargin().equals(other.getPreferentialMargin())) && (this.getPreferentialMargin() == null ? other.getPreferentialMargin() == null : this.getPreferentialMargin().equals(other.getPreferentialMargin()))
&& (this.getGasStationDrop() == null ? other.getGasStationDrop() == null : this.getGasStationDrop().equals(other.getGasStationDrop()))
&& (this.getPriceVip() == null ? other.getPriceVip() == null : this.getPriceVip().equals(other.getPriceVip())) && (this.getPriceVip() == null ? other.getPriceVip() == null : this.getPriceVip().equals(other.getPriceVip()))
&& (this.getPriceGun() == null ? other.getPriceGun() == null : this.getPriceGun().equals(other.getPriceGun())) && (this.getPriceGun() == null ? other.getPriceGun() == null : this.getPriceGun().equals(other.getPriceGun()))
&& (this.getPriceOfficial() == null ? other.getPriceOfficial() == null : this.getPriceOfficial().equals(other.getPriceOfficial())) && (this.getPriceOfficial() == null ? other.getPriceOfficial() == null : this.getPriceOfficial().equals(other.getPriceOfficial()))
@ -225,6 +239,7 @@ public class HighGasOilPrice implements Serializable {
result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode()); result = prime * result + ((getOilNo() == null) ? 0 : getOilNo().hashCode());
result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode()); result = prime * result + ((getOilNoName() == null) ? 0 : getOilNoName().hashCode());
result = prime * result + ((getPreferentialMargin() == null) ? 0 : getPreferentialMargin().hashCode()); result = prime * result + ((getPreferentialMargin() == null) ? 0 : getPreferentialMargin().hashCode());
result = prime * result + ((getGasStationDrop() == null) ? 0 : getGasStationDrop().hashCode());
result = prime * result + ((getPriceVip() == null) ? 0 : getPriceVip().hashCode()); result = prime * result + ((getPriceVip() == null) ? 0 : getPriceVip().hashCode());
result = prime * result + ((getPriceGun() == null) ? 0 : getPriceGun().hashCode()); result = prime * result + ((getPriceGun() == null) ? 0 : getPriceGun().hashCode());
result = prime * result + ((getPriceOfficial() == null) ? 0 : getPriceOfficial().hashCode()); result = prime * result + ((getPriceOfficial() == null) ? 0 : getPriceOfficial().hashCode());
@ -248,6 +263,7 @@ public class HighGasOilPrice implements Serializable {
sb.append(", oilNo=").append(oilNo); sb.append(", oilNo=").append(oilNo);
sb.append(", oilNoName=").append(oilNoName); sb.append(", oilNoName=").append(oilNoName);
sb.append(", preferentialMargin=").append(preferentialMargin); sb.append(", preferentialMargin=").append(preferentialMargin);
sb.append(", gasStationDrop=").append(gasStationDrop);
sb.append(", priceVip=").append(priceVip); sb.append(", priceVip=").append(priceVip);
sb.append(", priceGun=").append(priceGun); sb.append(", priceGun=").append(priceGun);
sb.append(", priceOfficial=").append(priceOfficial); sb.append(", priceOfficial=").append(priceOfficial);

@ -435,6 +435,66 @@ public class HighGasOilPriceExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andGasStationDropIsNull() {
addCriterion("gas_station_drop is null");
return (Criteria) this;
}
public Criteria andGasStationDropIsNotNull() {
addCriterion("gas_station_drop is not null");
return (Criteria) this;
}
public Criteria andGasStationDropEqualTo(BigDecimal value) {
addCriterion("gas_station_drop =", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropNotEqualTo(BigDecimal value) {
addCriterion("gas_station_drop <>", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropGreaterThan(BigDecimal value) {
addCriterion("gas_station_drop >", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("gas_station_drop >=", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropLessThan(BigDecimal value) {
addCriterion("gas_station_drop <", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropLessThanOrEqualTo(BigDecimal value) {
addCriterion("gas_station_drop <=", value, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropIn(List<BigDecimal> values) {
addCriterion("gas_station_drop in", values, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropNotIn(List<BigDecimal> values) {
addCriterion("gas_station_drop not in", values, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("gas_station_drop between", value1, value2, "gasStationDrop");
return (Criteria) this;
}
public Criteria andGasStationDropNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("gas_station_drop not between", value1, value2, "gasStationDrop");
return (Criteria) this;
}
public Criteria andPriceVipIsNull() { public Criteria andPriceVipIsNull() {
addCriterion("price_vip is null"); addCriterion("price_vip is null");
return (Criteria) this; return (Criteria) this;

@ -7,7 +7,8 @@ package com.hai.enum_type;
public enum GasTaskPriceTypeEnum { public enum GasTaskPriceTypeEnum {
type1(1 , "国标价"), type1(1 , "国标价"),
type2(2 , "油站价"), type2(2 , "油站价"),
type3(3 , "优惠幅度"), type3(3 , "平台优惠"),
type4(4 , "油站直降"),
; ;
private Integer status; private Integer status;

@ -33,6 +33,16 @@ public class GasPayPriceModel {
*/ */
private BigDecimal pricePlatform; private BigDecimal pricePlatform;
/**
* 油站直降
*/
private BigDecimal gasStationDrop;
/**
* 平台补贴
*/
private BigDecimal preferentialMargin;
/** /**
* 加油升数计算方式加油金额 / 国标价 * 加油升数计算方式加油金额 / 国标价
*/ */
@ -43,11 +53,6 @@ public class GasPayPriceModel {
*/ */
private BigDecimal discount; private BigDecimal discount;
/**
* 加油补贴, 计算方式国标价-团油VIP价
*/
private BigDecimal oilSubsidy;
/** /**
* 每升优惠 * 每升优惠
*/ */
@ -68,6 +73,22 @@ public class GasPayPriceModel {
*/ */
private BigDecimal payPrice; private BigDecimal payPrice;
public BigDecimal getPreferentialMargin() {
return preferentialMargin;
}
public void setPreferentialMargin(BigDecimal preferentialMargin) {
this.preferentialMargin = preferentialMargin;
}
public BigDecimal getGasStationDrop() {
return gasStationDrop;
}
public void setGasStationDrop(BigDecimal gasStationDrop) {
this.gasStationDrop = gasStationDrop;
}
public BigDecimal getOilingPrice() { public BigDecimal getOilingPrice() {
return oilingPrice; return oilingPrice;
} }
@ -124,14 +145,6 @@ public class GasPayPriceModel {
this.discount = discount; this.discount = discount;
} }
public BigDecimal getOilSubsidy() {
return oilSubsidy;
}
public void setOilSubsidy(BigDecimal oilSubsidy) {
this.oilSubsidy = oilSubsidy;
}
public BigDecimal getLitersPreferences() { public BigDecimal getLitersPreferences() {
return litersPreferences; return litersPreferences;
} }

@ -134,27 +134,26 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
} }
} }
discount = discount.divide(new BigDecimal("100")); discount = discount.divide(new BigDecimal("100"));
// 枪价
BigDecimal priceGun;
// 优惠价
BigDecimal priceVip;
// 优惠幅度
BigDecimal preferentialMargin = new BigDecimal("0");
// 查询油站价格 // 查询油站价格
HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo)); HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo));
if (gasOilPrice == null) { if (gasOilPrice == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格");
} }
priceGun = gasOilPrice.getPriceGun();
priceVip = gasOilPrice.getPriceVip();
preferentialMargin = gasOilPrice.getPreferentialMargin();
// 国标价 // 国标价
BigDecimal priceOfficial = gasOilPrice.getPriceOfficial(); BigDecimal priceOfficial = gasOilPrice.getPriceOfficial();
// 油站价
BigDecimal priceGun = gasOilPrice.getPriceGun();
// 油站直降
BigDecimal gasStationDrop = gasOilPrice.getGasStationDrop();
// 油站优惠价
BigDecimal priceVip = gasOilPrice.getPriceVip();
// 平台优惠
BigDecimal preferentialMargin = gasOilPrice.getPreferentialMargin();
GasPayPriceModel payPriceModel = new GasPayPriceModel(); GasPayPriceModel payPriceModel = new GasPayPriceModel();
// 1:平台自建 2:团油 3: 壳牌
if (store.getSourceType().equals(1)) { if (store.getSourceType().equals(1)) {
// 嗨森逛平台价 国标价 * 折扣 // 嗨森逛平台价 国标价 * 折扣
@ -163,15 +162,21 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
// 加油金额 // 加油金额
payPriceModel.setOilingPrice(oilingPrice); payPriceModel.setOilingPrice(oilingPrice);
// 油站枪价 // 油站枪价
payPriceModel.setPriceGun(priceGun); payPriceModel.setPriceGun(priceGun);
// 油站优惠价 // 油站优惠价
payPriceModel.setPriceVip(priceVip); payPriceModel.setPriceVip(priceVip);
// 油站国标价 // 油站国标价
payPriceModel.setPriceOfficial(priceOfficial); payPriceModel.setPriceOfficial(priceOfficial);
// 油站直降
payPriceModel.setGasStationDrop(gasStationDrop);
// 平台补贴
payPriceModel.setPreferentialMargin(gasOilPrice.getPreferentialMargin());
// 平台价 // 平台价
payPriceModel.setPricePlatform(pricePlatform); payPriceModel.setPricePlatform(pricePlatform);
@ -182,19 +187,19 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount); payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount);
// 加油补贴, 计算方式:加油站枪价 - 加油站VIP价 // 加油补贴, 计算方式:加油站枪价 - 加油站VIP价
payPriceModel.setOilSubsidy(priceGun.subtract(priceVip)); // payPriceModel.setOilSubsidy(priceGun.subtract(priceVip));
// 折扣,1 -平台折扣 // 折扣,1 -平台折扣
BigDecimal decimal1 = new BigDecimal("1").subtract(discount); BigDecimal decimal1 = new BigDecimal("1").subtract(discount);
// 油枪价 - 优惠幅度 // 油枪价 - 平台补贴
BigDecimal price = payPriceModel.getPriceGun().subtract(preferentialMargin); BigDecimal price = payPriceModel.getPriceGun().subtract(preferentialMargin);
// 优惠价格 (油枪价 - 优惠幅度) * 系统折扣 // 优惠价格 (油枪价 - 平台补贴) * 系统折扣
payPriceModel.setPricePreferences(price.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP)); payPriceModel.setPricePreferences(price.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
// 每升优惠 枪价 - 优惠价格 // 每升优惠 枪价 - 优惠价格
payPriceModel.setLitersPreferences(priceGun.subtract(payPriceModel.getPricePreferences())); payPriceModel.setLitersPreferences(payPriceModel.getPriceOfficial().subtract(payPriceModel.getPricePreferences()));
// 本次优惠 加油升数 * 每升优惠 // 本次优惠 加油升数 * 每升优惠
payPriceModel.setTotalPreferences(payPriceModel.getOilLiters().multiply(payPriceModel.getLitersPreferences()).setScale(2, BigDecimal.ROUND_DOWN)); payPriceModel.setTotalPreferences(payPriceModel.getOilLiters().multiply(payPriceModel.getLitersPreferences()).setScale(2, BigDecimal.ROUND_DOWN));
@ -233,6 +238,12 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
// 团油国标价 // 团油国标价
payPriceModel.setPriceOfficial(priceOfficial); payPriceModel.setPriceOfficial(priceOfficial);
// 油站直降
payPriceModel.setGasStationDrop(gasStationDrop);
// 平台补贴
payPriceModel.setPreferentialMargin(gasOilPrice.getPreferentialMargin());
// 平台价 // 平台价
payPriceModel.setPricePlatform(pricePlatform); payPriceModel.setPricePlatform(pricePlatform);
@ -243,7 +254,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri
payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount); payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("100") : discount);
// 加油补贴, 计算方式:团油枪价 - 团油VIP价 // 加油补贴, 计算方式:团油枪价 - 团油VIP价
payPriceModel.setOilSubsidy(priceGun.subtract(priceVip)); // payPriceModel.setOilSubsidy(priceGun.subtract(priceVip));
// 折扣,1 -平台折扣 // 折扣,1 -平台折扣
BigDecimal decimal1 = new BigDecimal("1").subtract(discount); BigDecimal decimal1 = new BigDecimal("1").subtract(discount);

@ -142,8 +142,8 @@ public class HighGasOilPriceOfficialServiceImpl implements HighGasOilPriceOffici
List<HighGasOilPrice> list = highGasOilPriceService.getPriceListByRegionAndOilNo(priceOfficial.getRegionId(), priceOfficial.getOilNo()); List<HighGasOilPrice> list = highGasOilPriceService.getPriceListByRegionAndOilNo(priceOfficial.getRegionId(), priceOfficial.getOilNo());
for (HighGasOilPrice gasOilPrice : list) { for (HighGasOilPrice gasOilPrice : list) {
gasOilPrice.setPriceOfficial(priceOfficial.getPriceOfficial()); gasOilPrice.setPriceOfficial(priceOfficial.getPriceOfficial());
gasOilPrice.setPriceGun(priceOfficial.getPriceOfficial()); gasOilPrice.setPriceGun(priceOfficial.getPriceOfficial().subtract(gasOilPrice.getGasStationDrop()));
gasOilPrice.setPriceVip(priceOfficial.getPriceOfficial().subtract(gasOilPrice.getPreferentialMargin())); gasOilPrice.setPriceVip(gasOilPrice.getPriceGun().subtract(gasOilPrice.getPreferentialMargin()));
highGasOilPriceService.editGasOilPrice(gasOilPrice); highGasOilPriceService.editGasOilPrice(gasOilPrice);
} }
} }

@ -98,6 +98,7 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
} }
gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice()); gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice());
// 更新自建站的国标价
gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo()); gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo());
} }
@ -108,12 +109,12 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
if (price == null) { if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
} }
price.setPriceGun(gasOilPriceTask.getPrice()); price.setPriceGun(gasOilPriceTask.getPrice().subtract(price.getGasStationDrop()));
price.setPriceVip(gasOilPriceTask.getPrice().subtract(price.getPreferentialMargin())); price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin()));
gasOilPriceService.editGasOilPrice(price); gasOilPriceService.editGasOilPrice(price);
} }
// 优惠幅度 // 平台优惠
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) { if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) {
// 查询油品价格 // 查询油品价格
HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(gasOilPriceTask.getMerStoreId(), gasOilPriceTask.getOilNo()); HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(gasOilPriceTask.getMerStoreId(), gasOilPriceTask.getOilNo());
@ -125,6 +126,19 @@ public class HighGasOilPriceTaskServiceImpl implements HighGasOilPriceTaskServic
gasOilPriceService.editGasOilPrice(price); gasOilPriceService.editGasOilPrice(price);
} }
// 油站直降
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())) {
// 查询油品价格
HighGasOilPrice price = gasOilPriceService.getGasOilPriceByStoreAndOilNo(gasOilPriceTask.getMerStoreId(), gasOilPriceTask.getOilNo());
if (price == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油品价格");
}
price.setGasStationDrop(gasOilPriceTask.getPrice());
price.setPriceGun(price.getPriceOfficial().subtract(price.getGasStationDrop()));
price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin()));
gasOilPriceService.editGasOilPrice(price);
}
} }
@Override @Override

Loading…
Cancel
Save