提交 f7712daf authored 作者: zhoushaopan's avatar zhoushaopan

修改装备缓存名称

上级 7c764173
流水线 #312 已失败 于阶段
package com.tykj.dev.device.library.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.CacheLibraryService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -25,7 +24,7 @@ import java.util.List;
public class CacheLibraryController {
@Autowired
private CacheLibraryService cacheLibraryService;
private DeviceLibraryCacheService cacheLibraryService;
@GetMapping("getAll")
public List<DeviceLibrary> getAll(){
......
......@@ -6,7 +6,7 @@ import com.tykj.dev.config.cache.ConfigCache;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.CacheLibraryService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceChangeService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
......@@ -37,6 +37,7 @@ import javax.validation.constraints.Min;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -76,7 +77,7 @@ public class DeviceLibraryController {
private Executor executor;
@Autowired
private CacheLibraryService cacheLibraryService;
private DeviceLibraryCacheService cacheLibraryService;
......@@ -492,10 +493,7 @@ public class DeviceLibraryController {
public ResponseEntity getDeviceStatisticsPage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
List<DeviceStatisticsVo> deviceStatisticsVoList = deviceLibraryService.getDeviceStatisticsPage(deviceLibrarySelectVo, deviceLibrarySelectVo.getPageable(),deviceLibrarySelectVo.getPageable().getSort());
List<DeviceStatisticsVo> deviceStatisticsVoSorts = deviceStatisticsVoList.stream()
.sorted(Comparator.comparing(DeviceStatisticsVo::getModel)
// .thenComparing(DeviceStatisticsVo::getName)
.thenComparing(DeviceStatisticsVo::getMatchingRangeName)
.thenComparing(DeviceStatisticsVo::getIsPart)).collect(Collectors.toList());
.sorted(Comparator.comparing(DeviceStatisticsVo::getModel).thenComparing(DeviceStatisticsVo::getName)).collect(Collectors.toList());
// Page<DeviceStatisticsVo> deviceStatisticsVos = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), deviceStatisticsVoList, deviceLibrarySelectVo.getPageable());
Page<DeviceStatisticsVo> deviceStatisticsVos = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), deviceStatisticsVoSorts, deviceLibrarySelectVo.getPageable());
Map<String,Object> map = new HashMap<>();
......@@ -814,43 +812,45 @@ public class DeviceLibraryController {
v.size(), k,v.stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
deviceNewVoList.add(deviceNewVo);
});
for (DeviceNewVo deviceNewVo : deviceNewVoList) {
Integer unitSort = DeviceModelSort.toUnitSort(deviceNewVo.getOwnUnit());
}
return deviceNewVoList;
}
/**
* 测试
*/
// @GetMapping("/setNumber")
// public List<DeviceLibrary> setNumber(){
//
// List<DeviceLibrary> allListAndParent = getAllListAndParent();
// List<DeviceLibrary> deviceLibraries = setOrderNumber(allListAndParent);
// return deviceLibraries;
// }
//
// public List<DeviceLibrary> getAllListAndParent(){
// DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
// List<DeviceLibrary> deviceLibraryServiceAllList = deviceLibraryService.getAllList(deviceLibrarySelectVo);
// Map<Integer, DeviceLibrary> collect = deviceLibraryServiceAllList.stream().collect(Collectors.toMap(DeviceLibrary::getId, Function.identity()));
// List<DeviceLibrary> containList = GetTreeUtils.parseTreeFromDown(
// deviceLibraryServiceAllList,
// DeviceLibrary::getId,
// deviceLibraryEntity -> Optional.ofNullable(collect.get(deviceLibraryEntity.getPartParentId())),
// DeviceLibrary::addChildNode
// );
// return containList;
// }
//
// private List<DeviceLibrary> setOrderNumber(List<DeviceLibrary> allListAndParent) {
// for (int i = 0; i < allListAndParent.size(); i++) {
// DeviceLibrary deviceLibrary = allListAndParent.get(i);
// deviceLibrary.setOrderNumber(i+1);
// i++;
// if (deviceLibrary.getChilds().size()>0){
// setOrderNumber(deviceLibrary.getChilds());
// }
// }
// return allListAndParent;
// }
@GetMapping("/setNumber")
public List<DeviceLibrary> setNumber(){
List<DeviceLibrary> allListAndParent = getAllListAndParent();
AtomicInteger sortNum = new AtomicInteger();
return setOrderNumber(sortNum, allListAndParent);
}
public List<DeviceLibrary> getAllListAndParent(){
DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
List<DeviceLibrary> deviceLibraryServiceAllList = deviceLibraryService.getAllList(deviceLibrarySelectVo);
Map<Integer, DeviceLibrary> collect = deviceLibraryServiceAllList.stream().collect(Collectors.toMap(DeviceLibrary::getId, Function.identity()));
return GetTreeUtils.parseTreeFromDown(
deviceLibraryServiceAllList,
DeviceLibrary::getId,
deviceLibraryEntity -> Optional.ofNullable(collect.get(deviceLibraryEntity.getPartParentId())),
DeviceLibrary::addChildNode
);
}
private List<DeviceLibrary> setOrderNumber(AtomicInteger sortNum,List<DeviceLibrary> allListAndParent) {
allListAndParent.forEach(
deviceLibrary -> {
deviceLibrary.setOrderNumber(sortNum.incrementAndGet());
if (deviceLibrary.getChilds().size()>0){
setOrderNumber(sortNum,deviceLibrary.getChilds());
}
}
);
return allListAndParent;
}
}
......@@ -8,7 +8,8 @@ import java.util.List;
* DATE:2021-8-11
* Author:zsp
*/
public interface CacheLibraryService {
public interface DeviceLibraryCacheService {
/**
* 查询全部
......
......@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
@Component
public class MyInitializer implements ApplicationListener<ApplicationReadyEvent> {
@Autowired
private CacheLibraryService cacheLibraryService;
private DeviceLibraryCacheService cacheLibraryService;
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
cacheLibraryService.getAllDeviceLibraryList();
......
package com.tykj.dev.device.library.service.impl;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.CacheLibraryService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -17,7 +16,7 @@ import java.util.List;
*/
@Service
@CacheConfig(cacheNames = "devicesLibraryList")
public class CacheLibraryServiceImpl implements CacheLibraryService {
public class CacheLibraryServiceImpl implements DeviceLibraryCacheService {
@Autowired
private DeviceLibraryDao deviceLibraryDao;
......
......@@ -7,7 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.config.base.DeviceLifeStatus;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.CacheLibraryService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo;
......@@ -57,7 +57,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
private UnitsService unitsService;
@Autowired
private CacheLibraryService cacheLibraryService;
private DeviceLibraryCacheService cacheLibraryService;
@Override
public DeviceLibrary addEntity(DeviceLibrary deviceLibraryEntity) {
DeviceLibrary deviceLibrary = deviceLibraryDao.save(deviceLibraryEntity);
......@@ -791,7 +791,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
predicateBuilder.eq("ownUnit", deviceLibrarySelectVo.getOwnUnit());
}
if (deviceLibrarySelectVo.getRfidCardId() != null) {
predicateBuilder.eq("rfidCardId", deviceLibrarySelectVo.getRfidCardId());
predicateBuilder.like("rfidCardId", deviceLibrarySelectVo.getRfidCardId());
}
if (deviceLibrarySelectVo.getPackingId() != null) {
predicateBuilder.eq("packingId", deviceLibrarySelectVo.getPackingId());
......
......@@ -1204,7 +1204,7 @@ public class RepairController {
messageService.add(messageBto);
}
String message = repairReceiveVo.getStatus() == 0 ? "业务办结" : "接收维修领取装备";
MessageBto messageBto = new MessageBto(taskBto2.getId(), taskBto2.getBusinessType(), message, ids, 1,0);
MessageBto messageBto = new MessageBto(taskBto2.getId(), taskBto2.getBusinessType(), message, ids, 1,1);
messageService.add(messageBto);
//遍历map依次发送阅知
messageMap.keySet().forEach(integer -> {
......@@ -1212,7 +1212,8 @@ public class RepairController {
integerList.addAll(userDao.findAllByUnitsId(integer).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList);
// MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList);
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1);
//存放详情id集合
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2);
......@@ -1424,7 +1425,7 @@ public class RepairController {
ids2.addAll(userDao.findAllByUnitsId(integer).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", ids2);
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", ids2,1,1);
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2);
});
......@@ -1876,7 +1877,7 @@ public class RepairController {
integerList.addAll(userDao.findAllByUnitsId(unitId).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList);
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1);
messageBto2.setRecord(String.valueOf(repairDetail1.getId()));
messageService.add(messageBto2);
}
......@@ -2050,7 +2051,7 @@ public class RepairController {
integerList.addAll(userDao.findAllByUnitsId(integer).stream()
.map(User::getUserId)
.collect(Collectors.toList()));
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList);
MessageBto messageBto2 = new MessageBto(0, 5, "待领取送修装备", integerList,1,1);
//阅知记录id拼接
messageBto2.setRecord(StringSplitUtil.idListToString(messageMap.get(integer)));
messageService.add(messageBto2);
......
......@@ -9,7 +9,7 @@ import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.service.CacheLibraryService;
import com.tykj.dev.device.library.service.DeviceLibraryCacheService;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
......@@ -121,7 +121,7 @@ public class StorageBillController {
private Executor executor;
@Autowired
private CacheLibraryService cacheLibraryService;
private DeviceLibraryCacheService cacheLibraryService;
@ApiOperation(value = "判断序列号是否存在申请任务中", notes = "判断序列号是否存在申请任务中")
@PostMapping(value = "/existApplyTask")
......
......@@ -74,7 +74,7 @@ public class MessageBto {
private Integer isHighLight = 0;
@ApiModelProperty(value = "是否置顶(0:不是,1:是)")
private Integer isTop = 0;
private Integer isTop;
/**
* bto类转化为do类
......@@ -102,7 +102,7 @@ public class MessageBto {
//set vo字段
if (userUtils!=null&&userReadDetailList.contains(userUtils.getCurrentUserId())){
messageUserVo.setIsRead(1);
messageUserVo.setIsTop(1);
messageUserVo.setIsTop(0);
}
if (messageUserVo.getCreateUserId()!=null){
messageUserVo.setOperator(userPublicService.getOne(messageUserVo.getCreateUserId()).getName());
......
......@@ -87,7 +87,7 @@ public class Message {
private Integer isHighLight = 0;
@ApiModelProperty(value = "是否置顶(0:不是,1:是)")
private Integer isTop = 0;
private Integer isTop;
/**
* do类转化为bto类
......
......@@ -64,5 +64,5 @@ public class MessageUserVo {
private String unit;
@ApiModelProperty(value = "是否置顶(0:不是,1:是)")
private Integer isTop = 0;
private Integer isTop;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论