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

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

上级 c3e97325
......@@ -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.vo.AllotBillSelectVo;
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.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
......@@ -139,13 +140,13 @@ public class AllotBackBillServiceImpl implements AllotBackBillService {
Integer billId = taskService.get(taskId).getBillId();
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;
}
......
......@@ -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.vo.AllotBillSelectVo;
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.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.aspectj.util.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -139,13 +141,13 @@ public class AllotBillServiceImpl implements AllotBillService {
Integer billId = taskService.get(taskId).getBillId();
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;
}
......
......@@ -19,12 +19,12 @@ public enum FileName {
/**
* 签收单
*/
SIGN(3,"签收单"),
SIGN(4,"签收单"),
/**
* 销毁单
*/
DESTROY(4,"销毁单");
DESTROY(5,"销毁单");
public Integer id;
......
......@@ -652,10 +652,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override
public Map<Integer,List<DeviceLibrary>> findAllByPackingId3() {
//筛选出当前单位在库的装备
long l = System.currentTimeMillis();
// List<DeviceLibrary> deviceLibraryList = cacheLibraryController.getAll();
List<DeviceLibrary> deviceLibraryList = cacheLibraryService.getAllDeviceLibraryList();
System.out.println("查询在库时间ggg"+(System.currentTimeMillis()-l));
String currentUserUnitName = userUtils.getCurrentUserUnitName();
List<DeviceLibrary> deviceLibraries = deviceLibraryList.stream().filter(deviceLibrary -> deviceLibrary.getLifeStatus() == 2)
.filter(deviceLibrary -> deviceLibrary.getLocationUnit().equals(currentUserUnitName)
......
......@@ -46,7 +46,9 @@ public class DeviceLogServiceImpl implements DeviceLogService {
@Override
public void addAllLog(List<DeviceLogDto> deviceLogDtos) {
long l = System.currentTimeMillis();
List<DeviceLog> deviceLogs = deviceLogDao.saveAll(deviceLogDtos.stream().map(DeviceLogDto::toDo).collect(Collectors.toList()));
System.out.println(System.currentTimeMillis()-l);
CompletableFuture.runAsync(()->{
deviceLogs.forEach(deviceLog -> {
DeviceLog deviceLog1 = deviceLogDao.findById(deviceLog.getId()).get();
......
......@@ -196,6 +196,10 @@ public class PackingLibraryController {
// }
// });
// }
// packingLibraryEntities.forEach(PackingLibrary::setConfigName);
if (packingLibrarySelectVo.getIsAllot()!=null){
packingLibraryEntities = filterDevices(packingLibraryEntities);
}
packingLibraryEntities.forEach(PackingLibrary::setConfigName);
//返回父子结构
Map<Integer, PackingLibrary> nodeCollect =
......@@ -206,9 +210,7 @@ public class PackingLibraryController {
packingLibraryEntity -> Optional.ofNullable(nodeCollect.get(packingLibraryEntity.getPartParentId())),
PackingLibrary::addChildNode
).stream().sorted(Comparator.comparing(PackingLibrary::getModel)).collect(Collectors.toList());
if (packingLibrarySelectVo.getIsAllot()!=null){
packingLibraryList = filterDevices(packingLibraryList);
}
Map<String,Object> map = new HashMap<>();
map.put("pages",packingLibraryList);
List<String> models = new ArrayList<>();
......@@ -502,6 +504,7 @@ public class PackingLibraryController {
*/
public List<PackingLibrary> filterDevices(List<PackingLibrary> packingLibraryList){
//获取列装id
List<Integer> packingIds = packingLibraryList.stream().map(PackingLibrary::getId).collect(Collectors.toList());
//通过列装id 查询装备数量
......@@ -509,21 +512,44 @@ public class PackingLibraryController {
// List<DeviceLibrary> allByPackingId2 = deviceLibraryService.findAllByPackingId2(packingIds);
// System.out.println("查询时间"+(System.currentTimeMillis()-l));
// Map<Integer, List<DeviceLibrary>> map = allByPackingId2.stream().collect(groupingBy(DeviceLibrary::getPackingId));
//key为列装id
Map<Integer, List<DeviceLibrary>> map = deviceLibraryService.findAllByPackingId3();
if (map.size()>0){
map.forEach(
(k,v)->{
if (v.size()==0){
Optional<PackingLibrary> byId = packingLibraryDao.findById(k);
PackingLibrary packingLibrary = new PackingLibrary();
if (byId.isPresent()){
packingLibrary = byId.get();
}
packingLibraryList.remove(packingLibrary);
// if (map.size()>0){
// map.forEach(
// (k,v)->{
// if (map.get(k).size() == 0){
// Optional<PackingLibrary> byId = packingLibraryDao.findById(k);
// PackingLibrary packingLibrary = new PackingLibrary();
// if (byId.isPresent()){
// packingLibrary = byId.get();
// }
// 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
* 根据型号查出所有
*/
List<PackingLibrary> findAllByModel(String model);
}
......@@ -2321,16 +2321,16 @@ public class RepairController {
* 查看送修单据
*/
@GetMapping("getSendFileList")
@ApiOperation("通过任务id查询账单中文件")
@ApiOperation("通过任务id查询送修账单中文件")
public ResponseEntity getSendFileList(Integer taskId){
return ResponseEntity.ok(repairSendBillService.getFileList(taskId));
}
/**
* 查看送修单据
* 查看维修退回单据
*/
@GetMapping("getBackFileList")
@ApiOperation("通过任务id查询账单中文件")
@ApiOperation("通过任务id查询维修退回账单中文件")
public ResponseEntity getBackFileList(Integer taskId){
return ResponseEntity.ok(repairSendBillService.getFileList(taskId));
}
......
......@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.FileName;
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.service.RepairSendBillService;
import com.tykj.dev.device.repair.subject.domin.RepairSendBill;
......@@ -110,9 +111,9 @@ public class RepairSendBillServiceImpl implements RepairSendBillService {
Integer billId = taskService.get(taskId).getBillId();
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;
}
......
......@@ -36,6 +36,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
......@@ -43,6 +44,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledFuture;
/**
......@@ -91,6 +93,10 @@ public class SelfCheckController {
@Autowired
private MessageService messageService;
@Autowired
@Qualifier("taskExecutor")
private Executor executor;
/**
* 月度
*/
......@@ -320,7 +326,7 @@ public class SelfCheckController {
selfExaminationBillEntity.setCreateUnitId(userUtils.getCurrentUnitId());
if (selfCheckSaveVo.getNewDeviceList() != null) {
//按新增不在系统的装备按rfid卡号拼接保存
StringBuffer stringBuffer = new StringBuffer();
StringBuilder stringBuffer = new StringBuilder();
stringBuffer.append(".");
for (String s : selfCheckSaveVo.getNewDeviceList()) {
stringBuffer.append(s);
......@@ -403,13 +409,25 @@ public class SelfCheckController {
}
}
//添加装备日志
//进行修改日志存储慢的问题
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
for (String s:strings) {
if (s.length()>=2) {
Integer id = Integer.parseInt(s.substring(0, s.length() - 1));
DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
deviceLogService.addLog(deviceLogDto);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id,"发起自查",fileVoList,taskBto.getId(),null);
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("[自查模块]:发起自查");
myWebSocket.sendMessage1();
return ResultUtil.success(selfExaminationBillEntity1);
......
......@@ -786,4 +786,10 @@ public class StorageBillController {
// }
// });
// }
/**
* 根据任务id 查询单据
*/
// public Map<>
}
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 org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author dengdiyi
......@@ -27,4 +29,6 @@ public interface StorageBillService {
StorageBill getOne(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;
import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
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.service.StorageBillService;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
......@@ -13,7 +18,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
......@@ -29,6 +36,8 @@ public class StorageBillServiceImpl implements StorageBillService {
@Autowired
private BlockChainUtil blockChainUtil;
@Autowired
private TaskService taskService;
@Override
public StorageBill addEntity(StorageBill storageBillEntity) {
StorageBill storageBill = storageBillDao.save(storageBillEntity);
......@@ -88,4 +97,25 @@ public class StorageBillServiceImpl implements StorageBillService {
public void delete(Integer 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论