提交 5aa5c7b5 authored 作者: 133's avatar 133

[zjm] 代码提交

上级 09a3b44c
...@@ -391,11 +391,11 @@ public class AllotBillController { ...@@ -391,11 +391,11 @@ public class AllotBillController {
// if (allotReceiveVo.getBillFileName()!=null&&allotReceiveVo.getBillFileUrl()!=null) { // if (allotReceiveVo.getBillFileName()!=null&&allotReceiveVo.getBillFileUrl()!=null) {
// fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl())); // fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl()));
// } // }
if (allotReceiveVo.getReceiveFiles()!=null&&allotReceiveVo.getReceiveFiles().size()>0){ if (allotReceiveVo.getReceiveFileList()!=null&&allotReceiveVo.getReceiveFileList().size()>0){
allotReceiveVo.getReceiveFiles().forEach(fileRet -> { allotReceiveVo.getReceiveFileList().forEach(fileRet -> {
fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath())); fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath()));
}); });
allotBillEntity.setReceiveFiles(FilesUtil.stringFileToList(allotReceiveVo.getReceiveFiles())); allotBillEntity.setReceiveFiles(FilesUtil.stringFileToList(allotReceiveVo.getReceiveFileList()));
} }
if (allotReceiveVo.getRightSignatureId()!=null&&!"".equals(allotReceiveVo.getRightSignatureId())) { if (allotReceiveVo.getRightSignatureId()!=null&&!"".equals(allotReceiveVo.getRightSignatureId())) {
allotBillEntity.setRightSignatureId(allotReceiveVo.getRightSignatureId()); allotBillEntity.setRightSignatureId(allotReceiveVo.getRightSignatureId());
......
...@@ -67,7 +67,7 @@ public class AllotReceiveVo { ...@@ -67,7 +67,7 @@ public class AllotReceiveVo {
private Integer status = 0; private Integer status = 0;
@ApiModelProperty(value = "接收方配发单") @ApiModelProperty(value = "接收方配发单")
private List<FileRet> receiveFiles; private List<FileRet> receiveFileList;
@ApiModelProperty(value = "收件单位签章id") @ApiModelProperty(value = "收件单位签章id")
private String rightSignatureId; private String rightSignatureId;
......
...@@ -91,7 +91,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -91,7 +91,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
public TaskBto saveDeviceDecommissioningDraft(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) { public TaskBto saveDeviceDecommissioningDraft(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) {
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units = unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
DeviceDecommissioningDetail deviceDecommissioningDetail=decommissioningOrderOutData.toDeviceDecommissioningDetail(); DeviceDecommissioningDetail deviceDecommissioningDetail;
TaskBto taskBto; TaskBto taskBto;
List<ScriptSaveVo> scriptSaveVos = decommissioningOrderOutData.getScriptSaveVos(); List<ScriptSaveVo> scriptSaveVos = decommissioningOrderOutData.getScriptSaveVos();
List<String> seqNumbers = new ArrayList<>(); List<String> seqNumbers = new ArrayList<>();
...@@ -103,6 +103,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -103,6 +103,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
} }
); );
if (decommissioningOrderOutData.getTaskId()==null){ if (decommissioningOrderOutData.getTaskId()==null){
deviceDecommissioningDetail = decommissioningOrderOutData.toDeviceDecommissioningDetail();
if (decommissioningOrderOutData.getApplyId()!=null) { if (decommissioningOrderOutData.getApplyId()!=null) {
DeviceDecommissioningDetail deviceDestroyBill1 = deviceDecommissioningDetailService.findApplyId(decommissioningOrderOutData.getApplyId()); DeviceDecommissioningDetail deviceDestroyBill1 = deviceDecommissioningDetailService.findApplyId(decommissioningOrderOutData.getApplyId());
if (deviceDestroyBill1 != null) { if (deviceDestroyBill1 != null) {
...@@ -116,10 +117,10 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -116,10 +117,10 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"保存退役任务草稿",gainThisUser(userId,units.getUnitId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),user.getName()+"保存退役任务草稿",gainThisUser(userId,units.getUnitId())));
}else { }else {
taskBto=taskService.get(decommissioningOrderOutData.getTaskId()); taskBto=taskService.get(decommissioningOrderOutData.getTaskId());
DeviceDecommissioningDetail deviceDecommissioningDetail1 = deviceDecommissioningDetailService.findDeviceDecommissioningDetail(taskBto.getBillId()); deviceDecommissioningDetail = deviceDecommissioningDetailService.findDeviceDecommissioningDetail(taskBto.getBillId());
deviceDecommissioningDetail.setId(deviceDecommissioningDetail1.getId());
deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus()); deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus());
deviceDecommissioningDetail.setNum(deviceDecommissioningDetail1.getNum()); deviceDecommissioningDetail.setSendUserbId(decommissioningOrderOutData.getSendUserbId());
deviceDecommissioningDetail.setSenderUserB(decommissioningOrderOutData.getSenderUserB());
} }
deviceDecommissioningDetail.setOutboundFile(FilesUtil.stringFileToList(decommissioningOrderOutData.getOutboundFileList())); deviceDecommissioningDetail.setOutboundFile(FilesUtil.stringFileToList(decommissioningOrderOutData.getOutboundFileList()));
deviceDecommissioningDetail.setApplyNumber(decommissioningOrderOutData.getApplyNumber()); deviceDecommissioningDetail.setApplyNumber(decommissioningOrderOutData.getApplyNumber());
......
...@@ -74,13 +74,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -74,13 +74,9 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
@Override @Override
public TaskBto saveDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) { public TaskBto saveDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) {
TaskBto taskBto; TaskBto taskBto;
DeviceDestroyBill deviceDestroyBill= deviceDestroyBillVo.toDeviceDestroyBill(); DeviceDestroyBill deviceDestroyBill;
deviceDestroyBill.setApplyNumber(deviceDestroyBillVo.getApplyNumber());
deviceDestroyBill.setReplayNumber(deviceDestroyBillVo.getReplayNumber());
deviceDestroyBill.setApplyFiles(FilesUtil.stringFileToList(deviceDestroyBill.getApplyFileList()));
deviceDestroyBill.setReplayFiles(FilesUtil.stringFileToList(deviceDestroyBill.getReplayFileList()));
deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBill.getScripts()));
if (deviceDestroyBillVo.getTaskId()==null){ if (deviceDestroyBillVo.getTaskId()==null){
deviceDestroyBill= deviceDestroyBillVo.toDeviceDestroyBill();
if (deviceDestroyBillVo.getApplyId()!=null) { if (deviceDestroyBillVo.getApplyId()!=null) {
Optional<DeviceDestroyBill> deviceDestroyBill1 = deviceDestroyBillService.findApplyId(deviceDestroyBillVo.getApplyId()); Optional<DeviceDestroyBill> deviceDestroyBill1 = deviceDestroyBillService.findApplyId(deviceDestroyBillVo.getApplyId());
if (deviceDestroyBill1.isPresent()) { if (deviceDestroyBill1.isPresent()) {
...@@ -94,11 +90,15 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -94,11 +90,15 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"保存销毁任务草稿",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"保存销毁任务草稿",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
}else { }else {
taskBto=taskService.get(deviceDestroyBillVo.getTaskId()); taskBto=taskService.get(deviceDestroyBillVo.getTaskId());
DeviceDestroyBill deviceDestroyBill1= deviceDestroyBillService.findDeviceDestroyBill(taskBto.getBillId()); deviceDestroyBill= deviceDestroyBillService.findDeviceDestroyBill(taskBto.getBillId());
deviceDestroyBill.setId(deviceDestroyBill1.getId());
deviceDestroyBill.setNum(deviceDestroyBill1.getNum());
deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus()); deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus());
} }
deviceDestroyBill.setDestroyTime(deviceDestroyBillVo.getDestroyTime());
deviceDestroyBill.setApplyNumber(deviceDestroyBillVo.getApplyNumber());
deviceDestroyBill.setReplayNumber(deviceDestroyBillVo.getReplayNumber());
deviceDestroyBill.setApplyFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getApplyFileList()));
deviceDestroyBill.setReplayFiles(FilesUtil.stringFileToList(deviceDestroyBillVo.getReplayFileList()));
deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBillVo.getScripts()));
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
return taskBto; return taskBto;
} }
......
...@@ -210,7 +210,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -210,7 +210,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setId(null); deviceRepelDetail.setId(null);
long time=System.currentTimeMillis(); long time=System.currentTimeMillis();
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers,lifeStatus); Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers,lifeStatus);
log.info("count 时间:{}",System.currentTimeMillis()-time);
if (count!=0) { if (count!=0) {
TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(), userId); TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
...@@ -311,21 +310,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -311,21 +310,22 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(),userId); TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(),userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(),repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(),repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
} }
}else { }
//添加本级清退任务 // else {
//后面和区县的一起提交给省 // //添加本级清退任务
deviceRepelDetail.setId(null); // //后面和区县的一起提交给省
deviceRepelDetail.setSendUnit(units.getName()); // deviceRepelDetail.setId(null);
deviceRepelDetail.setSendUnitId(units.getUnitId()); // deviceRepelDetail.setSendUnit(units.getName());
deviceRepelDetail.setRepelType(3); // deviceRepelDetail.setSendUnitId(units.getUnitId());
List<String> unitNames=new ArrayList<>(); // deviceRepelDetail.setRepelType(3);
unitNames.add(units.getName()); // List<String> unitNames=new ArrayList<>();
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitNames, DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus); // unitNames.add(units.getName());
if(count!=0) { // Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitNames, DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus);
TaskBto taskBto1 = cityDeclaredTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), units.getName(),userId); // if(count!=0) {
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, "省本级", repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); // TaskBto taskBto1 = cityDeclaredTask(units.getUnitId(), deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), taskBto.getId(), units.getName(),userId);
} // list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, "省本级", repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
} // }
// }
} }
); );
if (list==null||list.size()==0){ if (list==null||list.size()==0){
...@@ -535,6 +535,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -535,6 +535,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
orderOutDataRepelDetail.setId(deviceRepelDetail.getId()); orderOutDataRepelDetail.setId(deviceRepelDetail.getId());
orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId()); orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId());
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds()); orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime());
orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId());
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString()); orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId()); orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId());
orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList())); orderOutDataRepelDetail.setReplyFiles(FilesUtil.stringFileToList(orderOutData.getReplyFileList()));
...@@ -571,6 +573,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -571,6 +573,8 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
DeviceRepelDetail orderOutDataRepelDetail =orderOutData.toTrainDetailsVo(); DeviceRepelDetail orderOutDataRepelDetail =orderOutData.toTrainDetailsVo();
orderOutDataRepelDetail.setId(deviceRepelDetail.getId()); orderOutDataRepelDetail.setId(deviceRepelDetail.getId());
orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId()); orderOutDataRepelDetail.setRepelId(deviceRepelDetail.getRepelId());
orderOutDataRepelDetail.setCreateTime(deviceRepelDetail.getCreateTime());
orderOutDataRepelDetail.setCreateUserId(deviceRepelDetail.getCreateUserId());
orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds()); orderOutDataRepelDetail.setDeviceIds(deviceRepelDetail.getDeviceIds());
orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString()); orderOutDataRepelDetail.setRightSignatureId(UUID.randomUUID().toString());
orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId()); orderOutDataRepelDetail.setNum("NO:第"+ LocalDateTime.now().getYear()+"QT"+taskBto.getBillId());
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>misc</artifactId> <artifactId>misc</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-excel</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
......
package com.tykj.dev.device.train.controller; package com.tykj.dev.device.train.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.hutool.poi.excel.ExcelUtil;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.excel.utils.ExcelStyleUtil;
import com.tykj.dev.device.library.subject.vo.DeviceExcel;
import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.TrainUser;
import com.tykj.dev.device.train.entity.vo.ConditionsTrainVo; import com.tykj.dev.device.train.entity.vo.ConditionsTrainVo;
import com.tykj.dev.device.train.entity.vo.TrainUserExcelVo;
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.service.MgrcertService; import com.tykj.dev.device.user.subject.service.MgrcertService;
import com.tykj.dev.device.user.subject.service.UnitsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author zjm * @author zjm
...@@ -35,6 +55,9 @@ public class TrainController { ...@@ -35,6 +55,9 @@ public class TrainController {
@Autowired @Autowired
UnitsDao unitsDao; UnitsDao unitsDao;
@Autowired
UnitsService unitsService;
/** /**
* 培训列表查询接口(分页) * 培训列表查询接口(分页)
* *
...@@ -66,5 +89,25 @@ public class TrainController { ...@@ -66,5 +89,25 @@ public class TrainController {
return ResponseEntity.ok(trainThemeService.findBytaskId(taskId)); return ResponseEntity.ok(trainThemeService.findBytaskId(taskId));
} }
/**
* 查询培训的单位组织结构 省以下,不包括直属单位
*/
@GetMapping("/unit")
@ApiOperation(value = "省培训发证审核以及市培训申请发证审核调用接口", notes = "同意培训完成")
public ResponseEntity selectTrainUnitsOrganization(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
return ResponseEntity.ok(unitsService.findLeftNavigationNotDirectlyUnit(securityUser));
}
@PostMapping("/export/trainUser/{trainId}")
@ApiOperation(value = "导出培训人员信息", notes = "导出培训人员信息")
public ResponseEntity selectTrainUnitsOrganization(@PathVariable Integer trainId, HttpServletRequest request, HttpServletResponse response){
TrainTheme trainTheme= trainThemeService.findById(trainId);
List<TrainUserExcelVo> trainUsers=trainThemeService.findAllTrainUserByTrainId(trainId).stream().map(TrainUser::toTrainUserExcelVo).collect(Collectors.toList());
ExportParams exportParams = new ExportParams(trainTheme.getName()+"参加人员名单",trainTheme.getName()+"参加人员名单", ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TrainUserExcelVo.class, trainUsers);
com.tykj.dev.device.excel.utils.ExcelUtil.downloadExcel(request, response, workbook, trainTheme.getName()+"参加人员名单");
return ResponseEntity.ok("ok");
}
} }
...@@ -9,8 +9,10 @@ import com.tykj.dev.device.task.service.TaskLogService; ...@@ -9,8 +9,10 @@ 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.TrainUnitDao;
import com.tykj.dev.device.train.dao.TrainUserDao; 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.TrainUnit;
import com.tykj.dev.device.train.entity.TrainUser; 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;
...@@ -19,9 +21,11 @@ import com.tykj.dev.device.user.read.service.MessageService; ...@@ -19,9 +21,11 @@ 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.bto.MessageBto;
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.Units;
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.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.UnitsService;
import com.tykj.dev.device.user.subject.service.UserLogService; 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.BeanHelper;
...@@ -44,6 +48,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -44,6 +48,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -65,6 +70,9 @@ public class TrainJobController { ...@@ -65,6 +70,9 @@ public class TrainJobController {
TrainThemeService trainThemeService; TrainThemeService trainThemeService;
@Autowired @Autowired
MgrcertService mgrcertService; MgrcertService mgrcertService;
@Autowired
UnitsService unitsService;
@Autowired @Autowired
UnitsDao unitsDao; UnitsDao unitsDao;
@Autowired @Autowired
...@@ -83,6 +91,8 @@ public class TrainJobController { ...@@ -83,6 +91,8 @@ public class TrainJobController {
BlockChainUtil blockChainUtil; BlockChainUtil blockChainUtil;
@Autowired @Autowired
MessageService messageService; MessageService messageService;
@Autowired
TrainUnitDao trainUnitDao;
/** /**
* 新建培训信息 * 新建培训信息
...@@ -95,7 +105,6 @@ public class TrainJobController { ...@@ -95,7 +105,6 @@ public class TrainJobController {
trainThemeNoDb.setTrainDataFiles(FilesUtil.stringFileToList(trainThemeAddVo.getTrainDataFileList())); trainThemeNoDb.setTrainDataFiles(FilesUtil.stringFileToList(trainThemeAddVo.getTrainDataFileList()));
TrainTheme trainTheme = trainThemeService.save(trainThemeNoDb); TrainTheme trainTheme = trainThemeService.save(trainThemeNoDb);
List<User> userList=userService.findUnitsIdInUsers(trainThemeAddVo.getUnitsIds()); List<User> userList=userService.findUnitsIdInUsers(trainThemeAddVo.getUnitsIds());
List<Integer> needTrain = new ArrayList<>(); List<Integer> needTrain = new ArrayList<>();
List<Integer> normal = new ArrayList<>(); List<Integer> normal = new ArrayList<>();
...@@ -105,19 +114,29 @@ public class TrainJobController { ...@@ -105,19 +114,29 @@ public class TrainJobController {
needTrain.add(user.getUserId()); needTrain.add(user.getUserId());
}else { }else {
normal.add(user.getUserId()); normal.add(user.getUserId());
} } }
);
List<TrainUnit> trainUnits=new ArrayList<>();
trainThemeAddVo.getUnitsIds().forEach(
unitId->{
TrainUnit trainUnit=new TrainUnit();
trainUnit.setSubmitStatus(1);
trainUnit.setTrainId(trainTheme.getTrainId());
trainUnit.setUnitId(unitId);
trainUnits.add(trainUnit);
} }
); );
trainUnitDao.saveAll(trainUnits);
// 1.用户报名 // 1.用户报名
userService.findAllUserIdInUser(needTrain).forEach( userService.findAllUserIdInUser(needTrain).forEach(
user -> { user -> {
TrainUser trainUser= userToTrainUser(user); TrainUser trainUser= userToTrainUser(user);
trainUser.setIsSignUp(2); trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(1); trainUser.setIsNotJoinUserId(1);
trainUser.setTrainId(trainTheme.getTrainId()); trainUser.setTrainId(trainTheme.getTrainId());
saveTrainUser(trainUser); saveTrainUser(trainUser);
} });
);
userService.findAllUserIdInUser(normal).forEach( userService.findAllUserIdInUser(normal).forEach(
user -> { user -> {
...@@ -125,7 +144,6 @@ public class TrainJobController { ...@@ -125,7 +144,6 @@ public class TrainJobController {
trainUser.setIsSignUp(2); trainUser.setIsSignUp(2);
trainUser.setIsNotJoinUserId(0); trainUser.setIsNotJoinUserId(0);
trainUser.setTrainId(trainTheme.getTrainId()); trainUser.setTrainId(trainTheme.getTrainId());
// trainUserDao.save(trainUser);
saveTrainUser(trainUser); saveTrainUser(trainUser);
} }
); );
...@@ -159,7 +177,7 @@ public class TrainJobController { ...@@ -159,7 +177,7 @@ public class TrainJobController {
/** /**
* 待报名 (所调用的接口) * 待报名 (所调用的接口)
* * 用户报名接口
* @param signUpReturn * @param signUpReturn
* @return * @return
*/ */
...@@ -169,13 +187,22 @@ public class TrainJobController { ...@@ -169,13 +187,22 @@ public class TrainJobController {
TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId()); TrainTheme trainTheme = trainThemeService.findById(signUpReturn.getTrainThemeId());
TaskBto taskBto = taskService.get(signUpReturn.getTaskId()); TaskBto taskBto = taskService.get(signUpReturn.getTaskId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1002); TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(),StatusEnum.TRAIN1002);
Integer taskId=taskBto.getId(); Integer taskId=taskBto.getId();
TrainUnit trainUnit= trainUnitDao.findByTrainIdAndUnitId(trainTheme.getTrainId(),taskBto.getOwnUnit());
if (trainTheme.getTrainTime().getTime()<new Date().getTime()){
trainUnit.setSubmitStatus(3);
}else {
trainUnit.setSubmitStatus(2);
}
List<SignUpUsers> signUpUsers= signUpReturn.getSignUpUsers(); List<SignUpUsers> signUpUsers= signUpReturn.getSignUpUsers();
signUpUsers.forEach(signUpUser -> { signUpUsers.forEach(signUpUser -> {
TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(signUpUser.getUserId(),trainTheme.getTrainId()); TrainUser trainUser= trainUserDao.findByUserIdAndTrainId(signUpUser.getUserId(),trainTheme.getTrainId());
if (signUpUser.getReturns() == 0) { if (signUpUser.getReturns() == 0) {
trainUser.setIsSignUp(1); trainUser.setIsSignUp(1);
trainUser.setArriveMeal(signUpUser.getArriveMeal());
trainUser.setArriveTime(signUpUser.getArriveTime());
trainUser.setLeaveMeal(signUpUser.getLeaveMeal());
trainUser.setLeaveTime(signUpUser.getLeaveTime());
TaskLogBto taskLogBto = new TaskLogBto(taskId, "报名", null); TaskLogBto taskLogBto = new TaskLogBto(taskId, "报名", null);
userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"报名参加培训")); userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"报名参加培训"));
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
...@@ -189,30 +216,38 @@ public class TrainJobController { ...@@ -189,30 +216,38 @@ public class TrainJobController {
trainUser.setUnitsName(unitsDao.findById(trainUser.getUnitsId()).get().getName()); trainUser.setUnitsName(unitsDao.findById(trainUser.getUnitsId()).get().getName());
saveTrainUser(trainUser); saveTrainUser(trainUser);
}); });
// if (signUpReturn.getReturns() == 0) {
// taskBto = taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1);
// trainUser.setIsSignUp(1);
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "报名", null);
// userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"报名参加培训"));
// taskLogService.addLog(taskLogBto);
// } else {
// trainUser.setIsSignUp(2);
// trainUser.setNote(signUpReturn.getNote());
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "不报名", null);
// taskLogService.addLog(taskLogBto);
// taskService.moveToEnd(taskBto);
// userLogService.save(new UserLog(securityUser.getCurrentUserInfo().getUserId(),new Date(),"不参加培训"));
// }
taskBto.setCreateUserId(securityUser.getCurrentUserInfo().getUserId()); taskBto.setCreateUserId(securityUser.getCurrentUserInfo().getUserId());
taskBto= taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1); taskBto = taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1003, -1);
trainUnitDao.save(trainUnit);
List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()); List<Integer> userIds=userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.addAll(userService.findAllByUnite(trainTheme.getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList())); userIds.addAll(userService.findAllByUnite(trainTheme.getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()));
userIds.remove(securityUser.getCurrentUserInfo().getUserId()); userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(taskBto.getId(),BusinessEnum.TRAIN.id,securityUser.getUsername()+"提交了培训名单",userIds,trainTheme.getTrainId().toString())); messageService.add(new MessageBto(taskBto.getId(),BusinessEnum.TRAIN.id,securityUser.getUsername()+"提交了培训名单",userIds,trainTheme.getTrainId().toString()));
return ResponseEntity.ok(taskBto);
}
/**
* 拒绝报名
* 管理者拒绝某个单位的报名
* @return
*/
@ApiOperation(value = "拒绝某个单位的报名", notes = "拒绝某个单位的报名")
@GetMapping("/refuse/{taskId}")
public ResponseEntity signUp(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @PathVariable Integer taskId) {
TaskBto taskBto = taskService.get(taskId);
Units units=unitsService.findById(taskBto.getOwnUnit());
TrainTheme trainTheme = trainThemeService.findById(taskBto.getBillId());
TaskDisposeUtil.isNotSubmit(taskBto.getBillStatus(), StatusEnum.TRAIN1003);
taskBto = taskService.moveToSpecial(taskBto, StatusEnum.TRAIN1002, 0);
List<Integer> userIds = userService.findAllByUnite(securityUser.getCurrentUserInfo().getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList());
userIds.addAll(userService.findAllByUnite(trainTheme.getUnitsId()).stream().map(User::getUserId).collect(Collectors.toList()));
userIds.remove(securityUser.getCurrentUserInfo().getUserId());
messageService.add(new MessageBto(taskBto.getId(), BusinessEnum.TRAIN.id, securityUser.getUsername() + "拒绝了"+units.getName()+"培训报名", userIds, trainTheme.getTrainId().toString()));
return ResponseEntity.ok(taskBto); return ResponseEntity.ok(taskBto);
} }
/** /**
* 报名结束 * 报名结束
* *
...@@ -228,7 +263,6 @@ public class TrainJobController { ...@@ -228,7 +263,6 @@ public class TrainJobController {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
} }
); );
//查询主task //查询主task
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(trainTheme.getTrainId(), BusinessEnum.TRAIN.id);
//主task往下推待培训状态,0 //主task往下推待培训状态,0
...@@ -396,10 +430,12 @@ public class TrainJobController { ...@@ -396,10 +430,12 @@ public class TrainJobController {
private TrainUser saveTrainUser(TrainUser trainUser){ private TrainUser saveTrainUser(TrainUser trainUser){
TrainUser trainUser1 = trainUserDao.save(trainUser); TrainUser trainUser1 = trainUserDao.save(trainUser);
BcHash bcHash=blockChainUtil.sendHash(1000,JacksonUtil.toJSon(trainUser1)); //异步线程
CompletableFuture.runAsync(()-> {
BcHash bcHash = blockChainUtil.sendHash(1000, JacksonUtil.toJSon(trainUser1));
trainUser1.setRecordId(bcHash.getData().getRecordID()); trainUser1.setRecordId(bcHash.getData().getRecordID());
trainUserDao.save(trainUser1); trainUserDao.save(trainUser1);
});
return trainUser1; return trainUser1;
} }
} }
package com.tykj.dev.device.train.dao;
import com.tykj.dev.device.train.entity.TrainUnit;
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 TrainUnitDao.java
* @Description TODO
* @createTime 2021年05月11日 18:01:00
*/
public interface TrainUnitDao extends JpaRepository<TrainUnit, Integer>, JpaSpecificationExecutor<TrainUnit> {
List<TrainUnit> findAllByTrainId(Integer trainId);
TrainUnit findByTrainIdAndUnitId(Integer trainId,Integer unitId);
}
...@@ -22,5 +22,5 @@ public interface TrainUserDao extends JpaRepository<TrainUser, Integer>, JpaSpec ...@@ -22,5 +22,5 @@ public interface TrainUserDao extends JpaRepository<TrainUser, Integer>, JpaSpec
List<TrainUser> findAllByTrainId(Integer trainId); List<TrainUser> findAllByTrainId(Integer trainId);
List<TrainUser> findAllByUnitsIdAndTrainId(Integer unitId,Integer userId); List<TrainUser> findAllByUnitsIdAndTrainId(Integer unitId,Integer trainId);
} }
...@@ -101,16 +101,12 @@ public class TrainTheme { ...@@ -101,16 +101,12 @@ public class TrainTheme {
@ApiModelProperty(value = "培训地点") @ApiModelProperty(value = "培训地点")
private String trainLocation; private String trainLocation;
/**
* 主讲人
*/
@ApiModelProperty(value = "主讲人")
private String speakerUserId;
@Column(name = "train_data_files" ,columnDefinition = "TEXT") @Column(name = "train_data_files" ,columnDefinition = "TEXT")
@ApiModelProperty(value = "培训资料文件db", name = "trainDataFiles") @ApiModelProperty(value = "培训资料文件db", name = "trainDataFiles")
private String trainDataFiles; private String trainDataFiles;
@ApiModelProperty(value = "培训资料文件集合") @ApiModelProperty(value = "培训资料文件集合")
@Transient @Transient
private List<FileRet> trainDataFileList = new ArrayList<>(); private List<FileRet> trainDataFileList = new ArrayList<>();
......
package com.tykj.dev.device.train.entity;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainUnit.java
* @Description TODO
* @createTime 2021年05月11日 17:58:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@ApiModel(value = "培训单位信息")
public class TrainUnit extends BaseEntity {
private Integer trainId;
private Integer unitId;
private Integer submitStatus;
}
package com.tykj.dev.device.train.entity; package com.tykj.dev.device.train.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.tykj.dev.device.train.entity.vo.TrainDetailsVo;
import com.tykj.dev.device.train.entity.vo.TrainUserExcelVo;
import com.tykj.dev.device.user.subject.entity.Mgrcert; import com.tykj.dev.device.user.subject.entity.Mgrcert;
import com.tykj.dev.misc.base.BeanHelper;
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 org.modelmapper.ModelMapper;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date;
/** /**
* @author zjm * @author zjm
...@@ -46,6 +52,7 @@ public class TrainUser { ...@@ -46,6 +52,7 @@ public class TrainUser {
/** /**
* 真实名称 * 真实名称
*/ */
@Excel(name = "名称", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "真实名称", name = "name", example = "12321L") @ApiModelProperty(value = "真实名称", name = "name", example = "12321L")
private String name; private String name;
...@@ -53,6 +60,7 @@ public class TrainUser { ...@@ -53,6 +60,7 @@ public class TrainUser {
/** /**
* 移动电话 * 移动电话
*/ */
@Excel(name = "移动电话", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "移动电话", name = "mobile", example = "12321L") @ApiModelProperty(value = "移动电话", name = "mobile", example = "12321L")
private String mobile; private String mobile;
...@@ -60,12 +68,14 @@ public class TrainUser { ...@@ -60,12 +68,14 @@ public class TrainUser {
/** /**
* 身份证 * 身份证
*/ */
@Excel(name = "身份证", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "身份证", name = "idCard", example = "12321L") @ApiModelProperty(value = "身份证", name = "idCard", example = "12321L")
private String idCard; private String idCard;
/** /**
* 性别 * 性别
*/ */
@Excel(name = "性别", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "性别", name = "sex", example = "12321L") @ApiModelProperty(value = "性别", name = "sex", example = "12321L")
private Integer sex; private Integer sex;
...@@ -111,37 +121,30 @@ public class TrainUser { ...@@ -111,37 +121,30 @@ public class TrainUser {
@ApiModelProperty(value = "是否报名 1.报名 2.不报名", name = "certificate") @ApiModelProperty(value = "是否报名 1.报名 2.不报名", name = "certificate")
private Integer isSignUp; private Integer isSignUp;
/**
* 不报名的备注
*/
@ApiModelProperty(value = "不报名的备足", name = "certificate") @ApiModelProperty(value = "不报名的备足", name = "certificate")
private String note; private String note;
/**
* 是否发证
*/
@ApiModelProperty(value = "是否发证", name = "certificate") @ApiModelProperty(value = "是否发证", name = "certificate")
private Integer certificate; private Integer certificate;
// @ApiModelProperty(value = "到达时间", name = "arriveTime") @ApiModelProperty(value = "到达时间", name = "arriveTime")
// private Integer arriveTime; private Date arriveTime;
//
//
// @ApiModelProperty(value = "离开时间", name = "leaveTime") @ApiModelProperty(value = "离开时间", name = "leaveTime")
// private Integer leaveTime; private Date leaveTime;
//
//
// @ApiModelProperty(value = "到达就餐 1.午饭 2.晚饭", name = "arriveMeal") @ApiModelProperty(value = "到达就餐 0.无 1.午饭 2.晚饭", name = "arriveMeal")
// private Integer arriveMeal; private Integer arriveMeal;
//
//
// @ApiModelProperty(value = "离开就餐 1.午饭 2.晚饭", name = "leaveMeal") @ApiModelProperty(value = "离开就餐 0.无 1.午饭 2.晚饭", name = "leaveMeal")
// private Integer leaveMeal; private Integer leaveMeal;
//
/**
* 是否必须报名 1.必须 2.不必须
*/
@ApiModelProperty(value = "是否必须报名 1.必须 2.不必须", name = "certificate") @ApiModelProperty(value = "是否必须报名 1.必须 2.不必须", name = "certificate")
private Integer isNotJoinUserId; private Integer isNotJoinUserId;
...@@ -151,4 +154,43 @@ public class TrainUser { ...@@ -151,4 +154,43 @@ public class TrainUser {
@Transient @Transient
private Mgrcert mgrcert; private Mgrcert mgrcert;
public TrainUserExcelVo toTrainUserExcelVo(){
ModelMapper mapper = BeanHelper.getUserMapper();
TrainUserExcelVo trainUserExcelVo = mapper.map(this, TrainUserExcelVo.class);
if (this.getSex()==0){
trainUserExcelVo.setSexString("男");
}else {
trainUserExcelVo.setSexString("女");
}
if (this.getPosition()==0) {
trainUserExcelVo.setPositionString("领导");
}else {
trainUserExcelVo.setPositionString("干事");
}
switch (this.getArriveMeal()){
case 0:
trainUserExcelVo.setArriveMealString("不包括饭");
break;
case 1:
trainUserExcelVo.setArriveMealString("午饭");
break;
case 2:
trainUserExcelVo.setArriveMealString("晚饭");
break;
}
switch (this.getLeaveMeal()){
case 0:
trainUserExcelVo.setLeaveMealString("不包括饭");
break;
case 1:
trainUserExcelVo.setLeaveMealString("午饭");
break;
case 2:
trainUserExcelVo.setLeaveMealString("晚饭");
break;
}
return trainUserExcelVo;
}
} }
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
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 java.util.Date;
/** /**
* @author zjm * @author zjm
* @version 1.0.0 * @version 1.0.0
...@@ -30,4 +33,23 @@ public class SignUpUsers { ...@@ -30,4 +33,23 @@ public class SignUpUsers {
@ApiModelProperty(value = "是否报名 0 报名 1否", name = "returns") @ApiModelProperty(value = "是否报名 0 报名 1否", name = "returns")
private Integer returns; private Integer returns;
@ApiModelProperty(value = "到达时间", name = "arriveTime")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date arriveTime;
@ApiModelProperty(value = "离开时间", name = "leaveTime")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date leaveTime;
@ApiModelProperty(value = "到达就餐 1.午饭 2.晚饭", name = "arriveMeal")
private Integer arriveMeal;
@ApiModelProperty(value = "离开就餐 1.午饭 2.晚饭", name = "leaveMeal")
private Integer leaveMeal;
} }
...@@ -107,14 +107,18 @@ public class TrainRegistrationVo { ...@@ -107,14 +107,18 @@ public class TrainRegistrationVo {
private String trainSynopsis; private String trainSynopsis;
/** /**
* 以报名人员 * 单位已报名人员信息
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "signUpTrainUserToUnitVo")
private List<TrainUser> signUpUser; private List<TrainUserToUnitVo> signUpTrainUserToUnitVo;
/** /**
* 没报名人员 * 单位未报名人员信息
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "noSignUpTrainUserToUnitVo")
private List<TrainUser> noSignUpUser; private List<TrainUserToUnitVo> noSignUpTrainUserToUnitVo;
@ApiModelProperty(value = "isEnd",name = "是否可以结束报名")
private Boolean isEnd;
} }
package com.tykj.dev.device.train.entity.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainUserExcelVo.java
* @Description TODO
* @createTime 2021年05月11日 20:26:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TrainUserExcelVo {
/**
* 真实名称
*/
@Excel(name = "名称", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "真实名称", name = "name", example = "12321L")
private String name;
/**
* 移动电话
*/
@Excel(name = "移动电话", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "移动电话", name = "mobile", example = "12321L")
private String mobile;
/**
* 身份证
*/
@Excel(name = "身份证", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "身份证", name = "idCard", example = "12321L")
private String idCard;
/**
* 性别
*/
@Excel(name = "性别", orderNum = "1", width = 30, needMerge = true)
@ApiModelProperty(value = "性别", name = "sex", example = "12321L")
private String sexString;
/**
* 职务
*/
@ApiModelProperty(value = "职务", name = "position")
@Excel(name = "职务", orderNum = "1", width = 30, needMerge = true)
private String positionString;
/**
* 考勤
*/
@ApiModelProperty(value = "考勤", name = "attendance")
@Excel(name = "考勤", orderNum = "1", width = 30, needMerge = true)
private String attendance;
@ApiModelProperty(value = "到达时间", name = "arriveTime")
@Excel(name = "到达时间", orderNum = "1", width = 30, needMerge = true)
private Date arriveTime;
@ApiModelProperty(value = "离开时间", name = "leaveTime")
@Excel(name = "离开时间", orderNum = "1", width = 30, needMerge = true)
private Date leaveTime;
@ApiModelProperty(value = "到达就餐 0.无 1.午饭 2.晚饭", name = "arriveMeal")
@Excel(name = "到达就餐", orderNum = "1", width = 30, needMerge = true)
private String arriveMealString;
@ApiModelProperty(value = "离开就餐 0.无 1.午饭 2.晚饭", name = "leaveMeal")
@Excel(name = "离开就餐", orderNum = "1", width = 30, needMerge = true)
private String leaveMealString;
}
package com.tykj.dev.device.train.entity.vo;
import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName TrainUserToUnitVo.java
* @Description TODO
* @createTime 2021年05月10日 10:20:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "各单位人员报名情况对像", description = "各单位人员报名情况对像")
public class TrainUserToUnitVo {
@ApiModelProperty(value = "单位id" ,name = "unitId")
private Integer unitId;
@ApiModelProperty(value = "单位名称",name = "unitName")
private String unitName;
@ApiModelProperty(value = "培训人员集合",name = "trainUsers")
private List<TrainUser> trainUsers;
@ApiModelProperty(value = "任务id",name = "taskId")
private Integer taskId;
@ApiModelProperty(value = "单位报名状态",name = "taskId")
private Integer unitStatus;
}
...@@ -8,4 +8,6 @@ public interface TrainTaskService { ...@@ -8,4 +8,6 @@ public interface TrainTaskService {
List<TaskBto> selectBillidAndBillType(Integer billId, Integer billType, Integer billStatus); List<TaskBto> selectBillidAndBillType(Integer billId, Integer billType, Integer billStatus);
TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType); TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType);
List<TaskBto> findAllByTypeAndBillId(Integer billId);
} }
package com.tykj.dev.device.train.service; package com.tykj.dev.device.train.service;
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 java.util.List; import java.util.List;
...@@ -40,4 +41,6 @@ public interface TrainThemeService { ...@@ -40,4 +41,6 @@ public interface TrainThemeService {
TrainDetailsVo findSelectDetailsVo(Integer trainId); TrainDetailsVo findSelectDetailsVo(Integer trainId);
TrainTheme findBytaskId(Integer taskId); TrainTheme findBytaskId(Integer taskId);
List<TrainUser> findAllTrainUserByTrainId(Integer trainId);
} }
...@@ -34,4 +34,9 @@ public class TrainTaskServiceImpl implements TrainTaskService { ...@@ -34,4 +34,9 @@ public class TrainTaskServiceImpl implements TrainTaskService {
public TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType) { public TaskBto selectFatherIsNullAndBillidAndBillType(Integer billId, Integer billType) {
return taskDao.findAllByParentTaskIdIsNullAndBillIdAndBusinessType(billId, billType).parse2Bto(); return taskDao.findAllByParentTaskIdIsNullAndBillIdAndBusinessType(billId, billType).parse2Bto();
} }
@Override
public List<TaskBto> findAllByTypeAndBillId(Integer billId) {
return taskDao.findAllByParentTaskId(billId).stream().map(Task::parse2Bto).collect(Collectors.toList());
}
} }
...@@ -8,17 +8,20 @@ import com.tykj.dev.config.TaskBeanConfig; ...@@ -8,17 +8,20 @@ import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
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.train.dao.TrainThemeDao; import com.tykj.dev.device.train.dao.TrainThemeDao;
import com.tykj.dev.device.train.dao.TrainUnitDao;
import com.tykj.dev.device.train.dao.TrainUserDao; 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.TrainUnit;
import com.tykj.dev.device.train.entity.TrainUser; 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.cache.UnitsCache;
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.UserService; import com.tykj.dev.device.user.subject.service.UserService;
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.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -31,11 +34,16 @@ import org.springframework.http.ResponseEntity; ...@@ -31,11 +34,16 @@ import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* @author zjm * @author zjm
...@@ -61,12 +69,18 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -61,12 +69,18 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Autowired @Autowired
TrainUserDao trainUserDao; TrainUserDao trainUserDao;
@Autowired @Autowired
BlockChainUtil blockChainUtil; BlockChainUtil blockChainUtil;
@Autowired @Autowired
TaskService taskService; TaskService taskService;
@Autowired
UnitsCache unitsCache;
@Autowired
TrainUnitDao trainUnitDao;
@Override @Override
public TrainTheme save(TrainTheme trainTheme) { public TrainTheme save(TrainTheme trainTheme) {
TrainTheme trainTheme1 = trainThemeDao.save(trainTheme); TrainTheme trainTheme1 = trainThemeDao.save(trainTheme);
...@@ -136,17 +150,44 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -136,17 +150,44 @@ public class TrainThemeServiceImpl implements TrainThemeService {
@Override @Override
public TrainRegistrationVo findRegistrationVo(Integer trainThemeId) { public TrainRegistrationVo findRegistrationVo(Integer trainThemeId) {
TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get(); TrainTheme trainTheme = trainThemeDao.findById(trainThemeId).get();
TaskBto taskBto=trainTaskService.selectFatherIsNullAndBillidAndBillType(trainThemeId,BusinessEnum.TRAIN.id);
TrainRegistrationVo trainRegistrationVo = trainTheme.toTrainRegistrationVo(); TrainRegistrationVo trainRegistrationVo = trainTheme.toTrainRegistrationVo();
trainRegistrationVo.setSignUpUser(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId)); List<TrainUser> trainUsers= trainUserDao.findAllByTrainId(trainThemeId);
trainRegistrationVo.setNoSignUpUser(trainUserDao.findAllByIsSignUpAndTrainId(2,trainThemeId)); List<TrainUserToUnitVo> signUpTrainUserToUnitVo=new ArrayList<>();
trainRegistrationVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles())); List<TrainUserToUnitVo> notSignUpTrainUserToUnitVo=new ArrayList<>();
return trainRegistrationVo; Map<Integer, TrainUnit> trainUnitMap=trainUnitDao.findAllByTrainId(trainThemeId).stream().collect(Collectors.toMap(TrainUnit::getUnitId, Function.identity()));
AtomicBoolean flag= new AtomicBoolean(true);
List<TaskBto> taskBtoList=trainTaskService.findAllByTypeAndBillId(taskBto.getId());
taskBtoList.forEach(
taskBto1 -> {
TrainUnit trainUnit=trainUnitMap.get(taskBto1.getOwnUnit());
if (taskBto1.getBillStatus().equals(StatusEnum.TRAIN1002.id)){
flag.set(false);
notSignUpTrainUserToUnitVo.add(new TrainUserToUnitVo(taskBto1.getOwnUnit(), unitsCache.findById(taskBto1.getOwnUnit()).getName(), trainUsers, taskBto1.getId(),trainUnit.getSubmitStatus()));
}else {
List<TrainUser> trainUsersSignUp = trainUsers.stream().filter(trainUser -> trainUser.getUnitsId().equals(taskBto1.getOwnUnit()) && trainUser.getIsSignUp() == 1).collect(Collectors.toList());
List<TrainUser> trainUsersNotSignUp = trainUsers.stream().filter(trainUser -> trainUser.getUnitsId().equals(taskBto1.getOwnUnit()) && trainUser.getIsSignUp() == 2).collect(Collectors.toList());
if (trainUsersSignUp.size() != 0) {
signUpTrainUserToUnitVo.add(new TrainUserToUnitVo(taskBto1.getOwnUnit(),unitsCache.findById(taskBto1.getOwnUnit()).getName(), trainUsersSignUp, taskBto1.getId(),trainUnit.getSubmitStatus()));
}
if (trainUsersNotSignUp.size() != 0) {
notSignUpTrainUserToUnitVo.add(new TrainUserToUnitVo(taskBto1.getOwnUnit(), unitsCache.findById(taskBto1.getOwnUnit()).getName(), trainUsersNotSignUp, taskBto1.getId(),trainUnit.getSubmitStatus()));
}
}
}
);
trainRegistrationVo.setIsEnd(flag.get());
trainRegistrationVo.setNoSignUpTrainUserToUnitVo(notSignUpTrainUserToUnitVo);
trainRegistrationVo.setSignUpTrainUserToUnitVo(signUpTrainUserToUnitVo);
trainRegistrationVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles()));
return trainRegistrationVo;
} }
@Override @Override
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();
trainTrainingVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles()));
trainTrainingVo.setTrainUsers(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId)); trainTrainingVo.setTrainUsers(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId));
return trainTrainingVo; return trainTrainingVo;
} }
...@@ -170,9 +211,6 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -170,9 +211,6 @@ public class TrainThemeServiceImpl implements TrainThemeService {
if (trainUpdateVo.getEndTime() != null) { if (trainUpdateVo.getEndTime() != null) {
trainTheme.setEndTime(trainUpdateVo.getEndTime()); trainTheme.setEndTime(trainUpdateVo.getEndTime());
} }
if (trainUpdateVo.getSpeakerUserId() != null) {
trainTheme.setSpeakerUserId(trainUpdateVo.getSpeakerUserId());
}
if (trainUpdateVo.getStartTime() != null) { if (trainUpdateVo.getStartTime() != null) {
trainTheme.setStartTime(trainUpdateVo.getStartTime()); trainTheme.setStartTime(trainUpdateVo.getStartTime());
} }
...@@ -206,7 +244,6 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -206,7 +244,6 @@ public class TrainThemeServiceImpl implements TrainThemeService {
} }
} }
); );
return TrainThemePage.builder() return TrainThemePage.builder()
.data(list) .data(list)
.page(conditionsTrainVo.getPage()) .page(conditionsTrainVo.getPage())
...@@ -242,6 +279,12 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -242,6 +279,12 @@ public class TrainThemeServiceImpl implements TrainThemeService {
return findById(taskBto.getBillId()); return findById(taskBto.getBillId());
} }
@Override
public List<TrainUser> findAllTrainUserByTrainId(Integer trainId) {
return trainUserDao.findAllByTrainId(trainId).stream().filter(trainUser -> trainUser.getIsSignUp()==1).collect(Collectors.toList());
}
private Page<TrainTheme> getContacts(ConditionsTrainVo conditionsTrainVo, Pageable pageable) { private Page<TrainTheme> getContacts(ConditionsTrainVo conditionsTrainVo, Pageable pageable) {
PredicateBuilder<TrainTheme> predicateBuilder = Specifications.and(); PredicateBuilder<TrainTheme> predicateBuilder = Specifications.and();
if (conditionsTrainVo.getEndTime() != null && conditionsTrainVo.getStartTime() != null) { if (conditionsTrainVo.getEndTime() != null && conditionsTrainVo.getStartTime() != null) {
......
...@@ -47,4 +47,9 @@ public class LeftNavigation { ...@@ -47,4 +47,9 @@ public class LeftNavigation {
* 序号 * 序号
*/ */
private Integer order; private Integer order;
/**
* 所属名称
*/
private Integer theirId;
} }
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.cache; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.cache;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package com.tykj.dev.device.user.subject.controller; package com.tykj.dev.device.user.subject.controller;
import com.tykj.dev.config.swagger.AutoDocument; import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.user.subject.entity.Groups;
import com.tykj.dev.device.user.subject.service.GroupService; import com.tykj.dev.device.user.subject.service.GroupService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
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.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @author zjm * @author zjm
...@@ -31,4 +29,19 @@ public class GroupsController { ...@@ -31,4 +29,19 @@ public class GroupsController {
public ResponseEntity findAll(@PathVariable Integer type){ public ResponseEntity findAll(@PathVariable Integer type){
return ResponseEntity.ok(groupService.findAll(type)); return ResponseEntity.ok(groupService.findAll(type));
} }
@PostMapping(value = "/save")
@ApiOperation(value = "组列表的查询", notes = "成功返回分类的权限对象")
public ResponseEntity save(@RequestBody Groups groups){
groupService.saveGroup(groups);
return ResponseEntity.ok("添加成功");
}
@GetMapping(value = "/find/{id}")
@ApiOperation(value = "根据id查询组", notes = "根据id查询组")
public ResponseEntity findByid(@PathVariable Integer id){
return ResponseEntity.ok(groupService.findById(id));
}
} }
...@@ -39,7 +39,7 @@ public class Area { ...@@ -39,7 +39,7 @@ public class Area {
private String name; private String name;
/** /**
* 等级 等级 0国家级 1省级 2市级 3县级 * 等级 等级 0国家级 1省级 2市级 3县级 4.直属单位
*/ */
private Integer type; private Integer type;
...@@ -73,7 +73,7 @@ public class Area { ...@@ -73,7 +73,7 @@ public class Area {
} }
public LeftNavigation toLeftNavigation(){ public LeftNavigation toLeftNavigation(){
return new LeftNavigation(id,name,null, UUID.randomUUID().toString(),1,Double.valueOf(orders).intValue()); return new LeftNavigation(id,name,null, UUID.randomUUID().toString(),1,Double.valueOf(orders).intValue(),null);
} }
} }
...@@ -26,7 +26,6 @@ public class Groups { ...@@ -26,7 +26,6 @@ public class Groups {
*/ */
@Id @Id
@GeneratedValue @GeneratedValue
@Column(columnDefinition = "integer NOT NULL AUTO_INCREMENT")
private Integer id; private Integer id;
/** /**
...@@ -44,12 +43,16 @@ public class Groups { ...@@ -44,12 +43,16 @@ public class Groups {
*/ */
private String memberId; private String memberId;
/**
* 前端复现使用
*/
private String returnCash;
@Transient @Transient
private List<Integer> members; private List<Integer> members;
@Transient @Transient
private List<Units> unitsList; private List<Units> unitsList;
} }
...@@ -126,6 +126,6 @@ public class Units { ...@@ -126,6 +126,6 @@ public class Units {
} }
public LeftNavigation toLeftNavigation(){ public LeftNavigation toLeftNavigation(){
return new LeftNavigation(unitId,name,null, UUID.randomUUID().toString(),2,showOrder); return new LeftNavigation(unitId,name,null, UUID.randomUUID().toString(),2,showOrder,null);
} }
} }
...@@ -30,5 +30,9 @@ public interface GroupService { ...@@ -30,5 +30,9 @@ public interface GroupService {
*/ */
List<Integer> findGroup(Integer id); List<Integer> findGroup(Integer id);
/**
* 根据id查询组详情
*/
Groups findById(Integer id);
} }
...@@ -117,7 +117,6 @@ public interface UnitsService extends PublicService<Units> { ...@@ -117,7 +117,6 @@ public interface UnitsService extends PublicService<Units> {
/** /**
* 根据用户查询 可当前单位的下级单位 * 根据用户查询 可当前单位的下级单位
* @param userId 当前用户id
* @return 单位集合 * @return 单位集合
*/ */
List<Units> findByUserIdUnitsTrainListVo(Integer unitsId); List<Units> findByUserIdUnitsTrainListVo(Integer unitsId);
...@@ -135,6 +134,10 @@ public interface UnitsService extends PublicService<Units> { ...@@ -135,6 +134,10 @@ public interface UnitsService extends PublicService<Units> {
*/ */
LeftNavigation findLeftNavigation(SecurityUser securityUser); LeftNavigation findLeftNavigation(SecurityUser securityUser);
/**
* 左边侧面导航栏接口 不包括直属单位
*/
LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser);
/** /**
* 省入库上级单位对象查询接口 * 省入库上级单位对象查询接口
......
...@@ -4,15 +4,18 @@ import com.tykj.dev.device.user.subject.dao.GroupDao; ...@@ -4,15 +4,18 @@ import com.tykj.dev.device.user.subject.dao.GroupDao;
import com.tykj.dev.device.user.subject.entity.Groups; import com.tykj.dev.device.user.subject.entity.Groups;
import com.tykj.dev.device.user.subject.service.GroupService; import com.tykj.dev.device.user.subject.service.GroupService;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.misc.exception.ApiException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A; 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.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -60,4 +63,16 @@ public class GroupServiceImpl implements GroupService { ...@@ -60,4 +63,16 @@ public class GroupServiceImpl implements GroupService {
Groups group= groupDao.findById(id).get(); Groups group= groupDao.findById(id).get();
return Arrays.asList(group.getMemberId().substring(2).split(",")).stream().map(Integer::parseInt).collect(Collectors.toList()); return Arrays.asList(group.getMemberId().substring(2).split(",")).stream().map(Integer::parseInt).collect(Collectors.toList());
} }
@Override
public Groups findById(Integer id) {
Optional<Groups> optionalGroups = groupDao.findById(id);
if (optionalGroups.isPresent()){
Groups groups = optionalGroups.get();
groups.setUnitsList(unitsService.findAllByIdIn(integerList(groups.getMemberId())));
return groups;
}else {
throw new ApiException(ResponseEntity.status(500).body("[组] 没有找到对应的id"));
}
}
} }
...@@ -74,20 +74,42 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -74,20 +74,42 @@ public class UnitsServiceImpl implements UnitsService {
if (thisArea.getType()==1) { if (thisArea.getType()==1) {
areas.forEach(area -> { areas.forEach(area -> {
LeftNavigation leftNavigation = area.toLeftNavigation(); LeftNavigation leftNavigation = area.toLeftNavigation();
List<LeftNavigation> leftNavigationList1 = unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList()); List<LeftNavigation> leftNavigationList1 = new ArrayList<>();
unitsDao.findAllByAreaId(area.getId()).forEach(
units -> {
LeftNavigation leftNavigation1=units.toLeftNavigation();
leftNavigation1.setTheirId(units.getAreaId());
leftNavigationList1.add(leftNavigation1);
}
);
List<Area> countys = areaDao.findAllByFatherId(area.getId()); List<Area> countys = areaDao.findAllByFatherId(area.getId());
if (countys != null && countys.size() != 0) { if (countys != null && countys.size() != 0) {
countys.forEach( countys.forEach(
area1 -> { area1 -> unitsDao.findAllByAreaId(area1.getId()).forEach(
leftNavigationList1.addAll(unitsDao.findAllByAreaId(area1.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList())); units -> {
} LeftNavigation leftNavigation1=units.toLeftNavigation();
leftNavigation1.setTheirId(area.getId());
leftNavigationList1.add(leftNavigation1);
}
)
); );
} }
leftNavigation.setLeftNavigations(leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList())); leftNavigation.setLeftNavigations(leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
leftNavigationList.add(leftNavigation); leftNavigationList.add(leftNavigation);
}); });
}else if (thisArea.getType()==2){ }else if (thisArea.getType()==2){
areas.forEach(area -> leftNavigationList.addAll(unitsDao.findAllByAreaId(area.getId()).stream().map(Units::toLeftNavigation).sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()))); areas.forEach(area -> {
unitsDao.findAllByAreaId(area.getId()).forEach(
units -> {
LeftNavigation leftNavigation1=units.toLeftNavigation();
leftNavigation1.setTheirId(thisArea.getId());
leftNavigationList.add(leftNavigation1);
}
);
});
}else { }else {
return leftNavigationList; return leftNavigationList;
} }
...@@ -242,9 +264,9 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -242,9 +264,9 @@ public class UnitsServiceImpl implements UnitsService {
} }
if (belongsArea.getType()==1){ if (belongsArea.getType()==1){
//把省直属组合一下 直属单位(type=2) 处室单位(type=4) //把省直属组合一下 直属单位(type=2) 处室单位(type=4)
leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList())); // leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().map(Units::toLeftNavigation).collect(Collectors.toList()); List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22); LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22,null);
leftNavigationList.add(leftNavigation2); leftNavigationList.add(leftNavigation2);
} }
List<Area> areas= areaDao.findAllByFatherId(areaId); List<Area> areas= areaDao.findAllByFatherId(areaId);
...@@ -260,6 +282,48 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -260,6 +282,48 @@ public class UnitsServiceImpl implements UnitsService {
return leftNavigation; return leftNavigation;
} }
@Override
public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation();
List<LeftNavigation> leftNavigationList=new ArrayList<>();
Integer areaId=securityUser.getCurrentUserInfo().getUnits().getAreaId();
Area belongsArea= areaDao.findById(areaId).get();
if (belongsArea.getType()==1|| belongsArea.getType()==2){
leftNavigation = belongsArea.toLeftNavigation();
List<LeftNavigation> leftNavigationList1=new ArrayList<>();
unitsDao.findAllByAreaId(belongsArea.getId()).forEach(
units -> {
LeftNavigation leftNavigation1=units.toLeftNavigation();
leftNavigation1.setTheirId(belongsArea.getId());
leftNavigationList1.add(leftNavigation1);
}
);
leftNavigationList=leftNavigationList1;
}
List<Area> areas= areaDao.findAllByFatherId(areaId);
if (areas.size()!=0) {
provinceAndCity(belongsArea,areas,leftNavigationList);
}else {
leftNavigation= belongsArea.toLeftNavigation();
List<LeftNavigation> leftNavigationList1=new ArrayList<>();
unitsDao.findAllByAreaId(belongsArea.getId()).forEach(
units -> {
LeftNavigation leftNavigation1=units.toLeftNavigation();
leftNavigation1.setTheirId(belongsArea.getId());
leftNavigationList1.add(leftNavigation1);
}
);
leftNavigationList=leftNavigationList1;
}
leftNavigation.setLeftNavigations(leftNavigationList.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
return leftNavigation;
}
@Override @Override
public List<Units> findSuperiorUnitsList() { public List<Units> findSuperiorUnitsList() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论