|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.io.Serializable;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Collection;
|
|
|
|
|
@@ -30,6 +31,16 @@ public class PurCommissionRequestServiceImpl extends ServiceImpl<PurCommissionRe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void saveMain(PurCommissionRequest purCommissionRequest, List<PurCommissionRequestDetails> purCommissionRequestDetailsList) {
|
|
|
+
|
|
|
+ BigDecimal approveMoney = BigDecimal.ZERO;
|
|
|
+ if(purCommissionRequestDetailsList!=null && purCommissionRequestDetailsList.size()>0) {
|
|
|
+ for(PurCommissionRequestDetails entity:purCommissionRequestDetailsList) {
|
|
|
+ BigDecimal applyMoney = entity.getApplyMoney() == null ? BigDecimal.ZERO : entity.getApplyMoney();
|
|
|
+ approveMoney = approveMoney.add(applyMoney);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ purCommissionRequest.setApproveMoney(approveMoney);
|
|
|
+
|
|
|
purCommissionRequestMapper.insert(purCommissionRequest);
|
|
|
if(purCommissionRequestDetailsList!=null && purCommissionRequestDetailsList.size()>0) {
|
|
|
for(PurCommissionRequestDetails entity:purCommissionRequestDetailsList) {
|
|
@@ -44,6 +55,17 @@ public class PurCommissionRequestServiceImpl extends ServiceImpl<PurCommissionRe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateMain(PurCommissionRequest purCommissionRequest,List<PurCommissionRequestDetails> purCommissionRequestDetailsList) {
|
|
|
+
|
|
|
+ BigDecimal approveMoney = BigDecimal.ZERO;
|
|
|
+ if(purCommissionRequestDetailsList!=null && purCommissionRequestDetailsList.size()>0) {
|
|
|
+ for(PurCommissionRequestDetails entity:purCommissionRequestDetailsList) {
|
|
|
+ BigDecimal applyMoney = entity.getApplyMoney() == null ? BigDecimal.ZERO : entity.getApplyMoney();
|
|
|
+ approveMoney = approveMoney.add(applyMoney);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ purCommissionRequest.setApproveMoney(approveMoney);
|
|
|
+
|
|
|
+
|
|
|
purCommissionRequestMapper.updateById(purCommissionRequest);
|
|
|
|
|
|
//1.先删除子表数据
|