|
|
@@ -21,6 +21,7 @@ import com.goafanti.expenseAccount.Enums.EATypes;
|
|
|
import com.goafanti.expenseAccount.Enums.EAsecondaryTypes;
|
|
|
import com.goafanti.expenseAccount.bo.*;
|
|
|
import com.goafanti.expenseAccount.service.ExpenseAccountService;
|
|
|
+import com.goafanti.expenseAccount.service.ExpenseConfigService;
|
|
|
import com.goafanti.organization.bo.OrganizationListOut;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
|
@@ -62,6 +63,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
private DepartmentService departmentService;
|
|
|
@Autowired
|
|
|
private DepartmentMapper departmentMapper;
|
|
|
+ @Autowired
|
|
|
+ private ExpenseConfigService expenseConfigService;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -136,24 +139,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if (StringUtils.isBlank(dep.getExpenseRetrialFinanceId()))throw new BusinessException("报销部门财务复审人不存在。");
|
|
|
eae.setAuditor(dep.getExpenseRetrialFinanceId());
|
|
|
eae.setAuditorname(dep.getExpenseRetrialFinanceName());
|
|
|
- }else if (i==6){
|
|
|
- List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
|
|
|
- for (Admin admin : admins) {
|
|
|
- eae.setAuditor(admin.getId());
|
|
|
- eae.setAuditorname(admin.getName());
|
|
|
- }
|
|
|
- }else if (i==7){
|
|
|
- List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.VICE_CEO);
|
|
|
- for (Admin admin : admins) {
|
|
|
- eae.setAuditor(admin.getId());
|
|
|
- eae.setAuditorname(admin.getName());
|
|
|
- }
|
|
|
- }else if (i==8){
|
|
|
- if (StringUtils.isBlank(dep.getCashierName()))throw new BusinessException("报销部门出纳不存在。");
|
|
|
- eae.setAuditor(dep.getCashierId());
|
|
|
- eae.setAuditorname(dep.getCashierName());
|
|
|
}
|
|
|
- if (i!=5){
|
|
|
+ if (StringUtils.isNotEmpty(eae.getAuditor())){
|
|
|
if (eae.getAuditor().equals(aid))eae.setStatus(1);
|
|
|
else eae.setStatus(0);
|
|
|
list.add(eae);
|
|
|
@@ -518,10 +505,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
newEa.setStatus(status);
|
|
|
newEa.setExamineName("");
|
|
|
}else {
|
|
|
- //添加后续流程
|
|
|
- if(newEa.getProcessStatus()==EAProcessStatus.CWSH.getCode()){
|
|
|
- addExpenseAccountExamineFollow(in);
|
|
|
- }
|
|
|
//新的流程是当前流程+1
|
|
|
newEa.setProcessStatus(useEa.getProcessStatus()+1);
|
|
|
if (newEa.getApproval()==null)newEa.setApproval(useEa.getApproval());
|
|
|
@@ -548,25 +531,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
addNoticeAndEmail(in, status,str.toString(),admin.getName(),aids);
|
|
|
}
|
|
|
|
|
|
- private void addExpenseAccountExamineFollow(InputExpenseAccount in) {
|
|
|
- Date date = new Date();
|
|
|
- if (in.getApproval()!=null&&in.getApproval()==1){
|
|
|
- List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION);
|
|
|
- List<ExpenseAccountExamine> list=new ArrayList<>();
|
|
|
- for (Admin admin:admins){
|
|
|
- ExpenseAccountExamine eae=new ExpenseAccountExamine(in.getId(),5);
|
|
|
- eae.setEaid(in.getId());
|
|
|
- eae.setCreateTime(date);
|
|
|
- eae.setStatus(0);
|
|
|
- eae.setAuditor(admin.getId());
|
|
|
- eae.setAuditorname(admin.getName());
|
|
|
- list.add(eae);
|
|
|
- }
|
|
|
- expenseAccountExamineMapper.insertBatch(list);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
*
|
|
|
* @param aid
|
|
|
@@ -609,24 +573,52 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
*/
|
|
|
private List<ExpenseAccountExamine> examineByprocess( ExpenseAccount newEa,AdminListBo admin) {
|
|
|
//在跳入董事长审核的时候非特批直接跳过,原则上下个流程不可再跳过
|
|
|
- if (newEa.getProcessStatus()==EAProcessStatus.DSZSH.getCode()&&newEa.getApproval()!=1){
|
|
|
+ boolean flag2= false;
|
|
|
+ Date date2=new Date();
|
|
|
+ date2.setTime(date2.getTime()+1000l);
|
|
|
+ String statusName="";
|
|
|
+ if (newEa.getProcessStatus()==EAProcessStatus.DSZSH.getCode()){
|
|
|
+ if (newEa.getApproval()!=1){
|
|
|
+ newEa.setProcessStatus(newEa.getProcessStatus()+1);
|
|
|
+ flag2=true;
|
|
|
+ statusName="特批(财务选择)";
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ newEa.setProcessStatus(newEa.getProcessStatus()+1);
|
|
|
+ flag2=true;
|
|
|
+ statusName=EAProcessStatus.DSZSH.getDesc();
|
|
|
+ }
|
|
|
+ if (newEa.getProcessStatus()==EAProcessStatus.CWGGLYSH.getCode()){
|
|
|
newEa.setProcessStatus(newEa.getProcessStatus()+1);
|
|
|
+ flag2=true;
|
|
|
+ statusName=EAProcessStatus.CWGGLYSH.getDesc();
|
|
|
+ }
|
|
|
+ if (newEa.getProcessStatus()==EAProcessStatus.GSFSSH.getCode()){
|
|
|
+ newEa.setProcessStatus(newEa.getProcessStatus()+1);
|
|
|
+ flag2=true;
|
|
|
+ statusName=EAProcessStatus.GSFSSH.getDesc();
|
|
|
+ }
|
|
|
+ if (flag2){
|
|
|
+ addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),"1",String.format("未设置[%s]审核,跳过此流程"),date2);
|
|
|
}
|
|
|
//获取当前流程审核人,如果有已审核则跳过当前审核
|
|
|
List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), newEa.getProcessStatus());
|
|
|
boolean flag=false;
|
|
|
String aid="";
|
|
|
- for (ExpenseAccountExamine e : list) {
|
|
|
- if (e.getStatus()==1){
|
|
|
- flag=true;
|
|
|
- aid=e.getAuditor();
|
|
|
- break;
|
|
|
- }
|
|
|
- if(e.getAuditor().equals(newEa.getAid())){
|
|
|
- flag=true;
|
|
|
- break;
|
|
|
+ if (list.size()>0){
|
|
|
+ for (ExpenseAccountExamine e : list) {
|
|
|
+ if (e.getStatus()==1){
|
|
|
+ flag=true;
|
|
|
+ aid=e.getAuditor();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(e.getAuditor().equals(newEa.getAid())){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ //如果当前审核人已经审核,则跳过当前审核
|
|
|
if (flag&&newEa.getProcessStatus()<6){
|
|
|
String str=String.format("重复审核人跳过[%s]。",EAProcessStatus.getDesc(newEa.getProcessStatus()));
|
|
|
Date date=new Date();
|