|
|
@@ -369,30 +369,34 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
//完成申请
|
|
|
if (newEa.getStatus()==2){
|
|
|
//如果是借支则订单新增
|
|
|
- if (useEa.getType()!=4){
|
|
|
- //不然就看是否挂载借支订单进行抵扣
|
|
|
- if (useEa.getDebitId()!=null){
|
|
|
- ExpenseAccount useDebit=expenseAccountMapper.selectByPrimaryKey(useEa.getDebitId());
|
|
|
- if (useDebit.getLiquidationStatus()==2){
|
|
|
- List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByDebitId(useEa.getDebitId());
|
|
|
- boolean flag=true;
|
|
|
- for (ExpenseAccount expenseAccount : expenseAccounts) {
|
|
|
- if(!expenseAccount.getId().equals(in.getId())&&expenseAccount.getStatus()!=2){
|
|
|
- flag=false;
|
|
|
- break;
|
|
|
+ List<ExpenseAccount> expenseAccounts1 = expenseAccountMapper.selectListByMainId(in.getId());
|
|
|
+ for (ExpenseAccount e : expenseAccounts1) {
|
|
|
+ if (e.getType()!=4){
|
|
|
+ //不然就看是否挂载借支订单进行抵扣
|
|
|
+ if (e.getDebitId()!=null){
|
|
|
+ ExpenseAccount useDebit=expenseAccountMapper.selectByPrimaryKey(e.getDebitId());
|
|
|
+ if (useDebit.getLiquidationStatus()==2){
|
|
|
+ List<ExpenseAccount> expenseAccounts = expenseAccountMapper.selectByDebitId(e.getDebitId());
|
|
|
+ boolean flag=true;
|
|
|
+ for (ExpenseAccount expenseAccount : expenseAccounts) {
|
|
|
+ if(!expenseAccount.getId().equals(in.getId())&&expenseAccount.getStatus()!=2){
|
|
|
+ flag=false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ ExpenseAccount debit=new ExpenseAccount();
|
|
|
+ debit.setId(e.getDebitId());
|
|
|
+ debit.setLiquidationStatus(3);
|
|
|
+ expenseAccountMapper.updateByPrimaryKeySelective(debit);
|
|
|
}
|
|
|
- }
|
|
|
- if (flag){
|
|
|
- ExpenseAccount debit=new ExpenseAccount();
|
|
|
- debit.setId(useEa.getDebitId());
|
|
|
- debit.setLiquidationStatus(3);
|
|
|
- expenseAccountMapper.updateByPrimaryKeySelective(debit);
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
if (newEa.getStatus()==1){
|
|
|
if (newEa.getProcessStatus()==EAProcessStatus.CWSH.getCode()){
|
|
|
@@ -408,49 +412,13 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //审核处理审核表
|
|
|
- pushExpenseAccountExamine(in);
|
|
|
+ //审核处理审核表
|
|
|
+ pushExpenseAccountExamine(in);
|
|
|
expenseAccountMapper.updateByPrimaryKeySelective(newEa);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- private void pushExpenseFinaceCount(ExpenseAccount useEa, ExpenseAccount newEa) {
|
|
|
- String startTime=DateUtils.formatDate(useEa.getCreateTime(),AFTConstants.YYYYMMDD);
|
|
|
- AdminListBo admin = adminMapper.getDeptNameByAid(useEa.getAid());
|
|
|
- FinanceCount financeCount = financeCountMapper.selectByAidAndDates(admin.getDepFinance(), startTime);
|
|
|
- //通过
|
|
|
- if (newEa.getStatus()==1){
|
|
|
- //下一步是财务审核就要加财务统计
|
|
|
- if (newEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()||
|
|
|
- useEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
- if (newEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
- addFinanceCount(admin.getDepFinance(), startTime);
|
|
|
- //如果当前是财务审核通过就要减去未审核
|
|
|
- }else if (useEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
- FinanceCount newFinanceCount =new FinanceCount();
|
|
|
- newFinanceCount.setId(financeCount.getId());
|
|
|
- newFinanceCount.setExpenseUnauditedCount(financeCount.getExpenseUnauditedCount()-1);
|
|
|
- financeCountMapper.updateByPrimaryKeySelective(newFinanceCount);
|
|
|
- }
|
|
|
- }
|
|
|
- //驳回
|
|
|
- }else if (newEa.getStatus()==3){
|
|
|
- if (financeCount!=null) {
|
|
|
- FinanceCount newFinanceCount = new FinanceCount();
|
|
|
- newFinanceCount.setId(financeCount.getId());
|
|
|
- //财务审核时减去未审核与
|
|
|
- if (useEa.getProcessStatus() == EAProcessStatus.CWSH.getCode()) {
|
|
|
- newFinanceCount.setExpenseCount(financeCount.getExpenseCount() - 1);
|
|
|
- newFinanceCount.setExpenseUnauditedCount(financeCount.getExpenseUnauditedCount() - 1);
|
|
|
-
|
|
|
- } else if (useEa.getProcessStatus() > EAProcessStatus.CWSH.getCode()) {
|
|
|
- newFinanceCount.setExpenseCount(financeCount.getExpenseCount() - 1);
|
|
|
- }
|
|
|
- financeCountMapper.updateByPrimaryKeySelective(newFinanceCount);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
private void addFinanceCount(String aid,Date startTime ) {
|
|
|
String forDate=DateUtils.formatDate(startTime,AFTConstants.YYYYMMDD);
|
|
|
addFinanceCount(aid,forDate);
|