|
|
@@ -1235,66 +1235,93 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
TOrderPublicReleaseCount in =new TOrderPublicReleaseCount();
|
|
|
TOrderPublicReleaseCount use = tOrderPublicReleaseCountMapper.selectByOrderNo(orderNo);
|
|
|
in.setOrderNo(orderNo);
|
|
|
- Integer examine =null;
|
|
|
- int process =0;
|
|
|
- if (TokenManager.hasRole(AFTConstants.TECH_ADMIN)&&TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)){
|
|
|
- process=4;
|
|
|
- examine=0;
|
|
|
- }else if (TokenManager.hasRole(AFTConstants.TECH_ADMIN)){
|
|
|
- if (use.getMaxProcess()!=1){
|
|
|
- throw new BusinessException("审核人错误,必须是技术管理员才能审核。");
|
|
|
- }
|
|
|
- examine=1;
|
|
|
- process=2;
|
|
|
- }else if (TokenManager.hasRole(AFTConstants.FINANCE_ADMIN)){
|
|
|
- if (use.getMaxProcess()!=2){
|
|
|
- throw new BusinessException("审核人错误,必须是财务管理员才能审核。");
|
|
|
- }
|
|
|
- examine=2;
|
|
|
- process=4;
|
|
|
- }else {
|
|
|
- throw new BusinessException("审核人错误,必须是技术/财务管理员才能审核。");
|
|
|
- }
|
|
|
+ PublicConfig publicConfig = publicConfigMapper.queryById(1);
|
|
|
TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(orderNo);
|
|
|
- StringBuilder str=new StringBuilder();
|
|
|
- str.append("合同编号[").append(order.getContractNo()).append("]最大公出限制审核");
|
|
|
- if(status==1){
|
|
|
- in.setMaxProcess(process);
|
|
|
- if (examine==0){
|
|
|
- addOrderPublicReleaseLog(orderNo,status,1,remarks);
|
|
|
- addOrderPublicReleaseLog(orderNo,status,2,"相同审核人自动跳过。");
|
|
|
- pushCompleteMaxDuration(orderNo);
|
|
|
- str.append("已通过。");
|
|
|
- addNoticeAndEmail(order.getSalesmanId(),NoticeStatus.PUBLIC_MAX_DURATION_YES.getCode(), str.toString());
|
|
|
- }else if (examine==1){
|
|
|
- addOrderPublicReleaseLog(orderNo,status,1,remarks);
|
|
|
- if (examine==1){
|
|
|
- List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
|
|
|
- str.append("需要审核,请尽快审核。");
|
|
|
- admins.forEach(e->{
|
|
|
- addNoticeAndEmail(e.getId(),NoticeStatus.PUBLIC_MAX_DURATION_YES.getCode(), str.toString());
|
|
|
- });
|
|
|
- pushCompleteMaxDuration(orderNo);
|
|
|
+ in.setMaxProcess(use.getMaxProcess());
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
+ if (use.getMaxProcess()==1){
|
|
|
+ if (publicConfig.getTechAuditorStauts()==1&&TokenManager.getAdminId().equals(publicConfig.getTechAuditor())) {
|
|
|
+ addOrderPublicReleaseLog(orderNo,status,1,remarks);
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("审核人错误,必须是设置的审核人员才能审核。");
|
|
|
}
|
|
|
- }else if (examine==2){
|
|
|
+ }else if (use.getMaxProcess()==2){
|
|
|
+ if (publicConfig.getFinanceAuditorStauts()==1&&TokenManager.getAdminId().equals(publicConfig.getFinanceAuditor())) {
|
|
|
addOrderPublicReleaseLog(orderNo,status,2,remarks);
|
|
|
- pushCompleteMaxDuration(orderNo);
|
|
|
- str.append("已通过。");
|
|
|
- addNoticeAndEmail(order.getSalesmanId(),NoticeStatus.PUBLIC_MAX_DURATION_YES.getCode(), str.toString());
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("审核人错误,必须是设置的审核人员才能审核。");
|
|
|
}
|
|
|
- }else if(status==2){
|
|
|
- in.setMaxProcess(3);
|
|
|
- str.append("已驳回。");
|
|
|
- addNoticeAndEmail(order.getSalesmanId(),NoticeStatus.PUBLIC_MAX_DURATION_REJECT.getCode(), str.toString());
|
|
|
+ }else if (use.getMaxProcess()==3){
|
|
|
+ if (publicConfig.getOtherAuditorStauts()==1&&TokenManager.getAdminId().equals(publicConfig.getOtherAuditor())) {
|
|
|
+ addOrderPublicReleaseLog(orderNo,status,3,remarks);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("审核人错误,必须是设置的审核人员才能审核。");
|
|
|
+ }
|
|
|
}
|
|
|
+ pushPublicConfigSendNoticeAndEmail(publicConfig, in, aid, order, status);
|
|
|
return tOrderPublicReleaseCountMapper.updateByOrderNo(in);
|
|
|
}
|
|
|
|
|
|
+ private void pushPublicConfigSendNoticeAndEmail(PublicConfig publicConfig, TOrderPublicReleaseCount in, String aid, TOrderNewBo order,Integer status) {
|
|
|
+ StringBuilder str=new StringBuilder();
|
|
|
+ str.append("合同编号[").append(order.getContractNo()).append("]最大公出限制审核");
|
|
|
+ int noticeStatus=0;
|
|
|
+ if (status==1){
|
|
|
+ noticeStatus=NoticeStatus.PUBLIC_MAX_DURATION_YES.getCode();
|
|
|
+ }else if (status==2){
|
|
|
+ noticeStatus=NoticeStatus.PUBLIC_MAX_DURATION_NO.getCode();
|
|
|
+ }
|
|
|
+ //处理当前审核状态确定发送人
|
|
|
+ pushPublicConfig(publicConfig, in);
|
|
|
+ String str1="需要审核,请尽快审核。";
|
|
|
+ if (in.getMaxProcess()==2){
|
|
|
+ aid = publicConfig.getFinanceAuditor();
|
|
|
+ } else if (in.getMaxProcess()==3){
|
|
|
+ aid = publicConfig.getOtherAuditor();
|
|
|
+ }
|
|
|
+ else if (in.getMaxProcess()==5){
|
|
|
+ str1="审核通过。";
|
|
|
+ aid = order.getSalesmanId();
|
|
|
+ }
|
|
|
+ str.append(str1);
|
|
|
+ addNoticeAndEmail(aid, noticeStatus, str.toString());
|
|
|
+ if (in.getMaxProcess()==5){
|
|
|
+ pushCompleteMaxDuration( in.getOrderNo());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushPublicConfig(PublicConfig config, TOrderPublicReleaseCount in) {
|
|
|
+ if (in.getMaxProcess()==1){
|
|
|
+ if (config.getFinanceAuditorStauts()==0){
|
|
|
+ if (config.getOtherAuditorStauts()==0){
|
|
|
+ in.setMaxProcess(5);
|
|
|
+ }else {
|
|
|
+ in.setMaxProcess(3);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ in.setMaxProcess(2);
|
|
|
+ }
|
|
|
+ }else if (in.getMaxProcess()==2){
|
|
|
+ if (config.getOtherAuditorStauts()==0){
|
|
|
+ in.setMaxProcess(5);
|
|
|
+ }else {
|
|
|
+ in.setMaxProcess(3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Object maxDurationLog(String orderNo) {
|
|
|
return orderPublicReleaseLogMapper.queryByOrderNo(orderNo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Object updatePublicConfig(PublicConfig in) {
|
|
|
+ in.setId(1);
|
|
|
+ return publicConfigMapper.update(in);
|
|
|
+ }
|
|
|
+
|
|
|
private void pushCompleteMaxDuration(String orderNo) {
|
|
|
List<OrderPublicReleaseLog> orderPublicReleaseLogs = orderPublicReleaseLogMapper.queryByOrderNo(orderNo);
|
|
|
List<PublicRelease> publicReleases = publicReleaseMapper.selectByOrderNo(orderNo);
|
|
|
@@ -1318,6 +1345,7 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
|
|
|
newP.setId(e.getId());
|
|
|
newP.setStatus(2);
|
|
|
addpublicLog(e.getId(),2,"公出审核人已经审核最大公出小时,跳过审核");
|
|
|
+ addNoticeAndEmail(e.getAid(), NoticeStatus.PUBLIC_RELEASE_YES.getCode(), "公出审核人已经审核最大公出小时,跳过审核");
|
|
|
publicReleaseMapper.update(e);
|
|
|
}
|
|
|
}
|