Examples of GoodsDetail


Examples of net.yanhl.goods.pojo.GoodsDetail

      HttpServletResponse response) throws Exception {
    String currentUserName = null;
    try {
      currentUserName = UserUtil.getCurrentUserName(request);
      JSONObject jsonObject = readJson(request);
      GoodsDetail detail = (GoodsDetail) JSONObject.toBean(jsonObject, GoodsDetail.class);
      detail.setCreatorId(new Integer(UserUtil.getCurrentUserId(request)));
      detail.setCreateDate(new java.sql.Date(System.currentTimeMillis()));
      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);
      detail.setGoodsType(goodsType);
      getBaseManager().save(detail);
      print(response, RESBONSE_SUCCESS + "|" + detail.getId());
      log.debug(currentUserName + ">增加物品详细[" + detail.getGoodsName() + "]");
    } catch(JSONException je) {
      je.printStackTrace();
      log.error(currentUserName + ">增加物品详细>解析JSON数据出错:" + je.getMessage());
    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

Examples of net.yanhl.goods.pojo.GoodsDetail

      HttpServletResponse response) throws Exception {
    String currentUserName = null;
    Long goodsDetailId = StringUtil.getLongValue(request, "id");
    try {
      currentUserName = UserUtil.getCurrentUserName(request);
      GoodsDetail goodsDetail = (GoodsDetail) getBaseManager().get(GoodsDetail.class, goodsDetailId);
      JSONObject jsonObject = new JSONObject();
      jsonObject.accumulate("createDate", StringUtil.getValue(goodsDetail.getCreateDate(), "date"));
      jsonObject.accumulate("goodsTypeId", goodsDetail.getGoodsType().getId());
      jsonObject.accumulate("goodsName", goodsDetail.getGoodsName());
      jsonObject.accumulate("goodsUnit", goodsDetail.getGoodsUnit());
      jsonObject.accumulate("unitPrice", goodsDetail.getUnitPrice());
      jsonObject.accumulate("remark", goodsDetail.getRemark());
      print(response, jsonObject.toString());
      log.debug(currentUserName + ">载入物品详细[id=" + goodsDetailId + "]");
    } catch(JSONException je) {
      je.printStackTrace();
      log.error(currentUserName + ">载入物品详细>解析JSON数据出错:" + je.getMessage());
View Full Code Here

Examples of net.yanhl.goods.pojo.GoodsDetail

      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();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.