|
|
@ -64,6 +64,7 @@ import java.text.DecimalFormat; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -85,6 +86,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena |
|
|
|
private final IEmInfoClient emInfoClient; |
|
|
|
private final IEmInfoClient emInfoClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R doSave(OperMaintenanceTaskDTO req) { |
|
|
|
public R doSave(OperMaintenanceTaskDTO req) { |
|
|
|
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); |
|
|
|
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); |
|
|
@ -101,12 +104,33 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) { |
|
|
|
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) { |
|
|
|
Query query=new Query(); |
|
|
|
List<OperMaintenanceTaskVO> inspects = (List<OperMaintenanceTaskVO>) redisTemplate.opsForValue() |
|
|
|
query.setSize(req.getSize()); |
|
|
|
.get("maintenance_task_list" + req.getCurrent() + req.getSize()); |
|
|
|
query.setCurrent(req.getCurrent()); |
|
|
|
Long total = (Long) redisTemplate.opsForValue().get("maintenance_task_list_total"); |
|
|
|
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req); |
|
|
|
IPage<OperMaintenanceTaskVO> pages = new Page<>(req.getCurrent(), req.getSize()); |
|
|
|
IPage pages = super.page(Condition.getPage(query), queryWrapper); |
|
|
|
if (ObjectUtil.isEmpty(inspects) || ObjectUtil.isEmpty(total)) { |
|
|
|
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); |
|
|
|
Query query = new Query(); |
|
|
|
|
|
|
|
query.setSize(req.getSize()); |
|
|
|
|
|
|
|
query.setCurrent(req.getCurrent()); |
|
|
|
|
|
|
|
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req); |
|
|
|
|
|
|
|
List<OperMaintenanceTaskEntity> list = super.list(queryWrapper); |
|
|
|
|
|
|
|
List<OperMaintenanceTaskVO> voList = new ArrayList<>(); |
|
|
|
|
|
|
|
list.forEach(x -> { |
|
|
|
|
|
|
|
OperMaintenanceTaskVO operMaintenanceTaskVO = new OperMaintenanceTaskVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(x, operMaintenanceTaskVO); |
|
|
|
|
|
|
|
voList.add(operMaintenanceTaskVO); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
pages.setRecords(voList); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set("maintenance_task_list" + req.getCurrent() + req.getSize(), voList); |
|
|
|
|
|
|
|
redisTemplate.expire("maintenance_task_list" + req.getCurrent() + req.getSize(),60, TimeUnit.SECONDS); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set("maintenance_task_list_total",pages.getTotal()); |
|
|
|
|
|
|
|
redisTemplate.expire("maintenance_task_list_total",60, TimeUnit.SECONDS); |
|
|
|
|
|
|
|
return R.data(pages); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
pages.setRecords(inspects); |
|
|
|
|
|
|
|
pages.setCurrent(req.getCurrent()); |
|
|
|
|
|
|
|
pages.setSize(req.getSize()); |
|
|
|
|
|
|
|
pages.setTotal(total); |
|
|
|
return R.data(pages); |
|
|
|
return R.data(pages); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|