pos支付bug

This commit is contained in:
齐天大圣 2024-06-03 18:12:12 +08:00
parent 8bcf58ca2b
commit 1f9f076cc1
7 changed files with 47 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrder
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.order.entity.AllOrderInfo;
@ -111,6 +112,8 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
private ILJStoreService storeService;
@Resource
private StaffCommissionService staffCommissionService;
@Resource
private CardValueOrdersService cardValueOrdersService;
/**
* 通过ID查询单条数据
*
@ -266,6 +269,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
if ("CASH".equals(cardFuelRecordDTO.getPaymentType())) {
AllOrderInfo allOrderInfo = getAllOrderInfo(cardFuelRecordDTO);
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
cardValueOrdersService.updateBalances(orderNo,"paid");
}
double theAmountToBePaid = 0.0;

View File

@ -35,5 +35,6 @@ public interface CardValueOrdersService extends IService<CardValueOrders> {
void updateOrderStatus(String orderNo,String status);
void updateBalance(String orderNo,String status);
void updateBalances(String orderNo,String status);
}

View File

@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
import com.fuint.business.order.service.AllOrderInfoService;
import com.fuint.business.order.vo.AllOrderInfoVo;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.common.dto.AccountInfo;
@ -29,6 +32,9 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
@Resource
private UserBalanceService userBalanceService;
@Resource
private AllOrderInfoService allOrderInfoService;
/**
* 根据订单编号返回订单信息
* @param orderNo
@ -75,5 +81,23 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
baseMapper.updateById(oneByOrderNo);
}
}
@Resource
AllOrderInfoMapper allOrderInfoMapper;
@Override
public void updateBalances(String orderNo, String status) {
AllOrderInfoVo oneByOrderNo = allOrderInfoService.getOneByOrderNo(orderNo);
if (ObjectUtil.isNotEmpty(oneByOrderNo)){
if ("paid".equals(status)){
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(oneByOrderNo.getUserId(),oneByOrderNo.getStoreId());
Double cardBalance = 0.0;
cardBalance = userBalance.getCardBalance() + oneByOrderNo.getPayMoney();
userBalance.setCardBalance(cardBalance);
userBalanceService.updateUserBalance(userBalance);
}
oneByOrderNo.setStatus(status);
allOrderInfoMapper.updateById(oneByOrderNo);
}
}
}

View File

@ -3,6 +3,7 @@ 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.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.AllOrderInfoDto;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.CardBalanceChange;
@ -49,4 +50,6 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
AllOrderInfoVo getIndexData4Pos(@Param("allOrderInfo") AllOrderInfoDto allOrderInfo);
AllOrderInfoVo getHandOverList(HandoverRecord record);
AllOrderInfoVo getOneByOrderNo(String orderNo);
}

View File

@ -395,6 +395,13 @@
</if>
</where>
</select>
<select id="getOneByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
SELECT
*
from all_order_info
where order_no = #{orderNo}
</select>
<!-- WHERE-->
<!-- DATE(pay_time) = CURDATE();-->
<!-- <if test="startTime != null ">&lt;!&ndash; 开始时间检索 &ndash;&gt;-->
@ -411,4 +418,4 @@
<!-- <if test="endTime1 != null and endTime1 != ''">-->
<!-- AND pay_time &lt;= #{endTime} &#45;&#45; 结束时间检索-->
<!-- </if>-->
</mapper>
</mapper>

View File

@ -2,6 +2,7 @@ package com.fuint.business.order.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.AllOrderInfoDto;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.CashierOrder;
@ -92,4 +93,5 @@ public interface AllOrderInfoService {
AllOrderInfoVo getIndexData4Pos();
AllOrderInfoVo getOperatingDataPos(AllOrderInfoDto allOrderInfo);
AllOrderInfoVo getOneByOrderNo(String orderNo);
}

View File

@ -14,6 +14,7 @@ import com.fuint.business.convenienceSore.dto.LJGoodsDto;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.business.convenienceSore.service.StockTrackService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.order.dto.AllOrderInfoDto;
import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
@ -955,6 +956,10 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
}
@Override
public AllOrderInfoVo getOneByOrderNo(String orderNo) {
return allOrderInfoMapper.getOneByOrderNo(orderNo);
}
private long dayCount(String beginTimeStr, String endTimeStr ) {