|
|
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
@@ -213,6 +214,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public int update(InputExpenseAccount in) {
|
|
|
OutExpenseAccount useEA = expenseAccountMapper.selectByid(in.getId());
|
|
|
if (useEA.getStatus()!=0&&useEA.getStatus()!=3){
|
|
|
@@ -260,10 +262,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
List<ExpenseAccount> list = expenseAccountMapper.selectByDebitId(debitId);
|
|
|
ExpenseAccount newdebit=new ExpenseAccount();
|
|
|
newdebit.setId(debitId);
|
|
|
- int minStatus=0;
|
|
|
+ //计算除开当前单,已选择抵扣金额
|
|
|
BigDecimal count=new BigDecimal(0);
|
|
|
for (ExpenseAccount e : list) {
|
|
|
- if (e.getStatus()>0)minStatus=e.getStatus();
|
|
|
if (!in.getId().equals(e.getId())){
|
|
|
count=count.add(e.getSettlementAmount());
|
|
|
}
|
|
|
@@ -344,17 +345,17 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
//审核通知 获取发送人
|
|
|
addExamineExpenseAccountLog(in, useEa, newEa);
|
|
|
//完成申请
|
|
|
- if (in.getStatus()==2){
|
|
|
+ if (newEa.getStatus()==2){
|
|
|
//如果是借支则订单新增
|
|
|
- if (in.getType()!=4){
|
|
|
+ if (useEa.getType()!=4){
|
|
|
//不然就看是否挂载借支订单进行抵扣
|
|
|
if (useEa.getDebitId()!=null){
|
|
|
ExpenseAccount useDebit=expenseAccountMapper.selectByPrimaryKey(useEa.getDebitId());
|
|
|
if (useDebit.getLiquidationStatus()==2){
|
|
|
- List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByDebitId(useDebit.getDebitId());
|
|
|
+ List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByDebitId(useEa.getDebitId());
|
|
|
boolean flag=true;
|
|
|
for (ExpenseAccount expenseAccount : expenseAccounts) {
|
|
|
- if(expenseAccount.getStatus()!=2){
|
|
|
+ if(!expenseAccount.getId().equals(in.getId())&&expenseAccount.getStatus()!=2){
|
|
|
flag=flag;
|
|
|
break;
|
|
|
}
|