|
|
@@ -3,6 +3,7 @@ package com.goafanti.organization.service.impl;
|
|
|
import com.goafanti.admin.bo.AdminListBo;
|
|
|
import com.goafanti.common.dao.DepartmentMapper;
|
|
|
import com.goafanti.common.dao.ExpenseConfigDetailsMapper;
|
|
|
+import com.goafanti.common.dao.TOrderMidMapper;
|
|
|
import com.goafanti.common.dao.TOrderNewMapper;
|
|
|
import com.goafanti.common.model.Department;
|
|
|
import com.goafanti.common.model.ExpenseConfigDetails;
|
|
|
@@ -32,6 +33,8 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
private ExpenseConfigDetailsMapper expenseConfigDetailsMapper;
|
|
|
@Autowired
|
|
|
private TOrderNewMapper torderNewMapper;
|
|
|
+ @Autowired
|
|
|
+ private TOrderMidMapper torderMidMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AsyncUtils asyncUtils;
|
|
|
@@ -205,7 +208,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
public int updateOrganization(InputDep in) {
|
|
|
//获取上级编号
|
|
|
Department superDep=departmentMapper.selectByPrimaryKey(in.getSuperId());
|
|
|
- Department department = departmentMapper.selectByPrimaryKey(in.getId());
|
|
|
+ Department useDep = departmentMapper.selectByPrimaryKey(in.getId());
|
|
|
Date now=new Date();
|
|
|
Department dep=new Department();
|
|
|
dep.setLvl(superDep.getLvl()+1);
|
|
|
@@ -225,24 +228,47 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
dep.setApproval(in.getApproval());
|
|
|
dep.setApprovalAid(in.getApprovalAid());
|
|
|
//财务与复审切换的时候要切换所有未审核的财务
|
|
|
- if(StringUtils.isNotBlank(in.getFinanceId())&&!department.getFinanceId().equals(in.getFinanceId())){
|
|
|
+ boolean updateFinance=false;
|
|
|
+ boolean updateRetrialFinance=false;
|
|
|
+ if(StringUtils.isNotBlank(in.getFinanceId())&&!useDep.getFinanceId().equals(in.getFinanceId())){
|
|
|
dep.setFinanceId(in.getFinanceId());
|
|
|
//处理订单
|
|
|
- departmentMapper.updateOrderDepFinanceNotExamine(in.getFinanceId(),department.getFinanceId());
|
|
|
+ departmentMapper.updateOrderDepFinanceNotExamine(in.getFinanceId(),useDep.getFinanceId());
|
|
|
List<String> list = torderNewMapper.selectByFinanceNotExamine(in.getFinanceId());
|
|
|
torderNewMapper.updateOrderDepFinanceExamineName(list);
|
|
|
-
|
|
|
+ updateFinance=true;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(in.getRetrialFinanceId())&&
|
|
|
- !department.getRetrialFinanceId().equals(in.getRetrialFinanceId())){
|
|
|
+ !useDep.getRetrialFinanceId().equals(in.getRetrialFinanceId())){
|
|
|
dep.setRetrialFinanceId(in.getRetrialFinanceId());
|
|
|
- departmentMapper.updateOrderDepFinanceNotExamine(in.getRetrialFinanceId(),department.getRetrialFinanceId());
|
|
|
+ departmentMapper.updateOrderDepFinanceNotExamine(in.getRetrialFinanceId(),useDep.getRetrialFinanceId());
|
|
|
List<String> list = torderNewMapper.selectByFinanceNotExamine(in.getRetrialFinanceId());
|
|
|
torderNewMapper.updateOrderDepFinanceExamineName(list);
|
|
|
+ updateRetrialFinance=true;
|
|
|
}
|
|
|
-
|
|
|
dep.setExpenseFinanceId(in.getExpenseFinanceId());
|
|
|
- checkFinaceUpdate(in.getId(),in.getFinanceId());
|
|
|
+ //获取需要重新刷新的财务
|
|
|
+ List<String> aids =new ArrayList<>();
|
|
|
+ if (updateFinance){
|
|
|
+ if (aids.contains(in.getFinanceId())){
|
|
|
+ aids.add(in.getFinanceId());
|
|
|
+ }
|
|
|
+ if(!aids.contains(useDep.getFinanceId())){
|
|
|
+ aids.add(useDep.getFinanceId());
|
|
|
+ }
|
|
|
+ torderMidMapper.updateFinanceId(in.getId(),in.getFinanceId());
|
|
|
+ asyncUtils.updateFinanceExamine(in.getFinanceId());
|
|
|
+ }
|
|
|
+ if(updateRetrialFinance){
|
|
|
+ if (aids.contains(in.getRetrialFinanceId())){
|
|
|
+ aids.add(in.getRetrialFinanceId());
|
|
|
+ }
|
|
|
+ if(!aids.contains(useDep.getRetrialFinanceId())){
|
|
|
+ aids.add(useDep.getRetrialFinanceId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
+ checkFinaceUpdate(aids);
|
|
|
if (in.getExpenseRetrialFinanceExamine()==1){
|
|
|
dep.setExpenseRetrialFinanceExamine(in.getExpenseRetrialFinanceExamine());
|
|
|
}
|
|
|
@@ -264,14 +290,10 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
|
|
|
|
|
|
/**
|
|
|
* 如果更换了负责人刷新中间表
|
|
|
- * @param id 部门编号
|
|
|
- * @param financeId 财务编号
|
|
|
*/
|
|
|
- private void checkFinaceUpdate(String id, String financeId) {
|
|
|
- Department dep = departmentMapper.selectByPrimaryKey(id);
|
|
|
- if (financeId!=null&&!financeId.equals(dep.getFinanceId())){
|
|
|
- asyncUtils.updateFinanceExamineAndDep(id,financeId,dep.getFinanceId());
|
|
|
- }
|
|
|
+ private void checkFinaceUpdate(List<String> aids) {
|
|
|
+ asyncUtils.financeCoutSwitch(aids);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|