提交 88bba9df authored 作者: 133's avatar 133

[用户] [清退] [专管员统计] 代码提交

上级 25e4880c
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
...@@ -19,6 +20,8 @@ import com.tykj.dev.device.task.repository.TaskDao; ...@@ -19,6 +20,8 @@ import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task; import com.tykj.dev.device.task.subject.domin.Task;
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.AreaDao; import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao; import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.dao.UserDao; import com.tykj.dev.device.user.subject.dao.UserDao;
...@@ -77,6 +80,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -77,6 +80,8 @@ public class SendBackServiceImpl implements SendBackService {
@Autowired @Autowired
Snowflake snowflake; Snowflake snowflake;
@Autowired
MessageService messageService;
/** /**
* 添加设备 * 添加设备
* @param deviceIdList 待清退装备的id集合 * @param deviceIdList 待清退装备的id集合
...@@ -123,6 +128,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -123,6 +128,7 @@ public class SendBackServiceImpl implements SendBackService {
boolean flag=false; boolean flag=false;
User user= userDao.findById(startUserId).get(); User user= userDao.findById(startUserId).get();
Units units= unitsDao.findById(user.getUnitsId()).get(); Units units= unitsDao.findById(user.getUnitsId()).get();
for (DeviceLibrary deviceLibrary:deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceIdList)){ for (DeviceLibrary deviceLibrary:deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(deviceIdList)){
if (!deviceLibrary.getLocationUnit().equals(units.getName())){ if (!deviceLibrary.getLocationUnit().equals(units.getName())){
flag=true; flag=true;
...@@ -141,7 +147,9 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -141,7 +147,9 @@ public class SendBackServiceImpl implements SendBackService {
添加各单位的Task 添加各单位的Task
*/ */
addTaskById(deviceIdList,taskBto.getId(),startUserId,sendBackVo.getTime(),sendBackVo.getName()); addTaskById(deviceIdList,taskBto.getId(),startUserId,sendBackVo.getTime(),sendBackVo.getName());
List<Integer> ids= userDao.findAllByUnitsId(units.getUnitId()).stream().map(User::getUserId).collect(Collectors.toList());
ids.remove(startUserId);
messageService.add(new MessageBto(taskBto.getId(),BusinessEnum.SEND_BACK.id,user.getName()+"发起清退任务",ids));
return ResponseEntity.ok(taskBto.getId()); return ResponseEntity.ok(taskBto.getId());
} }
...@@ -472,7 +480,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -472,7 +480,8 @@ public class SendBackServiceImpl implements SendBackService {
保存出库清单 保存出库清单
*/ */
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get(); User user =userDao.findById(userId).get();
Units unit = unitsDao.findById(user.getUnitsId()).get();
Area area = areaDao.findById(unit.getAreaId()).get(); Area area = areaDao.findById(unit.getAreaId()).get();
...@@ -481,7 +490,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -481,7 +490,7 @@ public class SendBackServiceImpl implements SendBackService {
SendBackBill bill = sendBackBillEntityDao.findById(taskEntity.getBillId()).get(); SendBackBill bill = sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
bill.setSendBackOut(JSON.toJSONString(sendBackOut)); bill.setSendBackOut(JSON.toJSONString(sendBackOut));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,sendBackOut.getReviewerNameId()); // taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,sendBackOut.getReviewerNameId());
/* /*
...@@ -515,7 +524,20 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -515,7 +524,20 @@ public class SendBackServiceImpl implements SendBackService {
bill.setFormId(backBillDetailEntity.getId()); bill.setFormId(backBillDetailEntity.getId());
sendBackBillEntityDao.save(bill); sendBackBillEntityDao.save(bill);
return ResponseEntity.ok("装备出库发起成功等待审核");
Units father=fatherUnit.get(0);
taskEntity.setOwnUnit(father.getUnitId());
SendBackBill sendBackBill= sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
List<Integer> idList=stringToList(sendBackBill.getInvoleDevice());
deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach(
deviceLibrary -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(),"清退装备出库等待"+father.getName()+"签收",null);
deviceLogService.addLog(deviceLogDto);
}
);
TaskBto taskBto= taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1206,0);
return ResponseEntity.ok(taskBto);
} }
/** /**
...@@ -528,24 +550,24 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -528,24 +550,24 @@ public class SendBackServiceImpl implements SendBackService {
@Transactional @Transactional
@Override @Override
public ResponseEntity sendBackOutExamine(Integer taskId,Integer userId,Integer type) { public ResponseEntity sendBackOutExamine(Integer taskId,Integer userId,Integer type) {
TaskBto taskEntity = taskService.get(taskId); // TaskBto taskEntity = taskService.get(taskId);
//
Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get(); // Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
//
Area area = areaDao.findById(unit.getAreaId()).get(); // Area area = areaDao.findById(unit.getAreaId()).get();
//
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId()); // List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
Units father=fatherUnit.get(0); // Units father=fatherUnit.get(0);
taskEntity.setOwnUnit(father.getUnitId()); // taskEntity.setOwnUnit(father.getUnitId());
SendBackBill sendBackBill= sendBackBillEntityDao.findById(taskEntity.getBillId()).get(); // SendBackBill sendBackBill= sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
List<Integer> idList=stringToList(sendBackBill.getInvoleDevice()); // List<Integer> idList=stringToList(sendBackBill.getInvoleDevice());
deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach( // deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach(
deviceLibrary -> { // deviceLibrary -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(),"清退装备出库等待"+father.getName()+"签收",null); // DeviceLogDto deviceLogDto = new DeviceLogDto(deviceLibrary.getId(),"清退装备出库等待"+father.getName()+"签收",null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
} // }
); // );
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1206,0); // taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1206,0);
return ResponseEntity.ok("装配入库申请发送成功"); return ResponseEntity.ok("装配入库申请发送成功");
} }
...@@ -797,10 +819,37 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -797,10 +819,37 @@ public class SendBackServiceImpl implements SendBackService {
form.setReceiveUserBId(sendBackOut.getReviewerNameId()); form.setReceiveUserBId(sendBackOut.getReviewerNameId());
form.setReceiveUserBName(sendBackOut.getReviewerName()); form.setReceiveUserBName(sendBackOut.getReviewerName());
sendBackBillDetailEntityDao.save(form); sendBackBillDetailEntityDao.save(form);
Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
/*
已完结
*/
taskService.moveToEnd(taskEntity);
/*
修改装备是所属单位
*/
bill.setIsComplete(1);
sendBackBillEntityDao.save(bill);
List<Integer> idList = stringToList(bill.getInvoleDevice());
List<DeviceLibrary> deviceList = deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList);
for (DeviceLibrary d:deviceList) {
DeviceLogDto deviceLogDto = new DeviceLogDto(d.getId(),"清退装备签收入库完成",null);
deviceLogService.addLog(deviceLogDto);
d.setLocationUnit(unit.getName());
d.setOwnUnit(unit.getName());
d.setManageStatus(1);
}
deviceLibraryDao.saveAll(deviceList);
s(taskEntity,bill,idList);
/* /*
task 推入 19 task 推入 19
*/ */
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1204,sendBackOut.getReviewerNameId()); // taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1204,sendBackOut.getReviewerNameId());
// JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0); // JobEntity job = jobDao.findByTaskIdAndIsDone(taskEntity.getId(), 0);
// job.setIsDone(1); // job.setIsDone(1);
// addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0); // addJob(taskEntity.getId(),taskEntity.getBillStatus(),userId,job,sendBackOut.getReviewerNameId(),0);
...@@ -1584,7 +1633,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -1584,7 +1633,7 @@ public class SendBackServiceImpl implements SendBackService {
/* /*
市级的业务详情 市级的业务详情
*/ */
kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getParentTaskId()).stream().map(Task::parse2Bto).collect(Collectors.toList()); kidTask = taskDao.findTaskEntitiesByParentTaskId(taskBto.getId()).stream().map(Task::parse2Bto).collect(Collectors.toList());
} }
/* /*
区域名和任务id的映射,方便进入下一级 区域名和任务id的映射,方便进入下一级
......
...@@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
@ServerEndpoint(value = "/websocket/{userId}") //接受websocket请求路径 @ServerEndpoint(value = "/websocket/{userId}") //接受websocket请求路径
@Component //注册到spring容器中 @Component //注册到spring容器中
public class MyWebSocket { public class MyWebSocket {
private static int onlineCount = 0;
/** /**
* concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 * concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
*/ */
...@@ -49,17 +48,7 @@ public class MyWebSocket { ...@@ -49,17 +48,7 @@ public class MyWebSocket {
} }
} }
public static synchronized int getOnlineCount() {
return onlineCount;
}
public static synchronized void addOnlineCount() {
MyWebSocket.onlineCount++;
}
public static synchronized void subOnlineCount() {
MyWebSocket.onlineCount--;
}
/** /**
* 连接建立成功调用的方法 * 连接建立成功调用的方法
...@@ -75,11 +64,10 @@ public class MyWebSocket { ...@@ -75,11 +64,10 @@ public class MyWebSocket {
} else { } else {
webSocketMap.put(userId, this); webSocketMap.put(userId, this);
//加入set中 //加入set中
addOnlineCount();
//在线数加1 //在线数加1
} }
log.info("用户连接:" + userId + ",当前在线人数为:" + getOnlineCount()); log.info("用户连接:" + userId + ",当前在线人数为:" + webSocketMap.size());
sendMessage("连接成功"); sendMessage("连接成功");
} }
...@@ -89,12 +77,16 @@ public class MyWebSocket { ...@@ -89,12 +77,16 @@ public class MyWebSocket {
*/ */
@OnClose @OnClose
public void onClose() { public void onClose() {
if (webSocketMap.containsKey(userId)) { //从set中删除
webSocketMap.remove(userId); webSocketMap.remove(userId);
//从set中删除 log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
subOnlineCount(); }
}
log.info("用户退出:" + userId + ",当前在线人数为:" + getOnlineCount());
public void Close(String userId) {
//从set中删除
webSocketMap.remove(userId);
log.info("用户退出:" + userId + ",当前在线人数为:" + webSocketMap.size());
} }
/** /**
......
...@@ -5,14 +5,20 @@ import com.tykj.dev.device.task.service.TaskLogService; ...@@ -5,14 +5,20 @@ import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto; import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.train.dao.TrainUserDao;
import com.tykj.dev.device.train.entity.TrainTheme; import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.TrainUser;
import com.tykj.dev.device.train.entity.vo.*; import com.tykj.dev.device.train.entity.vo.*;
import com.tykj.dev.device.train.service.TrainTaskService; import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.TrainThemeService; import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.device.user.subject.dao.UnitsDao; 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.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.entity.UserLog;
import com.tykj.dev.device.user.subject.service.MgrcertService; import com.tykj.dev.device.user.subject.service.MgrcertService;
import com.tykj.dev.device.user.subject.service.UserLogService;
import com.tykj.dev.device.user.subject.service.UserService; import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
...@@ -20,6 +26,8 @@ import com.tykj.dev.socket.MyWebSocket; ...@@ -20,6 +26,8 @@ import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
...@@ -27,6 +35,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -27,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
...@@ -60,6 +69,10 @@ public class TrainJobController { ...@@ -60,6 +69,10 @@ public class TrainJobController {
TrainTaskService trainTaskService; TrainTaskService trainTaskService;
@Autowired @Autowired
TaskLogService taskLogService; TaskLogService taskLogService;
@Autowired
TrainUserDao trainUserDao;
@Autowired
UserLogService userLogService;
// 发起培训给选中人员都发一个代办任务报名,此任务在发起人跟踪里 // 发起培训给选中人员都发一个代办任务报名,此任务在发起人跟踪里
...@@ -73,40 +86,48 @@ public class TrainJobController { ...@@ -73,40 +86,48 @@ public class TrainJobController {
public ResponseEntity newTrain(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody TrainThemeAddVo trainThemeAddVo) { public ResponseEntity newTrain(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody TrainThemeAddVo trainThemeAddVo) {
TrainTheme trainTheme = trainThemeService.save(trainThemeAddVo.toDo()); TrainTheme trainTheme = trainThemeService.save(trainThemeAddVo.toDo());
// List<User> userList = userService.findSubordinate(securityUser.getCurrentUserInfo().getUserId()); // List<User> userList = userService.findSubordinate(securityUser.getCurrentUserInfo().getUserId());
List<Integer> needTrain = trainThemeAddVo.getJoinUserIds(); List<User> userList=userService.findUnitsIdInUsers(trainThemeAddVo.getUnitsIds());
List<Integer> normal = trainThemeAddVo.getNoJoinUserIds();
List<Integer> needTrain = new ArrayList<>();
// userList.forEach( List<Integer> normal = new ArrayList<>();
// user -> {
// if (user.getTrainStatus()==1 || user.getTrainStatus()==2){ userList.forEach(
// needTrain.add(user.getUserId()); user -> {
// }else { if (user.getTrainStatus()==1 || user.getTrainStatus()==2){
// normal.add(user.getUserId()); needTrain.add(user.getUserId());
// } }else {
// } normal.add(user.getUserId());
// ); }
}
);
// 1.用户报名 // 1.用户报名
trainTheme.setJoinUserId(JacksonUtil.toJSon(needTrain)); userService.findAllUserIdInUser(needTrain).forEach(
trainTheme.setNoJoinUserId(JacksonUtil.toJSon(normal)); user -> {
trainTheme.setSignUp("x"); TrainUser trainUser= userToTrainUser(user);
trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(1);
trainUser.setTrainId(trainTheme.getTrainId());
trainUserDao.save(trainUser);
}
);
userService.findAllUserIdInUser(normal).forEach(
user -> {
TrainUser trainUser= userToTrainUser(user);
trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(0);
trainUser.setTrainId(trainTheme.getTrainId());
trainUserDao.save(trainUser);
}
);
List<Integer> integers = new ArrayList<>(); List<Integer> integers = new ArrayList<>();
integers.add(securityUser.getCurrentUserInfo().getUserId()); integers.add(securityUser.getCurrentUserInfo().getUserId());
TaskBto task = taskService.start(new TaskBto(StatusEnum.TRAIN1000.id, trainTheme.getName(), null, null, trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers)); TaskBto task = taskService.start(new TaskBto(StatusEnum.TRAIN1000.id, trainTheme.getName(), null, null, trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers));
//1 新建培训
// jobService.addEntity(new JobEntity(taskEntity.getId(),1,39,0,"x"+securityUser.getCurrentUserInfo().getUserId()+"x",0));
//2. 报名中
// JobEntity jobEntity=new JobEntity(taskEntity.getId(),0,trainTheme.getTrainStatus(),securityUser.getCurrentUserInfo().getUserId(),"x"+securityUser.getCurrentUserInfo().getUserId()+"x",0);
// jobService.addEntity(jobEntity);
trainTheme.setTrainStatus(StatusEnum.TRAIN1000.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1000.id);
needTrain.forEach( needTrain.forEach(
id -> { id -> {
//4 报名确认
// TaskSaveVo taskSaveVo1=new TaskSaveVo(trainTheme.getName(),trainTheme.getTrainId(),36,taskEntity.getId(),"."+taskEntity.getId()+".",BusinessEnum.TRAIN.id,null,id,"x","x");
// TaskEntity taskEntity1 = taskService.addEntity(taskSaveVo1.toDo());
// JobEntity jobEntity1=new JobEntity(taskEntity1.getId(),0,36,id,"x"+id+"x",0);
// jobService.addEntity(jobEntity1);
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(id); list.add(id);
taskService.start(new TaskBto(StatusEnum.TRAIN1001.id, trainTheme.getName(), task.getId(), task.getId().toString(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, list)); taskService.start(new TaskBto(StatusEnum.TRAIN1001.id, trainTheme.getName(), task.getId(), task.getId().toString(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, list));
...@@ -115,18 +136,11 @@ public class TrainJobController { ...@@ -115,18 +136,11 @@ public class TrainJobController {
); );
normal.forEach( normal.forEach(
id -> { id -> {
//3 待报名
// TaskSaveVo taskSaveVo1=new TaskSaveVo(trainTheme.getName(),trainTheme.getTrainId(),37,taskEntity.getId(),"."+taskEntity.getId()+".",BusinessEnum.TRAIN.id,null,id,"x","x");
// TaskEntity taskEntity1 = taskService.addEntity(taskSaveVo1.toDo());
// JobEntity jobEntity1=new JobEntity(taskEntity1.getId(),0,37,id,"x"+id+"x",0);
// jobService.addEntity(jobEntity1);
List<Integer> list = new ArrayList<>(); List<Integer> list = new ArrayList<>();
list.add(id); list.add(id);
taskService.start(new TaskBto(StatusEnum.TRAIN1002.id, trainTheme.getName(), task.getId(), task.getId().toString(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, list)); taskService.start(new TaskBto(StatusEnum.TRAIN1002.id, trainTheme.getName(), task.getId(), task.getId().toString(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, list));
} }
); );
// TaskLogBto taskLogBto = new TaskLogBto(task.getId(),"发起培训",null);
// taskLogService.addLog(taskLogBto);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(trainThemeService.save(trainTheme)); return ResponseEntity.ok(trainThemeService.save(trainTheme));
} }
...@@ -144,35 +158,24 @@ public class TrainJobController { ...@@ -144,35 +158,24 @@ public class TrainJobController {
public ResponseEntity signUp(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody signUpReturn signUpReturn) { public ResponseEntity signUp(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody signUpReturn signUpReturn) {
TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId()); TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId());
TaskBto taskBto = taskService.get(signUpReturn.getTaskId()); TaskBto taskBto = taskService.get(signUpReturn.getTaskId());
TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId());
if (signUpReturn.getReturns() == 0) { if (signUpReturn.getReturns() == 0) {
taskBto = taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1); taskBto = taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1);
// JobEntity jobEntity = jobService.getOne(signUpReturn.getJobId()); trainUser.setIsSignUp(1);
// jobEntity.setIsDone(1);
// //4 等待培训
// jobService.update(jobEntity);
// JobEntity jobEntity1 = new JobEntity();
// BeanUtils.copyProperties(jobEntity, jobEntity1);
// jobEntity1.setId(null);
// jobEntity1.setIsDone(0);
// jobEntity1.setBillStatus(35);
// jobEntity1.setBelongUserId(0);
// jobService.addEntity(jobEntity1);
// TaskEntity taskEntity = taskService.getOne(jobEntity.getTaskId());
// taskEntity.setBillStatus(35);
// taskService.update(taskEntity);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "报名", null); TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "报名", null);
userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"报名参加培训"));
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
trainTheme.setSignUp(trainTheme.getSignUp() + securityUser.getCurrentUserInfo().getUserId() + "x");
} else { } else {
// JobEntity jobEntity = jobService.getOne(signUpReturn.getJobId()); trainUser.setIsSignUp(2);
// jobEntity.setIsDone(1); trainUser.setNote(signUpReturn.getNode());
// jobService.update(jobEntity);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "不报名", null); TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "不报名", null);
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"不参加培训"));
} }
trainUser.setUnitsName(unitsDao.findById(trainUser.getUnitsId()).get().getName());
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(trainThemeService.save(trainTheme)); return ResponseEntity.ok(trainUserDao.save(trainUser));
} }
/** /**
...@@ -186,20 +189,18 @@ public class TrainJobController { ...@@ -186,20 +189,18 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(trainId); TrainTheme trainTheme = trainThemeService.findById(trainId);
//查询所有必须报名而没有报名的task 状态直接转为待培训 //查询所有必须报名而没有报名的task 状态直接转为待培训
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1001.id).forEach( trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1001.id).forEach(
taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1) taskBto -> {
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1);
List<Integer> ids= taskBto.getInvolveUserIdList();
TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(ids.get(ids.size()-1),trainTheme.getTrainId());
trainUser.setIsSignUp(1);
trainUserDao.save(trainUser);
userLogService.save(new UserLog(trainUser.getUserId(),new Date(),"报名参加培训"));
}
); );
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1002.id).forEach( trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1002.id).forEach(
taskBto -> taskService.moveToEnd(taskBto) taskBto -> taskService.moveToEnd(taskBto)
); );
//未报名统一处理为为报名
// taskService.findBybullIdAndBussType(3,BusinessEnum.TRAIN.id).forEach(
// taskEntity -> {
//// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
//// jobEntity.setIsDone(1);
//// jobService.update(jobEntity);
// }
// );
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1000.id).forEach( trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1000.id).forEach(
taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1010) taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1010)
); );
...@@ -220,19 +221,6 @@ public class TrainJobController { ...@@ -220,19 +221,6 @@ public class TrainJobController {
trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1010.id).forEach( trainTaskService.selectBillidAndBillType(trainId, BusinessEnum.TRAIN.id, StatusEnum.TRAIN1010.id).forEach(
taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1004, taskBto.getInvolveUserIdList().get(0)) taskBto -> taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1004, taskBto.getInvolveUserIdList().get(0))
); );
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(8);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setIsDone(0);
// jobEntity1.setId(null);
// //5 培训中
// jobEntity1.setBillStatus(8);
// jobService.addEntity(jobEntity1);
//5 培训中 //5 培训中
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
// //主task往下推待培训状态,0 // //主task往下推待培训状态,0
...@@ -243,25 +231,7 @@ public class TrainJobController { ...@@ -243,25 +231,7 @@ public class TrainJobController {
} }
// //录入成绩
// @GetMapping("/{trainId}")
// public ResponseEntity resultsEntry(@PathVariable Integer trainId){
// TrainTheme trainTheme = trainThemeService.findById(trainId);
//
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setIsDone(0);
// jobEntity1.setId(null);
// //6 录入成绩
// jobEntity1.setBillStatus(6);
// jobService.addEntity(jobEntity1);
// //6 录入成绩
// trainTheme.setTrainStatus(6);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }
//市培训待审核 //市培训待审核
@ApiOperation(value = "3 录入成绩后调用的接口", notes = "状态改为'市培训申请发证") @ApiOperation(value = "3 录入成绩后调用的接口", notes = "状态改为'市培训申请发证")
...@@ -272,23 +242,16 @@ public class TrainJobController { ...@@ -272,23 +242,16 @@ public class TrainJobController {
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
taskBto.setOwnUnit(1); taskBto.setOwnUnit(1);
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1005); taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1005);
// taskEntity.setBillStatus(32); gradeEntryVo.getGradeEntryList().forEach(
// taskEntity.setOwnUnit(1); gradeEntry -> {
// taskService.update(taskEntity); TrainUser trainUser = trainUserDao.findByUserIdAndTrainId(gradeEntry.getUserId(),trainTheme.getTrainId());
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId()); trainUser.setAttendance(gradeEntry.getAttendance());
// jobEntity.setIsDone(1); trainUser.setScore(gradeEntry.getScore());
// jobService.update(jobEntity); trainUser.setEvaluation(gradeEntry.getEvaluation());
// JobEntity jobEntity1=new JobEntity(); trainUser.setCertificate(gradeEntry.getCertificate());
// BeanUtils.copyProperties(jobEntity,jobEntity1); trainUserDao.save(trainUser);
// jobEntity1.setIsDone(0); }
// //10市待审核 );
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(32);
// jobEntity1.setBelongUserId(0);
// jobService.addEntity(jobEntity1);
//10 市待审核状态
// trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate());
trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
trainTheme.setTrainStatus(StatusEnum.TRAIN1005.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1005.id);
trainTheme.setGood(gradeEntryVo.getGood()); trainTheme.setGood(gradeEntryVo.getGood());
trainTheme.setPass(gradeEntryVo.getPass()); trainTheme.setPass(gradeEntryVo.getPass());
...@@ -298,135 +261,6 @@ public class TrainJobController { ...@@ -298,135 +261,6 @@ public class TrainJobController {
return ResponseEntity.ok(trainThemeService.save(trainTheme)); return ResponseEntity.ok(trainThemeService.save(trainTheme));
} }
// //市培训申请
// @ApiOperation(value = "市培训待审核状态 审核接口",notes = "审核通过状态:'市培训申请发证',不通过则退回状态成绩录入状态")
// @GetMapping("/certificateApplication")
// public ResponseEntity certificateApplication(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@RequestBody GradeEntryVo gradeEntryVo){
//
// if (gradeEntryVo.getThrough()==0) {
// //申请发证
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity = taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(32);
// //省
// taskEntity.setOwnUnit(1);
// taskService.update(taskEntity);
// JobEntity jobEntity = taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1 = new JobEntity();
// BeanUtils.copyProperties(jobEntity, jobEntity1);
// jobEntity1.setIsDone(0);
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(32);
// jobEntity1.setBelongUserId(0);
// jobService.addEntity(jobEntity1);
//// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// trainTheme.setTrainStatus(32);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }else {
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity = taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(31);
// //省
// taskEntity.setOwnUnit(1);
// taskService.addEntity(taskEntity);
// JobEntity jobEntity = taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1 = new JobEntity();
// BeanUtils.copyProperties(jobEntity, jobEntity1);
// jobEntity1.setId(null);
// jobEntity1.setIsDone(0);
// jobEntity1.setBillStatus(31);
// jobEntity1.setBelongUserId(taskEntity.getStartUserId());
// jobEntity1.setInvoleUserId(jobEntity1.getInvoleUserId().replace(securityUser.getCurrentUserInfo().getUserId()+"x",""));
//// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// jobService.addEntity(jobEntity1);
// trainTheme.setTrainStatus(31);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }
// }
//
// //市培训待审核
// @ApiOperation(value = "3 录入成绩后调用的接口",notes = "状态改为'市培训待审核")
// @GetMapping("/gradesGrade")
// public ResponseEntity cityAudit(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@RequestBody GradeEntryVo gradeEntryVo){
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity= taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
//
// taskEntity.setBillStatus(31);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setIsDone(0);
// //10市待审核
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(31);
// jobEntity1.setBelongUserId(gradeEntryVo.getAuditId());
// jobEntity1.setInvoleUserId(jobEntity1.getInvoleUserId()+gradeEntryVo.getAuditId()+"x");
// jobService.addEntity(jobEntity);
// //10 市待审核状态
//// trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate());
// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// trainTheme.setTrainStatus(31);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }
//
// //市培训申请
// @ApiOperation(value = "市培训待审核状态 审核接口",notes = "审核通过状态:'市培训申请发证',不通过则退回状态成绩录入状态")
// @GetMapping("/certificateApplication")
// public ResponseEntity certificateApplication(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@RequestBody GradeEntryVo gradeEntryVo){
//
// if (gradeEntryVo.getThrough()==0) {
// //申请发证
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity = taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(32);
// //省
// taskEntity.setOwnUnit(1);
// taskService.update(taskEntity);
// JobEntity jobEntity = taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1 = new JobEntity();
// BeanUtils.copyProperties(jobEntity, jobEntity1);
// jobEntity1.setIsDone(0);
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(32);
// jobEntity1.setBelongUserId(0);
// jobService.addEntity(jobEntity1);
//// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// trainTheme.setTrainStatus(32);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }else {
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// TaskEntity taskEntity = taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(), trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(31);
// //省
// taskEntity.setOwnUnit(1);
// taskService.addEntity(taskEntity);
// JobEntity jobEntity = taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1 = new JobEntity();
// BeanUtils.copyProperties(jobEntity, jobEntity1);
// jobEntity1.setId(null);
// jobEntity1.setIsDone(0);
// jobEntity1.setBillStatus(31);
// jobEntity1.setBelongUserId(taskEntity.getStartUserId());
// jobEntity1.setInvoleUserId(jobEntity1.getInvoleUserId().replace(securityUser.getCurrentUserInfo().getUserId()+"x",""));
//// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// jobService.addEntity(jobEntity1);
// trainTheme.setTrainStatus(31);
// return ResponseEntity.ok(trainThemeService.save(trainTheme));
// }
// }
//市培训申请发证审核 待确认 //市培训申请发证审核 待确认
@ApiOperation(value = "市培训申请发证状态 调用接口", notes = "下一步'市培训申请发证审核'") @ApiOperation(value = "市培训申请发证状态 调用接口", notes = "下一步'市培训申请发证审核'")
...@@ -438,27 +272,18 @@ public class TrainJobController { ...@@ -438,27 +272,18 @@ public class TrainJobController {
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1006, gradeEntryVo.getAuditId()); taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1006, gradeEntryVo.getAuditId());
// TaskEntity taskEntity= taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(33);
// taskService.update(taskEntity);
//
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobEntity.setBelongUserId(securityUser.getCurrentUserInfo().getUserId());
// jobEntity.setInvoleUserId(jobEntity.getInvoleUserId()+securityUser.getCurrentUserInfo().getUserId()+"x");
// jobService.update(jobEntity);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setIsDone(0);
// jobEntity1.setId(null);
// //市培训发证审核
// jobEntity1.setBillStatus(33);
// jobEntity1.setBelongUserId(gradeEntryVo.getAuditId());
// jobEntity1.setInvoleUserId(jobEntity1.getInvoleUserId()+gradeEntryVo.getAuditId()+"x");
// jobService.addEntity(jobEntity1);
//7 市培训申请发证审核 //7 市培训申请发证审核
trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate()); trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate());
trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList())); gradeEntryVo.getGradeEntryList().forEach(
gradeEntry -> {
TrainUser trainUser = trainUserDao.findByUserIdAndTrainId(gradeEntry.getUserId(),trainTheme.getTrainId());
trainUser.setAttendance(gradeEntry.getAttendance());
trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUser.setCertificate(gradeEntry.getCertificate());
trainUserDao.save(trainUser);
}
);
trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1006.id);
trainTheme.setGood(gradeEntryVo.getGood()); trainTheme.setGood(gradeEntryVo.getGood());
trainTheme.setPass(gradeEntryVo.getPass()); trainTheme.setPass(gradeEntryVo.getPass());
...@@ -476,24 +301,18 @@ public class TrainJobController { ...@@ -476,24 +301,18 @@ public class TrainJobController {
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1007, gradeEntryVo.getAuditId()); taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1007, gradeEntryVo.getAuditId());
// TaskEntity taskEntity= taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity.setBillStatus(34);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setIsDone(0);
// //省培训发证审核
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(34);
// jobEntity1.setBelongUserId(gradeEntryVo.getAuditId());
// jobEntity1.setInvoleUserId(jobEntity1.getInvoleUserId()+gradeEntryVo.getAuditId()+"x");
// jobService.addEntity(jobEntity1);
//7 省培训发证审核 //7 省培训发证审核
trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate()); trainTheme.setIsCertificate(gradeEntryVo.getIsCertificate());
trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList())); gradeEntryVo.getGradeEntryList().forEach(
gradeEntry -> {
TrainUser trainUser = trainUserDao.findByUserIdAndTrainId(gradeEntry.getUserId(),trainTheme.getTrainId());
trainUser.setAttendance(gradeEntry.getAttendance());
trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUser.setCertificate(gradeEntry.getCertificate());
trainUserDao.save(trainUser);
}
);
trainTheme.setTrainStatus(StatusEnum.TRAIN1007.id); trainTheme.setTrainStatus(StatusEnum.TRAIN1007.id);
trainTheme.setGood(gradeEntryVo.getGood()); trainTheme.setGood(gradeEntryVo.getGood());
trainTheme.setPass(gradeEntryVo.getPass()); trainTheme.setPass(gradeEntryVo.getPass());
...@@ -513,6 +332,7 @@ public class TrainJobController { ...@@ -513,6 +332,7 @@ public class TrainJobController {
gradeEntry -> { gradeEntry -> {
if (gradeEntry.getCertificate() == 0) { if (gradeEntry.getCertificate() == 0) {
mgrcertService.save(gradeEntry.toDo()); mgrcertService.save(gradeEntry.toDo());
userLogService.save(new UserLog(gradeEntry.getUserId(),new Date(),"通过培训获得证书"));
} }
} }
); );
...@@ -522,52 +342,27 @@ public class TrainJobController { ...@@ -522,52 +342,27 @@ public class TrainJobController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id); // TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// //8 培训完成 // //8 培训完成
// taskEntity.setBillStatus(15);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// //完结待确认
// jobService.update(jobEntity);
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(15);
// jobEntity1.setIsDone(0);
// jobEntity1.setBelongUserId(taskEntity.getStartUserId());
// jobEntity1.setInvoleUserId("x"+taskEntity.getStartUserId()+"x");
// jobService.addEntity(jobEntity1);
trainTaskService.selectBillidAndBillType(gradeEntryVo.getTrainThemeId(), BusinessEnum.TRAIN.id, StatusEnum.TRAIN1003.id).forEach( trainTaskService.selectBillidAndBillType(gradeEntryVo.getTrainThemeId(), BusinessEnum.TRAIN.id, StatusEnum.TRAIN1003.id).forEach(
taskBto1 -> { taskBto1 -> {
// taskBto1.setCurrentPoint(0); // taskBto1.setCurrentPoint(0);
taskService.update(taskService.moveToSpecial(taskBto1, StatusEnum.TRAIN1009, taskBto1.getInvolveUserIdList().get(0))); taskService.moveToSpecial(taskBto1, StatusEnum.TRAIN1009, taskBto1.getInvolveUserIdList().get(0));
} }
); );
//9 成绩待确认 //9 成绩待确认
// TaskEntity taskEntity1=taskService.findByStartUserIdAndBillIdAndBussType(id,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity1.setBillStatus(38);
// taskService.update(taskEntity1);
// JobEntity jobEntity2 = taskUtils.getCurrentJob(taskEntity1.getId());
// jobEntity2.setIsDone(1);
// jobService.update(jobEntity2);
// JobEntity jobEntity3=new JobEntity();
// BeanUtils.copyProperties(jobEntity2,jobEntity3);
// jobEntity3.setId(null);
// jobEntity3.setBelongUserId(id);
// jobEntity3.setInvoleUserId("x"+id+"x");
// jobEntity3.setBillStatus(38);
// jobEntity3.setIsDone(0);
// jobService.addEntity(jobEntity3);
//
// );
/** /**
* 15 * 15
*/ */
trainTheme.setTrainStatus(StatusEnum.END.id); trainTheme.setTrainStatus(StatusEnum.END.id);
trainTheme.setGood(gradeEntryVo.getGood()); gradeEntryVo.getGradeEntryList().forEach(
trainTheme.setPass(gradeEntryVo.getPass()); gradeEntry -> {
TrainUser trainUser = trainUserDao.findByUserIdAndTrainId(gradeEntry.getUserId(),trainTheme.getTrainId());
trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList())); trainUser.setAttendance(gradeEntry.getAttendance());
trainUser.setScore(gradeEntry.getScore());
trainUser.setEvaluation(gradeEntry.getEvaluation());
trainUserDao.save(trainUser);
}
);
trainThemeService.save(trainTheme); trainThemeService.save(trainTheme);
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "审核通过", null); TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "审核通过", null);
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
...@@ -577,65 +372,6 @@ public class TrainJobController { ...@@ -577,65 +372,6 @@ public class TrainJobController {
} }
// //市审核 是否通过 培训完成
// public ResponseEntity gradeeEntry1(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@RequestBody GradeEntryVo gradeEntryVo){
// //向专管员证书表中添加数据
// List<Mgrcert> list=new ArrayList<>();
// gradeEntryVo.getGradeEntryList().forEach(
// gradeEntry -> list.add(gradeEntry.toDo())
// );
// mgrcertService.saveAll(list);
//
//
// TrainTheme trainTheme = trainThemeService.findById(gradeEntryVo.getTrainThemeId());
// //给培训报名的人员都发起一个通知,查看自己都证书
// List<Integer> ids= StringSplitUtil.userIdSplit(trainTheme.getSignUp());
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// //8 待确认
// taskEntity.setBillStatus(BusinessEnum.TRAIN.id);
// taskService.update(taskEntity);
// JobEntity jobEntity= jobService.findTaskIdAndinvoleUserIdLike(taskEntity.getId(),securityUser.getCurrentUserInfo().getUserId());
// jobEntity.setIsDone(1);
// //培训结束
// jobService.update(jobEntity);
// //发起人通知
// //给所有培训人员培训结果通知
// //通知
// JobEntity jobEntity1=new JobEntity();
// BeanUtils.copyProperties(jobEntity,jobEntity1);
// jobEntity1.setId(null);
// jobEntity1.setBillStatus(BusinessEnum.TRAIN.id);
// jobEntity1.setIsDone(0);
// jobEntity1.setBelongUserId(taskEntity.getStartUserId());
// jobEntity1.setInvoleUserId("x"+taskEntity.getStartUserId()+"x");
// jobService.addEntity(jobEntity1);
//
// ids.forEach(
// id->{
// //9 培训结果
// TaskEntity taskEntity1=taskService.findByStartUserIdAndBillIdAndBussType(id,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// taskEntity1.setBillStatus(BusinessEnum.TRAIN.id);
// taskService.update(taskEntity1);
// JobEntity jobEntity2 = taskUtils.getCurrentJob(taskEntity1.getId());
// jobEntity2.setIsDone(1);
// jobService.addEntity(jobEntity2);
// JobEntity jobEntity3=new JobEntity();
// BeanUtils.copyProperties(jobEntity2,jobEntity3);
// jobEntity3.setId(null);
// jobEntity3.setBillStatus(BusinessEnum.TRAIN.id);
// jobEntity3.setIsDone(0);
// jobService.addEntity(jobEntity3);
//
// }
// );
// /**
// * 培训结束
// */
// trainTheme.setTrainStatus(9);
// trainTheme.setTrainingResults(JacksonUtil.toJSon(gradeEntryVo.getGradeEntryList()));
// return ResponseEntity.ok( trainTheme);
// //修改业务都状态
// }
//考情 1.正常参加 2.为参加 3.请假 //考情 1.正常参加 2.为参加 3.请假
...@@ -647,26 +383,6 @@ public class TrainJobController { ...@@ -647,26 +383,6 @@ public class TrainJobController {
} }
// /**
// * 培训完成待确认
// *
// * @param signUpReturn
// * @return
// */
// @ApiOperation(value = "end。培训完成待确认")
// @PostMapping("/completionConfirmed")
// public ResponseEntity completionConfirmed(@RequestBody signUpReturn signUpReturn){
// TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId());
// TaskEntity taskEntity=taskService.findByParentAndBillIdAndBussType(0,trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
// //BusinessEnum.TRAIN.id
// taskEntity.setBillStatus(BusinessEnum.TRAIN.id);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
// myWebSocket.sendMessage1();
// return ResponseEntity.ok(true);
// }
/** /**
* 成绩查看确认 * 成绩查看确认
...@@ -679,14 +395,8 @@ public class TrainJobController { ...@@ -679,14 +395,8 @@ public class TrainJobController {
public ResponseEntity resultsConfirm(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody signUpReturn signUpReturn) { public ResponseEntity resultsConfirm(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @RequestBody signUpReturn signUpReturn) {
TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId()); TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId());
//给培训报名的人员都发起一个通知,查看自己都证书 //给培训报名的人员都发起一个通知,查看自己都证书
// TaskEntity taskEntity=taskService.findByStartUserIdAndBillIdAndBussType(securityUser.getCurrentUserInfo().getUserId(),trainTheme.getTrainId(),BusinessEnum.TRAIN.id);
TaskBto taskBto = taskService.get(signUpReturn.getTaskId()); TaskBto taskBto = taskService.get(signUpReturn.getTaskId());
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
// taskEntity.setBillStatus(BusinessEnum.TRAIN.id);
// taskService.update(taskEntity);
// JobEntity jobEntity= taskUtils.getCurrentJob(taskEntity.getId());
// jobEntity.setIsDone(1);
// jobService.update(jobEntity);
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResponseEntity.ok(true); return ResponseEntity.ok(true);
} }
...@@ -727,4 +437,9 @@ public class TrainJobController { ...@@ -727,4 +437,9 @@ public class TrainJobController {
return ResponseEntity.ok(trainThemeService.findSelectDetailsVo(trainId)); return ResponseEntity.ok(trainThemeService.findSelectDetailsVo(trainId));
} }
private TrainUser userToTrainUser(User user){
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(user,TrainUser.class);
}
} }
package com.tykj.dev.device.train.dao;
import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.TrainUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainUserDao.java
* @Description TODO
* @createTime 2020年12月01日 13:55:00
*/
public interface TrainUserDao extends JpaRepository<TrainUser, Integer>, JpaSpecificationExecutor<TrainUser> {
TrainUser findByUserIdAndTrainId(Integer userId,Integer trainId);
List<TrainUser> findAllByIsSignUpAndTrainId(Integer IsSignUp,Integer trainId);
}
...@@ -117,23 +117,23 @@ public class TrainTheme { ...@@ -117,23 +117,23 @@ public class TrainTheme {
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private String trainSynopsis; private String trainSynopsis;
/** // /**
* 参会人员(必须参会) // * 参会人员(必须参会)
*/ // */
@ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x") // @ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x")
private String joinUserId; // private String joinUserId;
//
/** // /**
* 不必须参会人员 // * 不必须参会人员
*/ // */
@ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x") // @ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x")
private String noJoinUserId; // private String noJoinUserId;
//
/** // /**
* 报名人员 // * 报名人员
*/ // */
@ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x") // @ApiModelProperty(value = "参会人员id 多个使用人员id+x+id+x")
private String signUp; // private String signUp;
/** /**
* 培训结果 * 培训结果
......
package com.tykj.dev.device.user.base.ret; package com.tykj.dev.device.train.entity;
import com.tykj.dev.device.user.subject.entity.Mgrcert;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.persistence.*;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -16,15 +19,27 @@ import lombok.NoArgsConstructor; ...@@ -16,15 +19,27 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@ApiModel(value = "培训选人列表实体") @Entity
public class UserTrainVo { @ApiModel(value = "培训人员信息")
public class TrainUser {
/** /**
* 用户 * 数据id
*/
@Id
@ApiModelProperty(value = "数据ID", name = "id", example = "12321L")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 培训id
*/ */
@ApiModelProperty(value = "培训id", name = "userId", example = "12321L")
private Integer trainId;
/**
* 用户
*/
@ApiModelProperty(value = "用户数据ID", name = "userId", example = "12321L") @ApiModelProperty(value = "用户数据ID", name = "userId", example = "12321L")
// @GeneratedValue(generator="UserIdentityGenerator",strategy = GenerationType.AUTO)
// @GenericGenerator(name = "UserIdentityGenerator", strategy = "UserIdentityGenerator")
private Integer userId; private Integer userId;
/** /**
...@@ -72,13 +87,48 @@ public class UserTrainVo { ...@@ -72,13 +87,48 @@ public class UserTrainVo {
private Integer unitsId; private Integer unitsId;
/** /**
* 培训状态 0.已培训 1.已过期 2.未培训 3.快过期 * 考勤
*/
@ApiModelProperty(value = "考勤", name = "attendance")
private String attendance;
/**
* 分数
*/
@ApiModelProperty(value = "分数", name = "score")
private String score;
/**
* 评价
*/
@ApiModelProperty(value = "评价", name = "evaluation")
private String evaluation;
/**
* 是否报名 1.报名 2.不报名
*/
@ApiModelProperty(value = "是否报名 1.报名 2.不报名", name = "certificate")
private Integer isSignUp;
/**
* 不报名的备注
*/ */
private Integer trainStatus; @ApiModelProperty(value = "不报名的备足", name = "certificate")
private String note;
/**
* 是否发证
*/
@ApiModelProperty(value = "是否发证", name = "certificate")
private Integer certificate;
/** /**
* 0 是 1 否 * 是否必须报名 1.必须 2.不必须
*/ */
private Integer isMustJoin; @ApiModelProperty(value = "是否必须报名 1.必须 2.不必须", name = "certificate")
private Integer isNotJoinUserId;
@Transient
private Mgrcert mgrcert;
} }
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -131,6 +132,6 @@ public class TrainAuditVo { ...@@ -131,6 +132,6 @@ public class TrainAuditVo {
* 成绩 * 成绩
*/ */
@ApiModelProperty(value = "gradeEntry") @ApiModelProperty(value = "gradeEntry")
private List<GradeEntry> gradeEntry; private List<TrainUser> TrainUser;
} }
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -130,7 +131,7 @@ public class TrainDetailsVo { ...@@ -130,7 +131,7 @@ public class TrainDetailsVo {
/** /**
* 成绩 * 成绩
*/ */
@ApiModelProperty(value = "gradeEntry") @ApiModelProperty(value = "trainUsers")
private List<GradeEntry> gradeEntry; private List<TrainUser> trainUsers;
} }
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.user.base.ret.UserTrainVo; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -118,11 +118,11 @@ public class TrainRegistrationVo { ...@@ -118,11 +118,11 @@ public class TrainRegistrationVo {
* 以报名人员 * 以报名人员
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private List<UserTrainVo> signUpUser; private List<TrainUser> signUpUser;
/** /**
* 没报名人员 * 没报名人员
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private List<UserTrainVo> noSignUpUser; private List<TrainUser> noSignUpUser;
} }
...@@ -102,17 +102,24 @@ public class TrainThemeAddVo { ...@@ -102,17 +102,24 @@ public class TrainThemeAddVo {
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private String trainSynopsis; private String trainSynopsis;
/** // /**
* 必须参加 // * 必须参加
*/ // */
@ApiModelProperty(value = "参会人员id 集合") // @ApiModelProperty(value = "参会人员id 集合")
private List<Integer> joinUserIds=new ArrayList<>(); // private List<Integer> joinUserIds=new ArrayList<>();
//
// /**
// * 不必须参会人员
// */
// @ApiModelProperty(value = "参会人员id 集合")
// private List<Integer> noJoinUserIds=new ArrayList<>();
/** /**
* 不必须参会人员 * 需要参加的单位
*/ */
@ApiModelProperty(value = "参会人员id 集合") @ApiModelProperty(value = "参会人员id 集合",name = "unitsIds")
private List<Integer> noJoinUserIds=new ArrayList<>(); private List<Integer> unitsIds;
/** /**
* 培训状态 1报名中 2待培训 3培训中 * 培训状态 1报名中 2待培训 3培训中
......
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.user.base.ret.UserTrainVo; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -118,7 +118,7 @@ public class TrainTrainingVo { ...@@ -118,7 +118,7 @@ public class TrainTrainingVo {
/** /**
* 以报名人员 * 以报名人员
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainUsers")
private List<UserTrainVo> signUpUser; private List<TrainUser> trainUsers;
} }
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;
/** /**
* @author zjm * @author zjm
...@@ -23,6 +24,9 @@ public class signUpReturn { ...@@ -23,6 +24,9 @@ public class signUpReturn {
@ApiModelProperty(value = "是否报名 0 报名 1否", name = "returns") @ApiModelProperty(value = "是否报名 0 报名 1否", name = "returns")
private Integer returns; private Integer returns;
@ApiModelProperty(value = "必须报名 不报名填写的备注",name = "node")
private String node;
@ApiModelProperty(value = "job——id", name = "taskId") @ApiModelProperty(value = "job——id", name = "taskId")
private Integer taskId; private Integer taskId;
......
...@@ -5,7 +5,9 @@ import com.github.wenhao.jpa.PredicateBuilder; ...@@ -5,7 +5,9 @@ import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.train.dao.TrainThemeDao; import com.tykj.dev.device.train.dao.TrainThemeDao;
import com.tykj.dev.device.train.dao.TrainUserDao;
import com.tykj.dev.device.train.entity.TrainTheme; import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.TrainUser;
import com.tykj.dev.device.train.entity.vo.*; import com.tykj.dev.device.train.entity.vo.*;
import com.tykj.dev.device.train.service.TrainTaskService; import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.TrainThemeService; import com.tykj.dev.device.train.service.TrainThemeService;
...@@ -51,6 +53,9 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -51,6 +53,9 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Autowired @Autowired
TrainTaskService trainTaskService; TrainTaskService trainTaskService;
@Autowired
TrainUserDao trainUserDao;
@Override @Override
public TrainTheme save(TrainTheme trainTheme) { public TrainTheme save(TrainTheme trainTheme) {
return trainThemeDao.save(trainTheme); return trainThemeDao.save(trainTheme);
...@@ -92,20 +97,8 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -92,20 +97,8 @@ public class TrainThemeServiceImpl implements TrainThemeService {
public TrainRegistrationVo findRegistrationVo(Integer trainThemeId) { public TrainRegistrationVo findRegistrationVo(Integer trainThemeId) {
TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get(); TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get();
TrainRegistrationVo trainRegistrationVo = trainTheme.toTrainRegistrationVo(); TrainRegistrationVo trainRegistrationVo = trainTheme.toTrainRegistrationVo();
List<Integer> signUp = StringSplitUtil.userIdSplit(trainTheme.getSignUp()); trainRegistrationVo.setSignUpUser(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId));
trainRegistrationVo.setSignUpUser(userService.findByIdListUserTarinVo(signUp)); trainRegistrationVo.setNoSignUpUser(trainUserDao.findAllByIsSignUpAndTrainId(2,trainThemeId));
List<Integer> integerList1 = JacksonUtil.readValue(trainTheme.getNoJoinUserId(), new TypeReference<List<Integer>>() {
});
List<Integer> integerList2 = JacksonUtil.readValue(trainTheme.getJoinUserId(), new TypeReference<List<Integer>>() {
});
if (integerList2!=null) {
integerList1.addAll(integerList2);
}
if (integerList1!=null) {
integerList1.removeAll(signUp);
}
trainRegistrationVo.setNoSignUpUser(userService.findByIdListUserTarinVo(integerList1));
return trainRegistrationVo; return trainRegistrationVo;
} }
...@@ -113,8 +106,7 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -113,8 +106,7 @@ public class TrainThemeServiceImpl implements TrainThemeService {
public TrainTrainingVo findTrainTrainingVo(Integer trainThemeId) { public TrainTrainingVo findTrainTrainingVo(Integer trainThemeId) {
TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get(); TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get();
TrainTrainingVo trainTrainingVo = trainTheme.toTrainTrainingVo(); TrainTrainingVo trainTrainingVo = trainTheme.toTrainTrainingVo();
List<Integer> signUp = StringSplitUtil.userIdSplit(trainTheme.getSignUp()); trainTrainingVo.setTrainUsers(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId));
trainTrainingVo.setSignUpUser(userService.findByIdListUserTarinVo(signUp));
return trainTrainingVo; return trainTrainingVo;
} }
...@@ -122,8 +114,11 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -122,8 +114,11 @@ public class TrainThemeServiceImpl implements TrainThemeService {
public TrainAuditVo findTrainAuditVo(Integer trainThemeId) { public TrainAuditVo findTrainAuditVo(Integer trainThemeId) {
TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get(); TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get();
TrainAuditVo trainAuditVo = trainTheme.toTrainAuditVo(); TrainAuditVo trainAuditVo = trainTheme.toTrainAuditVo();
trainAuditVo.setGradeEntry(JacksonUtil.readValue(trainTheme.getTrainingResults(), new TypeReference<List<GradeEntry>>() { List<TrainUser> trainUsers= trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId);
})); trainUsers.forEach(trainUser -> {
trainUser.setMgrcert(mgrcertService.findByUserId(trainUser.getUserId()));
});
trainAuditVo.setTrainUser(trainUsers);
return trainAuditVo; return trainAuditVo;
} }
...@@ -184,16 +179,11 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -184,16 +179,11 @@ public class TrainThemeServiceImpl implements TrainThemeService {
if (trainThemeOptional.isPresent()){ if (trainThemeOptional.isPresent()){
TrainTheme trainTheme=trainThemeOptional.get(); TrainTheme trainTheme=trainThemeOptional.get();
TrainDetailsVo trainDetailsVo=trainTheme.toTrainDetailsVo(); TrainDetailsVo trainDetailsVo=trainTheme.toTrainDetailsVo();
String gradeEntity= trainTheme.getTrainingResults(); List<TrainUser> trainUsers= trainUserDao.findAllByIsSignUpAndTrainId(1,trainId);
if (gradeEntity!=null) { trainUsers.forEach(trainUser -> {
List<GradeEntry> list = JacksonUtil.readValue(gradeEntity, new TypeReference<List<GradeEntry>>() { trainUser.setMgrcert(mgrcertService.findByUserId(trainUser.getUserId()));
}); });
list.forEach( trainDetailsVo.setTrainUsers(trainUsers);
gradeEntry -> gradeEntry.setMgrcert(mgrcertService.findByUserId(gradeEntry.getUserId()))
);
trainDetailsVo.setGradeEntry(list);
}
return trainDetailsVo; return trainDetailsVo;
}else { }else {
throw new ApiException(ResponseEntity.ok("培训id没有查询到,请检查")); throw new ApiException(ResponseEntity.ok("培训id没有查询到,请检查"));
......
...@@ -29,5 +29,12 @@ ...@@ -29,5 +29,12 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId> <artifactId>config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>socket</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -13,7 +13,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -13,7 +13,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = { @SpringBootApplication(scanBasePackages = {
"com.tykj.dev.misc", "com.tykj.dev.misc",
"com.tykj.dev.config", "com.tykj.dev.config",
"com.tykj.dev.device.user" "com.tykj.dev.device.user",
"com.tykj.dev.socket"
} }
) )
public class UserApp { public class UserApp {
......
package com.tykj.dev.device.user.base.ret;
import com.tykj.dev.device.user.subject.entity.Units;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Null;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName UnitsTrainListVo.java
* @Description TODO
* @createTime 2020年12月01日 10:33:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(value = "单位集合", description = "给培训单位列表做筛选")
public class UnitsTrainListVo {
@ApiModelProperty(value = "省级单位id", name = "province", example = "12321L")
private List<Units> province;
@ApiModelProperty(value = "市级单位", name = "city", example = "12321L")
private List<Units> city;
@ApiModelProperty(value = "区县单位", name = "county", example = "12321L")
private List<Units> county;
}
package com.tykj.dev.device.user.read.controller;
/**
* @author dengdiyi
*/
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.read.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* @author dengdiyi
*/
@RestController
@Api(tags = "阅知模块", description = "阅知模块")
@AutoDocument
@RequestMapping("/read")
public class MessageController {
@Autowired
private MessageService messageService;
@ApiOperation(value = "阅知信息查询")
@GetMapping("/get")
public ResponseEntity getMessage(){
return ResponseEntity.ok(messageService.getList());
}
@ApiOperation(value = "提交已读阅知信息")
@PostMapping("/read/{id}")
public ResponseEntity readMessage(@PathVariable("id") int id){
return ResponseEntity.ok(messageService.read(id).parse2Bto().toVo());
}
@ApiOperation(value = "完成阅知信息")
@PostMapping("/complete/{id}")
public ResponseEntity completeMessage(@PathVariable("id") int id){
return ResponseEntity.ok(messageService.complete(id).parse2Bto().toVo());
}
}
package com.tykj.dev.device.user.read.repository;
import com.tykj.dev.device.user.read.subject.domin.Message;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
/**
* @author dengdiyi
*/
@Repository
public interface MessageDao extends JpaRepository<Message,Integer>, JpaSpecificationExecutor<Message> {
}
package com.tykj.dev.device.user.read.service;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.read.subject.domin.Message;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import java.util.List;
/**
* @author dengdiyi
*/
public interface MessageService {
MessageBto add(MessageBto messageBto);
Message update(Message message);
Message get(Integer id);
void delete(Integer id);
List<MessageUserVo> getList();
/**
* @param messageId 阅知信息id
* 阅读该信息
*/
Message read(Integer messageId);
/**
* @param messageId 阅知信息id
* 完成该阅知信息
*/
Message complete(Integer messageId);
}
package com.tykj.dev.device.user.read.service.impl;
import com.tykj.dev.device.user.read.repository.MessageDao;
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.read.subject.domin.Message;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author dengdiyi
*/
@Service
public class MessageServiceImpl implements MessageService {
@Autowired
private MessageDao messageDao;
@Autowired
private UserUtils userUtils;
@Override
public MessageBto add(MessageBto messageBto) {
return messageDao.save(messageBto.toDo()).parse2Bto();
}
@Override
public Message update(Message message) {
return messageDao.save(message);
}
@Override
public Message get(Integer id) {
Optional<Message> message = messageDao.findById(id);
if (message.isPresent()){
return message.get();
}
else {
throw new ApiException("Id不存在");
}
}
@Override
public void delete(Integer id) {
messageDao.deleteById(id);
}
@Override
public List<MessageUserVo> getList() {
Integer userId = userUtils.getCurrentUserId();
return messageDao.findAll().stream()
.map(Message::parse2Bto)
.filter(messageBto -> messageBto.getInvolveUserIdList().contains(userId)&&!messageBto.getCompleteUserIdList().contains(userId))
.map(MessageBto::toVo)
.sorted(Comparator.comparing(MessageUserVo::getCreateTime).reversed())
.collect(Collectors.toList());
}
/**
* @param messageId 阅知信息id
*/
@Override
public Message read(Integer messageId) {
Integer userId = userUtils.getCurrentUserId();
MessageBto messageBto = get(messageId).parse2Bto();
List<Integer> userIds = messageBto.getUserReadDetailList();
userIds.add(userId);
messageBto.setUserReadDetailList(userIds);
List<Integer> userIds2 = messageBto.getCompleteUserIdList();
userIds2.add(userId);
messageBto.setCompleteUserIdList(userIds2);
return messageDao.save(messageBto.toDo());
}
/**
* @param messageId 阅知信息id
* 完成该阅知信息
*/
@Override
public Message complete(Integer messageId) {
Integer userId = userUtils.getCurrentUserId();
MessageBto messageBto = get(messageId).parse2Bto();
List<Integer> userIds = messageBto.getCompleteUserIdList();
userIds.add(userId);
messageBto.setCompleteUserIdList(userIds);
return messageDao.save(messageBto.toDo());
}
}
package com.tykj.dev.device.user.read.subject.bto;
import com.tykj.dev.device.user.read.subject.domin.Message;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.SpringUtils;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author dengdiyi
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MessageBto {
@ApiModelProperty(name = "主键id")
private Integer id;
@ApiModelProperty(name = "阅知信息对应业务Id")
private Integer taskId;
@ApiModelProperty(value = "业务类型主键id")
private Integer businessType;
@ApiModelProperty(value = "信息内容")
private String content;
@ApiModelProperty(value = "阅知人员id类别")
private List<Integer> involveUserIdList;
@ApiModelProperty(value = "已完成人员id列表")
private List<Integer> completeUserIdList = new ArrayList<>();
@ApiModelProperty(value = "用户已读列表")
private List<Integer> userReadDetailList = new ArrayList<>();
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime;
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId;
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime;
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
/**
* bto类转化为do类
*/
public Message toDo() {
//复制相同属性
ModelMapper modelMapper = BeanHelper.getUserMapper();
Message message = modelMapper.map(this, Message.class);
//set组合字段
message.setInvolveUsers(StringSplitUtil.idListToString(this.involveUserIdList));
message.setUserReadDetail(StringSplitUtil.idListToString(this.userReadDetailList));
message.setCompleteUsers(StringSplitUtil.idListToString(this.completeUserIdList));
return message;
}
/**
* bto类转化为vo类
*/
public MessageUserVo toVo() {
UserUtils userUtils = SpringUtils.getBean("userUtils");
//复制相同属性
ModelMapper modelMapper = BeanHelper.getUserMapper();
MessageUserVo messageUserVo = modelMapper.map(this, MessageUserVo.class);
//set vo字段
if (userUtils!=null&&userReadDetailList.contains(userUtils.getCurrentUserId())){
messageUserVo.setIsRead(1);
}
return messageUserVo;
}
public MessageBto(Integer taskId, Integer businessType, String content, List<Integer> involveUserIdList) {
this.taskId = taskId;
this.businessType = businessType;
this.content = content;
this.involveUserIdList = involveUserIdList;
}
}
package com.tykj.dev.device.user.read.subject.domin;
import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.StringSplitUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.modelmapper.ModelMapper;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* 阅知信息表
* @author dengdiyi
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update message set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("阅知信息表")
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id")
private Integer id;
@ApiModelProperty(name = "阅知信息对应业务Id")
private Integer taskId;
@ApiModelProperty(value = "业务类型主键id")
private Integer businessType;
@ApiModelProperty(value = "信息内容")
private String content;
@ApiModelProperty(value = "阅知人员id(x作为分隔符),例如x1x2x,意为id为1,2的用户待阅知该信息")
private String involveUsers;
@ApiModelProperty(value = "已完成人员id(x作为分隔符),例如x1x2x,意为id为1,2的用户已完成阅知该信息")
private String completeUsers;
@ApiModelProperty(value = "用户阅读信息")
private String userReadDetail;
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId;
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime;
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId;
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime;
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
/**
* do类转化为bto类
*/
public MessageBto parse2Bto() {
//modelMap复制
ModelMapper mapper = BeanHelper.getUserMapper();
MessageBto messageBto = mapper.map(this, MessageBto.class);
//解析组合字段并添加
messageBto.setInvolveUserIdList(StringSplitUtil.userIdSplit(this.involveUsers));
messageBto.setUserReadDetailList(StringSplitUtil.userIdSplit(this.userReadDetail));
messageBto.setCompleteUserIdList(StringSplitUtil.userIdSplit(this.completeUsers));
return messageBto;
}
}
package com.tykj.dev.device.user.read.subject.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MessageUserVo {
@ApiModelProperty(name = "主键id")
private Integer id;
@ApiModelProperty(name = "阅知信息对应业务Id")
private Integer taskId;
@ApiModelProperty(value = "业务类型主键id")
private Integer businessType;
@ApiModelProperty(value = "信息内容")
private String content;
@ApiModelProperty(name = "当前用户是否已阅读(0:未读,1:已读)")
private Integer isRead = 0;
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime;
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId;
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime;
}
...@@ -79,4 +79,12 @@ public class UnitsController { ...@@ -79,4 +79,12 @@ public class UnitsController {
return ResponseEntity.ok(unitsService.selectPage(page,size)); return ResponseEntity.ok(unitsService.selectPage(page,size));
} }
@GetMapping("/train/list/{unitsId}")
@ApiOperation(value = "清退时选择培训单位的接口", notes = "成功返回单位对象")
public ResponseEntity selectPage( @PathVariable Integer unitsId){
return ResponseEntity.ok(unitsService.findByUserIdUnitsTrainListVo(unitsId));
}
} }
...@@ -10,6 +10,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser; ...@@ -10,6 +10,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.*; import com.tykj.dev.device.user.subject.service.*;
import com.tykj.dev.device.user.util.LogoutUtil; import com.tykj.dev.device.user.util.LogoutUtil;
import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -62,6 +63,9 @@ public class UserController { ...@@ -62,6 +63,9 @@ public class UserController {
MyUserDetailsServiceImpl myUserDetailsService; MyUserDetailsServiceImpl myUserDetailsService;
@Autowired @Autowired
LogoutUtil logout; LogoutUtil logout;
@Autowired
MyWebSocket myWebSocket;
// @PostMapping(value = "/login") // @PostMapping(value = "/login")
// @ApiOperation(value = "用户新增接口", notes = "添加成功返回用户对象") // @ApiOperation(value = "用户新增接口", notes = "添加成功返回用户对象")
// public ResponseEntity loginUser(@RequestBody LoginUser loginUser){ // public ResponseEntity loginUser(@RequestBody LoginUser loginUser){
...@@ -80,8 +84,9 @@ public class UserController { ...@@ -80,8 +84,9 @@ public class UserController {
@ApiOperation(value = "用户登出") @ApiOperation(value = "用户登出")
@GetMapping("/userLogout") @GetMapping("/userLogout")
public void logout() { public void logout(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
log.info("调用登出接口"); log.info("调用登出接口");
myWebSocket.Close(String.valueOf(securityUser.getCurrentUserInfo().getUserId()));
logout.logout(); logout.logout();
} }
...@@ -99,8 +104,8 @@ public class UserController { ...@@ -99,8 +104,8 @@ public class UserController {
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(value = "用户新增接口", notes = "添加成功返回用户对象") @ApiOperation(value = "用户新增接口", notes = "添加成功返回用户对象")
public ResponseEntity saveUser(@RequestBody User user) { public ResponseEntity saveUser(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser,@RequestBody User user) {
return ResponseEntity.ok(userService.save(user)); return ResponseEntity.ok(userService.save(user,securityUser));
} }
@GetMapping(value = "/delete/{userId}") @GetMapping(value = "/delete/{userId}")
...@@ -165,12 +170,12 @@ public class UserController { ...@@ -165,12 +170,12 @@ public class UserController {
return ResponseEntity.ok("修改密码成功"); return ResponseEntity.ok("修改密码成功");
} }
@GetMapping(value = "/get/train/{userId}") // @GetMapping(value = "/get/train/{userId}")
@ApiOperation(value = "根据用户id查询下级用户列表", notes = "成功返回UserTrainVo对象集合") // @ApiOperation(value = "根据用户id查询下级用户列表", notes = "成功返回UserTrainVo对象集合")
public ResponseEntity getFind(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @PathVariable Integer userId) { // public ResponseEntity getFind(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @PathVariable Integer userId) {
//
return ResponseEntity.ok(userService.findByIdUserTarinVo(userId)); // return ResponseEntity.ok(userService.findByIdUserTarinVo(userId));
} // }
@GetMapping(value = "/get/trainUnits/{userId}") @GetMapping(value = "/get/trainUnits/{userId}")
@ApiOperation(value = "根据用户id查询下级单位列表", notes = "成功返回UnitsTrainVo对象集合") @ApiOperation(value = "根据用户id查询下级单位列表", notes = "成功返回UnitsTrainVo对象集合")
...@@ -214,4 +219,11 @@ public class UserController { ...@@ -214,4 +219,11 @@ public class UserController {
return ResponseEntity.ok(venitalisService.registeredRet(venitalisVo)); return ResponseEntity.ok(venitalisService.registeredRet(venitalisVo));
} }
@GetMapping("/test")
@ApiOperation(value = "1111111111111", notes = "uuid")
public ResponseEntity getUuid1(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResponseEntity.ok(userService.findAllLastUserids(securityUser.getCurrentUserInfo().getUserId()));
}
} }
package com.tykj.dev.device.user.subject.controller;
/**
* @author zjm
* @version 1.0.0
* @ClassName AreaController.java
* @Description TODO
* @createTime 2020年09月04日 13:34:00
*/
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UserLogService;
import com.tykj.dev.misc.exception.ApiException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Optional;
/**
* 区域视图层
*/
@RestController
@AutoDocument
@Api(tags = "用户档案模块", description = "提供用户档案的接口")
@RequestMapping("/userLog")
public class UserLogController {
@Autowired
UserLogService userLogService;
@GetMapping("/find/select/{userId}")
@ApiOperation(value = "分页查询area对象", notes = "成功返回区域对象")
public ResponseEntity selectPage(@PathVariable Integer userId){
return ResponseEntity.ok(userLogService.findAllByuserID(userId));
}
}
...@@ -16,4 +16,5 @@ public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationE ...@@ -16,4 +16,5 @@ public interface UserDao extends JpaRepository<User, Integer>, JpaSpecificationE
List<User> findAllByUnitsIdIn(List<Integer> ids); List<User> findAllByUnitsIdIn(List<Integer> ids);
List<User> findAllByUserIdIn(List<Integer> userIds); List<User> findAllByUserIdIn(List<Integer> userIds);
} }
package com.tykj.dev.device.user.subject.dao;
import com.tykj.dev.device.user.subject.entity.UserLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
public interface UserLogDao extends JpaRepository<UserLog, Integer>, JpaSpecificationExecutor<UserLog> {
List<UserLog> findAllByUserIdOrderByTimeAsc(Integer userId);
}
...@@ -158,10 +158,6 @@ public class User { ...@@ -158,10 +158,6 @@ public class User {
return mapper.map(this, HandoverUser.class); return mapper.map(this, HandoverUser.class);
} }
public UserTrainVo toUserTrainVo() {
ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, UserTrainVo.class);
}
public UserSuperiorVo toUserSuperiorVo() { public UserSuperiorVo toUserSuperiorVo() {
ModelMapper mapper = BeanHelper.getUserMapper(); ModelMapper mapper = BeanHelper.getUserMapper();
......
package com.tykj.dev.device.user.subject.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
/**
* @author zjm
* @version 1.0.0
* @ClassName UserLog.java
* @Description 用户日志对象
* @createTime 2020年12月01日 14:37:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@ApiModel(value = "用户日志对象", description = "用户log")
public class UserLog {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "id", name = "id")
private Integer id;
@ApiModelProperty(value = "用户id", name = "userId")
private Integer userId;
@ApiModelProperty(value = "时间", name = "time")
private Date time;
@ApiModelProperty(value = "内容", name = "content")
private String content;
public UserLog(Integer userId, Date time, String content) {
this.userId = userId;
this.time = time;
this.content = content;
}
}
...@@ -30,4 +30,6 @@ public interface AreaService extends PublicService<Area> { ...@@ -30,4 +30,6 @@ public interface AreaService extends PublicService<Area> {
AreaPage selectPage(Integer page,Integer size); AreaPage selectPage(Integer page,Integer size);
Area findByid(Integer areaId);
} }
package com.tykj.dev.device.user.subject.service; package com.tykj.dev.device.user.subject.service;
import com.tykj.dev.device.user.base.ret.AreaVo; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.base.ret.UnitsPage;
import com.tykj.dev.device.user.base.ret.UnitsTrainVo;
import com.tykj.dev.device.user.base.ret.UnitsVo;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
...@@ -22,6 +19,11 @@ public interface UnitsService extends PublicService<Units> { ...@@ -22,6 +19,11 @@ public interface UnitsService extends PublicService<Units> {
List<Units> findListById(Integer leven); List<Units> findListById(Integer leven);
/**
* 装备管理 人员管理 组织结构列表
* @param securityUser
* @return
*/
List<AreaVo> findListAreaUnitsVo(SecurityUser securityUser); List<AreaVo> findListAreaUnitsVo(SecurityUser securityUser);
List<Units> findListlevenGreaterThanEqual(Integer leven); List<Units> findListlevenGreaterThanEqual(Integer leven);
...@@ -72,4 +74,12 @@ public interface UnitsService extends PublicService<Units> { ...@@ -72,4 +74,12 @@ public interface UnitsService extends PublicService<Units> {
UnitsPage selectPage(Integer page, Integer size); UnitsPage selectPage(Integer page, Integer size);
}
/**
* 根据用户查询 可当前单位的下级单位
* @param userId 当前用户id
* @return 单位集合
*/
List<Units> findByUserIdUnitsTrainListVo(Integer unitsId);
}
package com.tykj.dev.device.user.subject.service;
import com.tykj.dev.device.user.subject.entity.UserLog;
import java.util.List;
public interface UserLogService extends PublicService<UserLog>{
List<UserLog> findAllByuserID(Integer userId);
}
...@@ -2,6 +2,8 @@ package com.tykj.dev.device.user.subject.service; ...@@ -2,6 +2,8 @@ package com.tykj.dev.device.user.subject.service;
import com.tykj.dev.device.user.base.ret.*; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import java.util.List; import java.util.List;
...@@ -22,6 +24,8 @@ public interface UserService extends PublicService<User> { ...@@ -22,6 +24,8 @@ public interface UserService extends PublicService<User> {
*/ */
User findByUserName(String userName); User findByUserName(String userName);
User save(User user, SecurityUser securityUser);
/** /**
* 查询同级人员 * 查询同级人员
* *
...@@ -74,7 +78,7 @@ public interface UserService extends PublicService<User> { ...@@ -74,7 +78,7 @@ public interface UserService extends PublicService<User> {
* @param userId 用户ID * @param userId 用户ID
* @return 用户集合 * @return 用户集合
*/ */
List<UserTrainVo> findByIdUserTarinVo(Integer userId); // List<UserTrainVo> findByIdUserTarinVo(Integer userId);
/** /**
...@@ -91,7 +95,7 @@ public interface UserService extends PublicService<User> { ...@@ -91,7 +95,7 @@ public interface UserService extends PublicService<User> {
* @param userId * @param userId
* @return * @return
*/ */
List<UserTrainVo> findByIdListUserTarinVo(List<Integer> userId); // List<UserTrainVo> findByIdListUserTarinVo(List<Integer> userId);
/** /**
...@@ -107,4 +111,21 @@ public interface UserService extends PublicService<User> { ...@@ -107,4 +111,21 @@ public interface UserService extends PublicService<User> {
* 根据用户ID查询上级单位所有用户 * 根据用户ID查询上级单位所有用户
*/ */
List<UserSuperiorVo> findUserSuperiorVo(Integer userId); List<UserSuperiorVo> findUserSuperiorVo(Integer userId);
/**
* 根据单位id集合查询用户
*/
List<User> findUnitsIdInUsers(List<Integer> units);
/**
* 根据用户id集合查询用户
*/
List<User> findAllUserIdInUser(List<Integer> userIds);
/**
* 根据单位id查询 上级的用户id
*/
List<Integer> findAllLastUserids(Integer userId);
} }
...@@ -111,6 +111,11 @@ public class AreaServiceImpl implements AreaService { ...@@ -111,6 +111,11 @@ public class AreaServiceImpl implements AreaService {
.build(); .build();
} }
@Override
public Area findByid(Integer areaId) {
return areaDao.findById(areaId).get();
}
private List<UnitsVo> subordinateAllUnits(List<UnitsVo> units, Area area) { private List<UnitsVo> subordinateAllUnits(List<UnitsVo> units, Area area) {
List<Area> list = areaDao.findAllByFatherId(area.getId()); List<Area> list = areaDao.findAllByFatherId(area.getId());
if (list.size() == 0) { if (list.size() == 0) {
......
...@@ -68,6 +68,34 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -68,6 +68,34 @@ public class UnitsServiceImpl implements UnitsService {
} }
List<Area> areas= areaDao.findAllByFatherId(areaId); List<Area> areas= areaDao.findAllByFatherId(areaId);
if (areas.size()!=0) { if (areas.size()!=0) {
areaVos=provinceAndCity(belongsArea,areas,areaVos);
}else {
int i=0;
AreaVo areaVo = belongsArea.toVo();
areaVo.setFrontEnd(i++);
List<UnitsVo> unitsList = unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toVo).collect(Collectors.toList());
for (UnitsVo unitsVo : unitsList) {
unitsVo.setFrontEnd(i++);
}
areaVo.setUnits(unitsList);
areaVos.add(areaVo);
}
//查询区域下所有的区域
//根据区域查看
return areaVos;
}
/**
* 根据所在区域是省还是市
* 省 则把下属市以及市下属都区都单位统一放入市AreaVo 在放入List<AreaVo> 集合中。
* 市 则把下属区都单位放入市都AreaVo对象中
* @param thisArea 本单位区域
* @param areas 下级区域列表
*/
private List<AreaVo> provinceAndCity(Area thisArea,List<Area> areas,List<AreaVo> areaVos){
AreaVo thisAreaVo=thisArea.toVo();
if (thisArea.getType()==1) {
areas.forEach(area -> { areas.forEach(area -> {
int i = 1; int i = 1;
AreaVo areaVo = area.toVo(); AreaVo areaVo = area.toVo();
...@@ -84,23 +112,29 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -84,23 +112,29 @@ public class UnitsServiceImpl implements UnitsService {
areaVo.setUnits(unitsList); areaVo.setUnits(unitsList);
areaVos.add(areaVo); areaVos.add(areaVo);
}); });
}else { }else if (thisArea.getType()==2){
int i=0; List<UnitsVo> unitsLists = unitsDao.findAllByAreaId(thisArea.getId()).stream().map(Units::toVo).collect(Collectors.toList());
AreaVo areaVo = belongsArea.toVo(); for (UnitsVo unitsVo : unitsLists) {
areaVo.setFrontEnd(i++); unitsVo.setFrontEnd(5000);
List<UnitsVo> unitsList = unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toVo).collect(Collectors.toList());
for (UnitsVo unitsVo : unitsList) {
unitsVo.setFrontEnd(i++);
} }
areaVo.setUnits(unitsList); thisAreaVo.setUnits(unitsLists);
areaVos.add(areaVo); areas.forEach(area -> {
int i = 1;
thisAreaVo.setFrontEnd(i++);
List<UnitsVo> unitsList = unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toVo).collect(Collectors.toList());
for (UnitsVo unitsVo : unitsList) {
unitsVo.setFrontEnd(i++);
}
thisAreaVo.getUnits().addAll(unitsList);
});
areaVos.add(thisAreaVo);
}else {
return areaVos;
} }
//查询区域下所有的区域
//根据区域查看
return areaVos; return areaVos;
} }
@Override @Override
public List<Units> findListlevenGreaterThanEqual(Integer leven) { public List<Units> findListlevenGreaterThanEqual(Integer leven) {
return unitsDao.findAllByLevelGreaterThanEqual(leven); return unitsDao.findAllByLevelGreaterThanEqual(leven);
...@@ -167,6 +201,37 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -167,6 +201,37 @@ public class UnitsServiceImpl implements UnitsService {
.build(); .build();
} }
@Override
public List<Units> findByUserIdUnitsTrainListVo(Integer unitsId) {
// List<Units> province=new ArrayList<>();
// List<Units> city=new ArrayList<>();
// List<Units> county=new ArrayList<>();
Optional<Units> unitsOptional = unitsDao.findById(unitsId);
if (unitsOptional.isPresent()) {
Units units=unitsOptional.get();
List<Integer> areaIds = areaDao.findAllByFatherId(units.getAreaId()).stream().map(Area::getId).collect(Collectors.toList());
// if (areaIds.size() != 0) {
// unitsDao.findAllByAreaIdIn(areaIds).forEach(
// units1 -> {
// if (units1.getLevel()==1){
// province.add(units1);
// }else if (units1.getLevel()==2){
// city.add(units1);
// }else if (units1.getLevel()==3){
// county.add(units1);
// }else {
// log.info("[清退] 没有找到对应的单位id");
// }
// }
// );
// }
return unitsDao.findAllByAreaIdIn(areaIds);
}else {
throw new ApiException(ResponseEntity.status(500).body("单位没有查到"));
}
}
@Override @Override
public Units save(Units units) { public Units save(Units units) {
Optional<Area> optionalArea = areaDao.findById(units.getAreaId()); Optional<Area> optionalArea = areaDao.findById(units.getAreaId());
......
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.subject.dao.UserLogDao;
import com.tykj.dev.device.user.subject.entity.UserLog;
import com.tykj.dev.device.user.subject.service.UserLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName UserLogServiceImpl.java
* @Description TODO
* @createTime 2020年12月01日 15:46:00
*/
@Service
public class UserLogServiceImpl implements UserLogService {
@Autowired
UserLogDao userLogDao;
@Override
public UserLog save(UserLog userLog) {
return userLogDao.save(userLog);
}
@Override
public boolean delete(Integer id) {
return false;
}
@Override
public List<UserLog> findAll() {
return userLogDao.findAll();
}
@Override
public UserLog update(UserLog userLog) {
return userLogDao.save(userLog);
}
@Override
public List<UserLog> findAllByuserID(Integer userId) {
return userLogDao.findAllByUserIdOrderByTimeAsc(userId);
}
}
package com.tykj.dev.device.user.subject.service.impl; package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.base.ret.*; import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.subject.dao.MgrcertDao; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.subject.dao.UserDao; import com.tykj.dev.device.user.read.subject.bto.MessageBto;
import com.tykj.dev.device.user.subject.dao.UserRoleDao; import com.tykj.dev.device.user.subject.dao.*;
import com.tykj.dev.device.user.subject.entity.Mgrcert; import com.tykj.dev.device.user.subject.entity.*;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.entity.UserRole;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserLogService;
import com.tykj.dev.device.user.subject.service.UserService; import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -40,6 +38,42 @@ public class UserServiceImpl implements UserService { ...@@ -40,6 +38,42 @@ public class UserServiceImpl implements UserService {
UnitsService unitsService; UnitsService unitsService;
@Autowired @Autowired
UserRoleDao userRoleDao; UserRoleDao userRoleDao;
@Autowired
UserLogService userLogService;
@Autowired
AreaService areaService;
@Autowired
UnitsDao unitsDao;
@Autowired
MessageService messageService;
@Override
public User save(User user, SecurityUser securityUser) {
String encode = bCryptPasswordEncoder.encode("qwer1234");
user.setPassword(encode);
Units units = unitsService.findById(user.getUnitsId());
User user1 = userDao.save(user);
switch (units.getLevel()){
case 1:
userRoleDao.save(new UserRole(user1.getUserId(),1));
break;
case 2:
userRoleDao.save(new UserRole(user1.getUserId(),2));
break;
case 3:
userRoleDao.save(new UserRole(user1.getUserId(),3));
break;
default:
log.info("[user] 添加转管员单位等级不存在:{}",units.getLevel());
}
messageService.add(new MessageBto(0,0,securityUser.getUsername()+"添加专管员"+user1.getUsername(),this.findAllLastUserids(securityUser.getCurrentUserInfo().getUserId())));
userLogService.save(new UserLog(user1.getUserId(),new Date(),"专管员任命成功"));
return user1;
}
/** /**
* 给密码加密bCryptPasswordEncoder * 给密码加密bCryptPasswordEncoder
...@@ -62,11 +96,12 @@ public class UserServiceImpl implements UserService { ...@@ -62,11 +96,12 @@ public class UserServiceImpl implements UserService {
break; break;
case 3: case 3:
userRoleDao.save(new UserRole(user1.getUserId(),3)); userRoleDao.save(new UserRole(user1.getUserId(),3));
break; break;
default: default:
log.info("[user] 添加转管员单位等级不存在:{}",units.getLevel()); log.info("[user] 添加转管员单位等级不存在:{}",units.getLevel());
} }
userLogService.save(new UserLog(user1.getUserId(),new Date(),"专管员任命成功"));
return user1; return user1;
} }
...@@ -91,6 +126,7 @@ public class UserServiceImpl implements UserService { ...@@ -91,6 +126,7 @@ public class UserServiceImpl implements UserService {
return userDao.findByUsername(userName); return userDao.findByUsername(userName);
} }
@Override @Override
public List<UserShenRe> findByUserId(Integer userId) { public List<UserShenRe> findByUserId(Integer userId) {
...@@ -242,26 +278,26 @@ public class UserServiceImpl implements UserService { ...@@ -242,26 +278,26 @@ public class UserServiceImpl implements UserService {
} }
@Override // @Override
public List<UserTrainVo> findByIdUserTarinVo(Integer userId) { // public List<UserTrainVo> findByIdUserTarinVo(Integer userId) {
List<UserTrainVo> list = new ArrayList<>(); // List<UserTrainVo> list = new ArrayList<>();
Integer unitsId = userDao.findById(userId).get().getUnitsId(); // Integer unitsId = userDao.findById(userId).get().getUnitsId();
Units units = unitsService.findById(unitsId); // Units units = unitsService.findById(unitsId);
userDao.findAllByUnitsIdIn(unitsService.findListSubordinateId(unitsId)).forEach( // userDao.findAllByUnitsIdIn(unitsService.findListSubordinateId(unitsId)).forEach(
user -> { // user -> {
UserTrainVo userTrainVo = user.toUserTrainVo(); // UserTrainVo userTrainVo = user.toUserTrainVo();
if (user.getTrainStatus() == 1 || user.getTrainStatus() == 2) { // if (user.getTrainStatus() == 1 || user.getTrainStatus() == 2) {
userTrainVo.setIsMustJoin(0); // userTrainVo.setIsMustJoin(0);
} else { // } else {
userTrainVo.setIsMustJoin(1); // userTrainVo.setIsMustJoin(1);
} // }
userTrainVo.setUnitsName(unitsService.findById(user.getUnitsId()).getName()); // userTrainVo.setUnitsName(unitsService.findById(user.getUnitsId()).getName());
list.add(userTrainVo); // list.add(userTrainVo);
} // }
); // );
list.sort(Comparator.comparing(UserTrainVo::getIsMustJoin).reversed()); // list.sort(Comparator.comparing(UserTrainVo::getIsMustJoin).reversed());
return list; // return list;
} // }
@Override @Override
public List<UnitsTrainVo> findByIdUnitsTrainVo(Integer userId) { public List<UnitsTrainVo> findByIdUnitsTrainVo(Integer userId) {
...@@ -269,23 +305,23 @@ public class UserServiceImpl implements UserService { ...@@ -269,23 +305,23 @@ public class UserServiceImpl implements UserService {
} }
@Override // @Override
public List<UserTrainVo> findByIdListUserTarinVo(List<Integer> userId) { // public List<UserTrainVo> findByIdListUserTarinVo(List<Integer> userId) {
List<UserTrainVo> list = new ArrayList<>(); // List<UserTrainVo> list = new ArrayList<>();
userDao.findAllByUserIdIn(userId).forEach( // userDao.findAllByUserIdIn(userId).forEach(
user -> { // user -> {
UserTrainVo userTrainVo = user.toUserTrainVo(); // UserTrainVo userTrainVo = user.toUserTrainVo();
if (user.getTrainStatus() == 1 || user.getTrainStatus() == 2) { // if (user.getTrainStatus() == 1 || user.getTrainStatus() == 2) {
userTrainVo.setIsMustJoin(0); // userTrainVo.setIsMustJoin(0);
} else { // } else {
userTrainVo.setIsMustJoin(1); // userTrainVo.setIsMustJoin(1);
} // }
userTrainVo.setUnitsName(unitsService.findById(user.getUnitsId()).getName()); // userTrainVo.setUnitsName(unitsService.findById(user.getUnitsId()).getName());
list.add(userTrainVo); // list.add(userTrainVo);
} // }
); // );
return list; // return list;
} // }
@Override @Override
public HandoverUser findByIdHandoverUser(Integer userId) { public HandoverUser findByIdHandoverUser(Integer userId) {
...@@ -320,5 +356,35 @@ public class UserServiceImpl implements UserService { ...@@ -320,5 +356,35 @@ public class UserServiceImpl implements UserService {
return list; return list;
} }
@Override
public List<User> findUnitsIdInUsers(List<Integer> units) {
return userDao.findAllByUnitsIdIn(units);
}
@Override
public List<User> findAllUserIdInUser(List<Integer> userIds) {
return userDao.findAllByUserIdIn(userIds);
}
@Override
public List<Integer> findAllLastUserids(Integer userId) {
User user=userDao.findById(userId).get();
Units units= unitsDao.findById(user.getUnitsId()).get();
Area area= areaService.findByid(units.getAreaId());
return to(new ArrayList<>(),area);
}
private List<Integer> to(List<Integer> ids,Area area){
if (area.getFatherId()==null){
return ids;
}
Area area1= areaService.findByid(area.getFatherId());
List<Units> units= unitsDao.findAllByAreaId(area1.getId());
ids.addAll(userDao.findAllByUnitsId(units.get(0).getUnitId()).stream().map(User::getUserId).collect(Collectors.toList()));
return to(ids,area1);
}
} }
...@@ -3,7 +3,9 @@ package com.tykj.dev.device.user.subject.service.impl; ...@@ -3,7 +3,9 @@ package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.base.req.VenitalisVo; import com.tykj.dev.device.user.base.req.VenitalisVo;
import com.tykj.dev.device.user.base.ret.RegistereRetVo; import com.tykj.dev.device.user.base.ret.RegistereRetVo;
import com.tykj.dev.device.user.subject.dao.UserDao; import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.dao.UserLogDao;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.entity.UserLog;
import com.tykj.dev.device.user.subject.entity.venaDigitalis.ContrastRet; import com.tykj.dev.device.user.subject.entity.venaDigitalis.ContrastRet;
import com.tykj.dev.device.user.subject.entity.venaDigitalis.RegisteredRet; import com.tykj.dev.device.user.subject.entity.venaDigitalis.RegisteredRet;
import com.tykj.dev.device.user.subject.service.VenitalisService; import com.tykj.dev.device.user.subject.service.VenitalisService;
...@@ -12,10 +14,12 @@ import com.tykj.dev.misc.utils.JacksonUtil; ...@@ -12,10 +14,12 @@ import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.httpclientutil.HttpClientUtil; import com.tykj.dev.misc.utils.httpclientutil.HttpClientUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.i18nformatter.qual.I18nFormat; import org.checkerframework.checker.i18nformatter.qual.I18nFormat;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -31,6 +35,8 @@ import java.util.Map; ...@@ -31,6 +35,8 @@ import java.util.Map;
public class VenitalisServiceImpl implements VenitalisService { public class VenitalisServiceImpl implements VenitalisService {
@Autowired @Autowired
private UserDao userDao; private UserDao userDao;
@Autowired
private UserLogDao userLogDao;
private final static String http="http://192.168.0.80:8081"; private final static String http="http://192.168.0.80:8081";
...@@ -59,6 +65,7 @@ public class VenitalisServiceImpl implements VenitalisService { ...@@ -59,6 +65,7 @@ public class VenitalisServiceImpl implements VenitalisService {
RegistereRetVo registereRetVo=new RegistereRetVo(); RegistereRetVo registereRetVo=new RegistereRetVo();
if (registeredRet.getReg_result().equals("ok") && registeredRet.getResult_code().equals("ok")){ if (registeredRet.getReg_result().equals("ok") && registeredRet.getResult_code().equals("ok")){
registereRetVo.setRet(true); registereRetVo.setRet(true);
userLogDao.save(new UserLog(venitalisVo.getUserId(),new Date(),user.getName()+"注册了指静脉"));
return registereRetVo; return registereRetVo;
}else { }else {
registereRetVo.setRet(false); registereRetVo.setRet(false);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version> <version>2.1.4.RELEASE</version>
</parent> </parent>
<modules> <modules>
<module>dev-socket</module> <module>dev-socket</module>
<module>dev-blockcha</module> <module>dev-blockcha</module>
...@@ -117,6 +118,7 @@ ...@@ -117,6 +118,7 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-allot</artifactId> <artifactId>dev-allot</artifactId>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论