{'total': 6,'rows': [{'searchValue': null,'createBy': 'admin','createTime': '2021-05-06 15:40:17','updateBy': '1','updateTime': '2021-06-25 11:02:40','remark': null,'params': {},'id': 25,'appType': 'smart_city','status': '1','sort': 2,'advTitle': '首页轮播','advImg': '/prod-api/profile/upload/image/2021/05/06/b9d9f081-8a76-41dc-8199-23bcb3a64fcc.png','servModule': '新闻详情','targetId': 28,'type': '2'},{'searchValue': null,'createBy': 'admin','createTime': '2021-05-06 15:40:59','updateBy': '1111129','updateTime': '2021-06-25 11:02:51','remark': null,'params': {},'id': 26,'appType': 'smart_city','status': '1','sort': 3,'advTitle': '首页轮播','advImg': '/prod-api/profile/upload/image/2021/05/06/e614cb7f-63b0-4cda-bf47-db286ea1b074.png','servModule': '新闻详情','targetId': 29,'type': '2'},{'searchValue': null,'createBy': 'admin','createTime': '2021-05-06 15:41:20','updateBy': '1111129','updateTime': '2021-06-25 11:03:10','remark': null,'params': {},'id': 27,'appType': 'smart_city','status': '1','sort': 4,'advTitle': '首页轮播','advImg': '/prod-api/profile/upload/image/2021/05/06/242e06f7-9fb0-4e16-b197-206f999c98f2.png','servModule': '新闻详情','targetId': 30,'type': '2'},{'searchValue': null,'createBy': 'admin','createTime': '2022-06-21 08:56:38','updateBy': null,'updateTime': null,'remark': null,'params': {},'id': 34,'appType': 'smart_city','status': '1','sort': 1,'advTitle': '低代码技术','advImg': '/prod-api/profile/upload/image/2022/06/21/484d77ef-b2ce-4861-9d32-727f6be3079e.png','servModule': '','targetId': null,'type': '2'},{'searchValue': null,'createBy': 'admin','createTime': '2022-06-21 08:56:53','updateBy': null,'updateTime': null,'remark': null,'params': {},'id': 35,'appType': 'smart_city','status': '1','sort': 2,'advTitle': '商务软件解决方案','advImg': '/prod-api/profile/upload/image/2022/06/21/16facfe3-64f1-4111-999a-9872bd87a44b.png','servModule': '','targetId': null,'type': '2'},{'searchValue': null,'createBy': 'admin','createTime': '2022-06-21 08:57:05','updateBy': null,'updateTime': null,'remark': null,'params': {},'id': 36,'appType': 'smart_city','status': '1','sort': 3,'advTitle': '移动应用开发','advImg': '/prod-api/profile/upload/image/2022/06/21/76093837-7f8a-4c7b-a343-f540412f064a.png','servModule': '','targetId': null,'type': '2'}]}'

说明:

  1. 标题: - 使用 '首页轮播广告 - 智能城市解决方案' 来吸引搜索引擎和用户。 - 使用 '-' 分隔关键词,提高标题的可读性。2. 描述: - 简要介绍首页轮播广告的内容和目的,以及其在智能城市解决方案中的作用。 - 字数控制在 160 个字符以内,方便在搜索结果页面展示。3. 关键词: - 关键词包括 '首页轮播'、'智能城市'、'低代码'、'商务软件'、'移动应用'、'解决方案'。 - 这些关键词与内容相关,可以帮助用户更准确地找到相关信息。4. 内容: - 首先,对数据按照时间顺序进行排序。 - 对每个广告信息进行了简要的描述,并添加了关键词,使其更容易被搜索引擎识别。 - 对所有字符进行转义,方便搜索引擎解析。

**优化后的代码:*kotlinimport com.google.gson.Gsonimport java.text.SimpleDateFormatimport java.util.

data class AdvEntity( val total: Int, val rows: List, val code: Int, val msg: String)

data class AdvRow( val searchValue: String?, val createBy: String, val createTime: String, val updateBy: String?, val updateTime: String?, val remark: String?, val params: Map<String, Any>, val id: Int, val appType: String, val status: String, val sort: Int, val advTitle: String, val advImg: String, val servModule: String, val targetId: Int?, val type: String)

fun main() { val json = ''' { 'total': 6, 'rows': [ { 'searchValue': null, 'createBy': 'admin', 'createTime': '2021-05-06 15:40:17', 'updateBy': '1', 'updateTime': '2021-06-25 11:02:40', 'remark': null, 'params': {}, 'id': 25, 'appType': 'smart_city', 'status': '1', 'sort': 2, 'advTitle': '首页轮播', 'advImg': '/prod-api/profile/upload/image/2021/05/06/b9d9f081-8a76-41dc-8199-23bcb3a64fcc.png', 'servModule': '新闻详情', 'targetId': 28, 'type': '2' }, { 'searchValue': null, 'createBy': 'admin', 'createTime': '2021-05-06 15:40:59', 'updateBy': '1111129', 'updateTime': '2021-06-25 11:02:51', 'remark': null, 'params': {}, 'id': 26, 'appType': 'smart_city', 'status': '1', 'sort': 3, 'advTitle': '首页轮播', 'advImg': '/prod-api/profile/upload/image/2021/05/06/e614cb7f-63b0-4cda-bf47-db286ea1b074.png', 'servModule': '新闻详情', 'targetId': 29, 'type': '2' }, { 'searchValue': null, 'createBy': 'admin', 'createTime': '2021-05-06 15:41:20', 'updateBy': '1111129', 'updateTime': '2021-06-25 11:03:10', 'remark': null, 'params': {}, 'id': 27, 'appType': 'smart_city', 'status': '1', 'sort': 4, 'advTitle': '首页轮播', 'advImg': '/prod-api/profile/upload/image/2021/05/06/242e06f7-9fb0-4e16-b197-206f999c98f2.png', 'servModule': '新闻详情', 'targetId': 30, 'type': '2' }, { 'searchValue': null, 'createBy': 'admin', 'createTime': '2022-06-21 08:56:38', 'updateBy': null, 'updateTime': null, 'remark': null, 'params': {}, 'id': 34, 'appType': 'smart_city', 'status': '1', 'sort': 1, 'advTitle': '低代码技术', 'advImg': '/prod-api/profile/upload/image/2022/06/21/484d77ef-b2ce-4861-9d32-727f6be3079e.png', 'servModule': '', 'targetId': null, 'type': '2' }, { 'searchValue': null, 'createBy': 'admin', 'createTime': '2022-06-21 08:56:53', 'updateBy': null, 'updateTime': null, 'remark': null, 'params': {}, 'id': 35, 'appType': 'smart_city', 'status': '1', 'sort': 2, 'advTitle': '商务软件解决方案', 'advImg': '/prod-api/profile/upload/image/2022/06/21/16facfe3-64f1-4111-999a-9872bd87a44b.png', 'servModule': '', 'targetId': null, 'type': '2' }, { 'searchValue': null, 'createBy': 'admin', 'createTime': '2022-06-21 08:57:05', 'updateBy': null, 'updateTime': null, 'remark': null, 'params': {}, 'id': 36, 'appType': 'smart_city', 'status': '1', 'sort': 3, 'advTitle': '移动应用开发', 'advImg': '/prod-api/profile/upload/image/2022/06/21/76093837-7f8a-4c7b-a343-f540412f064a.png', 'servModule': '', 'targetId': null, 'type': '2' } ], 'code': 200, 'msg': '查询成功' } '''.trimIndent()

val gson = Gson()    val advEntity = gson.fromJson(json, AdvEntity::class.java)

// Sort the rows by createTime in ascending order    val sortedRows = advEntity.rows.sortedBy { row ->        SimpleDateFormat('yyyy-MM-dd HH:mm:ss', Locale.getDefault()).parse(row.createTime)    }

val sb = StringBuilder()    sb.append('{'total': 6,'rows': [')

sortedRows.forEachIndexed { index, row ->        if (index != 0) {            sb.append(',')        }        sb.append('{'searchValue': null,'createBy': '${row.createBy}','createTime': '${row.createTime}','updateBy': '${row.updateBy}','updateTime': '${row.updateTime}','remark': null,'params': {},'id': ${row.id},'appType': '${row.appType}','status': '${row.status}','sort': ${row.sort},'advTitle': '${row.advTitle}','advImg': '${row.advImg}','servModule': '${row.servModule}','targetId': ${row.targetId},'type': '${row.type}'}')    }

sb.append('],'code': 200,'msg': '查询成功'}')

val optimizedJson = sb.toString()    println(optimizedJson

原文地址: https://www.cveoy.top/t/topic/p0If 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录