@ResponseBody
@RequestMapping(value= "/specialtySAP2DMS.do", method =RequestMethod.POST)publicJSONObject specialtySAP2DMS(@RequestBody JSONObject[] jsonObject, HttpServletRequest request)throwsGenericBusinessException {
JSONObject return_json= newJSONObject();
SapImportData sapData= newSapImportData();
List specialtyProductList = new ArrayList();try{//校验入参
if(null != jsonObject && (jsonObject.length)>0){for(JSONObject jsonObj : jsonObject){
SpecialtyProduct specialtyProduct= newSpecialtyProduct();
String prodCode= "";//物料编号
String prodDesc = "";//物料描述
String prodFlag = "";//标识
String prodRemark = "";//说明
String prodIscontr = "";//是否进行数量管控
if(StringTool.isEmpty(jsonObj.getString("PROD_CODE"))){
return_json.put("RESULT_STATUS", "F");
return_json.put("RESULT_REASON", "入参必填项存在空值(PROD_CODE-物料编号)");this.sapLog(sapData, "", "参数为空", "入参必填项存在空值(PROD_CODE-物料编号)","specialtySAP2DMS.do");returnreturn_json;
}else{
prodCode= (String)jsonObj.getString("PROD_CODE");//物料编号
if(StringTool.isNotEmpty(jsonObj.getString("PROD_DESC"))){
prodDesc= (String)jsonObj.getString("PROD_DESC");
}if(StringTool.isNotEmpty(jsonObj.getString("PROD_FLAG"))){
prodFlag= (String)jsonObj.getString("PROD_FLAG");
}if(StringTool.isNotEmpty(jsonObj.getString("PROD_REMARK"))){
prodRemark= (String)jsonObj.getString("PROD_REMARK");
}if(StringTool.isNotEmpty(jsonObj.getString("PROD_ISCONTR"))){
prodIscontr= (String)jsonObj.getString("PROD_ISCONTR");
}
specialtyProduct.setProdCode(prodCode);
specialtyProduct.setProdDesc(prodDesc);
specialtyProduct.setProdFlag(prodFlag);
specialtyProduct.setProdRemark(prodRemark);
specialtyProduct.setProdIscontr(prodIscontr);//处理开始时间和结束时间
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("GMT+8"));
Calendar c=Calendar.getInstance();
Timestamp ct= new Timestamp(c.getTimeInMillis());//创建时间
specialtyProduct.setCreatedDate(ct);//通用字段
specialtyProduct.setCreatorId(1l);
specialtyProduct.setCreatorName("admin");
specialtyProduct.setModiDate(ct);
specialtyProduct.setModifierId(1l);
specialtyProduct.setModifierName("admin");
specialtyProduct.setDataSource("SAP汇入");
specialtyProduct.setOwnerId(1l);//添加到List集合中批量保存
specialtyProductList.add(specialtyProduct);
}
}
return_json.put("RESULT_STATUS", "S");
return_json.put("RESULT_REASON", "成功");returnreturn_json;
}else{
return_json.put("RESULT_STATUS", "F");
return_json.put("RESULT_REASON", "入参错误");returnreturn_json;
}
}catch(Exception e){
return_json.put("RESULT_STATUS", "F");
return_json.put("RESULT_REASON", "接口处理错误");returnreturn_json;
}
}