123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package com.fdkankan.manage.controller;
- import cn.dev33.satoken.stp.StpUtil;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.fdkankan.manage.common.PageInfo;
- import com.fdkankan.manage.common.ResultData;
- import com.fdkankan.manage.httpClient.client.OverallClient;
- import com.fdkankan.manage.httpClient.vo.OverallParam;
- import com.fdkankan.manage.httpClient.vo.OverallVo;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * 全景看看作品
- */
- @RestController
- @RequestMapping("/service/manage/overall")
- public class OverallController {
- private static String appId ="BDA385EC848C1A425F746869011C8D23";
- private static String key ="appId";
- @Autowired
- OverallClient overallClient;
- @PostMapping("/list")
- public ResultData list(@RequestBody OverallParam param){
- OverallVo vo = overallClient.list(param,appId,key);
- if(vo.getCode() != 0 ){
- return ResultData.error(vo.getCode(),vo.getMsg());
- }
- Object data = vo.getData();
- JSONObject dataObj = JSONObject.parseObject(JSONObject.toJSONString(data));
- JSONArray array = dataObj.getJSONArray("list");
- for (Object o : array) {
- JSONObject obj = (JSONObject) o;
- obj.put("thumb",obj.getString("share"));
- obj.put("sceneCodes",obj.getString("id"));
- String name = obj.getString("name");
- if(StringUtils.isBlank(name)){
- name = "无标题";
- }
- obj.put("name",name);
- }
- List<Object> list = new ArrayList<>(array);
- long total = dataObj.getLongValue("total");
- return ResultData.ok(new PageInfo<>(param.getPageNum(), param.getPageSize(), total, list));
- }
- @PostMapping("/delete")
- public ResultData delete(@RequestBody OverallParam param){
- OverallVo vo = overallClient.delete(param.getId(),appId,key);
- if(vo.getCode() != 0 ){
- return ResultData.error(vo.getCode(),vo.getMsg());
- }
- return ResultData.ok(vo.getData());
- }
- }
|