yujian
2019-03-12 4a05f1c9c508ab7f10c5eae22a5c716f5454ca02
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -73,6 +73,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.factory.AccountDetailsFactory;
import com.yeshi.fanli.vo.user.ForbiddenUserIdentifyCodeVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -133,6 +134,7 @@
   @Resource
   private UserRankService userRankService;
   @Resource
   private UserMoneyDetailService userMoneyDetailService;
@@ -1624,4 +1626,84 @@
      }
   }
   /**
    * 查询封禁
    * @param callback
    * @param pageIndex
    * @param pageSize
    * @param key
    * @param type
    * @param out
    */
   @RequestMapping(value = "forbiddenQuery")
   public void forbiddenQuery(String callback, Integer pageIndex, Integer pageSize, String key, Integer type, PrintWriter out) {
      try {
         if (pageIndex == null)
            pageIndex = 1;
         if (pageSize == null)
            pageSize = Constant.PAGE_SIZE;
         List<ForbiddenUserIdentifyCodeVO> list = forbiddenUserIdentifyCodeService.listQuery((pageIndex - 1) * pageSize,
               pageSize, key, type);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关数据"));
            return;
         }
         long count = forbiddenUserIdentifyCodeService.countQuery(key, type);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
         GsonBuilder gsonBuilder = new GsonBuilder();
         gsonBuilder.serializeNulls();
         Gson gson = gsonBuilder.create();
         JSONObject data = new JSONObject();
         data.put("pe", pe);
         data.put("result_list", gson.toJson(list));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         e.printStackTrace();
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
      }
   }
   /**
    * 用户账号- 封禁/解封
    * @param callback
    * @param code
    * @param type 1("微信unionId"), 2("淘宝ID"), 3("手机号"), 4("支付宝账号");
    * @param out
    */
   @RequestMapping(value = "saveForbiddenInfo")
   public void saveForbiddenInfo(String callback, String code, Integer type, boolean state, PrintWriter out) {
      try {
         if (code == null || code.trim().length() == 0 || type == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不能为空"));
         }
         forbiddenUserIdentifyCodeService.saveForbiddenInfo(code, type, state);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
      } catch (ForbiddenUserIdentifyCodeException e) {
         e.printStackTrace();
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         e.printStackTrace();
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
      }
   }
}