Merge remote-tracking branch 'origin/master'

This commit is contained in:
齐天大圣 2023-11-15 14:34:45 +08:00
commit 88e9ba8bc9
53 changed files with 3494 additions and 645 deletions

View File

@ -3,7 +3,31 @@ import request from '@/utils/request'
// 查询消费有礼活动列表
export function listActiveConsumption(query) {
return request({
url: '/business/marketingActivity/activeConsumption/list',
url: '/business/marketingActivity/activeConsumption',
method: 'get',
params: query
})
}
//优惠券
export function listFavorable(query) {
return request({
url: 'business/marketingActivity/cardFavorable',
method: 'get',
params: query
})
}
// 兑换券
export function listExchange(query) {
return request({
url: 'business/marketingActivity/cardExchange',
method: 'get',
params: query
})
}
// 实物
export function listLJGoods(query) {
return request({
url: 'business/convenience/goods/list',
method: 'get',
params: query
})
@ -12,7 +36,7 @@ export function listActiveConsumption(query) {
// 查询消费有礼活动详细
export function getActiveConsumption(id) {
return request({
url: '/business/marketingActivity/activeConsumption/' + id,
url: 'business/marketingActivity/activeConsumption/' + id,
method: 'get'
})
}
@ -29,7 +53,7 @@ export function addActiveConsumption(data) {
// 修改消费有礼活动
export function updateActiveConsumption(data) {
return request({
url: '/business/marketingActivity/activeConsumption',
url: 'business/marketingActivity/activeConsumption',
method: 'put',
data: data
})

View File

@ -34,6 +34,14 @@ export function updateRecord(data) {
data: data
})
}
// 核销
export function cardExchangeRecord(data) {
return request({
url: 'business/marketingActivity/cardExchangeRecord',
method: 'put',
data: data
})
}
// 删除兑换券领取记录
export function delRecord(id) {

View File

@ -31,7 +31,35 @@ export function getPrepaidCardTopUpApi(query) {
export function getCheckTheStatusOfYourPaymentApi(query) {
return request({
url: 'business/marketingActivity/cardValueRecord/checkTheStatusOfYourPayment?id='+query,
method: 'get',
params: query
})
}
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
// 余额支付 油卡
export function getPrepaidFuelTopUpApi(query) {
return request({
url: 'business/marketingActivity/cardFuelRecord/prepaidFuelTopUp',
method: 'post',
data: query
})
}
}
// 余额插入订单 油卡
export function getCheckTheStatusOfYourPaymentByFuelApi(query) {
return request({
url: 'business/marketingActivity/cardFuelRecord/checkTheStatusOfYourPaymentByFuel?id='+query,
method: 'get',
params: query
})
}

View File

@ -398,7 +398,7 @@
},
form: {
sort:1,
groupOriented:1,
groupOriented:'1',
rechargeBalance:'',
giftBalance:'',
points:'',
@ -454,7 +454,7 @@
this.form = {
sort:1,
membershipLevel:'',
groupOriented:1,
groupOriented: '1',
rechargeBalance:'',
giftBalance:'',
points:'',

File diff suppressed because it is too large Load Diff

View File

@ -275,7 +275,7 @@
</template>
<script>
import { listActiveDiscount, getActiveDiscount, delActiveDiscount, addActiveDiscount, updateActiveDiscount } from "@/api/marketingActivity/activeDiscount";
import { listActiveDiscount, getActiveDiscount, delActiveDiscount, addActiveDiscount, updateActiveDiscount } from "@/api/EventMarketing/activeDiscount";
export default {
name: "ActiveDiscount",

View File

@ -275,7 +275,7 @@
</template>
<script>
import { listActiveFullminus, getActiveFullminus, delActiveFullminus, addActiveFullminus, updateActiveFullminus } from "@/api/business/marketingActivity/activeFullminus";
import { listActiveFullminus, getActiveFullminus, delActiveFullminus, addActiveFullminus, updateActiveFullminus } from "@/api/EventMarketing/activeFullminus";
export default {
name: "ActiveFullminus",

View File

@ -240,7 +240,7 @@
</template>
<script>
import { listActiveNewlyweds, getActiveNewlyweds, delActiveNewlyweds, addActiveNewlyweds, updateActiveNewlyweds } from "@/api/marketingActivity/activeNewlyweds";
import { listActiveNewlyweds, getActiveNewlyweds, delActiveNewlyweds, addActiveNewlyweds, updateActiveNewlyweds } from "@/api/EventMarketing/activeNewlyweds";
export default {
name: "ActiveNewlyweds",

View File

@ -209,7 +209,7 @@
</template>
<script>
import { listActiveRecommend, getActiveRecommend, delActiveRecommend, addActiveRecommend, updateActiveRecommend } from "@/api/marketingActivity/activeRecommend";
import { listActiveRecommend, getActiveRecommend, delActiveRecommend, addActiveRecommend, updateActiveRecommend } from "@/api/EventMarketing/activeRecommend";
export default {
name: "ActiveRecommend",

View File

@ -0,0 +1,61 @@
<template>
<!-- 活动中心-->
<div class="app-container">
<el-card style="margin-bottom: 20px">
<el-radio-group v-model="value">
<el-radio-button label="1">消费有礼</el-radio-button>
<el-radio-button label="2">折扣营销</el-radio-button>
<el-radio-button label="3">满减营销</el-radio-button>
<el-radio-button label="4">新人有礼</el-radio-button>
<el-radio-button label="5">推荐有礼</el-radio-button>
</el-radio-group>
</el-card>
<activeConsumption v-if="value == 1"></activeConsumption>
<activeDiscount v-if="value == 2"></activeDiscount>
<activeFullminus v-if="value == 3"></activeFullminus>
<activeNewlyweds v-if="value == 4" ></activeNewlyweds>
<activeRecommend v-if="value == 5"></activeRecommend>
<!-- 添加或修改兑换券对话框 -->
</div>
</template>
<script>
import activeDiscount from '../activeDiscount/index'
import activeNewlyweds from '../activeNewlyweds/index'
import activeConsumption from '../activeConsumption/index'
import activeFullminus from '../activeFullminus/index'
import activeRecommend from '../activeRecommend/index'
export default {
name: 'Exchange',
data() {
return{
value:1
}
},
created() {
},
components:{
activeNewlyweds,activeConsumption,activeDiscount,activeFullminus,activeRecommend
},
methods: {
}
}
</script>
<style scoped lang="scss">
.app-container{
width: 100%;
height: 100%;
}
.qr-code{
margin: 0px auto;
}
</style>

View File

@ -21,7 +21,7 @@
<div class="box-hui"><span style="width: 35%">券码:</span> <span>{{item.ticketCode}}</span> </div>
<div class="box-hui"><span style="width: 35%">有效期:</span> <span>{{item.outTime}}</span> </div>
<div class="box-hui"><span style="width: 35%">获得方式:</span> <span>{{item.exchangeFrom}}</span> </div>
<div class="anniu" >
<div class="anniu" @click="getcardExchangeRecord(item.id)" >
<span>立即核销</span>
</div>
</div>
@ -34,7 +34,7 @@
</template>
<script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/EventMarketing/cardExchangeRecord";
import { listRecord, getRecord, delRecord, addRecord, updateRecord,cardExchangeRecord } from "@/api/EventMarketing/cardExchangeRecord";
export default {
name: 'index',
data(){
@ -53,7 +53,7 @@
exchangeName: null,
ticketCode: null,
exchangeFrom: null,
status: null,
status: 0,
outTime: null,
cancelTime: null,
startTime: null,
@ -82,6 +82,18 @@
this.loading = false;
});
},
getcardExchangeRecord(id){
let data = {
id:id,
status:1
}
cardExchangeRecord(data).then(res=>{
if(res.code == 200){
this.$message.success("核销成功")
this.getList()
}
})
}
}
}

View File

@ -416,7 +416,7 @@
<div style="display: flex;margin: 20px 0">
<div style="width: 7%">支付方式</div>
<div>
<el-radio v-for="dict in dict.type.payment_type" v-model="cardValueForm.paymentType" :key="dict.value" :label="dict.label" :value="dict.value" border @click="payMethod(dict.value)"></el-radio>
<el-radio v-for="dict in payList" v-model="cardValueForm.paymentType" :key="dict.dictValue" :label="dict.dictValue" :value="dict.dictValue" border >{{ dict.dictLabel }}</el-radio>
</div>
</div>
</el-col>
@ -467,14 +467,14 @@
<span class="bom">升数卡充值不支持自定义积分,选择对应充值活动获得对应积分[需开启积分活动有效]</span>
</div>
</div>
<div style="display:flex;margin-left: 20px">
<!-- <div style="display:flex;margin-left: 20px">
<div style="line-height: 40px;width: 20%">提成员工</div>
<div>
<el-input :readonly="true" placeholder="请选择提成员工" v-model="cardFuelDieselForm.realName">
<el-button slot="append" @click="chooseStaff">选择员工</el-button>
</el-input>
</div>
</div>
</div> -->
</div>
</el-col>
</el-row>
@ -498,11 +498,7 @@
<div style="display: flex;margin: 20px 0">
<div style="width: 7%">支付方式</div>
<div>
<el-radio v-for="dict in dict.type.payment_type" v-model="cardFuelDieselForm.paymentType" :key="dict.value" :label="dict.label" :value="dict.value" border></el-radio>
<!-- <el-radio v-model="payment" label="现金" border>现金支付</el-radio>
<el-radio v-model="payment" label="POS刷卡" border>POS刷卡</el-radio>
<el-radio v-model="payment" label="随便付" border>随便付</el-radio>
<el-radio v-model="payment" label="银行卡" border>银行卡</el-radio> -->
<el-radio v-for="dict in dict.type.payment_type" v-model="cardFuelDieselForm.paymentType" :key="dict.value" :label="dict.value" :value="dict.value" border>{{ dict.label }}</el-radio>
</div>
</div>
</el-col>
@ -534,9 +530,9 @@
汽油
</el-tag> -->
</div>
<div style="text-align: center;margin-bottom: 10px">赠送金额</div>
<!-- <div style="text-align: center;margin-bottom: 10px">赠送金额</div> -->
<div>
<el-input v-model="authCode" placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<el-input v-model="authCode" @keydown.enter.native="collection" placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
<i
slot="suffix">
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
@ -815,10 +811,11 @@ import {getUser, updateUser} from "@/api/staff/user/user";
import {ljStoreInfo} from "@/api/staff/store";
import {getUserGrade} from "@/api/staff/user/usergrade";
import {getList} from "@/api/EventMarketing/oilBlock";
import {getCountOilTypeApi,getCardValueListApi} from "@/api/EventMarketing/cardSet";
import {getCountOilTypeApi,getCardValueListApi,getPrepaidCardTopUpApi,getCheckTheStatusOfYourPaymentApi,getDicts,getPrepaidFuelTopUpApi,getCheckTheStatusOfYourPaymentByFuelApi} from "@/api/EventMarketing/cardSet";
import {getSysConfig} from "@/api/staff/user/sysconfig";
import item from "../../layout/components/Sidebar/Item.vue";
import SelectStaff from "@/components/local/selectStaff";
import BigNumber from 'bignumber.js';
export default {
components: {SelectStaff},
@ -846,7 +843,10 @@ export default {
points:'', //
growthValue:'', //
remark:'',
paymentType:'' //
paymentType:'', //
royaltyType: '',//
percentageCommissions:null,
amountCommission:null
},
//
@ -858,7 +858,12 @@ export default {
staffMobile: '',
points:'',
remark:'',
rechargeBalance:'' //
rechargeBalance:'', //
paymentType:'',
oilType:'',
type:'',
chainStorId:'',
incomeLitres:'',
},
authCode:'', //
@ -872,8 +877,11 @@ export default {
isPay:true,
isPaySuccess:false,
isQuery:true,
isPay:true,
payList:[],
//
literCard:[
{liter:73.75,amount:500,lockPrice:6.78,point:50},
@ -993,16 +1001,19 @@ export default {
},
//
getCardValueList() {
async getCardValueList() {
let quy = {
pageNo: 1,
pageSize: 10000,
isonline: 0
}
getCardValueListApi(quy).then(res=>{
await getCardValueListApi(quy).then(res=>{
this.cardValueList = res.data.records;
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
})
if (this.cardValueList.length > 0) {
this.rechargeCard(0);
}
},
valueAmoutChange(data) {
@ -1016,6 +1027,22 @@ export default {
this.cardValueForm.bidBalance = change.bidBalance
this.cardValueForm.giftBalance = change.giftBalance
this.cardValueForm.growthValue = change.growthValue
this.cardValueForm.rechargeBalance = change.rechargeBalance
this.cardValueForm.royaltyType = change.royaltyType
this.cardValueForm.percentageCommissions = change.percentageCommissions
this.cardValueForm.amountCommission = change.amountCommission
//
if (change.royaltyType === "3") {
//
const percentageCommissions = new BigNumber(change.percentageCommissions);
const totalAmount = new BigNumber(data);
const commissionAmount = totalAmount.multipliedBy(percentageCommissions).dividedBy(100).decimalPlaces(2);
this.cardValueForm.amountCommission = commissionAmount
}
}
})
}
@ -1034,7 +1061,6 @@ export default {
this.sourceCardFuelDieselList = res.data.records
})
},
handleDataFromChild(data) {
this.openStaff = false
this.cardFuelDieselForm= {
@ -1042,6 +1068,12 @@ export default {
realName: data.realName,
staffMobile: data.staffMobile,
},
this.cardValueForm= {
mtStaffId: data.mtStaffId,
realName: data.realName,
staffMobile: data.staffMobile,
},
console.log('Received data in parent:', data);
},
@ -1073,9 +1105,12 @@ export default {
//
userRecharge(){
this.getCardFuelDieselList()
this.getCardValueList()
this.getCountOilType()
this.getPayList();
this.openRecharge = true;
this.title = '会员充值'
@ -1083,13 +1118,18 @@ export default {
},
//
confirm(flag){
let userForm = this.form
// form
console.log("formformformform",this.form);
this.flag = flag
if (flag ===1) {
if (this.cardValueForm.paymentType == '') {
this.$message.error('请选择支付方式');
return
}
this.rechargeBalance = this.cardValueForm.rechargeBalance
}else if(flag ===2) {
}else if(flag === 2) {
if (this.cardFuelDieselForm.paymentType == '') {
this.$message.error('请选择支付方式');
return
}
this.rechargeBalance = this.cardFuelDieselForm.rechargeBalance
}
this.isPay = true
@ -1099,6 +1139,11 @@ export default {
//
payMethod(payType,flag){
// this.map.payType = payType;
if (falg === 1) {
}
console.log("payType",payType)
this.cardValueForm.paymentType = payType
},
//
getInformation(){
@ -1134,6 +1179,7 @@ export default {
//
rechargeCard(index,item){
console.log("index",index)
//
this.activeKey = index;
@ -1142,6 +1188,7 @@ export default {
this.cardValueForm.giftBalance = 0
this.cardValueForm.growthValue = 0
this.cardValueForm.bidBalance = 0
// this.cardValueForm.bidBalance = 1
// this.cardValueForm.amount = 0
}else {
@ -1156,6 +1203,23 @@ export default {
this.cardValueForm.giftBalance = file.giftBalance
this.cardValueForm.growthValue = file.growthValue
this.cardValueForm.amount = null
this.cardValueForm.royaltyType = file.royaltyType
this.cardValueForm.percentageCommissions = file.percentageCommissions
this.cardValueForm.amountCommission = file.amountCommission
console.log("file.royaltyType ", file.royaltyType )
//
if (file.royaltyType === "3") {
//
const percentageCommissions = new BigNumber(file.percentageCommissions);
const totalAmount = new BigNumber(file.rechargeBalance);
const commissionAmount = totalAmount.multipliedBy(percentageCommissions).dividedBy(100).decimalPlaces(2);
this.cardValueForm.amountCommission = commissionAmount
}
}
},
@ -1167,11 +1231,20 @@ export default {
file = this.cardFuelDieselList[index]
this.cardFuelDieselForm.points = file.points
this.cardFuelDieselForm.rechargeBalance = file.rechargeBalance
this.cardFuelDieselForm.oilType = file.oilType
this.cardFuelDieselForm.type = file.type
this.cardFuelDieselForm.chainStorId = file.chainStorId
this.cardFuelDieselForm.incomeLitres = file.incomeLitres
this.rechargeBalance = file.rechargeBalance
console.log("this.cardFuelDieselList[index]",this.cardFuelDieselList[index])
console.log("this.cardFuelDieselForm[index]",this.cardFuelDieselForm)
},
async collection(){
let userForm = this.form
if (this.flag === 1) {
// id
this.cardValueForm.mtUserId = userForm.id
@ -1181,26 +1254,132 @@ export default {
this.cardValueForm.authCode = this.authCode
let id ;
await getPrepaidCardTopUpApi(this.cardValueForm).then(res=> {
console.log("返回数据",res)
await getPrepaidCardTopUpApi(this.cardValueForm).then(response=> {
if (response.data!=null){
this.loading = true;
id = response.data.id
// if (response.data.payStatus == "paid"){
// this.isPaySuccess = true;
// }
}
});
let this_ = this
let timer = setInterval(async () => {
getCheckTheStatusOfYourPaymentApi(id).then(response => {
if (response.data!=null){
if (response.data.payStatus == "unpaid"){
this_.isQuery = true;
}
if (response.data.payStatus == "paid"){
this_.isPaySuccess = true;
this_.isQuery = false;
}
if (response.data.payStatus == "payFail"){
this_.isPaySuccess = false;
this_.isQuery = false;
}
}
})
}, 500);
let timer2 = setInterval(function () {
if (this_.isQuery == false) {
this_.loading = false;
this_.isPay = false;
clearInterval(timer);
}
},500)
setTimeout(function (){
clearInterval(timer2);
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
},30000)
}else if (this.flag === 2){
console.log("cardFuelDieselForm",this.cardFuelDieselForm)
this.cardFuelDieselForm.mtUserId = userForm.id
this.cardFuelDieselForm.name = userForm.name
this.cardFuelDieselForm.mobile = userForm.mobile
this.cardFuelDieselForm.authCode = this.authCode
let id ;
await getPrepaidFuelTopUpApi(this.cardFuelDieselForm).then(response=> {
if (response.data!=null){
this.loading = true;
id = response.data.id
}
});
this.timer = setInterval(async () => {
await getCheckTheStatusOfYourPaymentApi(id).then(res => {
console.log("ddd", res)
})
}, 500);
let timer = setInterval(async () => {
getCheckTheStatusOfYourPaymentByFuelApi(id).then(response => {
if (response.data!=null){
if (response.data.payStatus == "unpaid"){
this_.isQuery = true;
}
if (response.data.payStatus == "paid"){
this_.isPaySuccess = true;
this_.isQuery = false;
}
if (response.data.payStatus == "payFail"){
this_.isPaySuccess = false;
this_.isQuery = false;
}
}
})
}, 500);
let timer2 = setInterval(function () {
if (this_.isQuery == false) {
this_.loading = false;
this_.isPay = false;
clearInterval(timer);
clearInterval(timer2);
}
},500)
setTimeout(function (){
clearInterval(timer2);
clearInterval(timer);
this_.loading = false;
this_.isPay = false;
this.isPaySuccess = false;
}else if (this.flag === 2){
},30000)
let this_ = this
}
console.log("88888888888888888888",this.flag)
},
getPayList(){
console.log("payment_type1")
getDicts("payment_type").then( response => {
console.log("payment_type2",response.data)
this.payList = response.data;
})
},
//
handClose(){
this.isPay = true;
this.openConfirm = false
this.openRecharge = false
this.isPaySuccess = false;
this.authCode = null
this.activeRecharge='balance',
this.cardValueForm = {}
this.cardFuelDieselForm = {}
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
@ -1230,6 +1409,17 @@ export default {
this.openLevel = false;
this.openBindIdCard = false;
this.openRecharge = false;
this.isPay = true;
this.openConfirm = false
this.openRecharge = false
this.isPaySuccess = false;
this.authCode = null
this.activeRecharge='balance',
this.cardValueForm = {}
this.cardFuelDieselForm = {}
},
cancelCollection(){
this.openConfirm = false;

View File

@ -35,6 +35,11 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
*/
public MerchantConfig selectMerchById(int id);
/**
* 将所有的使用1改为0
*/
public void updateMerchOrter();
/**
* 修改商户使用状态
* @param merchantConfig

View File

@ -10,11 +10,14 @@ import com.fuint.api.fuyou.entity.Message;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.service.CashierOrderService;
import com.fuint.business.order.service.HangBillService;
import com.fuint.business.order.service.LJOrderService;
import com.fuint.business.order.service.OilOrderService;
import io.swagger.models.auth.In;
@ -36,6 +39,8 @@ public class FyPayServiceImpl implements FyPayService {
private CashierOrderService cashierOrderService;
@Resource
private CardValueRecordService cardValueRecordService;
@Resource
private CardFuelRecordService cardFuelRecordService;
/**
* 条码支付
* @param map1
@ -70,6 +75,8 @@ public class FyPayServiceImpl implements FyPayService {
//响应报文验签
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
System.out.println("resMap"+resMap);
String str = resMap.get("sign");
if (Utils.verifySign(resMap, str)){
String resultCode = resMap.get("result_code");
@ -78,14 +85,14 @@ public class FyPayServiceImpl implements FyPayService {
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
Map<String, String> orderQueryRes = queryOrder(map1);
if(!orderQueryRes.get("msg").equals("unpaid")){
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
try {
Map<String, String> orderQueryRes = queryOrder(map1);
if(!orderQueryRes.get("msg").equals("unpaid")){
timer.cancel();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//定时器 立即开始 0.5s一次
}, 0, 500);
@ -97,6 +104,8 @@ public class FyPayServiceImpl implements FyPayService {
@Autowired
private MerchantConfigService merchantConfigService;
@Autowired
private HangBillService hangBillService;
@Override
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
@ -135,6 +144,7 @@ public class FyPayServiceImpl implements FyPayService {
LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
HangBill hangBill = hangBillService.selectHangBillByOrderNo(orderNo);
Date date = new Date();
if (reqMap.get("trans_stat").equals("SUCCESS")){
if (!ObjectUtil.isEmpty(oilOrder)){
@ -147,6 +157,10 @@ public class FyPayServiceImpl implements FyPayService {
if (!ObjectUtil.isEmpty(cashierOrder)){
cashierOrder.setStatus("paid");
}
if (!ObjectUtil.isEmpty(hangBill)){
hangBill.setPayStatus("paid");
hangBillService.updateHangBills(hangBill,allAmount);
}
if (ArrayUtil.isEmpty(list)){
for (OilOrder order : list) {
order.setOrderStatus("paid");
@ -154,11 +168,14 @@ public class FyPayServiceImpl implements FyPayService {
oilOrderService.updateOilOrder(order);
}
}
if ("CRV".equals(type)) {
if ("CVR".equals(type)) {
payStates = "paid";
// if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
//
// }
}
if ("CFR".equals(type)) {
payStates = "paid";
if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
}
}
// 修改商户账号余额信息
Double amount = merchantConfig.getAmount();
@ -177,18 +194,25 @@ public class FyPayServiceImpl implements FyPayService {
if (!ObjectUtil.isEmpty(cashierOrder)){
cashierOrder.setStatus("payFail");
}
if (!ObjectUtil.isEmpty(hangBill)){
hangBill.setPayStatus("payFail");
hangBillService.updateById(hangBill);
}
if (!ArrayUtil.isEmpty(list)){
for (OilOrder order : list) {
order.setOrderStatus("payFail");
oilOrderService.updateOilOrder(order);
}
}
if ("CRV".equals(type)) {
if ("CVR".equals(type)) {
payStates = "payFail";
if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
}
}
if ("CFR".equals(type)) {
payStates = "payFail";
}
}
if (!ObjectUtil.isEmpty(oilOrder)){
oilOrderService.updateOilOrder(oilOrder);
@ -199,11 +223,15 @@ public class FyPayServiceImpl implements FyPayService {
if (!ObjectUtil.isEmpty(cashierOrder)){
cashierOrderService.updateCashierOrder(cashierOrder);
}
if ("CRV".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
payStates = "payFail";
if ("CVR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
Integer id = Integer.parseInt(map1.get("orderId"));
cardValueRecordService.editPayStatus(id, payStates);
}
if ("CFR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
// 存油卡
Integer id = Integer.parseInt(map1.get("orderId"));
cardFuelRecordService.editPayStatus(id, payStates);
}
}
}catch (Exception e){
log.error(e.getMessage());

View File

@ -48,6 +48,19 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
return merchantConfig;
}
@Override
public void updateMerchOrter() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_use","1");
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
if (list.size()>0){
for (MerchantConfig merchantConfig : list) {
merchantConfig.setIsUse("0");
this.updateMerch(merchantConfig);
}
}
}
@Override
public int updateMerch(MerchantConfig merchantConfig) {
int row = baseMapper.updateById(merchantConfig);

View File

@ -50,6 +50,9 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
index = i;
}
}
// 将其他使用的账户关掉
merchantConfigService.updateMerchOrter();
// 改变目前使用账户
MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(index).getMerchConfigId());
merchantConfig.setIsUse("1");
merchantConfig.setIsOpenRule("1");

View File

@ -0,0 +1,95 @@
package com.fuint.business.commission.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
/**
* 提成记录表(CommissionRecord)表控制层
*
* @author wangh
* @since 2023-11-14 13:40:03
*/
@RestController
@RequestMapping("commissionRecord")
public class CommissionRecordController extends BaseController {
/**
* 服务对象
*/
@Resource
private CommissionRecordService commissionRecordService;
/**
* 分页查询
*
* @param commissionRecord 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("commissionRecord") CommissionRecord commissionRecord) {
Page page = new Page(pageNo, pageSize);
IPage< CommissionRecord> iPageList = this.commissionRecordService.queryByPage(page, commissionRecord);
return getSuccessResult(iPageList);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.commissionRecordService.queryById(id));
}
/**
* 新增数据
*
* @param commissionRecord 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody CommissionRecord commissionRecord) {
return getSuccessResult(this.commissionRecordService.insert(commissionRecord));
}
/**
* 编辑数据
*
* @param commissionRecord 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody CommissionRecord commissionRecord) {
return getSuccessResult(this.commissionRecordService.update(commissionRecord));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.commissionRecordService.deleteById(id));
}
}

View File

@ -1,25 +1,27 @@
package com.fuint.business.commission.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 提成记录表 (CommissionRecord)实体类
* 提成记录表(CommissionRecord)实体类
*
* @author wangh
* @since 2023-11-14 13:40:03
*/
@Data
@TableName("commission_record")
@ApiModel(value = "CommissionRecord对象", description = "提成记录表")
public class CommissionRecord extends BaseEntity implements Serializable {
public class CommissionRecord extends BaseEntity {
private static final long serialVersionUID = 885409182719360176L;
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ -57,5 +59,6 @@ public class CommissionRecord extends BaseEntity implements Serializable {
@ApiModelProperty("描述")
private String description;
}

View File

@ -0,0 +1,85 @@
package com.fuint.business.commission.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 提成记录表(CommissionRecord)表数据库访问层
*
* @author wangh
* @since 2023-11-14 13:40:03
*/
public interface CommissionRecordMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CommissionRecord queryById(Integer id);
/**
* 查询指定行数据
*
* @param commissionRecord 查询条件
* @param page 分页对象
* @return 对象列表
*/
IPage<CommissionRecord> queryAllByLimit(@Param("page") Page page, CommissionRecord commissionRecord);
/**
* 统计总行数
*
* @param commissionRecord 查询条件
* @return 总行数
*/
long count(CommissionRecord commissionRecord);
/**
* 新增数据
*
* @param commissionRecord 实例对象
* @return 影响行数
*/
int insert(CommissionRecord commissionRecord);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<CommissionRecord> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<CommissionRecord> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<CommissionRecord> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<CommissionRecord> entities);
/**
* 修改数据
*
* @param commissionRecord 实例对象
* @return 影响行数
*/
int update(CommissionRecord commissionRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.commission.mapper.CommissionRecordMapper">
<resultMap type="com.fuint.business.commission.entity.CommissionRecord" id="CommissionRecordMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
<result property="staffId" column="staff_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="amount" column="amount" jdbcType="NUMERIC"/>
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="CommissionRecordMap">
select
id, store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by
from commission_record
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="CommissionRecordMap">
select
id, store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by
from commission_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="staffId != null">
and staff_id = #{staffId}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="amount != null">
and amount = #{amount}
</if>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="description != null and description != ''">
and description = #{description}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from commission_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="staffId != null">
and staff_id = #{staffId}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="amount != null">
and amount = #{amount}
</if>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="description != null and description != ''">
and description = #{description}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into commission_record(store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by)
values (#{storeId}, #{staffId}, #{type}, #{amount}, #{orderNo}, #{description}, #{createTime}, #{createBy}, #{createTime}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into commission_record(store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.storeId}, #{entity.staffId}, #{entity.type}, #{entity.amount}, #{entity.orderNo}, #{entity.description}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into commission_record(store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.storeId}, #{entity.staffId}, #{entity.type}, #{entity.amount}, #{entity.orderNo}, #{entity.description}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy})
</foreach>
on duplicate key update
store_id = values(store_id),
staff_id = values(staff_id),
type = values(type),
amount = values(amount),
order_no = values(order_no),
description = values(description),
create_time = values(create_time),
create_by = values(create_by),
update_time = values(update_time),
update_by = values(update_by)
</insert>
<!--通过主键修改数据-->
<update id="update">
update commission_record
<set>
<if test="storeId != null">
store_id = #{storeId},
</if>
<if test="staffId != null">
staff_id = #{staffId},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="amount != null">
amount = #{amount},
</if>
<if test="orderNo != null and orderNo != ''">
order_no = #{orderNo},
</if>
<if test="description != null and description != ''">
description = #{description},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from commission_record where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,58 @@
package com.fuint.business.commission.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import io.lettuce.core.dynamic.annotation.Param;
/**
* 提成记录表(CommissionRecord)表服务接口
*
* @author wangh
* @since 2023-11-14 13:40:03
*/
public interface CommissionRecordService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CommissionRecord queryById(Integer id);
/**
* 分页查询
*
* @param commissionRecord 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<CommissionRecord> queryByPage(@Param("page") Page page, CommissionRecord commissionRecord);
/**
* 新增数据
*
* @param commissionRecord 实例对象
* @return 实例对象
*/
CommissionRecord insert(CommissionRecord commissionRecord);
/**
* 修改数据
*
* @param commissionRecord 实例对象
* @return 实例对象
*/
CommissionRecord update(CommissionRecord commissionRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -0,0 +1,89 @@
package com.fuint.business.commission.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.mapper.CommissionRecordMapper;
import com.fuint.business.commission.service.CommissionRecordService;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
/**
* 提成记录表(CommissionRecord)表服务实现类
*
* @author wangh
* @since 2023-11-14 13:40:03
*/
@Service("commissionRecordService")
public class CommissionRecordServiceImpl implements CommissionRecordService {
@Resource
private CommissionRecordMapper commissionRecordMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public CommissionRecord queryById(Integer id) {
return this.commissionRecordMapper.queryById(id);
}
/**
* 分页查询
*
* @param commissionRecord 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<CommissionRecord> queryByPage(@Param("page") Page page, CommissionRecord commissionRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
return this.commissionRecordMapper.queryAllByLimit(page, commissionRecord);
}
/**
* 新增数据
*
* @param commissionRecord 实例对象
* @return 实例对象
*/
@Override
public CommissionRecord insert(CommissionRecord commissionRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
commissionRecord.setStoreId(nowAccountInfo.getStoreId());
this.commissionRecordMapper.insert(commissionRecord);
return commissionRecord;
}
/**
* 修改数据
*
* @param commissionRecord 实例对象
* @return 实例对象
*/
@Override
public CommissionRecord update(CommissionRecord commissionRecord) {
this.commissionRecordMapper.update(commissionRecord);
return this.queryById(commissionRecord.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.commissionRecordMapper.deleteById(id) > 0;
}
}

View File

@ -111,7 +111,7 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by,change_type)
values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{change_type})
values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{changeType})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -60,9 +60,7 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
public IntegralDetail insert(IntegralDetail integralDetail) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralDetail.setStoreId(nowAccountInfo.getStoreId());
integralDetail.setCreateBy(nowAccountInfo.getStaffId().toString());
this.integralDetailMapper.insert(integralDetail);
return integralDetail;
}

View File

@ -19,7 +19,7 @@ import javax.annotation.Resource;
* @since 2023-11-13 18:53:47
*/
@RestController
@RequestMapping("cardFuelChange")
@RequestMapping("business/marketingActivity/cardFuelChange")
public class CardFuelChangeController extends BaseController {
/**
* 服务对象

View File

@ -2,8 +2,10 @@ package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
@ -19,7 +21,7 @@ import javax.annotation.Resource;
* @since 2023-11-13 18:53:31
*/
@RestController
@RequestMapping("cardFuelRecord")
@RequestMapping("business/marketingActivity/cardFuelRecord")
public class CardFuelRecordController extends BaseController {
/**
* 服务对象
@ -89,5 +91,25 @@ public class CardFuelRecordController extends BaseController {
return getSuccessResult(this.cardFuelRecordService.deleteById(id));
}
/**
* 存油卡订单生成充值
* @param cardFuelRecordDTO
* @return
*/
@PostMapping("prepaidFuelTopUp")
public ResponseObject prepaidFuelTopUp(@RequestBody CardFuelRecordDTO cardFuelRecordDTO) {
return getSuccessResult(this.cardFuelRecordService.prepaidFuelTopUp(cardFuelRecordDTO));
}
/**
* 查询支付状态 修改相关关联表
* @param id
* @return
*/
@GetMapping("checkTheStatusOfYourPaymentByFuel")
public ResponseObject checkTheStatusOfYourPaymentByFuel(Integer id) {
return getSuccessResult(this.cardFuelRecordService.checkTheStatusOfYourPaymentByFuel(id));
}
}

View File

@ -0,0 +1,10 @@
package com.fuint.business.marketingActivity.cardFule.dto;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import lombok.Data;
@Data
public class CardFuelRecordDTO extends CardFuelRecord {
private String authCode;
}

View File

@ -17,6 +17,8 @@ public class CardFuelRecord extends BaseEntity {
* 主键id
*/
private Integer id;
private Integer oilNumberId;
/**
* 会员id
*/
@ -52,7 +54,7 @@ public class CardFuelRecord extends BaseEntity {
/**
* 所得升数
*/
private Float incomeLitres;
private Double incomeLitres;
/**
* 支付方式 0扫码支付 1现金支付 2pos刷卡 3微信.......
*/
@ -105,6 +107,7 @@ public class CardFuelRecord extends BaseEntity {
* 店铺id
*/
private Integer storeId;
private Integer chainStoreId;
/**
* 支付编号
*/

View File

@ -214,8 +214,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type)
values (#{mtUserId}, #{name}, #{mobile}, #{mtStaffId}, #{realName}, #{staffMobile}, #{cardFuelId}, #{rechargeBalance}, #{incomeLitres}, #{paymentType}, #{remark}, #{points}, #{growthValue}, #{royaltyType}, #{percentageCommissions}, #{amountCommission}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{payStatus}, #{storeId}, #{paymentNo}, #{type}, #{oilType})
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type,chain_store_id)
values (#{mtUserId}, #{name}, #{mobile}, #{mtStaffId}, #{realName}, #{staffMobile}, #{cardFuelId}, #{rechargeBalance}, #{incomeLitres}, #{paymentType}, #{remark}, #{points}, #{growthValue}, #{royaltyType}, #{percentageCommissions}, #{amountCommission}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{payStatus}, #{storeId}, #{paymentNo}, #{type}, #{oilType}, #{chainStoreId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -2,7 +2,9 @@ package com.fuint.business.marketingActivity.cardFule.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import io.lettuce.core.dynamic.annotation.Param;
@ -55,4 +57,21 @@ public interface CardFuelRecordService {
*/
boolean deleteById(Integer id);
/**
* 存油卡订单生成充值
* @param cardFuelRecordDTO
* @return
*/
CardFuelRecordDTO prepaidFuelTopUp(CardFuelRecordDTO cardFuelRecordDTO);
/**
* 查询支付状态 修改相关关联表
* @param id
* @return
*/
CardFuelRecord checkTheStatusOfYourPaymentByFuel(Integer id);
boolean editPayStatus(Integer id, String payStatus);
}

View File

@ -1,10 +1,30 @@
package com.fuint.business.marketingActivity.cardFule.service.impl;
import cn.hutool.core.util.ObjectUtil;
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.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.api.fuyou.entity.MerchantConfig;
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.cardFule.dto.CardFuelRecordDTO;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelChangeService;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
@ -13,6 +33,9 @@ import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 燃油充值表(CardFuelRecord)表服务实现类
@ -24,7 +47,20 @@ import javax.annotation.Resource;
public class CardFuelRecordServiceImpl implements CardFuelRecordService {
@Resource
private CardFuelRecordMapper cardFuelRecordMapper;
@Autowired
private MerchantConfigService merchantConfigService;
@Autowired
private FyPayService fyPayService;
@Resource
private LJUserMapper ljUserMapper;
@Resource
private UserBalanceService userBalanceService;
@Resource
private CardFuelRecordService cardFuelRecordService;
@Resource
private IntegralDetailService integralDetailService;
@Resource
private CardFuelChangeService cardFuelChangeService;
/**
* 通过ID查询单条数据
*
@ -86,4 +122,187 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
public boolean deleteById(Integer id) {
return this.cardFuelRecordMapper.deleteById(id) > 0;
}
/**
* 修改该支付结果
* @param id
* @param payStatus
* @return
*/
@Override
public boolean editPayStatus(Integer id, String payStatus) {
CardFuelRecord cardFuelRecord = new CardFuelRecord();
cardFuelRecord.setId(id);
cardFuelRecord.setPayStatus(payStatus);
int i = cardFuelRecordMapper.update(cardFuelRecord);
return i>0;
}
@Override
public CardFuelRecordDTO prepaidFuelTopUp(CardFuelRecordDTO cardFuelRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 添加储存充值
if ("CASH".equals(cardFuelRecordDTO.getPaymentType())) {
cardFuelRecordDTO.setPayStatus("paid");
}else {
cardFuelRecordDTO.setPayStatus("unpaid");
}
// 根据日期生成支付编号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = timestamp+randomString;
cardFuelRecordDTO.setPaymentNo(orderNo);
cardFuelRecordDTO.setStoreId(nowAccountInfo.getStoreId());
cardFuelRecordMapper.insert(cardFuelRecordDTO);
Double theAmountToBePaid = 0.0;
boolean flag = false;
double epsilon = 1e-10; // 阈值
if (!ObjectUtil.isEmpty(cardFuelRecordDTO.getRechargeBalance())
&& cardFuelRecordDTO.getRechargeBalance() > epsilon
&& "unpaid".equals(cardFuelRecordDTO.getPayStatus())){
theAmountToBePaid = cardFuelRecordDTO.getRechargeBalance();
flag = true;
}
// 支付
if (flag) {
// Integer allAmount = (int) (theAmountToBePaid*100);
Integer allAmount = (int) (0.01 * 100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
// 处理支付需要的数据
Map<String, String> map = new HashMap<>();
map.put("authCode", cardFuelRecordDTO.getAuthCode());
map.put("allAmount", allAmount.toString());
map.put("orderNo", orderNo);
map.put("payType", cardFuelRecordDTO.getPaymentType());
map.put("insCd", merchantConfig.getInsCd());
map.put("mchntCd", merchantConfig.getMchntCd());
map.put("goodsDes", merchantConfig.getMerchantName());
map.put("publicKey", merchantConfig.getPublicKey());
map.put("privateKey", merchantConfig.getPrivateKey());
map.put("type", "CFR");
map.put("orderId", cardFuelRecordDTO.getId().toString());
// 调用支付接口
try {
fyPayService.pay(map);
} catch (Exception e){
e.printStackTrace();
}
}
return cardFuelRecordDTO;
}
@Override
public CardFuelRecord checkTheStatusOfYourPaymentByFuel(Integer id) {
CardFuelRecord cardFuelRecord = cardFuelRecordMapper.queryById(id);
if ("paid".equals(cardFuelRecord.getPayStatus())){
// 查询用户信息
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(cardFuelRecord.getMtUserId());
// 修改该用户的余额信息
if (!ObjectUtil.isEmpty(ljUserVos)) {
UserBalance userBalance = editRefuelMoney(cardFuelRecord, ljUserVos);
if (!ObjectUtil.isEmpty(userBalance)) {
userBalanceService.updateUserBalance(userBalance);
}
}
// 添加余额充值纪录表
CardFuelChange cardFuelChange = editFuelChange(cardFuelRecord);
cardFuelChangeService.insert(cardFuelChange);
// 积分表变动
if (!ObjectUtil.isEmpty(cardFuelRecord.getPoints()) && cardFuelRecord.getPoints() != 0) {
IntegralDetail integralDetail = changesInPoints(cardFuelRecord,ljUserVos);
integralDetailService.insert(integralDetail);
}
}else {
return cardFuelRecord;
}
return cardFuelRecord;
}
public UserBalance editRefuelMoney(CardFuelRecord cardFuelRecord,LJUserVo ljUserVos) {
List<Map<String, String>> refuelMoneyList = new ArrayList<>();
UserBalance userBalance = new UserBalance();
userBalance.setId(ljUserVos.getBalanceId());
if (ObjectUtil.isEmpty(ljUserVos.getRefuelMoney())) {
Map<String, String> refuelMoney = new HashMap<>();
// todo 目前没有用id
// refuelMoney.put("oilNumberId",cardFuelRecord.getOilNumberId().toString());
refuelMoney.put("type",cardFuelRecord.getType());
refuelMoney.put("oilType",cardFuelRecord.getOilType());
refuelMoney.put("refuelMoney",cardFuelRecord.getIncomeLitres().toString());
refuelMoneyList.add(refuelMoney);
String jsonString = JSON.toJSONString(refuelMoneyList);
userBalance.setRefuelMoney(jsonString);
return userBalance;
} else {
List<Map<String, String>> resultMapList = JSON.parseObject(ljUserVos.getRefuelMoney(), new TypeReference<List<Map<String, Object>>>() {});
boolean flag = true;
for (Map<String, String> stringObjectMap : resultMapList) {
if (stringObjectMap.get("type").equals(cardFuelRecord.getType()) &&
stringObjectMap.get("oilType").equals(cardFuelRecord.getOilType())) {
String refuelMoney = stringObjectMap.get("refuelMoney").toString();
// Double.valueOf(refuelMoney);
BigDecimal ref = new BigDecimal(refuelMoney);
BigDecimal inconLitres = new BigDecimal(cardFuelRecord.getIncomeLitres());
BigDecimal add = ref.add(inconLitres);
stringObjectMap.put("refuelMoney",add.toString());
flag = false;
break;
}
}
if (flag) {
Map<String, String> refuelMoney = new HashMap<>();
refuelMoney.put("type",cardFuelRecord.getType());
refuelMoney.put("oilType",cardFuelRecord.getOilType());
refuelMoney.put("refuelMoney",cardFuelRecord.getIncomeLitres().toString());
resultMapList.add(refuelMoney);
}
String jsonString = JSON.toJSONString(resultMapList);
userBalance.setRefuelMoney(jsonString);
return userBalance;
}
}
public CardFuelChange editFuelChange (CardFuelRecord cardFuelRecord) {
CardFuelChange cardFuelChange = new CardFuelChange();
cardFuelChange.setChainStoreId(cardFuelRecord.getChainStoreId());
cardFuelChange.setUserId(cardFuelRecord.getMtUserId());
cardFuelChange.setChangeType("1");
cardFuelChange.setFromType("油卡充值赠送");
cardFuelChange.setBalance(cardFuelRecord.getIncomeLitres());
cardFuelChange.setType(cardFuelRecord.getType());
cardFuelChange.setOilType(cardFuelRecord.getOilType());
return cardFuelChange;
}
private IntegralDetail changesInPoints(CardFuelRecord cardFuelRecord,LJUserVo ljUserVos) {
IntegralDetail integralDetail = new IntegralDetail();
integralDetail.setUserId(cardFuelRecord.getMtUserId());
integralDetail.setPointsChange(cardFuelRecord.getPoints());
// 计算积分
BigDecimal bigPoints = new BigDecimal(cardFuelRecord.getPoints());
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
integralDetail.setCurrentPoints(addPoints.intValue());
integralDetail.setChangeReason("购买油卡赠送");
return integralDetail;
}
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.business.commission.entity.CommissionRecord;
import com.fuint.business.commission.service.CommissionRecordService;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
@ -22,9 +24,11 @@ import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -37,6 +41,7 @@ import java.util.*;
* @author makejava
* @since 2023-10-31 11:30:11
*/
@Slf4j
@Service("cardValueRecordService")
public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMapper, CardValueRecord> implements CardValueRecordService {
@ -57,6 +62,9 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
@Resource
IntegralDetailService integralDetailService;
@Resource
CommissionRecordService commissionRecordService;
/**
* 储值卡充值新增
* @param cardValueRecord
@ -67,7 +75,9 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
return false;
}
@Override
@Transactional
public CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -104,8 +114,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
theAmountToBePaid = cardValueRecordDTO.getRechargeBalance();
flag = true;
}
// todo
if (flag) {
Integer allAmount = (int) (theAmountToBePaid*100);
// Integer allAmount = (int) (theAmountToBePaid*100);
Integer allAmount = (int) (0.01*100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
// 处理支付需要的数据
@ -139,11 +151,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
* @return
*/
@Override
@Transactional
public CardValueRecord checkTheStatusOfYourPayment(Integer id) {
CardValueRecord cardValueRecord = baseMapper.selectById(id);
if (!"paid".equals(cardValueRecord.getPayStatus())) {
return cardValueRecord;
} else{
// 支付成功之后
if ("paid".equals(cardValueRecord.getPayStatus())){
// 查询用户信息
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(cardValueRecord.getMtUserId());
@ -167,10 +179,17 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
integralDetailService.insert(integralDetail);
}
// 成长值变动明细
// 员工提成
if (!ObjectUtil.isEmpty(cardValueRecord.getRoyaltyType()) && !"1".equals(cardValueRecord.getRoyaltyType())) {
CommissionRecord commissionRecord = employeeCommissions(cardValueRecord);
commissionRecordService.insert(commissionRecord);
}
} else {
return cardValueRecord;
}
return cardValueRecord;
return cardValueRecord;
}
//添加余额明细表
private CardBalanceChange addCardBalance(CardValueRecord cardValueRecord) {
@ -190,6 +209,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtil.isEmpty(cardValueRecordDTO.getPoints())) cardValueRecordDTO.setPoints(0);
if (ObjectUtil.isEmpty(cardValueRecordDTO.getGrowthValue())) cardValueRecordDTO.setGrowthValue(0);
if (ObjectUtil.isEmpty(ljUserVos.getCardBalance())) ljUserVos.setCardBalance(0.00);
if (ObjectUtil.isEmpty(ljUserVos.getPoints())) ljUserVos.setPoints(0);
if (ObjectUtil.isEmpty(ljUserVos.getGrowthValue())) ljUserVos.setGrowthValue(0);
// 计算之后修改对应余额
BigDecimal bigBidBalance = new BigDecimal(cardValueRecordDTO.getBidBalance());
BigDecimal addCardValance = bigBidBalance.add(new BigDecimal(ljUserVos.getCardBalance()));
@ -224,7 +247,16 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
integralDetail.setChangeReason("余额充值赠送");
return integralDetail;
}
// 员工提成
private CommissionRecord employeeCommissions (CardValueRecord cardValueRecord) {
CommissionRecord commissionRecord = new CommissionRecord();
commissionRecord.setStaffId(cardValueRecord.getMtStaffId());
commissionRecord.setAmount(cardValueRecord.getAmountCommission());
commissionRecord.setOrderNo(cardValueRecord.getPaymentNo());
commissionRecord.setDescription("余额充值提成");
commissionRecord.setType("余额充值");
return commissionRecord;
}
// 成长值变动
//支付

View File

@ -0,0 +1,35 @@
package com.fuint.business.order.controller;
import com.fuint.business.order.entity.CreditUnit;
import com.fuint.business.order.service.CreditUnitService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/business/creditUnit")
public class CreditUnitController extends BaseController {
@Autowired
private CreditUnitService creditUnitService;
/**
* 查询所有挂账单位信息
* @return
*/
@GetMapping("/list")
private ResponseObject list(){
return getSuccessResult(creditUnitService.selectCreditUnitList());
}
/**
* 添加挂账单位信息
* @param creditUnit
* @return
*/
@PostMapping
private ResponseObject add(@Validated @RequestBody CreditUnit creditUnit){
return getSuccessResult(creditUnitService.insertCreditUnit(creditUnit));
}
}

View File

@ -0,0 +1,81 @@
package com.fuint.business.order.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.service.HangBillService;
import com.fuint.business.order.vo.HangBillVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 挂账记录信息 controller层
*/
@RestController
@RequestMapping("/business/hangBill")
public class HangBillController extends BaseController {
@Autowired
private HangBillService hangBillService;
/**
* 根据条件分页查询收银员订单信息
* @param hangBillVo
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(HangBillVo hangBillVo,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<HangBillVo> list = hangBillService.selectHangBillList(page,hangBillVo);
return getSuccessResult(list);
}
/**
* 查询所有挂账信息
* @return
*/
@GetMapping("/hangBills")
public ResponseObject hangBills(){
return getSuccessResult(hangBillService.selectHangBills());
}
/**
* 根据id查询挂账信息
* @param id
* @return
*/
@GetMapping("/{id}")
public ResponseObject info(@PathVariable Integer id){
HangBillVo hangBillVo = hangBillService.selectHangBillById(id);
return getSuccessResult(hangBillVo);
}
/**
* 添加挂账记录信息
* @param hangBill
* @return
*/
@PostMapping
public ResponseObject add(@Validated @RequestBody HangBill hangBill){
return getSuccessResult(hangBillService.insertHangBill(hangBill));
}
/**
* 归还挂账记录信息并收款
* @param map
* @return
*/
@PutMapping
public ResponseObject edit(@Validated @RequestBody Map<String,String> map){
int row = hangBillService.updateHangBill(map);
return getSuccessResult(row);
}
}

View File

@ -0,0 +1,58 @@
package com.fuint.business.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 挂账单位信息表(CreditUnit)实体类
*
* @author makejava
* @since 2023-11-14 10:45:00
*/
@Data
@TableName("credit_unit")
@ApiModel(value = "CreditUnit对象", description = "挂账单位信息表")
public class CreditUnit extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 单位名称
*/
private String unitName;
/**
* 挂账人
*/
private String personCredit;
/**
* 联系电话
*/
private String contactMobile;
/**
* 挂账额度
*/
private Double creditLimit;
/**
* 单据备注
*/
private String remark;
/**
* 单位状态启用禁用
*/
private String status;
}

View File

@ -30,26 +30,22 @@ public class HangBill extends BaseEntity implements Serializable {
* 店铺id
*/
private Integer storeId;
/**
* 挂账单位id
*/
private Integer creditUnitId;
/**
* 订单号
*/
private String orderNo;
/**
* 单位名称
*/
private String unitName;
/**
* 挂账人
*/
private String personCredit;
/**
* 联系电话
*/
private String contactMobile;
/**
* 订单状态0未归还1已归还
*/
private String status;
/**
* 支付状态已支付未支付支付失败
*/
private String payStatus;
/**
* 归还状态0挂账1归还
*/
@ -57,7 +53,15 @@ public class HangBill extends BaseEntity implements Serializable {
/**
* 挂账金额
*/
private String amount;
private Double amount;
/**
* 已还金额
*/
private Double repaidAmount;
/**
* 未还金额
*/
private Double outstandAmount;
/**
* 操作员工id
*/
@ -66,127 +70,6 @@ public class HangBill extends BaseEntity implements Serializable {
* 单据备注
*/
private String remark;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建用户
*/
private String createBy;
/**
* 修改用户
*/
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getPersonCredit() {
return personCredit;
}
public void setPersonCredit(String personCredit) {
this.personCredit = personCredit;
}
public String getContactMobile() {
return contactMobile;
}
public void setContactMobile(String contactMobile) {
this.contactMobile = contactMobile;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public Integer getStaffId() {
return staffId;
}
public void setStaffId(Integer staffId) {
this.staffId = staffId;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
}

View File

@ -0,0 +1,10 @@
package com.fuint.business.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.order.entity.CreditUnit;
/**
* 挂账单位信息 mapper层
*/
public interface CreditUnitMapper extends BaseMapper<CreditUnit> {
}

View File

@ -1,10 +1,37 @@
package com.fuint.business.order.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.order.entity.HangBill;
import com.fuint.business.order.vo.HangBillVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 挂账记录表 mapper层
*/
public interface HangBillMapper extends BaseMapper<HangBill> {
/**
* 根据条件分页查询油品订单信息
* @param page
* @param hangBill
* @return
*/
public IPage<HangBillVo> selectHangBillList(Page page,@Param("hangBill") HangBillVo hangBill);
/**
* 查询所有挂账信息
* @param storeId
* @return
*/
public List<HangBillVo> selectHangBills(@Param("storeId") int storeId);
/**
* 根据id查询挂账信息
* @param id
* @return
*/
public HangBillVo selectHangBillById(@Param("id") int id);
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.order.mapper.HangBillMapper">
<sql id="selectHangBill">
select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile
from hang_bill hb
inner join mt_staff ms on hb.staff_id = ms.id
inner join credit_unit cu on hb.credit_unit_id = cu.id
</sql>
<select id="selectHangBillList" resultType="com.fuint.business.order.vo.HangBillVo">
<include refid="selectHangBill"></include>
<where>
hb.store_id = #{hangBill.storeId}
<if test="hangBill.status != null and hangBill.status != ''">
and hb.status = #{hangBill.status}
</if>
<if test="hangBill.returnType != null and hangBill.returnType != ''">
and hb.return_type = #{hangBill.returnType}
</if>
<if test="hangBill.unitName != null and hangBill.unitName != ''">
and cu.unit_name like concat('%', #{hangBill.unitName}, '%')
</if>
<if test="hangBill.personCredit != null and hangBill.personCredit != ''">
and cu.person_credit like concat('%', #{hangBill.personCredit}, '%')
</if>
<if test="hangBill.contactMobile != null and hangBill.contactMobile != ''">
and cu.contact_mobile like concat('%', #{hangBill.contactMobile}, '%')
</if>
<if test="hangBill.mobile != null and hangBill.mobile != ''">
and ms.mobile like concat('%', #{hangBill.mobile}, '%')
</if>
<if test="hangBill.params.beginTime != null and hangBill.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(hb.create_time,'%y%m%d') &gt;= date_format(#{hangBill.params.beginTime},'%y%m%d')
</if>
<if test="hangBill.params.endTime != null and hangBill.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(hb.create_time,'%y%m%d') &lt;= date_format(#{hangBill.params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectHangBillById" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">
<include refid="selectHangBill"></include>
<where>
hb.id = #{id}
</where>
</select>
<select id="selectHangBills" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">
<include refid="selectHangBill"></include>
<where>
hb.store_id = #{storeId}
</where>
</select>
</mapper>

View File

@ -0,0 +1,24 @@
package com.fuint.business.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.order.entity.CreditUnit;
import java.util.List;
/**
* 挂账单位信息 业务层
*/
public interface CreditUnitService extends IService<CreditUnit> {
/**
* 查询所有挂账单位信息
* @return
*/
public List<CreditUnit> selectCreditUnitList();
/**
* 添加挂账单位信息
* @param creditUnit
* @return
*/
public int insertCreditUnit(CreditUnit creditUnit);
}

View File

@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.vo.HangBillVo;
import java.util.List;
import java.util.Map;
/**
* 挂账记录信息 业务层
@ -15,7 +19,27 @@ public interface HangBillService extends IService<HangBill> {
* @param hangBill
* @return
*/
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill);
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill);
/**
* 查询所有挂账记录信息
* @return
*/
public List<HangBillVo> selectHangBills();
/**
* 根据id查询挂账信息
* @param id
* @return
*/
public HangBillVo selectHangBillById(int id);
/**
* 根据订单号查询挂账信息
* @param orderNo
* @return
*/
public HangBill selectHangBillByOrderNo(String orderNo);
/**
* 添加挂账记录
@ -23,4 +47,19 @@ public interface HangBillService extends IService<HangBill> {
* @return
*/
public int insertHangBill(HangBill hangBill);
/**
* 修改挂账记录 并收款
* @param map
* @return
*/
public int updateHangBill(Map<String,String> map);
/**
* 修改挂账信息
* @param hangBill
* @param repaidAmount
* @return
*/
public int updateHangBills(HangBill hangBill,Double repaidAmount);
}

View File

@ -0,0 +1,27 @@
package com.fuint.business.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.order.entity.CreditUnit;
import com.fuint.business.order.mapper.CreditUnitMapper;
import com.fuint.business.order.service.CreditUnitService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CreditUnitServiceImpl extends ServiceImpl<CreditUnitMapper, CreditUnit> implements CreditUnitService {
@Override
public List<CreditUnit> selectCreditUnitList() {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status","qy");
List<CreditUnit> list = baseMapper.selectList(queryWrapper);
return list;
}
@Override
public int insertCreditUnit(CreditUnit creditUnit) {
int row = baseMapper.insert(creditUnit);
return row;
}
}

View File

@ -1,31 +1,165 @@
package com.fuint.business.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.service.OilConfigService;
import com.fuint.business.order.entity.HangBill;
import com.fuint.business.order.mapper.HangBillMapper;
import com.fuint.business.order.service.HangBillService;
import com.fuint.business.order.vo.HangBillVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 挂账记录信息 业务层
*/
@Service
public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService {
@Override
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill) {
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
hangBill.setStoreId(storeId);
return null;
IPage<HangBillVo> hangBillVoIPage = baseMapper.selectHangBillList(page, hangBill);
return hangBillVoIPage;
}
@Override
public List<HangBillVo> selectHangBills() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
List<HangBillVo> hangBillVos = baseMapper.selectHangBills(storeId);
return hangBillVos;
}
@Override
public HangBillVo selectHangBillById(int id) {
HangBillVo hangBillVo = baseMapper.selectHangBillById(id);
return hangBillVo;
}
@Override
public HangBill selectHangBillByOrderNo(String orderNo) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_no",orderNo);
HangBill hangBill = baseMapper.selectOne(queryWrapper);
return hangBill;
}
@Override
public int insertHangBill(HangBill hangBill) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
hangBill.setStoreId(storeId);
// 根据日期生成订单号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = timestamp+randomString;
Integer staffId = nowAccountInfo.getStaffId();
hangBill.setStaffId(staffId);
hangBill.setOrderNo(orderNo);
hangBill.setOutstandAmount(hangBill.getAmount());
hangBill.setRepaidAmount(0.0);
int row = baseMapper.insert(hangBill);
return row;
}
@Autowired
private FyPayService fyPayService;
@Autowired
private MerchantConfigService merchantConfigService;
@Autowired
private OilConfigService oilConfigService;
@Override
public int updateHangBill(Map<String,String> map) {
String payType = map.get("payType");
if (!map.get("repaidAmount").equals("0") && !payType.equals("CASH")){
Integer allAmount = (int) (Double.valueOf(map.get("repaidAmount"))*100);
// 判断是否开启支付规则
List<MerchantConfig> list = merchantConfigService.selectMeChByIsOpen();
if (list.size()>0){
oilConfigService.oilRule();
}
// 根据店铺id查询商户配置信息
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
// 处理支付需要的数据
Map<String,String> map1 = new HashMap<>();
map1.put("authCode",map.get("authCode"));
map1.put("allAmount",allAmount.toString());
map1.put("orderNo",map.get("orderNo"));
map1.put("payType",payType);
map1.put("insCd",merchantConfig.getInsCd());
map1.put("mchntCd",merchantConfig.getMchntCd());
map1.put("goodsDes",merchantConfig.getMerchantName());
map1.put("publicKey",merchantConfig.getPublicKey());
map1.put("privateKey",merchantConfig.getPrivateKey());
try {
fyPayService.pay(map);
}catch (Exception e){
e.printStackTrace();
}
}
// 根据id查询挂账信息
HangBill hangBill = baseMapper.selectById(Integer.parseInt(map.get("id")));
if (payType.equals("CASH")){
hangBill.setPayStatus("paid");
}
int row = 0;
hangBill.setRemark(map.get("remark"));
// 支付成功后修改挂账信息
if (hangBill.getPayStatus().equals("paid")){
Double repaidAmount1 = Double.valueOf(map.get("repaidAmount"));
Double amount = hangBill.getAmount();
Double repaidAmount = hangBill.getRepaidAmount();
Double outstandAmount = hangBill.getOutstandAmount();
Double repaidAmountAfter = repaidAmount+repaidAmount1;
// 修改挂账信息
hangBill.setRepaidAmount(repaidAmountAfter);
hangBill.setOutstandAmount(amount-repaidAmountAfter);
if (outstandAmount == repaidAmountAfter){
hangBill.setStatus("1");
hangBill.setReturnType("1");
}else {
hangBill.setStatus("2");
}
}
row = baseMapper.updateById(hangBill);
return row;
}
@Override
public int updateHangBills(HangBill hangBill, Double repaidAmount) {
HangBill hangBill1 = this.updateStatus(hangBill, repaidAmount);
int row = baseMapper.updateById(hangBill1);
return row;
}
private HangBill updateStatus(HangBill hangBill,Double repaidAmount1){
Double amount = hangBill.getAmount();
Double repaidAmount = hangBill.getRepaidAmount();
Double outstandAmount = hangBill.getOutstandAmount();
Double repaidAmountAfter = repaidAmount+repaidAmount1;
// 修改挂账信息
hangBill.setRepaidAmount(repaidAmountAfter);
hangBill.setOutstandAmount(amount-repaidAmountAfter);
if (outstandAmount == repaidAmountAfter){
hangBill.setStatus("1");
hangBill.setReturnType("1");
}else {
hangBill.setStatus("2");
}
return hangBill;
}
}

View File

@ -5,4 +5,14 @@ import lombok.Data;
@Data
public class HangBillVo extends HangBill {
// 操作人名称
private String realName;
// 操作人手机号
private String mobile;
// 单位名称
private String unitName;
// 挂账人
private String personCredit;
// 联系电话
private String contactMobile;
}

View File

@ -53,7 +53,7 @@ public class UserBalance extends BaseEntity implements Serializable {
/**
* 加油金
*/
private Integer refuelMoney;
private String refuelMoney;
}

View File

@ -64,7 +64,8 @@
mub.id balanceId,
mub.card_balance cardBalance,
mub.points,
mub.growth_value growthValue
mub.growth_value growthValue,
mub.refuel_money refuelMoney
from mt_user mu
left join mt_user_balance mub on mu.id = mub.mt_user_id
where mu.id = #{userId}

View File

@ -59,6 +59,8 @@ public class LJUserVo extends BaseEntity {
// 成长值
private Integer growthValue;
private String refuelMoney;
// 出生日期
private String birthday;

View File

@ -0,0 +1,19 @@
import request from '@/utils/request'
// 查询挂账信息列表
export function listCreditUnit(query) {
return request({
url: '/business/creditUnit/list',
method: 'get',
params: query
})
}
// 新增挂账记录
export function addCreditUnit(data) {
return request({
url: '/business/creditUnit',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询挂账信息列表
export function listHangBill(query) {
return request({
url: '/business/hangBill/list',
method: 'get',
params: query
})
}
// 查询挂账信息列表
export function hangBillInfo(id) {
return request({
url: '/business/hangBill/'+id,
method: 'get',
})
}
// 查询所有挂账信息列表
export function hangBills() {
return request({
url: '/business/hangBill/hangBills',
method: 'get',
})
}
// 新增挂账记录
export function addHangBill(data) {
return request({
url: '/business/hangBill',
method: 'post',
data: data
})
}
// 修改挂账记录及收款
export function editHangBill(data) {
return request({
url: '/business/hangBill',
method: 'put',
data: data
})
}

View File

@ -0,0 +1,17 @@
import request from '@/utils/request'
export function getGiftApi(data) {
return request({
url: 'business/integral/integralGift/queryByPage',
method: 'get',
params: data
})
}
export function getGiftCategoryApi(data) {
return request({
url: 'business/integral/integralGiftCategory/queryByPage',
method: 'get',
params: data
})
}

View File

@ -52,12 +52,14 @@
<div class="center-right">
<div class="center-right-top">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="全部" name="first"></el-tab-pane>
<el-tab-pane label="车用品" name="second"></el-tab-pane>
<el-tab-pane label="优惠卡券" name="third"></el-tab-pane>
<el-tab-pane label="食品酒饮" name="fourth"></el-tab-pane>
<el-tab-pane label="数码家电" name="fourthf"></el-tab-pane>
<el-tab-pane label="其它礼品" name="fourthp"></el-tab-pane>
<el-tab-pane v-for="(item,index) in giftCategoryList" :label="item.categoryName" :name='index'></el-tab-pane>
<!-- <el-tab-pane label="全部" name="first"></el-tab-pane>-->
<!-- <el-tab-pane label="车用品" name="second"></el-tab-pane>-->
<!-- <el-tab-pane label="优惠卡券" name="third"></el-tab-pane>-->
<!-- <el-tab-pane label="食品酒饮" name="fourth"></el-tab-pane>-->
<!-- <el-tab-pane label="数码家电" name="fourthf"></el-tab-pane>-->
<!-- <el-tab-pane label="其它礼品" name="fourthp"></el-tab-pane>-->
</el-tabs>
<div style="width: 200px; ">
<el-input v-model="input" placeholder="请输入内容"></el-input>
@ -67,17 +69,17 @@
<div class="wrap-right">
<div class="ts-box">
<div class="wrap-right-box" v-for="(item,index) in 17" :key="index">
<div class="wrap-right-box" v-for="(item,index) in giftList" :key="item.id">
<el-card shadow="hover">
<div class="box-six">
<img src="../../../assets/images/goods.png" >
<img :src="imagePath+item.coverImage" >
</div>
<div class="box-four">
<div class="title-red">1000积分</div>
<div class="title-red">{{item.exchangePoints}}积分</div>
<div class="title-hui">库存:不限</div>
<div class="title-goods">
<el-tag type="danger" size="mini" effect="dark">加钱购</el-tag>
<span style="margin-left: 5px">商品名称</span>
<span style="margin-left: 5px">{{item.giftName}}</span>
</div>
</div>
</el-card>
@ -98,15 +100,47 @@
</template>
<script>
import {getGiftApi,getGiftCategoryApi} from "@/api/cashier/integral";
export default {
name: "Integral",
dict: [],
data(){
return{
activeName:'first',
giftList:'',
giftCategoryList:'',
queryParams: {
page: 1,
pageSize: 10,
},
//
imagePath: process.env.VUE_APP_SERVER_URL,
activeName:0,
input:''
}
},
created() {
this.getGiftCategory();
this.getGift();
},
methods:{
//
getGift() {
getGiftApi().then(res=>{
this.giftList = res.data.records;
})
console.log("imagePath",this.imagePath)
},
//
getGiftCategory() {
getGiftCategoryApi().then(res=>{
this.giftCategoryList = res.data.records;
})
},
handleClick(tab, event){
console.log(tab, event);
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || 'fuint会员营销管理系统' // 网页标题
const port = process.env.port || process.env.npm_config_port || 81 // 端口
const port = process.env.port || process.env.npm_config_port || 82 // 端口
const serverUrl = process.env.VUE_APP_SERVER_URL || 'https://www.fuint.cn'