|
|
@@ -68,7 +68,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
Integer eaaid = expenseAccountPrivateMapper.selectByaidDefault(in.getAid());
|
|
|
in.setEaaid(eaaid);
|
|
|
expenseAccountMapper.insertSelective(in);
|
|
|
- addExpenseAccountLog(in.getId(),0,"创建报销");
|
|
|
+ addExpenseAccountLogAndNoticEmail(in.getId(),0,"创建报销");
|
|
|
return in.getId();
|
|
|
}
|
|
|
|
|
|
@@ -78,25 +78,28 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
* @param status 状态 0创建 1发起 2通过 3驳回 4修改
|
|
|
* @param str 备注
|
|
|
*/
|
|
|
- private void addExpenseAccountLog(Integer eaid, Integer status, String str) {
|
|
|
- String aid=TokenManager.getAdminId();
|
|
|
- Date date=new Date();
|
|
|
+ private void addExpenseAccountLog(Integer eaid, Integer status,String aid, String str) {
|
|
|
+ if (aid==null)aid=TokenManager.getAdminId();
|
|
|
ExpenseAccountLog eaLog=new ExpenseAccountLog();
|
|
|
eaLog.setEaid(eaid);
|
|
|
eaLog.setStatus(status);
|
|
|
eaLog.setRemarks(str);
|
|
|
eaLog.setAuditor(aid);
|
|
|
- //日志写入用操作人,邮箱、微信订阅与站内信要的是发送方消息,即收件人
|
|
|
+ expenseAccountLogMapper.insertSelective(eaLog);
|
|
|
+ }
|
|
|
|
|
|
+ private void addExpenseAccountLogAndNoticEmail(Integer eaid, Integer status, String str) {
|
|
|
+ Date date=new Date();
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
+ addExpenseAccountLog(eaid,status,aid,str);
|
|
|
+ //日志写入用操作人,邮箱、微信订阅与站内信要的是发送方消息,即收件人
|
|
|
AdminNoticeBo an = adminMapper.selectMyAndSuperBySuperId(aid);
|
|
|
-
|
|
|
StringBuffer sb =new StringBuffer();
|
|
|
if (status>0){
|
|
|
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, eaid, date, an.getName(),sb.toString());
|
|
|
}
|
|
|
- expenseAccountLogMapper.insertSelective(eaLog);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -112,14 +115,12 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
if(in.getStatus()==1){
|
|
|
in.setProcessStatus(1);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
//计算总金额
|
|
|
in.setTotalAmount(expenseAccountDetailsMapper.selectAmountCountByEAid(in.getId()));
|
|
|
if (useEA.getStatus()==0){
|
|
|
- addExpenseAccountLog(useEA.getId(),1,"发起报销审核");
|
|
|
+ addExpenseAccountLogAndNoticEmail(useEA.getId(),1,"发起报销审核");
|
|
|
}else if (useEA.getStatus()==3){
|
|
|
- addExpenseAccountLog(useEA.getId(),4,"修改并发起审核");
|
|
|
+ addExpenseAccountLogAndNoticEmail(useEA.getId(),4,"修改并发起审核");
|
|
|
}
|
|
|
return expenseAccountMapper.updateByPrimaryKeySelective(in);
|
|
|
}
|
|
|
@@ -157,7 +158,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
ExpenseAccount newEa=new ExpenseAccount();
|
|
|
newEa.setId(useEa.getId());
|
|
|
if (useEa.getStatus()==0)throw new BusinessException("审核状态错误");
|
|
|
- if (useEa.getProcessStatus()!=in.getProcessStatus())throw new BusinessException("审核流程错误");
|
|
|
+ if (useEa.getProcessStatus()!=in.getProcessStatus())throw new BusinessException(String.format("审核流程错误use=%s",useEa.getProcessStatus()));
|
|
|
//审核通知 获取发送人
|
|
|
addExamineExpenseAccountLog(in, useEa, newEa, in.getStatus());
|
|
|
expenseAccountMapper.updateByPrimaryKeySelective(newEa);
|
|
|
@@ -169,44 +170,43 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
StringBuffer str=new StringBuffer();
|
|
|
AdminListBo admin = adminMapper.getDeptNameByAid(useEa.getAid());
|
|
|
if (status==1){
|
|
|
- str=str.append("您有报销需要审核,请查看并审核。");
|
|
|
+ str=str.append("您有报销需要审核,").append("报销编号[").append(in.getId()).append("]").append("请查看并审核。");
|
|
|
if(useEa.getProcessStatus()== EAProcessStatus.FQ.getCode()){
|
|
|
//获取上级
|
|
|
aids.add(adminMapper.selectByPrimaryKey(admin.getSuperiorId()));
|
|
|
newEa.setProcessStatus(EAProcessStatus.SJSH.getCode());
|
|
|
|
|
|
}else if (useEa.getProcessStatus()== EAProcessStatus.SJSH.getCode()){
|
|
|
- //获取负责人
|
|
|
+ //获取财务负责人
|
|
|
+ aids.add(adminMapper.selectByPrimaryKey(admin.getDepFinance()));
|
|
|
+ newEa.setProcessStatus(EAProcessStatus.CWSH.getCode());
|
|
|
+ }else if (useEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
+ //获取部门负责人
|
|
|
List<Admin> list = adminMapper.listAdminBydepIdAndRoleType(admin.getId(), admin.getDepartmentId());
|
|
|
if (!list.isEmpty())aids.addAll(list);
|
|
|
newEa.setProcessStatus(EAProcessStatus.ZJLSH.getCode());
|
|
|
}else if (useEa.getProcessStatus()== EAProcessStatus.ZJLSH.getCode()){
|
|
|
- //获取负责人
|
|
|
- aids.add(adminMapper.selectByPrimaryKey(admin.getDepFinance()));
|
|
|
- newEa.setProcessStatus(EAProcessStatus.CWSH.getCode());
|
|
|
- }else if (useEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
|
|
|
- //获取负责人
|
|
|
+ //获取总裁、董事长等审核
|
|
|
List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.All_CED_AND_CHAIRMAN);
|
|
|
if (!admins.isEmpty())aids.addAll(admins);
|
|
|
newEa.setProcessStatus(EAProcessStatus.DSZSH.getCode());
|
|
|
}else if (useEa.getProcessStatus()== EAProcessStatus.DSZSH.getCode()){
|
|
|
- //获取负责人
|
|
|
+ //获取报销申请人
|
|
|
status =2;
|
|
|
aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
|
|
|
newEa.setStatus(status);
|
|
|
- str=new StringBuffer("您的报销审核已通过,请注意查看。");
|
|
|
+ str= str.append("您的报销审核已通过,请注意查看。");
|
|
|
}
|
|
|
}else {
|
|
|
aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
|
|
|
str=new StringBuffer("您的报销审核已驳回,请注意查看。");
|
|
|
}
|
|
|
-
|
|
|
addLogAndNoticeAndEmail(in, status,str.toString(),admin.getName(),aids);
|
|
|
}
|
|
|
|
|
|
private void addLogAndNoticeAndEmail(InputExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
|
|
|
-
|
|
|
Date date= new Date();
|
|
|
+ addExpenseAccountLog(in.getId(),status,null,in.getReason());
|
|
|
Integer noticeStatus=NoticeStatus.EXPENSE_NOTICE.getCode();
|
|
|
if (status==2){
|
|
|
noticeStatus=NoticeStatus.EXPENSE_COMPLETE.getCode();
|
|
|
@@ -264,13 +264,13 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
|
|
|
Integer processStatus=in.getProcessStatus();
|
|
|
//默认自己 设置上级,判断管理员与总裁等顶级审核
|
|
|
if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
|
|
|
- processStatus=1;
|
|
|
+ processStatus=3;
|
|
|
List<String> list = departmentService.selectMyDeps();
|
|
|
param.put("deps",list);
|
|
|
}else if (TokenManager.hasRole(AFTConstants.FINANCE)){
|
|
|
processStatus=2;
|
|
|
}else if (checkShiroCED()){
|
|
|
- processStatus=3;
|
|
|
+ processStatus=4;
|
|
|
}
|
|
|
param.put("processStatus",processStatus);
|
|
|
}else {
|