|
|
@@ -18,7 +18,9 @@ package org.springblade.check.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.client.entity.Message;
|
|
|
+import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IMessageClient;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.finance.feign.IFinanceClient;
|
|
|
@@ -45,6 +47,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
@@ -76,6 +79,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
|
|
|
private IOrderCheckClient orderCheckClient;
|
|
|
|
|
|
+ private ICorpsDescClient iCorpsDescClient;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<AuditProecessVO> selectAuditProecessPage(IPage<AuditProecessVO> page, AuditProecessVO auditProecess) {
|
|
|
return page.setRecords(baseMapper.selectAuditProecessPage(page, auditProecess));
|
|
|
@@ -116,6 +121,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
auditProecess.setBillNo(auditProecessDTO.getBillNo());
|
|
|
auditProecess.setSrcBillId(auditProecessDTO.getSrcBillId());
|
|
|
auditProecess.setPathId(e.getPathId());
|
|
|
+ auditProecess.setCorpId(auditProecessDTO.getCorpId());
|
|
|
auditProecess.setLevelId(e.getLevelId());
|
|
|
auditProecess.setProcessType(auditProecessDTO.getProcessType());
|
|
|
auditProecess.setPageLabel(auditProecessDTO.getPageLabel());
|
|
|
@@ -133,7 +139,28 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
//除了第一级是待审,其他都N
|
|
|
if(e.getLevelId()==1)
|
|
|
{
|
|
|
- //开启之后, 给第一级推送消息
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat();
|
|
|
+ String corpName=null;
|
|
|
+ if(auditProecessDTO.getCorpId()!=null)
|
|
|
+ {
|
|
|
+ R<CorpsDesc> corpMessage = iCorpsDescClient.getCorpMessage(auditProecessDTO.getCorpId());
|
|
|
+ if(corpMessage.isSuccess()&&corpMessage.getData()!=null)
|
|
|
+ {
|
|
|
+ corpName=corpMessage.getData().getCname();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String orderDate=null;
|
|
|
+ if(auditProecessDTO.getBillId()!=null)
|
|
|
+ {
|
|
|
+ Order order = orderDescClient.getById(auditProecessDTO.getBillId());
|
|
|
+ if(order!=null )
|
|
|
+ {
|
|
|
+
|
|
|
+ orderDate = simpleDateFormat.format(order.getCreateTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //开启之后, 给第一级推送消息
|
|
|
|
|
|
Message message=new Message();
|
|
|
message.setUserId(AuthUtil.getUserId());
|
|
|
@@ -141,7 +168,30 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
message.setToUserId(Long.valueOf(e.getAuditUserId()));
|
|
|
message.setMessageType(1);
|
|
|
message.setParameter(String.valueOf(auditProecessDTO.getBillId()));
|
|
|
- message.setMessageBody("你有新的审批待操作,请及时处理");
|
|
|
+ //不同的审批, 不同的模板
|
|
|
+ if(auditProecessDTO.getProcessType().equals("付费审批"))
|
|
|
+ {
|
|
|
+ message.setMessageBody("您有付费审核,公司名:"+corpName+","+"采购订单号:" +
|
|
|
+ ""+auditProecessDTO.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +" 提交人:"+auditProecessDTO.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecessDTO.getSendTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else if(auditProecessDTO.getProcessType().equals("销售审批"))
|
|
|
+ {
|
|
|
+ message.setMessageBody("您有销售审核,公司名:"+corpName+","+"销售订单号:" +
|
|
|
+ ""+auditProecessDTO.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +" 提交人:"+auditProecessDTO.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecessDTO.getSendTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else if(auditProecessDTO.getProcessType().equals("采购审批"))
|
|
|
+ {
|
|
|
+ message.setMessageBody("您有采购审核,公司名:"+corpName+","+"采购订单号:" +
|
|
|
+ ""+auditProecessDTO.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +" 提交人:"+auditProecessDTO.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecessDTO.getSendTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
message.setUrl("/approveData/index");
|
|
|
R save = messageClient.save(message);
|
|
|
if(!save.isSuccess())
|
|
|
@@ -264,6 +314,31 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
}
|
|
|
proecess.setAuditStatus("S");
|
|
|
baseMapper.updateById(proecess);
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat();
|
|
|
+ String corpName=null;
|
|
|
+ if(auditProecess1.getCorpId()!=null)
|
|
|
+ {
|
|
|
+ R<CorpsDesc> corpMessage = iCorpsDescClient.getCorpMessage(auditProecess1.getCorpId());
|
|
|
+ if(corpMessage.isSuccess()&&corpMessage.getData()!=null)
|
|
|
+ {
|
|
|
+ corpName=corpMessage.getData().getCname();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String orderDate=null;
|
|
|
+ if(auditProecess1.getBillId()!=null)
|
|
|
+ {
|
|
|
+ Order order = orderDescClient.getById(auditProecess1.getBillId());
|
|
|
+ if(order!=null )
|
|
|
+ {
|
|
|
+
|
|
|
+ orderDate = simpleDateFormat.format(order.getCreateTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Message message=new Message();
|
|
|
message.setUserName(AuthUtil.getUserName());
|
|
|
message.setUserId(AuthUtil.getUserId());
|
|
|
@@ -272,7 +347,12 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
message.setToUserId(Long.valueOf(proecess.getAuditUserId()));
|
|
|
message.setMessageType(1);
|
|
|
message.setTenantId(AuthUtil.getTenantId());
|
|
|
- message.setMessageBody("你有新的审批待操作,请及时处理");
|
|
|
+ //付费申请模板
|
|
|
+ message.setMessageBody("您有付费审核,公司名:"+corpName+","+"采购订单号:" +
|
|
|
+ ""+auditProecess1.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +"提交人:"+auditProecess1.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecess1.getSendTime())
|
|
|
+ );
|
|
|
+
|
|
|
message.setCreateUser(AuthUtil.getUserId());
|
|
|
message.setUrl("/approveData/index");
|
|
|
message.setCreateTime(new Date());
|
|
|
@@ -294,7 +374,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
throw new SecurityException("修改财务数据失败");
|
|
|
}
|
|
|
|
|
|
- sendMessage.setMessageBody("您的请核未通过,请查看原因");
|
|
|
+ sendMessage.setMessageBody("您的付费请核未通过"+",采购订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|
|
|
@@ -317,8 +397,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
throw new SecurityException("修改财务数据失败");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- sendMessage.setMessageBody("您的请核已通过,请继续操作");
|
|
|
+ sendMessage.setMessageBody("您的付费请核已通过"+",采购订单号:"+auditProecess1.getBillNo()+",请继续操作");
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|
|
|
@@ -335,7 +414,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
{
|
|
|
throw new SecurityException("修改财务数据失败");
|
|
|
}
|
|
|
- sendMessage.setMessageBody("您的请核未通过,请查看原因");
|
|
|
+ sendMessage.setMessageBody("您的付费请核未通过"+",采购订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|
|
|
@@ -623,6 +702,31 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
}
|
|
|
proecess.setAuditStatus("S");
|
|
|
baseMapper.updateById(proecess);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat();
|
|
|
+ String corpName=null;
|
|
|
+ if(auditProecess1.getCorpId()!=null)
|
|
|
+ {
|
|
|
+ R<CorpsDesc> corpMessage = iCorpsDescClient.getCorpMessage(auditProecess1.getCorpId());
|
|
|
+ if(corpMessage.isSuccess()&&corpMessage.getData()!=null)
|
|
|
+ {
|
|
|
+ corpName=corpMessage.getData().getCname();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String orderDate=null;
|
|
|
+ if(auditProecess1.getBillId()!=null)
|
|
|
+ {
|
|
|
+ Order order = orderDescClient.getById(auditProecess1.getBillId());
|
|
|
+ if(order!=null )
|
|
|
+ {
|
|
|
+
|
|
|
+ orderDate = simpleDateFormat.format(order.getCreateTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
Message message=new Message();
|
|
|
message.setParameter(String.valueOf(auditProecess.getBillId()));
|
|
|
message.setUserName(AuthUtil.getUserName());
|
|
|
@@ -631,7 +735,24 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
message.setToUserId(Long.valueOf(proecess.getAuditUserId()));
|
|
|
message.setMessageType(1);
|
|
|
message.setTenantId(AuthUtil.getTenantId());
|
|
|
- message.setMessageBody("你有新的审批待操作,请及时处理");
|
|
|
+
|
|
|
+ //判断模板类型
|
|
|
+ if(auditProecess1.getProcessType().equals("销售审批"))
|
|
|
+ {
|
|
|
+ message.setMessageBody("您有销售审核,公司名:"+corpName+","+"销售订单号:" +
|
|
|
+ ""+auditProecess1.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +"提交人:"+auditProecess1.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecess1.getSendTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ else if(auditProecess1.getProcessType().equals("采购审批"))
|
|
|
+ {
|
|
|
+ message.setMessageBody("您有采购审核,公司名:"+corpName+","+"采购订单号:" +
|
|
|
+ ""+auditProecess1.getBillNo()+","+"订单日期:"+orderDate+",请审核。"
|
|
|
+ +"提交人:"+auditProecess1.getSendName()+" "+"提交时间"+simpleDateFormat.format(auditProecess1.getSendTime())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
message.setCreateUser(AuthUtil.getUserId());
|
|
|
message.setUrl("/approveData/index");
|
|
|
message.setCreateTime(new Date());
|
|
|
@@ -653,7 +774,17 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
throw new SecurityException("修改财务数据失败");
|
|
|
}
|
|
|
|
|
|
- sendMessage.setMessageBody("您的请核未通过,请查看原因");
|
|
|
+ if(auditProecess1.getProcessType().equals("销售审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的销售请核未通过"+",销售订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
+ }
|
|
|
+ else if(auditProecess1.getProcessType().equals("采购审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的采购请核未通过"+",销售订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|
|
|
@@ -677,7 +808,14 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
}
|
|
|
|
|
|
|
|
|
- sendMessage.setMessageBody("您的请核已通过,请继续操作");
|
|
|
+ if(auditProecess1.getProcessType().equals("销售审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的销售请核已通过"+",销售订单号:"+auditProecess1.getBillNo()+",请继续操作");
|
|
|
+ }
|
|
|
+ else if(auditProecess1.getProcessType().equals("采购审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的采购请核已通过"+",销售订单号:"+auditProecess1.getBillNo()+",请继续操作");
|
|
|
+ }
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|
|
|
@@ -694,7 +832,14 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, A
|
|
|
{
|
|
|
throw new SecurityException("修改财务数据失败");
|
|
|
}
|
|
|
- sendMessage.setMessageBody("您的请核未通过,请查看原因");
|
|
|
+ if(auditProecess1.getProcessType().equals("销售审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的销售请核未通过"+",销售订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
+ }
|
|
|
+ else if(auditProecess1.getProcessType().equals("采购审批"))
|
|
|
+ {
|
|
|
+ sendMessage.setMessageBody("您的采购请核未通过"+",销售订单号:"+auditProecess1.getBillNo()+",请查看原因");
|
|
|
+ }
|
|
|
R save = messageClient.save(sendMessage);
|
|
|
if(!save.isSuccess())
|
|
|
{
|