예제 #1
0
  /** @功能 新增投资商 */
  public String add() {

    CarBrand carBrand = carBrandService.get(brandId);

    CarInfo one = carInfoService.get(id);
    one.setPrice(this.price); // 价格
    Integer priceInt = (int) (price * 10000);
    one.setPriceInt(priceInt);
    one.setCommission(commission);
    one.setTitle(title);
    one.setDescription(this.description); // 描述
    one.setCarType(carType);
    one.setCommitDate(new Date()); // 创建时间
    one.setCondition(condition);
    one.setTravel(travel);
    one.setCreabox(creabox);
    one.setDriveMode(driveMode);
    one.setColor(color);
    one.setProcedures(procedures);
    one.setSeatNum(seatNum);
    one.setChair(chair);
    one.setPlace(place);
    one.setFuel(fuel);
    one.setDischarge(discharge);
    one.setColorIn(colorIn);
    one.setHotState(hotState);
    one.setRecState(recState);
    one.setOriginalPrice(originalPrice);
    one.setBrandId(carBrand);
    one.setUsed(used);
    one.setSellState(10);

    // 根据前台传入的限时天数,获取限时时间
    if (xianNum != null) {
      Calendar calendar = Calendar.getInstance();
      calendar.set(calendar.DATE, calendar.get(calendar.DATE) + xianNum);
      one.setXianDate(calendar.getTime());
    }

    // 判断有没有图片上传
    if (file != null) {
      // 显示名称

      // 产品图片
      CarImg img = new CarImg();
      img.setCarInfo(one);
      this.carImgService.save(img);
      FileTool fileTool = new FileTool();
      String imgPath = fileTool.saveProductImg(this.file, this.fileFileName);
      img.setImgPath(imgPath);
      one.setImagePath(imgPath);
    }
    this.carInfoService.update(one);
    return SUCCESS;
  }
예제 #2
0
  public String show() {
    // 先保存产品资料
    CarInfo one = new CarInfo();
    LoginAdmin loginAdmin = (LoginAdmin) ActionContext.getContext().getSession().get("loginAdmin");

    Admin commitAdmin = adminService.get(loginAdmin.getId());
    one.setCommitAdmin(commitAdmin);

    list = carBrandService.getList();

    this.carInfoService.save(one);
    this.id = one.getId();
    return this.INPUT;
  }