|
@@ -3,6 +3,7 @@ package org.jeecg.modules.oa.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -11,6 +12,7 @@ import org.jeecg.modules.oa.entity.IncidentTicketChildren;
|
|
|
import org.jeecg.modules.oa.entity.IncidentTicketMsg;
|
|
|
import org.jeecg.modules.oa.mapper.IncidentTicketChildrenMapper;
|
|
|
import org.jeecg.modules.oa.mapper.IncidentTicketMapper;
|
|
|
+import org.jeecg.modules.oa.mapper.IncidentTicketMsgMapper;
|
|
|
import org.jeecg.modules.oa.service.IIncidentTicketMsgService;
|
|
|
import org.jeecg.modules.oa.service.IIncidentTicketService;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -18,10 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.io.Serializable;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Collection;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 森_工厂质量事故单-主表
|
|
@@ -34,6 +33,9 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
|
|
|
@Autowired
|
|
|
private IncidentTicketMapper incidentTicketMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IncidentTicketMsgMapper incidentTicketMsgMapper;
|
|
|
@Autowired
|
|
|
private IncidentTicketChildrenMapper incidentTicketChildrenMapper;
|
|
|
@Autowired
|
|
@@ -44,12 +46,57 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public String noticeUser(String ids,String headId,String code,String title){
|
|
|
+ public Result<?> propelling(IncidentTicket incidentTicket){
|
|
|
+
|
|
|
+ if(!incidentTicket.getState().equals("3")){//1未处理 2已通知 3通知已反馈 4已推送 5已完结
|
|
|
+ return Result.error("此单据状态下无法推送");
|
|
|
+ }
|
|
|
+
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ //推送正文
|
|
|
+
|
|
|
+ String businessType = incidentTicket.getBusinessType();//业务类型
|
|
|
+ List<IncidentTicketChildren> childrenList = incidentTicketChildrenMapper.selectByMainId(incidentTicket.getId());
|
|
|
+
|
|
|
+ for (IncidentTicketChildren children:childrenList){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ incidentTicket.setState("4");
|
|
|
+ incidentTicket.setUpdateBy(sysUser.getUsername());
|
|
|
+ incidentTicket.setUpdateTime(new Date());
|
|
|
+ incidentTicketMapper.updateById(incidentTicket);
|
|
|
+ return Result.ok("已推送");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Result<?> noticeUser(String ids,String headId,String code,String title){
|
|
|
|
|
|
String[] idList = ids.split(",");
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
HashMap<String,Object> taskParam = new HashMap<>();
|
|
|
|
|
|
+ if(!sysUser.getUsername().equals("T0008")){
|
|
|
+ return Result.error("该功能仅方珂使用");
|
|
|
+ }
|
|
|
+
|
|
|
+// Map<String ,Object> map = new HashMap<>();
|
|
|
+// map.put("pk_incident_ticket",headId);
|
|
|
+// incidentTicketMsgMapper.deleteByMap(map);
|
|
|
+
|
|
|
for(String o:idList){
|
|
|
|
|
|
sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),o,"质量事故单",code+" "+title, CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
@@ -64,69 +111,74 @@ public class IncidentTicketServiceImpl extends ServiceImpl<IncidentTicketMapper,
|
|
|
|
|
|
IncidentTicket incidentTicketEntity = incidentTicketMapper.selectById(headId);
|
|
|
if(incidentTicketEntity==null) {
|
|
|
- return "未找到对应数据";
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
}
|
|
|
- incidentTicketEntity.setState("2");//1未处理 2已通知 3通知已反馈 4已推送 5已完结
|
|
|
-// incidentTicketEntity.setUpdateBy(sysUser.getUsername());
|
|
|
-// incidentTicketEntity.setUpdateTime(new Date());
|
|
|
-// incidentTicketMapper.updateById(incidentTicketEntity);
|
|
|
- this.save(incidentTicketEntity);
|
|
|
|
|
|
- return "已通知";
|
|
|
+ incidentTicketEntity.setState("2");//1未处理 2已通知 3通知已反馈 4已推送 5已完结
|
|
|
+ incidentTicketEntity.setUpdateBy(sysUser.getUsername());
|
|
|
+ incidentTicketEntity.setUpdateTime(new Date());
|
|
|
+ incidentTicketMapper.updateById(incidentTicketEntity);
|
|
|
+// this.save(incidentTicketEntity);
|
|
|
+ return Result.error("已通知");
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public String noticeUserReturn(String headId,String code,String title){
|
|
|
-
|
|
|
+ public Result<?> noticeUserReturn(String headId, String code, String title){
|
|
|
+ IncidentTicket incidentTicketEntity = incidentTicketMapper.selectById(headId);
|
|
|
+ if(StringUtils.isNotBlank(incidentTicketEntity.getState()) && !incidentTicketEntity.getState().equals("2")){
|
|
|
+ return Result.error("该单已反馈通知,无需重复操作");
|
|
|
+ }
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
LambdaQueryWrapper<IncidentTicketMsg> query = new LambdaQueryWrapper<IncidentTicketMsg>();
|
|
|
query.eq(IncidentTicketMsg::getPkIncidentTicket,headId);
|
|
|
List<IncidentTicketMsg> list = iIncidentTicketMsgService.list(query);
|
|
|
|
|
|
boolean isAuth = false;
|
|
|
- boolean isComplete = true;
|
|
|
+// boolean isComplete = true;
|
|
|
|
|
|
for (IncidentTicketMsg o:list){
|
|
|
String userId = o.getUserId();
|
|
|
|
|
|
if(userId.equals(sysUser.getUsername())){
|
|
|
if (StringUtils.isNotBlank(o.getConfirm()) && o.getConfirm().equals("已通知")){
|
|
|
- return "您已通知,请勿重新操作";
|
|
|
+ return Result.error("您已通知,请勿重新操作");
|
|
|
}
|
|
|
|
|
|
o.setConfirm("已通知");
|
|
|
- iIncidentTicketMsgService.save(o);
|
|
|
+ o.setUpdateBy(sysUser.getUsername());
|
|
|
+ o.setUpdateTime(new Date());
|
|
|
+ incidentTicketMsgMapper.updateById(o);
|
|
|
isAuth = true;
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(o.getConfirm()) || !o.getConfirm().equals("已通知")){
|
|
|
- isComplete = false;
|
|
|
- }
|
|
|
+// if (StringUtils.isBlank(o.getConfirm()) || !o.getConfirm().equals("已通知")){
|
|
|
+// isComplete = false;
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
if(!isAuth){
|
|
|
- return "您无权此操作此事故单";
|
|
|
+ return Result.error("您无权操作此事故单");
|
|
|
}
|
|
|
|
|
|
HashMap<String,Object> taskParam = new HashMap<>();
|
|
|
|
|
|
- sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),"T0008","质量事故单",code+" "+title, CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+ sysBaseAPI.sendSysAnnouncement(sysUser,sysUser.getUsername(),"T0008","质量事故单",code+" "+title+" 财务对单人已处理完毕;", CommonConstant.MSG_CATEGORY_2,taskParam);
|
|
|
+
|
|
|
+// if(isComplete){
|
|
|
|
|
|
- if(isComplete){
|
|
|
- IncidentTicket incidentTicketEntity = incidentTicketMapper.selectById(headId);
|
|
|
if(incidentTicketEntity==null) {
|
|
|
- return "未找到对应数据";
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
}
|
|
|
incidentTicketEntity.setState("3");//1未处理 2已通知 3通知已反馈 4已推送 5已完结
|
|
|
-// incidentTicketEntity.setUpdateBy(sysUser.getUsername());
|
|
|
-// incidentTicketEntity.setUpdateTime(new Date());
|
|
|
-// incidentTicketMapper.updateById(incidentTicketEntity);
|
|
|
- this.save(incidentTicketEntity);
|
|
|
- }
|
|
|
-
|
|
|
- return "已通知";
|
|
|
+ incidentTicketEntity.setUpdateBy(sysUser.getUsername());
|
|
|
+ incidentTicketEntity.setUpdateTime(new Date());
|
|
|
+ incidentTicketMapper.updateById(incidentTicketEntity);
|
|
|
+// this.save(incidentTicketEntity);
|
|
|
+// }
|
|
|
+ return Result.ok("已通知");
|
|
|
}
|
|
|
|
|
|
|