代码:
public static void main(String[] args) {
// String theData = crmScene.getData();
String theData = "[{\"type\":1,\"values\":[\"审批中\",\"未交付\"],\"name\":\"status\"}]";
System.out.println(theData+"theDatatheData*******");
// String theNewData = crmScene.getData();
String theNewData = "[{\"type\":1,\"values\":[\"审批中\",\"未交付\"],\"name\":\"status\"}]";
Object theObject = JSON.parse(theData);
List<Object> list = (List<Object>) theObject;
//获取object中name的值:
Object objectValue = list.get(0);
Map entity = (Map)objectValue;
//获取object中name的值:
String name = entity.get("name").toString();
//替换交付管理中,状态的值
if(name.equals("status")){
theNewData = theNewData.replace("已导入","0");
theNewData = theNewData.replace("审批中","1");
theNewData = theNewData.replace("审批通过","2");
theNewData = theNewData.replace("审批拒绝","3");
theNewData = theNewData.replace("审批撤回","4");
theNewData = theNewData.replace("审批删除","5");
theNewData = theNewData.replace("未交付","6");
theNewData = theNewData.replace("已交付","7");
theNewData = theNewData.replace("部分交付","8");
theNewData = theNewData.replace("未邮寄","9");
theNewData = theNewData.replace("已邮寄","10");
theNewData = theNewData.replace("部分邮寄","11");
theNewData = theNewData.replace("已完结","12");
}
System.out.println(theNewData+"theNewData------------");
// crmScene.setData(theNewData);
JSON.parse(theNewData);
}
运行结果: