From 70ce2b2526069b7f77c9b1b868727236fcb1b56d Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 24 Oct 2022 17:35:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/OrderOilController.java | 2 +- .../java/com/hai/dao/HighGasOrderMapper.java | 124 ++++----- .../com/hai/dao/HighGasOrderSqlProvider.java | 58 ++++- .../hai/dao/HighMerchantAccountMapperExt.java | 9 +- .../java/com/hai/entity/HighGasOrder.java | 66 ++++- .../com/hai/entity/HighGasOrderExample.java | 238 ++++++++++++++++-- .../impl/OrderCreateHandleServiceImpl.java | 19 +- .../hai/service/impl/HighUserServiceImpl.java | 1 - .../main/java/com/web/config/AuthConfig.java | 100 +++++--- .../com/web/controller/CoresController.java | 75 ++++++ 10 files changed, 551 insertions(+), 141 deletions(-) diff --git a/hai-order/src/main/java/com/web/controller/business/OrderOilController.java b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java index 270c9a6c..eee3ec02 100644 --- a/hai-order/src/main/java/com/web/controller/business/OrderOilController.java +++ b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java @@ -293,7 +293,7 @@ public class OrderOilController { model.setGasPricePlatform(gasOrder.getGasPricePlatform()); model.setGasPriceGun(gasOrder.getGasPriceGun()); model.setGasPriceOfficial(gasOrder.getGasPriceOfficial()); - model.setDeductionPrice(gasOrder.getDeductionPrice()); + model.setDeductionPrice(gasOrder.getTotalDeductionPrice()); model.setPayablePrice(gasOrder.getPayablePrice()); model.setPayGold(gasOrder.getPayGold()); model.setPayPrice(gasOrder.getPayPrice()!=null?gasOrder.getPayPrice().toString():"未支付"); diff --git a/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java index a648d288..260da886 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java @@ -44,55 +44,57 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "mem_id, mem_phone, ", "company_id, company_name, ", "mer_id, mer_name, store_id, ", - "store_name, deduction_price, ", - "payable_price, pay_gold, ", - "pay_price, gas_refuel_price, ", - "gas_oil_no, gas_gun_no, ", - "gas_oil_type, gas_price_platform, ", - "gas_price_gun, gas_price_vip, ", - "gas_price_official, gas_price_cost, ", - "gas_price_cost_total, gas_price_channel_pay, ", - "gas_oil_liters, gas_discount, ", - "gas_oil_subsidy, gas_liters_preferences, ", - "gas_price_preferences, gas_class_group_id, ", - "gas_class_group_name, gas_class_group_task_id, ", - "gas_staff_id, gas_staff_name, ", - "gas_salesman_id, gas_salesman_name, ", - "gas_agent_id, gas_agent_name, ", - "gas_org_id, gas_org_name, ", - "pay_type, `status`, ", - "create_time, cancel_time, ", - "pay_time, refund_time, ", - "refund_remarks, ext_1, ", - "ext_2, ext_3, ext_4, ", - "ext_5, ext_6)", + "store_name, store_address, ", + "total_deduction_price, deduction_coupon_price, ", + "deduction_product_price, payable_price, ", + "pay_gold, pay_price, ", + "gas_refuel_price, gas_oil_no, ", + "gas_gun_no, gas_oil_type, ", + "gas_price_platform, gas_price_gun, ", + "gas_price_vip, gas_price_official, ", + "gas_price_cost, gas_price_cost_total, ", + "gas_price_channel_pay, gas_oil_liters, ", + "gas_discount, gas_oil_subsidy, ", + "gas_liters_preferences, gas_price_preferences, ", + "gas_class_group_id, gas_class_group_name, ", + "gas_class_group_task_id, gas_staff_id, ", + "gas_staff_name, gas_salesman_id, ", + "gas_salesman_name, gas_agent_id, ", + "gas_agent_name, gas_org_id, ", + "gas_org_name, pay_type, ", + "`status`, create_time, ", + "cancel_time, pay_time, ", + "refund_time, refund_remarks, ", + "ext_1, ext_2, ext_3, ", + "ext_4, ext_5, ext_6)", "values (#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ", "#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memPhone,jdbcType=VARCHAR}, ", "#{companyId,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, ", "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{storeId,jdbcType=BIGINT}, ", - "#{storeName,jdbcType=VARCHAR}, #{deductionPrice,jdbcType=DECIMAL}, ", - "#{payablePrice,jdbcType=DECIMAL}, #{payGold,jdbcType=INTEGER}, ", - "#{payPrice,jdbcType=DECIMAL}, #{gasRefuelPrice,jdbcType=DECIMAL}, ", - "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ", - "#{gasOilType,jdbcType=INTEGER}, #{gasPricePlatform,jdbcType=DECIMAL}, ", - "#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ", - "#{gasPriceOfficial,jdbcType=DECIMAL}, #{gasPriceCost,jdbcType=DECIMAL}, ", - "#{gasPriceCostTotal,jdbcType=DECIMAL}, #{gasPriceChannelPay,jdbcType=DECIMAL}, ", - "#{gasOilLiters,jdbcType=DECIMAL}, #{gasDiscount,jdbcType=DECIMAL}, ", - "#{gasOilSubsidy,jdbcType=DECIMAL}, #{gasLitersPreferences,jdbcType=DECIMAL}, ", - "#{gasPricePreferences,jdbcType=DECIMAL}, #{gasClassGroupId,jdbcType=BIGINT}, ", - "#{gasClassGroupName,jdbcType=VARCHAR}, #{gasClassGroupTaskId,jdbcType=BIGINT}, ", - "#{gasStaffId,jdbcType=BIGINT}, #{gasStaffName,jdbcType=VARCHAR}, ", - "#{gasSalesmanId,jdbcType=BIGINT}, #{gasSalesmanName,jdbcType=VARCHAR}, ", - "#{gasAgentId,jdbcType=BIGINT}, #{gasAgentName,jdbcType=VARCHAR}, ", - "#{gasOrgId,jdbcType=BIGINT}, #{gasOrgName,jdbcType=VARCHAR}, ", - "#{payType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", - "#{payTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", - "#{refundRemarks,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", - "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{storeName,jdbcType=VARCHAR}, #{storeAddress,jdbcType=VARCHAR}, ", + "#{totalDeductionPrice,jdbcType=DECIMAL}, #{deductionCouponPrice,jdbcType=DECIMAL}, ", + "#{deductionProductPrice,jdbcType=DECIMAL}, #{payablePrice,jdbcType=DECIMAL}, ", + "#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ", + "#{gasRefuelPrice,jdbcType=DECIMAL}, #{gasOilNo,jdbcType=VARCHAR}, ", + "#{gasGunNo,jdbcType=VARCHAR}, #{gasOilType,jdbcType=INTEGER}, ", + "#{gasPricePlatform,jdbcType=DECIMAL}, #{gasPriceGun,jdbcType=DECIMAL}, ", + "#{gasPriceVip,jdbcType=DECIMAL}, #{gasPriceOfficial,jdbcType=DECIMAL}, ", + "#{gasPriceCost,jdbcType=DECIMAL}, #{gasPriceCostTotal,jdbcType=DECIMAL}, ", + "#{gasPriceChannelPay,jdbcType=DECIMAL}, #{gasOilLiters,jdbcType=DECIMAL}, ", + "#{gasDiscount,jdbcType=DECIMAL}, #{gasOilSubsidy,jdbcType=DECIMAL}, ", + "#{gasLitersPreferences,jdbcType=DECIMAL}, #{gasPricePreferences,jdbcType=DECIMAL}, ", + "#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ", + "#{gasClassGroupTaskId,jdbcType=BIGINT}, #{gasStaffId,jdbcType=BIGINT}, ", + "#{gasStaffName,jdbcType=VARCHAR}, #{gasSalesmanId,jdbcType=BIGINT}, ", + "#{gasSalesmanName,jdbcType=VARCHAR}, #{gasAgentId,jdbcType=BIGINT}, ", + "#{gasAgentName,jdbcType=VARCHAR}, #{gasOrgId,jdbcType=BIGINT}, ", + "#{gasOrgName,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, ", + "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{cancelTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", + "#{refundTime,jdbcType=TIMESTAMP}, #{refundRemarks,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(HighGasOrder record); @@ -116,7 +118,10 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), - @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="store_address", property="storeAddress", jdbcType=JdbcType.VARCHAR), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_product_price", property="deductionProductPrice", jdbcType=JdbcType.DECIMAL), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @@ -166,15 +171,16 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Select({ "select", "id, order_no, child_order_no, channel_type, channel_order_no, mem_id, mem_phone, ", - "company_id, company_name, mer_id, mer_name, store_id, store_name, deduction_price, ", - "payable_price, pay_gold, pay_price, gas_refuel_price, gas_oil_no, gas_gun_no, ", - "gas_oil_type, gas_price_platform, gas_price_gun, gas_price_vip, gas_price_official, ", - "gas_price_cost, gas_price_cost_total, gas_price_channel_pay, gas_oil_liters, ", - "gas_discount, gas_oil_subsidy, gas_liters_preferences, gas_price_preferences, ", - "gas_class_group_id, gas_class_group_name, gas_class_group_task_id, gas_staff_id, ", - "gas_staff_name, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ", - "gas_org_id, gas_org_name, pay_type, `status`, create_time, cancel_time, pay_time, ", - "refund_time, refund_remarks, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", + "company_id, company_name, mer_id, mer_name, store_id, store_name, store_address, ", + "total_deduction_price, deduction_coupon_price, deduction_product_price, payable_price, ", + "pay_gold, pay_price, gas_refuel_price, gas_oil_no, gas_gun_no, gas_oil_type, ", + "gas_price_platform, gas_price_gun, gas_price_vip, gas_price_official, gas_price_cost, ", + "gas_price_cost_total, gas_price_channel_pay, gas_oil_liters, gas_discount, gas_oil_subsidy, ", + "gas_liters_preferences, gas_price_preferences, gas_class_group_id, gas_class_group_name, ", + "gas_class_group_task_id, gas_staff_id, gas_staff_name, gas_salesman_id, gas_salesman_name, ", + "gas_agent_id, gas_agent_name, gas_org_id, gas_org_name, pay_type, `status`, ", + "create_time, cancel_time, pay_time, refund_time, refund_remarks, ext_1, ext_2, ", + "ext_3, ext_4, ext_5, ext_6", "from high_gas_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -192,7 +198,10 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), - @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="store_address", property="storeAddress", jdbcType=JdbcType.VARCHAR), + @Result(column="total_deduction_price", property="totalDeductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_coupon_price", property="deductionCouponPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="deduction_product_price", property="deductionProductPrice", jdbcType=JdbcType.DECIMAL), @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @@ -262,7 +271,10 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "mer_name = #{merName,jdbcType=VARCHAR},", "store_id = #{storeId,jdbcType=BIGINT},", "store_name = #{storeName,jdbcType=VARCHAR},", - "deduction_price = #{deductionPrice,jdbcType=DECIMAL},", + "store_address = #{storeAddress,jdbcType=VARCHAR},", + "total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL},", + "deduction_coupon_price = #{deductionCouponPrice,jdbcType=DECIMAL},", + "deduction_product_price = #{deductionProductPrice,jdbcType=DECIMAL},", "payable_price = #{payablePrice,jdbcType=DECIMAL},", "pay_gold = #{payGold,jdbcType=INTEGER},", "pay_price = #{payPrice,jdbcType=DECIMAL},", diff --git a/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java index 52908b0b..df512d08 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java @@ -76,8 +76,20 @@ public class HighGasOrderSqlProvider { sql.VALUES("store_name", "#{storeName,jdbcType=VARCHAR}"); } - if (record.getDeductionPrice() != null) { - sql.VALUES("deduction_price", "#{deductionPrice,jdbcType=DECIMAL}"); + if (record.getStoreAddress() != null) { + sql.VALUES("store_address", "#{storeAddress,jdbcType=VARCHAR}"); + } + + if (record.getTotalDeductionPrice() != null) { + sql.VALUES("total_deduction_price", "#{totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.VALUES("deduction_coupon_price", "#{deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.VALUES("deduction_product_price", "#{deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayablePrice() != null) { @@ -274,7 +286,10 @@ public class HighGasOrderSqlProvider { sql.SELECT("mer_name"); sql.SELECT("store_id"); sql.SELECT("store_name"); - sql.SELECT("deduction_price"); + sql.SELECT("store_address"); + sql.SELECT("total_deduction_price"); + sql.SELECT("deduction_coupon_price"); + sql.SELECT("deduction_product_price"); sql.SELECT("payable_price"); sql.SELECT("pay_gold"); sql.SELECT("pay_price"); @@ -387,8 +402,20 @@ public class HighGasOrderSqlProvider { sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); } - if (record.getDeductionPrice() != null) { - sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + if (record.getStoreAddress() != null) { + sql.SET("store_address = #{record.storeAddress,jdbcType=VARCHAR}"); + } + + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.SET("deduction_coupon_price = #{record.deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.SET("deduction_product_price = #{record.deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayablePrice() != null) { @@ -584,7 +611,10 @@ public class HighGasOrderSqlProvider { sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); - sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + sql.SET("store_address = #{record.storeAddress,jdbcType=VARCHAR}"); + sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}"); + sql.SET("deduction_coupon_price = #{record.deductionCouponPrice,jdbcType=DECIMAL}"); + sql.SET("deduction_product_price = #{record.deductionProductPrice,jdbcType=DECIMAL}"); sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}"); sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); @@ -686,8 +716,20 @@ public class HighGasOrderSqlProvider { sql.SET("store_name = #{storeName,jdbcType=VARCHAR}"); } - if (record.getDeductionPrice() != null) { - sql.SET("deduction_price = #{deductionPrice,jdbcType=DECIMAL}"); + if (record.getStoreAddress() != null) { + sql.SET("store_address = #{storeAddress,jdbcType=VARCHAR}"); + } + + if (record.getTotalDeductionPrice() != null) { + sql.SET("total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionCouponPrice() != null) { + sql.SET("deduction_coupon_price = #{deductionCouponPrice,jdbcType=DECIMAL}"); + } + + if (record.getDeductionProductPrice() != null) { + sql.SET("deduction_product_price = #{deductionProductPrice,jdbcType=DECIMAL}"); } if (record.getPayablePrice() != null) { diff --git a/hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapperExt.java index a805c217..46951c49 100644 --- a/hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighMerchantAccountMapperExt.java @@ -14,12 +14,9 @@ public interface HighMerchantAccountMapperExt { @Select({"select " + - " case when sum(a.gas_price_cost_total) is not null then sum(a.gas_price_cost_total) ELSE 0 end " + - " from high_child_order a, high_order b" + - " where goods_type = 3 " + - " and a.order_id = b.id" + - " and goods_id in (SELECT id from high_merchant_store where merchant_id = #{merId}) " + - " and b.order_status in (2,3,6,7)"}) + " case when sum(gas_price_cost) is not null then sum(gas_price_cost) ELSE 0 end " + + " from high_gas_order " + + " where store_id in (SELECT id from high_merchant_store where merchant_id = #{merId}) and `status` in (2,5,6)"}) BigDecimal countMerGasOilAmount(@Param("merId") Long merId); @Select({ diff --git a/hai-service/src/main/java/com/hai/entity/HighGasOrder.java b/hai-service/src/main/java/com/hai/entity/HighGasOrder.java index 5c3a5b4e..83664020 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasOrder.java @@ -80,9 +80,24 @@ public class HighGasOrder implements Serializable { private String storeName; /** - * 优惠金额 + * 门店地址 */ - private BigDecimal deductionPrice; + private String storeAddress; + + /** + * 交易总优惠金额(优惠券优惠金额+产品优惠金额 + */ + private BigDecimal totalDeductionPrice; + + /** + * 优惠券优惠金额 + */ + private BigDecimal deductionCouponPrice; + + /** + * 产品优惠金额 + */ + private BigDecimal deductionProductPrice; /** * 应付金额 @@ -393,12 +408,36 @@ public class HighGasOrder implements Serializable { this.storeName = storeName; } - public BigDecimal getDeductionPrice() { - return deductionPrice; + public String getStoreAddress() { + return storeAddress; + } + + public void setStoreAddress(String storeAddress) { + this.storeAddress = storeAddress; + } + + public BigDecimal getTotalDeductionPrice() { + return totalDeductionPrice; + } + + public void setTotalDeductionPrice(BigDecimal totalDeductionPrice) { + this.totalDeductionPrice = totalDeductionPrice; + } + + public BigDecimal getDeductionCouponPrice() { + return deductionCouponPrice; + } + + public void setDeductionCouponPrice(BigDecimal deductionCouponPrice) { + this.deductionCouponPrice = deductionCouponPrice; + } + + public BigDecimal getDeductionProductPrice() { + return deductionProductPrice; } - public void setDeductionPrice(BigDecimal deductionPrice) { - this.deductionPrice = deductionPrice; + public void setDeductionProductPrice(BigDecimal deductionProductPrice) { + this.deductionProductPrice = deductionProductPrice; } public BigDecimal getPayablePrice() { @@ -770,7 +809,10 @@ public class HighGasOrder implements Serializable { && (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName())) - && (this.getDeductionPrice() == null ? other.getDeductionPrice() == null : this.getDeductionPrice().equals(other.getDeductionPrice())) + && (this.getStoreAddress() == null ? other.getStoreAddress() == null : this.getStoreAddress().equals(other.getStoreAddress())) + && (this.getTotalDeductionPrice() == null ? other.getTotalDeductionPrice() == null : this.getTotalDeductionPrice().equals(other.getTotalDeductionPrice())) + && (this.getDeductionCouponPrice() == null ? other.getDeductionCouponPrice() == null : this.getDeductionCouponPrice().equals(other.getDeductionCouponPrice())) + && (this.getDeductionProductPrice() == null ? other.getDeductionProductPrice() == null : this.getDeductionProductPrice().equals(other.getDeductionProductPrice())) && (this.getPayablePrice() == null ? other.getPayablePrice() == null : this.getPayablePrice().equals(other.getPayablePrice())) && (this.getPayGold() == null ? other.getPayGold() == null : this.getPayGold().equals(other.getPayGold())) && (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) @@ -833,7 +875,10 @@ public class HighGasOrder implements Serializable { result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode()); - result = prime * result + ((getDeductionPrice() == null) ? 0 : getDeductionPrice().hashCode()); + result = prime * result + ((getStoreAddress() == null) ? 0 : getStoreAddress().hashCode()); + result = prime * result + ((getTotalDeductionPrice() == null) ? 0 : getTotalDeductionPrice().hashCode()); + result = prime * result + ((getDeductionCouponPrice() == null) ? 0 : getDeductionCouponPrice().hashCode()); + result = prime * result + ((getDeductionProductPrice() == null) ? 0 : getDeductionProductPrice().hashCode()); result = prime * result + ((getPayablePrice() == null) ? 0 : getPayablePrice().hashCode()); result = prime * result + ((getPayGold() == null) ? 0 : getPayGold().hashCode()); result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); @@ -899,7 +944,10 @@ public class HighGasOrder implements Serializable { sb.append(", merName=").append(merName); sb.append(", storeId=").append(storeId); sb.append(", storeName=").append(storeName); - sb.append(", deductionPrice=").append(deductionPrice); + sb.append(", storeAddress=").append(storeAddress); + sb.append(", totalDeductionPrice=").append(totalDeductionPrice); + sb.append(", deductionCouponPrice=").append(deductionCouponPrice); + sb.append(", deductionProductPrice=").append(deductionProductPrice); sb.append(", payablePrice=").append(payablePrice); sb.append(", payGold=").append(payGold); sb.append(", payPrice=").append(payPrice); diff --git a/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java index 53b7c9eb..bdf025fe 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java @@ -976,63 +976,253 @@ public class HighGasOrderExample { return (Criteria) this; } - public Criteria andDeductionPriceIsNull() { - addCriterion("deduction_price is null"); + public Criteria andStoreAddressIsNull() { + addCriterion("store_address is null"); return (Criteria) this; } - public Criteria andDeductionPriceIsNotNull() { - addCriterion("deduction_price is not null"); + public Criteria andStoreAddressIsNotNull() { + addCriterion("store_address is not null"); return (Criteria) this; } - public Criteria andDeductionPriceEqualTo(BigDecimal value) { - addCriterion("deduction_price =", value, "deductionPrice"); + public Criteria andStoreAddressEqualTo(String value) { + addCriterion("store_address =", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceNotEqualTo(BigDecimal value) { - addCriterion("deduction_price <>", value, "deductionPrice"); + public Criteria andStoreAddressNotEqualTo(String value) { + addCriterion("store_address <>", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceGreaterThan(BigDecimal value) { - addCriterion("deduction_price >", value, "deductionPrice"); + public Criteria andStoreAddressGreaterThan(String value) { + addCriterion("store_address >", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { - addCriterion("deduction_price >=", value, "deductionPrice"); + public Criteria andStoreAddressGreaterThanOrEqualTo(String value) { + addCriterion("store_address >=", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceLessThan(BigDecimal value) { - addCriterion("deduction_price <", value, "deductionPrice"); + public Criteria andStoreAddressLessThan(String value) { + addCriterion("store_address <", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceLessThanOrEqualTo(BigDecimal value) { - addCriterion("deduction_price <=", value, "deductionPrice"); + public Criteria andStoreAddressLessThanOrEqualTo(String value) { + addCriterion("store_address <=", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceIn(List values) { - addCriterion("deduction_price in", values, "deductionPrice"); + public Criteria andStoreAddressLike(String value) { + addCriterion("store_address like", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceNotIn(List values) { - addCriterion("deduction_price not in", values, "deductionPrice"); + public Criteria andStoreAddressNotLike(String value) { + addCriterion("store_address not like", value, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("deduction_price between", value1, value2, "deductionPrice"); + public Criteria andStoreAddressIn(List values) { + addCriterion("store_address in", values, "storeAddress"); return (Criteria) this; } - public Criteria andDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("deduction_price not between", value1, value2, "deductionPrice"); + public Criteria andStoreAddressNotIn(List values) { + addCriterion("store_address not in", values, "storeAddress"); + return (Criteria) this; + } + + public Criteria andStoreAddressBetween(String value1, String value2) { + addCriterion("store_address between", value1, value2, "storeAddress"); + return (Criteria) this; + } + + public Criteria andStoreAddressNotBetween(String value1, String value2) { + addCriterion("store_address not between", value1, value2, "storeAddress"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceIsNull() { + addCriterion("total_deduction_price is null"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceIsNotNull() { + addCriterion("total_deduction_price is not null"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceEqualTo(BigDecimal value) { + addCriterion("total_deduction_price =", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <>", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceGreaterThan(BigDecimal value) { + addCriterion("total_deduction_price >", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price >=", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceLessThan(BigDecimal value) { + addCriterion("total_deduction_price <", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("total_deduction_price <=", value, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceIn(List values) { + addCriterion("total_deduction_price in", values, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotIn(List values) { + addCriterion("total_deduction_price not in", values, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price between", value1, value2, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andTotalDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("total_deduction_price not between", value1, value2, "totalDeductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIsNull() { + addCriterion("deduction_coupon_price is null"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIsNotNull() { + addCriterion("deduction_coupon_price is not null"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price =", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price <>", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceGreaterThan(BigDecimal value) { + addCriterion("deduction_coupon_price >", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price >=", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceLessThan(BigDecimal value) { + addCriterion("deduction_coupon_price <", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_coupon_price <=", value, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceIn(List values) { + addCriterion("deduction_coupon_price in", values, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotIn(List values) { + addCriterion("deduction_coupon_price not in", values, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_coupon_price between", value1, value2, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionCouponPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_coupon_price not between", value1, value2, "deductionCouponPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIsNull() { + addCriterion("deduction_product_price is null"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIsNotNull() { + addCriterion("deduction_product_price is not null"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceEqualTo(BigDecimal value) { + addCriterion("deduction_product_price =", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotEqualTo(BigDecimal value) { + addCriterion("deduction_product_price <>", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceGreaterThan(BigDecimal value) { + addCriterion("deduction_product_price >", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_product_price >=", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceLessThan(BigDecimal value) { + addCriterion("deduction_product_price <", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_product_price <=", value, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceIn(List values) { + addCriterion("deduction_product_price in", values, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotIn(List values) { + addCriterion("deduction_product_price not in", values, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_product_price between", value1, value2, "deductionProductPrice"); + return (Criteria) this; + } + + public Criteria andDeductionProductPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_product_price not between", value1, value2, "deductionProductPrice"); return (Criteria) this; } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 06a67a1f..e4d58198 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -338,12 +338,16 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setMerName(merchant.getMerchantName()); gasOrder.setStoreId(store.getId()); gasOrder.setStoreName(store.getStoreName()); + gasOrder.setStoreAddress(store.getAddress()); gasOrder.setGasRefuelPrice(childOrder.getGoodsPrice()); gasOrder.setGasOilNo(createOrderChild.getGasOilNo()); gasOrder.setGasGunNo(createOrderChild.getGasGunNo()); gasOrder.setGasOilType(Integer.parseInt(gasOilType.getExt1())); gasOrder.setStatus(OrderOilStatus.STATUS1.getNumber()); gasOrder.setGasDiscount(new BigDecimal("0")); + gasOrder.setTotalDeductionPrice(new BigDecimal("0")); + gasOrder.setDeductionCouponPrice(new BigDecimal("0")); + gasOrder.setDeductionProductPrice(new BigDecimal("0")); // 成本价 油站价 减 营销策略价 gasOrder.setGasPriceCost(priceModel.getPriceGun().subtract(marketingPrice)); @@ -364,20 +368,20 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { if (gasOrder.getGasRefuelPrice().compareTo(discountUserRel.getHighDiscount().getDiscountCondition()) > 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+discountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券"); } - gasOrder.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + gasOrder.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); } else if (discountUserRel.getHighDiscount().getDiscountType() == 2) { - gasOrder.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + gasOrder.setDeductionCouponPrice(discountUserRel.getHighDiscount().getDiscountPrice()); } else if (discountUserRel.getHighDiscount().getDiscountType() == 3) { // 加油金额 * 折扣 BigDecimal deductionPrice = gasOrder.getGasRefuelPrice() .multiply(discountUserRel.getHighDiscount().getDiscountPrice()) .setScale(2, BigDecimal.ROUND_HALF_DOWN); - gasOrder.setDeductionPrice(gasOrder.getGasRefuelPrice().subtract(deductionPrice)); + gasOrder.setDeductionCouponPrice(gasOrder.getGasRefuelPrice().subtract(deductionPrice)); } - gasOrder.setPayablePrice(gasOrder.getGasRefuelPrice().subtract(gasOrder.getDeductionPrice())); + gasOrder.setPayablePrice(gasOrder.getGasRefuelPrice().subtract(gasOrder.getTotalDeductionPrice())); if (gasOrder.getPayablePrice().compareTo(new BigDecimal("0")) < 0) { gasOrder.setPayablePrice(new BigDecimal("0")); } @@ -392,11 +396,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasOilSubsidy(new BigDecimal("0")); gasOrder.setGasLitersPreferences(new BigDecimal("0")); gasOrder.setGasPricePreferences(priceModel.getPriceGun()); - } - else { + } else { // 支付价格 childOrder.setGoodsActualPrice(priceModel.getPayPrice()); - gasOrder.setDeductionPrice(priceModel.getTotalPreferences()); + gasOrder.setDeductionCouponPrice(priceModel.getTotalPreferences()); gasOrder.setPayablePrice(priceModel.getPayPrice()); // 油价信息 @@ -410,7 +413,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasLitersPreferences(priceModel.getLitersPreferences()); gasOrder.setGasPricePreferences(priceModel.getPricePreferences()); } - + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); gasOrder.setPayGold(createOrderModel.getPayGold()!=null?createOrderModel.getPayGold():0); if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { 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 e8031b7c..e5de6753 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 @@ -132,7 +132,6 @@ public class HighUserServiceImpl implements HighUserService { HighUserModel highUserModel = new HighUserModel(); highUserModel.setHighUser(getDetailDataByUser(user.getId())); SessionObject so = new SessionObject(AESEncodeUtil.base64Encode(AESEncodeUtil.aesEncryptToBytes(user.getPhone(), "123")), 1 , highUserModel); - so.setType(1); userCenter.save(null,null,so); return highUserModel; diff --git a/hai-user/src/main/java/com/web/config/AuthConfig.java b/hai-user/src/main/java/com/web/config/AuthConfig.java index 0f8cd206..ff6367b1 100644 --- a/hai-user/src/main/java/com/web/config/AuthConfig.java +++ b/hai-user/src/main/java/com/web/config/AuthConfig.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.hai.common.security.UserCenter; -import com.hai.common.utils.RequestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,32 +53,77 @@ public class AuthConfig implements WebMvcConfigurer { } public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(new HandlerInterceptorAdapter() { + registry.addInterceptor(new HandlerInterceptorAdapter() { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) throws Exception { + if(debug){ + return true; + } + String token = request.getParameter("Authorization"); + if (StringUtils.isBlank(token)) { + token = request.getHeader("Authorization"); + } + if((StringUtils.isNotBlank(token) && userCenter.isTokenLogin(token)) || userCenter.isLogin(request)){//如果未登录,将无法使用任何接口 + userCenter.refreshCookie(request, response); + return true; + } else if(request instanceof StandardMultipartHttpServletRequest) { + StandardMultipartHttpServletRequest re = (StandardMultipartHttpServletRequest)request; + if(userCenter.isLogin(re.getRequest())){ + return true; + } else { + log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); + response.setStatus(401); + return false; + } + } else{ + log.error("the user is not logged in,remoteAddr:"+getIpAddress(request)+",requestUrl:"+request.getRequestURL()); + response.setStatus(401); + return false; + } + } + }) + .addPathPatterns("/**") + .excludePathPatterns("/swagger-resources/**") + .excludePathPatterns("/**/api-docs") + .excludePathPatterns("/**/springfox-swagger-ui/**") + .excludePathPatterns("/**/swagger-ui.html") + .excludePathPatterns("/login/*") + .excludePathPatterns("/sms/*") + ; + } + + public String getIpAddress(HttpServletRequest request) { + // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址 + String ip = request.getHeader("X-Forwarded-For"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + } else if (ip.length() > 15) { + String[] ips = ip.split(","); + for (int index = 0; index < ips.length; index++) { + String strIp = ips[index]; + if (!("unknown".equalsIgnoreCase(strIp))) { + ip = strIp; + break; + } + } + } + return ip; + } - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, - Object handler) throws Exception { - if(debug){ - return true; - } - String token = request.getHeader("Authorization"); - if (StringUtils.isNotBlank(token)) { - if(userCenter.isLogin(request) == true) { - return true; - } - } - log.error("the user is not logged in,remoteAddr:"+ RequestUtils.getIpAddress(request)+",requestUrl:"+request.getRequestURL()); - response.setStatus(401); - return false; - } - }) - .addPathPatterns("/**") - .excludePathPatterns("/swagger-resources/**") - .excludePathPatterns("/**/api-docs") - .excludePathPatterns("/**/springfox-swagger-ui/**") - .excludePathPatterns("/**/swagger-ui.html") - .excludePathPatterns("/login/*") - .excludePathPatterns("/sms/*") - ; - } } diff --git a/hai-user/src/main/java/com/web/controller/CoresController.java b/hai-user/src/main/java/com/web/controller/CoresController.java index 3ac133c6..fd7124cc 100644 --- a/hai-user/src/main/java/com/web/controller/CoresController.java +++ b/hai-user/src/main/java/com/web/controller/CoresController.java @@ -8,11 +8,17 @@ import com.hai.common.security.UserCenter; import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.entity.HighOilCard; +import com.hai.entity.HighUserCard; import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.RedisFileFolder; +import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; +import com.hai.service.HighOilCardService; +import com.hai.service.HighUserCardService; import com.hai.service.HighUserService; import com.web.type.LoginType; import io.swagger.annotations.Api; @@ -30,6 +36,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @className: CoresController @@ -50,9 +58,76 @@ public class CoresController { @Resource private HighUserService userService; + @Resource + private HighUserCardService userCardService; + + @Resource + private HighOilCardService oilCardService; + @Resource private UserCenter userCenter; + @RequestMapping(value = "/getUserDetail", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "获取用户详情") + public ResponseData getUserDetail(HttpServletRequest request, HttpServletResponse response) { + try { + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + log.error("CoresController --> outLogin() error!", "用户身份错误或已过期"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + return ResponseMsgUtil.success(userService.getDetailDataByUser(userInfoModel.getHighUser().getId())); + + } catch (Exception e) { + log.error("CoresController --> getUserDetail() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getUserAccount", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "获取用户账户余额") + public ResponseData getUserAccount(HttpServletRequest request, HttpServletResponse response) { + try { + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + log.error("CoresController --> outLogin() error!", "用户身份错误或已过期"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + + Map map = new HashMap<>(); + map.put("integral", userService.findByUserId(userInfoModel.getHighUser().getId()).getGold()); + map.put("oilCardPrice", 0); + map.put("hltCardPrice", 0); + + // 嗨森逛油卡 + List oilCardList = userCardService.getListByUser(userInfoModel.getHighUser().getId(), UserCardType.type2.getType()); + if (oilCardList.size() > 0) { + // 查询油卡 + HighOilCard oilCard = oilCardService.getOilCardByCardNo(oilCardList.get(0).getCardNo()); + if (oilCard != null) { + map.put("oilCardPrice", oilCard.getAmount()); + } + } + + // 贵州汇联通工会卡 + List hltCardList = userCardService.getListByUser(userInfoModel.getHighUser().getId(), UserCardType.type1.getType()); + if (hltCardList.size() > 0) { + // 查询油卡 + JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(oilCardList.get(0).getCardNo()); + if (StringUtils.isBlank(cardInfo.getString("data"))) { + map.put("hltCardPrice", cardInfo.getString("data")); + } + } + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error("CoresController --> getUserAccount() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/outLogin", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "退出登录")