囤油锁价
This commit is contained in:
parent
ef49ddc855
commit
44a1a82b81
@ -178,5 +178,12 @@ public class CardFuelRecordController extends BaseController {
|
|||||||
public void test() {
|
public void test() {
|
||||||
this.cardFuelRecordService.expireOilToBalance();
|
this.cardFuelRecordService.expireOilToBalance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//查询锁价记录
|
||||||
|
@GetMapping("/getRecordByUserId")
|
||||||
|
public ResponseObject queryById(@Param("cardFuelRecord") CardFuelRecord cardFuelRecord) {
|
||||||
|
return getSuccessResult(this.cardFuelRecordService.getRecordByUserId(cardFuelRecord));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ public interface CardFuelRecordMapper extends BaseMapper<CardFuelRecord> {
|
|||||||
IPage<CardFuelRecord> queryByPageApplet(@Param("page") Page page, @Param("cardFuelRecord") CardFuelRecord cardFuelRecord);
|
IPage<CardFuelRecord> queryByPageApplet(@Param("page") Page page, @Param("cardFuelRecord") CardFuelRecord cardFuelRecord);
|
||||||
|
|
||||||
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
|
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
|
||||||
|
|
||||||
|
CardFuelRecord getRecordByUserId(@Param("cardFuelRecord") CardFuelRecord cardFuelRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -415,5 +415,15 @@
|
|||||||
where store_id = #{storeId}
|
where store_id = #{storeId}
|
||||||
GROUP BY oil_type
|
GROUP BY oil_type
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordByUserId"
|
||||||
|
resultType="com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord">
|
||||||
|
select *
|
||||||
|
from card_fuel_record
|
||||||
|
where mt_user_id = #{cardFuelRecord.mtUserId}
|
||||||
|
and store_id = #{cardFuelRecord.storeId}
|
||||||
|
order by lockup_price desc
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
@ -112,4 +112,6 @@ public interface CardFuelRecordService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
|
List<CardFuelRecordCount> selectFuelRecordCount(CardFuelRecord cardFuelRecord);
|
||||||
|
|
||||||
|
CardFuelRecord getRecordByUserId(CardFuelRecord cardFuelRecord);
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,17 @@ import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordServi
|
|||||||
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount;
|
import com.fuint.business.marketingActivity.cardFule.vo.CardFuelRecordCount;
|
||||||
import com.fuint.business.marketingActivity.cardFuleOrders.entity.CardFuleOrders;
|
import com.fuint.business.marketingActivity.cardFuleOrders.entity.CardFuleOrders;
|
||||||
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
|
import com.fuint.business.marketingActivity.cardFuleOrders.service.CardFuleOrdersService;
|
||||||
|
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.member.entity.LJStaff;
|
import com.fuint.business.member.entity.LJStaff;
|
||||||
import com.fuint.business.member.service.ILJStaffService;
|
import com.fuint.business.member.service.ILJStaffService;
|
||||||
import com.fuint.business.order.entity.AllOrderInfo;
|
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.entity.OilBalanceChange;
|
||||||
import com.fuint.business.order.entity.RefuelMoney;
|
import com.fuint.business.order.entity.RefuelMoney;
|
||||||
import com.fuint.business.order.service.AllOrderInfoService;
|
import com.fuint.business.order.service.AllOrderInfoService;
|
||||||
|
import com.fuint.business.order.service.CardBalanceChangeService;
|
||||||
import com.fuint.business.order.service.OilBalanceChangeService;
|
import com.fuint.business.order.service.OilBalanceChangeService;
|
||||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||||
import com.fuint.business.storeInformation.entity.LJStore;
|
import com.fuint.business.storeInformation.entity.LJStore;
|
||||||
@ -497,8 +502,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
|||||||
cardFuleOrders.setPoints(cardFuelDiesel.getPoints());
|
cardFuleOrders.setPoints(cardFuelDiesel.getPoints());
|
||||||
cardFuleOrders.setType(cardFuelDiesel.getType());
|
cardFuleOrders.setType(cardFuelDiesel.getType());
|
||||||
cardFuleOrders.setOilType(cardFuelDiesel.getOilType());
|
cardFuleOrders.setOilType(cardFuelDiesel.getOilType());
|
||||||
cardFuleOrders.setIncomeLitres(cardFuelDiesel.getIncomeLitres());
|
cardFuleOrders.setLockupPrice(cardFuelDiesel.getLockPrice());
|
||||||
cardFuleOrders.setLockupPrice(cardFuelDiesel.getLockupPrice());
|
|
||||||
//油品名称
|
//油品名称
|
||||||
cardFuleOrders.setOilName(oilNameService.getById(cardFuelDiesel.getOilType()).getOilName());
|
cardFuleOrders.setOilName(oilNameService.getById(cardFuelDiesel.getOilType()).getOilName());
|
||||||
//订单号
|
//订单号
|
||||||
@ -560,11 +564,136 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CardBalanceChangeService cardBalanceChangeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CardValueRecordService cardValueRecordService;
|
||||||
/**
|
/**
|
||||||
* 屯油卡充值后续处理
|
* 屯油卡充值后续处理
|
||||||
* @param orderNo
|
* @param orderNo
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
|
public void fuleRechargeFinallDeal(String orderNo) throws JsonProcessingException {
|
||||||
|
UserBalance userBalance1 = new UserBalance();
|
||||||
|
CardValueRecord cardValueRecord = new CardValueRecord();
|
||||||
|
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
||||||
|
OilBalanceChange oilBalanceChange = new OilBalanceChange();
|
||||||
|
CardBalanceChange cardBalanceChange = new CardBalanceChange();
|
||||||
|
double afterLitres = 0.0;
|
||||||
|
double afterBalance = 0.0;
|
||||||
|
//订单详情
|
||||||
|
CardFuleOrders cardFuleOrders = cardFuleOrdersService.getOneByOrderNo(orderNo);
|
||||||
|
//更新订单状态
|
||||||
|
cardFuleOrders.setStatus("paid");
|
||||||
|
cardFuleOrders.setPayTime(new Date());
|
||||||
|
cardFuleOrdersService.updateById(cardFuleOrders);
|
||||||
|
//用户余额
|
||||||
|
UserBalance userBalance = userBalanceService.selectUserBalance(cardFuleOrders.getMtUserId(),cardFuleOrders.getChainStoreId());
|
||||||
|
//用户 (新用户新建 老用户叠加)
|
||||||
|
if (ObjectUtils.isNotEmpty(userBalance)){
|
||||||
|
//积分
|
||||||
|
if (ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(cardFuleOrders.getPoints())){
|
||||||
|
userBalance.setPoints(userBalance.getPoints() + cardFuleOrders.getPoints());
|
||||||
|
}
|
||||||
|
//储值卡余额
|
||||||
|
if (ObjectUtils.isNotEmpty(userBalance.getCardBalance()) && ObjectUtils.isNotEmpty(cardFuleOrders.getAmount())){
|
||||||
|
BigDecimal add = BigDecimal.valueOf(userBalance.getCardBalance()).add(BigDecimal.valueOf(cardFuleOrders.getAmount()));
|
||||||
|
afterBalance = add.doubleValue();
|
||||||
|
userBalance.setCardBalance(afterBalance);
|
||||||
|
}
|
||||||
|
userBalanceService.updateUserBalance(userBalance);
|
||||||
|
}else {
|
||||||
|
userBalance1.setMtUserId(cardFuleOrders.getMtUserId());
|
||||||
|
userBalance1.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
|
//积分
|
||||||
|
if (ObjectUtils.isNotEmpty(cardFuleOrders.getPoints())){
|
||||||
|
userBalance1.setPoints(cardFuleOrders.getPoints());
|
||||||
|
}
|
||||||
|
//储值卡余额
|
||||||
|
if (ObjectUtils.isNotEmpty(cardFuleOrders.getAmount())){
|
||||||
|
afterBalance = cardFuleOrders.getAmount();
|
||||||
|
userBalance1.setCardBalance(afterBalance);
|
||||||
|
}
|
||||||
|
userBalanceService.save(userBalance1);
|
||||||
|
}
|
||||||
|
//员工提成
|
||||||
|
staffCommissionService.countStaffCommission(cardFuleOrders.getStaffId(),cardFuleOrders.getStoreId(),cardFuleOrders.getAmount(),cardFuleOrders.getPayAmount(),"4",cardFuleOrders.getOrderNo());
|
||||||
|
|
||||||
|
//积分表变动
|
||||||
|
if (ObjectUtils.isNotEmpty(userBalance) && ObjectUtils.isNotEmpty(userBalance.getPoints()) && ObjectUtils.isNotEmpty(cardFuleOrders.getPoints())) {
|
||||||
|
IntegralDetail integralDetail = new IntegralDetail();
|
||||||
|
integralDetail.setStoreId(cardFuleOrders.getStoreId());
|
||||||
|
integralDetail.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
|
integralDetail.setPointsChange(Double.valueOf(cardFuleOrders.getPoints()));
|
||||||
|
integralDetail.setCurrentPoints(userBalance.getPoints() + cardFuleOrders.getPoints());
|
||||||
|
integralDetail.setChangeType("1");
|
||||||
|
integralDetail.setChangeReason("囤油卡充值");
|
||||||
|
integralDetail.setUserId(cardFuleOrders.getMtUserId());
|
||||||
|
IntegralDetail integralDetail1 = integralDetailService.insert2(integralDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
//用户余额变化记录
|
||||||
|
cardBalanceChange.setUserId(cardFuleOrders.getMtUserId());
|
||||||
|
cardBalanceChange.setStoreId(cardFuleOrders.getStoreId());
|
||||||
|
cardBalanceChange.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
|
cardBalanceChange.setChangeType("1");
|
||||||
|
cardBalanceChange.setFromType("屯油卡锁价"+cardFuleOrders.getAmount()+"元!");
|
||||||
|
cardBalanceChange.setBalance(cardFuleOrders.getAmount());
|
||||||
|
cardBalanceChange.setAfterTheChange(afterBalance);
|
||||||
|
cardBalanceChange.setOrderNo(cardFuleOrders.getOrderNo());
|
||||||
|
cardBalanceChangeService.save(cardBalanceChange);
|
||||||
|
|
||||||
|
|
||||||
|
//生成余额充值记录
|
||||||
|
cardValueRecord.setMtUserId(cardFuleOrders.getMtUserId());
|
||||||
|
cardValueRecord.setName(cardFuleOrders.getName());
|
||||||
|
cardValueRecord.setMobile(cardFuleOrders.getMobile());
|
||||||
|
cardValueRecord.setMtStaffId(cardFuleOrders.getStaffId());
|
||||||
|
cardValueRecord.setRealName(cardFuleOrders.getRealName());
|
||||||
|
cardValueRecord.setStaffMobile(cardFuleOrders.getStaffMobile());
|
||||||
|
cardValueRecord.setCardValueId(cardFuleOrders.getCardFuleId());
|
||||||
|
cardValueRecord.setBidBalance(cardFuleOrders.getAmount());
|
||||||
|
cardValueRecord.setRechargeBalance(cardFuleOrders.getAmount());
|
||||||
|
cardValueRecord.setPaymentType(cardFuleOrders.getPaymentType());
|
||||||
|
cardValueRecord.setPoints(cardFuleOrders.getPoints());
|
||||||
|
cardValueRecord.setPayStatus("paid");
|
||||||
|
cardValueRecord.setStoreId(cardFuleOrders.getStoreId());
|
||||||
|
cardValueRecord.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
|
cardValueRecord.setPaymentNo(cardFuleOrders.getOrderNo());
|
||||||
|
cardValueRecordService.save(cardValueRecord);
|
||||||
|
|
||||||
|
|
||||||
|
//生成充值记录
|
||||||
|
cardFuelRecord.setMtUserId(cardFuleOrders.getMtUserId());
|
||||||
|
cardFuelRecord.setName(cardFuleOrders.getName());
|
||||||
|
cardFuelRecord.setMobile(cardFuleOrders.getMobile());
|
||||||
|
cardFuelRecord.setMtStaffId(cardFuleOrders.getStaffId());
|
||||||
|
cardFuelRecord.setRealName(cardFuleOrders.getRealName());
|
||||||
|
cardFuelRecord.setStaffMobile(cardFuleOrders.getStaffMobile());
|
||||||
|
cardFuelRecord.setCardFuelId(cardFuleOrders.getCardFuleId());
|
||||||
|
cardFuelRecord.setRechargeBalance(cardFuleOrders.getPayAmount());
|
||||||
|
cardFuelRecord.setLockupPrice(cardFuleOrders.getLockupPrice());
|
||||||
|
cardFuelRecord.setPayAmount(cardFuleOrders.getPayAmount());
|
||||||
|
cardFuelRecord.setPaymentType(cardFuleOrders.getPaymentType());
|
||||||
|
cardFuelRecord.setPoints(cardFuleOrders.getPoints());
|
||||||
|
cardFuelRecord.setPayStatus("paid");
|
||||||
|
cardFuelRecord.setStoreId(cardFuleOrders.getStoreId());
|
||||||
|
cardFuelRecord.setPaymentNo(cardFuleOrders.getOrderNo());
|
||||||
|
cardFuelRecord.setType(cardFuleOrders.getType());
|
||||||
|
cardFuelRecord.setOilType(cardFuleOrders.getOilType());
|
||||||
|
cardFuelRecord.setOilName(cardFuleOrders.getOilName());
|
||||||
|
cardFuelRecord.setExpireTime(cardFuleOrders.getExpireTime());
|
||||||
|
cardFuelRecord.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
|
cardFuelRecordMapper.insert(cardFuelRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* @Transactional
|
||||||
public void fuleRechargeFinallDeal(String orderNo) throws JsonProcessingException {
|
public void fuleRechargeFinallDeal(String orderNo) throws JsonProcessingException {
|
||||||
UserBalance userBalance1 = new UserBalance();
|
UserBalance userBalance1 = new UserBalance();
|
||||||
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
||||||
@ -699,7 +828,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
|||||||
cardFuelRecord.setExpireTime(cardFuleOrders.getExpireTime());
|
cardFuelRecord.setExpireTime(cardFuleOrders.getExpireTime());
|
||||||
cardFuelRecord.setChainStoreId(cardFuleOrders.getChainStoreId());
|
cardFuelRecord.setChainStoreId(cardFuleOrders.getChainStoreId());
|
||||||
cardFuelRecordMapper.insert(cardFuelRecord);
|
cardFuelRecordMapper.insert(cardFuelRecord);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
@ -874,4 +1003,18 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
|||||||
List<CardFuelRecordCount> cardFuelRecordCounts = cardFuelRecordMapper.selectFuelRecordCount(cardFuelRecord);
|
List<CardFuelRecordCount> cardFuelRecordCounts = cardFuelRecordMapper.selectFuelRecordCount(cardFuelRecord);
|
||||||
return cardFuelRecordCounts;
|
return cardFuelRecordCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CardFuelRecord getRecordByUserId(CardFuelRecord cardFuelRecord) {
|
||||||
|
|
||||||
|
Integer storeId = 0;
|
||||||
|
if (ObjectUtils.isNotEmpty(cardFuelRecord.getStoreId())){
|
||||||
|
storeId = cardFuelRecord.getStoreId();
|
||||||
|
}else {
|
||||||
|
storeId= TokenUtil.getNowAccountInfo().getStoreId();
|
||||||
|
}
|
||||||
|
cardFuelRecord.setStoreId(storeId);
|
||||||
|
CardFuelRecord recordByUserId = cardFuelRecordMapper.getRecordByUserId(cardFuelRecord);
|
||||||
|
return recordByUserId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,26 +3,18 @@ package com.fuint.business.order.service.impl;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
|
||||||
import com.fuint.business.member.entity.LJStaff;
|
import com.fuint.business.member.entity.LJStaff;
|
||||||
import com.fuint.business.member.service.ILJStaffService;
|
import com.fuint.business.member.service.ILJStaffService;
|
||||||
import com.fuint.business.order.entity.HandoverRecord;
|
import com.fuint.business.order.entity.HandoverRecord;
|
||||||
import com.fuint.business.order.mapper.HandoverRecordMapper;
|
import com.fuint.business.order.mapper.HandoverRecordMapper;
|
||||||
import com.fuint.business.order.service.HandoverRecordService;
|
import com.fuint.business.order.service.HandoverRecordService;
|
||||||
import com.fuint.business.store.entity.MtStore;
|
import com.fuint.business.store.entity.MtStore;
|
||||||
import com.fuint.business.store.mapper.MtStoreMapper;
|
|
||||||
import com.fuint.business.store.service.StoreService;
|
import com.fuint.business.store.service.StoreService;
|
||||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||||
import com.fuint.business.userManager.vo.LJUserVo;
|
|
||||||
import com.fuint.common.util.TscLibDll;
|
import com.fuint.common.util.TscLibDll;
|
||||||
import com.fuint.framework.exception.BusinessCheckException;
|
import com.fuint.framework.exception.BusinessCheckException;
|
||||||
import com.fuint.system.dict.entity.SysDictData;
|
|
||||||
import com.fuint.system.dict.entity.SysDictType;
|
|
||||||
import com.fuint.system.dict.service.ISysDictDataService;
|
import com.fuint.system.dict.service.ISysDictDataService;
|
||||||
import com.fuint.system.dict.service.ISysDictTypeService;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import javafx.print.Printer;
|
import javafx.print.Printer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
|
Loading…
Reference in New Issue
Block a user