计划异常待办事项

master
赵嘉伟 4 years ago
parent ce7a606266
commit ab2daab203

@ -133,8 +133,8 @@ public class AbnormalPlanController {
return R.ok(abnormalPlanService.findAbnormalPlan(abnormalPlanDto));
}
@GetMapping("/processes")
public R processes(List<AbnormalPlan> abnormalPlanList){
@PostMapping("/processes")
public R processes(@RequestBody List<AbnormalPlan> abnormalPlanList){
abnormalPlanService.processes(abnormalPlanList);
return R.ok();
}

@ -889,8 +889,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
case Constants.CANCEL://取消
abnormalMessage.setSendUserGroup(abnormalBill.getCancelSendUserGroup());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_CANCEL);
//异常取消的时候要关闭当前异常单下所有的异常信息
UpdateWrapper<Message> messageTypeUpdateWrapper = new UpdateWrapper<>();
// messageTypeUpdateWrapper.eq("SITE",site);
@ -903,6 +901,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
messageService.update(abnormalMessage2,messageTypeUpdateWrapper);
break;
case Constants.SHUT_DOWN:
abnormalMessage.setSendUser(abnormalBillDispose.getResolveSendUser());
abnormalMessage.setNode(Constants.ABNORMAL_MESSAGE_PROGRAM_CONFIRM);
break;
}

@ -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);
}
}

@ -553,7 +553,8 @@
<select id="findAbnormalPlan" resultMap="abnormalPlanDto">
SELECT ZAP.ABNORMAL_NO ABNORMAL_NO ,ZAP.ABNORMAL_METHOD ABNORMAL_METHOD ,
ZAP.SHOP_ORDER SHOP_ORDER ,R.DESCRIPTION RESRCE_DESCRIPTION,ZAP.STATUS STATUS ,
IT.DESCRIPTION ITEM_DESCRIPTION,ZAP.QTY QTY ,ZNU.FULL_NAME FULL_NAME
IT.DESCRIPTION ITEM_DESCRIPTION,ZAP.QTY QTY ,ZNU.FULL_NAME FULL_NAME,
ZAP.SEND_USER_GROUP SEND_USER_GROUP
FROM Z_ABNORMAL_PLAN ZAP
LEFT JOIN RESRCE R ON R.RESRCE = ZAP.RESRCE AND R.SITE = ZAP.SITE
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = ZAP.ITEM_BO AND IT.LOCALE = #{locale}

Loading…
Cancel
Save