Commit 192d55c9 authored by 方建宇's avatar 方建宇

Merge remote-tracking branch 'origin/dev1.0' into dev1.0

parents 56ba51b4 60025341
...@@ -127,5 +127,10 @@ public class CustRecharge extends CyIdIncreEntity<CustRecharge> { ...@@ -127,5 +127,10 @@ public class CustRecharge extends CyIdIncreEntity<CustRecharge> {
*/ */
@TableField(exist = false) @TableField(exist = false)
private String storeName; private String storeName;
/**
* 是否为退款
*/
private String isReturn;
} }
...@@ -28,6 +28,7 @@ import org.rcisoft.core.model.CyPageInfo; ...@@ -28,6 +28,7 @@ import org.rcisoft.core.model.CyPageInfo;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -58,12 +59,18 @@ public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository, ...@@ -58,12 +59,18 @@ public class CustRechargeServiceImpl extends ServiceImpl<CustRechargeRepository,
public CyPersistModel persist(CustRecharge custRecharge){ public CyPersistModel persist(CustRecharge custRecharge){
custRecharge.setStoreId(CyUserUtil.getAuthenDept()); custRecharge.setStoreId(CyUserUtil.getAuthenDept());
if(custRecharge.getOrderNumber() != null){ if(custRecharge.getOrderNumber() != null && custRecharge.getIsReturn() == null){
//根据id修改余额 //根据id修改余额
CustInfo custInfo = custInfoServiceImpl.findById(custRecharge.getCustomerId()); CustInfo custInfo = custInfoServiceImpl.findById(custRecharge.getCustomerId());
BigDecimal newBalance = custInfo.getCustomerBalance().subtract(custRecharge.getConsumptionAmount()); BigDecimal newBalance = custInfo.getCustomerBalance().subtract(custRecharge.getConsumptionAmount());
custInfo.setCustomerBalance(newBalance); custInfo.setCustomerBalance(newBalance);
custInfoServiceImpl.merge(custInfo); custInfoServiceImpl.merge(custInfo);
}else if(Objects.equals(custRecharge.getIsReturn(), "1")){
CustInfo custInfo = custInfoServiceImpl.findById(custRecharge.getCustomerId());
BigDecimal newBalance = custInfo.getCustomerBalance().add(custRecharge.getActualReceipt());
custInfo.setCustomerBalance(newBalance);
custRecharge.setCustomerBalance(newBalance);
custInfoServiceImpl.merge(custInfo);
} }
//增加操作 //增加操作
......
...@@ -163,5 +163,7 @@ public class StoreGoodsApply extends CyIdIncreEntity<StoreGoodsApply> { ...@@ -163,5 +163,7 @@ public class StoreGoodsApply extends CyIdIncreEntity<StoreGoodsApply> {
private String payType; private String payType;
private Integer customerId;
} }
...@@ -2,6 +2,7 @@ package org.rcisoft.bus.storegoodslog.entity; ...@@ -2,6 +2,7 @@ package org.rcisoft.bus.storegoodslog.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity; import org.rcisoft.core.entity.CyIdIncreEntity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment