提交 2ffcd1d4 authored 作者: zhoushaopan's avatar zhoushaopan

[多模块]修改多个代码

上级 f6f27e46
...@@ -309,7 +309,8 @@ public class AllotBillController { ...@@ -309,7 +309,8 @@ public class AllotBillController {
deviceLibraryEntity.setManageStatus(0); deviceLibraryEntity.setManageStatus(0);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList, saveEntity.getId(), null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList, saveEntity.getId(), null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBillEntity.getReceiveUnit() + "发起配发", fileVoList, saveEntity.getId(), saveEntity.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
...@@ -428,7 +429,8 @@ public class AllotBillController { ...@@ -428,7 +429,8 @@ public class AllotBillController {
deviceLibraryEntity.setProdNumber(allotReceiveVo.getMap().get(id)); deviceLibraryEntity.setProdNumber(allotReceiveVo.getMap().get(id));
} }
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList, taskBto.getId(), null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList, taskBto.getId(), null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
...@@ -439,7 +441,7 @@ public class AllotBillController { ...@@ -439,7 +441,7 @@ public class AllotBillController {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11); deviceLibraryEntity.setLifeStatus(11);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(), null); DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
...@@ -661,7 +663,8 @@ public class AllotBillController { ...@@ -661,7 +663,8 @@ public class AllotBillController {
List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail()); List<Integer> deviceIds = StringSplitUtil.split(allotBill.getAllotCheckDetail());
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList, taskBto.getId(), null); // DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList, taskBto.getId(), null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单据", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
}); });
//签发人阅知 //签发人阅知
...@@ -735,7 +738,8 @@ public class AllotBillController { ...@@ -735,7 +738,8 @@ public class AllotBillController {
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVo.getAllotFiles().forEach(fileRet -> fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath()))); fileVo.getAllotFiles().forEach(fileRet -> fileVoList.add(new FileVo("配发单", fileRet.getName(), fileRet.getPreviewPath())));
ids.forEach(integer -> { ids.forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单", fileVoList, taskBto.getId(), null); // DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单", fileVoList, taskBto.getId(), null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传配发单", fileVoList, taskBto.getId(), taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(integer); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(integer);
deviceLibrary.setLocationUnit(allotBill.getReceiveUnit()); deviceLibrary.setLocationUnit(allotBill.getReceiveUnit());
...@@ -955,7 +959,8 @@ public class AllotBillController { ...@@ -955,7 +959,8 @@ public class AllotBillController {
log.info("[配发] 没有在packingLibraryHashMap找到key:{}的列装", deviceLibraryEntity.getModel() + deviceLibraryEntity.getName() + matchingRange); log.info("[配发] 没有在packingLibraryHashMap找到key:{}的列装", deviceLibraryEntity.getModel() + deviceLibraryEntity.getName() + matchingRange);
} }
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "配发将所属列装由" + deviceLibraryEntity.getMatchingRangeName() + "的列装改为" + configCache.getMatchingRangeMap().get(1) + "的列装", fileVoList, saveEntity.getId(), null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "配发将所属列装由" + deviceLibraryEntity.getMatchingRangeName() + "的列装改为" + configCache.getMatchingRangeMap().get(1) + "的列装", fileVoList, saveEntity.getId(), null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "配发将所属列装由" + deviceLibraryEntity.getMatchingRangeName() + "的列装改为" + configCache.getMatchingRangeMap().get(1) + "的列装", fileVoList, saveEntity.getId(), saveEntity.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
......
...@@ -177,7 +177,8 @@ public class BackController { ...@@ -177,7 +177,8 @@ public class BackController {
deviceLibraryEntity.setManageStatus(0); deviceLibraryEntity.setManageStatus(0);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBackBill.getReceiveUnit() + "发起退回", fileVoList,saveEntity.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBackBill.getReceiveUnit() + "发起退回", fileVoList,saveEntity.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "对" + allotBackBill.getReceiveUnit() + "发起退回", fileVoList,saveEntity.getId(),saveEntity.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
} }
} }
...@@ -275,7 +276,8 @@ public class BackController { ...@@ -275,7 +276,8 @@ public class BackController {
deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName()); deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
deviceLibraryEntity.setManageStatus(1); deviceLibraryEntity.setManageStatus(1);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收并发起入库", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
...@@ -286,7 +288,8 @@ public class BackController { ...@@ -286,7 +288,8 @@ public class BackController {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
deviceLibraryEntity.setLifeStatus(11); deviceLibraryEntity.setLifeStatus(11);
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(id, "接收入库丢失", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
deviceLibraryService.update(deviceLibraryEntity); deviceLibraryService.update(deviceLibraryEntity);
} }
...@@ -359,7 +362,8 @@ public class BackController { ...@@ -359,7 +362,8 @@ public class BackController {
List<Integer> deviceIds = StringSplitUtil.split(allotBackBill.getBackCheckDetail()); List<Integer> deviceIds = StringSplitUtil.split(allotBackBill.getBackCheckDetail());
deviceIds.forEach(integer -> { deviceIds.forEach(integer -> {
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单据", fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单据", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单据", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
}); });
//签发人阅知 //签发人阅知
...@@ -430,7 +434,8 @@ public class BackController { ...@@ -430,7 +434,8 @@ public class BackController {
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVo.getAllotFiles().forEach(fileRet -> fileVoList.add(new FileVo("退回单", fileRet.getName(), fileRet.getPreviewPath()))); fileVo.getAllotFiles().forEach(fileRet -> fileVoList.add(new FileVo("退回单", fileRet.getName(), fileRet.getPreviewPath())));
ids.forEach(integer -> { ids.forEach(integer -> {
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单", fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单", fileVoList,taskBto.getId(),null);
DeviceLogDto deviceLogDto = new DeviceLogDto(integer, "上传退回单", fileVoList,taskBto.getId(),taskBto.getId());
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(integer); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(integer);
deviceLibrary.setLocationUnit(allotBackBill.getReceiveUnit()); deviceLibrary.setLocationUnit(allotBackBill.getReceiveUnit());
......
...@@ -42,6 +42,11 @@ ...@@ -42,6 +42,11 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-file</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-selfcheck</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -19,6 +19,8 @@ import com.tykj.dev.device.file.entity.FileRet; ...@@ -19,6 +19,8 @@ import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.controller.SelfCheckController;
import com.tykj.dev.device.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.task.repository.TaskDao; 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;
...@@ -50,8 +52,10 @@ import org.springframework.http.ResponseEntity; ...@@ -50,8 +52,10 @@ import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -1286,7 +1290,8 @@ public class DeviceCheckController { ...@@ -1286,7 +1290,8 @@ public class DeviceCheckController {
log.info("[核查模块] 办结统计待办操作成功"); log.info("[核查模块] 办结统计待办操作成功");
return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕")); return ResponseEntity.ok(new ResultObj<>("办结统计待办确认完毕"));
} }
@Autowired
private SelfCheckController selfCheckController;
/** /**
* @param statId 统计账单主键id * @param statId 统计账单主键id
*/ */
...@@ -1316,6 +1321,18 @@ public class DeviceCheckController { ...@@ -1316,6 +1321,18 @@ public class DeviceCheckController {
} }
log.info("[核查模块] 统计数据确认操作成功"); 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<>("统计数据确认完毕")); return ResponseEntity.ok(new ResultObj<>("统计数据确认完毕"));
} }
......
...@@ -95,10 +95,12 @@ public class DeviceLibraryController { ...@@ -95,10 +95,12 @@ public class DeviceLibraryController {
@ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情") @ApiOperation(value = "根据装备id查询装备详情", notes = "根据装备id查询装备详情")
@PostMapping("/selectByIds") @PostMapping("/selectByIds")
public ResponseEntity selectByIds(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){ public ResponseEntity selectByIds(@RequestBody DeviceSelectIdsVo deviceSelectIdsVo){
List<DeviceLibrary> deviceLibraries = new ArrayList<>(); // List<DeviceLibrary> deviceLibraries = new ArrayList<>();
deviceSelectIdsVo.getIds().forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer).setConfigName())); // deviceSelectIdsVo.getIds().forEach(integer -> deviceLibraries.add(deviceLibraryService.getOne(integer).setConfigName()));
List<DeviceLibrary> byIds = deviceLibraryService.findByIds(deviceSelectIdsVo.getIds());
byIds.forEach(DeviceLibrary::setConfigName);
//进行排序 //进行排序
List<DeviceLibrary> libraryList = deviceLibraries.stream().sorted(Comparator.comparing(DeviceLibrary::getModel) List<DeviceLibrary> libraryList = byIds.stream().sorted(Comparator.comparing(DeviceLibrary::getModel)
.thenComparing(DeviceLibrary::getName).thenComparing(DeviceLibrary::getSeqNumber)).collect(Collectors.toList()); .thenComparing(DeviceLibrary::getName).thenComparing(DeviceLibrary::getSeqNumber)).collect(Collectors.toList());
return ResponseEntity.ok(PageUtil.getPerPage(deviceSelectIdsVo.getPage(),deviceSelectIdsVo.getSize(),libraryList, PageRequest.of(deviceSelectIdsVo.getPage(),deviceSelectIdsVo.getSize()))); return ResponseEntity.ok(PageUtil.getPerPage(deviceSelectIdsVo.getPage(),deviceSelectIdsVo.getSize(),libraryList, PageRequest.of(deviceSelectIdsVo.getPage(),deviceSelectIdsVo.getSize())));
} }
...@@ -199,7 +201,7 @@ public class DeviceLibraryController { ...@@ -199,7 +201,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表") @ApiOperation(value = "模糊查询核心装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/core/feature/summary") @PostMapping("/core/feature/summary")
public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectCoreDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
// long strat = System.currentTimeMillis();
Boolean hasModelDim = deviceLibrarySelectVo.getModelDim()!=null; Boolean hasModelDim = deviceLibrarySelectVo.getModelDim()!=null;
Boolean hasNameDim = deviceLibrarySelectVo.getNameDim()!=null; Boolean hasNameDim = deviceLibrarySelectVo.getNameDim()!=null;
Boolean hasSeqDim = deviceLibrarySelectVo.getSeqDim()!=null; Boolean hasSeqDim = deviceLibrarySelectVo.getSeqDim()!=null;
...@@ -212,7 +214,6 @@ public class DeviceLibraryController { ...@@ -212,7 +214,6 @@ public class DeviceLibraryController {
Boolean hasStorageLocationDim = deviceLibrarySelectVo.getRfidCardDim()!=null; Boolean hasStorageLocationDim = deviceLibrarySelectVo.getRfidCardDim()!=null;
//形态 //形态
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null; // Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo); List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) { if (hasModelDim||hasLifeStatusDim||hasLocationUnitDim||hasNameDim||hasOwnUnitDim||hasSeqDim) {
...@@ -727,16 +728,18 @@ public class DeviceLibraryController { ...@@ -727,16 +728,18 @@ public class DeviceLibraryController {
public ResponseEntity updateSeqByDeviceId(@RequestBody DeviceSeqVo deviceSeqVo){ public ResponseEntity updateSeqByDeviceId(@RequestBody DeviceSeqVo deviceSeqVo){
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(deviceSeqVo.getId()); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(deviceSeqVo.getId());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String seqNumber = deviceSeqVo.getSeqNumber().trim();
//先判断序列号是否已经存在 //先判断序列号是否已经存在
DeviceLibrary bySeqNumber = deviceLibraryService.findBySeqNumber(deviceSeqVo.getSeqNumber()); DeviceLibrary bySeqNumber = deviceLibraryService.findBySeqNumber(seqNumber);
if (bySeqNumber != null){ if (bySeqNumber != null){
map.put("error","该序列号已经存在,请重新更换序列号"); map.put("error","该序列号已经存在,请重新更换序列号");
}else { }else {
//修改序列号
deviceLibrary.setSeqNumber(deviceSeqVo.getSeqNumber());
//添加日志 //添加日志
DeviceLogDto deviceLogDto = new DeviceLogDto(deviceSeqVo.getId(), "将装备序列号改为"+deviceSeqVo.getSeqNumber(), null,null,null); DeviceLogDto deviceLogDto = new DeviceLogDto(deviceSeqVo.getId(), "将装备序列号:"+deviceLibrary.getSeqNumber()+"改为"+seqNumber, null,null,null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
//修改序列号
deviceLibrary.setSeqNumber(deviceSeqVo.getSeqNumber());
deviceLibraryService.update(deviceLibrary); deviceLibraryService.update(deviceLibrary);
map.put("deviceLibrary",deviceLibrary); map.put("deviceLibrary",deviceLibrary);
map.put("success","装备序列号信息更新成功"); map.put("success","装备序列号信息更新成功");
......
...@@ -203,4 +203,9 @@ public interface DeviceLibraryService { ...@@ -203,4 +203,9 @@ public interface DeviceLibraryService {
* @param seqNumber 序列号 * @param seqNumber 序列号
*/ */
DeviceLibrary findBySeqNumber(String seqNumber); DeviceLibrary findBySeqNumber(String seqNumber);
// /**
// *
// */
// List<DeviceLibrary> findByIds2(List<Integer> ids);
} }
...@@ -103,6 +103,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -103,6 +103,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
if (selectAreaId == null) { if (selectAreaId == null) {
List<DeviceLibrary> libraryEntities; List<DeviceLibrary> libraryEntities;
//unitId为null,按照父子结构查询返回当前单位的所有装备 //unitId为null,按照父子结构查询返回当前单位的所有装备
long start = System.currentTimeMillis();
if (selectUnitId == null) { if (selectUnitId == null) {
libraryEntities = getList2(deviceLibrarySelectVo); libraryEntities = getList2(deviceLibrarySelectVo);
} }
...@@ -111,6 +112,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -111,6 +112,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
String unitName = userPublicService.findByUnitsToname(selectUnitId); String unitName = userPublicService.findByUnitsToname(selectUnitId);
libraryEntities = getList3(deviceLibrarySelectVo, unitName); libraryEntities = getList3(deviceLibrarySelectVo, unitName);
} }
//按照子装备跟在父装备后面排列返回 //按照子装备跟在父装备后面排列返回
// List<DeviceLibrary> resultList = new ArrayList<>(); // List<DeviceLibrary> resultList = new ArrayList<>();
// for (DeviceLibrary d : libraryEntities) { // for (DeviceLibrary d : libraryEntities) {
...@@ -210,17 +212,18 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -210,17 +212,18 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
List<DeviceLibrary> libraryEntities = getCoreDevicePage(d); List<DeviceLibrary> libraryEntities = getCoreDevicePage(d);
if (libraryEntities.size() > 0) { if (libraryEntities.size() > 0) {
// Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName())); // Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()+"Ǵ"+deviceLibrary.getType())); Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()+"Ǵ"+deviceLibrary.getType()+"Ǵ"+deviceLibrary.getMatchingRangeName()));
//按型号遍历统计各种状态的装备数量 //按型号遍历统计各种状态的装备数量
for (String s : map.keySet()) { for (String s : map.keySet()) {
String[] strings = s.split("Ǵ"); String[] strings = s.split("Ǵ");
if (strings.length == 3) { if (strings.length == 4) {
DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo(); DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo();
List<Integer> deviceIds = new ArrayList<>(); List<Integer> deviceIds = new ArrayList<>();
List<String> devSeqs = new ArrayList<>(); List<String> devSeqs = new ArrayList<>();
deviceStatisticsVo.setModel(strings[0]); deviceStatisticsVo.setModel(strings[0]);
deviceStatisticsVo.setName(strings[1]); deviceStatisticsVo.setName(strings[1]);
deviceStatisticsVo.setType(Integer.valueOf(strings[2])); deviceStatisticsVo.setType(Integer.valueOf(strings[2]));
deviceStatisticsVo.setMatchingRangeName(strings[3]);
// deviceStatisticsVo.setDeviceNumber(map.get(s).size()); // deviceStatisticsVo.setDeviceNumber(map.get(s).size());
// deviceStatisticsVo.setDeviceIds(map.get(s).stream().map(DeviceLibrary::getId).collect(Collectors.toList())); // deviceStatisticsVo.setDeviceIds(map.get(s).stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
int num = 0; int num = 0;
...@@ -611,7 +614,12 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -611,7 +614,12 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override @Override
public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) { public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo),deviceLibrarySelectVo.getPageable().getSort()); long l = System.currentTimeMillis();
List<DeviceLibrary> all = deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo), deviceLibrarySelectVo.getPageable().getSort());
// return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo),deviceLibrarySelectVo.getPageable().getSort());
System.out.println(System.currentTimeMillis()-l);
System.out.println("all");
return all;
} }
@Override @Override
......
...@@ -83,4 +83,7 @@ public class DeviceStatisticsVo { ...@@ -83,4 +83,7 @@ public class DeviceStatisticsVo {
@ApiModelProperty(value = "装备形态") @ApiModelProperty(value = "装备形态")
public Integer type; public Integer type;
@ApiModelProperty(value = "装备配用范围")
public String matchingRangeName;
} }
...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -282,17 +283,28 @@ public class PackingController { ...@@ -282,17 +283,28 @@ public class PackingController {
else { else {
resultList = packingLibraryService.getInsertList(selectPack); resultList = packingLibraryService.getInsertList(selectPack);
} }
Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(selectPack.getPage(), selectPack.getSize(), resultList, selectPack.getPageable());
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
//进行过滤 退装的目录下面 回收站
List<Integer> statuses = new ArrayList<>(Arrays.asList(3, 4));
//先过滤出child为空的
List<PackingLibrary> childs = resultList.stream().filter(packingLibrary -> packingLibrary.getChilds() == null || packingLibrary.getChilds().size() == 0).collect(Collectors.toList());
//取出不为空的
resultList.removeAll(childs);
childs.forEach(packingLibrary -> {
List<PackingLibrary> in = packingLibraryDao.findAllByPartParentIdAndPackingStatusIn(packingLibrary.getId(), statuses);
if (in == null || in.size() == 0) {
resultList.add(packingLibrary);
}
});
Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(selectPack.getPage(), selectPack.getSize(), resultList, selectPack.getPageable());
map.put("pages",packingLibraries); map.put("pages",packingLibraries);
List<String> models = new ArrayList<>(); // for (PackingLibrary p : resultList){
// for (PackingLibrary p : resultList){
// if (p.getIsRoot()==1){ // if (p.getIsRoot()==1){
// models.add(p.getModel()); // models.add(p.getModel());
// } // }
// } // }
List<String> models = new ArrayList<>(resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 1).map(PackingLibrary::getModel).collect(Collectors.toList()));
models.addAll(resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 1).map(PackingLibrary::getModel).collect(Collectors.toList()));
//去重 //去重
models = models.stream().distinct().collect(Collectors.toList()); models = models.stream().distinct().collect(Collectors.toList());
map.put("models",models); map.put("models",models);
...@@ -300,6 +312,34 @@ public class PackingController { ...@@ -300,6 +312,34 @@ public class PackingController {
return ResultUtil.success(map); return ResultUtil.success(map);
} }
// @ApiOperation(value = "查询父子结构列装")
// @PostMapping("/select")
// public ResponseEntity selectPack(@RequestBody SelectPack selectPack){
// List<PackingLibrary> resultList;
// if (selectPack.getContent()==null&&selectPack.getModel()==null&&selectPack.getName()==null&&selectPack.getSecretLevel()==null&&selectPack.getStatus()==null){
// resultList = packingLibraryService.setOrder(packingLibraryService.getInsertList(selectPack));
// }
// else {
// resultList = packingLibraryService.getInsertList(selectPack);
// }
// Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(selectPack.getPage(), selectPack.getSize(), resultList, selectPack.getPageable());
// Map<String,Object> map = new HashMap<>();
// map.put("pages",packingLibraries);
// List<String> models = new ArrayList<>();
//// for (PackingLibrary p : resultList){
//// if (p.getIsRoot()==1){
//// models.add(p.getModel());
//// }
//// }
//
// models.addAll(resultList.stream().filter(packingLibrary -> packingLibrary.getIsRoot() == 1).map(PackingLibrary::getModel).collect(Collectors.toList()));
// //去重
// models = models.stream().distinct().collect(Collectors.toList());
// map.put("models",models);
// map.put("names",resultList.stream().map(PackingLibrary::getName).collect(Collectors.toSet()));
// return ResultUtil.success(map);
// }
@ApiOperation(value = "根据型号查询所有装备附件") @ApiOperation(value = "根据型号查询所有装备附件")
@PostMapping("/selectByModel") @PostMapping("/selectByModel")
public ResponseEntity selectByModel(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo){ public ResponseEntity selectByModel(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo){
......
...@@ -11,6 +11,7 @@ import com.tykj.dev.device.packing.subject.vo.*; ...@@ -11,6 +11,7 @@ import com.tykj.dev.device.packing.subject.vo.*;
import com.tykj.dev.misc.utils.*; import com.tykj.dev.misc.utils.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.runtime.ListAdapter;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -91,6 +92,26 @@ public class PackingLibraryController { ...@@ -91,6 +92,26 @@ public class PackingLibraryController {
return ResultUtil.success(packingLibraryEntityPage); return ResultUtil.success(packingLibraryEntityPage);
} }
// @ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询")
// @PostMapping("/retired/summary")
// public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
// List<PackingLibrary> resultList = packingLibraryService.getInvalidPage(packingLibrarySelectVo, packingLibrarySelectVo.getPageable());
// //返回父子结构
// Map<Integer, PackingLibrary> nodeCollect =
// resultList.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
// List<PackingLibrary> resultList2 = GetTreeUtils.parseTreeFromDown(
// resultList,
// PackingLibrary::getId,
// packingLibrary -> Optional.ofNullable(nodeCollect.get(packingLibrary.getPartParentId())),
// PackingLibrary::addChildNode
// );
// Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(packingLibrarySelectVo.getPage(),packingLibrarySelectVo.getSize(),resultList2,packingLibrarySelectVo.getPageable());
// Map<String,Object> map = new HashMap<>();
// map.put("pages",packingLibraries);
// map.put("models",resultList.stream().map(PackingLibrary::getModel).collect(Collectors.toSet()));
// map.put("names",resultList.stream().map(PackingLibrary::getName).collect(Collectors.toSet()));
// return ResultUtil.success(map);
// }
@ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询") @ApiOperation(value = "列装库退装分页查询", notes = "可以通过这个接口进行列装查询")
@PostMapping("/retired/summary") @PostMapping("/retired/summary")
public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) { public ResponseEntity getInvalidPage(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
...@@ -98,24 +119,60 @@ public class PackingLibraryController { ...@@ -98,24 +119,60 @@ public class PackingLibraryController {
//返回父子结构 //返回父子结构
Map<Integer, PackingLibrary> nodeCollect = Map<Integer, PackingLibrary> nodeCollect =
resultList.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary)); resultList.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibrary -> packingLibrary));
List<PackingLibrary> resultList2 = GetTreeUtils.parseTreeFromDown( List<PackingLibrary> resultList2 = GetTreeUtils.parseTreeFromDown(
resultList, resultList,
PackingLibrary::getId, PackingLibrary::getId,
packingLibrary -> Optional.ofNullable(nodeCollect.get(packingLibrary.getPartParentId())), packingLibrary -> Optional.ofNullable(nodeCollect.get(packingLibrary.getPartParentId())),
PackingLibrary::addChildNode PackingLibrary::addChildNode
); );
Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(packingLibrarySelectVo.getPage(),packingLibrarySelectVo.getSize(),resultList2,packingLibrarySelectVo.getPageable()); //resultList2 拿到所有的model
Map<String,Object> map = new HashMap<>(); List<String> models = resultList2.stream().map(PackingLibrary::getModel).collect(Collectors.toList());
map.put("pages",packingLibraries); Set<String> names = resultList2.stream().map(PackingLibrary::getName).collect(Collectors.toSet());
map.put("models",resultList.stream().map(PackingLibrary::getModel).collect(Collectors.toSet())); // 交集集合
map.put("names",resultList.stream().map(PackingLibrary::getName).collect(Collectors.toSet())); List<PackingLibrary> defectList = new ArrayList<>();
for (String model : models) {
//model在models出现的次数
int count = Collections.frequency(models, model);
if (count > 1) {
//取出list<PackingLibrary>
List<Integer> allByModel = packingLibraryDao.findAllByModel(model).stream().map(PackingLibrary::getId).collect(Collectors.toList());
//取出交集
defectList = resultList2.stream().filter(packingLibrary -> allByModel.contains(packingLibrary.getId())).sorted(Comparator.comparing(PackingLibrary::getId)).collect(Collectors.toList());
//去除交集
resultList2.removeAll(defectList);
//进行按照model分组
Map<String, List<PackingLibrary>> map1 = defectList.stream().collect(Collectors.groupingBy(PackingLibrary::getModel));
List<PackingLibrary> context1 = getContext1(map1);
resultList2.addAll(context1);
}
}
//过滤出空目录
//判断它本身是不是就是空目录
List<PackingLibrary> finalResult = resultList2.stream().filter(packingLibrary -> (packingLibrary.getChilds() != null && packingLibrary.getChilds().size() != 0))
.collect(Collectors.toList());
resultList2.removeAll(finalResult);
for (PackingLibrary packingLibrary : resultList2) {
if (packingLibraryDao.findAllByModel(packingLibrary.getModel()).size() >0){
finalResult.add(packingLibrary);
}
}
Page<PackingLibrary> packingLibraries = PageUtil.getPerPage(packingLibrarySelectVo.getPage(), packingLibrarySelectVo.getSize(), finalResult, packingLibrarySelectVo.getPageable());
Map<String, Object> map = new HashMap<>();
map.put("pages", packingLibraries);
// map.put("models", resultList2.stream().map(PackingLibrary::getModel).collect(Collectors.toSet()));
map.put("models", models.stream().distinct().collect(Collectors.toList()));
// map.put("names", resultList2.stream().map(PackingLibrary::getName).collect(Collectors.toSet()));
map.put("names", names);
return ResultUtil.success(map); return ResultUtil.success(map);
} }
@ApiOperation(value = "列装库列表查询", notes = "可以通过这个接口进行列装查询") @ApiOperation(value = "列装库列表查询", notes = "可以通过这个接口进行列装查询")
@PostMapping("/getList") @PostMapping("/getList")
public ResponseEntity getList(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) { public ResponseEntity getList(@RequestBody PackingLibrarySelectVo packingLibrarySelectVo) {
List<PackingLibrary> packingLibraryEntities = packingLibraryService.getList(packingLibrarySelectVo); List<PackingLibrary> packingLibraryEntities = packingLibraryService.getList1(packingLibrarySelectVo);
// if (packingLibrarySelectVo.ids!=null&&packingLibrarySelectVo.ids.size()>0) { // if (packingLibrarySelectVo.ids!=null&&packingLibrarySelectVo.ids.size()>0) {
// packingLibraryEntities.removeIf(p -> packingLibrarySelectVo.ids.contains(p.getId())); // packingLibraryEntities.removeIf(p -> packingLibrarySelectVo.ids.contains(p.getId()));
// packingLibraryEntities.forEach(packingLibrary -> { // packingLibraryEntities.forEach(packingLibrary -> {
...@@ -321,4 +378,60 @@ public class PackingLibraryController { ...@@ -321,4 +378,60 @@ public class PackingLibraryController {
return ResultUtil.success(packingLibraryService.getInsertList(selectPack)); return ResultUtil.success(packingLibraryService.getInsertList(selectPack));
} }
public List<PackingLibrary> getContext1(Map<String,List<PackingLibrary>> map){
List<PackingLibrary> context = new ArrayList<>();
for (List<PackingLibrary> value : map.values()) {
PackingLibrary context2 = getContext2(value);
context.add(context2);
}
return context;
}
public PackingLibrary getContext2(List<PackingLibrary> packingLibraries){
//判断集合的长度 801 802 803 804 只操作804 或者803
//取出目录
PackingLibrary packingLibrary = packingLibraries.get(0);
packingLibraries.remove(packingLibrary);
List<PackingLibrary> finalPackingList = new ArrayList<>();
for (int i = 0; i < packingLibraries.size(); i++) {
//会造成覆盖
if (packingLibrary.getChilds() != null){
List<PackingLibrary> childs = packingLibrary.getChilds();
finalPackingList.addAll(childs);
finalPackingList.addAll(packingLibraries);
packingLibrary.setChilds(finalPackingList);
}else {
//直接赋值
packingLibrary.setChilds(packingLibraries);
}
}
return packingLibrary;
}
public PackingLibrary getContext4(List<PackingLibrary> packingLibraries){ //12 6
//判断集合的长度 801 802 803 804 只操作804 或者803
//取出目录
PackingLibrary root = packingLibraries.get(0);
packingLibraries.removeIf(e -> Objects.equals(e,root));
List<PackingLibrary> finalPackingList = new ArrayList<>();
for (int i = 0; i < packingLibraries.size(); i++) {
//会造成覆盖
if (root.getChilds() != null){
List<PackingLibrary> childs = root.getChilds();
finalPackingList.addAll(childs);
finalPackingList.addAll(packingLibraries);
root.setChilds(finalPackingList);
}else {
//直接赋值
root.setChilds(packingLibraries);
}
}
return root;
}
} }
...@@ -36,5 +36,20 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer ...@@ -36,5 +36,20 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
PackingLibrary findByDeleteTagAndIdAndPackingStatus(Integer deleteTag,Integer id,Integer packingStatus); PackingLibrary findByDeleteTagAndIdAndPackingStatus(Integer deleteTag,Integer id,Integer packingStatus);
List<PackingLibrary> findByInvisibleRangeAndTypeAndName(Integer invisibleRange,Integer type,String name); List<PackingLibrary> findByInvisibleRangeAndTypeAndName(Integer invisibleRange,Integer type,String name);
/**
*
*/
List<PackingLibrary> findAllByPartParentIdAndPackingStatusIn(Integer partParentId,List<Integer> status);
/**
* 根据型号取出目录
*/
List<PackingLibrary> findAllByModelInAndIsRootAndPackingStatus(List<String> models,Integer isRoot,Integer packingStatus);
/**
* 根据型号查出所有
*/
List<PackingLibrary> findAllByModel(String model);
} }
...@@ -44,6 +44,12 @@ public interface PackingLibraryService{ ...@@ -44,6 +44,12 @@ public interface PackingLibraryService{
*/ */
List<PackingLibrary> getList(PackingLibrarySelectVo packingLibrarySelectVo); List<PackingLibrary> getList(PackingLibrarySelectVo packingLibrarySelectVo);
/**
* @param packingLibrarySelectVo 列装查询vo
* 获取父子结构列装列表
*/
List<PackingLibrary> getList1(PackingLibrarySelectVo packingLibrarySelectVo);
/** /**
* 获取所有存在的类型列表 * 获取所有存在的类型列表
*/ */
......
...@@ -119,12 +119,32 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -119,12 +119,32 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
@Override @Override
public List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable) { public List<PackingLibrary> getInvalidPage(PackingLibrarySelectVo packingLibrarySelectVo, Pageable pageable) {
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification2(packingLibrarySelectVo),pageable.getSort()); List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification2(packingLibrarySelectVo),pageable.getSort());
//取出退装的model
List<String> models = packingLibraryEntities.stream().map(PackingLibrary::getModel).distinct().collect(Collectors.toList());
//取出相同型号的目录
List<PackingLibrary> byModelAndIsRoot = findByModelAndIsRoot(models);
packingLibraryEntities.addAll(byModelAndIsRoot);
packingLibraryEntities.forEach(PackingLibrary::setConfigName); packingLibraryEntities.forEach(PackingLibrary::setConfigName);
return packingLibraryEntities; return packingLibraryEntities;
} }
@Override @Override
public List<PackingLibrary> getList(PackingLibrarySelectVo packingLibrarySelectVo) { public List<PackingLibrary> getList(PackingLibrarySelectVo packingLibrarySelectVo) {
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification22(packingLibrarySelectVo));
packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
packingLibraryEntities.stream().collect(Collectors.toMap(PackingLibrary::getId, packingLibraryEntity -> packingLibraryEntity));
return GetTreeUtils.parseTreeFromDown(
packingLibraryEntities,
PackingLibrary::getId,
packingLibraryEntity -> Optional.ofNullable(nodeCollect.get(packingLibraryEntity.getPartParentId())),
PackingLibrary::addChildNode
).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList());
}
@Override
public List<PackingLibrary> getList1(PackingLibrarySelectVo packingLibrarySelectVo) {
List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification(packingLibrarySelectVo)); List<PackingLibrary> packingLibraryEntities = packingLibraryDao.findAll(getSelectSpecification(packingLibrarySelectVo));
packingLibraryEntities.forEach(PackingLibrary::setConfigName); packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构 //返回父子结构
...@@ -138,6 +158,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -138,6 +158,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList()); ).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList());
} }
@Override @Override
public List<Integer> getTypeList() { public List<Integer> getTypeList() {
List<PackingLibrary> list = packingLibraryDao.findAll(); List<PackingLibrary> list = packingLibraryDao.findAll();
...@@ -797,54 +818,54 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -797,54 +818,54 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
predicateBuilder.eq("isRoot",0); predicateBuilder.eq("isRoot",0);
return predicateBuilder.build(); return predicateBuilder.build();
} }
// private Specification<PackingLibrary> getSelectSpecification(PackingLibrarySelectVo packingLibrarySelectVo) { private Specification<PackingLibrary> getSelectSpecification22(PackingLibrarySelectVo packingLibrarySelectVo) {
// PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and(); PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
// Integer level = userUtils.getCurrentUnitLevel(); Integer level = userUtils.getCurrentUnitLevel();
// if (level == 2) { if (level == 2) {
// predicateBuilder.in("invisibleRange", new Integer[]{2, 3}); predicateBuilder.in("invisibleRange", new Integer[]{2, 3});
// } }
// if (level == 3) { if (level == 3) {
// predicateBuilder.eq("invisibleRange", 3); predicateBuilder.eq("invisibleRange", 3);
// } }
// if (packingLibrarySelectVo != null) { if (packingLibrarySelectVo != null) {
// if (packingLibrarySelectVo.getContent() != null) { if (packingLibrarySelectVo.getContent() != null) {
// Class<PackingLibrary> packingLibraryEntityClass = PackingLibrary.class; Class<PackingLibrary> packingLibraryEntityClass = PackingLibrary.class;
// Field[] declaredFields = packingLibraryEntityClass.getDeclaredFields(); Field[] declaredFields = packingLibraryEntityClass.getDeclaredFields();
// PredicateBuilder<PackingLibrary> p = Specifications.or(); PredicateBuilder<PackingLibrary> p = Specifications.or();
// for (Field field : declaredFields) { for (Field field : declaredFields) {
// if (field.getType().equals(String.class) && field.getAnnotation(Transient.class) == null) { if (field.getType().equals(String.class) && field.getAnnotation(Transient.class) == null) {
// p.like(field.getName(), "%" + packingLibrarySelectVo.getContent() + "%"); p.like(field.getName(), "%" + packingLibrarySelectVo.getContent() + "%");
// } }
// } }
// predicateBuilder.predicate(p.build()); predicateBuilder.predicate(p.build());
// } }
// if (packingLibrarySelectVo.getStartTime() != null) { if (packingLibrarySelectVo.getStartTime() != null) {
// predicateBuilder.gt("createTime", packingLibrarySelectVo.getStartTime()); predicateBuilder.gt("createTime", packingLibrarySelectVo.getStartTime());
// } }
// if (packingLibrarySelectVo.getEndTime() != null) { if (packingLibrarySelectVo.getEndTime() != null) {
// predicateBuilder.lt("updateTime", packingLibrarySelectVo.getEndTime()); predicateBuilder.lt("updateTime", packingLibrarySelectVo.getEndTime());
// } }
// if (packingLibrarySelectVo.getModel() != null) { if (packingLibrarySelectVo.getModel() != null) {
// predicateBuilder.eq("model", packingLibrarySelectVo.getModel()); predicateBuilder.eq("model", packingLibrarySelectVo.getModel());
// } }
// if (packingLibrarySelectVo.getType() != null) { if (packingLibrarySelectVo.getType() != null) {
// predicateBuilder.eq("type", packingLibrarySelectVo.getType()); predicateBuilder.eq("type", packingLibrarySelectVo.getType());
// } }
// if (packingLibrarySelectVo.getSecretLevel() != null) { if (packingLibrarySelectVo.getSecretLevel() != null) {
// predicateBuilder.eq("secretLevel", packingLibrarySelectVo.getSecretLevel()); predicateBuilder.eq("secretLevel", packingLibrarySelectVo.getSecretLevel());
// } }
// if (packingLibrarySelectVo.getInvisibleRange() != null) { if (packingLibrarySelectVo.getInvisibleRange() != null) {
// predicateBuilder.eq("invisibleRange", packingLibrarySelectVo.getInvisibleRange()); predicateBuilder.eq("invisibleRange", packingLibrarySelectVo.getInvisibleRange());
// } }
// if (packingLibrarySelectVo.getName() != null) { if (packingLibrarySelectVo.getName() != null) {
// predicateBuilder.eq("name", packingLibrarySelectVo.getName()); predicateBuilder.eq("name", packingLibrarySelectVo.getName());
// } }
// } }
// predicateBuilder.eq("packingStatus", 2); predicateBuilder.eq("packingStatus", 2);
//// predicateBuilder.eq("isRoot",0); // predicateBuilder.eq("isRoot",0);
// predicateBuilder.in("isRoot",new Integer[]{0,1}); predicateBuilder.in("isRoot",new Integer[]{0,1});
// return predicateBuilder.build(); return predicateBuilder.build();
// } }
private Specification<PackingLibrary> getSelectSpecification2(PackingLibrarySelectVo packingLibrarySelectVo) { private Specification<PackingLibrary> getSelectSpecification2(PackingLibrarySelectVo packingLibrarySelectVo) {
PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and(); PredicateBuilder<PackingLibrary> predicateBuilder = Specifications.and();
...@@ -877,7 +898,8 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -877,7 +898,8 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
predicateBuilder.eq("model", packingLibrarySelectVo.getModel()); predicateBuilder.eq("model", packingLibrarySelectVo.getModel());
} }
if (packingLibrarySelectVo.getName() != null) { if (packingLibrarySelectVo.getName() != null) {
predicateBuilder.eq("name", packingLibrarySelectVo.getName()); // predicateBuilder.eq("name", packingLibrarySelectVo.getName());
predicateBuilder.like("name", "%"+packingLibrarySelectVo.getName()+"%");
} }
if (packingLibrarySelectVo.getType() != null) { if (packingLibrarySelectVo.getType() != null) {
predicateBuilder.eq("type", packingLibrarySelectVo.getType()); predicateBuilder.eq("type", packingLibrarySelectVo.getType());
...@@ -894,10 +916,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -894,10 +916,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
else { else {
predicateBuilder.eq("packingStatus", 3); predicateBuilder.eq("packingStatus", 3);
} }
//新增 // predicateBuilder.eq(packingLibrarySelectVo.getPackingStatus()!= null,"packingStatus",packingLibrarySelectVo.getPackingStatus());
// predicateBuilder.in("isRoot",new Integer[]{0,1});
} }
// predicateBuilder.eq("isPart", 0); // predicateBuilder.eq("isPart", 0);
// predicateBuilder.in("isRoot",new Integer[]{0,1});
return predicateBuilder.build(); return predicateBuilder.build();
} }
...@@ -977,4 +999,8 @@ public class PackingLibraryServiceImpl implements PackingLibraryService { ...@@ -977,4 +999,8 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
predicateBuilder.eq("packingStatus", 2); predicateBuilder.eq("packingStatus", 2);
return predicateBuilder.build(); return predicateBuilder.build();
} }
private List<PackingLibrary> findByModelAndIsRoot(List<String> models){
return packingLibraryDao.findAllByModelInAndIsRootAndPackingStatus(models,1,2);
}
} }
...@@ -264,6 +264,8 @@ public class PackingLibrary { ...@@ -264,6 +264,8 @@ public class PackingLibrary {
this.childs=null; this.childs=null;
} }
public PackingLibrary setConfigName(){ public PackingLibrary setConfigName(){
ConfigCache configCache = SpringUtils.getBean("initConfigCache"); ConfigCache configCache = SpringUtils.getBean("initConfigCache");
if (configCache != null) { if (configCache != null) {
......
...@@ -159,4 +159,8 @@ public class WaitingRepairEquipmentVo { ...@@ -159,4 +159,8 @@ public class WaitingRepairEquipmentVo {
@ApiModelProperty(value = "任务uservo") @ApiModelProperty(value = "任务uservo")
private TaskUserVo taskUserVos; private TaskUserVo taskUserVos;
@ApiModelProperty(value = "任务uservo")
private TaskUserVo backTaskUserVos;
} }
...@@ -35,6 +35,7 @@ import io.swagger.annotations.Api; ...@@ -35,6 +35,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -100,6 +101,7 @@ public class DeviceRetiredController { ...@@ -100,6 +101,7 @@ public class DeviceRetiredController {
this.taskLogService = taskLogService; this.taskLogService = taskLogService;
} }
@ApiOperation(value = "查询可退装装备", notes = "可以通过这个接口查询销毁单") @ApiOperation(value = "查询可退装装备", notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/devices") @PostMapping(value = "/devices")
public ResponseEntity selectRepairBill(@RequestBody CanRetiredDeviceSelectVo canRetiredDeviceSelectVo) { public ResponseEntity selectRepairBill(@RequestBody CanRetiredDeviceSelectVo canRetiredDeviceSelectVo) {
...@@ -125,8 +127,39 @@ public class DeviceRetiredController { ...@@ -125,8 +127,39 @@ public class DeviceRetiredController {
d -> Optional.ofNullable(nodeCollect.get(d.getPartParentId())), d -> Optional.ofNullable(nodeCollect.get(d.getPartParentId())),
DeviceRetiredResultVo::addChildNode DeviceRetiredResultVo::addChildNode
); );
return ResultUtil.success(containList); //过滤出目录下面为空的目录
List<DeviceRetiredResultVo> finalContainList = containList.stream().filter(deviceRetiredResultVo -> deviceRetiredResultVo.getChilds() != null && deviceRetiredResultVo.getChilds().size() != 0).collect(Collectors.toList());
//分页
Page<DeviceRetiredResultVo> retiredResultVos = PageUtil.getPerPage(canRetiredDeviceSelectVo.getPage(), canRetiredDeviceSelectVo.getSize(), finalContainList, canRetiredDeviceSelectVo.getPageable());
return ResultUtil.success(retiredResultVos);
} }
// @ApiOperation(value = "查询可退装装备", notes = "可以通过这个接口查询销毁单")
// @PostMapping(value = "/devices")
// public ResponseEntity selectRepairBill(@RequestBody CanRetiredDeviceSelectVo canRetiredDeviceSelectVo) {
// //最终返回的List<VO>
// List<DeviceRetiredResultVo> deviceRetiredResultVos = new ArrayList<>();
// //查询类构建
// PackingLibrarySelectVo packingLibrarySelectVo = new PackingLibrarySelectVo();
// BeanUtils.copyProperties(canRetiredDeviceSelectVo, packingLibrarySelectVo);
// List<PackingLibrary> list = GetTreeUtils.splitTree(packingLibraryService.getList(packingLibrarySelectVo),PackingLibrary::getChilds,PackingLibrary::setChildNull);
// //循环获取列装主体的数量,并生成VO
// for(PackingLibrary packingLibrary : list) {
// DeviceRetiredResultVo deviceRetiredResultVo = calcDeviceRetiredResultVo(packingLibrary);
// //新增名称
//// systemConfigService.findByEnglishNameAndValue(packingLibrary.get,packingLibrary.getMatchingRange())
// deviceRetiredResultVos.add(deviceRetiredResultVo);
// }
// List<DeviceRetiredResultVo> deviceRetiredResultVos2 = canRetired(deviceRetiredResultVos);
// Map<Integer, DeviceRetiredResultVo> nodeCollect =
// deviceRetiredResultVos2.stream().collect(Collectors.toMap(DeviceRetiredResultVo::getId, deviceRetiredResultVo -> deviceRetiredResultVo));
// List<DeviceRetiredResultVo> containList = GetTreeUtils.parseTreeFromDown(
// deviceRetiredResultVos2,
// DeviceRetiredResultVo::getId,
// d -> Optional.ofNullable(nodeCollect.get(d.getPartParentId())),
// DeviceRetiredResultVo::addChildNode
// );
// return ResultUtil.success(containList);
// }
@ApiOperation(value = "提交退装表单", notes = "可以通过这个接口提交销毁表单发起退装流程") @ApiOperation(value = "提交退装表单", notes = "可以通过这个接口提交销毁表单发起退装流程")
@PostMapping(value = "/form") @PostMapping(value = "/form")
......
package com.tykj.dev.device.retired.entity.vo; package com.tykj.dev.device.retired.entity.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -12,7 +13,7 @@ import lombok.Data; ...@@ -12,7 +13,7 @@ import lombok.Data;
**/ **/
@ApiModel("可销毁装备查询类") @ApiModel("可销毁装备查询类")
@Data @Data
public class CanRetiredDeviceSelectVo { public class CanRetiredDeviceSelectVo extends CustomPage {
@ApiModelProperty(value = "模糊查询", example = "装备1") @ApiModelProperty(value = "模糊查询", example = "装备1")
private String content; private String content;
......
...@@ -149,7 +149,6 @@ public class SelfCheckSchedulerTask { ...@@ -149,7 +149,6 @@ public class SelfCheckSchedulerTask {
//发起待自查任务 //发起待自查任务
List<Integer> userIds = new ArrayList<>(); List<Integer> userIds = new ArrayList<>();
userIds.add(0); userIds.add(0);
// selfCheckBill.setTitle("系统发起"+units.getName()+"自查任务");
TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds); TaskBto taskBto = new TaskBto(StatusEnum.WAIT_SELF_CHECK.id,title.toString(),null,".",selfCheckBill1.getId(),4,units.getUnitId(),0,null,userIds);
taskService.start(taskBto); taskService.start(taskBto);
}); });
......
...@@ -18,6 +18,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.*; ...@@ -18,6 +18,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.*;
import com.tykj.dev.device.task.service.TaskLogService; 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.domin.Task;
import com.tykj.dev.device.user.read.service.MessageService; 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;
...@@ -125,6 +126,7 @@ public class SelfCheckController { ...@@ -125,6 +126,7 @@ public class SelfCheckController {
public ResponseEntity setCycle(@PathVariable("type") int type){ public ResponseEntity setCycle(@PathVariable("type") int type){
if (selfCheckSchedulerTask!=null) { if (selfCheckSchedulerTask!=null) {
String corn = "0 0 0 1 1/"+type+" ? "; String corn = "0 0 0 1 1/"+type+" ? ";
// String corn = "10-20 * * * * ?";
ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture(); ScheduledFuture scheduledFuture = selfCheckSchedulerTask.getScheduledFuture();
scheduledFuture.cancel(true); scheduledFuture.cancel(true);
selfCheckSchedulerTask.setCron(corn); selfCheckSchedulerTask.setCron(corn);
...@@ -572,7 +574,7 @@ public class SelfCheckController { ...@@ -572,7 +574,7 @@ public class SelfCheckController {
public ResponseEntity isSaveSelfTask(@RequestBody SaveSelfTaskVo saveSelfTaskVo){ public ResponseEntity isSaveSelfTask(@RequestBody SaveSelfTaskVo saveSelfTaskVo){
//保存自查任务 //保存自查任务
if (saveSelfTaskVo.getIsSave() == 0){ if (saveSelfTaskVo.getIsSave() == 0){
return this.selectDetail( taskService.get(saveSelfTaskVo.getTaskId()).getBillId()); return this.selectDetail(taskService.get(saveSelfTaskVo.getTaskId()).getBillId());
}else { }else {
//删除task //删除task
TaskBto taskBto = taskService.get(saveSelfTaskVo.getTaskId()); TaskBto taskBto = taskService.get(saveSelfTaskVo.getTaskId());
...@@ -593,7 +595,7 @@ public class SelfCheckController { ...@@ -593,7 +595,7 @@ public class SelfCheckController {
@ApiOperation(value = "是否保存自查任务", notes = "可以通过这个接口查询是否保存自查任务") @ApiOperation(value = "是否保存自查任务", notes = "可以通过这个接口查询是否保存自查任务")
@GetMapping(value = "/isSaveSelfTask") @GetMapping(value = "/test")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity toSave(){ public ResponseEntity toSave(){
List<Units> unitsList = unitsDao.findAll(); List<Units> unitsList = unitsDao.findAll();
...@@ -657,4 +659,18 @@ public class SelfCheckController { ...@@ -657,4 +659,18 @@ public class SelfCheckController {
return ResponseEntity.ok("ok"); 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;
}
} }
package com.tykj.dev.device.selfcheck.repository; package com.tykj.dev.device.selfcheck.repository;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.Date;
import java.util.List;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
public interface SelfCheckBillDao extends JpaRepository<SelfCheckBill, Integer>, JpaSpecificationExecutor<SelfCheckBill> { 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);
} }
...@@ -6,6 +6,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo; ...@@ -6,6 +6,7 @@ import com.tykj.dev.device.selfcheck.subject.vo.SelfCheckSelectVo;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -27,4 +28,9 @@ public interface SelfCheckBillService { ...@@ -27,4 +28,9 @@ public interface SelfCheckBillService {
Page<SelfCheckBill> getPage(SelfCheckSelectVo selfCheckSelectVo, Pageable pageable); Page<SelfCheckBill> getPage(SelfCheckSelectVo selfCheckSelectVo, Pageable pageable);
void delete(Integer id); void delete(Integer id);
/**
* 根据核查完成时间去查询当前单位系统发起的自查任务
*/
List<SelfCheckBill> findByDate(Date date,String unitName);
} }
...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import javax.persistence.Transient; import javax.persistence.Transient;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
...@@ -100,6 +101,11 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService { ...@@ -100,6 +101,11 @@ public class SelfCheckBillServiceImpl implements SelfCheckBillService {
selfExaminationBillDao.deleteById(id); selfExaminationBillDao.deleteById(id);
} }
@Override
public List<SelfCheckBill> findByDate(Date date,String unitName) {
return selfExaminationBillDao.findAllByCreateTimeAfterAndCheckUnitAndCheckStatusAndCreateUserId(date,unitName,3,null);
}
private Specification<SelfCheckBill> getSelectSpecification(SelfCheckSelectVo selfCheckSelectVo) { private Specification<SelfCheckBill> getSelectSpecification(SelfCheckSelectVo selfCheckSelectVo) {
PredicateBuilder<SelfCheckBill> predicateBuilder = Specifications.and(); PredicateBuilder<SelfCheckBill> predicateBuilder = Specifications.and();
predicateBuilder.eq("checkUnit",userUtils.getCurrentUserUnitName()); predicateBuilder.eq("checkUnit",userUtils.getCurrentUserUnitName());
......
...@@ -490,7 +490,8 @@ public class StorageBillController { ...@@ -490,7 +490,8 @@ public class StorageBillController {
saveEntities.add(saveEntity); saveEntities.add(saveEntity);
stringBuffer.append(saveEntity.getId()); stringBuffer.append(saveEntity.getId());
//存装备日志 //存装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,null); DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,taskEntity1.getId());
// DeviceLogDto deviceLogDto = new DeviceLogDto(saveEntity.getId(), logMessage, fileVoList,null,null);
deviceLogDtos.add(deviceLogDto); deviceLogDtos.add(deviceLogDto);
stringBuffer.append("x"); stringBuffer.append("x");
//申请业务列装入库数量+1 //申请业务列装入库数量+1
......
package com.tykj.dev.device.task.repository; package com.tykj.dev.device.task.repository;
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 org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
...@@ -85,4 +86,8 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE ...@@ -85,4 +86,8 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
//zsp //zsp
Task findByParentTaskId(Integer parentTaskId); Task findByParentTaskId(Integer parentTaskId);
//zsp
List<Task> findAllByBillIdAndBusinessTypeAndOwnUnit(Integer billId, Integer businessType, Integer ownUnit);
} }
...@@ -143,6 +143,7 @@ public interface TaskService { ...@@ -143,6 +143,7 @@ public interface TaskService {
* 根据billId和businessType获得Task * 根据billId和businessType获得Task
*/ */
TaskBto getParentTaskIsNull(Integer billId, Integer businessType); TaskBto getParentTaskIsNull(Integer billId, Integer businessType);
TaskBto getParentTaskIsNotNull(Integer billId, Integer businessType);
/** /**
* @param taskSelectVo 获取跟踪和待办业务列表 * @param taskSelectVo 获取跟踪和待办业务列表
...@@ -233,7 +234,7 @@ public interface TaskService { ...@@ -233,7 +234,7 @@ public interface TaskService {
TaskBto findByTaskId(Integer taskId); TaskBto findByTaskId(Integer taskId);
List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId,Integer businessType);
List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer billId,Integer businessType,Integer ownUnit);
} }
...@@ -414,6 +414,18 @@ public class TaskServiceImpl implements TaskService { ...@@ -414,6 +414,18 @@ public class TaskServiceImpl implements TaskService {
} }
} }
@Override
public TaskBto getParentTaskIsNotNull(Integer billId, Integer businessType) {
List<Task> tasks = taskDao.findAllByBillIdAndBusinessType(billId, businessType);
tasks = tasks.stream().filter(task -> task.getParentTaskId() != null).collect(Collectors.toList());
if (tasks.size()==0){
return new TaskBto();
// throw new ApiException(String.format("要查询的数据不存在,查询的billId为 %d,businessType为 %d", billId, businessType));
}else {
return tasks.get(0).parse2Bto();
}
}
/** /**
* @param taskSelectVo 获取跟踪和待办业务列表 * @param taskSelectVo 获取跟踪和待办业务列表
*/ */
...@@ -1121,6 +1133,22 @@ public class TaskServiceImpl implements TaskService { ...@@ -1121,6 +1133,22 @@ public class TaskServiceImpl implements TaskService {
return taskDao.findById(taskId).get().parse2Bto(); return taskDao.findById(taskId).get().parse2Bto();
} }
@Override
public List<TaskBto> findAllByBillIdAndBusinessType2(Integer billId, Integer businessType) {
List<Task> taskList = taskDao.findAllByBillIdAndBusinessType(billId, businessType);
List<TaskBto> taskBtos = new ArrayList<>();
for (Task task : taskList) {
TaskBto taskBto = task.parse2Bto();
taskBtos.add(taskBto);
}
return taskBtos;
}
@Override
public List<Task> findAllByBillAndBusinessTypeAndOwnUnit(Integer billId,Integer businessType,Integer ownUnit) {
return taskDao.findAllByBillIdAndBusinessTypeAndOwnUnit(billId,businessType,ownUnit);
}
@Override @Override
public void moveAllSonNodeToEnd(Integer taaskId) { public void moveAllSonNodeToEnd(Integer taaskId) {
List<Task> tasks = taskDao.findAllByParentTaskId(taaskId); List<Task> tasks = taskDao.findAllByParentTaskId(taaskId);
......
...@@ -75,6 +75,7 @@ public class Message { ...@@ -75,6 +75,7 @@ public class Message {
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)") @ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0; private Integer deleteTag = 0;
@Lob
@Column(name = "record",columnDefinition = "TEXT") @Column(name = "record",columnDefinition = "TEXT")
@ApiModelProperty(value = "附加信息") @ApiModelProperty(value = "附加信息")
private String record; private String record;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论