提交 61b081e0 authored 作者: zhoushaopan's avatar zhoushaopan

[多模块]修改多个代码

上级 48c8c738
......@@ -808,7 +808,8 @@ public class AllotBillController {
.collect(Collectors.toList()));
}
//给同单位专管员和收件单位专管员推阅知
messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
// messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
messageBto1.setContent("撤回任务:" + title);
MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
......
......@@ -648,7 +648,7 @@ public class BackController {
.map(User::getUserId)
.collect(Collectors.toList()));
//给同单位专管员和收件单位专管员推阅知
messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
messageBto1.setContent("撤回任务:" + title);
MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
......
......@@ -52,10 +52,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
......@@ -214,9 +211,12 @@ public class DeviceCheckController {
CheckStatVo ctVo = transUtil.checkStatDo2Vo(ct);
linkVo.setTitle(ctVo.getTitle());
LocalDateTime endTime = ctVo.getEndTime();
endTime = LocalDateTime.of(ctVo.getEndTime().toLocalDate(), LocalTime.MAX);
// LocalDateTime endTime = ctVo.getEndTime().plusDays(1);
//新增修改时间
LocalDateTime updateTime = ctVo.getUpdateTime();
linkVo.setEndTime(ctVo.getEndTime().toLocalDate());
// linkVo.setEndTime(ctVo.getEndTime().toLocalDate());
linkVo.setEndTime(LocalDateTime.of(ctVo.getEndTime().toLocalDate(), LocalTime.MAX).toLocalDate());
List<LinkCheckDetail> lcdList = new ArrayList<>();
List<LinkExamDetail> ledList = new ArrayList<>();
......@@ -516,7 +516,7 @@ public class DeviceCheckController {
} else if (revAreaStat.getComProgress() == 2 && task.getBillStatus() % 10 == 1) {
led.setCheckResult("进行中");
} else if (revAreaStat.getComProgress() == 2) {
if (endTime.isBefore(LocalDateTime.now())) {
if (endTime.isBefore(updateTime)) {
led.setCheckResult("逾期完成");
} else {
led.setCheckResult("完成");
......@@ -649,7 +649,6 @@ public class DeviceCheckController {
// 2.发起自己的检查(只是市级别的 level=2)
List<String> checkedUnitNames = checkedUnits.stream().map(Units::getName).collect(toList());
log.info("[核查模块]发起核查,发起单位为{},被查单位为{}", startUnit.getName(), checkedUnitNames);
// 构建省的统计账单,所有的checkedUnits都要被包含到统计中去
......@@ -771,7 +770,7 @@ public class DeviceCheckController {
@PostMapping("/startExam")
public ResponseEntity<ResultObj> startExam(@RequestBody CheckExamVo ceVo) {
//设置为
ceVo.setEndTime(ceVo.getEndTime().plusDays(1));
ceVo.setEndTime(LocalDateTime.of(ceVo.getEndTime(), LocalTime.MAX).toLocalDate());
//初始化数据结构
List<Integer> detailIds = new ArrayList<>();
Integer startUnitId = ceVo.getUnitId();
......@@ -1094,6 +1093,8 @@ public class DeviceCheckController {
taskService.moveToSpecial(currentTask, firstStatus, currentTask.getFirstUserId());
}
log.info("[核查模块] 专管员B操作成功");
//完结系统自查业务
findBySystem();
return ResponseEntity.ok(new ResultObj<>("专管B操作成功"));
}
......@@ -1332,18 +1333,6 @@ private SelfCheckController selfCheckController;
}
log.info("[核查模块] 统计数据确认操作成功");
//判断自己是否存在系统自查任务
LocalDateTime updateTime = statRepo.findById(statId).get().getUpdateTime();
Instant instant = updateTime.atZone(ZoneId.systemDefault()).toInstant();
Date date = Date.from(instant);
List<Task> bySystem = selfCheckController.findBySystem(date);
if (bySystem.size() != 0){
for (Task task : bySystem) {
//任务结束
TaskBto taskBto = task.parse2Bto();
taskService.moveToEnd(taskBto);
}
}
return ResponseEntity.ok(new ResultObj<>("统计数据确认完毕"));
}
......@@ -1665,6 +1654,11 @@ private SelfCheckController selfCheckController;
return new CheckAreaStatVo(finalCityName, actualCount, supposeCount, finalProgress, finalSituation, 0, 0);
}
private void findBySystem(){
selfCheckController.findBySystem1();
}
}
......
......@@ -23,6 +23,7 @@ import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
......@@ -44,6 +45,7 @@ import java.util.stream.Collectors;
@AutoDocument
@Api(tags = "装备管理模块", description = "装备管理接口")
@Validated
@Slf4j
public class DeviceLibraryController {
@Autowired
private DeviceLibraryService deviceLibraryService;
......@@ -171,6 +173,7 @@ public class DeviceLibraryController {
public ResponseEntity selectCheckDeviceListByUnit(@PathVariable("unitName") String unitName) {
String unit = unitName;
PredicateBuilder<DeviceLibrary> predicateBuilder = Specifications.and();
log.info("[装备模块] 单位名称:{}",unit);
predicateBuilder.eq("ownUnit", unit);
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(predicateBuilder.build());
deviceLibraries.forEach(DeviceLibrary::setConfigName);
......@@ -228,7 +231,6 @@ public class DeviceLibraryController {
Boolean containRfidCardDim = !hasRfidCardDim||(deviceLibrary.getRfidCardId()!=null&&deviceLibrary.getRfidCardId().contains(deviceLibrarySelectVo.getRfidCardDim()));
Boolean containStorageLocationDim = !hasStorageLocationDim||deviceLibrary.getStorageLocation().contains(deviceLibrarySelectVo.getStorageLocationDim());
// Boolean containTypeDim = !hasTypeDim||deviceLibrary.getType().contains(deviceLibrarySelectVo.getTypeDim());
return containModelDim&&containNameDim&&containSeqDim&&containLocationUnitDim&&containOwnUnitDim&&containLifeStatusDim&&containUpdateTimeDim&&containRfidCardDim&&containStorageLocationDim;
}).collect(Collectors.toList());
}
......
......@@ -257,8 +257,17 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
allotIds.add(d2.getId());
break;
case 4:
repairNum++;
repairIds.add(d2.getId());
//如果所属跟所在不一致
if (!d2.getLocationUnit().equals(d2.getOwnUnit())){
if (d2.getOwnUnit().equals(userUtils.getCurrentUserUnitName())){
repairNum++;
repairIds.add(d2.getId());
}
}else {
repairNum++;
repairIds.add(d2.getId());
}
break;
case 5:
scrappedNum++;
......
......@@ -2165,4 +2165,135 @@ public class RepairController {
repairBackBill.setStartUserbId(agentBackVo.getStartUserbId());
return ResponseEntity.ok(deviceRepairBackBillService.update(repairBackBill));
}
@ApiOperation(value = "维修撤回", notes = "根据任务id撤回维修")
@GetMapping("/revokeRepairTask/taskId")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity revokeRepairTask(Integer taskId) {
//根据任务id查询子任务 发件方是子任务 收件方是主任务
TaskBto taskBto = taskService.get(taskId);
Integer parentTaskId = taskBto.getParentTaskId();
TaskBto parentTask = taskService.get(parentTaskId);
//父任务未被完成 可以被撤回
Integer billId = taskBto.getBillId();
String title = taskBto.getTitle();
// AllotBill allotBill = allotBillService.getOne(billId);
RepairSendBill sendBill = repairSendBillService.getOne(billId);
Integer currentUserId = userUtils.getCurrentUserId();
List<Integer> idList = userPublicService.findOtherUser(currentUserId);
//找到收件方的阅知
MessageBto messageBto1 = messageService.findByTaskId(parentTaskId).parse2Bto();
//纵向配发阅知要发给收件单位的人
idList.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(sendBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//给同单位专管员和收件单位专管员推阅知
// messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
messageBto1.setContent("撤回任务:" + title);
MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
messageService.add(messageBto);
myWebSocket.sendMessage1();
//将任务都完结
taskService.moveToRevoke(taskBto);
taskService.moveToRevoke(parentTask);
if (sendBill.getRepairDeviceCheckDetail() != null) {
List<Integer> ids = StringSplitUtil.split(sendBill.getRepairDeviceCheckDetail());
//所有的装备
List<DeviceLibrary> deviceLibraryList;
//所有的装备日志
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
ids.forEach(id -> {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id);
//添加装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + deviceLibrary.getName() + "配发撤回", null, null, null);
deviceLogDtos.add(deviceLogDto);
});
//设置装备为在库
deviceLibraryService.updateLifeStatus2(2,ids);
deviceLibraryList = deviceLibraryService.findByIds(ids);
//添加日志
deviceLogService.addAllLog(deviceLogDtos);
// sendBill.setDeviceLibraries(deviceLibraryList);
sendBill.setDeviceLibraries(deviceLibraryList);
repairSendBillService.delete(sendBill.getId());
}
return ResponseEntity.ok(messageBto);
}
@ApiOperation(value = "维修撤回", notes = "根据任务id撤回维修")
@GetMapping("/revokeRepairBackTask/taskId")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity revokeRepairBackTask(Integer taskId) {
//根据任务id查询子任务 发件方是子任务 收件方是主任务
TaskBto taskBto = taskService.get(taskId);
Integer parentTaskId = taskBto.getParentTaskId();
TaskBto parentTask = taskService.get(parentTaskId);
//父任务未被完成 可以被撤回
Integer billId = taskBto.getBillId();
String title = taskBto.getTitle();
RepairBackBill repairBackBill = repairBackBillDao.findById(billId).get();
Integer currentUserId = userUtils.getCurrentUserId();
List<Integer> idList = userPublicService.findOtherUser(currentUserId);
//找到收件方的阅知
MessageBto messageBto1 = messageService.findByTaskId(parentTaskId).parse2Bto();
//纵向配发阅知要发给收件单位的人
idList.addAll(userDao.findAllByUnitsId(userPublicService.findUnitIdByName(repairBackBill.getReceiveUnit())).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
//给同单位专管员和收件单位专管员推阅知
// messageBto1.setContent(title.substring(0,4)+"撤回"+title.substring(4));
messageBto1.setContent("撤回任务:" + title);
MessageBto messageBto = new MessageBto(-1, parentTask.getBusinessType(), messageBto1.getContent(), idList, 1);
BeanUtils.copyProperties(messageBto1,messageBto);
messageBto.setTaskId(-1);
messageService.add(messageBto);
myWebSocket.sendMessage1();
//将任务都完结
taskService.moveToRevoke(taskBto);
taskService.moveToRevoke(parentTask);
if (repairBackBill.getBackCheckDetail() != null) {
List<Integer> ids = StringSplitUtil.split(repairBackBill.getBackCheckDetail());
//所有的装备
List<DeviceLibrary> deviceLibraryList;
//所有的装备日志
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
ids.forEach(id -> {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id);
//添加装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + deviceLibrary.getName() + "配发撤回", null, null, null);
deviceLogDtos.add(deviceLogDto);
});
//设置装备为在库
deviceLibraryService.updateLifeStatus2(2,ids);
deviceLibraryList = deviceLibraryService.findByIds(ids);
//添加日志
deviceLogService.addAllLog(deviceLogDtos);
// sendBill.setDeviceLibraries(deviceLibraryList);
repairBackBill.setDeviceLibraries(deviceLibraryList);
repairSendBillService.delete(repairBackBill.getId());
}
return ResponseEntity.ok(messageBto);
}
}
package com.tykj.dev.device.repair.subject.domin;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -262,4 +263,8 @@ public class RepairBackBill {
@ApiModelProperty("任务id")
@Transient
private Integer taskId;
@ApiModelProperty(value = "装备集合")
@Transient
private List<DeviceLibrary> deviceLibraries;
}
package com.tykj.dev.device.repair.subject.domin;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -250,4 +251,8 @@ public class RepairSendBill {
@Transient
private List<FileRet> receiveFileList = new ArrayList<>();
@ApiModelProperty(value = "装备集合")
@Transient
private List<DeviceLibrary> deviceLibraries;
}
......@@ -659,18 +659,34 @@ public class SelfCheckController {
return ResponseEntity.ok("ok");
}
// @ApiOperation(value = "查询时间段系统发其自查任务", notes = "可以通过这个接口查询自查任务详情")
// @PostMapping(value = "/findBySystem")
// public List<Task> findBySystem(Date date) {
// //查询当前时间之前的系统自查(当前单位)
// String currentUserUnitName = userUtils.getCurrentUserUnitName();
// List<SelfCheckBill> byDate = selfExaminationBillService.findByDate(date, currentUserUnitName);
//
// List<Task> allByBillAndBusinessTypeAndOwnUnit = new ArrayList<>();
// //通过billId和businessType 和 ownUnit
// for (SelfCheckBill selfCheckBill : byDate) {
// allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(selfCheckBill.getId(), 4, userUtils.getCurrentUnitId());
// }
// return allByBillAndBusinessTypeAndOwnUnit;
// }
@ApiOperation(value = "查询时间段系统发其自查任务", notes = "可以通过这个接口查询自查任务详情")
@PostMapping(value = "/findBySystem")
public List<Task> findBySystem(Date date) {
//查询当前时间之前的系统自查(当前单位)
String currentUserUnitName = userUtils.getCurrentUserUnitName();
List<SelfCheckBill> byDate = selfExaminationBillService.findByDate(date, currentUserUnitName);
List<Task> allByBillAndBusinessTypeAndOwnUnit = new ArrayList<>();
@PostMapping(value = "/findBySystem1")
public void findBySystem1() {
//通过billId和businessType 和 ownUnit
for (SelfCheckBill selfCheckBill : byDate) {
allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(selfCheckBill.getId(), 4, userUtils.getCurrentUnitId());
List<Task> allByBillAndBusinessTypeAndOwnUnit = taskService.findAllByBillAndBusinessTypeAndOwnUnit(4, userUtils.getCurrentUnitId());
System.out.println("allByBillAndBusinessTypeAndOwnUnit = " + allByBillAndBusinessTypeAndOwnUnit);
if (allByBillAndBusinessTypeAndOwnUnit.size()>0){
for (Task task : allByBillAndBusinessTypeAndOwnUnit) {
taskService.moveToArchive(task.parse2Bto());
//删除
selfCheckBillService.delete(task.getBillId());
}
}
return allByBillAndBusinessTypeAndOwnUnit;
}
}
......@@ -15,7 +15,6 @@ import java.util.List;
public interface SelfCheckBillDao extends JpaRepository<SelfCheckBill, Integer>, JpaSpecificationExecutor<SelfCheckBill> {
// @Query("select o from SelfCheckBill o where o.createTime <= :startTime)
//// List<SelfCheckBill> findall(String unitName, Date startTime);
// List<SelfCheckBill> findAll
List<SelfCheckBill> findAllByCreateTimeAfterAndCheckUnitAndCheckStatusAndCreateUserId(Date date,String unitName,Integer status,Integer userId);
}
......@@ -33,4 +33,6 @@ public interface SelfCheckBillService {
* 根据核查完成时间去查询当前单位系统发起的自查任务
*/
List<SelfCheckBill> findByDate(Date date,String unitName);
List<SelfCheckBill> findBySystem(String unitName);
}
......@@ -106,6 +106,13 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
return selfExaminationBillDao.findAllByCreateTimeAfterAndCheckUnitAndCheckStatusAndCreateUserId(date,unitName,3,null);
}
@Override
public List<SelfCheckBill> findBySystem(String unitName) {
PredicateBuilder<SelfCheckBill> builder = Specifications.and();
builder.eq("checkUnit",unitName);
return selfExaminationBillDao.findAll(builder.build());
}
private Specification<SelfCheckBill> getSelectSpecification(SelfCheckSelectVo selfCheckSelectVo) {
PredicateBuilder<SelfCheckBill> predicateBuilder = Specifications.and();
predicateBuilder.eq("checkUnit",userUtils.getCurrentUserUnitName());
......
......@@ -88,6 +88,6 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
Task findByParentTaskId(Integer parentTaskId);
//zsp
List<Task> findAllByBillIdAndBusinessTypeAndOwnUnit(Integer billId, Integer businessType, Integer ownUnit);
List<Task> findAllByBusinessTypeAndOwnUnitAndCustomInfo( Integer businessType, Integer ownUnit,String customInfo);
}
......@@ -236,5 +236,5 @@ public interface TaskService {
List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId,Integer businessType);
List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer billId,Integer businessType,Integer ownUnit);
List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer businessType,Integer ownUnit);
}
......@@ -1145,8 +1145,8 @@ public class TaskServiceImpl implements TaskService {
}
@Override
public List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer billId,Integer businessType,Integer ownUnit) {
return taskDao.findAllByBillIdAndBusinessTypeAndOwnUnit(billId,businessType,ownUnit);
public List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer businessType,Integer ownUnit) {
return taskDao.findAllByBusinessTypeAndOwnUnitAndCustomInfo(businessType,ownUnit,null);
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论