yujian
2019-10-18 3aadf7bed39a775349097ca991878613717b768f
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -50,6 +50,7 @@
import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
import com.yeshi.fanli.service.inter.money.extract.ExtractCountService;
import com.yeshi.fanli.service.inter.money.extract.ExtractService;
import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
import com.yeshi.fanli.service.inter.push.PushRecordService;
@@ -102,10 +103,12 @@
   @Resource
   private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
   @Resource
   private UserInfoExtraService userInfoExtraService;
   @Resource
   private CommonOrderCountService commonOrderCountService;
   /**
    * 
@@ -397,6 +400,11 @@
            if (adminUser == null) {
               record.setAdminUser(new AdminUser());
            }
            // 查询用户备注信息
            UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(record.getExtract().getUserInfo().getId());
            if (extra != null) {
               record.getExtract().getUserInfo().setStateDesc(extra.getMark());
            }
            int warnLevel = 0;
            Extract extract = record.getExtract();
@@ -436,7 +444,26 @@
               }
               record.setExtraInfoStr(desc.toString());
            }
            if (warnLevel == 0) {
               // 查询同店铺商品,同商品订单超过一定数量的
               List<Integer> typeList = new ArrayList<>();
               typeList.add(HongBaoV2.TYPE_ZIGOU);
               long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList,
                     record.getExtract().getUserInfo().getId(),
                     Integer.parseInt(configService.get("admin_min_same_goods_order_count")));
               long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList,
                     record.getExtract().getUserInfo().getId(),
                     Integer.parseInt(configService.get("admin_min_same_shop_order_count")));
               if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) {
                  warnLevel = 3;
                  record.setExtraInfoStr(
                        String.format("同店铺:%s   同商品:%s", sameShopOrderCount, sameGoodsOrderCount));
               }
            }
            record.setWarnLevel(warnLevel);
         }
         int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days);
@@ -446,7 +473,7 @@
         GsonBuilder gsonBuilder = new GsonBuilder();
         gsonBuilder.serializeNulls();
         gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
         Gson gson = gsonBuilder.create();
         JSONObject data = new JSONObject();
@@ -560,14 +587,14 @@
            } else {
               surplusTime = DateUtil.dateDiff(formattodayTime, formatTime);
            }
            String mark = "";
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(extract.getUserInfo().getId());
            if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getMark())) {
               mark = "警惕!! " + userInfoExtra.getMark();
            }
            data.put("mark",mark);
            data.put("mark", mark);
            data.put("extract", extract);
            data.put("beforeMoney", beforeMoney);
            data.put("surplusTime", surplusTime);
@@ -637,7 +664,7 @@
                  mark = "警惕!! " + userInfoExtra.getMark();
               }
               data.put("mark",mark);
               data.put("mark", mark);
               data.put("extract", extract);
               data.put("beforeMoney", beforeMoney);
               data.put("surplusTime", surplusTime);
@@ -850,8 +877,8 @@
               innerList.put("name", "驳回数");
            }
            List<ChartTDO> list = extractAuditRecordService.countAuditTotal(state, dateType, year,
                  startTime, endTime);
            List<ChartTDO> list = extractAuditRecordService.countAuditTotal(state, dateType, year, startTime,
                  endTime);
            if (dateType != 3) {
               innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
            } else {
@@ -935,8 +962,8 @@
         JSONObject innerList = new JSONObject();
         innerList.put("name", "总计");
         List<ChartTDO> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year,
               startTime, endTime);
         List<ChartTDO> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year, startTime,
               endTime);
         if (dateType != 3) {
            innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
@@ -1020,12 +1047,11 @@
         Gson gson = new Gson();
         List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
         JSONObject innerList = new JSONObject();
         innerList.put("name", "总计");
         List<ChartTDO> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year,
               startTime, endTime);
         List<ChartTDO> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year, startTime,
               endTime);
         if (dateType != 3) {
            innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
@@ -1057,7 +1083,6 @@
      }
   }
   
   /**
    * 下载提现红包Openid
    * @param callback
@@ -1072,28 +1097,29 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
            return;
         }
         String filepath = "自动提现OpenId "+ java.lang.System.currentTimeMillis() + ".txt";
         String filepath = "自动提现OpenId " + java.lang.System.currentTimeMillis() + ".txt";
         response.reset();
          response.setContentType("application/octet-stream");
          String fileName= URLDecoder.decode(filepath,"utf-8");
          response.addHeader("Content-Disposition","attachment;"+ "filename=\"" +URLEncoder.encode(fileName, "utf-8") + "\"");
         response.setContentType("application/octet-stream");
         String fileName = URLDecoder.decode(filepath, "utf-8");
         response.addHeader("Content-Disposition",
               "attachment;" + "filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\"");
         StringBuilder sb = new StringBuilder();
         for(String t:list){
            sb.append(t+"\r\n");
         for (String t : list) {
            sb.append(t + "\r\n");
         }
         String opid_str = sb.toString();
         if (!StringUtil.isNullOrEmpty(opid_str) && opid_str.endsWith("\r\n")) {
            opid_str = opid_str.substring(0, opid_str.length() - 2);
         }
          OutputStream os = response.getOutputStream();
            byte[] byt = opid_str.getBytes();
            os.write(byt);
            os.flush();
          os.close();
         OutputStream os = response.getOutputStream();
         byte[] byt = opid_str.getBytes();
         os.write(byt);
         os.flush();
         os.close();
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
         e.printStackTrace();
@@ -1140,7 +1166,7 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
            return;
         }
         if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
         }
@@ -1149,22 +1175,22 @@
         if (pageSize == null || pageSize < 1) {
            pageSize = Constant.PAGE_SIZE;
         }
         int count = list.size();
         int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
         List<UserInfo> listResult = null;
         if (pageIndex < totalPage) {
            int start = (pageIndex - 1) * pageSize;
            listResult = list.subList(start, start + pageSize);
         } else if (pageIndex == totalPage) {
             listResult = list.subList((pageIndex - 1) * pageSize, list.size());
            listResult = list.subList((pageIndex - 1) * pageSize, list.size());
         } else {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("没有更多了"));
            return;
         }
         JSONObject data = new JSONObject();
         data.put("pe", pe);
         data.put("result_list", listResult);