提交 1d3af8d9 authored 作者: zhoushaopan's avatar zhoushaopan

[配发,入库,维修,退回,新增版本,自查]优化代码和更新代码

上级 c3e97325
...@@ -11,6 +11,7 @@ import com.tykj.dev.device.allot.service.AllotBackBillService; ...@@ -11,6 +11,7 @@ import com.tykj.dev.device.allot.service.AllotBackBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBackBill; import com.tykj.dev.device.allot.subject.domin.AllotBackBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo; import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
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.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
...@@ -139,13 +140,13 @@ public class AllotBackBillServiceImpl implements AllotBackBillService { ...@@ -139,13 +140,13 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
Integer billId = taskService.get(taskId).getBillId(); Integer billId = taskService.get(taskId).getBillId();
AllotBackBill allotBackBill = getOne(billId); AllotBackBill allotBackBill = getOne(billId);
//收件方签收单集合 //收件方签收单集合
map.put(FileName.SIGN.name,allotBackBill.getReceiveFileList()); map.put(FileName.SIGN.name, FilesUtil.stringFileToList(allotBackBill.getReceiveFiles()));
//申请文号文件集合 //申请文号文件集合
map.put(FileName.APPLY.name,allotBackBill.getApplyFileList()); map.put(FileName.APPLY.name,FilesUtil.stringFileToList(allotBackBill.getApplyFiles()));
//批复文号文件集合 //批复文号文件集合
map.put(FileName.RECEIPT.name,allotBackBill.getReplyFileList()); map.put(FileName.RECEIPT.name,FilesUtil.stringFileToList(allotBackBill.getReplyFiles()));
//发件方回执单集合 //发件方回执单集合
map.put(FileName.RECEIPT.name,allotBackBill.getSendFileList()); map.put(FileName.RECEIPT.name,FilesUtil.stringFileToList(allotBackBill.getSendFiles()));
return map; return map;
} }
......
...@@ -11,10 +11,12 @@ import com.tykj.dev.device.allot.service.AllotBillService; ...@@ -11,10 +11,12 @@ import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo; import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
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.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import org.aspectj.util.FileUtil;
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;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -139,13 +141,13 @@ public class AllotBillServiceImpl implements AllotBillService { ...@@ -139,13 +141,13 @@ public class AllotBillServiceImpl implements AllotBillService {
Integer billId = taskService.get(taskId).getBillId(); Integer billId = taskService.get(taskId).getBillId();
AllotBill allotBill = getOne(billId); AllotBill allotBill = getOne(billId);
//收件方签收单集合 //收件方签收单集合
map.put(FileName.SIGN.name,allotBill.getReceiveFileList()); map.put(FileName.SIGN.name, FilesUtil.stringFileToList(allotBill.getReceiveFiles()));
//申请文号文件集合 //申请文号文件集合
map.put(FileName.APPLY.name,allotBill.getApplyFileList()); map.put(FileName.APPLY.name,FilesUtil.stringFileToList(allotBill.getApplyFiles()));
//批复文号文件集合 //批复文号文件集合
map.put(FileName.RECEIPT.name,allotBill.getReplyFileList()); map.put(FileName.REPLY.name,FilesUtil.stringFileToList(allotBill.getReplyFiles()));
//发件方回执单集合 //发件方回执单集合
map.put(FileName.RECEIPT.name,allotBill.getSendFileList()); map.put(FileName.RECEIPT.name,FilesUtil.stringFileToList(allotBill.getSendFiles()));
return map; return map;
} }
......
...@@ -19,12 +19,12 @@ public enum FileName { ...@@ -19,12 +19,12 @@ public enum FileName {
/** /**
* 签收单 * 签收单
*/ */
SIGN(3,"签收单"), SIGN(4,"签收单"),
/** /**
* 销毁单 * 销毁单
*/ */
DESTROY(4,"销毁单"); DESTROY(5,"销毁单");
public Integer id; public Integer id;
......
...@@ -652,10 +652,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -652,10 +652,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override @Override
public Map<Integer,List<DeviceLibrary>> findAllByPackingId3() { public Map<Integer,List<DeviceLibrary>> findAllByPackingId3() {
//筛选出当前单位在库的装备 //筛选出当前单位在库的装备
long l = System.currentTimeMillis();
// List<DeviceLibrary> deviceLibraryList = cacheLibraryController.getAll();
List<DeviceLibrary> deviceLibraryList = cacheLibraryService.getAllDeviceLibraryList(); List<DeviceLibrary> deviceLibraryList = cacheLibraryService.getAllDeviceLibraryList();
System.out.println("查询在库时间ggg"+(System.currentTimeMillis()-l));
String currentUserUnitName = userUtils.getCurrentUserUnitName(); String currentUserUnitName = userUtils.getCurrentUserUnitName();
List<DeviceLibrary> deviceLibraries = deviceLibraryList.stream().filter(deviceLibrary -> deviceLibrary.getLifeStatus() == 2) List<DeviceLibrary> deviceLibraries = deviceLibraryList.stream().filter(deviceLibrary -> deviceLibrary.getLifeStatus() == 2)
.filter(deviceLibrary -> deviceLibrary.getLocationUnit().equals(currentUserUnitName) .filter(deviceLibrary -> deviceLibrary.getLocationUnit().equals(currentUserUnitName)
......
...@@ -46,7 +46,9 @@ public class DeviceLogServiceImpl implements DeviceLogService { ...@@ -46,7 +46,9 @@ public class DeviceLogServiceImpl implements DeviceLogService {
@Override @Override
public void addAllLog(List<DeviceLogDto> deviceLogDtos) { public void addAllLog(List<DeviceLogDto> deviceLogDtos) {
long l = System.currentTimeMillis();
List<DeviceLog> deviceLogs = deviceLogDao.saveAll(deviceLogDtos.stream().map(DeviceLogDto::toDo).collect(Collectors.toList())); List<DeviceLog> deviceLogs = deviceLogDao.saveAll(deviceLogDtos.stream().map(DeviceLogDto::toDo).collect(Collectors.toList()));
System.out.println(System.currentTimeMillis()-l);
CompletableFuture.runAsync(()->{ CompletableFuture.runAsync(()->{
deviceLogs.forEach(deviceLog -> { deviceLogs.forEach(deviceLog -> {
DeviceLog deviceLog1 = deviceLogDao.findById(deviceLog.getId()).get(); DeviceLog deviceLog1 = deviceLogDao.findById(deviceLog.getId()).get();
......
...@@ -196,6 +196,10 @@ public class PackingLibraryController { ...@@ -196,6 +196,10 @@ public class PackingLibraryController {
// } // }
// }); // });
// } // }
// packingLibraryEntities.forEach(PackingLibrary::setConfigName);
if (packingLibrarySelectVo.getIsAllot()!=null){
packingLibraryEntities = filterDevices(packingLibraryEntities);
}
packingLibraryEntities.forEach(PackingLibrary::setConfigName); packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构 //返回父子结构
Map<Integer, PackingLibrary> nodeCollect = Map<Integer, PackingLibrary> nodeCollect =
...@@ -206,9 +210,7 @@ public class PackingLibraryController { ...@@ -206,9 +210,7 @@ public class PackingLibraryController {
packingLibraryEntity -> Optional.ofNullable(nodeCollect.get(packingLibraryEntity.getPartParentId())), packingLibraryEntity -> Optional.ofNullable(nodeCollect.get(packingLibraryEntity.getPartParentId())),
PackingLibrary::addChildNode PackingLibrary::addChildNode
).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList()); ).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList());
if (packingLibrarySelectVo.getIsAllot()!=null){
packingLibraryList = filterDevices(packingLibraryList);
}
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("pages",packingLibraryList); map.put("pages",packingLibraryList);
List<String> models = new ArrayList<>(); List<String> models = new ArrayList<>();
...@@ -502,6 +504,7 @@ public class PackingLibraryController { ...@@ -502,6 +504,7 @@ public class PackingLibraryController {
*/ */
public List<PackingLibrary> filterDevices(List<PackingLibrary> packingLibraryList){ public List<PackingLibrary> filterDevices(List<PackingLibrary> packingLibraryList){
//获取列装id //获取列装id
List<Integer> packingIds = packingLibraryList.stream().map(PackingLibrary::getId).collect(Collectors.toList()); List<Integer> packingIds = packingLibraryList.stream().map(PackingLibrary::getId).collect(Collectors.toList());
//通过列装id 查询装备数量 //通过列装id 查询装备数量
...@@ -509,21 +512,44 @@ public class PackingLibraryController { ...@@ -509,21 +512,44 @@ public class PackingLibraryController {
// List<DeviceLibrary> allByPackingId2 = deviceLibraryService.findAllByPackingId2(packingIds); // List<DeviceLibrary> allByPackingId2 = deviceLibraryService.findAllByPackingId2(packingIds);
// System.out.println("查询时间"+(System.currentTimeMillis()-l)); // System.out.println("查询时间"+(System.currentTimeMillis()-l));
// Map<Integer, List<DeviceLibrary>> map = allByPackingId2.stream().collect(groupingBy(DeviceLibrary::getPackingId)); // Map<Integer, List<DeviceLibrary>> map = allByPackingId2.stream().collect(groupingBy(DeviceLibrary::getPackingId));
//key为列装id
Map<Integer, List<DeviceLibrary>> map = deviceLibraryService.findAllByPackingId3(); Map<Integer, List<DeviceLibrary>> map = deviceLibraryService.findAllByPackingId3();
if (map.size()>0){ // if (map.size()>0){
map.forEach( // map.forEach(
(k,v)->{ // (k,v)->{
if (v.size()==0){ // if (map.get(k).size() == 0){
Optional<PackingLibrary> byId = packingLibraryDao.findById(k); // Optional<PackingLibrary> byId = packingLibraryDao.findById(k);
PackingLibrary packingLibrary = new PackingLibrary(); // PackingLibrary packingLibrary = new PackingLibrary();
if (byId.isPresent()){ // if (byId.isPresent()){
packingLibrary = byId.get(); // packingLibrary = byId.get();
} // }
packingLibraryList.remove(packingLibrary); // packingLibraryList.remove(packingLibrary);
// }
// }
// );
// }
List<Integer> notInPackingIds = new ArrayList<>();
// List<PackingLibrary> notInPackingLibraries = new ArrayList<>();
packingIds.forEach(
integer -> {
if (!map.containsKey(integer)){
//加入不在集合中的
notInPackingIds.add(integer);
} }
} }
); );
} //查询出不在集合中的列装
return packingLibraryList; // notInPackingLibraries = packingLibraryDao.findAllByIdIn(notInPackingIds);
//进行移除
// list.removeAll(notInPackingLibraries);
// packingLibraryList.forEach(
// packingLibrary -> {
// if (notInPackingIds.contains(packingLibrary.getId())){
// packingLibraryList.remove(packingLibrary);
// }
// }
// );
packingIds.removeAll(notInPackingIds);
return packingLibraryDao.findAllByIdIn(packingIds);
} }
} }
...@@ -51,5 +51,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer ...@@ -51,5 +51,6 @@ public interface PackingLibraryDao extends JpaRepository<PackingLibrary, Integer
* 根据型号查出所有 * 根据型号查出所有
*/ */
List<PackingLibrary> findAllByModel(String model); List<PackingLibrary> findAllByModel(String model);
} }
...@@ -2321,16 +2321,16 @@ public class RepairController { ...@@ -2321,16 +2321,16 @@ public class RepairController {
* 查看送修单据 * 查看送修单据
*/ */
@GetMapping("getSendFileList") @GetMapping("getSendFileList")
@ApiOperation("通过任务id查询账单中文件") @ApiOperation("通过任务id查询送修账单中文件")
public ResponseEntity getSendFileList(Integer taskId){ public ResponseEntity getSendFileList(Integer taskId){
return ResponseEntity.ok(repairSendBillService.getFileList(taskId)); return ResponseEntity.ok(repairSendBillService.getFileList(taskId));
} }
/** /**
* 查看送修单据 * 查看维修退回单据
*/ */
@GetMapping("getBackFileList") @GetMapping("getBackFileList")
@ApiOperation("通过任务id查询账单中文件") @ApiOperation("通过任务id查询维修退回账单中文件")
public ResponseEntity getBackFileList(Integer taskId){ public ResponseEntity getBackFileList(Integer taskId){
return ResponseEntity.ok(repairSendBillService.getFileList(taskId)); return ResponseEntity.ok(repairSendBillService.getFileList(taskId));
} }
......
...@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil; ...@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.FileName; import com.tykj.dev.config.base.FileName;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.repair.repository.RepairSendBillDao; import com.tykj.dev.device.repair.repository.RepairSendBillDao;
import com.tykj.dev.device.repair.service.RepairSendBillService; import com.tykj.dev.device.repair.service.RepairSendBillService;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill; import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
...@@ -110,9 +111,9 @@ public class RepairSendBillServiceImpl implements RepairSendBillService { ...@@ -110,9 +111,9 @@ public class RepairSendBillServiceImpl implements RepairSendBillService {
Integer billId = taskService.get(taskId).getBillId(); Integer billId = taskService.get(taskId).getBillId();
RepairSendBill repairSendBill = getOne(billId); RepairSendBill repairSendBill = getOne(billId);
//收件方签收单集合 //收件方签收单集合
map.put(FileName.SIGN.name,repairSendBill.getReceiveFileList()); map.put(FileName.SIGN.name, FilesUtil.stringFileToList(repairSendBill.getReceiveFiles()));
//发件方回执单集合 //发件方回执单集合
map.put(FileName.RECEIPT.name,repairSendBill.getSendFileList()); map.put(FileName.RECEIPT.name,FilesUtil.stringFileToList(repairSendBill.getSendFiles()));
return map; return map;
} }
......
...@@ -36,6 +36,7 @@ import io.swagger.annotations.Api; ...@@ -36,6 +36,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
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;
...@@ -43,6 +44,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -43,6 +44,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
/** /**
...@@ -91,6 +93,10 @@ public class SelfCheckController { ...@@ -91,6 +93,10 @@ public class SelfCheckController {
@Autowired @Autowired
private MessageService messageService; private MessageService messageService;
@Autowired
@Qualifier("taskExecutor")
private Executor executor;
/** /**
* 月度 * 月度
*/ */
...@@ -320,7 +326,7 @@ public class SelfCheckController { ...@@ -320,7 +326,7 @@ public class SelfCheckController {
selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId()); selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
if (selfCheckSaveVo.getNewDeviceList() != null) { if (selfCheckSaveVo.getNewDeviceList() != null) {
//按新增不在系统的装备按rfid卡号拼接保存 //按新增不在系统的装备按rfid卡号拼接保存
StringBuffer stringBuffer = new StringBuffer(); StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append("."); stringBuffer.append(".");
for (String s : selfCheckSaveVo.getNewDeviceList()) { for (String s : selfCheckSaveVo.getNewDeviceList()) {
stringBuffer.append(s); stringBuffer.append(s);
...@@ -403,13 +409,25 @@ public class SelfCheckController { ...@@ -403,13 +409,25 @@ public class SelfCheckController {
} }
} }
//添加装备日志 //添加装备日志
//进行修改日志存储慢的问题
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
for (String s:strings) { for (String s:strings) {
if (s.length()>=2) { if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1)); Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null); // DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
deviceLogService.addLog(deviceLogDto); DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),taskBto.getId());
deviceLogDtos.add(deviceLogDto);
// deviceLogService.addLog(deviceLogDto);
}
} }
long l = System.currentTimeMillis();
//进行日志的存储
executor.execute(
()->{
deviceLogService.addAllLog(deviceLogDtos);
} }
);
log.info("日志存储时间:{}",System.currentTimeMillis()-l);
log.info("[自查模块]:发起自查"); log.info("[自查模块]:发起自查");
myWebSocket.sendMessage1(); myWebSocket.sendMessage1();
return ResultUtil.success(selfExaminationBillEntity1); return ResultUtil.success(selfExaminationBillEntity1);
......
...@@ -786,4 +786,10 @@ public class StorageBillController { ...@@ -786,4 +786,10 @@ public class StorageBillController {
// } // }
// }); // });
// } // }
/**
* 根据任务id 查询单据
*/
// public Map<>
} }
package com.tykj.dev.device.storage.service; package com.tykj.dev.device.storage.service;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.storage.subject.domin.StorageBill; import com.tykj.dev.device.storage.subject.domin.StorageBill;
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.List; import java.util.List;
import java.util.Map;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -27,4 +29,6 @@ public interface StorageBillService { ...@@ -27,4 +29,6 @@ public interface StorageBillService {
StorageBill getOne(Integer id); StorageBill getOne(Integer id);
void delete(Integer id); void delete(Integer id);
Map<String,List<FileRet>> getFileList(Integer taskId);
} }
...@@ -3,9 +3,14 @@ package com.tykj.dev.device.storage.service.impl; ...@@ -3,9 +3,14 @@ package com.tykj.dev.device.storage.service.impl;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.FileName;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.storage.repository.StorageBillDao; import com.tykj.dev.device.storage.repository.StorageBillDao;
import com.tykj.dev.device.storage.service.StorageBillService; import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill; import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
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;
...@@ -13,7 +18,9 @@ import org.springframework.data.domain.Pageable; ...@@ -13,7 +18,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap;
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;
...@@ -29,6 +36,8 @@ public class StorageBillServiceImpl implements StorageBillService { ...@@ -29,6 +36,8 @@ public class StorageBillServiceImpl implements StorageBillService {
@Autowired @Autowired
private BlockChainUtil blockChainUtil; private BlockChainUtil blockChainUtil;
@Autowired
private TaskService taskService;
@Override @Override
public StorageBill addEntity(StorageBill storageBillEntity) { public StorageBill addEntity(StorageBill storageBillEntity) {
StorageBill storageBill = storageBillDao.save(storageBillEntity); StorageBill storageBill = storageBillDao.save(storageBillEntity);
...@@ -88,4 +97,25 @@ public class StorageBillServiceImpl implements StorageBillService { ...@@ -88,4 +97,25 @@ public class StorageBillServiceImpl implements StorageBillService {
public void delete(Integer id) { public void delete(Integer id) {
storageBillDao.deleteById(id); storageBillDao.deleteById(id);
} }
@Override
public Map<String, List<FileRet>> getFileList(Integer taskId) {
Map<String,List<FileRet>> map = new HashMap<>();
Integer billId = taskService.get(taskId).getBillId();
Optional<StorageBill> storageBillDaoById = storageBillDao.findById(billId);
StorageBill storageBill = new StorageBill();
if (storageBillDaoById.isPresent()){
storageBill = storageBillDaoById.get();
}
//收件方签收单集合
// map.put(FileName.SIGN.name, FilesUtil.stringFileToList(allotBill.getReceiveFiles()));
// //申请文号文件集合
// map.put(FileName.APPLY.name,FilesUtil.stringFileToList(storageBill.getApplyFiles()));
// //批复文号文件集合
// map.put(FileName.REPLY.name,FilesUtil.stringFileToList(storageBill.getfil));
// //发件方回执单集合
// map.put(FileName.RECEIPT.name,FilesUtil.stringFileToList(allotBill.getSendFiles()));
return map;
}
} }
package com.tykj.dev.device.zxing.controller;
import com.tykj.dev.device.zxing.entity.PackageVersion;
import com.tykj.dev.device.zxing.service.PackageVersionService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@ApiModel("系统版本管理模块")
@RequestMapping("/packageVersion")
public class PackageVersionController {
@Autowired
private PackageVersionService packageVersionService;
@ApiOperation(value = "获取版本号")
@GetMapping("/getVersion")
public PackageVersion getVersion(){
return packageVersionService.getVersion();
}
}
package com.tykj.dev.device.zxing.dao;
import com.tykj.dev.device.zxing.entity.PackageVersion;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PackageVersionDao extends JpaRepository<PackageVersion,Integer> {
}
package com.tykj.dev.device.zxing.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@ApiModel("Java版本号")
public class PackageVersion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty("id主键")
private Integer id;
@ApiModelProperty("上一次版本号")
private String oldVersion;
@ApiModelProperty("当前版本号")
private String nowVersion;
}
package com.tykj.dev.device.zxing.service;
import com.tykj.dev.device.zxing.entity.PackageVersion;
public interface PackageVersionService {
/**
* 获取版本号
*/
PackageVersion getVersion();
}
package com.tykj.dev.device.zxing.service.impl;
import com.tykj.dev.device.zxing.dao.PackageVersionDao;
import com.tykj.dev.device.zxing.entity.PackageVersion;
import com.tykj.dev.device.zxing.service.PackageVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class PackageVersionServiceImpl implements PackageVersionService {
@Autowired
private PackageVersionDao packageVersionDao;
@Override
public PackageVersion getVersion() {
return packageVersionDao.findById(1).get();
}
/**
* 自动升级版本号,版本号+1
* @param version
* @return
*/
private String autoUpgradeVersion(String version){
if (version.equals("")) {
version = "0.0.0.0";
}
//将版本号拆解成整数数组
String[] arr = version.split("\\.");
int[] ints=new int[arr.length];
for (int i = 0; i < arr.length; i++) {
ints[i] = Integer.valueOf(arr[i]);
}
//递归调用
this.autoUpgradeVersion(ints, ints.length - 1);
//数组转字符串
StringBuffer sb = new StringBuffer();
for (int i = 0; i < ints.length; i++) {
sb.append(ints[i]);
if ((i + 1) != ints.length) {
sb.append(".");
}
}
return sb.toString();
}
/**
* 自动升级版本号,版本号+1
* @param ints
* @param index
*/
private void autoUpgradeVersion(int[] ints, int index){
if(index == 0){
ints[0] = ints[0] + 1;
}
else {
int value = ints[index] + 1;
if (value < 10) {
ints[index] = value;
}
else {
ints[index] = 0;
autoUpgradeVersion(ints, index - 1);
}
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论