From 8b4b2bf9921c1a89e6ada8f608aaff3dac7abf84 Mon Sep 17 00:00:00 2001 From: hxh Date: Wed, 19 Jun 2024 14:54:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=A1=E5=88=92=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=B7=AF=E7=BA=BF=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shuili/common/core/redis/RedisCache.java | 440 +++++++++--------- .../common/core/service/BaseService.java | 66 +-- .../yxgh/df/dto/DfCheckingPlanContentDto.java | 3 + .../com/kms/yxgh/df/dto/DfPlanSearchDto.java | 3 + .../com/kms/yxgh/df/dto/DfPlanSimpleDto.java | 6 + .../com/kms/yxgh/df/mapper/DfPlanMapper.java | 14 +- .../kms/yxgh/df/service/DfPlanService.java | 13 +- 7 files changed, 293 insertions(+), 252 deletions(-) diff --git a/shuili-framework/src/main/java/com/shuili/common/core/redis/RedisCache.java b/shuili-framework/src/main/java/com/shuili/common/core/redis/RedisCache.java index 8012ae4d..0537ec89 100644 --- a/shuili-framework/src/main/java/com/shuili/common/core/redis/RedisCache.java +++ b/shuili-framework/src/main/java/com/shuili/common/core/redis/RedisCache.java @@ -18,227 +18,229 @@ import java.util.concurrent.TimeUnit; * * @author shuili **/ -@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@SuppressWarnings(value = {"unchecked", "rawtypes"}) @Component public class RedisCache { - @Autowired - public RedisTemplate redisTemplate; - - @Value("${shuili.nameKey}") - private String REDIS_PREFIX; - - - /** - * 缓存基本的对象,Integer、String、实体类等 - * - * @param key 缓存的键值 - * @param value 缓存的值 - */ - public void setCacheObject(final String key, final T value) { - redisTemplate.opsForValue().set(REDIS_PREFIX+"_"+key, value); - } - - /** - * 缓存基本的对象,Integer、String、实体类等 - * - * @param key 缓存的键值 - * @param value 缓存的值 - * @param timeout 时间 - * @param timeUnit 时间颗粒度 - */ - public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) { - redisTemplate.opsForValue().set(REDIS_PREFIX+"_"+key, value, timeout, timeUnit); - } - - public void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) { - redisTemplate.opsForValue().set(REDIS_PREFIX+"_"+key, value, timeout, timeUnit); - } - - /** - * 设置有效时间 - * - * @param key Redis键 - * @param timeout 超时时间 - * @return true=设置成功;false=设置失败 - */ - public boolean expire(final String key, final long timeout) { - return expire(REDIS_PREFIX+"_"+key, timeout, TimeUnit.SECONDS); - } - - /** - * 获取有效时间 - * - * @param key - * @return - */ - public long getExpire(final String key) { - return redisTemplate.getExpire(REDIS_PREFIX+"_"+key); - } - - /** - * 设置有效时间 - * - * @param key Redis键 - * @param timeout 超时时间 - * @param unit 时间单位 - * @return true=设置成功;false=设置失败 - */ - public boolean expire(final String key, final long timeout, final TimeUnit unit) { - return redisTemplate.expire(REDIS_PREFIX+"_"+key, timeout, unit); - } - - /** - * 获得缓存的基本对象。 - * - * @param key 缓存键值 - * @return 缓存键值对应的数据 - */ - public T getCacheObject(final String key) { - ValueOperations operation = redisTemplate.opsForValue(); - return operation.get(REDIS_PREFIX+"_"+key); - } - public T getCacheObject(final String key,Class c) { - ValueOperations operation = redisTemplate.opsForValue(); - return operation.get(REDIS_PREFIX+"_"+key); - } - - /** - * 删除单个对象 - * - * @param key - */ - public boolean deleteObject(final String key) { - return redisTemplate.delete(REDIS_PREFIX+"_"+key); - } - - /** - * 删除集合对象 - * - * @param collection 多个对象 - * @return - */ - public long deleteObject(final Collection collection) { - return redisTemplate.delete(collection); - } - - /** - * 缓存List数据 - * - * @param key 缓存的键值 - * @param dataList 待缓存的List数据 - * @return 缓存的对象 - */ - public long setCacheList(final String key, final List dataList) { - Long count = redisTemplate.opsForList().rightPushAll(REDIS_PREFIX+"_"+key, dataList); - return count == null ? 0 : count; - } - - /** - * 获得缓存的list对象 - * - * @param key 缓存的键值 - * @return 缓存键值对应的数据 - */ - public List getCacheList(final String key) { - return redisTemplate.opsForList().range(REDIS_PREFIX+"_"+key, 0, -1); - } - - /** - * 缓存Set - * - * @param key 缓存键值 - * @param dataSet 缓存的数据 - * @return 缓存数据的对象 - */ - public long setCacheSet(final String key, final Set dataSet) { + @Autowired + public RedisTemplate redisTemplate; + + @Value("${shuili.nameKey}") + private String REDIS_PREFIX; + + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + */ + public void setCacheObject(final String key, final T value) { + redisTemplate.opsForValue().set(REDIS_PREFIX + "_" + key, value); + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + */ + public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) { + redisTemplate.opsForValue().set(REDIS_PREFIX + "_" + key, value, timeout, timeUnit); + } + + public void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) { + redisTemplate.opsForValue().set(REDIS_PREFIX + "_" + key, value, timeout, timeUnit); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout) { + return expire(REDIS_PREFIX + "_" + key, timeout, TimeUnit.SECONDS); + } + + /** + * 获取有效时间 + * + * @param key + * @return + */ + public long getExpire(final String key) { + return redisTemplate.getExpire(REDIS_PREFIX + "_" + key); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) { + return Boolean.TRUE.equals(redisTemplate.expire(REDIS_PREFIX + "_" + key, timeout, unit)); + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(REDIS_PREFIX + "_" + key); + } + + public T getCacheObject(final String key, Class c) { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(REDIS_PREFIX + "_" + key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) { + return Boolean.TRUE.equals(redisTemplate.delete(REDIS_PREFIX + "_" + key)); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public long deleteObject(final Collection collection) { + return redisTemplate.delete(collection); + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public long setCacheList(final String key, final List dataList) { + Long count = redisTemplate.opsForList().rightPushAll(REDIS_PREFIX + "_" + key, dataList); + return count == null ? 0 : count; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(final String key) { + return redisTemplate.opsForList().range(REDIS_PREFIX + "_" + key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public long setCacheSet(final String key, final Set dataSet) { // redisTemplate.opsForSet() - Long count = redisTemplate.opsForSet().add(REDIS_PREFIX+"_"+key, dataSet); - return count == null ? 0 : count; - } - public long setCacheSet(final String key, final Set dataSet,int time,TimeUnit t) { - - Long count = redisTemplate.opsForSet().add(REDIS_PREFIX+"_"+key, dataSet,time,t); - return count == null ? 0 : count; - } - - /** - * 获得缓存的set - * - * @param key - * @return - */ - public Set getCacheSet(final String key) { - return redisTemplate.opsForSet().members(REDIS_PREFIX+"_"+key); - } - - /** - * 缓存Map - * - * @param key - * @param dataMap - */ - public void setCacheMap(final String key, final Map dataMap) { - if (dataMap != null) { - redisTemplate.opsForHash().putAll(REDIS_PREFIX+"_"+key, dataMap); - } - } - - /** - * 获得缓存的Map - * - * @param key - * @return - */ - public Map getCacheMap(final String key) { - return redisTemplate.opsForHash().entries(REDIS_PREFIX+"_"+key); - } - - /** - * 往Hash中存入数据 - * - * @param key Redis键 - * @param hKey Hash键 - * @param value 值 - */ - public void setCacheMapValue(final String key, final String hKey, final T value) { - redisTemplate.opsForHash().put(REDIS_PREFIX+"_"+key, hKey, value); - } - - /** - * 获取Hash中的数据 - * - * @param key Redis键 - * @param hKey Hash键 - * @return Hash中的对象 - */ - public T getCacheMapValue(final String key, final String hKey) { - HashOperations opsForHash = redisTemplate.opsForHash(); - return opsForHash.get(REDIS_PREFIX+"_"+key, hKey); - } - - /** - * 获取多个Hash中的数据 - * - * @param key Redis键 - * @param hKeys Hash键集合 - * @return Hash对象集合 - */ - public List getMultiCacheMapValue(final String key, final Collection hKeys) { - return redisTemplate.opsForHash().multiGet(REDIS_PREFIX+"_"+key, hKeys); - } - - /** - * 获得缓存的基本对象列表 - * - * @param pattern 字符串前缀 - * @return 对象列表 - */ - public Collection keys(final String pattern) { - return redisTemplate.keys(pattern); - } - - public boolean hasKey(String key) { - return redisTemplate.hasKey(REDIS_PREFIX+"_"+key); - } + Long count = redisTemplate.opsForSet().add(REDIS_PREFIX + "_" + key, dataSet); + return count == null ? 0 : count; + } + + public long setCacheSet(final String key, final Set dataSet, int time, TimeUnit t) { + + Long count = redisTemplate.opsForSet().add(REDIS_PREFIX + "_" + key, dataSet, time, t); + return count == null ? 0 : count; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(final String key) { + return redisTemplate.opsForSet().members(REDIS_PREFIX + "_" + key); + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + */ + public void setCacheMap(final String key, final Map dataMap) { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(REDIS_PREFIX + "_" + key, dataMap); + } + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(final String key) { + return redisTemplate.opsForHash().entries(REDIS_PREFIX + "_" + key); + } + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue(final String key, final String hKey, final T value) { + redisTemplate.opsForHash().put(REDIS_PREFIX + "_" + key, hKey, value); + } + + /** + * 获取Hash中的数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return Hash中的对象 + */ + public T getCacheMapValue(final String key, final String hKey) { + HashOperations opsForHash = redisTemplate.opsForHash(); + return opsForHash.get(REDIS_PREFIX + "_" + key, hKey); + } + + /** + * 获取多个Hash中的数据 + * + * @param key Redis键 + * @param hKeys Hash键集合 + * @return Hash对象集合 + */ + public List getMultiCacheMapValue(final String key, final Collection hKeys) { + return redisTemplate.opsForHash().multiGet(REDIS_PREFIX + "_" + key, hKeys); + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) { + return redisTemplate.keys(pattern); + } + + public boolean hasKey(String key) { + return Boolean.TRUE.equals(redisTemplate.hasKey(REDIS_PREFIX + "_" + key)); + } } diff --git a/shuili-framework/src/main/java/com/shuili/common/core/service/BaseService.java b/shuili-framework/src/main/java/com/shuili/common/core/service/BaseService.java index d944a70d..4803f193 100644 --- a/shuili-framework/src/main/java/com/shuili/common/core/service/BaseService.java +++ b/shuili-framework/src/main/java/com/shuili/common/core/service/BaseService.java @@ -21,61 +21,69 @@ import java.util.Objects; /** * 扩展其他的通用方法 + * * @param */ -public class BaseService, T extends BaseEntity> extends ServiceImpl{ +public class BaseService, T extends BaseEntity> extends ServiceImpl { RedisCache redisCache = SpringUtils.getBean(RedisCache.class); - public IPage selectPage(SearchParam sp){ - return getBaseMapper().selectPage(new Page<>(sp.getPageNum(),sp.getPageSize()), BeanToWrapper.getWrapper(sp)); + public IPage selectPage(SearchParam sp) { + return getBaseMapper().selectPage(new Page<>(sp.getPageNum(), sp.getPageSize()), BeanToWrapper.getWrapper(sp)); } - public AjaxResult selectPage(T t){ + public AjaxResult selectPage(T t) { QueryWrapper wrapper = BeanToWrapper.getWrapper(t); BeanToWrapper.order(wrapper, t); Page> mapPage = getBaseMapper().selectMapsPage(new Page<>(t.getPageNum(), t.getPageSize()), wrapper); AjaxResult success = AjaxResult.success(); - success.put(AjaxResult.DATA_TAG,mapPage.getRecords()); - success.put(AjaxResult.TOTAL,mapPage.getTotal()); + success.put(AjaxResult.DATA_TAG, mapPage.getRecords()); + success.put(AjaxResult.TOTAL, mapPage.getTotal()); return success; } + /** * 同步保存到缓存 + * * @param t * @return */ - public boolean saveWithRedis(T t){ + public boolean saveWithRedis(T t) { boolean save = super.save(t); - if(save){ - redisCache.setCacheObject(getRedisKey()+t.getId(),t); + if (save) { + redisCache.setCacheObject(getRedisKey() + t.getId(), t); } return true; } /** * 同步更新缓存 + * * @param t * @return */ - public boolean updateWithReids(T t){ + public boolean updateWithReids(T t) { boolean result = super.updateById(t); - if(result){ - redisCache.setCacheObject(getRedisKey()+t.getId(),t); + if (result) { + redisCache.setCacheObject(getRedisKey() + t.getId(), t); } return result; } /** * 从缓存中获取对应的数据 + * * @param id * @return */ - public T getWithRedis(Serializable id){ - T cacheObject = redisCache.getCacheObject(getRedisKey()+id.toString(),getEntityClass()); - if(Objects.isNull(cacheObject)){ + public T getWithRedis(Serializable id) { + T cacheObject = redisCache.getCacheObject(getRedisKey() + id.toString(), getEntityClass()); + if (Objects.isNull(cacheObject)) { T byId = getById(id); - redisCache.setCacheObject(getRedisKey()+id.toString(),byId); + if (Objects.isNull(byId)) { + return null; + } + redisCache.setCacheObject(getRedisKey() + id, byId); return byId; } return cacheObject; @@ -84,45 +92,49 @@ public class BaseService, T extends BaseEntity> extends /** * 同步删除redis + * * @return */ - public boolean removeByIdWithRedis(Serializable id){ + public boolean removeByIdWithRedis(Serializable id) { boolean result = super.removeById(id); - if(result){ // 同步删除redis - redisCache.deleteObject(getRedisKey()+id.toString()); + if (result) { // 同步删除redis + redisCache.deleteObject(getRedisKey() + id.toString()); } return result; } /** * 同步删除缓存 + * * @param ids * @return */ - public boolean removeWithRedis(Serializable[] ids){ + public boolean removeWithRedis(Serializable[] ids) { boolean result = removeByIds(Arrays.asList(ids)); - if(result){ + if (result) { for (Serializable id : ids) { - redisCache.deleteObject(getRedisKey()+id.toString()); + redisCache.deleteObject(getRedisKey() + id.toString()); } } return result; } - public boolean removeWithRedis(List ids){ + public boolean removeWithRedis(List ids) { boolean result = removeByIds(ids); - if(result){ + if (result) { for (Serializable id : ids) { - redisCache.deleteObject(getRedisKey()+id.toString()); + redisCache.deleteObject(getRedisKey() + id.toString()); } } return result; } + /** * 工程名+实体类+ id + * * @return */ - public String getRedisKey(){ - return getEntityClass()+"_"; + public String getRedisKey() { + return getEntityClass() + "_"; } } diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfCheckingPlanContentDto.java b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfCheckingPlanContentDto.java index 4b125d45..b0f13768 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfCheckingPlanContentDto.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfCheckingPlanContentDto.java @@ -35,6 +35,9 @@ public class DfCheckingPlanContentDto { @ApiModelProperty("巡查路线ID") private String lineId; + @ApiModelProperty("巡查路线名称") + private String lineName; + /** * 计划开始时间 */ diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSearchDto.java b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSearchDto.java index 5914fc3c..e867db1d 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSearchDto.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSearchDto.java @@ -17,6 +17,9 @@ public class DfPlanSearchDto { private String name; @ApiModelProperty(value = "状态") private String status; + @ApiModelProperty(value = "记录状态") + private String recordStatus; + private String user; @ApiModelProperty(value = "巡查人员id") private List userIds; @ApiModelProperty(value = "开始时间") diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSimpleDto.java b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSimpleDto.java index 683bc70b..de535b0d 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSimpleDto.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/dto/DfPlanSimpleDto.java @@ -44,6 +44,12 @@ public class DfPlanSimpleDto { @ApiModelProperty("状态") private String status; + @ApiModelProperty("记录状态") + private String recordStatus; + + @ApiModelProperty("记录id") + private String recordId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty("最近修改时间") private Date updateTime; diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfPlanMapper.java b/shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfPlanMapper.java index aca71a10..c9245de0 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfPlanMapper.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfPlanMapper.java @@ -31,7 +31,9 @@ public interface DfPlanMapper extends BaseMapper { "SELECT df.dike_name as dike_name, df.dike_code as dike_code, df.dike_type as dike_type, " + "p.id, p.name, p.type plan_type, p.update_time as update_time, p.create_time as create_time, " + "p.frequency, p.status, p.create_uid as createUid, " + - "(select count(1) from bs_sgc_df_xsjhxq su where su.plan_id = p.id) as item_count " + + "(select count(1) from bs_sgc_df_xsjhxq su where su.plan_id = p.id) as item_count ," + + "(select count(1) from bs_sgc_df_xsjhjl r where p.id = r.plan_id and r.create_uid = #{dto.user} and r.status = '1' order by r.create_time desc limit 1) as record_status, " + + "(select id from bs_sgc_df_xsjhjl r where p.id = r.plan_id and r.create_uid = #{dto.user} and r.status = '1' order by r.create_time desc limit 1) as record_id " + "FROM bs_sgc_df_xsjh p " + "Left JOIN att_dike_base df ON p.dike_code = df.dike_code and df.expr_date is null " + "WHERE 1=1 " + @@ -50,6 +52,16 @@ public interface DfPlanMapper extends BaseMapper { "" + "AND p.end_date <= #{dto.endTime} " + "" + + "" + + " and NOT EXISTS (" + + " SELECT plan_id FROM bs_sgc_df_xsjhjl od WHERE p.id = od.plan_id and od.create_uid = #{dto.user} and od.status = '1'" + + ") " + + "" + + "" + + " and EXISTS (" + + " SELECT plan_id FROM bs_sgc_df_xsjhjl od WHERE p.id = od.plan_id and od.create_uid = #{dto.user} and od.status = '1'" + + ") " + + "" + "" + "AND p.id in (select plan_id from bs_sgc_df_xsjhzx where operator_uid in " + " " + diff --git a/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java b/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java index 5bb273ed..4291e4fe 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java +++ b/shuili-system/src/main/java/com/kms/yxgh/df/service/DfPlanService.java @@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.kms.common.utils.UserUtils; import com.kms.system.service.SysUserService; import com.kms.yxgh.base.DfException; import com.kms.yxgh.common.dto.OperatorDto; -import com.kms.yxgh.df.domain.DfCheckingPlanContent; -import com.kms.yxgh.df.domain.DfPlan; -import com.kms.yxgh.df.domain.DfPlanOperator; -import com.kms.yxgh.df.domain.DfRecord; +import com.kms.yxgh.df.domain.*; import com.kms.yxgh.df.dto.DfCheckingPlanContentDto; import com.kms.yxgh.df.dto.DfPlanDetailDto; import com.kms.yxgh.df.dto.DfPlanSearchDto; @@ -21,10 +19,12 @@ import com.kms.yxgh.df.mapper.DfPlanMapper; import com.kms.yxgh.df.mapper.DfRecordMapper; import com.kms.yxgh.util.BeanCopyUtils; import com.shuili.common.core.domain.SearchParam; +import com.shuili.common.core.domain.entity.SysUser; import com.shuili.common.core.service.BaseService; import com.shuili.common.utils.StringUtils; import lombok.AllArgsConstructor; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.data.util.Optionals; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -47,6 +47,7 @@ public class DfPlanService extends BaseService { private final DfRecordMapper dfRecordMapper; private final DfCheckingPlanContentService dfCheckingPlanContentService; + private final DfCheckingLineService dfCheckingLineService; private final DfCheckingPlanContentMapper dfCheckingPlanContentMapper; private final SysUserService userService; private final DfPlanOperatorService dfPlanOperatorService; @@ -54,7 +55,8 @@ public class DfPlanService extends BaseService { public IPage search(SearchParam sp) { Page page = new Page<>(sp.getPageNum(), sp.getPageSize()); DfPlanSearchDto searchDto = sp.getData(); - + SysUser user = UserUtils.getUser(); + searchDto.setUser(Optional.ofNullable(user).map(SysUser::getId).orElse(null)); IPage result = this.getBaseMapper().search(page, searchDto); result.getRecords().forEach(item -> { item.setCreateName(userService.userName(item.getCreateUid())); @@ -235,6 +237,7 @@ public class DfPlanService extends BaseService { private DfCheckingPlanContentDto toDto(DfCheckingPlanContent entity, Map> operatorMap) { DfCheckingPlanContentDto dto = BeanCopyUtils.copy(entity, DfCheckingPlanContentDto.class); if (dto != null) { + dto.setLineName(Optional.ofNullable(dfCheckingLineService.getWithRedis(dto.getLineId())).map(DfCheckingLine::getName).orElse("")); dto.setOperator(operatorMap.getOrDefault(dto.getId(), Collections.emptyList()).stream() .map(item -> { OperatorDto operatorDto = new OperatorDto();