|
|
@@ -94,7 +94,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if (a.getSuperId()!=null){
|
|
|
eae.setAuditor(a.getSuperId());
|
|
|
eae.setAuditorname(a.getSuperName());
|
|
|
- list.add(eae);
|
|
|
}else {
|
|
|
eae.setAuditor(a.getId());
|
|
|
eae.setAuditorname(a.getName());
|
|
|
@@ -154,18 +153,42 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}
|
|
|
|
|
|
private void addExpenseAccountLogAndNoticEmail(InputExpenseAccount in, Integer status, String str) {
|
|
|
- Date date=new Date();
|
|
|
String aid=TokenManager.getAdminId();
|
|
|
addExpenseAccountLog(in.getId(),status,aid,str);
|
|
|
- //日志写入用操作人,邮箱、微信订阅与站内信要的是发送方消息,即收件人
|
|
|
- AdminNoticeBo an = adminMapper.selectMyAndSuperBySuperId(aid);
|
|
|
- StringBuffer sb =new StringBuffer();
|
|
|
- if (status>0){
|
|
|
- in.setExamineName(an.getSuperName());
|
|
|
- sb=sb.append("[").append(an.getName()).append("]").append(str).append(",请及时审核。");
|
|
|
- asyncUtils.addNoticAndEmail(NoticeStatus.EXPENSE_NOTICE.getCode(), an.getSuperId(),sb.toString());
|
|
|
- weChatUtils.addExpenseAccountWeChatNotice(an.getExpenseOpenId(), 1, in.getId(), date, an.getName(),sb.toString());
|
|
|
+ //正常是走入上级审核,但是可能会跳过
|
|
|
+ if(status>0){
|
|
|
+ createExamineByProcess(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void createExamineByProcess(InputExpenseAccount in) {
|
|
|
+ //审核流程推送到最新
|
|
|
+ examineByprocess(in);
|
|
|
+ List<Admin> aids=new ArrayList<>();
|
|
|
+ AdminListBo admin = adminMapper.getDeptNameByAid(in.getAid());
|
|
|
+ if(in.getProcessStatus()== EAProcessStatus.SJSH.getCode()){
|
|
|
+ //获取上级
|
|
|
+ Admin superAdmin = adminMapper.selectByPrimaryKey(admin.getId());
|
|
|
+ aids.add(superAdmin);
|
|
|
+ in.setUserNames(superAdmin.getName());
|
|
|
+ }else if (in.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
+ //获取财务负责人
|
|
|
+ Admin finaceAdmin = adminMapper.selectByPrimaryKey(admin.getDepFinance());
|
|
|
+ aids.add(finaceAdmin);
|
|
|
+ in.setExamineName(finaceAdmin.getName());
|
|
|
+ }else if (in.getProcessStatus()== EAProcessStatus.ZJLSH.getCode()){
|
|
|
+ //获取部门负责人
|
|
|
+ List<Admin> list = adminMapper.listAdminBydepIdAndRoleType(admin.getDepartmentId(), AFTConstants.SALESMAN_ADMIN);
|
|
|
+ if (!list.isEmpty())aids.addAll(list);
|
|
|
+ in.setExamineName(getAdmins(list));
|
|
|
+ }else if (in.getProcessStatus()== EAProcessStatus.ZJLSH.getCode()){
|
|
|
+ //获取总裁、董事长等审核
|
|
|
+ List<Admin> list = adminMapper.selectAdminByRoleType(AFTConstants.All_CED_AND_CHAIRMAN);
|
|
|
+ if (!list.isEmpty())aids.addAll(list);
|
|
|
+ in.setExamineName(getAdmins(list));
|
|
|
}
|
|
|
+ StringBuffer str=new StringBuffer().append("您有报销需要审核,").append("报销编号[").append(in.getId()).append("]").append(",请查看并审核。");
|
|
|
+ addLogAndNoticeAndEmail(in, 1,str.toString(), admin.getName(),aids);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -311,10 +334,20 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //审核处理审核表
|
|
|
+ pushExpenseAccountExamine(in);
|
|
|
expenseAccountMapper.updateByPrimaryKeySelective(newEa);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+ private void pushExpenseAccountExamine(InputExpenseAccount in) {
|
|
|
+ if (in.getStatus()==2){
|
|
|
+ expenseAccountExamineMapper.updateStatusByEaidAndAid(in.getId(),TokenManager.getAdminId(),1);
|
|
|
+ }else if (in.getStatus()==3){
|
|
|
+ expenseAccountExamineMapper.updateStatusByEaidAndAid(in.getId(),null,0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void addExamineExpenseAccountLog(InputExpenseAccount in, ExpenseAccount useEa, ExpenseAccount newEa) {
|
|
|
List<Admin> aids=new ArrayList<>();
|
|
|
StringBuffer str=new StringBuffer();
|
|
|
@@ -322,6 +355,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
AdminListBo admin = adminMapper.getDeptNameByAid(useEa.getAid());
|
|
|
if (status==1){
|
|
|
str=str.append("您有报销需要审核,").append("报销编号[").append(in.getId()).append("]").append(",请查看并审核。");
|
|
|
+ pushExamineProcess(newEa);
|
|
|
if(useEa.getProcessStatus()== EAProcessStatus.FQ.getCode()){
|
|
|
//获取上级
|
|
|
Admin superAdmin = adminMapper.selectByPrimaryKey(admin.getSuperiorId());
|
|
|
@@ -365,6 +399,31 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
addLogAndNoticeAndEmail(in, status,str.toString(),admin.getName(),aids);
|
|
|
}
|
|
|
|
|
|
+ private void pushExamineProcess( ExpenseAccount newEa) {
|
|
|
+ //如果到了董事长审核,无需判断了
|
|
|
+ if (newEa.getProcessStatus()<EAProcessStatus.DSZSH.getCode()){
|
|
|
+ //判断没一个流程是否可以跳过
|
|
|
+ examineByprocess(newEa);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void examineByprocess( ExpenseAccount newEa) {
|
|
|
+ List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndType(newEa.getId(), newEa.getProcessStatus());
|
|
|
+ boolean flag=false;
|
|
|
+ for (ExpenseAccountExamine e : list) {
|
|
|
+ if (e.getStatus()==1){
|
|
|
+ flag=true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ addExpenseAccountLog(newEa.getId(),1,null,"重复审核人跳过当前审核。");
|
|
|
+ newEa.setProcessStatus(newEa.getProcessStatus()+1);
|
|
|
+ if (newEa.getProcessStatus()<5)examineByprocess(newEa);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private String getAdmins(List<Admin> list) {
|
|
|
StringBuffer str =new StringBuffer();
|
|
|
for (Admin admin : list) {
|