北京经济技术开发区经开区虚拟城市项目-【后端】-服务,Poi,企业,地块等定制接口
13693261870
2023-10-05 ab2c34275d9527a708330cd6beea1932d13e6b99
将JSON映射成实体类
已添加1个文件
已修改2个文件
185 ■■■■■ 文件已修改
src/main/java/com/smartearth/poiexcel/config/InitConfig.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/smartearth/poiexcel/controller/EntController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/smartearth/poiexcel/entity/EntResult.java 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/smartearth/poiexcel/config/InitConfig.java
@@ -2,6 +2,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.smartearth.poiexcel.entity.EntEntity;
import com.smartearth.poiexcel.entity.EntResult;
import com.smartearth.poiexcel.entity.Result;
import com.smartearth.poiexcel.entity.TokenResult;
import org.apache.commons.logging.Log;
@@ -9,6 +11,8 @@
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.util.List;
/**
 * åˆå§‹åŒ–完成配置类
@@ -30,12 +34,21 @@
        }
    }
    /**
     * æµ‹è¯•
     */
    private void test() {
        String json = "{\"success\":true,\"code\":200,\"message\":\"成功\",\"data\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"userInfo\":{\"loginLogId\":\"1ab1675c3632428a84dc0ebe579cd66f\",\"phoneNumber\":\"\",\"displayName\":\"时空一张图\",\"userMail\":\"\",\"departLevel\":\"5-1\",\"id\":\"ff1e827d1e6243108cf8343b46b7dc05\",\"userID\":\"shikong001\",\"uniqueID\":\"\",\"departName\":\"汽车和智能制造产业专班\"},\"expires\":3600,\"roles\":[]}}";
        Result rs = JSON.parseObject(json, Result.class);
        String tokenJson = "{\"success\":true,\"code\":200,\"message\":\"成功\",\"data\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"userInfo\":{\"loginLogId\":\"1ab1675c3632428a84dc0ebe579cd66f\",\"phoneNumber\":\"\",\"displayName\":\"时空一张图\",\"userMail\":\"\",\"departLevel\":\"5-1\",\"id\":\"ff1e827d1e6243108cf8343b46b7dc05\",\"userID\":\"shikong001\",\"uniqueID\":\"\",\"departName\":\"汽车和智能制造产业专班\"},\"expires\":3600,\"roles\":[]}}";
        Result rsToken = JSON.parseObject(tokenJson, Result.class);
        // TokenResult tr = JSON.parseObject(rs.getData().toJSONString(), TokenResult.class)
        TokenResult tr = JSONObject.parseObject(rs.getData(), TokenResult.class);
        TokenResult tr = JSONObject.parseObject(rsToken.getData(), TokenResult.class);
        String token = tr.getCtoken();
        int len = json.length();
        String entJson = "{\"success\":true,\"code\":200,\"message\":\"成功\",\"data\":{\"showCount\":2,\"totalPage\":30,\"totalResult\":59,\"currentPage\":2,\"currentResult\":2,\"entityOrField\":true,\"pd\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"showCount\":\"2\",\"qylabel\":\"开业\",\"buildDate_startdate\":\"2023-06-29\",\"currentPage\":\"2\",\"list\":[{\"entName\":\"煤科通安(北京)智控科技有限公司\",\"fingerId\":\"649d7f468429fa3468856bc0\",\"regCapital\":\"4500\",\"regCapitalCNY\":\"4500\",\"legalPerson\":\"霍中刚\",\"address\":\"北京市北京经济技术开发区(大兴)采育镇育隆大街5号\",\"buildDate\":\"2023-06-29\",\"entType\":\"1190-其他有限责任公司\",\"industryCategory\":\"M-科学研究和技术服务业\",\"businessScope\":\"一般项目:技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广;工程和技术研究和试验发展;对外承包工程;工程管理服务;矿山机械销售;电气设备销售;仪器仪表销售;煤炭销售(不在北京地区开展实物煤的交易、储运活动);软件开发;信息咨询服务(不含许可类信息咨询服务);广告制作;广告发布;广告设计、代理;仪器仪表制造;工业自动控制系统装置制造;工业自动控制系统装置销售;气压动力机械及元件制造;气压动力机械及元件销售;机械电气设备制造;物联网设备制造;数据处理服务。(除依法须经批准的项目外,凭营业执照依法自主开展经营活动)许可项目:安全生产检验检测;建筑智能化系统设计;建筑劳务分包。(依法须经批准的项目,经相关部门批准后方可开展经营活动,具体经营项目以相关部门批准文件或许可证件为准)(不得从事国家和本市产业政策禁止和限制类项目的经营活动。)\",\"qylabel\":\"开业\"},{\"entName\":\"北京荣华利通文化传媒有限公司\",\"fingerId\":\"649d7f468429fa3468856bc1\",\"regCapital\":\"50\",\"regCapitalCNY\":\"50\",\"legalPerson\":\"袁静\",\"address\":\"北京市北京经济技术开发区荣华南路2号院2号楼5层509-1\",\"buildDate\":\"2023-06-29\",\"entType\":\"1130-有限责任公司(自然人投资或控股)\",\"industryCategory\":\"R-文化、体育和娱乐业\",\"businessScope\":\"一般项目:组织文化艺术交流活动;会议及展览服务;图文设计制作;数字内容制作服务(不含出版发行);信息咨询服务(不含许可类信息咨询服务);市场调查(不含涉外调查);广告制作;广告设计、代理;广告发布;平面设计;社会经济咨询服务;市场营销策划;咨询策划服务;企业形象策划。(除依法须经批准的项目外,凭营业执照依法自主开展经营活动)(不得从事国家和本市产业政策禁止和限制类项目的经营活动。)\",\"qylabel\":\"开业\"}],\"buildDate_enddate\":\"2023-06-30\"}}}";
        Result rsEnt = JSON.parseObject(entJson, Result.class);
        EntResult er = JSONObject.parseObject(rsEnt.getData(), EntResult.class);
        List<EntEntity> entList = er.getPd().getList();
        int len = tokenJson.length();
    }
}
src/main/java/com/smartearth/poiexcel/controller/EntController.java
@@ -1,8 +1,6 @@
package com.smartearth.poiexcel.controller;
import com.smartearth.poiexcel.entity.ResponseMsg;
import com.smartearth.poiexcel.entity.Result;
import com.smartearth.poiexcel.entity.TokenResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
src/main/java/com/smartearth/poiexcel/entity/EntResult.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,162 @@
package com.smartearth.poiexcel.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
 * ä¼ä¸šç»“果类
 * @author WWW
 */
public class EntResult implements Serializable {
    private static final long serialVersionUID = -8624235184539814993L;
    private Integer showCount;
    private Integer totalPage;
    private Integer totalResult;
    private Integer currentPage;
    private Integer currentResult;
    private Boolean entityOrField;
    private PageData pd;
    public EntResult() {
    }
    public Integer getShowCount() {
        return showCount;
    }
    public void setShowCount(Integer showCount) {
        this.showCount = showCount;
    }
    public Integer getTotalPage() {
        return totalPage;
    }
    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }
    public Integer getTotalResult() {
        return totalResult;
    }
    public void setTotalResult(Integer totalResult) {
        this.totalResult = totalResult;
    }
    public Integer getCurrentPage() {
        return currentPage;
    }
    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }
    public Integer getCurrentResult() {
        return currentResult;
    }
    public void setCurrentResult(Integer currentResult) {
        this.currentResult = currentResult;
    }
    public Boolean getEntityOrField() {
        return entityOrField;
    }
    public void setEntityOrField(Boolean entityOrField) {
        this.entityOrField = entityOrField;
    }
    public PageData getPd() {
        return pd;
    }
    public void setPd(PageData pd) {
        this.pd = pd;
    }
    public static class PageData {
        private String ctoken;
        private Integer showCount;
        private String qylabel;
        private String buildDate_startdate;
        private String buildDate_enddate;
        private Integer currentPage;
        private List<EntEntity> list;
        public PageData() {
            list = new ArrayList<>();
        }
        public String getCtoken() {
            return ctoken;
        }
        public void setCtoken(String ctoken) {
            this.ctoken = ctoken;
        }
        public Integer getShowCount() {
            return showCount;
        }
        public void setShowCount(Integer showCount) {
            this.showCount = showCount;
        }
        public String getQylabel() {
            return qylabel;
        }
        public void setQylabel(String qylabel) {
            this.qylabel = qylabel;
        }
        public String getBuildDate_startdate() {
            return buildDate_startdate;
        }
        public void setBuildDate_startdate(String buildDate_startdate) {
            this.buildDate_startdate = buildDate_startdate;
        }
        public String getBuildDate_enddate() {
            return buildDate_enddate;
        }
        public void setBuildDate_enddate(String buildDate_enddate) {
            this.buildDate_enddate = buildDate_enddate;
        }
        public Integer getCurrentPage() {
            return currentPage;
        }
        public void setCurrentPage(Integer currentPage) {
            this.currentPage = currentPage;
        }
        public List<EntEntity> getList() {
            return list;
        }
        public void setList(List<EntEntity> list) {
            this.list = list;
        }
    }
}