|
@@ -1,10 +1,14 @@
|
|
|
package com.fs.app.controller;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.lang.TypeReference;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.utils.CloudHostUtils;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.his.domain.*;
|
|
|
import com.fs.his.enums.FsUserIntegralLogTypeEnum;
|
|
|
import com.fs.his.enums.PaymentMethodEnum;
|
|
@@ -23,10 +27,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@@ -88,6 +89,7 @@ public class IntegralController extends AppBaseController {
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
List<FsIntegralOrderListUVO> list=integralOrderService.selectFsIntegralOrderListUVO(param);
|
|
|
+ list.forEach(vo -> vo.setItemJson(adaptItemJson(vo.getItemJson())));
|
|
|
PageInfo<FsIntegralOrderListUVO> listPageInfo=new PageInfo<>(list);
|
|
|
return R.ok().put("data",listPageInfo);
|
|
|
}
|
|
@@ -96,9 +98,37 @@ public class IntegralController extends AppBaseController {
|
|
|
@GetMapping("/getIntegralOrderById")
|
|
|
public R getIntegralOrderById(@RequestParam("orderId")Long orderId, HttpServletRequest request){
|
|
|
FsIntegralOrder order=integralOrderService.selectFsIntegralOrderByOrderId(orderId);
|
|
|
+ order.setItemJson(adaptItemJson(order.getItemJson()));
|
|
|
return R.ok().put("data",order);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 兼容处理itemJson
|
|
|
+ */
|
|
|
+ private String adaptItemJson(String itemJson) {
|
|
|
+ if (StringUtils.isBlank(itemJson)) {
|
|
|
+ return itemJson;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CloudHostUtils.hasCloudHostName("弘德堂")) {
|
|
|
+ if (itemJson.startsWith("{") && itemJson.endsWith("}")) {
|
|
|
+ FsIntegralGoods integralGoods = JSONUtil.toBean(itemJson, FsIntegralGoods.class);
|
|
|
+ List<FsIntegralGoods> goodsItem = new ArrayList<>();
|
|
|
+ goodsItem.add(integralGoods);
|
|
|
+ return JSONUtil.toJsonStr(goodsItem);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (itemJson.startsWith("[") && itemJson.endsWith("]")) {
|
|
|
+ List<FsIntegralGoods> goodsItem = JSONUtil.toBean(itemJson, new TypeReference<List<FsIntegralGoods>>(){}, true);
|
|
|
+ if (goodsItem.size() == 1) {
|
|
|
+ return JSONUtil.toJsonStr(goodsItem.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return itemJson;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Login
|
|
|
@ApiOperation("创建订单")
|