提交 7436cebe authored 作者: zhoushaopan's avatar zhoushaopan

feat(枚举): 舍弃misc中的装备状态枚举

舍弃misc中的装备状态枚举
上级 6eab5a3f
......@@ -258,7 +258,8 @@ public class DeviceApplyController {
taskService.update(taskService.moveToArchive(taskBto));
deviceApplyBillService.update(applyBillEntity);
//发送阅知信息
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"对" + userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "的装备申请驳回",ids);
MessageBto messageBto = new MessageBto(taskBto.getId(),taskBto.getBusinessType(),
"不同意申请业务:【"+userPublicService.getAreaNameByUnitName(applyBillEntity.getApplyUnit()) + "->【中办机要局】",ids);
messageService.add(messageBto);
log.info("[申请模块]:装备申请驳回");
myWebSocket.sendMessage1();
......
package com.tykj.dev.config;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.*;
import lombok.Data;
import lombok.Getter;
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.decommissioning.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.decommissioning.entity.DeviceDecommissioningDetail;
import com.tykj.dev.device.decommissioning.entity.vo.DecommissioningSelectVo;
import com.tykj.dev.device.decommissioning.entity.vo.PagingVo;
......@@ -15,7 +16,7 @@ import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
//import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.library.controller;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
......@@ -15,6 +16,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog;
import com.tykj.dev.device.library.subject.vo.*;
import com.tykj.dev.device.user.util.UserUtils;
//import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.DeviceModelSort;
import com.tykj.dev.misc.utils.GetTreeUtils;
......@@ -1014,6 +1016,13 @@ public class DeviceLibraryController {
return ResponseEntity.ok("解除成功");
}
@ApiOperation(value = "批量修改存放位置", notes = "解除装备绑定")
@PostMapping("/batchUpdateStorageLocation")
public ResponseEntity batchUpdateStorageLocation(@RequestBody UpdateStorageLocationVo updateStorageLocationVo){
deviceLibraryService.updateStorageLocation(updateStorageLocationVo);
return ResponseEntity.ok("修改成功");
}
@ApiOperation(value = "查询可绑定的附件", notes = "查询可绑定的附件")
@PostMapping("/selectPartDevice")
......@@ -1032,6 +1041,11 @@ public class DeviceLibraryController {
// Boolean hasTypeDim = deviceLibrarySelectVo.getTypeDim()!=null;
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
List<DeviceLibrary> resultList = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
List<Integer> lifeStatusList = new ArrayList<>(Arrays.asList(DeviceLifeStatus.DESTROYED.id,
DeviceLifeStatus.SCRAP_I.id, DeviceLifeStatus.RETIRE.id));
//过滤出状态为已报废,已销毁,已退役
resultList = resultList.stream().filter(deviceLibrary -> !lifeStatusList.contains(deviceLibrary.getLifeStatus()))
.collect(Collectors.toList());
// resultList = resultList.stream().filter(deviceLibrary -> deviceLibrary.getIsPart() == 1).collect(Collectors.toList());
//根据装备id查询附件 然后过滤 0 装备 1 附件
if (deviceLibrarySelectVo.getIsPart() == 0){
......
......@@ -222,5 +222,11 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query("update DeviceLibrary o set o.partParentId = null where o.id in :deviceIds")
int updatePartParentId(
@Param("deviceIds") List<Integer> deviceIds);
@Transactional
@Modifying
@Query("update DeviceLibrary o set o.storageLocation = :storageLocation where o.id in :deviceIds")
int updateStorageLocation( @Param("storageLocation") String storageLocation,
@Param("deviceIds") List<Integer> deviceIds);
}
......@@ -2,10 +2,7 @@ package com.tykj.dev.device.library.service;
import com.tykj.dev.config.UpdateCache;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.BindingDeviceVo;
import com.tykj.dev.device.library.subject.vo.DeviceForApplyVo;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
import com.tykj.dev.device.library.subject.vo.DeviceStatisticsVo;
import com.tykj.dev.device.library.subject.vo.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
......@@ -499,4 +496,7 @@ public interface DeviceLibraryService {
* @param deviceForApplyVos 更新试用装备序列号的vo
*/
void updateSeqNumber(List<DeviceForApplyVo> deviceForApplyVos);
void updateStorageLocation(UpdateStorageLocationVo updateStorageLocationVo);
}
......@@ -35,6 +35,7 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.persistence.Transient;
import java.lang.reflect.Field;
......@@ -1137,6 +1138,28 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
@Override
@UpdateCache
public void updateStorageLocation(UpdateStorageLocationVo updateStorageLocationVo) {
List<Integer> deviceIds = updateStorageLocationVo.getDeviceIds();
Integer userId = userUtils.getCurrentUserId();
List<DeviceLogDto> deviceLogDtos = new ArrayList<>();
if (!CollectionUtils.isEmpty(deviceIds)){
//添加装备日志
deviceIds.forEach(integer -> {
DeviceLogDto deviceLogDto= new DeviceLogDto(integer,"将存放位置修改为"+
updateStorageLocationVo.getStorageLocation(),null,userId);
deviceLogDtos.add(deviceLogDto);
});
deviceLibraryDao.updateStorageLocation(updateStorageLocationVo.getStorageLocation(),deviceIds);
}else {
throw new ApiException("请选择要修改的装备");
}
CompletableFuture.runAsync(()->{
deviceLogService.addAllLog(deviceLogDtos);
});
}
// @Override
// @UpdateCache
// public int updatePartParentId(List<Integer> deviceIds) {
......
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("批量修改库房位置的vo")
public class UpdateStorageLocationVo {
@ApiModelProperty(value = "装备id的集合")
private List<Integer> deviceIds;
@ApiModelProperty(value = "要修改的库房位置")
private String storageLocation;
}
package com.tykj.dev.device.loss.service.impl;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.config.base.FileName;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
......@@ -28,7 +29,7 @@ import com.tykj.dev.device.user.subject.service.AreaService;
import com.tykj.dev.device.user.subject.service.UnitsService;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.DeviceLifeStatus;
//import com.tykj.dev.misc.base.DeviceLifeStatus;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.utils.TaskDisposeUtil;
import org.springframework.beans.factory.annotation.Autowired;
......
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 装备生命状态枚举
*/
@AllArgsConstructor
public enum DeviceLifeStatus {
/**
* 入库待审核
*/
STORAGE_WAIT_CONFIRM(0, "入库待审核"),
/**
* 入库审核失败
*/
STORAGE_CONFIRM_FAILED(1, "入库审核失败"),
/**
* 在库
*/
IN_LIBRARY(2, "在库"),
/**
* 配发中
*/
IN_TRANSIT(3, "配发"),
/**
* 维修中
*/
REPAIRING(4, "维修中"),
/**
* 报废在省库
*/
SCRAP_I(5, "已报废"),
/**
* 清退
*/
SEND_BACK(6, "清退"),
/**
* 待退装
*/
WAIT_RETIRED(7, "待退装"),
/**
* 退装
*/
RETIRED(8, "退装"),
/**
* 待销毁
*/
WAIT_DESTROY(9, "待销毁"),
/**
* 已销毁
*/
DESTROYED(10, "已销毁"),
/**
* 丢失
*/
LOSS(11, "丢失"),
/**
* 退役
*/
RETIRE(12, "退役"),
/**
* 报废不在省库
*/
SCRAP_II(13, "已报废"),
/**
* 使用
*/
USE(14, "使用"),
/**
* 待退役
*/
REPEL(15,"待退役");
public Integer id;
public String name;
}
//package com.tykj.dev.misc.base;
//
//import lombok.AllArgsConstructor;
//
///**
// * @author dengdiyi
// * 装备生命状态枚举
// */
//@AllArgsConstructor
//public enum DeviceLifeStatus {
//
// /**
// * 入库待审核
// */
// STORAGE_WAIT_CONFIRM(0, "入库待审核"),
// /**
// * 入库审核失败
// */
// STORAGE_CONFIRM_FAILED(1, "入库审核失败"),
// /**
// * 在库
// */
// IN_LIBRARY(2, "在库"),
// /**
// * 配发中
// */
// IN_TRANSIT(3, "配发"),
// /**
// * 维修中
// */
// REPAIRING(4, "维修中"),
// /**
// * 报废在省库
// */
// SCRAP_I(5, "已报废"),
// /**
// * 清退
// */
// SEND_BACK(6, "清退"),
// /**
// * 待退装
// */
// WAIT_RETIRED(7, "待退装"),
// /**
// * 退装
// */
// RETIRED(8, "退装"),
// /**
// * 待销毁
// */
// WAIT_DESTROY(9, "待销毁"),
// /**
// * 已销毁
// */
// DESTROYED(10, "已销毁"),
// /**
// * 丢失
// */
// LOSS(11, "丢失"),
// /**
// * 退役
// */
// RETIRE(12, "退役"),
// /**
// * 报废不在省库
// */
// SCRAP_II(13, "已报废"),
// /**
// * 使用
// */
// USE(14, "使用"),
//
// /**
// * 待退役
// */
// REPEL(15,"待退役");
//
//
// public Integer id;
//
// public String name;
//
//}
......@@ -442,9 +442,9 @@ public class PackingController {
//筛选出当前单位在库的装备
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
deviceLibrarySelectVo.setLifeStatus(Collections.singletonList(2));
long l = System.currentTimeMillis();
// long l = System.currentTimeMillis();
List<DeviceLibrary> deviceLibraries = deviceLibraryService.getList(deviceLibrarySelectVo);
System.out.println("查询在库时间"+(System.currentTimeMillis()-l));
// System.out.println("查询在库时间"+(System.currentTimeMillis()-l));
//转为列装id的map
Map<Integer,List<DeviceLibrary>> map = deviceLibraries.stream().collect(groupingBy(DeviceLibrary::getPackingId));
ids.forEach(integer -> {
......
......@@ -389,10 +389,10 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
// });
// }
//发送阅知信息
List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
MessageBto messageBto = new MessageBto(0, 1, "手动删除列装", userIds, 0);
messageBto.setRecord(id.toString());
messageService.add(messageBto);
// List<Integer> userIds = userPublicService.findOtherUser(userUtils.getCurrentUserId());
// MessageBto messageBto = new MessageBto(0, 1, "手动删除列装", userIds, 0);
// messageBto.setRecord(id.toString());
// messageService.add(messageBto);
}
}
......
......@@ -512,13 +512,17 @@ public class StatisticalServiceImpl implements StatisticalService {
String unitName = userUtils.getCurrentUserUnitName();
WorkBench workBench = new WorkBench();
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
// deviceLibrarySelectVo.setAreaId(areaCache.findByName("浙江省").getId());
deviceLibrarySelectVo.setAreaId(areaCache.findByName("浙江省").getId());
workBench.setPackingNum(packingLibraryDao.findAllByIsRootAndPackingStatus(0,2).size());
List<DeviceLibrary> deviceLibraries = deviceLibraryService.getCoreDevicePage(deviceLibrarySelectVo);
workBench.setAllDeviceNum(deviceLibraries.size());
workBench.setSelfDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(unitName)).count()).intValue());
workBench.setSelfDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary ->
deviceLibrary.getOwnUnit().equals(unitName)).count()).intValue());
workBench.setMatchingDeviceNum(new Long(matchingDeviceLibraryDao.count()).intValue());
workBench.setDailyDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary -> deviceLibrary.getOwnUnit().equals(unitName)&&Arrays.asList(2,14).contains(deviceLibrary.getLifeStatus())).count()).intValue());
workBench.setDailyDeviceNum(Long.valueOf(deviceLibraries.stream().filter(deviceLibrary ->
deviceLibrary.getOwnUnit().equals(unitName)&&Arrays.asList(2,14).contains(deviceLibrary.getLifeStatus()))
.count()).intValue());
List<Task> allTasks = taskDao.findAll();
List<Task> tasks = allTasks.stream().filter(task -> task.getBusinessType()==7).collect(Collectors.toList());
List<Task> tasks2 = allTasks.stream().filter(task -> task.getBusinessType()==4).collect(Collectors.toList());
......
......@@ -41,7 +41,7 @@ public class UpdateCacheAspect {
*/
@AfterReturning(pointcut = "operationLog()")
public void doAfterReturning(JoinPoint point) {
log.info("开始更新缓存");
log.info("通过AOP更新缓存");
deviceLibraryCacheService.asyncUpdateCache();
}
......
......@@ -15,6 +15,7 @@ import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.socket.MyWebSocket;
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.data.domain.Page;
import org.springframework.http.ResponseEntity;
......@@ -34,6 +35,7 @@ import java.util.stream.Collectors;
@Api(tags = "阅知模块", description = "阅知模块")
@AutoDocument
@RequestMapping("/read")
@Slf4j
public class MessageController {
@Autowired
......@@ -59,7 +61,9 @@ public class MessageController {
public ResponseEntity getAllMessage(@RequestBody MessageSelectVo messageSelectVo){
Boolean hasContentDim = messageSelectVo.getContentDim()!=null;
Boolean hasOperatorDim = messageSelectVo.getOperatorDim()!=null;
long l = System.currentTimeMillis();
List<MessageUserVo> messageUserVos = messageService.getAllList(messageSelectVo);
log.info("查询全部阅知时间为:{}",System.currentTimeMillis()-l);
// messageUserVos.sort(Comparator.comparing(MessageUserVo::getIsTop).reversed().thenComparing(MessageUserVo::getCreateTime).reversed());
//模糊查询筛选
if (hasContentDim||hasOperatorDim) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论