方法一:

postman的传参:

java接收:

package com.nps.base.xue.xd.groovyEngine

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.nps.common.service.NpsApplicationContextHolder
import com.nps.data_api.service.impl.NpsDataApiService import java.lang.reflect.Type /*
* @author XueWeiWei
* @date 2019/8/9 17:24
*/
class TrainMarshallingUpdateByGKEYGroovy {
private NpsDataApiService npsDataApiService = NpsApplicationContextHolder.getApplicationContext().getBean("npsDataApiService") // public List<Object> execute(Map<Object,Object> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// npsDataApiService.exec(param,"train_marshalling_update_by_gkey")
//
// resultMap.put("resultCode","success")
//
// result.add(resultMap)
// return result
// } // public List<Object> execute(List<Map<Object,Object>> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// for (int i = 0; i < param.size(); i++) {
// npsDataApiService.exec(param[i],"train_marshalling_update_by_gkey")
// }
//
// resultMap.put("result","success")
// resultMap.put("resultCode","2")
//
// result.add(resultMap)
// return result
// } public List<Object> execute(Map<Object,Object> param){
List<Object> result = new ArrayList<>() Map queryMap = new HashMap()
Map resultMap = new HashMap() //获取数组GKEY
String GKEYList = param.get("GKEY") //获取不为空的需要更新的字段
(param.get("PREARRIVAL_LIST_FK_GKEY1") != null) ? queryMap.put("PREARRIVAL_LIST_FK_GKEY1",param.get("PREARRIVAL_LIST_FK_GKEY1")) : 1 == 1;
(param.get("PRE_TRAIN_NUMBER") != null) ? queryMap.put("PRE_TRAIN_NUMBER",param.get("PRE_TRAIN_NUMBER")) : 1 == 1;
(param.get("TRAIN_NUM") != null) ? queryMap.put("TRAIN_NUM",param.get("TRAIN_NUM")) : 1 == 1; List<Map<Object,Object>> marshallingGKEYList
Gson gson = new Gson()
Type type = new TypeToken<List<Map>>(){}.getType()
marshallingGKEYList = gson.fromJson(GKEYList,type) //更新
for (int i = 0; i < marshallingGKEYList.size(); i++) {
Map marshallingMap;
marshallingMap = (Map)marshallingGKEYList.get(i)
queryMap.put("GKEY",marshallingMap.get("GKEY"))
npsDataApiService.exec(queryMap,"train_marshalling_update_by_gkey")
} queryMap.clear()
resultMap.put("result","success")
resultMap.put("resultCode","2") result.add(resultMap) return result
}
}

  

方法二:

postman传参方式:

java接收:

package com.nps.base.xue.xd.groovyEngine

import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.nps.common.service.NpsApplicationContextHolder
import com.nps.data_api.service.impl.NpsDataApiService import java.lang.reflect.Type /*
* @author XueWeiWei
* @date 2019/8/9 17:24
*/
class TrainMarshallingUpdateByGKEYGroovy {
private NpsDataApiService npsDataApiService = NpsApplicationContextHolder.getApplicationContext().getBean("npsDataApiService") // public List<Object> execute(Map<Object,Object> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// npsDataApiService.exec(param,"train_marshalling_update_by_gkey")
//
// resultMap.put("resultCode","success")
//
// result.add(resultMap)
// return result
// } // public List<Object> execute(List<Map<Object,Object>> param){
// List<Object> result = new ArrayList<>()
//
// Map resultMap = new HashMap()
//
// for (int i = 0; i < param.size(); i++) {
// npsDataApiService.exec(param[i],"train_marshalling_update_by_gkey")
// }
//
// resultMap.put("result","success")
// resultMap.put("resultCode","2")
//
// result.add(resultMap)
// return result
// } public List<Object> execute(Map<Object,Object> param){
List<Object> result = new ArrayList<>() Map queryMap = new HashMap()
Map resultMap = new HashMap() //获取数组GKEY
String GKEYList = param.get("GKEY") //获取不为空的需要更新的字段
(param.get("PREARRIVAL_LIST_FK_GKEY1") != null) ? queryMap.put("PREARRIVAL_LIST_FK_GKEY1",param.get("PREARRIVAL_LIST_FK_GKEY1")) : 1 == 1;
(param.get("PRE_TRAIN_NUMBER") != null) ? queryMap.put("PRE_TRAIN_NUMBER",param.get("PRE_TRAIN_NUMBER")) : 1 == 1;
(param.get("TRAIN_NUM") != null) ? queryMap.put("TRAIN_NUM",param.get("TRAIN_NUM")) : 1 == 1; List<Object> marshallingGKEYList
Gson gson = new Gson()
Type type = new TypeToken<List<Object>>(){}.getType()
marshallingGKEYList = gson.fromJson(GKEYList,type) //更新
for (int i = 0; i < marshallingGKEYList.size(); i++) {
queryMap.put("GKEY",marshallingGKEYList.get(i))
npsDataApiService.exec(queryMap,"train_marshalling_update_by_gkey")
} queryMap.clear()
resultMap.put("result","success")
resultMap.put("resultCode","2") result.add(resultMap) return result
}
}

  

postman中如何传数组的更多相关文章

  1. postman 中get传参数

    mybatis中: @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET, produces = & ...

  2. SSM中前台传数组。后台接受的问题

    当时写得时候,忘记考虑json的jar,做个记录. 第一步:先带入jar <dependency> <groupId>com.fasterxml.jackson.core< ...

  3. 在MyBatis中,前台传数组批量传id处理数据方式

    <update id = "dishBatchSaleOrDown"> <if test="ids != null"> <if t ...

  4. 如何使用postman传数组数据

    如何使用postman传数组数据 在我们做api接口数据调试的时候,大部分是会用到postman的,一般请求数据的参数都是字符串,但是特殊情况下我们是需要传一个数组数据的,那么为了实现这种需求,究竟该 ...

  5. Postman系列三:Postman中post接口实战(上传文件、json请求)

    一:接口测试过程中GET请求与POST请求的主要区别 从开发角度我们看get与post的主要区别是:1.Get是用来从服务器上获得数据,而Post是用来向服务器上传递数据:2.Get安全性比Post低 ...

  6. 『政善治』Postman工具 — 8、Postman中Pre-request Script的使用

    目录 1.Pre-request Script介绍 2.常用SNIPPETS(片段)说明 (1)获取变量脚本: (2)设置变量脚本: (3)清空变量脚本: (4)Send a request代码片段 ...

  7. JavaScript中常见的数组操作函数及用法

    JavaScript中常见的数组操作函数及用法 昨天写了个帖子,汇总了下常见的JavaScript中的字符串操作函数及用法.今天正好有时间,也去把JavaScript中常见的数组操作函数及用法总结一下 ...

  8. Asp.net中后台C#数组与前台Javascript数组交互

    摘自:http://blog.csdn.net/a6225301/article/details/20003305 在上一篇<asp.net中javascript与后台c#交互>中实现了前 ...

  9. C语言中的指针数组

    C语言中的指针数组是什么,像 char *a[]={"ddd","dsidd","lll"}; 这里讲一下注意如果我们使用了a也就是首元素的 ...

随机推荐

  1. python实现语音录入识别

    一.介绍 1.第一步录音存入本地 2.调用百度语音识别sdk 注意点:百度语音识别对声音源有要求,比特率必须是256kbps 二.代码 #安装必要库 pip install baidu-aip #百度 ...

  2. PC 端响应式布局

    前言:PC端 电脑显示器的尺寸种类还是很多的,台式电脑和笔记本电脑尺寸相差就更明显,所以响应式布局还是很重要的,甚至是必须要考虑的. 响应式的页面好不好,在后管平台上很明显.因为后管平台,一般是全屏显 ...

  3. P1523 旅行商简化版

    P1523 旅行商简化版 题目背景 欧几里德旅行商(Euclidean Traveling Salesman)问题也就是货郎担问题一直是困扰全世界数学家.计算机学家的著名问题.现有的算法都没有办法在确 ...

  4. opencv打开摄像头并新建窗口显示

    几个程序使用的基本函数如下: ******************************************************************* cvCreateCameraCap ...

  5. 11、testng.xml文件解析

    我们可以从以下几种方式调用testng 用testng.xml ant 命令行 我们本次重点介绍testng.xml,testng.xml 文件来配置测试用例的执行 ,testng.xml 文件可以很 ...

  6. 机器学习技法笔记:02 Dual Support Vector Machine、KKT

    原文地址:https://www.jianshu.com/p/58259cdde0e1 Roadmap Motivation of Dual SVM Lagrange Dual SVM Solving ...

  7. Java缓冲区读写

    缓冲区读 有两种方法从缓冲区读取数据: 绝对位置 相对位置 使用四个版本重载的get()方法用于从缓冲区读取数据. get(int index)返回给定索引处的数据. get()从缓冲区中的当前位置返 ...

  8. swiper在微信端滑动效果不友好(滑动不了)的解决方案

    如需转载请注明出处.好用就点赞吧 前提:我做的事竖直方向的一份报告,上下翻页滑动. 猜测原因: 1.检查自己的slide里面内容的样式的的高度,就是两个页面的高度不一致,测试的时候wrapper会取连 ...

  9. Java性能调优攻略全分享,5步搞定!(附超全技能图谱)

    对于很多研发人员来说,Java 性能调优都是很头疼的问题,为什么这么说?如今,一个简单的系统就囊括了应用程序.数据库.容器.操作系统.网络等技术,线上一旦出现性能问题,就可能要你协调多方面组件去进行优 ...

  10. Couleur(启发式 + 主席树)(终于补坑了)

    ZOJ Problem Set - 4053 Couleur Time Limit: 6 Seconds      Memory Limit: 131072 KB DreamGrid has an a ...