更新json字段代码备份

@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(DecOrderEntity decOrder,DecOrderPage decOrderPage,JsonExtractPage jsonExtractPage, HttpServletRequest request) {
List<GoodsCodeEntity> goodsCodeList = decOrderPage.getGoodsCodeList();
AjaxJson j = new AjaxJson();
String message = "更新成功";
try{
DecOrderEntity decOrder1=decOrderService.getEntity(DecOrderEntity.class, decOrder.getId());
String jsonExtract = decOrder1.getJsonExtract();
JsonExtractPage jsonExtractPage1;
if(StringUtils.isNotBlank(jsonExtract)){
jsonExtractPage1 = JSONObject.parseObject(decOrder1.getJsonExtract(), JsonExtractPage.class);
jsonExtractPage1.setJsEta(jsonExtractPage.getJsEta());
jsonExtractPage1.setJsHy(jsonExtractPage.getJsHy());
jsonExtractPage1.setJsJzxNum(jsonExtractPage.getJsJzxNum());
jsonExtractPage1.setJsWeight(jsonExtractPage.getJsWeight());
jsonExtractPage1.setJsTj(jsonExtractPage.getJsTj());

//json对象和字符串互转
//JSONObject json = JSONObject.fromObject(str);
String jsonString = JSON.toJSONString(jsonExtractPage1);
decOrder1.setJsonExtract(jsonString);
}else{
String jsonString = JSON.toJSONString(jsonExtractPage);
decOrder1.setJsonExtract(jsonString);
}



MyBeanUtils.copyBeanNotNull2Bean(decOrder, decOrder1);
decOrderService.updateMain(decOrder1, goodsCodeList);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "更新业务订单表失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}

 

 

 

 

 

二、

String str = String.valueOf(map.get("json_extract"));
JSONObject json = JSONObject.parseObject(str);
String jsBLorawbNo = json.getString("jsBLorawbNo");/**B/L OR AWB NO*/
String jsEta = json.getString("jsEta");/**ETA*/
String jsHy = json.getString("jsHy");/**海运整柜(注明箱型)*/
String jsJzxNum = json.getString("jsJzxNum");/**集装箱数量*/
String jsWeight = json.getString("jsWeight");/**毛重*/
String jsTj = json.getString("jsTj");/**体积*/
String jsSumfy = json.getString("jsSumfy");/**物流费用合计金额*/
String jsGsje = json.getString("jsGsje");/**关税金额(必须和关税单金额核对)*/
String jsZzs = json.getString("jsZzs");/**增值税(必须和关税单金额核对)*/
String jsFybm = json.getString("jsFybm");/**费用部门*/

posted @ 2020-03-24 10:42  薛柏梁  阅读(224)  评论(0编辑  收藏  举报