From 559e188de93bb05d6c37ec1a0d392ec69ed02567 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@S0ZHK00LKCA6OYY> Date: 星期二, 20 十一月 2018 10:41:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java | 150 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 149 insertions(+), 1 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java index 832e806..f97edbe 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java @@ -29,6 +29,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.yeshi.fanli.entity.admin.UserInfoAdmin; +import com.yeshi.fanli.entity.bus.user.AccountDetails; import com.yeshi.fanli.entity.bus.user.Extract; import com.yeshi.fanli.entity.bus.user.HongBao; import com.yeshi.fanli.entity.bus.user.MoneyRecord; @@ -57,6 +58,7 @@ import com.yeshi.fanli.util.HongBaoUtil; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; + import org.yeshi.utils.JsonUtil; @Controller @@ -1024,8 +1026,154 @@ } } - public static void main(String[] args) { + + + /** + * 闃熷憳鍏崇郴 + * @param pageIndex + * @param key + * @param state + * @param startTime + * @param endTime + * @param out + */ + @RequestMapping(value = "getRelationList") + public void getRelationList(String callback, Integer pageIndex, Integer pageSize, Long uid, Integer type, + Integer state, String startTime, String endTime, PrintWriter out) { + if (pageIndex == null || pageIndex < 1) { + pageIndex = 1; + } + + if (pageSize == null || pageSize < 1) { + pageSize = Constant.PAGE_SIZE; + } + + try { + + 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()); + } + + List<ThreeSale> listQuery = null; + if (type == 0) { + // 涓婄骇鐢ㄦ埛 + if (uid == null) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ涓婄骇闇�杈撳叆鐢ㄦ埛id")); + return; + } + listQuery = threeSaleService.listSuperiorQuery((pageIndex - 1) * pageSize, pageSize, state, uid); + } else if (type == 1) { + // 涓�绾х敤鎴� + listQuery = threeSaleService.listFirstTeamQuery((pageIndex - 1) * pageSize, pageSize, uid, + state, startTime, endTime); + } else if (type == 2) { + // 浜岀骇鐢ㄦ埛 + listQuery = threeSaleService.listSecondTeamQuery((pageIndex - 1) * pageSize, pageSize, uid, + state, startTime, endTime); + } + + if (listQuery == null || listQuery.size() == 0) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); + return; + } + + for (ThreeSale threeSale: listQuery) { + Integer expire = threeSale.getExpire(); + if (threeSale.getState()) { + threeSale.setExpire(1); // 閭�璇锋垚鍔� + } else { + if (expire != null && expire == 1) { + threeSale.setExpire(2); // 閭�璇峰け鏁� + } else { + threeSale.setExpire(0);// 宸查個璇� + } + } + } + + long count = 0; + if (type == 0) { + // 涓婄骇鐢ㄦ埛 + count = threeSaleService.countSuperiorQuery(state, uid); + } else if (type == 1) { + // 涓�绾х敤鎴� + count = threeSaleService.countFirstTeamQuery(uid, state, startTime, endTime); + } else if (type == 2) { + // 浜岀骇鐢ㄦ埛 + count = threeSaleService.countSecondTeamQuery(uid, state, startTime, endTime); + } + + 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); + data.put("result_list", listQuery); + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); + + } catch (Exception e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触")); + e.printStackTrace(); + } + } + + + /** + * 鐢ㄦ埛璐︽埛鏄庣粏 + * @param callback + * @param pageIndex + * @param pageSize + * @param id + * @param out + */ + @RequestMapping(value = "getAccountDetails") + public void getAccountDetails(String callback, Integer pageIndex,Integer pageSize, Long uid, PrintWriter out) { + if (pageIndex == null || pageIndex < 1) { + pageIndex = 1; + } + + if (pageSize == null || pageSize < 1) { + pageSize = Constant.PAGE_SIZE; + } + + if (uid == null) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇蜂紶閫掓纭暟鎹�")); + return; + } + + try { + + List<AccountDetails> detailsList = accountDetailsService.findAccountDetailsList(uid, pageIndex); + if (detailsList == null || detailsList.size() == 0) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); + return; + } + + int count = accountDetailsService.getCount(uid); + + 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); + data.put("result_list", GsonUtil.toJsonExpose(detailsList)); + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); + + } catch (Exception e) { + e.printStackTrace(); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触")); + } + } + + public static void main(String[] args) { java.lang.System.out.println(java.lang.System.currentTimeMillis()); } -- Gitblit v1.8.0