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>
</template>
</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">
<span>{{ parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.balCreateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">

View File

@ -124,14 +124,16 @@ public class CardExchangeRecordServiceImpl extends ServiceImpl<CardExchangeRecor
@Override
public boolean addCardExchangeRecord(CardExchangeRecord cardExchangeRecord) {
CardExchange cardExchange = cardExchangeService.getById(cardExchangeRecord.getCardExchangeId());
cardExchangeRecord.setExchangeName(cardExchange.getName());
cardExchangeRecord.setGiftName(cardExchange.getGiftName());
cardExchangeRecord.setDescription(cardExchange.getUseInstructions());
cardExchangeRecord.setStartTime(new Date());
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardExchange.getValidity());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardExchangeRecord.setOutTime(from);
if (ObjectUtils.isNotEmpty(cardExchange)){
cardExchangeRecord.setExchangeName(cardExchange.getName());
cardExchangeRecord.setGiftName(cardExchange.getGiftName());
cardExchangeRecord.setDescription(cardExchange.getUseInstructions());
cardExchangeRecord.setStartTime(new Date());
LocalDate today = LocalDate.now();
LocalDate localDate = today.plusDays(cardExchange.getValidity());
Date from = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
cardExchangeRecord.setOutTime(from);
}
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.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletResponse;
@ -18,6 +19,7 @@ import java.util.Map;
/**
* 油品订单信息 业务层
*/
@Transactional
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.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
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"));
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","消费总金额不对!");
this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(),0.0, oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail");
result = true;
@ -1132,10 +1134,19 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 修改订单的优惠金额和支付金额
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
oilOrder.setPayAmount(payAmount);
oilOrder.setActiveId(Integer.valueOf(activeId));
oilOrder.setCouponId(Integer.valueOf(cardFavorableId));
oilOrder.setActiveType(type);
if (StringUtils.isNotEmpty(activeId)){
oilOrder.setActiveId(Integer.valueOf(activeId));
}
if (StringUtils.isNotEmpty(cardFavorableId)) {
oilOrder.setCouponId(Integer.valueOf(cardFavorableId));
}
if (StringUtils.isNotEmpty(type)) {
oilOrder.setActiveType(type);
}
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;
}
@ -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.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);
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);
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 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();
// 根据用户id查询用户余额信息
LJStore store = storeService.selectStoreByStoreId(storeId);
UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId());
boolean result = false;
if (ObjectUtil.isNotEmpty(balance)){
// 修改余额信息
Double beforeBalance = balance.getCardBalance();
Double afterBalance = beforeBalance - amount;
if ((beforeBalance - amount)<0.0){
result = true;
return false;
}
cardBalanceChange.setAfterTheChange(afterBalance);
balance.setCardBalance(afterBalance);
// 修改加油次数
@ -1428,6 +1434,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardBalanceChange.setStoreId(storeId);
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
return true;
}
private void insertGrowthValueChange(Integer userId,Integer storeId,Integer growthValue,Integer growthValueAfter,String orderNo){

View File

@ -10,7 +10,7 @@
</sql>
<sql id="selectUserAndBalance">
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
LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id
</sql>
@ -60,10 +60,10 @@
and mub.card_balance != 0
</if>
<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 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>
</where>
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.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.userManager.util.GenderConverter;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ExcelIgnoreUnannotated
@ -114,4 +116,9 @@ public class LJUserVo extends BaseEntity {
*/
private Integer chainStoreId;
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) {
let _this = this
console.log(res)
let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.reservedPayInfo);
uni.requestPayment({
// provider: 'wxpay' 'alipay'
provider: payProvider,
timeStamp: _this.orderInfo.timeStamp,
nonceStr: _this.orderInfo.nonceStr,
package: _this.orderInfo.package,
signType: 'MD5',
paySign: _this.orderInfo.paySign,
success: function(res) {
console.log('success:', res);
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"
if (uni.getStorageSync("appltType") == "WECHAT") {
let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.reservedPayInfo);
uni.requestPayment({
// provider: 'wxpay' 'alipay'
provider: payProvider,
timeStamp: _this.orderInfo.timeStamp,
nonceStr: _this.orderInfo.nonceStr,
package: _this.orderInfo.package,
signType: 'MD5',
paySign: _this.orderInfo.paySign,
success: function(res) {
console.log('success:', res);
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
})
console.log('fail:', err);
}
});
}
if (_this.appltType == "ALIPAY") {
my.tradePay({
tradeNO: res.data.data.reservedTransactionId
}, function(resp) {
if (resp.resultCode == '9000') {
console.log("支付成功")
// 使
/* _this.preferentialData.storeId = _this.oilOrder.storeId
_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"
},
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('支付失败,' + resp.resultCode);
}
});
console.log('fail:', err);
}
});
}
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;
}
if(res.data.success == "ok"){
_this.preferentialData.storeId = _this.oilOrder.storeId
_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);
})
// _this.preferentialData.storeId = _this.oilOrder.storeId
// _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)=>{})
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
@ -378,17 +376,17 @@
success: function (res) {
console.log('success');
// 使
_this.preferentialData.storeId = _this.oilOrder.storeId
_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);
})
// _this.preferentialData.storeId = _this.oilOrder.storeId
// _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'
})
@ -413,17 +411,15 @@
if(resp.resultCode == '9000'){
console.log("支付成功")
// 使
_this.preferentialData.storeId = _this.oilOrder.storeId
_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);
})
// _this.preferentialData.storeId = _this.oilOrder.storeId
// _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)=>{})
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})