bug修改
This commit is contained in:
parent
873825c669
commit
5d9de0a0dc
@ -16,3 +16,13 @@ export function cashierOrder(id) {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 根据订单号查询油品订单信息
|
||||
export function orderStatisticsApi(query) {
|
||||
return request({
|
||||
url: '/business/cashierOrder/orderStatistics',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,8 +258,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {cashierOrder, listCashierOrder} from "@/api/order/cashierorder";
|
||||
import {queryStaffs} from "@/api/order/staff";
|
||||
import {cashierOrder, listCashierOrder, orderStatisticsApi} from "@/api/order/cashierorder";
|
||||
import {queryStaffs} from "@/api/order/staff";
|
||||
import {oilOrderList, oilOrders} from "@/api/order/oilorder";
|
||||
import {getOilNameList} from "@/api/order/oilnumgun";
|
||||
import {getOrderGoods} from "@/api/order/goodsorder";
|
||||
@ -294,7 +294,7 @@ import {exportExcelCashierApi} from "@/api/order/exportExcel";
|
||||
pageSize: 10,
|
||||
},
|
||||
total:0,
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -91,9 +91,9 @@
|
||||
<el-card class="box-card">
|
||||
<div class="wgang">
|
||||
<div>商品交易列表</div>
|
||||
<div style="display: flex ">
|
||||
<div style="display: flex ">
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus" @click="exportExcelGoodsOrder()">导出订单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-box">
|
||||
<el-table
|
||||
|
@ -14,7 +14,7 @@ import java.io.Serializable;
|
||||
* @since 2023-11-07 13:59:23
|
||||
*/
|
||||
@Data
|
||||
public class IntegralOrders extends BaseEntity {
|
||||
public class IntegralOrders extends BaseEntity {
|
||||
private static final long serialVersionUID = 181605029480746026L;
|
||||
/**
|
||||
* 兑换订单id(主键)
|
||||
@ -103,5 +103,10 @@ public class IntegralOrders extends BaseEntity {
|
||||
*/
|
||||
private String paymentType;
|
||||
|
||||
/**
|
||||
* 处理状态
|
||||
*/
|
||||
private String processingStatus;
|
||||
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public interface IntegralOrdersMapper {
|
||||
|
||||
int editPayStatus(@Param("orderNumber") String orderNumber,@Param("payStates") String payStates, @Param("storeId") Integer storeId );
|
||||
// int editPayStatus(@Param("orderNumber") String orderNumber,@Param("payStates") String payStates, @Param("storeId") Integer storeId );
|
||||
|
||||
int updatePaymentType (@Param("orderNumber") String orderNumber);
|
||||
/**
|
||||
* 根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
|
@ -442,6 +442,9 @@
|
||||
</if>
|
||||
|
||||
</update>
|
||||
<update id="updatePaymentType">
|
||||
update integral_orders set status = '1' where order_number = #{orderNumber}
|
||||
</update>
|
||||
|
||||
<select id="queryIntegralOrdersByOrderNo">
|
||||
select * from integral_orders where order_number = #{orderNumber}
|
||||
|
@ -26,14 +26,18 @@ import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeReco
|
||||
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
|
||||
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.mapper.LJStaffMapper;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
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 com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.RedisLock;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -47,6 +51,7 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 存储兑换订单信息(IntegralOrders)表服务实现类
|
||||
@ -156,6 +161,8 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
return this.integralOrdersDao.statistics(nowAccountInfo.getStoreId(),orderType);
|
||||
}
|
||||
|
||||
@Resource
|
||||
AllOrderInfoService allOrderInfoService;
|
||||
/**
|
||||
* 插入订单状态 并进行支付
|
||||
*
|
||||
@ -167,13 +174,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
public IntegralOrders integralOrdersProcessing(IntegralOrdersRequest integralOrdersList) {
|
||||
double epsilon = 1e-10; // 阈值
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// 当为小程序下单时
|
||||
if (ObjectUtil.isNotEmpty(integralOrdersList.getOrderChannel()) && integralOrdersList.getOrderChannel() == -1) {
|
||||
nowAccountInfo.setChainStoreId(integralOrdersList.getChainStoreId());
|
||||
nowAccountInfo.setStoreId(integralOrdersList.getStoreId());
|
||||
integralOrdersList.getIntegralOrdersList().get(0).setUserId(nowAccountInfo.getId());
|
||||
|
||||
}
|
||||
integralOrdersList.setStoreId(nowAccountInfo.getStoreId());
|
||||
// 首先判断是否足够积分
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(integralOrdersList.getIntegralOrdersList().get(0).getUserId(), nowAccountInfo.getChainStoreId());
|
||||
if (ObjectUtil.isEmpty(ljUserVos)) {
|
||||
@ -215,9 +216,21 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
integralOrders.setOrderNumber(orderNo);
|
||||
integralOrders.setStatus(status);
|
||||
integralOrders.setOrderType("1"); // 设置交易类型
|
||||
|
||||
|
||||
}
|
||||
integralOrdersDao.insertBatch(integralOrdersList.getIntegralOrdersList());
|
||||
|
||||
if ("CASH".equals(integralOrdersList.getPaymentType()) && integralOrdersList.getAllAmout().compareTo(0.0) > 0) {
|
||||
try{
|
||||
AllOrderInfo allOrderInfo = getAllOrderInfo(integralOrdersList,orderNo);
|
||||
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if (!ObjectUtil.isEmpty(integralOrdersList.getAllAmout())
|
||||
@ -253,6 +266,31 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
return integralOrdersList1.get(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static AllOrderInfo getAllOrderInfo(IntegralOrdersRequest integralOrdersRequest,String orderNo) {
|
||||
List<IntegralOrders> integralOrdersList = integralOrdersRequest.getIntegralOrdersList();
|
||||
AllOrderInfo allOrderInfo = new AllOrderInfo();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(integralOrdersList)) {
|
||||
allOrderInfo.setOrderNo(orderNo);
|
||||
allOrderInfo.setType("4");
|
||||
allOrderInfo.setStoreId(integralOrdersRequest.getStoreId());
|
||||
allOrderInfo.setGoodsMoney(integralOrdersRequest.getAllAmout());
|
||||
allOrderInfo.setPayMoney(integralOrdersRequest.getAllAmout());
|
||||
allOrderInfo.setPayType("CASH");
|
||||
allOrderInfo.setUserId(integralOrdersList.get(0).getUserId());
|
||||
allOrderInfo.setPayChannel("cashier");
|
||||
allOrderInfo.setStatus("paid");
|
||||
allOrderInfo.setContent("积分商品兑换");
|
||||
allOrderInfo.setPayTime(new Date());
|
||||
allOrderInfo.setUpdateTime(new Date());
|
||||
allOrderInfo.setCreateBy(integralOrdersList.get(0).getStaffId().toString());
|
||||
}
|
||||
return allOrderInfo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态并添加记录
|
||||
*
|
||||
@ -270,6 +308,8 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
|
||||
@Resource
|
||||
LJGoodsService ljGoodsService;
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
@Override
|
||||
@Transactional
|
||||
public IntegralOrders checkTheStatusOfYourPaymentByIntegral(String orderNo) {
|
||||
@ -279,9 +319,12 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
// List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo, nowAccountInfo.getStoreId());
|
||||
List<IntegralOrders> listByOrderNo = integralOrdersDao.getListByOrderNo2(orderNo);
|
||||
|
||||
if ("paid".equals(listByOrderNo.get(0).getStatus())) {
|
||||
// 加锁 processing_status
|
||||
String lockKey = "IntegralOrders"+nowAccountInfo.getStoreId()+orderNo;
|
||||
Boolean isLock = redisLock.tryLock(lockKey, 5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock && "paid".equals(listByOrderNo.get(0).getStatus()) && "0".equals(listByOrderNo.get(0).getProcessingStatus()) ) {
|
||||
// 查询用户信息
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), listByOrderNo.get(0).getChainStoreId());
|
||||
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(listByOrderNo.get(0).getUserId(), nowAccountInfo.getChainStoreId());
|
||||
// 查询用户信息
|
||||
BigDecimal totalPoints = new BigDecimal(0);
|
||||
|
||||
@ -349,6 +392,13 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
integralDetailService.insert2(integralDetail);
|
||||
}
|
||||
|
||||
// 批量修改该
|
||||
integralOrdersDao.updatePaymentType(orderNo);
|
||||
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
}else {
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
}
|
||||
return listByOrderNo.get(0);
|
||||
|
@ -37,8 +37,10 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.oilDepotConfiguration.entity.OilDepotConfig;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.entity.OilBalanceChange;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
import com.fuint.business.order.service.OilBalanceChangeService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
@ -169,6 +171,8 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
int i = cardFuelRecordMapper.update(cardFuelRecord);
|
||||
return i>0;
|
||||
}
|
||||
@Resource
|
||||
AllOrderInfoService allOrderInfoService;
|
||||
|
||||
@Resource
|
||||
ILJStaffService iljStaffService;
|
||||
@ -203,8 +207,16 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
}
|
||||
|
||||
cardFuelRecordMapper.insert(cardFuelRecordDTO);
|
||||
double theAmountToBePaid = 0.0;
|
||||
|
||||
|
||||
// 当为现金支付时插入到总的订单表
|
||||
if ("CASH".equals(cardFuelRecordDTO.getPaymentType())) {
|
||||
AllOrderInfo allOrderInfo = getAllOrderInfo(cardFuelRecordDTO);
|
||||
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
|
||||
}
|
||||
|
||||
double theAmountToBePaid = 0.0;
|
||||
// 判断是否可以调起支付
|
||||
boolean flag = false;
|
||||
|
||||
double epsilon = 1e-10; // 阈值
|
||||
@ -245,6 +257,26 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
return cardFuelRecordDTO;
|
||||
}
|
||||
|
||||
|
||||
private static AllOrderInfo getAllOrderInfo(CardFuelRecordDTO cardFuelRecordDTO) {
|
||||
AllOrderInfo allOrderInfo = new AllOrderInfo();
|
||||
allOrderInfo.setOrderNo(cardFuelRecordDTO.getPaymentNo());
|
||||
allOrderInfo.setType("5");
|
||||
allOrderInfo.setStoreId(cardFuelRecordDTO.getStoreId());
|
||||
allOrderInfo.setGoodsMoney(cardFuelRecordDTO.getRechargeBalance());
|
||||
allOrderInfo.setPayMoney(cardFuelRecordDTO.getRealyPayBills());
|
||||
allOrderInfo.setPayType("CASH");
|
||||
allOrderInfo.setUserId(cardFuelRecordDTO.getMtUserId());
|
||||
allOrderInfo.setPayChannel("cashier");
|
||||
allOrderInfo.setStatus("paid");
|
||||
allOrderInfo.setContent("油品充值");
|
||||
allOrderInfo.setPayTime(new Date());
|
||||
allOrderInfo.setUpdateTime(new Date());
|
||||
allOrderInfo.setCreateBy(cardFuelRecordDTO.getMtStaffId().toString());
|
||||
|
||||
return allOrderInfo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@ -292,6 +324,8 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
}else {
|
||||
redisLock.unlock(lockKey);
|
||||
|
||||
return cardFuelRecord;
|
||||
}
|
||||
return cardFuelRecord;
|
||||
|
@ -38,8 +38,10 @@ import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrd
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.member.entity.LJStaff;
|
||||
import com.fuint.business.member.service.ILJStaffService;
|
||||
import com.fuint.business.order.entity.AllOrderInfo;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.entity.CashierOrder;
|
||||
import com.fuint.business.order.service.AllOrderInfoService;
|
||||
import com.fuint.business.order.service.CardBalanceChangeService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
@ -274,7 +276,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Resource
|
||||
AllOrderInfoService allOrderInfoService;
|
||||
@Override
|
||||
@Transactional
|
||||
public CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO) {
|
||||
@ -301,7 +304,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
if (ObjectUtil.isEmpty(cardValueRecordDTO.getBidBalance())) cardValueRecordDTO.setBidBalance(0.0);
|
||||
if (ObjectUtil.isEmpty(cardValueRecordDTO.getRechargeBalance())) cardValueRecordDTO.setRechargeBalance(0.0);
|
||||
if (ObjectUtil.isEmpty(cardValueRecordDTO.getGiftBalance())) cardValueRecordDTO.setGiftBalance(0.0);
|
||||
// todo
|
||||
|
||||
if (cardValueRecordDTO.getBidBalance() >= 0.0) {
|
||||
BigDecimal bigDecimal = new BigDecimal(cardValueRecordDTO.getBidBalance());
|
||||
@ -313,6 +315,12 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
}
|
||||
baseMapper.insert(cardValueRecordDTO);
|
||||
|
||||
// 当为现金支付时插入到总的订单表
|
||||
if ("CASH".equals(cardValueRecordDTO.getPaymentType())) {
|
||||
AllOrderInfo allOrderInfo = getAllOrderInfo(cardValueRecordDTO);
|
||||
allOrderInfoService.insertAllOrderInfo(allOrderInfo);
|
||||
}
|
||||
|
||||
double epsilon = 1e-10; // 阈值
|
||||
|
||||
Double theAmountToBePaid = 0.0;
|
||||
@ -359,23 +367,38 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> msg = new HashMap<>();
|
||||
msg.put("tag","cardTag");
|
||||
msg.put("orderId",cardValueRecordDTO.getId().toString());
|
||||
msg.put("orderNo",orderNo);
|
||||
msg.put("storeId",nowAccountInfo.getStoreId());
|
||||
msg.put("chainStoreId",nowAccountInfo.getChainStoreId());
|
||||
// Map<String, Object> msg = new HashMap<>();
|
||||
// msg.put("tag","cardTag");
|
||||
// msg.put("orderId",cardValueRecordDTO.getId().toString());
|
||||
// msg.put("orderNo",orderNo);
|
||||
// msg.put("storeId",nowAccountInfo.getStoreId());
|
||||
// msg.put("chainStoreId",nowAccountInfo.getChainStoreId());
|
||||
|
||||
// 发起rocket请求
|
||||
rocketUtil.pushMessage(msg);
|
||||
|
||||
|
||||
|
||||
|
||||
// rocketUtil.pushMessage(msg);
|
||||
|
||||
// 支付 payment_type
|
||||
return cardValueRecordDTO;
|
||||
}
|
||||
|
||||
private static AllOrderInfo getAllOrderInfo(CardValueRecordDTO cardValueRecordDTO) {
|
||||
AllOrderInfo allOrderInfo = new AllOrderInfo();
|
||||
allOrderInfo.setOrderNo(cardValueRecordDTO.getPaymentNo());
|
||||
allOrderInfo.setType("2");
|
||||
allOrderInfo.setStoreId(cardValueRecordDTO.getStoreId());
|
||||
allOrderInfo.setGoodsMoney(cardValueRecordDTO.getGiftBalance());
|
||||
allOrderInfo.setPayMoney(cardValueRecordDTO.getRealyPayBills());
|
||||
allOrderInfo.setPayType("CASH");
|
||||
allOrderInfo.setUserId(cardValueRecordDTO.getMtUserId());
|
||||
allOrderInfo.setPayChannel("cashier");
|
||||
allOrderInfo.setStatus("paid");
|
||||
allOrderInfo.setContent("储值卡充值");
|
||||
allOrderInfo.setPayTime(new Date());
|
||||
allOrderInfo.setUpdateTime(new Date());
|
||||
allOrderInfo.setCreateBy(cardValueRecordDTO.getMtStaffId().toString());
|
||||
return allOrderInfo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@ -451,6 +474,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
|
||||
redisLock.unlock(lockKey);
|
||||
} else {
|
||||
redisLock.unlock(lockKey);
|
||||
return cardValueRecord;
|
||||
}
|
||||
return cardValueRecord;
|
||||
|
@ -16,7 +16,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (OilInventoryOrder)表控制层
|
||||
* (OilInventoryOrder-库存盘点)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-20 11:13:50
|
||||
|
@ -48,8 +48,8 @@ public class OilPurchaseController extends BaseController {
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("oilPurchase") OilPurchase oilPurchase) {
|
||||
Page page =new Page(pageNo,pageSize);
|
||||
IPage<OilPurchase> oilTanks = this.oilPurchaseService.queryByPage(page, oilPurchase);
|
||||
return getSuccessResult(oilTanks);
|
||||
IPage<OilPurchase> oilPurchaseIPage = this.oilPurchaseService.queryByPage(page, oilPurchase);
|
||||
return getSuccessResult(oilPurchaseIPage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public class OilTank extends BaseEntity {
|
||||
*/
|
||||
private Double totalPrice;
|
||||
/**
|
||||
* 折后单价
|
||||
* 折合单价
|
||||
*/
|
||||
private Double discountedPrice;
|
||||
/**
|
||||
@ -78,6 +78,9 @@ public class OilTank extends BaseEntity {
|
||||
* 关联油号表ID
|
||||
*/
|
||||
private Integer numberId;
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 创建时间
|
||||
// */
|
||||
|
@ -86,6 +86,9 @@ public interface OilTankMapper {
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(OilTank oilTank);
|
||||
int addStoredQuantityByLock(@Param("tankId") Integer tankId,@Param("changeNum") Double changeNum);
|
||||
|
||||
int subtractStoredQuantityByLock(@Param("tankId") Integer tankId,@Param("changeNum") Double changeNum);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
|
@ -411,6 +411,20 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="addStoredQuantityByLock">
|
||||
update oil_tank set
|
||||
stored_quantity = stored_quantity+#{changeNum},
|
||||
update_time = NOW()
|
||||
where id = #{tankId}
|
||||
</update>
|
||||
|
||||
<update id="subtractStoredQuantityByLock">
|
||||
update oil_tank set
|
||||
stored_quantity = stored_quantity-#{changeNum},
|
||||
update_time = NOW()
|
||||
where id = #{tankId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
@ -78,4 +78,15 @@ public interface OilTankService {
|
||||
|
||||
public void export(HttpServletResponse response);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tankId
|
||||
* @param changeNum 改变的数量
|
||||
* @param totalAmount 修改的总价格
|
||||
* @return
|
||||
*/
|
||||
OilTank addStoredQuantityByLock(Integer tankId, Double changeNum, Double totalAmount);
|
||||
OilTank subtractStoredQuantityByLock(Integer tankId, Double changeNum);
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilTankMapper;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper;
|
||||
import com.fuint.business.petrolStationManagement.service.OilPurchaseOrderService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTankService;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilTankVO;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
@ -47,6 +48,9 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
@Resource
|
||||
OilTankMapper oilTankMapper;
|
||||
|
||||
@Resource
|
||||
OilTankService oilTankService;
|
||||
|
||||
@Resource
|
||||
OilTrackingMapper oilTrackingMapper;
|
||||
|
||||
@ -208,6 +212,11 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
oilPurchase.setPurchaseId(id);
|
||||
List<OilPurchaseOrderVO> allList = oilPurchaseOrderDao.getAllList(oilPurchase);
|
||||
for (OilPurchaseOrderVO oilPurchaseOrderVO : allList) {
|
||||
|
||||
|
||||
|
||||
oilTankService.addStoredQuantityByLock(oilPurchaseOrderVO.getTankId(),oilPurchaseOrderVO.getPurchaseVolume(),oilPurchaseOrderVO.getTotalAmount());
|
||||
|
||||
OilTank oilTank = new OilTank();
|
||||
oilTank.setId(oilPurchaseOrderVO.getTankId());
|
||||
oilTank.setStoredQuantity(oilPurchaseOrderVO.getPurchaseVolume());
|
||||
@ -221,6 +230,10 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
BigDecimal disPrice = totalSum.divide(volSum, 2, RoundingMode.HALF_UP);
|
||||
oilTank.setDiscountedPrice(disPrice.doubleValue());
|
||||
oilTankMapper.accumulate(oilTank);
|
||||
|
||||
|
||||
|
||||
|
||||
// 插入到库存跟踪
|
||||
OilTracking oilTracking = new OilTracking();
|
||||
oilTracking.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
@ -9,6 +9,7 @@ import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTankService;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilTankExcel;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.RedisLock;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -17,7 +18,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* (OilTank)表服务实现类
|
||||
@ -113,6 +116,64 @@ public class OilTankServiceImpl implements OilTankService {
|
||||
return this.queryById(oilTank.getId());
|
||||
}
|
||||
|
||||
@Resource
|
||||
RedisLock redisLock;
|
||||
|
||||
/**
|
||||
* 增加存油数量
|
||||
* @param tankId
|
||||
* @param changeNum (只需要传入修改的数量)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OilTank addStoredQuantityByLock(Integer tankId, Double changeNum, Double totalAmount) {
|
||||
// 根据油罐id加锁 同一时间只能
|
||||
String lockKey = "oilTank-"+tankId;
|
||||
Boolean isLock = redisLock.tryLock(lockKey,5000,5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock) {
|
||||
// 判断存油数量是否足够
|
||||
OilTank oilTank = oilTankDao.queryById(tankId);
|
||||
// 计算总数
|
||||
BigDecimal changeNumBigDecimal = new BigDecimal(changeNum.toString());
|
||||
BigDecimal storedQuantityBigDecimal = changeNumBigDecimal.subtract(new BigDecimal(oilTank.getStoredQuantity().toString()));
|
||||
|
||||
if (storedQuantityBigDecimal.toString().compareTo(oilTank.getTankVolume().toString())>0) {
|
||||
redisLock.unlock(lockKey);
|
||||
throw new RuntimeException("“"+ oilTank.getTankName() +"”油罐中容量不足,无法进行增加!");
|
||||
}
|
||||
// todo 计算单价,和总价格
|
||||
this.oilTankDao.addStoredQuantityByLock(tankId, changeNum);
|
||||
redisLock.unlock(lockKey);
|
||||
}
|
||||
return this.queryById(tankId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 减少存油数量
|
||||
* @param tankId
|
||||
* @param changeNum (只需要传入修改的数量,都为正数)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OilTank subtractStoredQuantityByLock(Integer tankId, Double changeNum) {
|
||||
// 根据油罐id加锁 同一时间只能
|
||||
String lockKey = "oilTank-"+tankId;
|
||||
Boolean isLock = redisLock.tryLock(lockKey,500,5000, TimeUnit.MILLISECONDS);
|
||||
if (isLock) {
|
||||
// 判断存油数量是否足够
|
||||
OilTank oilTank = oilTankDao.queryById(tankId);
|
||||
if (oilTank.getStoredQuantity().compareTo(changeNum)<0) {
|
||||
redisLock.unlock(lockKey);
|
||||
throw new RuntimeException("“"+ oilTank.getTankName() +"”油罐中存油数量不足,无法进行减少!");
|
||||
}
|
||||
// todo 计算单价,和总价格
|
||||
|
||||
this.oilTankDao.subtractStoredQuantityByLock(tankId, changeNum);
|
||||
redisLock.unlock(lockKey);
|
||||
}
|
||||
return this.queryById(tankId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
@ -134,6 +195,11 @@ public class OilTankServiceImpl implements OilTankService {
|
||||
return this.oilTankDao.cleanData(id) > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出存油统计
|
||||
* @param response
|
||||
*/
|
||||
public void export(HttpServletResponse response) {
|
||||
|
||||
OilTank oilTank = new OilTank();
|
||||
|
@ -128,11 +128,6 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
|
||||
userBalanceAdd.setPoints(0);
|
||||
userBalanceAdd.setGrowthValue(0);
|
||||
userBalanceAdd.setConsumeNum(0);
|
||||
// todo 12-29 设置等级
|
||||
// LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByChainStoreId(chainStoreId);
|
||||
// if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
|
||||
// userBalanceAdd.setGradeId(ljUserGrade.getId());
|
||||
// }
|
||||
// 新增会员余额信息
|
||||
return insertUserBalance(userBalanceAdd);
|
||||
}
|
||||
|
@ -305,6 +305,7 @@ public class AccountServiceImpl extends ServiceImpl<TAccountMapper, TAccount> im
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean update(Map<String, Object> param) {
|
||||
|
||||
// List<Integer> roleIds = (List) param.get("roleIds");
|
||||
|
@ -808,7 +808,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
|
||||
// 新增会员余额信息
|
||||
userBalanceService.insertUserBalance(userBalanceAdd);
|
||||
}
|
||||
// 查询关联表里面是否有信息
|
||||
// 查询关联表里面是否有信息 (注册邀请)
|
||||
MtInvitation mtInvitation1 = mtInvitationMapper.queryByStoreId(Integer.parseInt(storeId), mtUser.getId());
|
||||
if (ObjectUtil.isEmpty(mtInvitation1)) {
|
||||
MtInvitation mtInvitation = new MtInvitation();
|
||||
|
@ -125,9 +125,8 @@ public class ClientSignController extends BaseController {
|
||||
String storeId = ObjectUtil.isEmpty(userInfo.get("storeId"))? "" : userInfo.get("storeId").toString();
|
||||
if ("".equals(storeId)) return getFailureResult(0, "微信登录失败");
|
||||
|
||||
// 根据storeId查找对应的连锁店id
|
||||
// 根据storeId查找对应的连锁店id 获取连锁店信息
|
||||
LJStore ljStore = iljStoreService.selectStoreByIdUni(Integer.parseInt(storeId));
|
||||
// todo 获取微信小程序配置信息
|
||||
ChainStoreConfig chainStoreConfig = new ChainStoreConfig();
|
||||
chainStoreConfig.setChainStoreId(ljStore.getChainStoreId());
|
||||
ChainStoreConfig wxConfig = chainStoreConfigService.chainStoreConfigInfoByChainId(chainStoreConfig);
|
||||
|
53
fuintCashierWeb/src/api/order/exportExcel.js
Normal file
53
fuintCashierWeb/src/api/order/exportExcel.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 导出收银台订单
|
||||
export function exportExcelCashierApi(data) {
|
||||
return request({
|
||||
url: 'business/cashierOrder/exportExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob', // 表明响应类型为二进制流
|
||||
data: data // 通过 data 参数传递需要的数据
|
||||
});
|
||||
}
|
||||
|
||||
// 导出油品订单
|
||||
export function exportExcelOilOrderApi(data) {
|
||||
return request({
|
||||
url: 'business/oilOrder/exportExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob', // 表明响应类型为二进制流
|
||||
// params: data
|
||||
data: data // 通过 data 参数传递需要的数据
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 导出商品订单
|
||||
export function exportExcelGoodsOrderApi(data) {
|
||||
return request({
|
||||
url: 'business/order/exportExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob', // 表明响应类型为二进制流
|
||||
data: data // 通过 data 参数传递需要的数据
|
||||
});
|
||||
}
|
||||
|
||||
// 导出会员充值订单
|
||||
export function exportExcelVipApi(data) {
|
||||
return request({
|
||||
url: 'business/marketingActivity/cardValueRecord/exportExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob', // 表明响应类型为二进制流
|
||||
data: data // 通过 data 参数传递需要的数据
|
||||
});
|
||||
}
|
||||
|
||||
// 导出小程序订单
|
||||
export function exportExcelAppletApi(data) {
|
||||
return request({
|
||||
url: 'business/cashierOrder/exportExcel',
|
||||
method: 'post',
|
||||
responseType: 'blob', // 表明响应类型为二进制流
|
||||
data: data // 通过 data 参数传递需要的数据
|
||||
});
|
||||
}
|
@ -468,11 +468,11 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
|
||||
},
|
||||
methods:{
|
||||
// 获取所有积分商品
|
||||
getGift() {
|
||||
async getGift() {
|
||||
if (this.queryParams.categoryId ==='first') {
|
||||
this.queryParams.categoryId = null
|
||||
}
|
||||
getGiftApi(this.queryParams).then(res=>{
|
||||
await getGiftApi(this.queryParams).then(res=>{
|
||||
this.giftList = res.data.records;
|
||||
})
|
||||
console.log("imagePath",this.imagePath)
|
||||
@ -617,13 +617,14 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
|
||||
},
|
||||
// 重置
|
||||
reset() {
|
||||
this.getGift();
|
||||
this.shoppingCart=[]
|
||||
this.markPurchasesAll = 0
|
||||
this.allPoints=0
|
||||
this.allAmout=0
|
||||
this.allMoneyRatio=0
|
||||
this.paymentType = ''
|
||||
this.getGift();
|
||||
|
||||
// this.paymentType = ''
|
||||
this.resetMember()
|
||||
},
|
||||
// 打开购物车
|
||||
@ -803,12 +804,14 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
if (this.paymentType == '') {
|
||||
if (this.shoppingCart.length <1){
|
||||
this.$message.error('请先选择商品');
|
||||
return
|
||||
} else if(!this.paymentType) {
|
||||
this.$message.error('请先选择支付方式');
|
||||
|
||||
return
|
||||
}
|
||||
this.isPay = true
|
||||
this.isPay = true;
|
||||
this.dialogVisiblej = true
|
||||
},
|
||||
// 确定收款
|
||||
@ -853,7 +856,7 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
|
||||
if (flag) return
|
||||
|
||||
let timer = setInterval(async () => {
|
||||
getCheckTheStatusOfYourPaymentByIntegralApi({orderNumber:orderNumber}).then(response => {
|
||||
await getCheckTheStatusOfYourPaymentByIntegralApi({orderNumber:orderNumber}).then(response => {
|
||||
if (response.data!=null){
|
||||
if (response.data.status == "unpaid"){
|
||||
this_.isQuery = true;
|
||||
@ -889,7 +892,7 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
|
||||
},30000)
|
||||
|
||||
}
|
||||
this.paymentType = ''
|
||||
// this.paymentType = ''
|
||||
this.reset()
|
||||
},
|
||||
// 清楚数据
|
||||
|
@ -71,10 +71,9 @@
|
||||
<el-card class="box-card">
|
||||
<div class="wgang">
|
||||
<div>收银台订单列表</div>
|
||||
<!-- <div style="display: flex ">-->
|
||||
|
||||
<!-- <el-button type="primary" size="mini" icon="el-icon-plus">新增会员</el-button>-->
|
||||
<!-- </div>-->
|
||||
<div style="display: flex ">
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus" @click = "exportExcelCashier()">导出订单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-box">
|
||||
<el-table
|
||||
@ -260,10 +259,11 @@
|
||||
|
||||
<script>
|
||||
import {cashierOrder, listCashierOrder,orderStatisticsApi} from "@/api/cashier/cashierorder";
|
||||
import {queryStaffs} from "@/api/cashier/staff";
|
||||
import {queryStaffs} from "@/api/cashier/staff";
|
||||
import {oilOrderList, oilOrders} from "@/api/cashier/oilorder";
|
||||
import {getOilNameList} from "@/api/cashier/oilnumgun";
|
||||
import {getOrderGoods} from "@/api/cashier/goodsorder";
|
||||
import {exportExcelCashierApi} from "@/api/order/exportExcel";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -310,6 +310,13 @@ import {getOrderGoods} from "@/api/cashier/goodsorder";
|
||||
this.getStaffList();
|
||||
},
|
||||
methods:{
|
||||
|
||||
exportExcelCashier() {
|
||||
exportExcelCashierApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
this.$download.saveAs(blob,'收银台订单统计.xLsx')
|
||||
})
|
||||
},
|
||||
// 获取订单统计信息
|
||||
|
||||
getOrderStatistics() {
|
||||
|
@ -63,18 +63,6 @@
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <div style="display: flex;">-->
|
||||
<!-- <div class="top-app-sou">-->
|
||||
<!-- <el-form :label-position="labelPosition" label-width="40px" :model="formLabelAlign">-->
|
||||
<!-- <el-form-item label="名称">-->
|
||||
<!-- <el-input v-model="formLabelAlign.name" placeholder="请输入要搜索的内容"></el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-form>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div style="margin-left: 10px">-->
|
||||
<!-- <el-button type="primary" icon="el-icon-search">搜索</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</el-card>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
@ -116,10 +104,9 @@
|
||||
<el-card class="box-card">
|
||||
<div class="wgang">
|
||||
<div>商品交易列表</div>
|
||||
<!-- <div style="display: flex ">-->
|
||||
|
||||
<!-- <el-button type="primary" size="mini" icon="el-icon-plus">新增会员</el-button>-->
|
||||
<!-- </div>-->
|
||||
<div style="display: flex ">
|
||||
<el-button type="primary" size="mini" icon="el-icon-plus" @click="exportExcelGoodsOrder()">导出订单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-box">
|
||||
<el-table
|
||||
@ -210,9 +197,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getOrderGoods, listOrder,orderStatisticsApi} from "@/api/cashier/goodsorder";
|
||||
import {getOrderGoods, listOrder,orderStatisticsApi} from "@/api/cashier/goodsorder";
|
||||
import {queryStaffs} from "@/api/cashier/staff";
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
import { exportExcelGoodsOrderApi } from "@/api/order/exportExcel";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -267,6 +255,12 @@ export default {
|
||||
this.getPayList();
|
||||
},
|
||||
methods:{
|
||||
exportExcelGoodsOrder() {
|
||||
exportExcelGoodsOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
|
||||
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||
this.$download.saveAs(blob,'商品订单统计.xLsx')
|
||||
})
|
||||
},
|
||||
// 订单统计
|
||||
getOrderStatistics (){
|
||||
orderStatisticsApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
|
||||
|
Loading…
Reference in New Issue
Block a user