|
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
@ -65,7 +64,6 @@ 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; |
|
|
@ -87,8 +85,6 @@ 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))); |
|
|
@ -105,28 +101,12 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) { |
|
|
|
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) { |
|
|
|
List<OperMaintenanceTaskVO> tasks = (List<OperMaintenanceTaskVO>) redisTemplate.opsForValue().get("main_list" + req.getCurrent() + req.getSize()); |
|
|
|
|
|
|
|
Long total = (Long) redisTemplate.opsForValue().get("main_list_total"); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(tasks) || ObjectUtil.isEmpty(total)){ |
|
|
|
|
|
|
|
Query query=new Query(); |
|
|
|
|
|
|
|
query.setSize(req.getSize()); |
|
|
|
|
|
|
|
query.setCurrent(req.getCurrent()); |
|
|
|
|
|
|
|
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req); |
|
|
|
|
|
|
|
IPage pages = super.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
|
|
|
List<OperMaintenanceTaskVO> list = OperMaintenanceTaskWrapper.build().listVO(pages.getRecords()); |
|
|
|
|
|
|
|
pages.setRecords(list); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set("main_list" + req.getCurrent() + req.getSize() , list); |
|
|
|
|
|
|
|
redisTemplate.expire("main_list" + req.getCurrent() + req.getSize(),30, TimeUnit.SECONDS); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set("main_list_total" , pages.getTotal()); |
|
|
|
|
|
|
|
redisTemplate.expire("main_list_total",30, TimeUnit.SECONDS); |
|
|
|
|
|
|
|
return R.data(pages); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Query query=new Query(); |
|
|
|
Query query=new Query(); |
|
|
|
query.setSize(req.getSize()); |
|
|
|
query.setSize(req.getSize()); |
|
|
|
query.setCurrent(req.getCurrent()); |
|
|
|
query.setCurrent(req.getCurrent()); |
|
|
|
IPage pages = Condition.getPage(query); |
|
|
|
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req); |
|
|
|
pages.setTotal(total); |
|
|
|
IPage pages = super.page(Condition.getPage(query), queryWrapper); |
|
|
|
pages.setRecords(tasks); |
|
|
|
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); |
|
|
|
return R.data(pages); |
|
|
|
return R.data(pages); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|