| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.reflect.ReflectUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.PatMedInhospMapper; |
| | |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(map); |
| | | **/ |
| | | //todo 代码优化 |
| | | Map<String, Object> map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | // Map<String, Object> map = patItemCount(serviceSubtaskVO); |
| | | //Map<String, Object> map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | //patItemCount 调用redisCache记录统计数据 |
| | | Map<String, Object> map = patItemCount(serviceSubtaskVO); |
| | | map.put("serviceSubtaskList", serviceSubtaskList); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(map); |
| | |
| | | if(ObjectUtils.isNotEmpty(userId)){ |
| | | redisMap = redisCache.getCacheObject(userId + "patItemCount"); |
| | | //记录是否有可用缓存 |
| | | // Boolean redisFlag = false; |
| | | // Map oldConditionMap = (Map)redisMap.get("searchCondition"); |
| | | Boolean redisFlag = false; |
| | | ServiceSubtaskVO oldCondition = null; |
| | | if(MapUtils.isNotEmpty(redisMap)){ |
| | | oldCondition = (ServiceSubtaskVO)redisMap.get(userId + "searchCondition"); |
| | | // 比较查询条件是否一致 |
| | | if(ObjectUtils.isNotEmpty(oldCondition) && |
| | | isSameCondition(oldCondition, serviceSubtaskVO)){ |
| | | // 条件一致,使用缓存 |
| | | redisFlag = true; |
| | | map = redisMap; |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | }else { |
| | | } |
| | | } |
| | | |
| | | // 如果没有缓存或者条件不一致,重新查询 |
| | | if(!redisFlag){ |
| | | map = serviceSubtaskService.patItemCount(serviceSubtaskVO); |
| | | // map.put("searchCondition",serviceSubtaskVO); |
| | | map.put(userId + "searchCondition", serviceSubtaskVO); |
| | | redisCache.setCacheObject(userId + "patItemCount", map, 120, TimeUnit.MINUTES); |
| | | } |
| | | } |
| | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个ServiceSubtaskVO的查询条件是否一致 |
| | | * 使用反射比较所有字段,排除分页参数和无关字段 |
| | | */ |
| | | private boolean isSameCondition(ServiceSubtaskVO oldCondition, ServiceSubtaskVO newCondition) { |
| | | // 使用ReflectUtils的通用方法比较,排除分页参数等无关字段 |
| | | return ReflectUtils.equalsAllFields( |
| | | oldCondition, |
| | | newCondition, |
| | | // 排除的字段:分页参数、序列化ID、时间戳等 |
| | | "pageNum", "pageSize", "serialVersionUID", |
| | | "createBy", "createTime", "updateBy", "updateTime", |
| | | "searchValue", "params" |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出单一任务(随访宣教)列表 |