admin
2019-03-13 df03194e4b0c0737cf84127c4dd69d456e30ed24
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -21,7 +21,6 @@
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.controller.admin.utils.AdminUtils;
import com.yeshi.fanli.dto.money.AccountDetails;
import com.yeshi.fanli.entity.admin.UserInfoAdmin;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
@@ -37,9 +36,7 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.UserInfoCountService;
import com.yeshi.fanli.service.inter.goods.ShareService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.order.OrderItemServcie;
import com.yeshi.fanli.service.inter.order.OrderService;
import com.yeshi.fanli.service.inter.user.BindingAccountService;
import com.yeshi.fanli.service.inter.user.ExtractService;
@@ -57,6 +54,7 @@
import com.yeshi.fanli.util.GsonUtil;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.AccountDetailsFactory;
import com.yeshi.fanli.vo.user.UserInfoVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -80,16 +78,10 @@
   private ConfigService configService;
   @Resource
   private HongBaoService hongBaoService;
   @Resource
   private ExtractService extractService;
   @Resource
   private ThreeSaleSerivce threeSaleService;
   @Resource
   private OrderItemServcie orderItemService;
   @Resource
   private ShareService shareService;
@@ -114,7 +106,7 @@
   @Resource
   private UserRankService userRankService;
   @Resource
   private UserMoneyDetailService userMoneyDetailService;
@@ -308,22 +300,15 @@
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer userType, Integer days,
         String startTime, String endTime, Integer orderMode, PrintWriter out) {
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,
         Integer days, String startTime, String endTime, Integer orderMode, Integer type, PrintWriter out) {
      try {
         // 结束时间 2018-06-06 00:00:00 加上一天
         if (!StringUtil.isNullOrEmpty(endTime)) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date enddate = sdf.parse(endTime);
            Calendar c = Calendar.getInstance();
            c.setTime(enddate);
            c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
            endTime = sdf.format(c.getTime());
         if (type == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户类型type不能为空"));
            return;
         }
         if (pageIndex == null)
            pageIndex = 1;
@@ -344,15 +329,35 @@
            }
         }
         List<UserInfoAdmin> userList = userInfoService.query((pageIndex - 1) * pageSize, pageSize, key, userType,
               days, startTime, endTime, orderField, orderMode);
         String userRank = null;
         if (rank != null) {
            switch (rank) {
            case 1:
               userRank = "青铜";
               break;
            case 2:
               userRank = "白银";
               break;
            case 3:
               userRank = "黄金";
               break;
            case 4:
               userRank = "铂金";
               break;
            default:
               break;
            }
         }
         List<UserInfoVO> userList = userInfoService.query((pageIndex - 1) * pageSize, pageSize, type, key, keyType,
               userRank, days, startTime, endTime, orderField, orderMode);
         if (userList == null || userList.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关数据"));
            return;
         }
         long count = userInfoService.queryCount(key, userType, days, startTime, endTime);
         long count = userInfoService.queryCount(type, key, keyType, userRank, days, startTime, endTime);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -363,7 +368,6 @@
         JSONObject data = new JSONObject();
         data.put("pe", pe);
         // data.put("sumMoney", sumMoney);
         data.put("resultList", gson.toJson(userList));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
@@ -1290,4 +1294,34 @@
      }
   }
   /**
    * 用户账号- 封禁/解封
    * @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, PrintWriter out) {
      try {
         if (code == null || code.trim().length() == 0 || type == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不能为空"));
         }
         forbiddenUserIdentifyCodeService.saveForbiddenInfo(code, type);
         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("操作异常"));
      }
   }
}