From 7ab789ba2a857dd343fb13fde5f0ae1cea25d21f Mon Sep 17 00:00:00 2001 From: "@QQNZX" Date: Tue, 14 Nov 2023 16:08:33 +0800 Subject: [PATCH 1/5] 11.11 --- .../api/EventMarketing/activeConsumption.js | 2 +- .../activeConsumption/index.vue | 186 +++--------------- .../EventMarketing/activeDiscount/index.vue | 2 +- .../EventMarketing/activeFullminus/index.vue | 2 +- .../EventMarketing/activeNewlyweds/index.vue | 2 +- .../EventMarketing/activeRecommend/index.vue | 2 +- .../src/views/EventMarketing/center/index.vue | 55 ++++++ 7 files changed, 86 insertions(+), 165 deletions(-) create mode 100644 fuintAdmin/src/views/EventMarketing/center/index.vue diff --git a/fuintAdmin/src/api/EventMarketing/activeConsumption.js b/fuintAdmin/src/api/EventMarketing/activeConsumption.js index 1fb58105e..7435fa614 100644 --- a/fuintAdmin/src/api/EventMarketing/activeConsumption.js +++ b/fuintAdmin/src/api/EventMarketing/activeConsumption.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询消费有礼活动列表 export function listActiveConsumption(query) { return request({ - url: '/business/marketingActivity/activeConsumption/list', + url: '/business/marketingActivity/activeConsumption', method: 'get', params: query }) diff --git a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue index 5e7cb0b34..8bf3ee79b 100644 --- a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue +++ b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue @@ -1,22 +1,8 @@ + From 9fb78cf532730e962d74c8d968f2065944abb444 Mon Sep 17 00:00:00 2001 From: wangh <9483> Date: Tue, 14 Nov 2023 18:53:58 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fuintAdmin/src/api/EventMarketing/cardSet.js | 30 ++- fuintAdmin/src/views/member/userInfo.vue | 250 +++++++++++++++--- .../fuyou/service/impl/FyPayServiceImpl.java | 29 +- .../CommissionRecordController.java | 95 +++++++ .../commission/entity/CommissionRecord.java | 17 +- .../mapper/CommissionRecordMapper.java | 85 ++++++ .../mapper/xml/CommissionRecordMapper.xml | 187 +++++++++++++ .../service/CommissionRecordService.java | 58 ++++ .../impl/CommissionRecordServiceImpl.java | 89 +++++++ .../mapper/xml/IntegralDetailMapper.xml | 2 +- .../impl/IntegralDetailServiceImpl.java | 4 +- .../controller/CardFuelChangeController.java | 2 +- .../controller/CardFuelRecordController.java | 24 +- .../cardFule/dto/CardFuelRecordDTO.java | 10 + .../cardFule/entity/CardFuelRecord.java | 5 +- .../mapper/xml/CardFuelRecordMapper.xml | 4 +- .../service/CardFuelRecordService.java | 19 ++ .../impl/CardFuelRecordServiceImpl.java | 221 +++++++++++++++- .../impl/CardValueRecordServiceImpl.java | 48 +++- .../userManager/entity/UserBalance.java | 2 +- .../userManager/mapper/xml/LJUserMapper.xml | 3 +- .../business/userManager/vo/LJUserVo.java | 2 + fuintCashierWeb/src/api/cashier/integral.js | 17 ++ .../views/cashier/NewComponents/Integral.vue | 56 +++- fuintCashierWeb/vue.config.js | 2 +- 25 files changed, 1184 insertions(+), 77 deletions(-) create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/controller/CommissionRecordController.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/CommissionRecordMapper.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/xml/CommissionRecordMapper.xml create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/dto/CardFuelRecordDTO.java create mode 100644 fuintCashierWeb/src/api/cashier/integral.js diff --git a/fuintAdmin/src/api/EventMarketing/cardSet.js b/fuintAdmin/src/api/EventMarketing/cardSet.js index 4333cd375..755d8daea 100644 --- a/fuintAdmin/src/api/EventMarketing/cardSet.js +++ b/fuintAdmin/src/api/EventMarketing/cardSet.js @@ -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 }) -} \ No newline at end of file +} + +// 余额插入订单 油卡 +export function getCheckTheStatusOfYourPaymentByFuelApi(query) { + return request({ + url: 'business/marketingActivity/cardFuelRecord/checkTheStatusOfYourPaymentByFuel?id='+query, + method: 'get', + params: query + }) +} diff --git a/fuintAdmin/src/views/member/userInfo.vue b/fuintAdmin/src/views/member/userInfo.vue index 22e606174..75b304e74 100644 --- a/fuintAdmin/src/views/member/userInfo.vue +++ b/fuintAdmin/src/views/member/userInfo.vue @@ -416,7 +416,7 @@
支付方式
- + {{ dict.dictLabel }}
@@ -467,14 +467,14 @@ 升数卡充值不支持自定义积分,选择对应充值活动获得对应积分[需开启积分活动有效] -
+
@@ -498,11 +498,7 @@
支付方式
- - + {{ dict.label }}
@@ -534,9 +530,9 @@ 汽油 --> -
赠送金额
+
- + @@ -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; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index 1d635e436..dea5035a4 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -10,6 +10,7 @@ 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.LJOrder; @@ -36,6 +37,8 @@ public class FyPayServiceImpl implements FyPayService { private CashierOrderService cashierOrderService; @Resource private CardValueRecordService cardValueRecordService; + @Resource + private CardFuelRecordService cardFuelRecordService; /** * 条码支付 * @param map1 @@ -70,6 +73,8 @@ public class FyPayServiceImpl implements FyPayService { //响应报文验签 Map 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"); @@ -154,11 +159,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(); @@ -183,12 +191,15 @@ public class FyPayServiceImpl implements FyPayService { 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 +210,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()); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/controller/CommissionRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/controller/CommissionRecordController.java new file mode 100644 index 000000000..538880a0a --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/controller/CommissionRecordController.java @@ -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)); + } + + + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java index 5ee92039c..bdf1e0b5a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/entity/CommissionRecord.java @@ -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; + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/CommissionRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/CommissionRecordMapper.java new file mode 100644 index 000000000..56b9c7367 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/CommissionRecordMapper.java @@ -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 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 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param commissionRecord 实例对象 + * @return 影响行数 + */ + int update(CommissionRecord commissionRecord); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/xml/CommissionRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/xml/CommissionRecordMapper.xml new file mode 100644 index 000000000..a4bc7cfc0 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/mapper/xml/CommissionRecordMapper.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 into commission_record(store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by) + values + + (#{entity.storeId}, #{entity.staffId}, #{entity.type}, #{entity.amount}, #{entity.orderNo}, #{entity.description}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}) + + + + + insert into commission_record(store_id, staff_id, type, amount, order_no, description, create_time, create_by, update_time, update_by) + values + + (#{entity.storeId}, #{entity.staffId}, #{entity.type}, #{entity.amount}, #{entity.orderNo}, #{entity.description}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}) + + 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) + + + + + update commission_record + + + store_id = #{storeId}, + + + staff_id = #{staffId}, + + + type = #{type}, + + + amount = #{amount}, + + + order_no = #{orderNo}, + + + description = #{description}, + + + create_time = #{createTime}, + + + create_by = #{createBy}, + + + update_time = #{updateTime}, + + + update_by = #{updateBy}, + + + where id = #{id} + + + + + delete from commission_record where id = #{id} + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java new file mode 100644 index 000000000..2a91c040d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/CommissionRecordService.java @@ -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 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); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java new file mode 100644 index 000000000..b741d4a99 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/commission/service/impl/CommissionRecordServiceImpl.java @@ -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 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; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml index a4e6e71ed..c4410b839 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/mapper/xml/IntegralDetailMapper.xml @@ -111,7 +111,7 @@ 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}) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java index 14e6a5c2f..f9881b1b6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/integral/service/impl/IntegralDetailServiceImpl.java @@ -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; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelChangeController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelChangeController.java index 8765ac8fe..e61cca79e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelChangeController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelChangeController.java @@ -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 { /** * 服务对象 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelRecordController.java index ebc2cf523..aa09ad207 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/controller/CardFuelRecordController.java @@ -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)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/dto/CardFuelRecordDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/dto/CardFuelRecordDTO.java new file mode 100644 index 000000000..c874ae2eb --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/dto/CardFuelRecordDTO.java @@ -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; + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelRecord.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelRecord.java index 5fa692a78..76cb508a7 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelRecord.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/entity/CardFuelRecord.java @@ -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:现金支付 2:pos刷卡 3:微信....... */ @@ -105,6 +107,7 @@ public class CardFuelRecord extends BaseEntity { * 店铺id */ private Integer storeId; + private Integer chainStoreId; /** * 支付编号 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/mapper/xml/CardFuelRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/mapper/xml/CardFuelRecordMapper.xml index 8ce4083ae..4880b03cf 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/mapper/xml/CardFuelRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/mapper/xml/CardFuelRecordMapper.xml @@ -214,8 +214,8 @@ - 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}) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelRecordService.java index 375cc001f..35a2f51fe 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/CardFuelRecordService.java @@ -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); + + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java index fd347c890..18be624b8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java @@ -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 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> refuelMoneyList = new ArrayList<>(); + UserBalance userBalance = new UserBalance(); + userBalance.setId(ljUserVos.getBalanceId()); + if (ObjectUtil.isEmpty(ljUserVos.getRefuelMoney())) { + Map 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> resultMapList = JSON.parseObject(ljUserVos.getRefuelMoney(), new TypeReference>>() {}); + boolean flag = true; + for (Map 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 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; + } + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 5fc73540b..5136d4c15 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -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 implements CardValueRecordService { @@ -57,6 +62,9 @@ public class CardValueRecordServiceImpl extends ServiceImpl
- - - - - - + + + + + + + +
@@ -67,17 +69,17 @@
-
+
- +
-
1000积分
+
{{item.exchangePoints}}积分
库存:不限
加钱购 - 商品名称 + {{item.giftName}}
@@ -98,15 +100,47 @@ From 6a8849aea456be281ea9724e81614d4c9bad93cb Mon Sep 17 00:00:00 2001 From: "@QQNZX" Date: Wed, 15 Nov 2023 14:33:51 +0800 Subject: [PATCH 5/5] 11.15 --- .../api/EventMarketing/activeConsumption.js | 21 +- .../api/EventMarketing/cardExchangeRecord.js | 8 + .../views/EventMarketing/SaveBlock/index.vue | 4 +- .../activeConsumption/index.vue | 503 +++++++++++++++--- .../src/views/EventMarketing/center/index.vue | 8 +- .../src/views/EventMarketing/online/index.vue | 18 +- 6 files changed, 486 insertions(+), 76 deletions(-) diff --git a/fuintAdmin/src/api/EventMarketing/activeConsumption.js b/fuintAdmin/src/api/EventMarketing/activeConsumption.js index bf5f10526..5bd2999ea 100644 --- a/fuintAdmin/src/api/EventMarketing/activeConsumption.js +++ b/fuintAdmin/src/api/EventMarketing/activeConsumption.js @@ -8,6 +8,7 @@ export function listActiveConsumption(query) { params: query }) } +//优惠券 export function listFavorable(query) { return request({ url: 'business/marketingActivity/cardFavorable', @@ -15,11 +16,27 @@ export function listFavorable(query) { 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 + }) +} // 查询消费有礼活动详细 export function getActiveConsumption(id) { return request({ - url: '/business/marketingActivity/activeConsumption/' + id, + url: 'business/marketingActivity/activeConsumption/' + id, method: 'get' }) } @@ -36,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 }) diff --git a/fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js b/fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js index c42209ca9..b31763198 100644 --- a/fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js +++ b/fuintAdmin/src/api/EventMarketing/cardExchangeRecord.js @@ -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) { diff --git a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue index 432f6536f..111d1319c 100644 --- a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue +++ b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue @@ -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:'', diff --git a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue index 6f7263a9f..4e7620dc4 100644 --- a/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue +++ b/fuintAdmin/src/views/EventMarketing/activeConsumption/index.vue @@ -52,7 +52,11 @@ - + + + @@ -60,16 +64,48 @@ - + + + - - - + + + + + + + + + - + + - + + + + + + + + + @@ -107,7 +143,7 @@ - + @@ -140,18 +176,18 @@ border style="width: 100%">
-
选择兑换券
新增
+
选择兑换券
新增
+ width="80"> + width="80"> + width="80"> + width="240"> - + label="操作" + + > @@ -264,28 +301,66 @@
-
赠送实物
-
+
选择实物
新增
+
+ + + + + + + + + + + + + + + +
- - + + @@ -297,8 +372,8 @@ - - + + @@ -310,8 +385,8 @@ - - + + @@ -323,14 +398,14 @@ - + - + @@ -350,21 +425,22 @@ - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 选择 + + +