This commit is contained in:
cun-nan 2024-01-15 14:41:36 +08:00
parent c971b639eb
commit 44f040f6ae
2 changed files with 23 additions and 12 deletions

View File

@ -348,7 +348,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
if (userId!=null){
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId);
this.updateGrowthValue(oilActualPay, userId, Integer.valueOf(jsonObjects.get(i).get("oilName").toString()),refuelMoney,storeId,orderNo);
}
order.setStoreId(storeId);
order.setUserId(userId);
@ -981,7 +981,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
e.printStackTrace();
}
}else {
this.updateGrowthValue(payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId());
this.updateGrowthValue(payAmount,userId, Integer.valueOf(oilOrder.getOils()),oilCardAmount,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
oilOrder.setPayAmount(payAmount);
@ -1052,7 +1052,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), oilOrder.getStoreId());
userId = cardValudChildrens.getUserId();
}
this.updateGrowthValue(oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId());
this.updateGrowthValue(oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
if (ObjectUtil.isNotEmpty(cashierOrder)){
@ -1152,7 +1152,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
* @param refuelMoney 消费后的加油金信息
* @param storeId 店铺id
*/
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId,String orderNo){
if (oilId!=null){
OilName oilName = oilNameService.selectOilNameById(oilId);
// 获取成长值增长数值
@ -1165,16 +1165,23 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
if (refuelMoney==null){
String refuelMoney1 = balance.getRefuelMoney();
if (StringUtils.isNotEmpty(refuelMoney1)){
JSONArray objects = JSONArray.parseArray(refuelMoney1);
JSONArray objects = JSONArray.parseArray(refuelMoney);
JSONArray objects1 = JSONArray.parseArray(refuelMoney1);
List<RefuelMoney> list = new ArrayList<>();
for (Object object : objects) {
if (((JSONObject)object).get("oilType").toString().equals(oilId)){
for (int i = 0;i<objects.size();i++){
if (((JSONObject)objects.get(i)).get("oilType").toString().equals(oilId)){
RefuelMoney refuelMoney2 = new RefuelMoney();
refuelMoney2.setType(((JSONObject) object).get("type").toString());
refuelMoney2.setOilType(((JSONObject) object).get("oilType").toString());
refuelMoney2.setRefuelMoney("0");
refuelMoney2.setType(((JSONObject) objects.get(i)).get("type").toString());
refuelMoney2.setOilType(((JSONObject) objects.get(i)).get("oilType").toString());
refuelMoney2.setRefuelMoney(((JSONObject) objects.get(i)).get("refuelMoney").toString());
list.add(refuelMoney2);
Double oilBalance = 0.0;
Double afterOilBalance = 0.0;
if (!refuelMoney1.equals(refuelMoney)){
oilBalance = Double.valueOf(((JSONObject) objects1.get(i)).get("refuelMoney").toString()) - Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
afterOilBalance = Double.valueOf(((JSONObject) objects.get(i)).get("refuelMoney").toString());
this.insertOilBalance(userid,storeId,oilName.getId().toString(),oilName.getOilType(),oilBalance,afterOilBalance,orderNo);
}
}
}
balance.setRefuelMoney(JSONObject.toJSONString(list));
@ -1288,6 +1295,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilBalanceChange.setType(type);
oilBalanceChange.setFromType("油品订单消费");
oilBalanceChange.setOrderNo(orderNo);
oilBalanceChange.setOilBalance(oilBalance);
oilBalanceChange.setAfterOilChange(afterOilBalance);
oilBalanceChangeService.save(oilBalanceChange);
}

View File

@ -112,6 +112,7 @@
value:"储值卡扣款",
barCode:"",
isLook:false,
timer:{},
}
},
onLoad() {
@ -137,7 +138,7 @@
//
countdown(){
let _this = this
setInterval(() => {
_this.timer = setInterval(() => {
// countdown1
_this.timestamp--;
// 0
@ -192,6 +193,7 @@
},
goback() {
clearInterval(this.timer)
uni.navigateBack()
}
}