|
|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.app.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.facade.Hospital580FacadeService;
|
|
|
import com.fs.common.core.domain.PageResponse;
|
|
|
@@ -23,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
@@ -73,29 +76,35 @@ public class Hospital580Controller extends AppBaseController {
|
|
|
@ApiOperation(value = "销售制单分享-缓存对应订单客户开方信息")
|
|
|
@Login
|
|
|
@PostMapping("/cacheSquareInformation")
|
|
|
- public R cacheOpenInformation(@RequestBody CacheOpenInformationVo vo){
|
|
|
+ public R cacheOpenInformation(@RequestBody Map<String, Object> vo){
|
|
|
TwelveDigitSnowflake snowflake = snowflakeFactory.getSnowflake();
|
|
|
String key = String.valueOf(snowflake.nextId());
|
|
|
//缓存开放信息-6小时
|
|
|
- String redisKey = buildCacheKey(key,"square",vo.getUserId());
|
|
|
- redisCache.setCacheObject(redisKey , JSON.toJSONString(vo), 6, TimeUnit.HOURS);
|
|
|
- return R.ok().put("dataKey",key);
|
|
|
+ String redisKey = buildCacheKey(key, "square",Long.parseLong(vo.get("userId").toString()));
|
|
|
+ redisCache.setCacheObject(redisKey, JSON.toJSONString(vo), 6, TimeUnit.HOURS);
|
|
|
+ return R.ok().put("dataKey", key);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "销售制单分享-获取缓存对应订单客户开方信息")
|
|
|
@Login
|
|
|
@PostMapping("/selectSquareInformation")
|
|
|
- public R selectOpenInformation(@RequestBody CacheOpenInformationVo vo) {
|
|
|
- log.debug("获取缓存开放信息: orderKey={}, companyUserId={}",
|
|
|
- vo.getDataKey(), vo.getUserId());
|
|
|
+ public R selectOpenInformation(@RequestBody Map<String, Object> vo) {
|
|
|
+ String dataKey = String.valueOf(vo.get("dataKey")) ;
|
|
|
+ String userId = String.valueOf(vo.get("userId"));
|
|
|
|
|
|
- String redisKey = buildCacheKey(vo.getDataKey(),"square", vo.getUserId());
|
|
|
- CacheOpenInformationVo informationVo = JSON.parseObject(redisCache.getCacheObject(redisKey), CacheOpenInformationVo.class);
|
|
|
- if (informationVo == null) {
|
|
|
+ log.debug("获取缓存开放信息: orderKey={}, companyUserId={}", dataKey, userId);
|
|
|
+
|
|
|
+ String redisKey = buildCacheKey(dataKey, "square", Long.valueOf(userId));
|
|
|
+ String cacheData = redisCache.getCacheObject(redisKey);
|
|
|
+
|
|
|
+ if (cacheData == null) {
|
|
|
log.warn("缓存未找到: key={}", redisKey);
|
|
|
return R.error("未找到对应的开放信息");
|
|
|
}
|
|
|
- return R.ok().put("data",informationVo);
|
|
|
+
|
|
|
+ // 返回原始的 Map 数据
|
|
|
+ Map<String, Object> information = JSON.parseObject(cacheData, new TypeReference<Map<String, Object>>(){});
|
|
|
+ return R.ok().put("data", information);
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
@@ -112,7 +121,11 @@ public class Hospital580Controller extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
String redisKey = buildCacheKey("orderId",vo.getOrderCode(), vo.getUserId());
|
|
|
- redisCache.setCacheObject(redisKey , vo.getDataKey(), 6, TimeUnit.HOURS);
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("dataKey",vo.getDataKey());
|
|
|
+ map.put("orderCode",vo.getOrderCode());
|
|
|
+ map.put("companyUserId",vo.getCompanyUserId());
|
|
|
+ redisCache.setCacheObject(redisKey , map, 6, TimeUnit.HOURS);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@@ -124,8 +137,8 @@ public class Hospital580Controller extends AppBaseController {
|
|
|
return R.error("订单信息不能为空");
|
|
|
}
|
|
|
String redisKey = buildCacheKey("orderId",vo.getOrderCode(), vo.getUserId());
|
|
|
- String dataKey=redisCache.getCacheObject(redisKey);
|
|
|
- return R.ok().put("dataKey",dataKey);
|
|
|
+ Map<String,Object> map=redisCache.getCacheObject(redisKey);
|
|
|
+ return R.ok().put("dataKey",map);
|
|
|
}
|
|
|
|
|
|
|