All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
k.e.book.ddh.service.CcRechargeOrderService Maven / Gradle / Ivy
package k.e.book.ddh.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import k.e.book.common.enums.OrderStatus;
import k.e.book.common.utils.TimeFormatter;
import k.e.book.ddh.entity.CcRechargeOrderDO;
import k.e.book.ddh.entity.CcRechargeOrderQueryDTO;
import k.e.book.ddh.mapper.CcRechargeOrderMapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author kk
* @date 2023-05-21 11:04
*/
@Service
public class CcRechargeOrderService extends ServiceImpl {
/**
* @param id d
* @return 更新为过期订单
*/
public boolean updateAuto(Long id) {
CcRechargeOrderDO dd = new CcRechargeOrderDO();
dd.setStatus(OrderStatus.EXPIRED.getFlag());
dd.setId(id);
return this.updateById(dd);
}
public CcRechargeOrderDO getTimeoutOrderForId(String orderId) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getStatus, OrderStatus.CREATED);
qr.eq(CcRechargeOrderDO::getOrderid, orderId).last("limit 1");
return this.getOne(qr);
}
public List getTimeoutOrder(long size) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getStatus, OrderStatus.CREATED);
qr.last("limit " + size);
return this.list(qr);
}
public boolean updateNotify(String orderId) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getOrderid, orderId).last("limit 1");
CcRechargeOrderDO dd = new CcRechargeOrderDO();
dd.setIsSold(1);
dd.setUpdatedAt(TimeFormatter.getUpdateAt());
return this.update(dd, qr);
}
public CcRechargeOrderDO findByNotify() {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getStatus, OrderStatus.CREATED.getFlag());
return this.getOne(qr);
}
public CcRechargeOrderDO findByMQ(String orderId, String status) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getOrderid, orderId).eq(CcRechargeOrderDO::getStatus, status);
return this.getOne(qr);
}
public boolean updateHash(String orderId) {
CcRechargeOrderDO orderDO = new CcRechargeOrderDO();
orderDO.setIsTxhash(1);
orderDO.setUpdatedAt(TimeFormatter.getUpdateAt());
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getOrderid, orderId).last("limit 1");
return this.update(orderDO, qr);
}
public boolean updateFromMQ(Long itemId, String orderId) {
CcRechargeOrderDO orderDO = new CcRechargeOrderDO();
orderDO.setItemId(itemId);
orderDO.setUpdatedAt(TimeFormatter.getUpdateAt());
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
qr.eq(CcRechargeOrderDO::getOrderid, orderId).last("limit 1");
return this.update(orderDO, qr);
}
public IPage selectProductPage(CcRechargeOrderQueryDTO dto) {
LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
if (dto.getId() != null) {
qr.eq(CcRechargeOrderDO::getId, dto.getId());
}
if (dto.getOrderid() != null) {
qr.eq(CcRechargeOrderDO::getOrderid, dto.getOrderid());
}
if (dto.getParentId() != null) {
qr.eq(CcRechargeOrderDO::getParentId, dto.getParentId());
}
if (dto.getUserId() != null) {
qr.eq(CcRechargeOrderDO::getUserId, dto.getUserId());
}
if (dto.getMerchantNo() != null) {
qr.eq(CcRechargeOrderDO::getMerchantNo, dto.getMerchantNo());
}
if (dto.getParentOrderId() != null) {
qr.eq(CcRechargeOrderDO::getParentOrderId, dto.getParentOrderId());
}
if (dto.getSellerId() != null) {
qr.eq(CcRechargeOrderDO::getSellerId, dto.getSellerId());
}
if (dto.getAmount() != null) {
qr.eq(CcRechargeOrderDO::getAmount, dto.getAmount());
}
if (dto.getItemId() != null) {
qr.eq(CcRechargeOrderDO::getItemId, dto.getItemId());
}
if (dto.getUserBoxId() != null) {
qr.eq(CcRechargeOrderDO::getUserBoxId, dto.getUserBoxId());
}
if (dto.getType() != null) {
qr.eq(CcRechargeOrderDO::getType, dto.getType());
}
if (dto.getPayamount() != null) {
qr.eq(CcRechargeOrderDO::getPayamount, dto.getPayamount());
}
if (dto.getPaytype() != null) {
qr.eq(CcRechargeOrderDO::getPaytype, dto.getPaytype());
}
if (dto.getPaytime() != null) {
qr.eq(CcRechargeOrderDO::getPaytime, dto.getPaytime());
}
if (dto.getIp() != null) {
qr.eq(CcRechargeOrderDO::getIp, dto.getIp());
}
if (dto.getUseragent() != null) {
qr.eq(CcRechargeOrderDO::getUseragent, dto.getUseragent());
}
if (dto.getMemo() != null) {
qr.eq(CcRechargeOrderDO::getMemo, dto.getMemo());
}
if (dto.getCreatetime() != null) {
qr.eq(CcRechargeOrderDO::getCreatetime, dto.getCreatetime());
}
if (dto.getExpiredtime() != null) {
qr.eq(CcRechargeOrderDO::getExpiredtime, dto.getExpiredtime());
}
if (dto.getUpdatetime() != null) {
qr.eq(CcRechargeOrderDO::getUpdatetime, dto.getUpdatetime());
}
if (dto.getPayinfo() != null) {
qr.eq(CcRechargeOrderDO::getPayinfo, dto.getPayinfo());
}
if (dto.getTradeNo() != null) {
qr.eq(CcRechargeOrderDO::getTradeNo, dto.getTradeNo());
}
if (dto.getOutTradeNo() != null) {
qr.eq(CcRechargeOrderDO::getOutTradeNo, dto.getOutTradeNo());
}
if (dto.getRefundTradeno() != null) {
qr.eq(CcRechargeOrderDO::getRefundTradeno, dto.getRefundTradeno());
}
if (dto.getStatus() != null) {
qr.eq(CcRechargeOrderDO::getStatus, dto.getStatus());
}
if (dto.getFundProcessType() != null) {
qr.eq(CcRechargeOrderDO::getFundProcessType, dto.getFundProcessType());
}
if (dto.getPayChannel() != null) {
qr.eq(CcRechargeOrderDO::getPayChannel, dto.getPayChannel());
}
if (dto.getProductId() != null) {
qr.eq(CcRechargeOrderDO::getProductId, dto.getProductId());
}
if (dto.getIsSold() != null) {
qr.eq(CcRechargeOrderDO::getIsSold, dto.getIsSold());
}
if (dto.getIsWhite() != null) {
qr.eq(CcRechargeOrderDO::getIsWhite, dto.getIsWhite());
}
if (dto.getIsTxhash() != null) {
qr.eq(CcRechargeOrderDO::getIsTxhash, dto.getIsTxhash());
}
if (dto.getCreatedAt() != null) {
qr.eq(CcRechargeOrderDO::getCreatedAt, dto.getCreatedAt());
}
if (dto.getUpdatedAt() != null) {
qr.eq(CcRechargeOrderDO::getUpdatedAt, dto.getUpdatedAt());
}
if (dto.getDeletedAt() != null) {
qr.eq(CcRechargeOrderDO::getDeletedAt, dto.getDeletedAt());
}
qr.orderByDesc(CcRechargeOrderDO::getId);
IPage page = new Page<>();
page.setCurrent(dto.getPage());
page.setSize(dto.getLimit());
return baseMapper.selectPage(page, qr);
}
}