* sb.append("cremindRemark:\"xiaoqiangremark\"");
* sb.append("}");
* sb.append("]");
*
* @param jsonArray
* @param classzz
*/
public static final
JSONUtils.getMorpherRegistry().registerMorpher(new TimeStampMorpher());
// JSONUtils.getMorpherRegistry().registerMorpher(new TimeStampMorpher());
// StringBuilder sb = new StringBuilder("[");
// sb.append("{");
// sb.append("cremindTitle:\"小名\",");
// sb.append("cremindDate:\"2012-06-0519:20:22\",");
// sb.append("cremindRemark:\"阿斯蒂芬\"");
// sb.append("}");
// sb.append("]");
// List
// Cremind.class);
return JSONArray.toList(JSONArray.fromObject(jsonArray),classzz);
}
}
项目中表示层Action调用:
[java]
/**
* 新增客户
* 请求参数:
* name:客户名称
* cno:客户编号(跟ID不同)
* customKindId:客户性质ID
* phone:公司电话
* fax:公司传真
* address:客户地址
* siteUrl:公司网址
* cIndustryId:客户行业ID
* cIndustryNum:行业排名
* mainSellProduct:主营产品
* cbuildDate:成立时间
* clevelId:客户级别ID
* signTag:签约标志
* remind:[{
* cremindTitle:提醒名称
* cremindDate:提醒日期
* cremindRemark:备注
* @return
* @throws Exception
*/
public String addCustomer() throws Exception{
return super.executeAction(new IExecuteActionCallback() {
public String execute(BaseJSONAction baseJsonAction) {
Customer cst = new Customer();
bindParam2Bean(cst);//绑定请求参数到对象
//处理特殊参数的绑定
//处理客户性质ID
String customKindId = getParam("customKindId").toString();
if (!StringUtils.isBlank(customKindId)){
CustomKind ck = new CustomKind();
ck.setCustomKindId(Integer.valueOf(customKindId));
cst.setCustomKind(ck);
}
//处理客户行业
String cIndustryId = getParam("cIndustryId").toString();
if(!StringUtils.isBlank(cIndustryId)){
Cindustry cs = new Cindustry();
cs.setCindustryId(Integer.valueOf(cIndustryId));
cst.setCindustry(cs);
}
//处理客户级别
String clevelId = getParam("clevelId").toString();
if(!StringUtils.isBlank(clevelId)){
Clevel cl = new Clevel();
cl.setClevelId(Integer.valueOf(clevelId));
cst.setClevel(cl);
}
// 理
cst.setCregArchDate(DateUtil.getTimestamp());
if (cst.getCbuildDate()==null)
cst.setCbuildDate(DateUtil.getTimestamp());
// 理所 工
Emp emp = getCurrentUser();
if (emp!=null)
cst.setEmp(emp);
/