From 7e48ac59dd687f642b92393731961dd65387bdfe Mon Sep 17 00:00:00 2001 From: wangh <9483> Date: Tue, 6 Feb 2024 15:48:25 +0800 Subject: [PATCH] no message --- .../CardFavorableRecordController.java | 8 +++ .../dto/CardFavorableAdnUserDTO.java | 3 + .../mapper/CardFavorableRecordMapper.java | 3 + .../mapper/xml/CardFavorableRecordMapper.xml | 9 +++ .../service/CardFavorableRecordService.java | 2 + .../impl/CardFavorableRecordServiceImpl.java | 6 ++ .../service/impl/AllOrderInfoServiceImpl.java | 42 ++++++++---- .../userManager/mapper/UserBalanceMapper.java | 4 ++ .../mapper/xml/UserBalanceMapper.xml | 15 +++++ .../service/UserBalanceService.java | 4 ++ .../service/impl/UserBalanceServiceImpl.java | 43 ++++++++++++- .../src/api/cashier/cardfavorablerecord.js | 10 +++ .../cashier/orderComponents/order_Oil.vue | 64 +++++++++++++------ 13 files changed, 180 insertions(+), 33 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java index df79494ea..76d0992c8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/controller/CardFavorableRecordController.java @@ -174,5 +174,13 @@ public class CardFavorableRecordController extends BaseController { public ResponseObject selectCount(@Param("cardFuelDiesel") CardFavorableRecord cardFavorableRecord) { return getSuccessResult(this.cardFavorableRecordService.selectCount(cardFavorableRecord)); } + + /** + * 查询优惠券信息 + */ + @GetMapping("getInfoById/{id}") + public ResponseObject getInfoById(@PathVariable("id") Integer id) { + return getSuccessResult(this.cardFavorableRecordService.getInfoById(id)); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/CardFavorableAdnUserDTO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/CardFavorableAdnUserDTO.java index 988f08c32..f9d202aea 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/CardFavorableAdnUserDTO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/dto/CardFavorableAdnUserDTO.java @@ -15,4 +15,7 @@ public class CardFavorableAdnUserDTO extends CardFavorable { private List gradeIds; //天数 private Integer days; + + //优惠卷名称 + private String favorableName; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/CardFavorableRecordMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/CardFavorableRecordMapper.java index cade4337b..29f540005 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/CardFavorableRecordMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/CardFavorableRecordMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.marketingActivity.activeExchange.dto.PaymentActiveDTO; +import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableAdnUserDTO; import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableDTOS; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -41,5 +42,7 @@ public interface CardFavorableRecordMapper extends BaseMapper getCanUserCardFavorableList(@Param("paymentActiveDTO") PaymentActiveDTO paymentActiveDTO); boolean updateCardAndActiveById(@Param("cardFavorableId") Integer cardFavorableId, @Param("userId") Integer userId, @Param("storeId") Integer storeId); + + CardFavorableAdnUserDTO getInfoById(Integer id); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml index 1964bcb2f..688c81a8e 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/mapper/xml/CardFavorableRecordMapper.xml @@ -176,5 +176,14 @@ and mt_user_id = #{userId} and store_id = #{storeId} + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java index 0677f5e23..4af560fe9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java @@ -72,5 +72,7 @@ public interface CardFavorableRecordService extends IService oilOrders = oilOrderService.selectOilOrder(oilOrder.getOrderNo()); // 获取油罐数据 @@ -296,12 +311,17 @@ public class AllOrderInfoServiceImpl extends ServiceImpl { int subtractUserBalanceByLock(UserBalanceVo balance); + + int updateRefuelMoney(UserBalance userBalance); + + int addUserBalance(Integer id, Double changeCardBalance); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/UserBalanceMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/UserBalanceMapper.xml index c04cfeb48..b19abd212 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/UserBalanceMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/mapper/xml/UserBalanceMapper.xml @@ -2,6 +2,7 @@ + update mt_user_balance @@ -17,4 +18,18 @@ where id = #{id} + + update mt_user_balance + set + refuel_money = #{refuelMoney} + where id = #{id} + + + + update mt_user_balance + set + card_balance = card_balance +#{changeCardBalance} + where id = #{id} + + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java index 4e3d06d15..8a6f7c998 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java @@ -64,4 +64,8 @@ public interface UserBalanceService extends IService { int subtractUserBalanceByLock(UserBalanceVo balance); + int addUserOil(String oilId, Integer userId, Integer chainStoreId, Double changeOil); + + int addUserBalance(Integer userId, Integer chainStoreId, Double changeBalance); + } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java index cc574db03..61ca703c2 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/impl/UserBalanceServiceImpl.java @@ -1,6 +1,9 @@ package com.fuint.business.userManager.service.impl; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.storeInformation.entity.LJStore; @@ -14,11 +17,14 @@ import com.fuint.business.userManager.vo.UserBalanceVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.RedisLock; import com.fuint.common.util.TokenUtil; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.List; +import java.util.Map; import java.util.concurrent.TimeUnit; /** @@ -58,12 +64,45 @@ public class UserBalanceServiceImpl extends ServiceImpl> resultMapList = JSON.parseObject(userBalance.getRefuelMoney(), new TypeReference>>() {}); + + + + for (Map stringStringMap : resultMapList) { + if (oilId.equals(stringStringMap.get("oilType"))) { + BigDecimal resRefuelMoney = new BigDecimal(stringStringMap.get("refuelMoney")); + BigDecimal refuelMoney = resRefuelMoney.add(new BigDecimal(changeOil.toString())); + stringStringMap.put("refuelMoney",resRefuelMoney.toString()); + break; + } + } + + String jsonString = JSON.toJSONString(resultMapList); + userBalance.setRefuelMoney(jsonString); + } + int row = baseMapper.updateRefuelMoney(userBalance); return row; } + // 增加用户余额信息 + @Override + public int addUserBalance(Integer userId, Integer chainStoreId, Double changeBalance) { + UserBalance userBalance = selectUserBalance(userId, chainStoreId); + return baseMapper.addUserBalance(userBalance.getId(), changeBalance); + } + @Resource RedisLock redisLock; diff --git a/fuintCashierWeb/src/api/cashier/cardfavorablerecord.js b/fuintCashierWeb/src/api/cashier/cardfavorablerecord.js index fc4fa9cc7..46b27219a 100644 --- a/fuintCashierWeb/src/api/cashier/cardfavorablerecord.js +++ b/fuintCashierWeb/src/api/cashier/cardfavorablerecord.js @@ -8,3 +8,13 @@ export function listCardFavorableRecord(cardValueRecord) { params: cardValueRecord }) } + + +// 根据id查询 +export function getInfoByIdApi(id) { + return request({ + url: '/business/marketingActivity/cardFavorableRecord/getInfoById/'+id, + method: 'get', + // params: cardValueRecord + }) +} diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue index 46aed4334..91725ec39 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue @@ -252,11 +252,11 @@
订单金额
退款单号:{{ oilOrder.orderNo }}
- +
是否退掉优惠券: - 优惠卷信息 + 优惠卷信息
退款原因
@@ -327,6 +327,7 @@ import {getOrderInfoApi, refundApi} from "@/api/cashier/refund"; import {exportExcelOilOrderApi} from "@/api/order/exportExcel"; import {getLodop} from "@/api/LodopFuncs"; + import {getInfoByIdApi} from "@/api/cashier/cardfavorablerecord"; export default { name: "order_Cashier", @@ -340,7 +341,8 @@ radio1:"油号选错", dialogRefund:false, loading: false, - + // 是否退优惠券 + isOilVouchers:false, // 员工列表 staffList:[], // 终端列表 @@ -367,6 +369,8 @@ // 用户列表 userList:[], + // 输入退款金额 + refundAmt:0, orderStatistics: { numberOfOilPens:'0', theTotalAmountOfOil:'0', @@ -529,44 +533,56 @@ this.oilOrder = response.data }) - let title = '是否将该收银台下的订单全部退款' + let title = '' await getOrderInfoApi({orderNo: this.oilOrder.orderNo, type: 'oil'}).then(res=>{ if (res.code === 200) { if (res.data.type === "1") { - title = '该订单下有其它商品订单,是否一并退款' + title = '该订单下有其它商品订单,退款之后商品将不能图退款' this.oilOrder.payAmount = res.data.money } } }); - //退款确定 - this.$confirm(title+', 是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.dialogRefund = true; + if (title) { + //退款确定 + this.$confirm(title+', 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.dialogRefund = true; - }).catch(() => { - this.$message({ - type: 'info', - message: '已取消退款' + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消退款' + }); }); - }); - - - + } else { + this.dialogRefund = true; + } }, async refundConfirmed() { + + // if (!this.refundAmt) { + // this.$message({ + // type: 'info', + // message: '请输入退款金额' + // }); + // return + // } this.dialogRefund = false; this.loading = true; console.log("cashierOrder",this.cashierOrder) let map={ + // 是否退优惠券 + isOilVouchers : this.isOilVouchers, orderNo: this.oilOrder.orderNo, storeId: this.oilOrder.storeId, refundRemark:this.radio1 +"-"+ this.refundRemark, type: "canRefund", + refundAmt: this.refundAmt, refType: "oilOrder", } await refundApi(map).then(res=>{ @@ -580,6 +596,14 @@ this.getList(); }, + + // 获取优惠券信息 + getInfoById() { + + getInfoByIdApi().then(res=>{ + + }) + }, // 根据员工id查询员工信息 queryStaf(list,id){ let name = "";