no message

This commit is contained in:
wangh 2024-02-06 15:48:25 +08:00
parent 614387248f
commit 7e48ac59dd
13 changed files with 180 additions and 33 deletions

View File

@ -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));
}
}

View File

@ -15,4 +15,7 @@ public class CardFavorableAdnUserDTO extends CardFavorable {
private List<Integer> gradeIds;
//天数
private Integer days;
//优惠卷名称
private String favorableName;
}

View File

@ -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<CardFavorableRecor
List<CardFavorableRecordVO> getCanUserCardFavorableList(@Param("paymentActiveDTO") PaymentActiveDTO paymentActiveDTO);
boolean updateCardAndActiveById(@Param("cardFavorableId") Integer cardFavorableId, @Param("userId") Integer userId, @Param("storeId") Integer storeId);
CardFavorableAdnUserDTO getInfoById(Integer id);
}

View File

@ -176,5 +176,14 @@
and mt_user_id = #{userId}
and store_id = #{storeId}
</update>
<select id="getInfoById"
resultType="com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableAdnUserDTO">
select cf.name favorableName
from card_favorable_record cfr
LEFT JOIN card_favorable_record cf ON cf.id = cfr.card_favorable_id
where id = #{id}
</select>
</mapper>

View File

@ -72,5 +72,7 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
* @return
*/
boolean issueCardFavorable(CardFavorableAdnUserDTO cardFavorableAdnUserDTO);
CardFavorableAdnUserDTO getInfoById(Integer id);
}

View File

@ -355,5 +355,11 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
}
return flag;
}
@Override
public CardFavorableAdnUserDTO getInfoById(Integer id) {
return cardFavorableRecordMapper.getInfoById(id);
}
}

View File

@ -30,6 +30,9 @@ import com.fuint.business.petrolStationManagement.entity.OilTracking;
import com.fuint.business.petrolStationManagement.service.OilGunService;
import com.fuint.business.petrolStationManagement.service.OilTankService;
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.mapper.MtOpenGiftMapper;
import com.fuint.repository.model.MtOrderGoods;
import lombok.extern.slf4j.Slf4j;
@ -170,10 +173,10 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
// BigDecimal payMoneyBig = new BigDecimal(allOrderInfo.getPayMoney().toString());
// BigDecimal payMoneyBefBig = payMoneyBig.multiply(new BigDecimal("100")).stripTrailingZeros();
// 退款金额(暂不支持部分退款)
// BigDecimal refundAmtBig = new BigDecimal(map.get("refundAmt"));
// BigDecimal refundAmtBefBig = refundAmtBig.multiply(new BigDecimal("100"));
BigDecimal refundAmtBig = new BigDecimal(map.get("refundAmt"));
BigDecimal refundAmtBefBig = refundAmtBig.multiply(new BigDecimal("100"));
map.put("totalAmt",money.toString());
map.put("refundAmt",money.toString());
map.put("refundAmt",refundAmtBefBig.toString());
map.put("orderNo",allOrderInfo.getOrderNo());
map.put("payType",allOrderInfo.getPayType());
@ -208,11 +211,17 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
allOrderInfo.setRefOrderNo(map.get("refundOrderNo"));
baseMapper.updateById(allOrderInfo);
// 处理油品订单
OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(map.get("orderNo"));
OilOrder oilOrder = new OilOrder();
oilOrder = oilOrderService.selectOilOrderByOrderNo(map.get("orderNo"));
// 处理商品订单
LJOrder ljOrder = ljOrderService.selectGoodsOrder(map.get("orderNo"));
LJOrder ljOrder = new LJOrder();
ljOrder = ljOrderService.selectGoodsOrder(map.get("orderNo"));
// 处理收银台订单
CashierOrder orderNo = cashierOrderService.selectCashierOrder(map.get("orderNo"));
CashierOrder orderNo = new CashierOrder();
orderNo = cashierOrderService.selectCashierOrder(map.get("orderNo"));
if (ObjectUtil.isNotEmpty(orderNo)) {
orderNo.setStatus("refund");
cashierOrderService.updateById(orderNo);
@ -264,7 +273,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
// 商户号
map.put("mchntCd", merchantConfig.getMchntCd());
// 生成退款id
map.put("refundOrderNo",allOrderInfo.getOrderNo() + "_rref");
map.put("refundOrderNo",allOrderInfo.getOrderNo() + "_ref");
map.put("publicKey",merchantConfig.getPublicKey());
map.put("privateKey",merchantConfig.getPrivateKey());
return map;
@ -273,12 +282,18 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
@Resource
OilGunService oilGunService;
@Resource
UserBalanceService userBalanceService;
// 处理油品
private void disposeOil(OilOrder oilOrder,String refundOrderNo) {
// 处理订单状态
oilOrder.setOrderStatus("refund");
oilOrderService.updateById(oilOrder);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 获取所有当前订单的数据
List<OilOrder> oilOrders = oilOrderService.selectOilOrder(oilOrder.getOrderNo());
// 获取油罐数据
@ -296,12 +311,17 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
OilTracking insert = oilTrackingService.insert(oilTracking);
// 处理储值卡
// if (ObjectUtil.isNotEmpty()) {}
if (ObjectUtil.isNotEmpty(order.getBalanceAmount())) {
userBalanceService.addUserBalance(order.getUserId(),nowAccountInfo.getChainStoreId(),order.getBalanceAmount());
}
// 处理屯油卡
// if (ObjectUtil.isNotEmpty()) {}
if (ObjectUtil.isNotEmpty(order.getOilCardAmount())) {
userBalanceService.addUserOil(order.getOils(),order.getUserId(),nowAccountInfo.getChainStoreId(),order.getOilCardAmount());
}
// 处理优惠券
// if (ObjectUtil.isNotEmpty()) {}
if (ObjectUtil.isNotEmpty(order.getCouponId())) {
}
}

View File

@ -7,4 +7,8 @@ import com.fuint.business.userManager.vo.UserBalanceVo;
public interface UserBalanceMapper extends BaseMapper<UserBalance> {
int subtractUserBalanceByLock(UserBalanceVo balance);
int updateRefuelMoney(UserBalance userBalance);
int addUserBalance(Integer id, Double changeCardBalance);
}

View File

@ -2,6 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.userManager.mapper.UserBalanceMapper">
<update id="subtractUserBalanceByLock">
update mt_user_balance
<set>
@ -17,4 +18,18 @@
</set>
where id = #{id}
</update>
<update id="updateRefuelMoney">
update mt_user_balance
set
refuel_money = #{refuelMoney}
where id = #{id}
</update>
<update id="addUserBalance">
update mt_user_balance
set
card_balance = card_balance +#{changeCardBalance}
where id = #{id}
</update>
</mapper>

View File

@ -64,4 +64,8 @@ public interface UserBalanceService extends IService<UserBalance> {
int subtractUserBalanceByLock(UserBalanceVo balance);
int addUserOil(String oilId, Integer userId, Integer chainStoreId, Double changeOil);
int addUserBalance(Integer userId, Integer chainStoreId, Double changeBalance);
}

View File

@ -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<UserBalanceMapper, UserB
public int addUserBalanceByLock(UserBalanceVo balance) {
public int addUserBalanceByLock(Integer oilId, Integer userId, Integer changeBalance) {
int row = baseMapper.updateById(balance);
// int row = baseMapper.addUserBalance(balance);
return 0;
}
// 增加用户的油品信息
@Override
public int addUserOil(String oilId, Integer userId, Integer chainStoreId, Double changeOil) {
UserBalance userBalance = selectUserBalance(userId, chainStoreId);
if(ObjectUtil.isNotEmpty(userBalance)&& ObjectUtil.isNotEmpty(userBalance.getRefuelMoney())) {
List<Map<String, String>> resultMapList = JSON.parseObject(userBalance.getRefuelMoney(), new TypeReference<List<Map<String, Object>>>() {});
for (Map<String, String> 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;

View File

@ -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
})
}

View File

@ -252,11 +252,11 @@
<div class="tk">订单金额</div>
<div class="tk">退款单号{{ oilOrder.orderNo }}</div>
<!-- <el-input placeholder="请输入退款金额" v-model="refundRemark"></el-input>-->
<!-- <el-input placeholder="请输入退款金额" v-model="refundAmt"></el-input>-->
<!-- 是否推掉优惠券-->
<br>
<span>是否退掉优惠券: </span>
<el-checkbox>优惠卷信息</el-checkbox>
<el-checkbox v-model="isOilVouchers">优惠卷信息</el-checkbox>
<div style="margin: 10px 0">
退款原因<br/>
@ -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,16 +533,17 @@
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
}
}
});
if (title) {
//退
this.$confirm(title+', 是否继续?', '提示', {
confirmButtonText: '确定',
@ -553,20 +558,31 @@
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 = "";