HttpServletResponse response) throws Exception {
String currentUserName = null;
try {
currentUserName = UserUtil.getCurrentUserName(request);
JSONObject jsonObject = readJson(request);
GoodsDetail goodsDetail = (GoodsDetail) JSONObject.toBean(jsonObject, GoodsDetail.class);
GoodsDetail oldGoodsType = (GoodsDetail) getBaseManager().get(GoodsDetail.class, goodsDetail.getId());
oldGoodsType.setGoodsName(goodsDetail.getGoodsName());
String goodsTypeId = jsonObject.getString("goodsTypeId");
if (StringUtils.isEmpty(goodsTypeId)) {
throw new IllegalArgumentException("物品类型ID不能为空!");
}
Long longGoodsTypeId = Long.parseLong(goodsTypeId);
GoodsType goodsType = (GoodsType) getBaseManager().get(GoodsType.class, longGoodsTypeId);
oldGoodsType.setGoodsType(goodsType);
oldGoodsType.setGoodsUnit(goodsDetail.getGoodsUnit());
oldGoodsType.setUnitPrice(goodsDetail.getUnitPrice());
oldGoodsType.setRemark(goodsDetail.getRemark());
getBaseManager().update(oldGoodsType);
print(response, RESBONSE_SUCCESS);
log.debug(currentUserName + ">修改物品详细[" + goodsDetail.getGoodsName() + "]信息");
} catch(JSONException je) {
je.printStackTrace();