This commit is contained in:
wangh 2024-01-19 10:15:57 +08:00
commit 93d27e996e
35 changed files with 608 additions and 417 deletions

View File

@ -105,7 +105,7 @@
<span></span> <el-input-number v-model="item.amount" :min="0" :max="99999" label="0"></el-input-number> <span></span>
</div>
<div style="width: 25%;display: flex; align-items: center;">
<span></span> <el-input-number v-model="item.discount" :min="0" :max="10" placeholder="1 ~ 9.9" label=""></el-input-number> <span></span>
<span></span> <el-input-number v-model="item.discount" :min="0" :max="9.9" placeholder="1 ~ 9.9" label=""></el-input-number> <span></span>
</div>
<div @click="deleteactiveDiscountChildList(index)">

View File

@ -174,12 +174,12 @@
<el-form-item label="满足金额" prop="satisfiedAmount" v-if="form.discountType == 1">
<el-input v-model="form.satisfiedAmount" placeholder="请输入满足金额" />
</el-form-item>
<el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">
<el-input v-model="form.specialDiscount" placeholder="请输入优惠折扣" />
<el-form-item label="优惠折扣" prop="specialDiscount" v-if="form.discountType == 1">
<el-input-number v-model="form.specialDiscount" :min="0" :max="9.9" placeholder="1 ~ 9.9"/>
</el-form-item>
<el-form-item label="折扣抵消" prop="discountOffset" v-if="form.discountType == 1">
<!-- <el-form-item label="折扣抵消" prop="discountOffset" v-if="form.discountType == 1">
<el-input v-model="form.discountOffset" placeholder="请输入折扣抵消" />
</el-form-item>
</el-form-item>-->
<el-form-item label="生效日期" prop="timeType">
<el-radio-group v-model="form.timeType">
<!-- 0 -->
@ -460,9 +460,6 @@ export default {
checkTime: [
{ required: true, message: '不能为空', trigger: 'change' }
],
exclusiveFunction: [
{ required: true, message: '不能为空', trigger: 'change' }
],
claimRule: [
{ required: true, message: '不能为空', trigger: 'change' }
],

View File

@ -330,7 +330,7 @@ export default {
if (res.data===1){
this.$modal.msgSuccess("修改成功")
this.getList()
this.show = false
this.dialogVisible = false
}
})
}else {

View File

@ -59,38 +59,24 @@
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
<el-table-column label="核销权限" align="center" prop="writeOff">
</el-table-column>
<el-table-column label="特殊权限" align="center" prop="specialPrem">
</el-table-column>
<el-table-column label="退款权限" align="center" prop="refund">
<el-table-column label="员工角色" align="center" prop="roleId" >
<template slot-scope="scope">
<dict-tag :options="dict.type.ywqx" :value="scope.row.refund"/>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="storeName">
<template slot-scope="scope">
<el-switch
v-model="scope.row.auditedStatus"
active-value="A"
inactive-value="N"
@change="handleStatusChange(scope.row)"
></el-switch>
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">普通员工</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="员工状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.zhzt" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="公众号" align="center" prop="official">
<template slot-scope="scope">
<dict-tag :options="dict.type.official" :value="scope.row.official"/>
</template>
</el-table-column>
<!-- <el-table-column label="公众号" align="center" prop="official">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.official" :value="scope.row.official"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="一键加油" align="center" prop="isRefuel">
<template slot-scope="scope">
<dict-tag :options="dict.type.display" :value="scope.row.isRefuel"/>
@ -106,25 +92,23 @@
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime" width="150">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="更新时间" align="center" prop="updateTime" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.updateTime) }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['staff:list']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-hasPermi="['staff:list']"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
@ -143,21 +127,6 @@
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- <el-row>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="员工类别" prop="category">-->
<!-- <el-select v-model="form.category" placeholder="请选择员工类别">-->
<!-- <el-option key="0" label="请选择员工类别" value="0"></el-option>-->
<!-- <el-option-->
<!-- v-for="item in categoryOptions"-->
<!-- :key="item.key"-->
<!-- :label="item.name"-->
<!-- :value="item.key"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row>
<el-col :span="8">
<el-form-item label="姓名" prop="realName">
@ -169,68 +138,22 @@
<el-input v-model="form.mobile" placeholder="请输入联系人电话" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="角色组" prop="role">
<el-select v-model="form.role" placeholder="请选择角色">
<el-option
v-for="dict in dict.type.role"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
<el-select v-model="form.roleId" placeholder="请选择角色">
<el-option label="油站站长" :value="12" ></el-option>
<el-option label="普通员工" :value="15" ></el-option>
<el-option label="收银员" :value="16" ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="登录密码" prop="password">
<el-input v-model="form.password" placeholder="请输入登录密码" maxlength="30"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退款权限" prop="refund">
<el-select v-model="form.refund" placeholder="请选择权限">
<el-option
v-for="dict in dict.type.ywqx"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="退款密码" prop="refundPassword">
<el-input v-model="form.applypassword" placeholder="请输入登录密码" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10" style="display: flex;margin-bottom: 20px">
<template>
<span style="margin-right: 10px">核销权限</span>
<el-checkbox-group v-model="writeOff" ref="" @change="getCheckbox">
<el-checkbox
v-for="dict in dict.type.write_off"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
</template>
</el-col>
<el-col :span="14" style="display: flex">
<span style="margin-right: 10px">特殊权限</span>
<el-checkbox-group v-model="specialPrem" @change="getCheckbox">
<el-checkbox
v-for="dict in dict.type.special_prem"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-checkbox>
</el-checkbox-group>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
@ -253,48 +176,6 @@
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="POS加油员" prop="pos">
<el-select v-model="form.pos">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 启用后,当前账户登录POS端后油品收银必选加油员才可进行<br/>下步操作(需系统开启加油选择加油员功能) </div>
<span>启用后,当前账户登录POS端后油...</span>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交易统计" prop="transaction">
<el-select v-model="form.transaction">
<el-option
v-for="dict in dict.type.transaction"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交易订单显示信息终端支持:(PC<br/>POS小程序) </div>
<span>交易订单显示信息终端支持:(PC...</span>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="收款通知" prop="notice">
<el-select v-model="form.notice">
@ -315,182 +196,8 @@
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="指定油枪" prop="oilGunId" v-show="form.notice == 'zdyx'">
<el-select v-model="form.oilGunId">
<el-option
v-for="dict in dict.type.notice"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<span> 多选,已选油枪号的交易将发送模板消息 </span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="时间范围" prop="timeFrame">
<el-select v-model="form.timeFrame">
<el-option
v-for="dict in dict.type.time_frame"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content">当前账户下可查看交易的时间范围(PC<br/>POS端)</div>
<span>当前账户下可查看交易的时间范...</span>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="交班模式" prop="handoverMode">
<el-select v-model="form.handoverMode">
<el-option
v-for="dict in dict.type.handover"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<span> 根据需求自行选择模式 </span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班权限" prop="handoverPrem">
<el-select v-model="form.handoverPrem" placeholder="请选择所属店铺">
<el-option
v-for="dict in dict.type.ywqx"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 若无权限,则无法查看交班统计信息和<br/>进行交班操作 </div>
<span>若无权限,则无法查看交班统计...</span>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班退出" prop="handoverOut">
<el-select v-model="form.handoverOut">
<el-option
v-for="dict in dict.type.handover_quit"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<span> 进行交班处理后是否退出当前账户 </span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="交班记录" prop="record">
<el-select v-model="form.record">
<el-option
v-for="dict in dict.type.jbjl"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 全部记录:查看所有员工交班记录,名下<br/>记录:员工自己名下记录(需有交班权限才可查看),<br/>禁用权限:无权限查看交班记录,记录为空 </div>
<span>全部记录:查看所有员工交班记录...</span>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="交班商户号" prop="merchantStatus">
<el-select v-model="form.merchantStatus">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交班信息是否显示商户号统计信息,<br/>用后当前员工则无商户号统计信息 </div>
<span>交班信息是否显示商户号统计信...</span>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="员工筛选" prop="screen">
<el-select v-model="form.screen">
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<br/>
<el-tooltip
class="item"
effect="dark"
placement="bottom">
<div slot="content"> 交易信息是否可以筛选员工进行查<br/>,启用后可筛选则反之 </div>
<span>交易信息是否可以筛选员工进行...</span>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="POS权限" prop="posPrem">
<div class="block">
<el-cascader
v-model="posPrem"
:options="posOptions"
:props="props"
@change="handleNodeClick1"
clearable></el-cascader>
<br/>
<span> POS手持机中功能对应操作权限 </span>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="小程序权限" prop="appletPrem">
<div class="block">
<el-cascader
v-model="appletPrem"
:options="appletOptions"
:props="props"
@change="handleNodeClick2"
clearable></el-cascader>
<br/>
<span> 小程序管理端功能对应操作权限 </span>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="账户状态" prop="status">
<el-select v-model="form.status">

View File

@ -469,6 +469,7 @@ public class FyPayServiceImpl implements FyPayService {
returnParameter.setReservedTransactionId(resMap.get("reserved_transaction_id"));
res.put("data",returnParameter);
res.put("resultMsg",resMap.get("result_msg"));
return res;
}else {
throw new Exception("验签失败,请联系管理员!");

View File

@ -42,7 +42,7 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
for (int i = 0; i < list.size(); i++) {
MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(i).getMerchConfigId());
amountAll += merchantConfig.getAmount();
proList.add((double) (list.get(i).getProportion()/100));
proList.add(list.get(i).getProportion()/100.0);
radioList.add(merchantConfig.getAmount()/amountAll);
distanceList.add(proList.get(i) - radioList.get(i));
}

View File

@ -9,14 +9,28 @@ import java.math.BigDecimal;
public class ActiveDiscountPayVO implements Serializable {
//活动id
private Integer activeId;
//1满减2折扣
private String type;
//活动名称
private String activeName;
//满足金额
private BigDecimal amount;
//折扣
//折扣
private BigDecimal discount;
//活动优惠价格
private BigDecimal activeDiscount;
//折扣
private double discounts;
//可用油品
private String oilId;
//适用会员
private String adaptUser;
//参与条件 0不限制 1优惠订单不参与
private String participationCondition;
//优惠券id
private Integer couponId;
//优惠券金额
private BigDecimal cardFavorableAmount;
//优惠券信息
private String cardFavorableInfo;
}

View File

@ -93,12 +93,12 @@ public class ActiveExchangeController extends BaseController {
/**
* test
* 满减折扣优惠券会员等级总优惠
* @param paymentActiveDTO
* @return
*/
@PostMapping("test")
public ResponseObject paymentActiveVO(@RequestBody PaymentActiveDTO paymentActiveDTO) {
@GetMapping("getPaymentActive")
public ResponseObject getPaymentActive(PaymentActiveDTO paymentActiveDTO) {
return getSuccessResult(this.activeExchangeService.paymentActive(paymentActiveDTO));
}

View File

@ -17,4 +17,6 @@ public class PaymentActiveDTO implements Serializable {
private Integer storeId;
//会员等级
private Integer mtUserLevel;
//用户id
private Integer userId;
}

View File

@ -56,4 +56,10 @@ public interface ActiveExchangeService {
* @return
*/
PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO);
/**
* 消费有礼后续处理
* @param paymentActiveDTO
*/
void activeConsumption(PaymentActiveDTO paymentActiveDTO);
}

View File

@ -1,5 +1,7 @@
package com.fuint.business.marketingActivity.activeExchange.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@ -32,8 +34,11 @@ import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeReco
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
import com.fuint.business.marketingActivity.cardFavorable.vo.CouponVO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.business.marketingActivity.cardValue.service.CardValueService;
import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO;
@ -41,10 +46,14 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserGradeMapper;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.LJUserService;
@ -53,6 +62,7 @@ import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -60,9 +70,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -82,6 +91,8 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
@Resource
private LJUserGradeService userGradeService;
@Resource
private LJUserGradeMapper ljUserGradeMapper;
@Resource
private CardFavorableService cardFavorableService;
@Resource
private ActiveConsumptionService activeConsumptionService;
@ -94,15 +105,17 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
@Resource
private OilOrderMapper oilOrderMapper;
@Resource
private LJUserMapper ljUserMapper;
@Resource
private UserBalanceService userBalanceService;
@Resource
private ILJStoreService iljStoreService;
@Autowired
private LJUserService userService;
@Resource
private CardValueOrdersMapper cardValueOrdersMapper;
private CardFavorableRecordMapper cardFavorableRecordMapper;
@Resource
private OilNameMapper oilNameMapper;
@Resource
private OilNumberMapper oilNumberMapper;
/**
* 分页查询所有
* @param
@ -423,49 +436,313 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
public PaymentActiveVO paymentActive(PaymentActiveDTO paymentActiveDTO) {
PaymentActiveVO paymentActiveVO = new PaymentActiveVO();
Integer storeId = paymentActiveDTO.getStoreId();
BigDecimal amount = new BigDecimal("0.00");
BigDecimal fullAmount = new BigDecimal("0.00");
BigDecimal a = new BigDecimal("0.1");
BigDecimal b = new BigDecimal("10");
double finalAmount = 0.00;
Integer userId = TokenUtil.getNowAccountInfo().getId();
//折扣
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel());
//满减
List<ActiveDiscountPayVO> activeFuletVOList = oilOrderMapper.selectActiveFule(storeId,paymentActiveDTO.getAmount(),paymentActiveDTO.getOilId(),paymentActiveDTO.getMtUserLevel());
//优惠券
paymentActiveDTO.setUserId(userId);
List<CardFavorableRecordVO> canUserCardFavorableList = cardFavorableRecordMapper.getCanUserCardFavorableList(paymentActiveDTO);
//会员等级当前优惠力度最大
//无限制条件的活动列表
List<ActiveDiscountPayVO> resList =new ArrayList<>();
//无限制条件的优惠券的列表
ArrayList<CardFavorableRecordVO> cardFavorableRecordVOS = new ArrayList<>();
//优惠券和折扣活动的组合列表
ArrayList<ActiveDiscountPayVO> cardAndDisPays = new ArrayList<>();
//优惠券和满减活动的组合列表
ArrayList<ActiveDiscountPayVO> cardAndComPays = new ArrayList<>();
//折扣
List<ActiveDiscountPayVO> activeDiscountVOList = oilOrderMapper.selectActiveDiscount(storeId,paymentActiveDTO.getAmount());
if (CollectionUtils.isNotEmpty(activeDiscountVOList)){
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
if (activeDiscountPayVO.getAmount().multiply(activeDiscountPayVO.getDiscount()).compareTo(amount) > 0){
amount = paymentActiveDTO.getAmount().subtract(((b.subtract(activeDiscountPayVO.getDiscount())).multiply(paymentActiveDTO.getAmount()).multiply(a)));
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
paymentActiveVO.setAmount(amount);
paymentActiveVO.setFavorableAmount((b.subtract(activeDiscountPayVO.getDiscount())).multiply(activeDiscountPayVO.getAmount()).multiply(a));
}
if (activeDiscountPayVO.getParticipationCondition().equals("0")){
activeDiscountPayVO.setType("2");
activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount());
resList.add(activeDiscountPayVO);
}
}
}
//满减
List<ActiveDiscountPayVO> activeFuletVOList = oilOrderMapper.selectActiveFule(storeId,paymentActiveDTO.getAmount());
if (CollectionUtils.isNotEmpty(activeFuletVOList)){
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) {
if (activeDiscountPayVO.getOilId().contains(paymentActiveDTO.getOilId().toString()) &&
activeDiscountPayVO.getAdaptUser().contains(paymentActiveDTO.getMtUserLevel().toString())){
//如果满足条件
if ((paymentActiveDTO.getAmount()).compareTo(activeDiscountPayVO.getAmount()) >= 0){
fullAmount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount());
if (amount.compareTo(fullAmount) > 0){
amount = paymentActiveDTO.getAmount().subtract(activeDiscountPayVO.getDiscount());
paymentActiveVO.setActiveId(activeDiscountPayVO.getActiveId());
paymentActiveVO.setAmount(amount);
paymentActiveVO.setFavorableAmount(paymentActiveDTO.getAmount().subtract(fullAmount));
}
}
if (activeDiscountPayVO.getParticipationCondition().equals("0")){
activeDiscountPayVO.setActiveDiscount(activeDiscountPayVO.getDiscount());
activeDiscountPayVO.setType("1");
resList.add(activeDiscountPayVO);
}
}
}
//优惠券
if (CollectionUtils.isNotEmpty(canUserCardFavorableList)){
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){
cardFavorableRecordVOS.add(cardFavorableRecordVO);
}
}
}
//折扣+优惠券
for (ActiveDiscountPayVO activeDiscountPayVO : activeDiscountVOList) {
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if(cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
BigDecimal discount = activeDiscountPayVO1.getDiscount();
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndDisPays.add(activeDiscountPayVO1);
}else if( !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
String[] split = cardFavorableRecordVO.getOilType().split(",");
if(paymentActiveDTO.getOilId().equals(split)){
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
BigDecimal discount = activeDiscountPayVO1.getDiscount();
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndDisPays.add(activeDiscountPayVO1);
}
}
}
}
//满减+优惠券
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) {
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if(cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
BigDecimal discount = activeDiscountPayVO1.getDiscount();
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndComPays.add(activeDiscountPayVO1);
}else if (!cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
String[] split = cardFavorableRecordVO.getOilType().split(",");
if(paymentActiveDTO.getOilId().equals(split)){
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
double discountAmount = cardFavorableRecordVO.getDiscountAmount();
activeDiscountPayVO1.setActiveDiscount(activeDiscountPayVO1.getDiscount());
BigDecimal bigDecimal = BigDecimal.valueOf(discountAmount);
BigDecimal discount = activeDiscountPayVO1.getDiscount();
activeDiscountPayVO1.setDiscount(bigDecimal.add(discount));
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndComPays.add(activeDiscountPayVO1);
}
}
}
}
for (ActiveDiscountPayVO activeDiscountPayVO : resList) {
double v = activeDiscountPayVO.getDiscount().doubleValue();
activeDiscountPayVO.setDiscounts(v);
}
for (ActiveDiscountPayVO activeDiscountPayVO : cardAndDisPays) {
double v = activeDiscountPayVO.getDiscount().doubleValue();
activeDiscountPayVO.setDiscounts(v);
}
for (ActiveDiscountPayVO activeDiscountPayVO : cardAndComPays) {
double v = activeDiscountPayVO.getDiscount().doubleValue();
activeDiscountPayVO.setDiscounts(v);
}
ArrayList<ActiveDiscountPayVO> activeDiscountPayVOS = new ArrayList<>();
//1.无限制条件的活动和优惠券分别选出一个优惠最大的来
//活动
if (CollectionUtils.isNotEmpty(resList)){
ActiveDiscountPayVO activeDiscountPayVO = resList.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
activeDiscountPayVOS.add(activeDiscountPayVO);
}
//优惠券
CardFavorableRecordVO cardFavorableRecordVO = new CardFavorableRecordVO();
if (CollectionUtils.isNotEmpty(cardFavorableRecordVOS)){
cardFavorableRecordVO = cardFavorableRecordVOS.stream().max(Comparator.comparingDouble(CardFavorableRecordVO::getDiscountAmount)).get();
}
//2.有限制条件的活动和优惠券组合比较出一个优惠最大的来
//满减+优惠券
if (CollectionUtils.isNotEmpty(cardAndDisPays)){
ActiveDiscountPayVO activeDiscountPayVO1 = cardAndDisPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
activeDiscountPayVOS.add(activeDiscountPayVO1);
}
//折扣+优惠券
if (CollectionUtils.isNotEmpty(cardAndComPays)){
ActiveDiscountPayVO activeDiscountPayVO2 = cardAndComPays.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
activeDiscountPayVOS.add(activeDiscountPayVO2);
}
//3.活动和活动+优惠券的组合比较
if (CollectionUtils.isNotEmpty(activeDiscountPayVOS)){
ActiveDiscountPayVO activeDiscountPayVO3 = activeDiscountPayVOS.stream().max(Comparator.comparingDouble(ActiveDiscountPayVO::getDiscounts)).get();
//4. 3和优惠券比较
if(ObjectUtils.isNotEmpty(activeDiscountPayVO3)){
finalAmount = activeDiscountPayVO3.getDiscounts();
if (ObjectUtils.isNotEmpty(cardFavorableRecordVO) && finalAmount < cardFavorableRecordVO.getDiscountAmount()){
PaymentActiveVO paymentActiveVO1 = new PaymentActiveVO();
//单用优惠券优惠力度最大
paymentActiveVO1.setCardFavorableId(cardFavorableRecordVO.getId());
//金额
paymentActiveVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
//优惠券名字
paymentActiveVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName() + ""+cardFavorableRecordVO.getSatisfiedAmount() + "" + cardFavorableRecordVO.getDiscountAmount() + "");
BeanUtils.copyProperties(paymentActiveVO1,paymentActiveVO);
//return paymentActiveVO1;
}else {
PaymentActiveVO paymentActiveVO2 = new PaymentActiveVO();
//活动或活动+优惠券优惠力度最大
paymentActiveVO2.setActiveId(activeDiscountPayVO3.getActiveId());
paymentActiveVO2.setActiveInfo(activeDiscountPayVO3.getActiveName());
paymentActiveVO2.setType(activeDiscountPayVO3.getType());
paymentActiveVO2.setActiveFavorableAmount(activeDiscountPayVO3.getActiveDiscount());
paymentActiveVO2.setCardFavorableId(activeDiscountPayVO3.getCouponId());
paymentActiveVO2.setCardFavorableInfo(activeDiscountPayVO3.getCardFavorableInfo());
paymentActiveVO2.setCardFavorableAmount(activeDiscountPayVO3.getCardFavorableAmount());
BeanUtils.copyProperties(paymentActiveVO2,paymentActiveVO);
//return paymentActiveVO2;
}
}
}
//会员等级优惠
Integer oilId = paymentActiveDTO.getOilId();
double oilPriceById = oilNumberMapper.getOilPriceById(oilId,storeId);
BigDecimal bigDecimal1 = BigDecimal.valueOf(oilPriceById);
String oilTypebyId = oilNameMapper.getOilTypebyId(oilId);
String gradeId = ljUserGradeMapper.selectByUserId(paymentActiveDTO.getStoreId(), userId);
if (StringUtils.isNotEmpty(gradeId)){
LJUserGrade ljUserGrade = ljUserGradeMapper.selectAllByGradeId(gradeId);
if (ObjectUtils.isNotEmpty(ljUserGrade)){
if (oilTypebyId.equals("汽油")){
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("gasolineRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("gasolineRule2");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
}
}
}
}
if (oilTypebyId.equals("柴油")){
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("dieselRule3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getDieselRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("dieselRule1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("dieselRule3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
}
}
}
}
if (oilTypebyId.equals("天然气")){
if (ljUserGrade.getGasolineDiscount().equals("无优惠")){
}else if (ljUserGrade.getGasolineDiscount().equals("每升优惠")){
String gasolineRule = ljUserGrade.getNaturalGasRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
BigDecimal divide = paymentActiveDTO.getAmount().divide(bigDecimal1,2,RoundingMode.HALF_UP);
Integer gasolineRule3 = jsonObject.getInteger("naturalGas3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
BigDecimal multiply = divide.multiply(bigDecimal2);
paymentActiveVO.setMemberFavorableAmount(multiply);
}
}
}else {
String gasolineRule = ljUserGrade.getGasolineRule();
List<JSONObject> jsonObjects = JSONArray.parseArray(gasolineRule, JSONObject.class);
for (JSONObject jsonObject : jsonObjects) {
Integer gasolineRule1 = jsonObject.getInteger("naturalGas1");
BigDecimal bigDecimal = BigDecimal.valueOf(gasolineRule1);
if (paymentActiveDTO.getAmount().compareTo(bigDecimal)>=0){
//升数
Integer gasolineRule3 = jsonObject.getInteger("naturalGas3");
BigDecimal bigDecimal2 = BigDecimal.valueOf(gasolineRule3);
paymentActiveVO.setMemberFavorableAmount(bigDecimal2);
}
}
}
}
}
}
return paymentActiveVO;
}
@Override
public void activeConsumption(PaymentActiveDTO paymentActiveDTO) {
//消费有礼
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(storeId, paymentActiveDTO.getAmount());
List<ActiveConsumptionVO> activeConsumptionVOS = oilOrderMapper.selectActiveConsumption(paymentActiveDTO.getStoreId(), paymentActiveDTO.getAmount());
//连锁店信息
LJUser ljUserVo = userService.queryUserByUserId(TokenUtil.getNowAccountInfo().getId());
String accountName = TokenUtil.getNowAccountInfo().getAccountName();
Integer storeId1 = paymentActiveDTO.getStoreId();
Integer chainStoreId = iljStoreService.selectStoreByStoreId(storeId1).getChainStoreId();
//用户余额
@ -519,6 +796,5 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
}
}
}
return paymentActiveVO;
}
}

View File

@ -9,8 +9,18 @@ import java.math.BigDecimal;
public class PaymentActiveVO implements Serializable {
//活动id
private Integer activeId;
//应付金额
private BigDecimal amount;
//优惠金额
private BigDecimal favorableAmount;
//活动信息
private String activeInfo;
//1满减2折扣
private String type;
//活动优惠金额
private BigDecimal activeFavorableAmount;
//优惠券id
private Integer cardFavorableId;
//优惠券信息
private String cardFavorableInfo;
//优惠券金额
private BigDecimal cardFavorableAmount;
//等级会员优惠金额
private BigDecimal memberFavorableAmount;
}

View File

@ -121,7 +121,7 @@ public class CardFavorableController extends BaseController {
/**
*查询我的优惠券接口(小程序端)
*查询我的券接口(小程序端)
* @param pageNo
* @param pageSize
* @param cardFavorableDTOS

View File

@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardFavorable.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO;
import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -35,5 +36,7 @@ public interface CardFavorableRecordMapper extends BaseMapper<CardFavorableRecor
*/
// List<CouponVO> selectAllByCondition(Integer id);
IPage<CouponVO> selectAllByCondition(@Param("page") Page page, @Param("cardFavorableDTOS") CardFavorableDTOS cardFavorableDTOS);
List<CardFavorableRecordVO> getCanUserCardFavorableList(@Param("paymentActiveDTO") PaymentActiveDTO paymentActiveDTO);
}

View File

@ -116,5 +116,30 @@
</if>
</where>
</select>
<select id="getCanUserCardFavorableList" resultType="com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO">
SELECT
cf.id id,
cf.NAME cardFavorableName,
cf.type type,
cf.discount_amount discountAmount,
cf.oil_type oilType,
cf.satisfied_amount satisfiedAmount,
cf.exclusive_function exclusiveFunction,
(case discount_type when'1'then cf.satisfied_amount * (1-(cf.special_discount * ${paymentActiveDTO.amount}))
when '0' then cf.discount_amount
else 10 end) as amount
FROM
card_favorable cf
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
WHERE
cfr.mt_user_id = #{paymentActiveDTO.userId}
AND cfr.store_id = #{paymentActiveDTO.storeId}
AND cf.type != 1
AND cf.satisfied_amount <![CDATA[ <= ]]> 350
AND now() BETWEEN cfr.start_time
AND cfr.end_time
AND cfr.status = 0
</select>
</mapper>

View File

@ -19,6 +19,7 @@ import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -84,15 +85,20 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
@Override
public IPage<CardFavorableRecordVO> getCardFavorableList(Page page, CardFavorableRecord cardFavorableRecord) {
Integer storeId = TokenUtil.getNowAccountInfo().getStoreId();
cardFavorableRecord.setStoreId(storeId);
IPage<CardFavorableRecordVO> cardFavorableList = cardFavorableRecordMapper.getCardFavorableList(page, cardFavorableRecord);
List<CardFavorableRecordVO> records = cardFavorableList.getRecords();
for (CardFavorableRecordVO record : records) {
String oilName = "";
String[] split = record.getOilType().split(",");
for (String s : split) {
oilName += oilNameService.selectOilNameById(Integer.parseInt(s)).getOilName();
if (StringUtils.isNotEmpty(record.getOilType())){
String[] split = record.getOilType().split(",");
for (String s : split) {
oilName += oilNameService.selectOilNameById(Integer.parseInt(s)).getOilName();
}
record.setOilName(oilName);
}
record.setOilName(oilName);
}
cardFavorableList.setRecords(records);
return cardFavorableList;

View File

@ -17,6 +17,7 @@ import com.fuint.business.store.service.StoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -145,9 +146,11 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
CardFavorable favorable = getById(id);
BeanUtils.copyProperties(favorable,cardFavorableVO);
//获取油号
cardFavorableVO.setOilType(Arrays.stream(favorable.getOilType().split(","))
.map(Integer::valueOf)
.toArray(Integer[]::new));
if (StringUtils.isNotEmpty(favorable.getOilType())){
cardFavorableVO.setOilType(Arrays.stream(favorable.getOilType().split(","))
.map(Integer::valueOf)
.toArray(Integer[]::new));
}
return cardFavorableVO;
}
@ -162,10 +165,12 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
BeanUtils.copyProperties(cardFavorableDTO,cardFavorable);
//转换油品类型格式
String oil = "";
for (String s : cardFavorableDTO.getOilType()) {
oil += s + ",";
if (ObjectUtils.isNotEmpty(cardFavorableDTO.getOilType())){
for (String s : cardFavorableDTO.getOilType()) {
oil += s + ",";
}
cardFavorable.setOilType(oil);
}
cardFavorable.setOilType(oil);
if (cardFavorableDTO.getIsonline().equals("1")){
cardFavorable.setStatus("1");
}

View File

@ -11,25 +11,37 @@ public class CardFavorableRecordVO extends CardFavorableRecord {
*/
private String cardFavorableName;
/**
* 优惠券类型
* 优惠券类型 0油品券 1商品券 2通用券
*/
private String type;
/**
* 满减金额
*/
private String fullDeduction;
private double fullDeduction;
/**
* 优惠金额
*/
private String discountAmount;
private double discountAmount;
/**
* 优惠折扣
*/
private double specialDiscount;
/**
* 可用时段
*
*/
private String availablePeriod;
/**
* 互斥功能 0满减活动 1储值卡付款
*/
private String exclusiveFunction;
/**
* 可用油品
*/
private String oilType;
private String oilName;
//优惠类型 0满减券 1折扣券
private String discountType;
//满足金额
private double satisfiedAmount;
}

View File

@ -5,12 +5,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.entity.ReceiveParameter;
import com.fuint.api.fuyou.entity.ReturnParameter;
@ -18,8 +15,6 @@ import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
@ -30,15 +25,9 @@ import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselServi
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardFuleOrders.entity.CardFuleOrders;
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.CardBalanceChange;
import com.fuint.business.order.entity.OilBalanceChange;
import com.fuint.business.order.service.AllOrderInfoService;
import com.fuint.business.order.service.OilBalanceChangeService;

View File

@ -90,7 +90,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
* @param amount
* @return
*/
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount);
List<ActiveDiscountPayVO> selectActiveDiscount(@Param("storeId") Integer storeId, @Param("amount") BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
/**
* 满减
@ -98,7 +98,7 @@ public interface OilOrderMapper extends BaseMapper<OilOrder> {
* @param amount
* @return
*/
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount);
List<ActiveDiscountPayVO> selectActiveFule(@Param("storeId") Integer storeId, @Param("amount")BigDecimal amount,@Param("oilId") Integer oilId,@Param("levelId") Integer levelId);
/**
* 消费有礼

View File

@ -352,14 +352,22 @@
ad.NAME activeName,
ad.diesel_user_level adaptUser,
ad.adapt_oil oilId,
adc.amount amount,
adc.discount discount
ad.limit_acount as limitAcount,
ad.participation_condition,
(case ad.store_id when ${storeId} then adc.amount * (1-(adc.discount * 0.1))
end) as discount
FROM
active_discount ad
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
where ad.store_id = #{storeId}
and adc.amount &lt;= #{amount}
and ad.status = 0
LEFT JOIN active_discount_child adc ON ad.id = adc.active_discount_id
WHERE
ad.store_id = #{storeId}
AND adc.amount <![CDATA[ <= ]]> #{amount}
and now() BETWEEN ad.active_start_time
AND ad.active_end_time
AND ad.STATUS = 0
AND concat(',',ad.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',ad.diesel_user_level,',') like concat('%',#{levelId},'%')
GROUP BY ad.id
</select>
<select id="selectActiveFule" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO">
@ -368,14 +376,21 @@
af.NAME activeName,
af.diesel_user_level adaptUser,
af.adapt_oil oilId,
adc.amount amount,
af.limit_acount as limitAcount,
af.participation_condition,
adc.deduction_amount discount
FROM
active_fullminus af
LEFT JOIN active_discount_child adc ON af.id = adc.active_fullminus_id
where af.store_id = #{storeId}
and adc.amount &lt;= #{amount}
and status = 0
WHERE
af.store_id = #{storeId}
AND adc.amount <![CDATA[ <= ]]> #{amount}
and now() BETWEEN af.active_start_time
AND af.active_end_time
AND af.STATUS = 0
AND concat(',',af.adapt_oil,',') like concat('%',#{oilId},'%')
AND concat(',',af.diesel_user_level,',') like concat('%',#{levelId},'%')
GROUP BY af.id
</select>
<select id="selectActiveConsumption" resultType="com.fuint.business.marketingActivity.activeDiscount.vo.ActiveConsumptionVO">

View File

@ -1010,6 +1010,19 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 调用支付接口
try {
applet = fyPayService.applet(receiveParameter);
String resultMsg = (String) applet.get("resultMsg");
// 判断商户订单号是否重复 重复则重新生成订单号
if (StringUtils.isNotEmpty(resultMsg)){
// 根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo1 = "2345"+timestamp+randomString;
oilOrder.setOrderNo(orderNo1);
this.updateOilOrder(oilOrder);
receiveParameter.setOrderNo(orderNo1);
applet = fyPayService.applet(receiveParameter);
}
applet.put("orderNo",orderNo);
} catch (Exception e) {
e.printStackTrace();

View File

@ -17,4 +17,6 @@ public interface OilNameMapper extends BaseMapper<OilName> {
public List<OilName> getAllOilNameGroup();
public OilName selectOilNameById(@Param("id") int id);
String getOilTypebyId(Integer oilId);
}

View File

@ -62,5 +62,6 @@ public interface OilNumberMapper extends BaseMapper<OilNumber> {
*/
List<OilNumberNameVo> selectOilNumberNameByStoreId(@Param("storeId") Integer storeId);
double getOilPriceById(@Param("oilId") Integer oilId,@Param("storeId") Integer storeId);
}

View File

@ -22,6 +22,9 @@
parameterType="int">
select id, oil_type, oil_name from oil_name where id = #{id}
</select>
<select id="getOilTypebyId" resultType="String">
select oil_type from oil_name where id = #{oilId}
</select>
<select id="getAllOilNameGroup" resultType="com.fuint.business.petrolStationManagement.entity.OilName">
select id, oil_type, oil_name from oil_name group by oil_name
</select>
@ -34,4 +37,4 @@
<!-- LEFT JOIN (-->
<!-- SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'oil_type'-->
<!-- ) dict ON NA.oil_type = dict.dict_value;-->
</mapper>
</mapper>

View File

@ -145,4 +145,8 @@
onu.store_id = #{storeId} and onu.state = '启用'
</where>
</select>
<select id="getOilPriceById" resultType="double">
select oil_price from oil_number where oil_name = #{oilId} and store_id = #{storeId}
</select>
</mapper>

View File

@ -18,4 +18,8 @@ public interface LJUserGradeMapper extends BaseMapper<LJUserGrade> {
* @return
*/
public IPage<LJUserGrade> selectUserGradeList(Page page, @Param("userGrade") LJUserGrade userGrade);
String selectByUserId(@Param("storeId") Integer storeId, @Param("userId") Integer userId);
LJUserGrade selectAllByGradeId(String gradeId);
}

View File

@ -12,4 +12,12 @@
</where>
order by grade
</select>
</mapper>
<select id="selectByUserId" resultType="String">
select grade_id from mt_user_balance where mt_user_id = #{userId} and store_id = #{storeId}
</select>
<select id="selectAllByGradeId" resultType="com.fuint.business.userManager.entity.LJUserGrade">
select * from mt_user_grade where id = #{gradeId}
</select>
</mapper>

View File

@ -141,7 +141,7 @@
<select id="selectUserById" resultType="com.fuint.business.userManager.vo.LJUserVo"
parameterType="java.lang.Integer">
select * from mt_user
select * from mt_user mu
<where>
mu.id = #{id}
</where>
@ -172,4 +172,4 @@
mi.storeId = #{storeId}
</where>
</select>
</mapper>
</mapper>

View File

@ -45,9 +45,12 @@ public class AlipayController extends BaseController {
* @return
*/
@PostMapping("/getUserid")
public ResponseObject getUserId(@RequestBody Map<String,String> map,HttpServletRequest request) throws AlipayApiException {
String authCode = map.get("authCode");
public ResponseObject getUserId(@RequestBody Map<String,String> map,HttpServletRequest request) throws Exception {
logger.info("支付宝授权登录参数:{}", map);
String authCode = map.get("authCode");
String encryptedData = map.get("encryptedData");
// alipayService.getUserMobile(encryptedData);
String storeId = map.get("storeId");
if ("".equals(storeId)) return getFailureResult(0, "支付宝登录失败");
// 根据storeId查找对应的连锁店id

View File

@ -4,5 +4,13 @@ import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
public interface AlipayService1 {
/**
* 获取用户支付宝userId
* @param code
* @return
* @throws AlipayApiException
*/
public AlipaySystemOauthTokenResponse getAlipayProfile(String code) throws AlipayApiException;
void getUserMobile(String encryptedData) throws Exception;
}

View File

@ -1,8 +1,14 @@
package com.fuint.module.AlipayApi.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipayEncrypt;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import com.alipay.api.request.AlipayUserInfoShareRequest;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
@ -14,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class AlipayServiceImpl1 implements AlipayService1 {
private static final Logger logger = LoggerFactory.getLogger(AlipayServiceImpl1.class);
@ -59,4 +67,56 @@ public class AlipayServiceImpl1 implements AlipayService1 {
return null;
}
@Override
public void getUserMobile(String encryptedData) throws Exception {
//1. 获取验签和解密所需要的参数
Map<String, String> openapiResult = JSON.parseObject(encryptedData,
new TypeReference<Map<String, String>>() {
}, Feature.OrderedField);
String signType = "RSA2";
String charset = "UTF-8";
String encryptType = "AES";
String sign = openapiResult.get("sign");
String content = openapiResult.get("response");
//如果密文的
boolean isDataEncrypted = !content.startsWith("{");
boolean signCheckPass = false;
//2. 验签
String signContent = content;
// String signVeriKey = "你的小程序对应的支付宝公钥为扩展考虑建议用appId+signType做密钥存储隔离";
String signVeriKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnwDxxSNpBKL8xjtU3leNBy9mIOMYOr0WgxGbCxTMfhUPka9nr8Hbt0GN+7ylNBmxCYvW8kmge4dCOLUPqseM9+HyF9R1NrWBB3zQPVqnD0mKCYr9cEgtx6/eU7oIK1FqAl0G+jNIT3IKWMSXEX09yPKJWS6zk7+FRzOzn11vShTFjmrqWdrisJgRsQ54PHhPkQz7xFojDRqIunlpICWUVA8GwUg02hm5ZEhxpMHEWoJZ6Dj1wPH2Vh4CpIT/mjtD+SvssCpT0/XOEDPajcMRfgoV8fyyN0JNQDVZdMZgSO4aRHQqhC3X5CBXSuv40hHnwjcDjsPcbVav5BtaPp3wPQIDAQAB";
// String decryptKey = "你的小程序对应的加解密密钥为扩展考虑建议用appId+encryptType做密钥存储隔离"
String decryptKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJJM2nlUCidns6anNtGUiCL+J83kNL1nrr6hNktHkrX9bhR8LiBU3qBX+MkGDY4snlbdz+anGWu8YkcMlfBlAr82AsdIS9UTHh3lgsIAZTBZHgzZrxn7vwHfHI6Kw7uGZJbZ320JEG3s0KyvGiW0eqGuWI4BW+sD7b6JoLtNfBq+yF9ObOcs76rNCWz+04BmhCH7i6d8arK8NKgEiI9EjBThGjLRDFK1ryacKpz4UVvIXgxEW5w0MTjo/Q7gp2VLpwE/4jc8QfDFwmGU75L+nhK0rr1l0wwSo7svWFAXvberzMCGyuuLomuh2ldDfERJbIjg/qU66gx0EML1tgpVtFAgMBAAECggEARTArDJuwswXBH3Rq7SRvPza3NbXQD6eR9gjuZcTiyG4ecyMH/40bhK/nbFu+cEzh/HxTnIrI6Xmr+eBoxybhNXsgDu1ttjELUF8i7oftiN7rfJVd0P58CySgQXKYybw65lqF8enA8M1gdkxyYS1Z10igelBKyBwUak9LwBIpM0wrPIFrLhoxIEJC6QJ8EDnm6lKbytvcCa2mMZmtWs8oFxNA/SLRWtdEgHk4hslQVqq4R8B/xUy9Cu4kjdnVMHG2MqFXOiTas3gyKZLGN1ACBfpxxtyw0RAfX294ChV4SIvp10s1VqBFudcQeXeV5ph0NXP1eNt/8o3HIu0vjc0jAQKBgQD5ZtOR19M5vAcxJykh5u01CPdfz2LztqdinCpkBIpFviceW/k1euQFaWbOKdYFUrPnuLgX7Ds6dhSrkoL1+1RiVKUR6AtqIMa4fZJIMJWEPNNYWl8s6u6j11Dkd0B10g5+KV/kKLSlwFuBQnDyHw1ND+WKHqj9vkkzimzfcwedBQKBgQCMxao2IKX8CNjXDuryGkmXac0wxql0nN8AFHjCQGm16GPwlp805nAwsHKfJK45ACeixnWH9Cn6sje3yOUpCw6KG4OougRkrQEkQpoPVrZuXEcZ4j4Wg64VgW9tUAVH/WOV0VDnOBpsM8mbKsLLglb1H9Bx7813IX1pmhm93a0ZQQKBgD6U48/75T/eg7t8xSCBrtIZDuHWy1C2a6gd4bE5Rm0buvsuPwmBbchB248uBktNpmEmA+PU3kPcL3GiEQSibVlDPiyRGpQl51eSAuvkbRBCpxHLk4hU507rj5vUpLMr44Ea5rn80N+qtgtoXakTy6WjsIiJCwSpA/tP5+PmHGn1AoGASY/VhZmEA3OAFMnX3pH8GOKR9kYqMST0p28LN78/Pm7lIskjAxrUT601CJK7dE/vZnE848Gk2judQC38CnmbrHH6WAZ020NI0HD5XsCabotMIGuItG01YEmWN9JUIC16h8Ss+Vbo/9gEJ1CuIHjJBikM3S1J+lIG3lNH1l7r4MECgYEA2eAV0x55cmjC6VIMk3EAVUFbJ1LY1U9irmI6B5e7k/OVcdRksJfMRJwcquYVSfAk4hDrl7x0Qy36XELGvMe/hx07HxeAOXON8gL1b3UHP1zxvXb90YLHseHn9lssABsXS6Enyv3nrzqUi/uzBvpdDE2SRVS6nUr7Yyui6Yl+UPA="
;
//如果是加密的报文则需要在密文的前后添加双引号
if (isDataEncrypted) {
signContent = "\"" + signContent + "\"";
}
try {
signCheckPass = AlipaySignature.rsaCheck(signContent, sign, signVeriKey, charset, signType);
} catch (AlipayApiException e) {
//验签异常, 日志
}
if(!signCheckPass) {
//验签不通过异常或者报文被篡改终止流程不需要做解密
throw new Exception("验签失败");
}
//3. 解密
String plainData = null;
if (isDataEncrypted) {
try {
AlipayEncrypt.decryptContent(content, encryptType, decryptKey, charset);
} catch (AlipayApiException e) {
//解密异常, 记录日志
throw new Exception("解密异常");
}
} else {
plainData = content;
}
}
}

View File

@ -298,7 +298,7 @@
_this.oilNumberList = res.data;
if (res.data){
// _this.getOilGun(res.data[0].numberId);
_this.oilPrice = res.data[0].gbPrice
_this.oilPrice = res.data[0].oilPrice
_this.oilUnit = res.data[0].unit
_this.oilOrder.oils = res.data[0].oilNameId
if (res.data[0].oilGunList){
@ -366,7 +366,7 @@
// this.getOilGun(data.numberId)
this.oilGunList = data.oilGunList
this.oilOrder.oilGunNum = data.oilGunList[0].id
this.oilPrice = data.gbPrice
this.oilPrice = data.oilPrice
this.oilUnit = data.unit
this.oilOrder.oils = data.oilNameId
uni.setStorageSync("tankId",data.oilGunList[0].tankId)

View File

@ -13,7 +13,9 @@
<button class="dl-box" open-type='getPhoneNumber' @getphonenumber="getPhone">手机号快捷登录</button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="dl-box" open-type="getPhoneNumber" @getphonenumber="getUserLogin">手机号快捷登录</button>
<!-- <button class="dl-box" open-type="getPhoneNumber" @getphonenumber="getUserLogin">手机号快捷登录</button> -->
<button open-type="getAuthorize" scope='phoneNumber' class="dl-box" hover-class="button-active"
@getAuthorize="getUserLogin">手机号快捷登录</button>
<!-- #endif -->
<button class="kk-box" @click="goback">我再看看</button>
<view class="dbottom">
@ -59,10 +61,16 @@
console.log(e)
let _this = this;
my.getAuthCode({
scopes: 'auth_base',
// my.getAuthCode({
my.getPhoneNumber({
// scopes: 'auth_base',
success: res => {
const authCode = res.authCode;
let encryptedData = res.response;
// _this.setData({
// ['userInfo.phone']: "18457621459",
// alertPhone: false,
// })
console.log(res)
request({
url: "clientApi/sign/alipayLogin/getUserid",
@ -72,6 +80,7 @@
storeId: 0,
staffId: "",
phone: "18457621459",
encryptedData:encryptedData,
},
}).then((resp) => {
console.log(resp)

View File

@ -348,6 +348,12 @@
})
return;
}
if(res.data.resultMsg == "商户订单号重复"){
uni.showToast({
title:"商户订单号重复,请重新选择订单信息进行支付!",
icon:"none"
})
}
if (res.data.data.reservedPayInfo){
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({
@ -383,7 +389,8 @@
console.log('fail:',err);
}
});
}else{
}
if (_this.appltType== "ALIPAY") {
my.tradePay({ tradeNO: res.data.data.reservedTransactionId }, function(resp){
if(resp.resultCode == '9000'){
console.log("支付成功")
@ -835,9 +842,10 @@
}else{
_this.chooseCardBalance(0)
}
_this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId)
// _this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId)
})
},
// getPayment
//
getOilOrder() {
let _this = this;