修改使用fastjson包,修复部分bug,优化代码
This commit is contained in:
parent
c1f2a06150
commit
da04f124cf
20
pom.xml
20
pom.xml
|
@ -73,15 +73,9 @@
|
|||
<artifactId>c3p0</artifactId>
|
||||
<version>0.9.1.2</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>commons-attributes</groupId>
|
||||
<artifactId>commons-attributes-api</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-attributes</groupId>
|
||||
<artifactId>commons-attributes-compiler</artifactId>
|
||||
<version>2.2</version>
|
||||
<!-- <dependency> <groupId>commons-attributes</groupId> <artifactId>commons-attributes-api</artifactId>
|
||||
<version>2.2</version> </dependency> <dependency> <groupId>commons-attributes</groupId>
|
||||
<artifactId>commons-attributes-compiler</artifactId> <version>2.2</version>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
|
@ -199,12 +193,10 @@
|
|||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.47</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jstl</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
|
|
|
@ -24,6 +24,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.Accident;
|
||||
|
@ -33,8 +36,7 @@ import luckyweb.seagull.spring.service.AccidentService;
|
|||
import luckyweb.seagull.spring.service.OperationLogService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -127,7 +129,7 @@ public class AccidentController {
|
|||
List<Accident> acclist = accidentservice.findByPage(accident, offset, limit);
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(acclist);
|
||||
JSONArray recordJson = StrLib.listToJson(acclist);
|
||||
// 得到总记录数
|
||||
int total = accidentservice.findRows(accident);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -375,8 +377,8 @@ public class AccidentController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
String status="fail";
|
||||
String ms="删除故障记录失败!";
|
||||
int suc=0;
|
||||
|
@ -528,7 +530,7 @@ public class AccidentController {
|
|||
}
|
||||
|
||||
|
||||
JSONArray jsondata = JSONArray.fromObject(data);
|
||||
JSONArray jsondata = (JSONArray)JSONArray.toJSON(data);
|
||||
|
||||
req.setAttribute("gdata", jsondata.toString());
|
||||
model.addAttribute("title1", title1);
|
||||
|
|
|
@ -9,11 +9,11 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
||||
import luckyweb.seagull.spring.entity.TestCasedetail;
|
||||
import luckyweb.seagull.spring.service.TestTastExcuteService;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。
|
||||
|
@ -72,14 +72,14 @@ public class AutoTestChartController {
|
|||
createtime[i] = taskinfo.get(i)[7].toString();
|
||||
}
|
||||
|
||||
JSONArray jsontaskid=JSONArray.fromObject(taskid);
|
||||
JSONArray jsonjobname=JSONArray.fromObject(jobname);
|
||||
JSONArray jsoncasetotal=JSONArray.fromObject(casetotal);
|
||||
JSONArray jsoncasesuc=JSONArray.fromObject(casesuc);
|
||||
JSONArray jsoncasefail=JSONArray.fromObject(casefail);
|
||||
JSONArray jsoncaselock=JSONArray.fromObject(caselock);
|
||||
JSONArray jsoncasenoex=JSONArray.fromObject(casenoex);
|
||||
JSONArray jsoncreatetime=JSONArray.fromObject(createtime);
|
||||
JSONArray jsontaskid=(JSONArray)JSONArray.toJSON(taskid);
|
||||
JSONArray jsonjobname=(JSONArray)JSONArray.toJSON(jobname);
|
||||
JSONArray jsoncasetotal=(JSONArray)JSONArray.toJSON(casetotal);
|
||||
JSONArray jsoncasesuc=(JSONArray)JSONArray.toJSON(casesuc);
|
||||
JSONArray jsoncasefail=(JSONArray)JSONArray.toJSON(casefail);
|
||||
JSONArray jsoncaselock=(JSONArray)JSONArray.toJSON(caselock);
|
||||
JSONArray jsoncasenoex=(JSONArray)JSONArray.toJSON(casenoex);
|
||||
JSONArray jsoncreatetime=(JSONArray)JSONArray.toJSON(createtime);
|
||||
|
||||
req.setAttribute("taskid", jsontaskid);
|
||||
req.setAttribute("jobname", jsonjobname);
|
||||
|
|
|
@ -16,6 +16,10 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.quartz.QuartzJob;
|
||||
import luckyweb.seagull.spring.entity.SectorProjects;
|
||||
|
@ -27,8 +31,6 @@ import luckyweb.seagull.spring.service.SectorProjectsService;
|
|||
import luckyweb.seagull.spring.service.TestTastExcuteService;
|
||||
import luckyweb.seagull.util.DateLib;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -146,7 +148,7 @@ public class CasedetailController
|
|||
|
||||
List<TestCasedetail> caselist = casedetailService.findByPage(caseDetail, offset, limit);
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(caselist);
|
||||
JSONArray recordJson = StrLib.listToJson(caselist);
|
||||
// 得到总记录数
|
||||
int total = casedetailService.findRows(caseDetail);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -189,8 +191,8 @@ public class CasedetailController
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("caseids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("caseids"));
|
||||
String status="success";
|
||||
String ms="执行任务成功!";
|
||||
|
||||
|
@ -272,7 +274,7 @@ public class CasedetailController
|
|||
String endDate = req.getParameter("endDate");
|
||||
String projid = req.getParameter("projid");
|
||||
List<Object[]> tasks = tastExcuteService.findTastList(startDate, projid, endDate);
|
||||
JSONArray array = JSONArray.fromObject(tasks);
|
||||
JSONArray array = JSONArray.parseArray(JSON.toJSONString(tasks));
|
||||
pw.write(array.toString());
|
||||
}
|
||||
catch (IOException e)
|
||||
|
|
|
@ -25,6 +25,10 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.Barchart4;
|
||||
|
@ -36,8 +40,6 @@ import luckyweb.seagull.spring.service.OperationLogService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -158,14 +160,13 @@ public class FlowCheckController {
|
|||
|
||||
jsonArr.add(jsonobj);
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = jsonArr.toString();
|
||||
|
||||
// 得到总记录数
|
||||
int total = flowcheckservice.findRows(flowcheck);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("total", total);
|
||||
json.put("rows", recordJson);
|
||||
json.put("rows", jsonArr);
|
||||
pw.print(json.toString());
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,7 @@ public class FlowCheckController {
|
|||
fclist.set(i, fc);
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(fclist);
|
||||
JSONArray recordJson = StrLib.listToJson(fclist);
|
||||
// 得到总记录数
|
||||
int total = flowcheckservice.findRowsTable(flowcheck);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -715,8 +716,8 @@ public class FlowCheckController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除流程检查信息失败!";
|
||||
|
@ -849,7 +850,7 @@ public class FlowCheckController {
|
|||
}
|
||||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(list);
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -962,9 +963,9 @@ public class FlowCheckController {
|
|||
title = "当前选择日期段内无数据";
|
||||
}
|
||||
|
||||
JSONArray jsondata=JSONArray.fromObject(data);
|
||||
JSONArray jsonprojectname=JSONArray.fromObject(projectname);
|
||||
JSONArray jsoncolumnname=JSONArray.fromObject(columnname);
|
||||
JSONArray jsondata=(JSONArray) JSONArray.toJSON(data);
|
||||
JSONArray jsonprojectname=(JSONArray) JSONArray.toJSON(projectname);
|
||||
JSONArray jsoncolumnname=(JSONArray) JSONArray.toJSON(columnname);
|
||||
|
||||
req.setAttribute("gdata", jsondata.toString());
|
||||
req.setAttribute("labels", jsonprojectname.toString());
|
||||
|
|
|
@ -22,6 +22,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
import luckyweb.seagull.spring.entity.ProjectCasesteps;
|
||||
|
@ -36,8 +39,6 @@ import luckyweb.seagull.spring.service.TestJobsService;
|
|||
import luckyweb.seagull.spring.service.TestTastExcuteService;
|
||||
import luckyweb.seagull.util.DateLib;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import rmi.service.RunService;
|
||||
|
||||
/**
|
||||
|
@ -91,7 +92,7 @@ public class LogdetailController
|
|||
loglist.set(i, log);
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(loglist);
|
||||
JSONArray recordJson = StrLib.listToJson(loglist);
|
||||
pw.print(recordJson);
|
||||
}
|
||||
|
||||
|
@ -196,7 +197,7 @@ public class LogdetailController
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
String logid = jsonObject.getString("logid");
|
||||
String status="fail";
|
||||
String ms="更新用例预期结果失败!";
|
||||
|
@ -299,10 +300,10 @@ public class LogdetailController
|
|||
|
||||
rsp.setContentType("application/json");
|
||||
rsp.setCharacterEncoding("utf-8");
|
||||
JSONArray taskArray = JSONArray.fromObject(taskdata);
|
||||
JSONArray caseArray = JSONArray.fromObject(casedata);
|
||||
JSONArray logArray = JSONArray.fromObject(logdata);
|
||||
JSONArray caseaddArray = JSONArray.fromObject(caseadddata);
|
||||
JSONArray taskArray = (JSONArray) JSONArray.toJSON(taskdata);
|
||||
JSONArray caseArray = (JSONArray) JSONArray.toJSON(casedata);
|
||||
JSONArray logArray = (JSONArray) JSONArray.toJSON(logdata);
|
||||
JSONArray caseaddArray = (JSONArray) JSONArray.toJSON(caseadddata);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("taskdata", taskArray);
|
||||
jsobjcet.put("casedata", caseArray);
|
||||
|
@ -356,12 +357,12 @@ public class LogdetailController
|
|||
createdate[i] = taskreport.get(i)[5].toString();
|
||||
}
|
||||
|
||||
JSONArray jsoncasetotal=JSONArray.fromObject(casetotal);
|
||||
JSONArray jsoncasesuc=JSONArray.fromObject(casesuc);
|
||||
JSONArray jsoncasefail=JSONArray.fromObject(casefail);
|
||||
JSONArray jsoncaselock=JSONArray.fromObject(caselock);
|
||||
JSONArray jsoncasenoex=JSONArray.fromObject(casenoex);
|
||||
JSONArray jsoncreatedate=JSONArray.fromObject(createdate);
|
||||
JSONArray jsoncasetotal=(JSONArray) JSONArray.toJSON(casetotal);
|
||||
JSONArray jsoncasesuc=(JSONArray) JSONArray.toJSON(casesuc);
|
||||
JSONArray jsoncasefail=(JSONArray) JSONArray.toJSON(casefail);
|
||||
JSONArray jsoncaselock=(JSONArray) JSONArray.toJSON(caselock);
|
||||
JSONArray jsoncasenoex=(JSONArray) JSONArray.toJSON(casenoex);
|
||||
JSONArray jsoncreatedate=(JSONArray) JSONArray.toJSON(createdate);
|
||||
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("casetotal", jsoncasetotal);
|
||||
|
|
|
@ -13,14 +13,15 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.spring.entity.OperationLog;
|
||||
import luckyweb.seagull.spring.entity.SectorProjects;
|
||||
import luckyweb.seagull.spring.service.OperationLogService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.DateLib;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -113,7 +114,7 @@ public class OperationLogController {
|
|||
|
||||
List<OperationLog> loglist = operationlogservice.findByPage(oplog, offset, limit);
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(loglist);
|
||||
JSONArray recordJson = StrLib.listToJson(loglist);
|
||||
// 得到总记录数
|
||||
int total = operationlogservice.findRows(oplog);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -161,8 +162,8 @@ public class OperationLogController {
|
|||
|
||||
}
|
||||
|
||||
JSONArray jsonname=JSONArray.fromObject(name);
|
||||
JSONArray jsonintegral=JSONArray.fromObject(integral);
|
||||
JSONArray jsonname=(JSONArray) JSONArray.toJSON(name);
|
||||
JSONArray jsonintegral=(JSONArray) JSONArray.toJSON(integral);
|
||||
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("name", jsonname);
|
||||
|
|
|
@ -18,6 +18,10 @@ import org.springframework.validation.FieldError;
|
|||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.FlowCheck;
|
||||
|
@ -29,8 +33,6 @@ import luckyweb.seagull.spring.service.FlowInfoService;
|
|||
import luckyweb.seagull.spring.service.OperationLogService;
|
||||
import luckyweb.seagull.spring.service.PlanFlowCheckService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -109,7 +111,7 @@ public class PlanFlowCheckController {
|
|||
pfclist.get(i).setCheckphase(fi.getPhasename());
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(pfclist);
|
||||
JSONArray recordJson = StrLib.listToJson(pfclist);
|
||||
// 得到总记录数
|
||||
int total = planflowcheckservice.findRows(pfcheck);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -412,8 +414,8 @@ public class PlanFlowCheckController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
String status="fail";
|
||||
String ms="删除检查计划失败!";
|
||||
int suc=0;
|
||||
|
@ -640,7 +642,7 @@ public class PlanFlowCheckController {
|
|||
}
|
||||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(list);
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
|
@ -35,8 +38,6 @@ import luckyweb.seagull.spring.service.ProjectPlanCaseService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -167,7 +168,7 @@ public class ProjectCaseController {
|
|||
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectcases);
|
||||
JSONArray recordJson = StrLib.listToJson(projectcases);
|
||||
// 得到总记录数
|
||||
int total = projectcaseservice.findRows(projectcase);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -336,8 +337,8 @@ public class ProjectCaseController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("caseids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("caseids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除用例失败!";
|
||||
|
@ -402,7 +403,7 @@ public class ProjectCaseController {
|
|||
String sign = req.getParameter("sign");
|
||||
|
||||
ProjectCase pc = projectcaseservice.getCaseBySign(sign);
|
||||
String jsonStr = JSONObject.fromObject(pc).toString();
|
||||
String jsonStr = JSONObject.toJSONString(pc);
|
||||
pw.print(jsonStr);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
@ -445,7 +446,7 @@ public class ProjectCaseController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
String ms="保存用例集失败!";
|
||||
String status="fail";
|
||||
int projectid = Integer.valueOf(jsonObject.getString("projectid"));
|
||||
|
@ -526,7 +527,7 @@ public class ProjectCaseController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
|
||||
int id = Integer.valueOf(jsonObject.getString("id"));
|
||||
ProjectModule projectmodule = moduleservice.load(id);
|
||||
|
@ -601,7 +602,7 @@ public class ProjectCaseController {
|
|||
modulejson.setName(projectmodule.getModulename());
|
||||
boolean isParent = moduleservice.getModuleIsParent(projectmodule.getId());
|
||||
modulejson.setisParent(isParent);
|
||||
jsonarr.add(JSONObject.fromObject(modulejson));
|
||||
jsonarr.add(JSONObject.toJSONString(modulejson));
|
||||
}
|
||||
} else {
|
||||
List<SectorProjects> prolist = QueueListener.qa_projlist;
|
||||
|
@ -617,7 +618,7 @@ public class ProjectCaseController {
|
|||
modulejson.setisParent(false);
|
||||
}
|
||||
|
||||
jsonarr.add(JSONObject.fromObject(modulejson));
|
||||
jsonarr.add(JSONObject.toJSONString(modulejson));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ import org.springframework.validation.BindingResult;
|
|||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
import luckyweb.seagull.spring.entity.ProjectCasesteps;
|
||||
|
@ -35,9 +39,6 @@ import luckyweb.seagull.spring.service.TempCasestepDebugService;
|
|||
import luckyweb.seagull.spring.service.TestClientService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
import rmi.service.RunService;
|
||||
|
||||
/**
|
||||
|
@ -192,9 +193,7 @@ public class ProjectCasestepsController {
|
|||
jsonstr = jsonstr.replace("\\\"", "\"");
|
||||
jsonstr = jsonstr.replace("undefined", "0");
|
||||
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonstr);
|
||||
// 参数1为要转换的JSONArray数据,参数2为要转换的目标数据,即List盛装的数据
|
||||
List<?> list = JSONArray.toList(jsonarr, new ProjectCasesteps(), new JsonConfig());
|
||||
List<ProjectCasesteps> list = JSON.parseArray(jsonstr, ProjectCasesteps.class);
|
||||
String usercode = "";
|
||||
if (null != request.getSession().getAttribute(PublicConst.SESSIONKEYUSERCODE)
|
||||
&& null != request.getSession().getAttribute(PublicConst.SESSIONKEYUSERNAME)) {
|
||||
|
@ -205,19 +204,19 @@ public class ProjectCasestepsController {
|
|||
String time = formatter.format(currentTime);
|
||||
ProjectCase projectcase = new ProjectCase();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ProjectCasesteps step = (ProjectCasesteps) list.get(i);
|
||||
ProjectCasesteps step = list.get(i);
|
||||
if (i == 0) {
|
||||
casestepsservice.delforcaseid(step.getCaseid());
|
||||
projectcase = projectcaseservice.load(step.getCaseid());
|
||||
}
|
||||
step.setOperationer(usercode);
|
||||
step.setTime(time);
|
||||
step.setOperation(step.getOperation().replaceAll(""", "\""));
|
||||
step.setPath(step.getPath().replaceAll(""", "\""));
|
||||
step.setParameters(step.getParameters().replaceAll(""", "\""));
|
||||
step.setAction(step.getAction().replaceAll(""", "\""));
|
||||
step.setExpectedresult(step.getExpectedresult().replaceAll(""", "\""));
|
||||
step.setRemark(step.getRemark().replaceAll(""", "\""));
|
||||
step.setOperation(step.getOperation().replace(""", "\""));
|
||||
step.setPath(step.getPath().replace(""", "\""));
|
||||
step.setParameters(step.getParameters().replace(""", "\""));
|
||||
step.setAction(step.getAction().replace(""", "\""));
|
||||
step.setExpectedresult(step.getExpectedresult().replace(""", "\""));
|
||||
step.setRemark(step.getRemark().replace(""", "\""));
|
||||
casestepsservice.add(step);
|
||||
|
||||
projectcase.setOperationer(usercode);
|
||||
|
@ -256,7 +255,7 @@ public class ProjectCasestepsController {
|
|||
e.printStackTrace();
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(casesteps);
|
||||
JSONArray recordJson = StrLib.listToJson(casesteps);
|
||||
pw.print(recordJson);
|
||||
}
|
||||
|
||||
|
@ -429,7 +428,7 @@ public class ProjectCasestepsController {
|
|||
List<ProjectCasesteps> steps = casestepsservice.getSteps(Integer.valueOf(caseid));
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(steps);
|
||||
JSONArray recordJson = StrLib.listToJson(steps);
|
||||
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
json.put("steps", recordJson);
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
import luckyweb.seagull.spring.entity.ProjectModule;
|
||||
|
@ -30,8 +33,6 @@ import luckyweb.seagull.spring.service.ProjectPlanService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -213,7 +214,7 @@ public class ProjectPlanCaseController {
|
|||
|
||||
viewToSaveCase = projectcases;
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectcases);
|
||||
JSONArray recordJson = StrLib.listToJson(projectcases);
|
||||
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
JSONObject json = new JSONObject();
|
||||
|
@ -259,8 +260,8 @@ public class ProjectPlanCaseController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("caseids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("caseids"));
|
||||
List<ProjectCase> caselist=viewToSaveCase;
|
||||
// 添加列表中多的用例
|
||||
for (int i = 0; i < jsonarr.size(); i++) {
|
||||
|
@ -379,7 +380,7 @@ public class ProjectPlanCaseController {
|
|||
}
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectcases);
|
||||
JSONArray recordJson = StrLib.listToJson(projectcases);
|
||||
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
json.put("cases", recordJson);
|
||||
|
@ -411,7 +412,7 @@ public class ProjectPlanCaseController {
|
|||
}
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectcases);
|
||||
JSONArray recordJson = StrLib.listToJson(projectcases);
|
||||
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
json.put("cases", recordJson);
|
||||
|
|
|
@ -17,21 +17,21 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
import luckyweb.seagull.spring.entity.ProjectPlan;
|
||||
import luckyweb.seagull.spring.entity.SectorProjects;
|
||||
import luckyweb.seagull.spring.entity.UserInfo;
|
||||
import luckyweb.seagull.spring.service.OperationLogService;
|
||||
import luckyweb.seagull.spring.service.ProjectCaseService;
|
||||
import luckyweb.seagull.spring.service.ProjectPlanCaseService;
|
||||
import luckyweb.seagull.spring.service.ProjectPlanService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -133,7 +133,7 @@ public class ProjectPlanController {
|
|||
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectplans);
|
||||
JSONArray recordJson = StrLib.listToJson(projectplans);
|
||||
// 得到总记录数
|
||||
int total = projectplanservice.findRows(projectplan);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -279,8 +279,8 @@ public class ProjectPlanController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("planids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("planids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除计划失败!";
|
||||
|
@ -342,7 +342,7 @@ public class ProjectPlanController {
|
|||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
|
||||
JSONArray jsonArray = JSONArray.fromObject(listplan);
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(listplan));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
import luckyweb.seagull.spring.entity.ProjectCasesteps;
|
||||
import luckyweb.seagull.spring.entity.ProjectPlan;
|
||||
import luckyweb.seagull.spring.entity.ProjectProtocolTemplate;
|
||||
import luckyweb.seagull.spring.entity.ProjectTemplateParams;
|
||||
import luckyweb.seagull.spring.entity.SectorProjects;
|
||||
|
@ -32,8 +32,6 @@ import luckyweb.seagull.spring.service.ProjectTemplateParamsService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -137,7 +135,7 @@ public class ProjectProtocolTemplateController {
|
|||
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(ptlist);
|
||||
JSONArray recordJson = StrLib.listToJson(ptlist);
|
||||
// 得到总记录数
|
||||
int total = ptemplateservice.findRows(ppt);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -301,8 +299,8 @@ public class ProjectProtocolTemplateController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("templateids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("templateids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除协议模板失败!";
|
||||
|
@ -371,7 +369,7 @@ public class ProjectProtocolTemplateController {
|
|||
String recordJson = jsonarr.toString();
|
||||
String str = "{\"message\": \"\",\"value\": "+recordJson+",\"code\": 200,\"redirect\": \"\" }";
|
||||
|
||||
json = JSONObject.fromObject(str);
|
||||
json = JSONObject.parseObject(str);
|
||||
pw.print(json.toString());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
@ -410,7 +408,7 @@ public class ProjectProtocolTemplateController {
|
|||
String recordJson = jsonarr.toString();
|
||||
String str = "{\"message\": \"\",\"value\": "+recordJson+",\"code\": 200,\"redirect\": \"\" }";
|
||||
|
||||
json = JSONObject.fromObject(str);
|
||||
json = JSONObject.parseObject(str);
|
||||
pw.print(json.toString());
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
@ -428,7 +426,7 @@ public class ProjectProtocolTemplateController {
|
|||
String templateid = req.getParameter("templateid");
|
||||
|
||||
ProjectProtocolTemplate ppt = ptemplateservice.load(Integer.valueOf(templateid));
|
||||
String jsonStr = JSONObject.fromObject(ppt).toString();
|
||||
String jsonStr = JSONObject.toJSONString(ppt);
|
||||
pw.print(jsonStr);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
|
|
@ -15,6 +15,10 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.ProjectProtocolTemplate;
|
||||
|
@ -26,9 +30,6 @@ import luckyweb.seagull.spring.service.ProjectTemplateParamsService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -112,7 +113,7 @@ public class ProjectTemplateParamsController {
|
|||
}else{
|
||||
for(int i=0;i<paramslist.size();i++){
|
||||
ProjectTemplateParams ptp = paramslist.get(i);
|
||||
ptp.setParam(ptp.getParam().replaceAll("\"", """));
|
||||
ptp.setParam(ptp.getParam().replace("\"", """));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,26 +161,12 @@ public class ProjectTemplateParamsController {
|
|||
}
|
||||
String jsonstr = sb.toString().substring(1, sb.toString().length() - 1);
|
||||
jsonstr = jsonstr.replace("\\\"", "\"");
|
||||
jsonstr = jsonstr.replaceAll(""", "\\\\\"");
|
||||
jsonstr = jsonstr.replace(""", "\"");
|
||||
jsonstr = jsonstr.replace("undefined", "0");
|
||||
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonstr);
|
||||
|
||||
//处理json-lib 2.4版本当遇到json格式字符串时,把它当成对象处理的bug
|
||||
for(int i=0;i<jsonarr.size();i++){
|
||||
JSONObject tempobj=(JSONObject) jsonarr.get(i);
|
||||
String str=tempobj.get("param").toString();
|
||||
if(str.length()>0&&str.startsWith("[")&&str.endsWith("]")){
|
||||
tempobj.element("param", str+" ");
|
||||
jsonarr.set(i, tempobj);
|
||||
}
|
||||
if (str.length() > 0 && str.startsWith("{") && str.endsWith("}")) {
|
||||
tempobj.element("param", str + " ");
|
||||
jsonarr.set(i, tempobj);
|
||||
}
|
||||
}
|
||||
// 参数1为要转换的JSONArray数据,参数2为要转换的目标数据,即List盛装的数据
|
||||
List<?> list = JSONArray.toList(jsonarr, new ProjectTemplateParams(), new JsonConfig());
|
||||
//List<?> list = JSONArray.toList(jsonarr, new ProjectTemplateParams(), new JsonConfig());
|
||||
List<ProjectTemplateParams> list = JSON.parseArray(jsonstr, ProjectTemplateParams.class);
|
||||
String usercode = "";
|
||||
if (null != request.getSession().getAttribute(PublicConst.SESSIONKEYUSERCODE)
|
||||
&& null != request.getSession().getAttribute(PublicConst.SESSIONKEYUSERNAME)) {
|
||||
|
@ -189,7 +176,7 @@ public class ProjectTemplateParamsController {
|
|||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = formatter.format(currentTime);
|
||||
|
||||
ProjectTemplateParams oldtempparam = (ProjectTemplateParams) list.get(0);
|
||||
ProjectTemplateParams oldtempparam = list.get(0);
|
||||
ProjectProtocolTemplate ppt = ptemplateservice.load(oldtempparam.getTemplateid());
|
||||
List<ProjectTemplateParams> paramslist =ptemplateparamsService.getParamsList(oldtempparam.getTemplateid());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
@ -203,8 +190,8 @@ public class ProjectTemplateParamsController {
|
|||
for (ProjectTemplateParams oldparam:paramslist) {
|
||||
if(param.getId()==oldparam.getId()&&oldparam.getId()!=0){
|
||||
tag=1;
|
||||
param.setParam(param.getParam().replaceAll(""", "\""));
|
||||
param.setParamname(param.getParamname().replaceAll(""", "\""));
|
||||
param.setParam(param.getParam().replace(""", "\""));
|
||||
param.setParamname(param.getParamname().replace(""", "\""));
|
||||
ptemplateparamsService.modify(param);
|
||||
paramslist.remove(oldparam);
|
||||
break;
|
||||
|
@ -212,8 +199,8 @@ public class ProjectTemplateParamsController {
|
|||
}
|
||||
|
||||
if(tag==0){
|
||||
param.setParam(param.getParam().replaceAll(""", "\""));
|
||||
param.setParamname(param.getParamname().replaceAll(""", "\""));
|
||||
param.setParam(param.getParam().replace(""", "\""));
|
||||
param.setParamname(param.getParamname().replace(""", "\""));
|
||||
ptemplateparamsService.add(param);
|
||||
}
|
||||
}
|
||||
|
@ -245,8 +232,7 @@ public class ProjectTemplateParamsController {
|
|||
List<ProjectTemplateParams> params = ptemplateparamsService.getParamsList(Integer.valueOf(templateid));
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(params);
|
||||
recordJson = recordJson.replaceAll(""", "\\\\\"");
|
||||
JSONArray recordJson = StrLib.listToJson(params);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
json.put("params", recordJson);
|
||||
pw.print(json.toString());
|
||||
|
|
|
@ -23,6 +23,9 @@ import org.springframework.validation.FieldError;
|
|||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.Barchart3;
|
||||
|
@ -33,8 +36,6 @@ import luckyweb.seagull.spring.service.OperationLogService;
|
|||
import luckyweb.seagull.spring.service.ProjectsVersionService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -146,7 +147,7 @@ public class ProjectVersionController {
|
|||
List<ProjectVersion> projectversions = projectsversionservice.findByPage(projectversion, offset, limit);
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projectversions);
|
||||
JSONArray recordJson = StrLib.listToJson(projectversions);
|
||||
// 得到总记录数
|
||||
int total = projectsversionservice.findRows(projectversion);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -1097,9 +1098,9 @@ public class ProjectVersionController {
|
|||
title = "当前选择日期段内无数据";
|
||||
}
|
||||
|
||||
JSONArray jsondata=JSONArray.fromObject(data);
|
||||
JSONArray jsonprojectname=JSONArray.fromObject(projectname);
|
||||
JSONArray jsoncolumnname=JSONArray.fromObject(columnname);
|
||||
JSONArray jsondata= (JSONArray)JSONArray.toJSON(data);
|
||||
JSONArray jsonprojectname= (JSONArray)JSONArray.toJSON(projectname);
|
||||
JSONArray jsoncolumnname= (JSONArray)JSONArray.toJSON(columnname);
|
||||
|
||||
req.setAttribute("gdata", jsondata.toString());
|
||||
req.setAttribute("labels", jsonprojectname.toString());
|
||||
|
@ -1217,9 +1218,9 @@ public class ProjectVersionController {
|
|||
title = "当前项目无数据";
|
||||
}
|
||||
|
||||
JSONArray jsondata=JSONArray.fromObject(data);
|
||||
JSONArray jsonlaunchdate=JSONArray.fromObject(launchdate);
|
||||
JSONArray jsoncolumnname=JSONArray.fromObject(columnname);
|
||||
JSONArray jsondata= (JSONArray)JSONArray.toJSON(data);
|
||||
JSONArray jsonlaunchdate= (JSONArray)JSONArray.toJSON(launchdate);
|
||||
JSONArray jsoncolumnname= (JSONArray)JSONArray.toJSON(columnname);
|
||||
|
||||
req.setAttribute("gdata", jsondata.toString());
|
||||
req.setAttribute("launchdate", jsonlaunchdate.toString());
|
||||
|
@ -1336,9 +1337,9 @@ public class ProjectVersionController {
|
|||
title = "当前项目无数据";
|
||||
}
|
||||
|
||||
JSONArray jsondata=JSONArray.fromObject(data);
|
||||
JSONArray jsonlaunchdate=JSONArray.fromObject(launchdate);
|
||||
JSONArray jsoncolumnname=JSONArray.fromObject(columnname);
|
||||
JSONArray jsondata= (JSONArray)JSONArray.toJSON(data);
|
||||
JSONArray jsonlaunchdate= (JSONArray)JSONArray.toJSON(launchdate);
|
||||
JSONArray jsoncolumnname= (JSONArray)JSONArray.toJSON(columnname);
|
||||
|
||||
req.setAttribute("gdata", jsondata.toString());
|
||||
req.setAttribute("labels", jsonlaunchdate.toString());
|
||||
|
|
|
@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.PublicCaseParams;
|
||||
import luckyweb.seagull.spring.entity.SectorProjects;
|
||||
|
@ -24,8 +27,6 @@ import luckyweb.seagull.spring.service.PublicCaseParamsService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.UserInfoService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -118,7 +119,7 @@ public class PublicCaseParamsController {
|
|||
}
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(pcps);
|
||||
JSONArray recordJson = StrLib.listToJson(pcps);
|
||||
// 得到总记录数
|
||||
int total = pcpservice.findRows(pcp);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -237,8 +238,8 @@ public class PublicCaseParamsController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除参数失败!";
|
||||
|
@ -317,7 +318,7 @@ public class PublicCaseParamsController {
|
|||
|
||||
List<PublicCaseParams> pcplist = pcpservice.getParamListByProjectid(projectid);
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(pcplist);
|
||||
JSONArray recordJson = StrLib.listToJson(pcplist);
|
||||
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
json.put("params", recordJson);
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.validation.BindingResult;
|
|||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.Review;
|
||||
|
@ -25,8 +28,6 @@ import luckyweb.seagull.spring.service.ReviewInfoService;
|
|||
import luckyweb.seagull.spring.service.ReviewService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -119,7 +120,7 @@ public class ReviewController {
|
|||
List<Review> reviewlist = reviewservice.findByPage(review, offset, limit);
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(reviewlist);
|
||||
JSONArray recordJson = StrLib.listToJson(reviewlist);
|
||||
// 得到总记录数
|
||||
int total = reviewservice.findRows(review);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -159,8 +160,8 @@ public class ReviewController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除评审记录失败!";
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.validation.BindingResult;
|
|||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.Review;
|
||||
|
@ -26,8 +29,6 @@ import luckyweb.seagull.spring.service.ReviewInfoService;
|
|||
import luckyweb.seagull.spring.service.ReviewService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -99,7 +100,7 @@ public class ReviewInfoController {
|
|||
List<ReviewInfo> reviewlist = reviewinfoservice.findByPage(reviewinfo, offset, limit);
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(reviewlist);
|
||||
JSONArray recordJson = StrLib.listToJson(reviewlist);
|
||||
// 得到总记录数
|
||||
int total = reviewinfoservice.findRows(reviewinfo);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -277,8 +278,8 @@ public class ReviewInfoController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除评审明细信息失败!";
|
||||
|
|
|
@ -13,14 +13,15 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.SecondarySector;
|
||||
import luckyweb.seagull.spring.service.OperationLogService;
|
||||
import luckyweb.seagull.spring.service.SecondarySectorService;
|
||||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -78,7 +79,7 @@ public class SecondarySectorController {
|
|||
List<SecondarySector> sectors = secondarysectorservice.findByPage(ss, offset, limit);
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(sectors);
|
||||
JSONArray recordJson = StrLib.listToJson(sectors);
|
||||
// 得到总记录数
|
||||
int total = secondarysectorservice.findRows(ss);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -186,8 +187,8 @@ public class SecondarySectorController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("seids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("seids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除失败!";
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
|||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -14,6 +13,9 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.ProjectCase;
|
||||
|
@ -35,8 +37,6 @@ import luckyweb.seagull.spring.service.SectorProjectsService;
|
|||
import luckyweb.seagull.spring.service.TestClientService;
|
||||
import luckyweb.seagull.spring.service.TestJobsService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -137,7 +137,7 @@ public class SectorProjectsController {
|
|||
}
|
||||
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(projects);
|
||||
JSONArray recordJson = StrLib.listToJson(projects);
|
||||
// 得到总记录数
|
||||
int total = sectorprojectsservice.findRows(sectorprojects);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -273,8 +273,8 @@ public class SectorProjectsController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("proids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("proids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除项目失败!";
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.TestCasedetail;
|
||||
import luckyweb.seagull.spring.entity.TestJobs;
|
||||
|
@ -29,9 +32,6 @@ import luckyweb.seagull.spring.service.TestTastExcuteService;
|
|||
import luckyweb.seagull.util.DateLib;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
* 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。
|
||||
|
@ -136,7 +136,7 @@ public class TastExcuteController {
|
|||
}
|
||||
List<TestTaskexcute> tasklist = tastExcuteService.findByPage(task, offset, limit);
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(tasklist);
|
||||
JSONArray recordJson = StrLib.listToJson(tasklist);
|
||||
// 得到总记录数
|
||||
int total = tastExcuteService.findRows(task);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -179,8 +179,8 @@ public class TastExcuteController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("taskids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("taskids"));
|
||||
|
||||
String status="success";
|
||||
String ms="删除任务成功!";
|
||||
|
@ -276,7 +276,7 @@ public class TastExcuteController {
|
|||
}
|
||||
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(per);
|
||||
JSONArray jsonArray = (JSONArray)JSONArray.toJSON(per);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -293,7 +293,7 @@ public class TastExcuteController {
|
|||
String taskid = req.getParameter("taskid");
|
||||
|
||||
TestTaskexcute task = tastExcuteService.load(Integer.valueOf(taskid));
|
||||
String jsonStr = JSONObject.fromObject(task).toString();
|
||||
String jsonStr = JSONObject.toJSONString(task);
|
||||
pw.print(jsonStr);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
|
|
@ -14,6 +14,10 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.quartz.QuartzManager;
|
||||
|
@ -24,8 +28,6 @@ import luckyweb.seagull.spring.service.OperationLogService;
|
|||
import luckyweb.seagull.spring.service.SectorProjectsService;
|
||||
import luckyweb.seagull.spring.service.TestClientService;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -111,7 +113,7 @@ public class TestClientController {
|
|||
tct.setProjectpername(sbnames.toString());
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(tcs);
|
||||
JSONArray recordJson = StrLib.listToJson(tcs);
|
||||
// 得到总记录数
|
||||
int total = tcservice.findRows(tc);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -253,8 +255,8 @@ public class TestClientController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.fromObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.fromObject(jsonObject.getString("ids"));
|
||||
JSONObject jsonObject = JSONObject.parseObject(sb.toString());
|
||||
JSONArray jsonarr = JSONArray.parseArray(jsonObject.getString("ids"));
|
||||
|
||||
String status="fail";
|
||||
String ms="删除客户端失败!";
|
||||
|
@ -302,7 +304,7 @@ public class TestClientController {
|
|||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
|
||||
JSONArray jsonArray = JSONArray.fromObject(listc);
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(listc));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -337,7 +339,7 @@ public class TestClientController {
|
|||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
|
||||
JSONArray jsonArray = JSONArray.fromObject(pathlist);
|
||||
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(pathlist));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.quartz.QuartzJob;
|
||||
|
@ -50,7 +53,6 @@ import luckyweb.seagull.spring.service.UserInfoService;
|
|||
import luckyweb.seagull.util.DateLib;
|
||||
import luckyweb.seagull.util.DateUtil;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONObject;
|
||||
import rmi.service.RunService;
|
||||
|
||||
/**
|
||||
|
@ -182,7 +184,7 @@ public class TestJobsController
|
|||
}
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(jobs);
|
||||
JSONArray recordJson = StrLib.listToJson(jobs);
|
||||
// 得到总记录数
|
||||
int total = testJobsService.findRows(tj);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -1175,18 +1177,18 @@ public class TestJobsController
|
|||
{
|
||||
QuartzJob qj = new QuartzJob();
|
||||
String message = qj.toRunTask(tj.getPlanproj(), jobid,tj.getTaskName(),tj.getClientip(),tj.getClientpath());
|
||||
pw.write(JSONObject.fromObject("{result:\""+message+"\"}").toString());
|
||||
pw.write(JSONObject.parseObject("{result:\""+message+"\"}").toString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String message = "当前项目在服务器不存在!";
|
||||
pw.write(JSONObject.fromObject("{result:"+message+"}").toString());
|
||||
pw.write(JSONObject.parseObject("{result:"+message+"}").toString());
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
pw.write(JSONObject.fromObject("{result:"+e.getMessage()+"}").toString());
|
||||
pw.write(JSONObject.parseObject("{result:"+e.getMessage()+"}").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.comm.QueueListener;
|
||||
import luckyweb.seagull.spring.entity.SecondarySector;
|
||||
|
@ -31,8 +35,6 @@ import luckyweb.seagull.spring.service.UserInfoService;
|
|||
import luckyweb.seagull.spring.service.UserRoleService;
|
||||
import luckyweb.seagull.util.Endecrypt;
|
||||
import luckyweb.seagull.util.StrLib;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -128,7 +130,7 @@ public class UserInfoController {
|
|||
users.get(i).setPassword("");
|
||||
}
|
||||
// 转换成json字符串
|
||||
String recordJson = StrLib.listToJson(users);
|
||||
JSONArray recordJson = StrLib.listToJson(users);
|
||||
// 得到总记录数
|
||||
int total = userinfoservice.findRows(userinfo);
|
||||
// 需要返回的数据有总记录数和行数据
|
||||
|
@ -856,8 +858,8 @@ public class UserInfoController {
|
|||
|
||||
// 取集合
|
||||
rsp.setContentType("text/xml;charset=utf-8");
|
||||
JSONArray jsonArraypermi = JSONArray.fromObject(templistpermi);
|
||||
JSONArray jsonArrayoppro = JSONArray.fromObject(templistoppro);
|
||||
JSONArray jsonArraypermi = JSONArray.parseArray(JSON.toJSONString(templistpermi));
|
||||
JSONArray jsonArrayoppro = JSONArray.parseArray(JSON.toJSONString(templistoppro));
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("permi", jsonArraypermi);
|
||||
jsobjcet.put("oppro", jsonArrayoppro);
|
||||
|
|
|
@ -8,12 +8,12 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import luckyweb.seagull.comm.PublicConst;
|
||||
import luckyweb.seagull.spring.entity.UserAuthority;
|
||||
import luckyweb.seagull.spring.entity.UserInfo;
|
||||
|
@ -89,7 +89,7 @@ public class UserLoginController {
|
|||
|
||||
rsp.setContentType("application/json");
|
||||
rsp.setCharacterEncoding("utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(result);
|
||||
JSONArray jsonArray = (JSONArray)JSONArray.toJSON(result);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class UserLoginController {
|
|||
|
||||
rsp.setContentType("application/json");
|
||||
rsp.setCharacterEncoding("utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(result);
|
||||
JSONArray jsonArray = (JSONArray)JSONArray.toJSON(result);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class UserLoginController {
|
|||
|
||||
rsp.setContentType("application/json");
|
||||
rsp.setCharacterEncoding("utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(status);
|
||||
JSONArray jsonArray = (JSONArray)JSONArray.toJSON(status);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
@ -258,7 +258,7 @@ public class UserLoginController {
|
|||
|
||||
rsp.setContentType("application/json");
|
||||
rsp.setCharacterEncoding("utf-8");
|
||||
JSONArray jsonArray = JSONArray.fromObject(status);
|
||||
JSONArray jsonArray = (JSONArray)JSONArray.toJSON(status);
|
||||
JSONObject jsobjcet = new JSONObject();
|
||||
jsobjcet.put("data", jsonArray);
|
||||
|
||||
|
|
|
@ -8,11 +8,12 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -201,12 +202,34 @@ public class StrLib {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述:通过传入一个列表对象,调用指定方法将列表中的数据生成一个JSON规格指定字符串
|
||||
* @param list列表对象
|
||||
* @return java.lang.String
|
||||
*/
|
||||
public static String listToJson(List<?> list) {
|
||||
public static JSONArray listToJson(List<?> list) {
|
||||
StringBuilder jsonarr = new StringBuilder();
|
||||
jsonarr.append("[");
|
||||
//fastjson在转化list>string的过程中,如果List中的对象中还有实体对象,存在bug,所以循环转换
|
||||
for(Object obj:list){
|
||||
String jsonObject = JSON.toJSONString(obj,SerializerFeature.WriteMapNullValue,
|
||||
SerializerFeature.WriteNullListAsEmpty,SerializerFeature.WriteNullStringAsEmpty,SerializerFeature.WriteNullNumberAsZero,
|
||||
SerializerFeature.WriteNullBooleanAsFalse);
|
||||
jsonarr.append(jsonObject).append(",");
|
||||
}
|
||||
jsonarr.append("]");
|
||||
JSONArray recordJson = JSONArray.parseArray(jsonarr.toString());
|
||||
return recordJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:通过传入一个列表对象,调用指定方法将列表中的数据生成一个JSON规格指定字符串
|
||||
* @param list列表对象
|
||||
* @return java.lang.String
|
||||
* @deprecated
|
||||
*/
|
||||
public static String listToJsonOld(List<?> list) {
|
||||
StringBuilder json = new StringBuilder();
|
||||
json.append("[");
|
||||
if (list != null && list.size() > 0) {
|
||||
|
@ -224,14 +247,14 @@ public class StrLib {
|
|||
/**
|
||||
* @param object 任意对象
|
||||
* @return java.lang.String
|
||||
* @deprecated
|
||||
*/
|
||||
public static String objectToJson(Object object) {
|
||||
StringBuilder json = new StringBuilder();
|
||||
if (object == null) {
|
||||
json.append("\"\"");
|
||||
} else if (object.getClass().isArray()) {
|
||||
JSONArray jsonarray = JSONArray.fromObject(object);
|
||||
json.append("\"").append(jsonarray.toString().replace("\"", """)).append("\"");
|
||||
json.append("\"").append(JSON.toJSONString(object).replace("\"", """)).append("\"");
|
||||
} else if (object instanceof Timestamp) {
|
||||
//定义格式,不显示毫秒
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -255,6 +278,7 @@ public class StrLib {
|
|||
* 功能描述:传入任意一个 javabean 对象生成一个指定规格的字符串
|
||||
* @param bean bean对象
|
||||
* @return String
|
||||
* @deprecated
|
||||
*/
|
||||
private static String beanToJson(Object bean) {
|
||||
StringBuilder json = new StringBuilder();
|
||||
|
|
|
@ -206,6 +206,18 @@
|
|||
field : 'casetime',
|
||||
title : '执行时间',
|
||||
width : '10%',
|
||||
formatter : function(value,
|
||||
row, index) {
|
||||
var now = new Date(value);
|
||||
var year=now.getFullYear();
|
||||
var month=now.getMonth()+1;
|
||||
var date=now.getDate();
|
||||
var hour=now.getHours();
|
||||
var minute=now.getMinutes();
|
||||
var second=now.getSeconds();
|
||||
var time=year+'-'+add0(month)+'-'+add0(date)+' '+add0(hour)+':'+add0(minute)+':'+add0(second);
|
||||
return time;
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'casestatus_str',
|
||||
|
@ -299,6 +311,18 @@
|
|||
field : 'logtime',
|
||||
title : '打印时间',
|
||||
width : '10%',
|
||||
formatter : function(value,
|
||||
row, index) {
|
||||
var now = new Date(value);
|
||||
var year=now.getFullYear();
|
||||
var month=now.getMonth()+1;
|
||||
var date=now.getDate();
|
||||
var hour=now.getHours();
|
||||
var minute=now.getMinutes();
|
||||
var second=now.getSeconds();
|
||||
var time=year+'-'+add0(month)+'-'+add0(date)+' '+add0(hour)+':'+add0(minute)+':'+add0(second);
|
||||
return time;
|
||||
}
|
||||
}, {
|
||||
field : 'logGrade',
|
||||
title : '日志级别',
|
||||
|
@ -516,6 +540,8 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
function add0(m){return m<10?'0'+m:m }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -235,6 +235,19 @@
|
|||
field : 'runTime',
|
||||
title : '开始时间',
|
||||
width : '10%',
|
||||
formatter : function(value,
|
||||
row, index) {
|
||||
var now = new Date(value);
|
||||
var year=now.getFullYear();
|
||||
var month=now.getMonth()+1;
|
||||
var date=now.getDate();
|
||||
var hour=now.getHours();
|
||||
var minute=now.getMinutes();
|
||||
var second=now.getSeconds();
|
||||
//var time= year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
|
||||
var time=year+'-'+add0(month)+'-'+add0(date)+' '+add0(hour)+':'+add0(minute)+':'+add0(second);
|
||||
return time;
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'startTimestr',
|
||||
|
@ -519,6 +532,8 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function add0(m){return m<10?'0'+m:m }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -206,6 +206,18 @@
|
|||
field : 'createTime',
|
||||
title : '开始时间',
|
||||
width : '10%',
|
||||
formatter : function(value,
|
||||
row, index) {
|
||||
var now = new Date(value);
|
||||
var year=now.getFullYear();
|
||||
var month=now.getMonth()+1;
|
||||
var date=now.getDate();
|
||||
var hour=now.getHours();
|
||||
var minute=now.getMinutes();
|
||||
var second=now.getSeconds();
|
||||
var time=year+'-'+add0(month)+'-'+add0(date)+' '+add0(hour)+':'+add0(minute)+':'+add0(second);
|
||||
return time;
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'finishtime',
|
||||
|
@ -213,7 +225,15 @@
|
|||
width : '10%',
|
||||
formatter : function(value,
|
||||
row, index) {
|
||||
return '<font id="finishtime' + row.id + '">'+value+'</font>';
|
||||
var now = new Date(value);
|
||||
var year=now.getFullYear();
|
||||
var month=now.getMonth()+1;
|
||||
var date=now.getDate();
|
||||
var hour=now.getHours();
|
||||
var minute=now.getMinutes();
|
||||
var second=now.getSeconds();
|
||||
var time=year+'-'+add0(month)+'-'+add0(date)+' '+add0(hour)+':'+add0(minute)+':'+add0(second);
|
||||
return '<font id="finishtime' + row.id + '">'+time+'</font>';
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -400,6 +420,8 @@
|
|||
toastr.warning('请选取要删除的任务!');
|
||||
}
|
||||
}
|
||||
|
||||
function add0(m){return m<10?'0'+m:m }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue