コード例 #1
0
  // 更新
  @Validations(
      requiredFields = {
        @RequiredFieldValidator(fieldName = "instantMessagingTitle", message = "在线客服标题不允许为空!"),
        @RequiredFieldValidator(fieldName = "instantMessagingPosition", message = "在线客服位置不允许为空!")
      })
  @InputConfig(resultName = "error")
  public String update() {
    List<InstantMessaging> allInstantMessagingList = instantMessagingService.getAllList();
    if (allInstantMessagingList != null) {
      for (InstantMessaging instantMessaging : allInstantMessagingList) {
        instantMessagingService.delete(instantMessaging);
      }
    }
    if (instantMessagingList != null) {
      for (InstantMessaging instantMessaging : instantMessagingList) {
        if (instantMessaging != null
            && StringUtils.isNotEmpty(instantMessaging.getTitle())
            && StringUtils.isNotEmpty(instantMessaging.getValue())) {
          instantMessagingService.save(instantMessaging);
        }
      }
    }

    Setting setting = SettingUtil.getSetting();
    setting.setInstantMessagingTitle(instantMessagingTitle);
    setting.setInstantMessagingPosition(instantMessagingPosition);
    setting.setIsInstantMessagingEnabled(isInstantMessagingEnabled);
    SettingUtil.updateSetting(setting);

    jobService.buildShopJs();

    redirectUrl = "instant_messaging!edit.action";
    return SUCCESS;
  }
コード例 #2
0
 // 编辑
 public String edit() {
   instantMessagingList = instantMessagingService.getAllList();
   return INPUT;
 }