yujian
2019-01-16 e5ade1fdbd87e085f5be5460c6e3f0adb47704e6
fanli/src/main/java/com/yeshi/fanli/controller/admin/ConfigAdminController.java
@@ -12,13 +12,14 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.common.Config;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.util.StringUtil;
@Controller
@RequestMapping("admin/new/api/v1/config")
@@ -26,6 +27,10 @@
   
   @Resource
   private ConfigService configService;
   @Resource
   private AdminUserService adminUserService;
   
   @RequestMapping(value = "getConfigList", method = RequestMethod.POST)
   public void getConfigList(PrintWriter out){
@@ -76,8 +81,11 @@
            return;
         }
         
         int pageSize = Constant.PAGE_SIZE;
         int count = configService.getCount(key, pageIndex);
         PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
         
         JSONObject data = new JSONObject();
         data.put("pe", pe);
@@ -99,6 +107,7 @@
    */
   @RequestMapping(value = "saveModify")
   public void saveModify(String callback, Config config, PrintWriter out) {
      Long id = config.getId();
      if (id == null) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("ID不能为空"));
@@ -111,9 +120,20 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
            return;
         }
         // key 不可修改
         config.setKey(crentconfig.getKey());
         configService.update(config);
         if (StringUtil.isNullOrEmpty(config.getName()) || StringUtil.isNullOrEmpty(config.getValue())) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("说明、有效值不能为空"));
            return;
         }
         crentconfig.setName(config.getName());
         crentconfig.setValue(config.getValue());
         if (!StringUtil.isNullOrEmpty(config.getBeizhu())) {
            crentconfig.setBeizhu(config.getBeizhu());
         }
         configService.update(crentconfig);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
         
      } catch (Exception e) {