From 2c479a66e7cb1df74f50ed798a2c3e2a0bc15322 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@S0ZHK00LKCA6OYY> Date: 星期五, 30 十一月 2018 12:24:16 +0800 Subject: [PATCH] 修复提现验证问题 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java | 1001 ++++++++++++++++++++++++++++------------------------------ 1 files changed, 479 insertions(+), 522 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java index 6ba3a56..aa1b49e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java @@ -65,7 +65,7 @@ @Resource private ExtractService extractService; - + @Resource private ExtractCountService extractCountService; @@ -86,39 +86,32 @@ @Resource private AdminUserService adminUserService; - + @Resource private OrderItemServcie orderItemServcie; - + @Resource private PidOrderService pidOrderService; - + @Resource private RedisManager redisManager; - + @Resource private TaoBaoOrderService taoBaoOrderService; - + @Resource private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService; - - - - - + private final static String TODAY = "1"; private final static String THREE = "2"; private final static String AWEEK = "3"; @RequestMapping(value = "getExtractList", method = RequestMethod.POST) public void getExtractList(int pageIndex, PrintWriter out) { - List<Extract> extractList = extractService - .getExtractList(pageIndex - 1); + List<Extract> extractList = extractService.getExtractList(pageIndex - 1); int count = extractService.getCount(); - int totalPage = count % Constant.PAGE_SIZE == 0 ? count - / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1; - PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, - totalPage); + int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1; + PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage); JSONObject data = new JSONObject(); data.put("pe", pe); data.put("extractList", extractList); @@ -136,99 +129,96 @@ */ @RequestMapping(value = "passExtract", method = RequestMethod.POST) public void passExtract(String callback, long id, PrintWriter out, HttpServletRequest request) { - - //TODO 闇�瑕侀偖绠卞彂閫佺煭淇¢獙璇� - - AdminUser admin = (AdminUser) request.getSession().getAttribute( - Constant.SESSION_ADMIN); - + + // TODO 闇�瑕侀偖绠卞彂閫佺煭淇¢獙璇� + + AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); + Integer integer = extractService.passExtract(id, admin); Extract extract = extractService.getExtractById(id); long uid = extract.getUserInfo().getId(); if (integer == null) { out.print(JsonUtil.loadTrueResult("閫氳繃")); - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" - + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛 + LogHelper + .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛 } else if (integer == 1) { - + out.print(JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ瀵硅薄")); // 鍚屾剰涔嬪悗澶辫触 - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪"); + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪"); String title = "浣犵殑鎻愮幇鐢宠琚┏鍥�"; String content = "闈炲父閬楁喚锛屼綘鐨勬彁鐜扮敵璇疯椹冲洖銆傛垜浠�氳繃鏍稿鍙戠幇浣犵殑璐︾洰鏄庣粏鏈夎锛屾垜浠細鍦ㄥ璁″畬鎴愪箣鍚庣粰浣犲彂閫氱煡娑堟伅銆傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } else { - - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�"); + + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�"); out.print(JsonUtil.loadFalseResult("璇ョ姸鎬佷笉绛変簬涓嶄负鍒濆鐘舵��")); String title = "浣犵殑鎻愮幇鐢宠涓嶆垚鍔�"; String content = "璇风‘淇濅綘鐨勬彁鐜拌处鎴风殑闅愮璁剧疆涓� 鍏佽閭銆佹墜鏈哄彿銆佷細鍛樺悕鎵惧埌鎴戙�傚惁鍒欐棤娉曟垚鍔熷畬鎴愯浆璐︺�傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } } - + /** * - * 鏂规硶璇存槑: 閫氳繃鎻愮幇璇锋眰 鍙痡sonP鏂瑰紡 + * 鏂规硶璇存槑: 閫氳繃鎻愮幇璇锋眰 鍙痡sonP鏂瑰紡 * * @param id - * @param code 楠岃瘉鐮� + * @param code + * 楠岃瘉鐮� * @param out * @param request */ @RequestMapping(value = "passExtractJP") - public void passExtractJP(String callback, Long id, String code,PrintWriter out, HttpServletRequest request) { - - /* 妫�楠屾槸鍚︾櫥闄� */ + public void passExtractJP(String callback, Long id, String code, PrintWriter out, HttpServletRequest request) { + + /* 妫�楠屾槸鍚︾櫥闄� */ AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); if (admin == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��")); return; - } - - /* 妫�楠屾槸鍚﹂�氳繃楠岃瘉 */ - String codeType = (String)request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); + } + + /* 妫�楠屾槸鍚﹂�氳繃楠岃瘉 */ + String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); if (!"1".equals(codeType)) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3,"閭楠岃瘉鏈�氳繃")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "閭楠岃瘉鏈�氳繃")); return; } - - /* 鍏佽鎻愮幇 鎿嶄綔 */ + + /* 鍏佽鎻愮幇 鎿嶄綔 */ Integer integer = extractService.passExtract(id, admin); - - + Extract extract = extractService.getExtractById(id); long uid = extract.getUserInfo().getId(); if (integer == null) { JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("閫氳繃")); - - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" - + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛 + + LogHelper + .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛 } else if (integer == 1) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ瀵硅薄")); - - - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪"); + + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪"); String title = "浣犵殑鎻愮幇鐢宠琚┏鍥�"; String content = "闈炲父閬楁喚锛屼綘鐨勬彁鐜扮敵璇疯椹冲洖銆傛垜浠�氳繃鏍稿鍙戠幇浣犵殑璐︾洰鏄庣粏鏈夎锛屾垜浠細鍦ㄥ璁″畬鎴愪箣鍚庣粰浣犲彂閫氱煡娑堟伅銆傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } else { - JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("璇ョ姸鎬佷笉绛変簬涓嶄负鍒濆鐘舵��")); - - - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�"); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ姸鎬佷笉绛変簬涓嶄负鍒濆鐘舵��")); + + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鍚屾剰鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�"); String title = "浣犵殑鎻愮幇鐢宠涓嶆垚鍔�"; String content = "璇风‘淇濅綘鐨勬彁鐜拌处鎴风殑闅愮璁剧疆涓� 鍏佽閭銆佹墜鏈哄彿銆佷細鍛樺悕鎵惧埌鎴戙�傚惁鍒欐棤娉曟垚鍔熷畬鎴愯浆璐︺�傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } - + } - + /** * * 鏂规硶璇存槑: 鎷掔粷鎻愮幇璇锋眰 @@ -240,40 +230,37 @@ * @param request */ @RequestMapping(value = "rejectExtract", method = RequestMethod.POST) - public void rejectExtract(String callback ,long id, String reason, PrintWriter out, - HttpServletRequest request) { - AdminUser admin = (AdminUser) request.getSession().getAttribute( - Constant.SESSION_ADMIN); - + public void rejectExtract(String callback, long id, String reason, PrintWriter out, HttpServletRequest request) { + AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); + Extract extract = extractService.getExtractById(id); long uid = extract.getUserInfo().getId(); long extractTime = extract.getExtractTime(); try { extractService.rejectExtract(id, reason, extractTime, admin);// 鎻愮幇澶辫触 - + // 璋冪敤鎺ㄩ�佺珯鍐呬俊缁欑敤鎴� out.print(JsonUtil.loadTrueResult("鎷掔粷")); - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" - + admin.getName() + "鎷掔粷浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!鎷掔粷鍘熷洜鏄�" - + reason); + LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "鎷掔粷浜哰id=" + id + + "]鐨勬彁鐜扮敵璇�!鎷掔粷鍘熷洜鏄�" + reason); String title = "浣犵殑鎻愮幇鐢宠琚┏鍥�"; String content = "闈炲父閬楁喚锛屼綘鐨勬彁鐜扮敵璇疯椹冲洖銆傛垜浠�氳繃鏍稿鍙戠幇浣犵殑璐︾洰鏄庣粏鏈夎锛屾垜浠細鍦ㄥ璁″畬鎴愪箣鍚庣粰浣犲彂閫氱煡娑堟伅銆傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } catch (ObjectStateException e) { - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�!"); // - + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�!"); // + out.print(JsonUtil.loadFalseResult(e.getMessage())); } catch (NotExistObjectException e) { - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪!"); - + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪!"); + out.print(JsonUtil.loadFalseResult(e.getMessage())); } } - + /** * * 鏂规硶璇存槑: 鎷掔粷鎻愮幇璇锋眰jsonP @@ -285,54 +272,52 @@ * @param request */ @RequestMapping(value = "rejectExtractJP") - public void rejectExtractJP(String callback ,Long id,String code, String reason, PrintWriter out, + public void rejectExtractJP(String callback, Long id, String code, String reason, PrintWriter out, HttpServletRequest request) { - /* 妫�楠屾槸鍚︾櫥闄� */ + /* 妫�楠屾槸鍚︾櫥闄� */ AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); if (admin == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄�")); return; - } - - - /* 妫�楠屾槸鍚﹂�氳繃楠岃瘉 */ - String codeType = (String)request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); + } + + /* 妫�楠屾槸鍚﹂�氳繃楠岃瘉 */ + String codeType = (String) request.getSession().getAttribute(Constant.SESSION_EXTRACT_VERIFY_RESULT); if (!"1".equals(codeType)) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3,"閭楠岃瘉鏈�氳繃")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(3, "閭楠岃瘉鏈�氳繃")); return; } - - - /* 鎷掔粷鎻愮幇 鎿嶄綔 */ + + /* 鎷掔粷鎻愮幇 鎿嶄綔 */ try { Extract extract = extractService.getExtractById(id); long extractTime = extract.getExtractTime(); extractService.rejectExtract(id, reason, extractTime, admin);// 鎻愮幇澶辫触 - - JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult("鎷掔粷")); - + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎷掔粷")); + // 璋冪敤鎺ㄩ�佺珯鍐呬俊缁欑敤鎴� - //out.print(JsonUtil.loadTrueResult("鎷掔粷")); - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]"+ admin.getName() + - "鎷掔粷浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!鎷掔粷鍘熷洜鏄�" + reason); + // out.print(JsonUtil.loadTrueResult("鎷掔粷")); + LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "鎷掔粷浜哰id=" + id + + "]鐨勬彁鐜扮敵璇�!鎷掔粷鍘熷洜鏄�" + reason); String title = "浣犵殑鎻愮幇鐢宠琚┏鍥�"; String content = "闈炲父閬楁喚锛屼綘鐨勬彁鐜扮敵璇疯椹冲洖銆傛垜浠�氳繃鏍稿鍙戠幇浣犵殑璐︾洰鏄庣粏鏈夎锛屾垜浠細鍦ㄥ璁″畬鎴愪箣鍚庣粰浣犲彂閫氱煡娑堟伅銆傚鏈夌枒闂鑱旂郴瀹㈡湇銆�"; // xingePushController.pushSystemZnx(uid, title, content, out); } catch (ObjectStateException e) { - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�!"); // - + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�!"); // + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); - + } catch (NotExistObjectException e) { - LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" - + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪!"); - + LogHelper.userInfo( + "[ip:" + IPUtil.getRemotIP(request) + "][绠$悊鍛�:" + admin.getName() + "] 鎷掔粷鎻愮幇id=" + id + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪!"); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); } - + } /** @@ -345,6 +330,14 @@ 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) { @@ -394,8 +387,8 @@ * @param out */ @RequestMapping(value = "getFinishRecordList") - public void getFinishRecordList(String callback, Integer pageIndex, - String key, String startTime, String endTime, PrintWriter out) { + public void getFinishRecordList(String callback, Integer pageIndex, String key, String startTime, String endTime, + PrintWriter out) { try { @@ -418,23 +411,23 @@ endTime = sdf.format(c.getTime()); - if (pageIndex == null) + if (pageIndex == null) pageIndex = 1; - + int pageSize = Constant.PAGE_SIZE; - List<ExtractAuditRecord> auditList = extractAuditRecordService.getList(pageIndex, - pageSize, key, startTime, endTime); + List<ExtractAuditRecord> auditList = extractAuditRecordService.getList(pageIndex, pageSize, key, startTime, + endTime); int count = extractAuditRecordService.getCount(key, startTime, endTime); int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); if (auditList == null || auditList.size() == 0) { - out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"))); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"))); } else { - - for (ExtractAuditRecord extractAuditRecord: auditList) { + + for (ExtractAuditRecord extractAuditRecord : auditList) { int countByUid = 0; int countCancel = 0; Extract extract = extractAuditRecord.getExtract(); @@ -444,31 +437,26 @@ countByUid = hongBaoService.getCountByUid(id); countCancel = hongBaoService.getCountCancelByUid(id); } - extractAuditRecord.setCancelOrderNum((long)countCancel); - extractAuditRecord.setOrderNum((long)countByUid); + extractAuditRecord.setCancelOrderNum((long) countCancel); + extractAuditRecord.setOrderNum((long) countByUid); } - - + JSONObject data = new JSONObject(); - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); //閲嶇偣 + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); // 閲嶇偣 Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); - + data.put("pe", pe); data.put("auditList", gson.toJson(auditList)); - - out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadTrueResult(data))); + + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); } - } catch (Exception e) { e.printStackTrace(); - out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); } } - - - /** * 鏌ヨ瀹㈡湇涓汉鎻愮幇瀹℃壒璁板綍淇℃伅 @@ -486,17 +474,18 @@ * @param request */ @RequestMapping(value = "getMyAuditedList") - public void getMyAuditedList(String callback, Integer pageIndex,String key, String timeSlot, Integer state, - PrintWriter out,HttpServletRequest request) { + public void getMyAuditedList(String callback, Integer pageIndex, String key, String timeSlot, Integer state, + PrintWriter out, HttpServletRequest request) { try { - - //AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); - //if (admin == null) { - // JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄�")); - // return; - //} - + + // AdminUser admin = (AdminUser) + // request.getSession().getAttribute(Constant.SESSION_ADMIN); + // if (admin == null) { + // JsonUtil.printMode(out, callback, + // JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄�")); + // return; + // } int pageSize = Constant.PAGE_SIZE; @@ -505,49 +494,49 @@ days = 0; // 浠婃棩 } else if (THREE.equals(timeSlot)) { days = 3; // 鍓�3澶� - }else if (AWEEK.equals(timeSlot)) { + } else if (AWEEK.equals(timeSlot)) { days = 7; // 鍓�7澶� - } - - if (state != null && state != 0 && state != 1 && state != 2 ) { + } + + if (state != null && state != 0 && state != 1 && state != 2) { state = null; } - - + // 鏌ヨ褰撳墠浜哄憳鐨勫鏍稿垪琛ㄤ俊鎭� - //Long adminId = admin.getId(); - //auditList = extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, pageSize, key,state, adminId, days); - //count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, adminId,days); - - + // Long adminId = admin.getId(); + // auditList = + // extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, + // pageSize, key,state, adminId, days); + // count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, + // state, adminId,days); + // 鏆備笉鍖哄垎璐﹀彿锛岄粯璁ゆ墍鏈� - List<ExtractAuditRecord> auditList = extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, - pageSize, key,state, null, days); + List<ExtractAuditRecord> auditList = extractAuditRecordService.getMyAuditedTimeSlotList(pageIndex, pageSize, + key, state, null, days); if (auditList == null || auditList.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); return; } - + for (ExtractAuditRecord record : auditList) { AdminUser adminUser = record.getAdminUser(); if (adminUser == null) { record.setAdminUser(new AdminUser()); } } - - - int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days); + + int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days); int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; - PageEntity pe = new PageEntity(pageIndex, pageSize, count,totalPage); - - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); + 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("list", gson.toJson(auditList)); - + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { @@ -562,27 +551,25 @@ * @param out */ @RequestMapping(value = "getMyAuditedCount") - public void getMyAuditedCount(String callback, HttpServletRequest request, - PrintWriter out) { + public void getMyAuditedCount(String callback, HttpServletRequest request, PrintWriter out) { - AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); - + if (admin == null) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��"))); } else { Long adminId = admin.getId(); - + int taskToday = extractCountService.countTodayApply(); - //int countTodayComplete = extractService.countTodayComplete(); - + // int countTodayComplete = extractService.countTodayComplete(); + // 浠婃棩绱澶勭悊鏁版嵁 int countToday = extractAuditRecordService.getMyAuditedCountToday(adminId); // 鏈懆绱澶勭悊鏁版嵁 int countWeek = extractAuditRecordService.getMyAuditedCountWeek(adminId); // 鏈湀绱澶勭悊鏁版嵁 int countMonth = extractAuditRecordService.getMyAuditedCountMonth(adminId); - + JSONObject data = new JSONObject(); data.put("adminUser", admin); data.put("taskToday", taskToday); @@ -593,20 +580,21 @@ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); } - } - + /** * 瀹㈡湇浠诲姟椤甸潰灞曠ず鏁版嵁锛氫紶鍏ユ彁鐜扮敵璇穒d 鍒欐樉绀哄綋鍓嶇敵璇凤紝鑻ユ棤id鍒欐樉绀哄鏈嶄换鍔′笅绗竴涓敵璇锋暟鎹� + * * @param callback - * @param extractId 鎻愮幇id + * @param extractId + * 鎻愮幇id * @param request * @param out */ @RequestMapping(value = "getIaskInfo") public void getIaskInfo(String callback, Long extractId, HttpServletRequest request, PrintWriter out) { try { - + String surplusTime = ""; JSONObject data = new JSONObject(); Extract extract = new Extract(); @@ -615,30 +603,31 @@ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠璐︽埛澶辨晥,璇烽噸鏂扮櫥闄嗐��"))); return; } - + if (extractId != null) { - /* 浼犲叆鎻愮幇鐢宠id 鏌ヨ鍓嶅鏈嶄换鍔℃暟鎹� */ - + /* 浼犲叆鎻愮幇鐢宠id 鏌ヨ鍓嶅鏈嶄换鍔℃暟鎹� */ + extract = extractService.selectByPrimaryKey(extractId); if (extract == null) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("褰撳墠鐢宠宸蹭笉瀛樺湪"))); return; } - + // 褰撳墠浠诲姟鎸囧畾涓鸿璐︽埛澶勭悊 - /*extract.setAdminId(admin.getId()); - extractService.updateByPrimaryKeySelective(extract);*/ - - + /* + * extract.setAdminId(admin.getId()); + * extractService.updateByPrimaryKeySelective(extract); + */ + BigDecimal beforeMoney = null; - List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); + List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); if (records != null && records.size() > 0) { ExtractAuditRecord extractAuditRecord = records.get(0); if (extractAuditRecord != null) { beforeMoney = extractAuditRecord.getBeforeMoney(); } } - + Long extractTime = extract.getExtractTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(extractTime); @@ -648,203 +637,206 @@ Date todayTime = new Date(); String formattodayTime = sdf.format(todayTime); String formatTime = sdf.format(c.getTime()); - + long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); if (diff <= 0) { surplusTime = "宸茶秴鏃�"; - } else { - surplusTime = DateUtil.dateDiff(formattodayTime,formatTime); + } else { + surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); } - + data.put("extract", extract); data.put("beforeMoney", beforeMoney); data.put("surplusTime", surplusTime); - + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - + } else { - /* 鏈紶鍏ユ彁鐜扮敵璇穒d 鏌ヨ褰撳墠瀹㈡湇浠诲姟 涓殑绗竴涓� 鏁版嵁 */ - + /* 鏈紶鍏ユ彁鐜扮敵璇穒d 鏌ヨ褰撳墠瀹㈡湇浠诲姟 涓殑绗竴涓� 鏁版嵁 */ + boolean newTask = false; - + // 鏌ヨ涔嬪墠鏈鐞嗗畬鐨勪换鍔� extract = extractService.getMyTaskInfo(admin.getId()); - + if (extract == null) { // 鏂颁换鍔� extract = extractService.getNewTaskInfo(); - if (extract != null) + if (extract != null) newTask = true; } - - + if (extract == null) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏆傛棤鐢ㄦ埛鎻愮幇鐢宠"))); } else { - + if (newTask) { // 褰撳墠浠诲姟鎸囧畾涓鸿璐︽埛澶勭悊 - /*extract.setAdminId(admin.getId()); - - extractService.updateByPrimaryKeySelective(extract);*/ + /* + * extract.setAdminId(admin.getId()); + * + * extractService.updateByPrimaryKeySelective(extract); + */ } - + BigDecimal beforeMoney = null; - - List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); + + List<ExtractAuditRecord> records = extractAuditRecordService.getbyExtractId(extract.getId()); if (records != null && records.size() > 0) { ExtractAuditRecord extractAuditRecord = records.get(0); if (extractAuditRecord != null) { beforeMoney = extractAuditRecord.getBeforeMoney(); } } - - + Long extractTime = extract.getExtractTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(extractTime); - + Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.DAY_OF_MONTH, 3);// 浠婂ぉ+3澶� Date todayTime = new Date(); - + String formattodayTime = sdf.format(todayTime); String formatTime = sdf.format(c.getTime()); - + long diff = sdf.parse(formatTime).getTime() - sdf.parse(formattodayTime).getTime(); if (diff <= 0) { surplusTime = "宸茶秴鏃�"; - } else { - surplusTime = DateUtil.dateDiff(formattodayTime,formatTime); + } else { + surplusTime = DateUtil.dateDiff(formattodayTime, formatTime); } - - + data.put("extract", extract); data.put("beforeMoney", beforeMoney); data.put("surplusTime", surplusTime); - + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); } - + } - + } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } - + /** * 鏌ヨ鐢ㄦ埛鍘嗗彶鎻愮幇璁板綍 + * * @param callback - * @param pageIndex 椤电爜 - * @param key 鐢ㄦ埛id + * @param pageIndex + * 椤电爜 + * @param key + * 鐢ㄦ埛id * @param request * @param out */ @RequestMapping(value = "getByUidList") - public void getByUidList(String callback, Integer pageIndex, Long uid, HttpServletRequest request, PrintWriter out) { + public void getByUidList(String callback, Integer pageIndex, Long uid, HttpServletRequest request, + PrintWriter out) { try { if (uid == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢ㄦ埛涓嶅瓨鍦�")); return; } - - if (pageIndex == null) + + if (pageIndex == null) pageIndex = 1; - + int pageSize = Constant.PAGE_SIZE; - + List<ExtractAuditRecord> list = extractAuditRecordService.getByUidList(pageIndex, pageSize, uid); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鎻愮幇璁板綍")); return; } - + int count = extractAuditRecordService.getByUidCount(uid); int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); - - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); //閲嶇偣 + + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); // 閲嶇偣 Gson gson = gsonBuilder.create(); - + JSONObject data = new JSONObject(); data.put("pe", pe); data.put("list", gson.toJson(list)); - + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - + } catch (Exception e) { // TODO: handle exception JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); e.printStackTrace(); } } - - + /** * 鏁伴噺缁熻 + * * @param callback - * @param uid 鐢ㄦ埛id + * @param uid + * 鐢ㄦ埛id * @param request * @param out */ @RequestMapping(value = "countByUid") public void countByUid(String callback, Long uid, HttpServletRequest request, PrintWriter out) { - + try { - - // 缁熻宸查鍙栭噾棰� 璐︽埛鍘嗗彶鎬绘敹鐩� + + // 缁熻宸查鍙栭噾棰� 璐︽埛鍘嗗彶鎬绘敹鐩� double receiveMoneys = hongBaoService.countReceiveMoneysByUid(uid); - + // 鍘嗗彶鎻愮幇鎴愬姛閲戦 double successMoneys = extractCountService.countSuccessMoneysByUid(uid); - + // 鍘嗗彶鎻愮幇鎬绘鏁般�佹垚鍔熸鏁般�佸け璐ユ鏁� - Map<String, Object> map = extractCountService.countRecordsByUid(uid); - - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); + Map<String, Object> map = extractCountService.countRecordsByUid(uid); + + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); Gson gson = gsonBuilder.create(); - + JSONObject data = new JSONObject(); data.put("map", gson.toJson(map)); data.put("successMoneys", gson.toJson(successMoneys)); data.put("receiveMoneys", gson.toJson(receiveMoneys)); - + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - + } catch (Exception e) { // TODO: handle exception JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); e.printStackTrace(); } } - - + /** * 鏍规嵁鐢ㄦ埛id鏌ヨ鐩稿簲璁㈠崟鍒楄〃 * * @param callback * @param pageIndex - * @param key 鐢ㄦ埛id + * @param key + * 鐢ㄦ埛id * @param out */ @RequestMapping(value = "getOrderRecordList") - public void getOrderRecordList(String callback, Integer pageIndex, Integer pageSize, Long key, - String startTime, String endTime, PrintWriter out) { + public void getOrderRecordList(String callback, Integer pageIndex, Integer pageSize, Long key, String startTime, + String endTime, PrintWriter out) { try { - + if (key == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏈幏鍙栧埌鐢ㄦ埛id")); return; } - - + if (!StringUtil.isNullOrEmpty(endTime)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date enddate = sdf.parse(endTime); @@ -854,147 +846,134 @@ endTime = sdf.format(c.getTime()); } - if(pageIndex == null) + if (pageIndex == null) pageIndex = 1; - - if(pageSize == null) + + if (pageSize == null) pageSize = Constant.PAGE_SIZE; - - + List<HongBao> list = hongBaoService.selectOrderByUid(pageIndex, pageSize, key, startTime, endTime); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ敤鎴锋棤璁㈠崟璁板綍")); return; - } - - + } + Map<String, List<TaoBaoWeiQuanOrder>> wq = new HashMap<String, List<TaoBaoWeiQuanOrder>>(); - for (HongBao hongBao :list) { + for (HongBao hongBao : list) { String orderId = hongBao.getOrderId(); - + List<TaoBaoWeiQuanOrder> weiQuanList = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId); if (weiQuanList != null && weiQuanList.size() > 0) { wq.put(orderId, weiQuanList); } } - - - - /* 楠岃瘉缃戠粶: */ + + /* 楠岃瘉缃戠粶: */ StringBuffer auctionIdBuf = new StringBuffer(); - - List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>(); - + + List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>(); + for (HongBao hongBao : list) { - Map<String,Object> map = new HashMap<String,Object>(); - + Map<String, Object> map = new HashMap<String, Object>(); + Long preGettime = hongBao.getPreGettime(); Long getTime = hongBao.getGetTime(); Integer state = hongBao.getState(); Integer type = hongBao.getType(); String orderId = hongBao.getOrderId(); - + // 鍗曠瑪鏀剁泭閲戦 BigDecimal money = hongBao.getMoney(); - - - map.put("getTime",getTime); - + + map.put("getTime", getTime); + // 瀛愯鍗曞彿 String orderItemId = ""; - map.put("orderItemId",orderItemId); - - - - /* 璁㈠崟鐘舵�佸垽鏂細1 璁㈠崟宸蹭粯娆� 2銆佽鍗曞凡缁撶畻 4銆佽鍗曞け鏁� */ + map.put("orderItemId", orderItemId); + + /* 璁㈠崟鐘舵�佸垽鏂細1 璁㈠崟宸蹭粯娆� 2銆佽鍗曞凡缁撶畻 4銆佽鍗曞け鏁� */ if (state == HongBao.STATE_SHIXIAO) { - map.put("orderState",4); // 璁㈠崟澶辨晥 + map.put("orderState", 4); // 璁㈠崟澶辨晥 } else if (state == HongBao.STATE_BUKELINGQU) { Integer orderState = null; - + if (type == HongBao.TYPE_SHARE_GOODS) { - // 鍒嗕韩璁㈠崟 + // 鍒嗕韩璁㈠崟 Long hongbaoId = hongBao.getId(); PidOrder pidOrder = pidOrderService.getPidOrderByHongBaoId(hongbaoId); String pidstate = pidOrder.getState(); if ("璁㈠崟浠樻".equals(pidstate)) { orderState = 1; } else if ("璁㈠崟缁撶畻".equals(pidstate)) { - orderState = 2; + orderState = 2; } else if ("璁㈠崟澶辨晥".equals(pidstate)) { orderState = 4; } } else { - if (preGettime != null && preGettime > 0) { + if (preGettime != null && preGettime > 0) { orderState = 2; // 璁㈠崟缁撶畻 } else { orderState = 1; // 璁㈠崟宸蹭粯娆� } } - map.put("orderState",orderState); - + map.put("orderState", orderState); + } else if (state == HongBao.STATE_KELINGQU || state == HongBao.STATE_YILINGQU) { - map.put("orderState",2); // 璁㈠崟缁撶畻 + map.put("orderState", 2); // 璁㈠崟缁撶畻 } - - - /* 璁㈠崟杩斿埄鐘舵�侊細 2鏈埌璐� 3宸插埌璐� 4宸插け鏁� */ - - if (HongBao.STATE_YILINGQU == state ) { - map.put("moneyState",3); //宸插埌璐� + + /* 璁㈠崟杩斿埄鐘舵�侊細 2鏈埌璐� 3宸插埌璐� 4宸插け鏁� */ + + if (HongBao.STATE_YILINGQU == state) { + map.put("moneyState", 3); // 宸插埌璐� } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) { - map.put("moneyState",2); // 鏈埌璐� + map.put("moneyState", 2); // 鏈埌璐� } else { - map.put("moneyState",4); // 宸插け鏁� + map.put("moneyState", 4); // 宸插け鏁� } - - - - /* 璁㈠崟绫诲瀷锛�1绯荤粺绾㈠寘 2銆佽嚜璐鍗� 3銆侀個璇疯鍗� 4 鍒嗕韩璁㈠崟 */ + + /* 璁㈠崟绫诲瀷锛�1绯荤粺绾㈠寘 2銆佽嚜璐鍗� 3銆侀個璇疯鍗� 4 鍒嗕韩璁㈠崟 */ int rebateSource = 0; - if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN ) { - // 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 - rebateSource = 1; - } else if(type == HongBao.TYPE_JINGDONG ||type == HongBao.TYPE_TAOBAO) { - // 鑷喘璁㈠崟 + if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) { + // 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 + rebateSource = 1; + } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) { + // 鑷喘璁㈠崟 rebateSource = 2; - } else if (type == HongBao.TYPE_YAOQING || type == HongBao.TYPE_YIJI || - type == HongBao.TYPE_ERJI || type == HongBao.TYPE_SHARE_ERJI || - type == HongBao.TYPE_SHARE_YIJI) { + } else if (type == HongBao.TYPE_YAOQING || type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI + || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) { // 閭�璇蜂汉鑷喘璁㈠崟+閭�璇蜂汉鍒嗕韩璁㈠崟 rebateSource = 3; } else if (type == HongBao.TYPE_SHARE_GOODS) { - // 鍒嗕韩璁㈠崟 + // 鍒嗕韩璁㈠崟 rebateSource = 4; } - map.put("rebateSource",rebateSource); - - + map.put("rebateSource", rebateSource); + // 鑾峰彇璁㈠崟淇℃伅 Map<String, Object> inMap = getOrderItem(hongBao); - + OrderItem orderItem = (OrderItem) inMap.get("orderItem"); - Long endtime = (Long) inMap.get("endtime"); + Long endtime = (Long) inMap.get("endtime"); Long thirdCreateTime = (Long) inMap.get("thirdCreateTime"); - - /* 鍒濆鍖� 绌哄��*/ + + /* 鍒濆鍖� 绌哄�� */ if (orderItem == null) { orderItem = new OrderItem(); - map.put("goodsStae","-1"); - } - - // 璁㈠崟鏉ユ簮 0 鏃� 1娣樺疂 2 浜笢 - map.put("orderSource",1); - + map.put("goodsStae", "-1"); + } + + // 璁㈠崟鏉ユ簮 0 鏃� 1娣樺疂 2 浜笢 + map.put("orderSource", 1); + // 褰撳墠瀹為檯杩斿埄閲戦 orderItem.setFanMoney(money); - + String itemOrderId = orderItem.getOrderId(); // 绾㈠寘瀵瑰簲璁㈠崟鍙� if (StringUtil.isNullOrEmpty(itemOrderId)) orderItem.setOrderId(orderId); - - + Long auctionId = orderItem.getAuctionId(); if (auctionId != null) { auctionIdBuf.append(auctionId + ","); @@ -1006,126 +985,120 @@ Long auctionId2 = taoBaoOrder.getAuctionId(); orderItem.setAuctionId(auctionId2); auctionIdBuf.append(auctionId + ","); - + orderItem.setPayMoney(taoBaoOrder.getPayment()); orderItem.setTitle(taoBaoOrder.getTitle()); - + String settlementTime = taoBaoOrder.getSettlementTime(); - + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - if (!StringUtil.isNullOrEmpty(settlementTime)){ + if (!StringUtil.isNullOrEmpty(settlementTime)) { Date settleDate = sdf.parse(settlementTime); - endtime =settleDate.getTime(); + endtime = settleDate.getTime(); } - + String createTime = taoBaoOrder.getCreateTime(); - if (!StringUtil.isNullOrEmpty(createTime)){ + if (!StringUtil.isNullOrEmpty(createTime)) { Date createDate = sdf.parse(createTime); - thirdCreateTime =createDate.getTime(); + thirdCreateTime = createDate.getTime(); } - + } - + } } - - map.put("orderItem",orderItem); - + + map.put("orderItem", orderItem); + // 鏀惰揣鏃堕棿 - map.put("endtime",endtime); + map.put("endtime", endtime); // 涓嬪崟鏃堕棿 - map.put("thirdCreateTime",thirdCreateTime); - + map.put("thirdCreateTime", thirdCreateTime); + listmap.add(map); } - - - - /* 楠岃瘉缃戠粶: 鑾峰彇鍟嗗搧閾炬帴 鍥剧墖閾炬帴 */ + + /* 楠岃瘉缃戠粶: 鑾峰彇鍟嗗搧閾炬帴 鍥剧墖閾炬帴 */ List<TaoBaoGoodsBrief> goodsBriefList = null; if (auctionIdBuf != null && auctionIdBuf.length() > 0) { String auctionIds = auctionIdBuf.toString(); - - String ids = auctionIds.substring(0, auctionIds.length() -1); + + String ids = auctionIds.substring(0, auctionIds.length() - 1); goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids); } - - List<Map<String,Object>> listResult = new ArrayList<Map<String,Object>>(); - - Iterator<Map<String,Object>> iterator = listmap.iterator(); + + List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>(); + + Iterator<Map<String, Object>> iterator = listmap.iterator(); while (iterator.hasNext()) { - - Map<String,Object> map = iterator.next(); - + + Map<String, Object> map = iterator.next(); + int goodsStae = 1; String auctionUrl = ""; // 鍟嗗搧閾炬帴 - + OrderItem orderItem = (OrderItem) map.get("orderItem"); Long auctionId = orderItem.getAuctionId(); - if (auctionId != null){ + if (auctionId != null) { if (goodsBriefList != null && goodsBriefList.size() > 0) { - for (TaoBaoGoodsBrief taoBaoGoodsBrief :goodsBriefList) { + for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsBriefList) { Long auctionIdTB = taoBaoGoodsBrief.getAuctionId(); if (auctionId.equals(auctionIdTB)) { - goodsStae=0;// 鍦ㄥ敭 + goodsStae = 0;// 鍦ㄥ敭 auctionUrl = taoBaoGoodsBrief.getAuctionUrl(); String pictUrl = taoBaoGoodsBrief.getPictUrl(); orderItem.setPicture(pictUrl); } } - } + } } - - map.put("goodsStae",goodsStae); // - map.put("auctionUrl",auctionUrl); // 鍟嗗搧閾炬帴 + + map.put("goodsStae", goodsStae); // + map.put("auctionUrl", auctionUrl); // 鍟嗗搧閾炬帴 listResult.add(map); - + } - - - + int count = hongBaoService.countOrderByUid(key, startTime, endTime); int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); - + // 璇ユ湡闂寸殑鎬绘敹鐩� double countProfit = hongBaoService.countProfitByUid(key, startTime, endTime); - + JSONObject data = new JSONObject(); data.put("pe", pe); data.put("countProfit", countProfit); data.put("listmap", listResult); - - out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadTrueResult(data))); - + + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadFalseResult(e.getMessage())); } } - - + /** * 鏍规嵁鐢ㄦ埛id鏌ヨ鐩稿簲璁㈠崟鍒楄〃 * * @param callback * @param pageIndex - * @param key 鐢ㄦ埛id + * @param key + * 鐢ㄦ埛id * @param out */ @RequestMapping(value = "getOrderList") - public void getOrderList(String callback, Integer pageIndex, Integer pageSize, Long key, - String startTime, String endTime, PrintWriter out) { + public void getOrderList(String callback, Integer pageIndex, Integer pageSize, Long key, String startTime, + String endTime, PrintWriter out) { try { - + if (key == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏈幏鍙栧埌鐢ㄦ埛id")); return; } - - + if (!StringUtil.isNullOrEmpty(endTime)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date enddate = sdf.parse(endTime); @@ -1135,124 +1108,118 @@ endTime = sdf.format(c.getTime()); } - if(pageIndex == null) + if (pageIndex == null) pageIndex = 1; - - if(pageSize == null) + + if (pageSize == null) pageSize = Constant.PAGE_SIZE; - - + List<HongBao> list = hongBaoService.selectOrderByUid(pageIndex, pageSize, key, startTime, endTime); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ敤鎴锋棤璁㈠崟璁板綍")); return; - } - - - - /* 楠岃瘉缃戠粶: */ + } + + /* 楠岃瘉缃戠粶: */ StringBuffer auctionIdBuf = new StringBuffer(); - - List<Map<String,Object>> listmap = new ArrayList<Map<String,Object>>(); - + + List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>(); + for (HongBao hongBao : list) { - Map<String,Object> map = new HashMap<String,Object>(); - + Map<String, Object> map = new HashMap<String, Object>(); + Long preGettime = hongBao.getPreGettime(); Long getTime = hongBao.getGetTime(); Integer state = hongBao.getState(); Integer type = hongBao.getType(); String orderId = hongBao.getOrderId(); Date balanceTime = hongBao.getBalanceTime(); - + // 鑷喘璁㈠崟id Long orderItemId = hongBao.getOrderItemId(); // 鍗曠瑪鏀剁泭閲戦 BigDecimal money = hongBao.getMoney(); - - - map.put("getTime",getTime); - map.put("orderItemId",orderItemId); - + + map.put("getTime", getTime); + map.put("orderItemId", orderItemId); + if (state == HongBao.STATE_SHIXIAO) { if (balanceTime != null) { - map.put("orderState",1); //缁存潈鎴愬姛 + map.put("orderState", 1); // 缁存潈鎴愬姛 } else { - map.put("orderState",2); //璁㈠崟澶辨晥 + map.put("orderState", 2); // 璁㈠崟澶辨晥 } } else if (state == HongBao.STATE_BUKELINGQU || state == HongBao.STATE_KELINGQU) { - if (preGettime != null && preGettime > 0) { - map.put("orderState",0); //璁㈠崟缁撶畻 + if (preGettime != null && preGettime > 0) { + map.put("orderState", 0); // 璁㈠崟缁撶畻 } else { - map.put("orderState",3); //璁㈠崟浠樻涓� 鏈粨绠� + map.put("orderState", 3); // 璁㈠崟浠樻涓� 鏈粨绠� } } else { - map.put("orderState",0); //璁㈠崟宸蹭粯娆�-宸茬粨绠� + map.put("orderState", 0); // 璁㈠崟宸蹭粯娆�-宸茬粨绠� } - - - if (HongBao.STATE_YILINGQU == state ) { - map.put("moneyState",3); //宸插埌璐� + + if (HongBao.STATE_YILINGQU == state) { + map.put("moneyState", 3); // 宸插埌璐� } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) { - map.put("moneyState",2); // 鏈埌璐� + map.put("moneyState", 2); // 鏈埌璐� } else { - map.put("moneyState",4); // 宸插け鏁� + map.put("moneyState", 4); // 宸插け鏁� } - - - - /* 1-娣樺疂璁㈠崟 2-浜笢璁㈠崟 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 5.閭�璇峰ソ鍙嬬孩鍖�(甯冨績琛楃殑) 6.涓�绾у垎閿�绾㈠寘 - 7.浜岀骇鍒嗛攢绾㈠寘 20-鍒嗕韩鍟嗗搧璁㈠崟 */ + + /* + * 1-娣樺疂璁㈠崟 2-浜笢璁㈠崟 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 5.閭�璇峰ソ鍙嬬孩鍖�(甯冨績琛楃殑) 6.涓�绾у垎閿�绾㈠寘 7.浜岀骇鍒嗛攢绾㈠寘 + * 20-鍒嗕韩鍟嗗搧璁㈠崟 + */ int rebateSource = 0; - if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN ) { - + if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) { + /* 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 */ - rebateSource = 1; - - } else if(type == HongBao.TYPE_JINGDONG ||type == HongBao.TYPE_TAOBAO) { - - /* 鑷喘璁㈠崟 */ + rebateSource = 1; + + } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) { + + /* 鑷喘璁㈠崟 */ rebateSource = 2; - + } else if (type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI || type == HongBao.TYPE_YAOQING || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) { - - /* 閭�璇疯鍗� 鍒嗛攢绾㈠寘瀵瑰簲鐨勬渶涓婄骇绾㈠寘 */ + + /* 閭�璇疯鍗� 鍒嗛攢绾㈠寘瀵瑰簲鐨勬渶涓婄骇绾㈠寘 */ rebateSource = 3; - + } else if (type == HongBao.TYPE_SHARE_GOODS) { - - /* 鍒嗕韩璁㈠崟 */ + + /* 鍒嗕韩璁㈠崟 */ rebateSource = 4; - + } - map.put("rebateSource",rebateSource); - + map.put("rebateSource", rebateSource); + // 鑾峰彇璁㈠崟淇℃伅 Map<String, Object> inMap = getOrderItem(hongBao); - + OrderItem orderItem = (OrderItem) inMap.get("orderItem"); - Long endtime = (Long) inMap.get("endtime"); + Long endtime = (Long) inMap.get("endtime"); Long thirdCreateTime = (Long) inMap.get("thirdCreateTime"); - - /* 鍒濆鍖� 绌哄��*/ + + /* 鍒濆鍖� 绌哄�� */ if (orderItem == null) { orderItem = new OrderItem(); - map.put("goodsStae","-1"); - } - - // 璁㈠崟鏉ユ簮 0 鏃� 1娣樺疂 2 浜笢 - map.put("orderSource",1); - + map.put("goodsStae", "-1"); + } + + // 璁㈠崟鏉ユ簮 0 鏃� 1娣樺疂 2 浜笢 + map.put("orderSource", 1); + // 褰撳墠瀹為檯杩斿埄閲戦 orderItem.setFanMoney(money); - + String itemOrderId = orderItem.getOrderId(); // 绾㈠寘瀵瑰簲璁㈠崟鍙� if (StringUtil.isNullOrEmpty(itemOrderId)) orderItem.setOrderId(orderId); - - + Long auctionId = orderItem.getAuctionId(); if (auctionId == null) { if (!StringUtil.isNullOrEmpty(orderId)) { @@ -1262,174 +1229,164 @@ Long auctionId2 = taoBaoOrder.getAuctionId(); orderItem.setAuctionId(auctionId2); auctionIdBuf.append(auctionId + ","); - + orderItem.setPayMoney(taoBaoOrder.getPayment()); orderItem.setTitle(taoBaoOrder.getTitle()); - + String settlementTime = taoBaoOrder.getSettlementTime(); - + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - if (!StringUtil.isNullOrEmpty(settlementTime)){ + if (!StringUtil.isNullOrEmpty(settlementTime)) { Date settleDate = sdf.parse(settlementTime); - endtime =settleDate.getTime(); + endtime = settleDate.getTime(); } - + String createTime = taoBaoOrder.getCreateTime(); - if (!StringUtil.isNullOrEmpty(createTime)){ + if (!StringUtil.isNullOrEmpty(createTime)) { Date createDate = sdf.parse(createTime); - thirdCreateTime =createDate.getTime(); + thirdCreateTime = createDate.getTime(); } - + } - + } } - - - - - map.put("orderItem",orderItem); - + + map.put("orderItem", orderItem); + // 鏀惰揣鏃堕棿 - map.put("endtime",endtime); + map.put("endtime", endtime); // 涓嬪崟鏃堕棿 - map.put("thirdCreateTime",thirdCreateTime); - + map.put("thirdCreateTime", thirdCreateTime); + listmap.add(map); } - - + int count = hongBaoService.countOrderByUid(key, startTime, endTime); int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); - + // 璇ユ湡闂寸殑鎬绘敹鐩� double countProfit = hongBaoService.countProfitByUid(key, startTime, endTime); - + JSONObject data = new JSONObject(); data.put("pe", pe); data.put("countProfit", countProfit); data.put("listmap", listmap); - - out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadTrueResult(data))); - + + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); } catch (Exception e) { e.printStackTrace(); out.print(JsonUtil.loadFalseResult(e.getMessage())); } } - - - public Map<String,Object> getOrderItem(HongBao hongBao) { - + + public Map<String, Object> getOrderItem(HongBao hongBao) { + OrderItem orderItem = null; - + Long endtime = new Long(0); Long thirdCreateTime = new Long(0); - - Map<String,Object> map = new HashMap<String,Object>(); - - + + Map<String, Object> map = new HashMap<String, Object>(); + Integer type = hongBao.getType(); if (type == null) { return map; } - - if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN ) { + + if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) { /* 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 */ - - } else if(type == HongBao.TYPE_JINGDONG ||type == HongBao.TYPE_TAOBAO) { - /* 鑷喘璁㈠崟 */ - + + } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) { + /* 鑷喘璁㈠崟 */ + Long orderItemId = hongBao.getOrderItemId(); orderItem = orderItemServcie.selectByPrimaryKey(orderItemId); - + // 涓嬪崟鏃堕棿 Order order = hongBao.getOrder(); if (order != null) { Date thirdCreateTime2 = order.getThirdCreateTime(); - if (thirdCreateTime2 != null) { + if (thirdCreateTime2 != null) { thirdCreateTime = thirdCreateTime2.getTime(); } } - - if (orderItem != null){ - + + if (orderItem != null) { + // 缁撴潫鏃堕棿 Long settlementTime = orderItem.getSettlementTime(); if (settlementTime != 0) { endtime = settlementTime; - } - - // 閫�娆炬椂闂翠笉涓虹┖ 鍒欏凡閫�娆炬椂闂翠负缁撴潫鏃堕棿 + } + + // 閫�娆炬椂闂翠笉涓虹┖ 鍒欏凡閫�娆炬椂闂翠负缁撴潫鏃堕棿 Long refundTime = orderItem.getRefundTime(); if (refundTime != 0) { endtime = refundTime; - } - + } + } - - + } else if (type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI || type == HongBao.TYPE_YAOQING || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) { - /* 閭�璇疯鍗� 鍒嗛攢绾㈠寘瀵瑰簲鐨勬渶涓婄骇绾㈠寘 */ - + /* 閭�璇疯鍗� 鍒嗛攢绾㈠寘瀵瑰簲鐨勬渶涓婄骇绾㈠寘 */ + HongBao parent = hongBao.getParent(); - + if (parent != null) { Long pid = parent.getId(); HongBao phongbao = hongBaoService.selectByPrimaryKey(pid); Map<String, Object> map2 = getOrderItem(phongbao); return map2; } - - + } else if (type == HongBao.TYPE_SHARE_GOODS) { - /* 鍒嗕韩璁㈠崟 */ - + /* 鍒嗕韩璁㈠崟 */ + Long hongbaoId = hongBao.getId(); PidOrder pidOrder = pidOrderService.getPidOrderByHongBaoId(hongbaoId); - + if (pidOrder != null) { orderItem = new OrderItem(); - + orderItem.setOrderId(pidOrder.getOrderId()); orderItem.setTitle(pidOrder.getGoodsTitle()); orderItem.setPayMoney(pidOrder.getPayMoney()); orderItem.setAuctionId(pidOrder.getAuctionId()); - + // 涓嬪崟鏃堕棿 Date createTime = pidOrder.getCreateTime(); - if (createTime != null ) { + if (createTime != null) { thirdCreateTime = createTime.getTime(); } - + // 缁撶畻鏃堕棿 Date balanceTime = pidOrder.getBalanceTime(); - if (balanceTime != null ) { + if (balanceTime != null) { endtime = balanceTime.getTime(); } - + String param = hongBao.getParam(); if (!StringUtil.isNullOrEmpty(param)) { - String picture = param.substring(11,param.length()); + String picture = param.substring(11, param.length()); if (!StringUtil.isNullOrEmpty(picture)) { - orderItem.setPicture(picture.substring(0, picture.length()-1)); + orderItem.setPicture(picture.substring(0, picture.length() - 1)); } } } } - + map.put("orderItem", orderItem); map.put("endtime", endtime); map.put("thirdCreateTime", thirdCreateTime); - + return map; - + } - - + /** * 鏍¢獙鐢ㄦ埛璧勯噾鏄惁寮傚父 * @@ -1443,14 +1400,14 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("UID涓嶈兘涓虹┖")); 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) { JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("璧勯噾姝e父")); @@ -1458,5 +1415,5 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璧勯噾寮傚父")); } } - + } -- Gitblit v1.8.0