提交 627ef7ab authored 作者: 133's avatar 133

1111

上级 fc1de5b9
......@@ -288,7 +288,7 @@ public class SendBackServiceImpl implements SendBackService {
HashMap<String,List<Integer>> locationUnitList = new HashMap<>();
HashMap<String,List<AbnormalDescribe>> desList = new HashMap<>();
StringBuffer xDevId = new StringBuffer();
for (DeviceLibrary deviceLibraryEntity : deviceLibraryEntitiesByIdIn) {
String locationUnit = deviceLibraryEntity.getLocationUnit();
......@@ -305,14 +305,24 @@ public class SendBackServiceImpl implements SendBackService {
}
unDeviceDesVos.add(map.get(deviceLibraryEntity.getId()));
desList.put(locationUnit,unDeviceDesVos);
xDevId.append("x").append(deviceLibraryEntity.getId());
}
TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill parentBillEntity = sendBackBillEntityDao.findById(parentTask.getBillId()).get();
parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes));
saveSendBackBill(parentBillEntity);
TaskBto exceptionParentTask=taskService.get(parentTask.getParentTaskId());
SendBackBill exceptionParentBillEntity = sendBackBillEntityDao.findById(exceptionParentTask.getBillId()).get();
if (exceptionParentBillEntity.getInvoleDevice().equals(xDevId.toString())){
taskService.moveToEnd(exceptionParentTask);
}
// if (xDevId.equals(parentBillEntity.getInvoleDevice())) {
// taskService.moveToEnd(parentTask);
// }
Set<String> locationKey = locationUnitList.keySet();
for (String location:locationKey) {
......@@ -404,9 +414,11 @@ public class SendBackServiceImpl implements SendBackService {
if (parentTaskBill.getInvoleDevice().equals("")){
taskService.moveToEnd(parentTask);
s(parentTask,parentTaskBill,idList);
Units units1 =unitsDao.findById(Integer.valueOf(parentTask.getCustomInfo())).get();
s1(parentTask,units1,idList);
}
}
// sendBackBillEntityDao.save(parentTaskBill);
saveSendBackBill(parentTaskBill);
......@@ -470,7 +482,7 @@ public class SendBackServiceImpl implements SendBackService {
}
sendBackOutVo.setDeviceLibraryEntities(deviceLibraries);
if (flag) {
Task exlTask = taskDao.findByParentTaskIdAndAndTitle(taskId, "异常装备描述");
Task exlTask = taskDao.findByParentTaskIdAndAndTitle(taskId, "异常装备描述");
sendBackOutVo.setExcTask(exlTask.getId());
}
return ResponseEntity.ok(sendBackOutVo);
......@@ -677,6 +689,59 @@ public class SendBackServiceImpl implements SendBackService {
}
}
/**
* 判断是否全部提交
* 全部提交把跟踪业务改为代办
*/
private void s1(TaskBto taskEntity,Units units,List<Integer> idList){
//父类task
TaskBto fatherTaskBto = taskService.get(taskEntity.getParentTaskId());;
SendBackBill fatherBill = sendBackBillEntityDao.findById(fatherTaskBto.getBillId()).get();
String send=fatherBill.getSendBackStatistical();
SendBackVo sendBackVo= JSONObject.parseObject(send,SendBackVo.class);
/*
将入库结果反馈给下级,由于两个task使用的是同一个账单,所以数据已反馈
*/
Area area= areaDao.findById(units.getAreaId()).get();
updateStatistical(idList,area.getName(),sendBackVo);
//查询当前task上级task
//查询当前task上级task所有子task
List<Task> taskList=taskDao.findAllByParentTaskId(fatherTaskBto.getId());
//判断对应的bill是否完成
List<Integer> integers=taskList.stream().map(Task::getBillId).collect(Collectors.toList());
boolean flag = sendBackBillEntityDao.findAllById(integers).stream().allMatch(e->e.getIsComplete()==1);
if (flag){
if (fatherTaskBto.getParentTaskId()!=null) {
taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1203, 0);
List<Integer> list=new ArrayList<>();
findInvoleDevice(fatherBill.getInvoleDevice()).forEach(deviceLibrary ->
{
if (!deviceLibrary.getLocationUnit().equals(deviceLibrary.getOwnUnit())){
list.add(deviceLibrary.getId());
}
}
);
if (list.size() != 0) {
addExceptionTask(fatherTaskBto.getId(), list, fatherTaskBto.getOwnUnit(), 0, fatherBill.getDeadLine());
}
}else {
sendBackVo.setStatus(0);
fatherBill.setSendBackStatistical(JSON.toJSONString(sendBackVo));
// sendBackBillEntityDao.save(fatherBill);
saveSendBackBill(fatherBill);
taskService.moveToSpecial(fatherTaskBto,StatusEnum.SEND_BACK_1201,fatherTaskBto.getCreateUserId());
}
}
}
private List<DeviceLibrary> findInvoleDevice(String involeDevice){
List<String> idStringList = Arrays.asList(involeDevice.split("x"));
......@@ -1638,18 +1703,18 @@ public class SendBackServiceImpl implements SendBackService {
/*
省级的业务详情
*/
kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getId()).stream().map(Task::parse2Bto).collect(Collectors.toList());
kidTask = taskDao.findTaskEntitiesByParentTaskIdAndAndBusinessType(taskBto.getId(),BusinessEnum.SEND_BACK.id).stream().map(Task::parse2Bto).collect(Collectors.toList());
kidTask.forEach(
taskBto1 -> {
qkidTask.addAll(taskDao.findTaskEntitiesByParentTaskId(taskBto.getId()).stream().map(Task::parse2Bto).collect(Collectors.toList()));
qkidTask.addAll(taskDao.findTaskEntitiesByParentTaskIdAndAndBusinessType(taskBto.getId(),BusinessEnum.SEND_BACK.id).stream().map(Task::parse2Bto).collect(Collectors.toList()));
}
);
}else if(unit.getLevel() == 2){
/*
市级的业务详情
*/
kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getId()).stream().map(Task::parse2Bto).collect(Collectors.toList());
kidTask = taskDao.findTaskEntitiesByParentTaskIdAndAndBusinessType(taskBto.getId(),BusinessEnum.SEND_BACK.id).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
/*
区域名和任务id的映射,方便进入下一级
......
......@@ -58,7 +58,7 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
@Query("select o.billId from Task o where o.parentTaskId = ?1 and o. businessType = ?2")
Integer findBillIdByParentId(int parentTaskId, int businessType);
List<Task> findTaskEntitiesByParentTaskId(Integer parentTaskId);
List<Task> findTaskEntitiesByParentTaskIdAndAndBusinessType(Integer parentTaskId,Integer businessType);
Task findByBusinessTypeAndOwnUnitAndBillStatus(Integer type, Integer ownUnit, Integer billStatus);
......
......@@ -14,6 +14,8 @@ import com.tykj.dev.device.train.entity.TrainUser;
import com.tykj.dev.device.train.entity.vo.*;
import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
......@@ -40,6 +42,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -80,6 +83,10 @@ public class TrainJobController {
@Autowired
BlockChainUtil blockChainUtil;
@Autowired
MessageService messageService;
// 发起培训给选中人员都发一个代办任务报名,此任务在发起人跟踪里
......@@ -113,7 +120,6 @@ public class TrainJobController {
trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(1);
trainUser.setTrainId(trainTheme.getTrainId());
// trainUserDao.save(trainUser);
saveTrainUser(trainUser);
}
);
......@@ -142,7 +148,16 @@ public class TrainJobController {
taskService.start(new TaskBto(StatusEnum.TRAIN1002.id, trainTheme.getName(), task.getId(), task.getId().toString(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id, unitId, 0, null, list));
}
);
if (securityUser.getCurrentUserInfo().getUnits().getLevel()==1){
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,securityUser.getUsername()+"发起培训",userIds));
}else {
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.remove(securityUser.getCurrentUserInfo().getUserId());
userIds.addAll(userService.findAllByUnite(1).stream().map(User::getUserId).collect(Collectors.toList()));
messageService.add(new MessageBto(task.getId(),BusinessEnum.TRAIN.id,securityUser.getUsername()+"发起培训",userIds));
}
myWebSocket.sendMessage1();
return ResponseEntity.ok(trainThemeService.save(trainTheme));
}
......@@ -194,6 +209,11 @@ public class TrainJobController {
// userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"不参加培训"));
// }
taskBto= taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1);
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.addAll(userService.findAllByUnite(trainTheme.getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()));
userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(taskBto.getId(),BusinessEnum.TRAIN.id,securityUser.getUsername()+"提交了培训名单",userIds));
myWebSocket.sendMessage1();
return ResponseEntity.ok(taskBto);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论