This commit is contained in:
cun-nan 2024-01-29 18:18:30 +08:00
parent b5c6f8382f
commit cedf3c7281
8 changed files with 138 additions and 132 deletions

View File

@ -202,9 +202,9 @@
<div>{{ scope.row.consumeNum ? scope.row.consumeNum : '0' }}</div> <div>{{ scope.row.consumeNum ? scope.row.consumeNum : '0' }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="注册时间" align="center" width="160" prop="createTime"> <el-table-column label="注册时间" align="center" width="160" prop="balCreateTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.balCreateTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">

View File

@ -124,14 +124,16 @@ public class CardExchangeRecordServiceImpl extends ServiceImpl<CardExchangeRecor
@Override @Override
public boolean addCardExchangeRecord(CardExchangeRecord cardExchangeRecord) { public boolean addCardExchangeRecord(CardExchangeRecord cardExchangeRecord) {
CardExchange cardExchange = cardExchangeService.getById(cardExchangeRecord.getCardExchangeId()); CardExchange cardExchange = cardExchangeService.getById(cardExchangeRecord.getCardExchangeId());
cardExchangeRecord.setExchangeName(cardExchange.getName()); if (ObjectUtils.isNotEmpty(cardExchange)){
cardExchangeRecord.setGiftName(cardExchange.getGiftName()); cardExchangeRecord.setExchangeName(cardExchange.getName());
cardExchangeRecord.setDescription(cardExchange.getUseInstructions()); cardExchangeRecord.setGiftName(cardExchange.getGiftName());
cardExchangeRecord.setStartTime(new Date()); cardExchangeRecord.setDescription(cardExchange.getUseInstructions());
LocalDate today = LocalDate.now(); cardExchangeRecord.setStartTime(new Date());
LocalDate localDate = today.plusDays(cardExchange.getValidity()); LocalDate today = LocalDate.now();
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); LocalDate localDate = today.plusDays(cardExchange.getValidity());
cardExchangeRecord.setOutTime(from); Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardExchangeRecord.setOutTime(from);
}
return save(cardExchangeRecord); return save(cardExchangeRecord);
} }
} }

View File

@ -9,6 +9,7 @@ import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.vo.OilOrderVo; import com.fuint.business.order.vo.OilOrderVo;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -18,6 +19,7 @@ import java.util.Map;
/** /**
* 油品订单信息 业务层 * 油品订单信息 业务层
*/ */
@Transactional
public interface OilOrderService extends IService<OilOrder> { public interface OilOrderService extends IService<OilOrder> {
/** /**
* 根据条件分页查询油品订单信息 * 根据条件分页查询油品订单信息

View File

@ -60,6 +60,7 @@ import com.fuint.system.config.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -1057,7 +1058,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 未使用囤油卡 // 未使用囤油卡
// 校验支付金额和优惠金额数据是否相同 // 校验支付金额和优惠金额数据是否相同
Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount")); Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount"));
if (Double.compare(realAmount,oilOrder.getOrderAmount())!=0){ // if (Double.compare(realAmount,oilOrder.getOrderAmount())!=0){
if (-0.03>=(realAmount-oilOrder.getOrderAmount()) && (realAmount-oilOrder.getOrderAmount())>=0.03){
applet.put("error","消费总金额不对!"); applet.put("error","消费总金额不对!");
this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(),0.0, oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(),0.0, oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail");
result = true; result = true;
@ -1132,10 +1134,19 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 修改订单的优惠金额和支付金额 // 修改订单的优惠金额和支付金额
oilOrder.setDiscountAmount(Double.valueOf(discountAmount)); oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayAmount(payAmount); oilOrder.setPayAmount(payAmount);
oilOrder.setActiveId(Integer.valueOf(activeId)); if (StringUtils.isNotEmpty(activeId)){
oilOrder.setCouponId(Integer.valueOf(cardFavorableId)); oilOrder.setActiveId(Integer.valueOf(activeId));
oilOrder.setActiveType(type); }
if (StringUtils.isNotEmpty(cardFavorableId)) {
oilOrder.setCouponId(Integer.valueOf(cardFavorableId));
}
if (StringUtils.isNotEmpty(type)) {
oilOrder.setActiveType(type);
}
this.updateOilOrder(oilOrder); this.updateOilOrder(oilOrder);
if (oilOrder.getOrderStatus().equals("paid")) {
this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getActiveId(), oilOrder.getCouponId(), oilOrder.getActiveType(), oilOrder.getOrderAmount(), Integer.valueOf(oilOrder.getOils()));
}
return applet; return applet;
} }
@ -1194,6 +1205,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
} }
this.updateGrowthValue(oilOrder.getOrderAmount(),oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo); this.updateGrowthValue(oilOrder.getOrderAmount(),oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId()); this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.updateCardAndActiveById(oilOrder.getStoreId(),oilOrder.getUserId(),oilOrder.getActiveId(),oilOrder.getCouponId(),oilOrder.getActiveType(),oilOrder.getOrderAmount(), Integer.valueOf(oilOrder.getOils()));
this.insertCardBalance(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount()-oilOrder.getPayAmount(),userId,oilOrder.getStoreId(),orderNo); this.insertCardBalance(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount()-oilOrder.getPayAmount(),userId,oilOrder.getStoreId(),orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo); staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
} }
@ -1382,17 +1394,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
userBalanceService.updateUserBalance(balance); userBalanceService.updateUserBalance(balance);
this.insertGrowthValueChange(userid,storeId,addGrowthVal,growthAfter,orderNo); this.insertGrowthValueChange(userid,storeId,addGrowthVal,growthAfter,orderNo);
// CardBalanceChange cardBalanceChange = new CardBalanceChange();
//// 添加余额记录信息
// cardBalanceChange.setUserId(userid);
// cardBalanceChange.setChangeType("0");
// cardBalanceChange.setFromType("油品订单消费");
// cardBalanceChange.setBalance(oilAmount - oilActualPay);
// cardBalanceChange.setOrderNo(orderNo);
// cardBalanceChange.setStoreId(storeId);
//
// cardBalanceChangeService.insertCardBalance(cardBalanceChange);
} }
} }
@ -1402,15 +1403,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
* @param userId * @param userId
* @param storeId * @param storeId
*/ */
private void insertCardBalance(Double amount,Integer userId,Integer storeId,String orderNo){ private boolean insertCardBalance(Double amount,Integer userId,Integer storeId,String orderNo){
CardBalanceChange cardBalanceChange = new CardBalanceChange(); CardBalanceChange cardBalanceChange = new CardBalanceChange();
// 根据用户id查询用户余额信息 // 根据用户id查询用户余额信息
LJStore store = storeService.selectStoreByStoreId(storeId); LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId());
boolean result = false;
if (ObjectUtil.isNotEmpty(balance)){ if (ObjectUtil.isNotEmpty(balance)){
// 修改余额信息 // 修改余额信息
Double beforeBalance = balance.getCardBalance(); Double beforeBalance = balance.getCardBalance();
Double afterBalance = beforeBalance - amount; Double afterBalance = beforeBalance - amount;
if ((beforeBalance - amount)<0.0){
result = true;
return false;
}
cardBalanceChange.setAfterTheChange(afterBalance); cardBalanceChange.setAfterTheChange(afterBalance);
balance.setCardBalance(afterBalance); balance.setCardBalance(afterBalance);
// 修改加油次数 // 修改加油次数
@ -1428,6 +1434,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardBalanceChange.setStoreId(storeId); cardBalanceChange.setStoreId(storeId);
cardBalanceChangeService.insertCardBalance(cardBalanceChange); cardBalanceChangeService.insertCardBalance(cardBalanceChange);
return true;
} }
private void insertGrowthValueChange(Integer userId,Integer storeId,Integer growthValue,Integer growthValueAfter,String orderNo){ private void insertGrowthValueChange(Integer userId,Integer storeId,Integer growthValue,Integer growthValueAfter,String orderNo){

View File

@ -10,7 +10,7 @@
</sql> </sql>
<sql id="selectUserAndBalance"> <sql id="selectUserAndBalance">
select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money, select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money,
mub.second_card,mub.fixing_level mub.second_card,mub.fixing_level,mub.create_time balCreateTime
FROM mt_user mu FROM mt_user mu
LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id
</sql> </sql>
@ -60,10 +60,10 @@
and mub.card_balance != 0 and mub.card_balance != 0
</if> </if>
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 --> <if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(mu.create_time,'%y%m%d') &gt;= date_format(#{user.params.beginTime},'%y%m%d') and date_format(mub.balCreateTime,'%y%m%d') &gt;= date_format(#{user.params.beginTime},'%y%m%d')
</if> </if>
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 --> <if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(mu.create_time,'%y%m%d') &lt;= date_format(#{user.params.endTime},'%y%m%d') and date_format(mub.balCreateTime,'%y%m%d') &lt;= date_format(#{user.params.endTime},'%y%m%d')
</if> </if>
</where> </where>
GROUP BY mu.id GROUP BY mu.id

View File

@ -2,11 +2,13 @@ package com.fuint.business.userManager.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.userManager.util.GenderConverter; import com.fuint.business.userManager.util.GenderConverter;
import com.fuint.framework.entity.BaseEntity; import com.fuint.framework.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
@ -114,4 +116,9 @@ public class LJUserVo extends BaseEntity {
*/ */
private Integer chainStoreId; private Integer chainStoreId;
private Integer days; private Integer days;
/**
* 注册时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
private Date balCreateTime;
} }

View File

@ -282,80 +282,72 @@
if (res.code === 200) { if (res.code === 200) {
let _this = this let _this = this
console.log(res) console.log(res)
let payProvider = "wxpay" if (uni.getStorageSync("appltType") == "WECHAT") {
_this.orderInfo = JSON.parse(res.data.reservedPayInfo); let payProvider = "wxpay"
uni.requestPayment({ _this.orderInfo = JSON.parse(res.data.reservedPayInfo);
// provider: 'wxpay' 'alipay' uni.requestPayment({
provider: payProvider, // provider: 'wxpay' 'alipay'
timeStamp: _this.orderInfo.timeStamp, provider: payProvider,
nonceStr: _this.orderInfo.nonceStr, timeStamp: _this.orderInfo.timeStamp,
package: _this.orderInfo.package, nonceStr: _this.orderInfo.nonceStr,
signType: 'MD5', package: _this.orderInfo.package,
paySign: _this.orderInfo.paySign, signType: 'MD5',
success: function(res) { paySign: _this.orderInfo.paySign,
console.log('success:', res); success: function(res) {
uni.reLaunch({ console.log('success:', res);
url: '/pagesRefuel/orderSuccess/index' uni.reLaunch({
}) url: '/pagesRefuel/orderSuccess/index'
},
fail: function(err) {
request({
url: "/business/marketingActivity/activeExchange/cardValueOrders",
method: 'put',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
}) })
}) },
console.log('fail:', err); fail: function(err) {
} request({
}); url: "/business/marketingActivity/activeExchange/cardValueOrders",
} method: 'put',
if (_this.appltType == "ALIPAY") { data: {
my.tradePay({ "orderNo": res.data.data.orderNo,
tradeNO: res.data.data.reservedTransactionId "status": "payFail"
}, function(resp) { },
if (resp.resultCode == '9000') { }).then((res) => {
console.log("支付成功") uni.showToast({
// 使 title: "支付失败!",
/* _this.preferentialData.storeId = _this.oilOrder.storeId icon: "error"
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount })
_this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId
request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post',
data: _this.preferentialData,
}).then((res)=>{
console.log(res);
}) */
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
} else {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
}) })
}) console.log('fail:', err);
console.log('支付失败,' + resp.resultCode); }
} });
}); }
if (uni.getStorageSync("appltType") == "ALIPAY") {
my.tradePay({
tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
if (resp.resultCode == '9000') {
console.log("支付成功")
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
} else {
request({
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail"
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('支付失败,' + resp.resultCode);
}
});
}
} }
}) })
}, },
// //

View File

@ -338,17 +338,15 @@
return; return;
} }
if(res.data.success == "ok"){ if(res.data.success == "ok"){
_this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount // _this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils // _this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId // _this.preferentialData.mtUserLevel = _this.user.gradeId
request({ // request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", // url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post', // method: 'post',
data: _this.preferentialData, // data: _this.preferentialData,
}).then((res)=>{ // }).then((res)=>{})
console.log(res);
})
uni.reLaunch({ uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index' url: '/pagesRefuel/orderSuccess/index'
}) })
@ -378,17 +376,17 @@
success: function (res) { success: function (res) {
console.log('success'); console.log('success');
// 使 // 使
_this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount // _this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils // _this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId // _this.preferentialData.mtUserLevel = _this.user.gradeId
request({ // request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", // url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post', // method: 'post',
data: _this.preferentialData, // data: _this.preferentialData,
}).then((res)=>{ // }).then((res)=>{
console.log(res); // console.log(res);
}) // })
uni.reLaunch({ uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index' url: '/pagesRefuel/orderSuccess/index'
}) })
@ -413,17 +411,15 @@
if(resp.resultCode == '9000'){ if(resp.resultCode == '9000'){
console.log("支付成功") console.log("支付成功")
// 使 // 使
_this.preferentialData.storeId = _this.oilOrder.storeId // _this.preferentialData.storeId = _this.oilOrder.storeId
_this.preferentialData.orderAmount = _this.oilOrder.orderAmount // _this.preferentialData.orderAmount = _this.oilOrder.orderAmount
_this.preferentialData.oilId = _this.oilOrder.oils // _this.preferentialData.oilId = _this.oilOrder.oils
_this.preferentialData.mtUserLevel = _this.user.gradeId // _this.preferentialData.mtUserLevel = _this.user.gradeId
request({ // request({
url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById", // url: "business/marketingActivity/cardFavorableRecord/updateCardAndActiveById",
method: 'post', // method: 'post',
data: _this.preferentialData, // data: _this.preferentialData,
}).then((res)=>{ // }).then((res)=>{})
console.log(res);
})
uni.reLaunch({ uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index' url: '/pagesRefuel/orderSuccess/index'
}) })