| | |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.PhotoEnum; |
| | | import com.ruoyi.common.enums.RadioEnum; |
| | | import com.ruoyi.common.enums.VadioEnum; |
| | |
| | | import javax.xml.transform.dom.DOMSource; |
| | | import javax.xml.transform.stream.StreamResult; |
| | | import java.io.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 通用请求处理 |
| | |
| | | @Autowired |
| | | private SysConfigMapper sysConfigMapper; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | private static final String FILE_DELIMETER = ","; |
| | | |
| | | @Value("${uploadSwitch}") |
| | | private Integer uploadSwitch; |
| | | |
| | | @Value("${fileUpload}") |
| | | private String fileUpload; |
| | | |
| | | @Value("${profile}") |
| | | private String profile; |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | | |
| | | /** |
| | | * 通用下载请求 |
| | |
| | | // 上传并返回新文件名称 |
| | | String fileName = FileUploadUtils.uploadSort(filePath, file); |
| | | String url = null; |
| | | //新华医院特殊,这个视频的访问得转 |
| | | String xhPath = "http://218.108.11.22:8093/profile-api"; |
| | | String xhPath = fileUpload + profile; |
| | | |
| | | if (uploadSwitch == 1) { |
| | | String fn = fileName.replaceAll("/profile", ""); |
| | | url = xhPath + fn; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | String url = null; |
| | | String xhPath = "http://218.108.11.22:8093/profile-api"; |
| | | String xhPath = fileUpload + profile; |
| | | if (uploadSwitch == 1) { |
| | | url = xhPath + "/upload/show/" + fileName.split("\\.", 2)[0] + "/" + fileName; |
| | | } else { |
| | |
| | | String fileName = filePath.toLowerCase(); |
| | | return fileName.endsWith(".doc") || fileName.endsWith(".docx"); |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation("获取RedisCache") |
| | | @PostMapping("/getRedisCache") |
| | | public String getRedisCache(@RequestBody String key) { |
| | | String object = redisCache.getCacheObject(key); |
| | | return object; |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation("查询RedisCache") |
| | | @PostMapping("/findRedisCacheList") |
| | | public Set<String> findRedisCacheList(@RequestBody String key) { |
| | | Set<String> allKeys = redisCache.getAllKeys(); |
| | | Set<String> matchKeys = new HashSet<>(); |
| | | for (String redisKey : allKeys) { |
| | | if(redisKey.contains(key)) { |
| | | matchKeys.add(redisKey); |
| | | } |
| | | } |
| | | return matchKeys; |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | */ |
| | | @ApiOperation("删除RedisCache") |
| | | @PostMapping("/deleteRedisCache") |
| | | public String deleteRedisCache(@RequestBody String key) { |
| | | String object = redisCache.getCacheObject(key); |
| | | if(StringUtils.isNotEmpty(object)) { |
| | | redisCache.deleteObject(key); |
| | | return "删除RedisCache" + key + "成功!"; |
| | | }else { |
| | | return "删除RedisCache" + key + "失败,未找到对应cache"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |