喻健
2018-12-25 95654e5a5a1d0c4384cf44a1510c670ec804abc7
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java
@@ -15,11 +15,12 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -34,6 +35,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.exception.ExtractException;
import com.yeshi.fanli.exception.NotExistObjectException;
import com.yeshi.fanli.exception.ObjectStateException;
import com.yeshi.fanli.log.LogHelper;
@@ -55,9 +57,7 @@
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("admin/new/api/v1/extract")
@@ -328,27 +328,12 @@
    */
   @RequestMapping(value = "checkExtract", method = RequestMethod.POST)
   public void checkExtract(String uid, PrintWriter out) {
      JSONObject data = new JSONObject();
      // 已到账的红包
      int count = hongBaoService.getCount(HongBao.STATE_YILINGQU);
      if (count == 0) {
         data.put("code", "1");
         out.print(data);
         return;
      }
      List<Integer> checked = extractService.checkExtract(uid);
      if (checked != null && checked.size() > 0) {
         Integer diversity = checked.get(0);
         if (diversity == 0) {
            data.put("code", "0");
         } else {
            data.put("code", "1");
         }
      } else {
         data.put("code", "1");
      try {
         extractService.checkExtract(uid);
         data.put("code", "1"); // 正常
      } catch (ExtractException e) {
         data.put("code", "0");// 异常
      }
      out.print(data);
   }
@@ -523,6 +508,23 @@
            if (adminUser == null) {
               record.setAdminUser(new AdminUser());
            }
            int warnLevel = 0;
            Extract extract = record.getExtract();
            if (extract != null) {
               Integer extractState = extract.getState();
               if (extractState != null && extractState == 0) {
                  UserInfo userInfo = extract.getUserInfo();
                  if (userInfo != null) {
                     double countTodayMoney = extractService.countTodayMoney(userInfo.getId());
                     if (countTodayMoney >= 100) {
                        warnLevel = 1;
                     }
                  }
               }
            }
            record.setWarnLevel(warnLevel);
         }
         int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days);
@@ -1024,7 +1026,11 @@
            String auctionIds = auctionIdBuf.toString();
            String ids = auctionIds.substring(0, auctionIds.length() - 1);
            goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
            try {
               goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
            } catch (Exception e) {
               e.printStackTrace();
            }
         }
         List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>();
@@ -1075,7 +1081,7 @@
      } catch (Exception e) {
         e.printStackTrace();
         out.print(JsonUtil.loadFalseResult(e.getMessage()));
         out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
      }
   }
@@ -1278,7 +1284,7 @@
      } catch (Exception e) {
         e.printStackTrace();
         out.print(JsonUtil.loadFalseResult(e.getMessage()));
         out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
      }
   }
@@ -1401,18 +1407,11 @@
         return;
      }
      List<Integer> listChecked = extractService.checkExtract(uid);
      if (listChecked == null || listChecked.size() == 0) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("资金异常"));
         return;
      }
      Integer diversity = listChecked.get(0);
      if (diversity == 0) {
      try {
         extractService.checkExtract(uid);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("资金正常"));
      } else {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("资金异常"));
      } catch (ExtractException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      }
   }