|
|
|
@ -5,19 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.dto.AbnormalPlanDto;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.mapper.AbnormalPlanMapper;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.model.AbnormalPlan;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.AbnormalPlanService;
|
|
|
|
|
import com.foreverwin.mesnac.common.constant.Constants;
|
|
|
|
|
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.mapper.MessageMapper;
|
|
|
|
|
import com.foreverwin.mesnac.common.model.Message;
|
|
|
|
|
import com.foreverwin.mesnac.common.service.MessageService;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.NwaUser;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.NwaUserService;
|
|
|
|
|
import com.foreverwin.modular.core.exception.BaseException;
|
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
|
import com.foreverwin.modular.core.util.FrontPage;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -27,7 +29,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
@ -57,6 +58,15 @@ public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, Abn
|
|
|
|
|
@Autowired
|
|
|
|
|
private ActiveMQUtil activeMQUtil;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AbnormalBillService abnormalBillService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AbnormalBillMapper abnormalBillMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private AbnormalBillDisposeMapper abnormalBillDisposeMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<AbnormalPlan> selectPage(FrontPage<AbnormalPlan> frontPage, AbnormalPlan abnormalPlan) {
|
|
|
|
@ -129,44 +139,23 @@ public class AbnormalPlanServiceImpl extends ServiceImpl<AbnormalPlanMapper, Abn
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
|
for (AbnormalPlan abnormalPlan : abnormalPlanList){
|
|
|
|
|
Message message = new Message();
|
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
|
message.setHandle(uuid);
|
|
|
|
|
message.setSite(site);
|
|
|
|
|
message.setObjectBo(HandleEnum.ABNORMAL_PLAN.getHandle(site,abnormalPlan.getAbnormalNo()));
|
|
|
|
|
message.setMessageType(Constants.ABNORMAL_MESSAGE_PLAN);
|
|
|
|
|
|
|
|
|
|
//设置消息格式content,没做
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.setSendUserGroup(abnormalPlan.getSendUserGroup());
|
|
|
|
|
message.setGrade(Double.parseDouble("1.0"));
|
|
|
|
|
message.setResponseDateTime(now);
|
|
|
|
|
message.setNode("PLAN");
|
|
|
|
|
//设置为Y,则不进入计时器
|
|
|
|
|
message.setStatus("Y");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.setCreatedUser(user);
|
|
|
|
|
message.setCreatedDateTime(now);
|
|
|
|
|
message.setModifiedUser(user);
|
|
|
|
|
message.setModifiedDateTime(now);
|
|
|
|
|
|
|
|
|
|
AbnormalBill abnormalBill = abnormalBillMapper.selectById(HandleEnum.ABNORMAL_BILL.getHandle(site, abnormalPlan.getAbnormalNo()));
|
|
|
|
|
AbnormalBillDispose abnormalBillDispose = abnormalBillDisposeMapper.selectById(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site, abnormalPlan.getAbnormalNo()));
|
|
|
|
|
//发送消息
|
|
|
|
|
List<NwaUser> nwaUsers = nwaUserService.checkUserGroup(site,message.getSendUserGroup());
|
|
|
|
|
StringBuilder sendUsers = new StringBuilder();
|
|
|
|
|
for (int i = 0; i < nwaUsers.size(); i++) {
|
|
|
|
|
if(i == (nwaUsers.size() - 1)){
|
|
|
|
|
sendUsers.append(nwaUsers.get(i));
|
|
|
|
|
}else{
|
|
|
|
|
sendUsers.append(nwaUsers.get(i)).append("|");
|
|
|
|
|
}
|
|
|
|
|
abnormalBillService.anomalyCreatedAndSendMessage(abnormalBill,abnormalBillDispose);
|
|
|
|
|
if(Constants.PROCESSED.equals(abnormalPlan.getStatus())){
|
|
|
|
|
throw new BaseException("异常单:"+abnormalPlan.getAbnormalNo()+"已经处理,不能再次处理");
|
|
|
|
|
}
|
|
|
|
|
activeMQUtil.wechatSendMessage(sendUsers.toString(),message.getContent());
|
|
|
|
|
//保存
|
|
|
|
|
messageService.saveOrUpdate(message);
|
|
|
|
|
//设置状态为已处理
|
|
|
|
|
abnormalPlan.setStatus(Constants.PROCESSED);
|
|
|
|
|
//设置处理人
|
|
|
|
|
abnormalPlan.setProcessor(user);
|
|
|
|
|
//设置发送时间
|
|
|
|
|
abnormalPlan.setSendDateTime(now);
|
|
|
|
|
//设置handle
|
|
|
|
|
abnormalPlan.setHandle(HandleEnum.ABNORMAL_PLAN.getHandle(site,abnormalPlan.getAbnormalNo()));
|
|
|
|
|
//更新
|
|
|
|
|
this.saveOrUpdate(abnormalPlan);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|