From 069002eaf41d090335c851765c04d708870b6d55 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@MS-20170306HGUF>
Date: 星期日, 23 二月 2020 16:53:00 +0800
Subject: [PATCH] 图片排列设置
---
fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java | 1574 +++++++++++++++++++++------------------------------------
1 files changed, 592 insertions(+), 982 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 5680022..6fac641 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
@@ -1,70 +1,71 @@
package com.yeshi.fanli.controller.admin;
+import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
-
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
+import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.yeshi.utils.DateUtil;
import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.entity.wx.RedPackRecord;
+import org.yeshi.utils.wx.WXRedPackUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.controller.admin.utils.AdminUtils;
+import com.yeshi.fanli.dto.ChartTDO;
+import com.yeshi.fanli.entity.admin.count.CountUserInfo;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
-import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
-import com.yeshi.fanli.entity.bus.user.Order;
-import com.yeshi.fanli.entity.bus.user.OrderItem;
import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.common.AdminUser;
-import com.yeshi.fanli.entity.taobao.PidOrder;
-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.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.exception.ExtractException;
import com.yeshi.fanli.exception.NotExistObjectException;
import com.yeshi.fanli.exception.ObjectStateException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.count.ExtractCountService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.count.UserInfoCountService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
-import com.yeshi.fanli.service.inter.order.OrderItemServcie;
-import com.yeshi.fanli.service.inter.order.PidOrderService;
+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;
-import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
-import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
-import com.yeshi.fanli.service.inter.user.AccountMessageService;
-import com.yeshi.fanli.service.inter.user.ExtractAuditRecordService;
-import com.yeshi.fanli.service.inter.user.ExtractService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
-import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
@Controller
@RequestMapping("admin/new/api/v1/extract")
@@ -72,18 +73,15 @@
@Resource
private ExtractService extractService;
-
+
@Resource
private ConfigService configService;
-
+
@Resource
private UserInfoCountService userInfoCountService;
@Resource
private ExtractCountService extractCountService;
-
- @Resource
- private AccountMessageService accountMessageService;
@Resource
private PushRecordService pushRecordService;
@@ -95,19 +93,10 @@
private ExtractAuditRecordService extractAuditRecordService;
@Resource
- private HongBaoService hongBaoService;
-
- @Resource
private HongBaoV2CountService hongBaoV2CountService;
@Resource
private AdminUserService adminUserService;
-
- @Resource
- private OrderItemServcie orderItemServcie;
-
- @Resource
- private PidOrderService pidOrderService;
@Resource
private RedisManager redisManager;
@@ -118,64 +107,11 @@
@Resource
private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
- private final static String TODAY = "1";
- private final static String THREE = "2";
- private final static String AWEEK = "3";
+ @Resource
+ private UserInfoExtraService userInfoExtraService;
- @RequestMapping(value = "getExtractList", method = RequestMethod.POST)
- public void getExtractList(int pageIndex, PrintWriter out) {
- 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);
- JSONObject data = new JSONObject();
- data.put("pe", pe);
- data.put("extractList", extractList);
- out.print(JsonUtil.loadTrueResult(data));
- }
-
- /**
- *
- * 鏂规硶璇存槑: 閫氳繃鎻愮幇璇锋眰
- *
- * @author mawurui createTime 2018骞�3鏈�14鏃� 涓嬪崍3:15:42
- * @param id
- * @param out
- * @param request
- */
- @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);
-
- 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 + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛
- } else if (integer == 1) {
-
- out.print(JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ瀵硅薄")); // 鍚屾剰涔嬪悗澶辫触
- 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 + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�");
- out.print(JsonUtil.loadFalseResult("璇ョ姸鎬佷笉绛変簬涓嶄负鍒濆鐘舵��"));
- String title = "浣犵殑鎻愮幇鐢宠涓嶆垚鍔�";
- String content = "璇风‘淇濅綘鐨勬彁鐜拌处鎴风殑闅愮璁剧疆涓� 鍏佽閭銆佹墜鏈哄彿銆佷細鍛樺悕鎵惧埌鎴戙�傚惁鍒欐棤娉曟垚鍔熷畬鎴愯浆璐︺�傚鏈夌枒闂鑱旂郴瀹㈡湇銆�";
- // xingePushController.pushSystemZnx(uid, title, content, out);
- }
- }
+ @Resource
+ private CommonOrderCountService commonOrderCountService;
/**
*
@@ -207,74 +143,21 @@
/* 鍏佽鎻愮幇 鎿嶄綔 */
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("閫氳繃"));
-
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("宸查�氳繃"));
LogHelper
- .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!"); // 鍚屾剰涔嬪悗鎴愬姛
+ .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "閫氳繃浜哰id=" + id + "]鐨勬彁鐜扮敵璇�!");
} else if (integer == 1) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ瀵硅薄"));
-
+ 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);
} else {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇ョ姸鎬佷笉绛変簬涓嶄负鍒濆鐘舵��"));
-
+ 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);
}
- }
-
- /**
- *
- * 鏂规硶璇存槑: 鎷掔粷鎻愮幇璇锋眰
- *
- * @author mawurui createTime 2018骞�3鏈�14鏃� 涓嬪崍3:15:55
- * @param id
- * @param reason
- * @param out
- * @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);
-
- 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);
-
- String title = "浣犵殑鎻愮幇鐢宠琚┏鍥�";
- String content = "闈炲父閬楁喚锛屼綘鐨勬彁鐜扮敵璇疯椹冲洖銆傛垜浠�氳繃鏍稿鍙戠幇浣犵殑璐︾洰鏄庣粏鏈夎锛屾垜浠細鍦ㄥ璁″畬鎴愪箣鍚庣粰浣犲彂閫氱煡娑堟伅銆傚鏈夌枒闂鑱旂郴瀹㈡湇銆�";
- // xingePushController.pushSystemZnx(uid, title, content, out);
- } catch (ObjectStateException e) {
- 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 + "鐨勬彁鐜扮敵璇蜂笉瀛樺湪!");
-
- out.print(JsonUtil.loadFalseResult(e.getMessage()));
- }
}
/**
@@ -304,23 +187,22 @@
return;
}
- /* 鎷掔粷鎻愮幇 鎿嶄綔 */
+ try {
+ // 缂栫爜杞崲
+ reason = URLDecoder.decode(reason, "UTF-8");
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
try {
- Extract extract = extractService.getExtractById(id);
- long extractTime = extract.getExtractTime();
- extractService.rejectExtract(id, reason, extractTime, admin);// 鎻愮幇澶辫触
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎷掔粷"));
+ extractService.rejectExtract(id, reason, admin);// 鎻愮幇澶辫触
- // 璋冪敤鎺ㄩ�佺珯鍐呬俊缁欑敤鎴�
- // out.print(JsonUtil.loadTrueResult("鎷掔粷"));
+ JsonUtil.printMode(out, callback, 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 + "鐨勬彁鐜扮敵璇风姸鎬佸紓甯�!"); //
@@ -337,24 +219,6 @@
}
/**
- * 璧勯噾鏍¢獙鏄惁寮傚父
- *
- * @param uid
- * @param out
- */
- @RequestMapping(value = "checkExtract", method = RequestMethod.POST)
- public void checkExtract(String uid, PrintWriter out) {
- JSONObject data = new JSONObject();
- try {
- extractService.checkExtract(uid);
- data.put("code", "1"); // 姝e父
- } catch (ExtractException e) {
- data.put("code", "0");// 寮傚父
- }
- out.print(data);
- }
-
- /**
* 鑾峰彇浠婃棩鎻愮幇璁板綍锛氫粖鏃ユ�婚銆佹�绘鏁般�佹垚鍔熸鏁般�佸け璐ユ鏁� 鑾峰彇绯荤粺鎻愮幇璁板綍锛氭�婚銆佹�绘鏁�
*
* @param out
@@ -366,31 +230,30 @@
// 浠婃棩鎻愮幇鎴愬姛閲戦
BigDecimal todayextractMoney = extractCountService.getTodayTotalSuccessMoney();
-
+
// 褰撳墠鐢ㄦ埛浣欓鎬昏锛氭墍鏈夌敤鎴锋�讳綑棰�
BigDecimal amountMoney = userInfoCountService.countAllMoney(null);
-
- // 鍙彁鐜伴噾棰濋檺鍒�
- String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
- if (minMoney == null){
+
+ // 鍙彁鐜伴噾棰濋檺鍒�
+ String minMoney = configService.get(ConfigKeyEnum.extractMoneyMin.getKey());
+ if (minMoney == null) {
minMoney = "0";
}
// 褰撳墠鍙彁鐜伴噾棰濇�昏锛� 瓒呰繃鏈�浣庢彁鐜伴噾棰�---璁″叆缁熻
BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney));
-
+
// 绱宸叉彁鐜伴噾棰濇�昏锛氬凡鎻愮幇鎴愬姛鐨勬�婚/ 娆℃暟
Map<String, Object> resultData = extractCountService.countTotalSuccess();
-
-
+
JSONObject data = new JSONObject();
data.put("todayCount", totalcount);
data.put("todayextractMoney", todayextractMoney);
-
+
data.put("amountMoney", amountMoney); // 鎵�鏈夌敤鎴锋�讳綑棰�
data.put("extractApply", extractApply); // 鍙彁鐜伴噾棰濇�昏
data.put("extractNumber", resultData.get("totalamount")); // 鎻愮幇鎴愬姛娆℃暟
data.put("extractMoney", resultData.get("totalmoney")); // 鎻愮幇鎴愬姛閲戦
-
+
out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
}
@@ -452,8 +315,8 @@
if (extract != null) {
UserInfo userInfo = extract.getUserInfo();
Long id = userInfo.getId();
- countByUid = hongBaoService.getCountByUid(id);
- countCancel = hongBaoService.getCountCancelByUid(id);
+ countByUid = hongBaoV2CountService.countNumberByUid(id);
+ countCancel = hongBaoV2CountService.countNumberByUidAndState(id, HongBaoV2.STATE_SHIXIAO);
}
extractAuditRecord.setCancelOrderNum((long) countCancel);
extractAuditRecord.setOrderNum((long) countByUid);
@@ -506,13 +369,12 @@
// }
int pageSize = Constant.PAGE_SIZE;
-
Integer days = null;
- if (TODAY.equals(timeSlot)) {
+ if ("1".equals(timeSlot)) {
days = 0; // 浠婃棩
- } else if (THREE.equals(timeSlot)) {
+ } else if ("2".equals(timeSlot)) {
days = 3; // 鍓�3澶�
- } else if (AWEEK.equals(timeSlot)) {
+ } else if ("3".equals(timeSlot)) {
days = 7; // 鍓�7澶�
}
@@ -541,23 +403,73 @@
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();
if (extract != null) {
Integer extractState = extract.getState();
- if (extractState != null && extractState == 0) {
+ if (extractState != null && extractState == Extract.STATE_NOT_PROCESS) {
UserInfo userInfo = extract.getUserInfo();
if (userInfo != null) {
- double countTodayMoney = extractService.countTodayMoney(userInfo.getId());
- if (countTodayMoney >= 100) {
+ BigDecimal countTodayMoney = extractService.sumTodayApplyMoney(userInfo.getId(),
+ TimeUtil.getGernalTime(extract.getExtractTime()));
+ if (countTodayMoney.compareTo(new BigDecimal(100)) > 0) {
warnLevel = 1;
}
}
}
-
}
+
+ if (record.getExtraInfo() != null) {
+ StringBuffer desc = new StringBuffer();
+ if (System.currentTimeMillis() > TimeUtil.convertToTimeTemp("2019-06-21", "yyyy-MM-dd")) {
+ desc.append("澶х瑪璁㈠崟鏁�:" + record.getExtraInfo().getOrderCount50More() + "\n#");
+ desc.append("缁存潈璁㈠崟鏁�:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
+ desc.append("缁存潈璁㈠崟浣i噾:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
+ if (record.getExtraInfo().getOrderCount50More() > 0
+ || record.getExtraInfo().getWeiQuanOrderCount() > 0
+ || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(10)) >= 0)
+ warnLevel = 2;
+ } else {
+ if (record.getExtraInfo().getOrderCount50More() > 0
+ || record.getExtraInfo().getWeiQuanOrderCount() > 0
+ || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0)
+ warnLevel = 2;
+ desc.append("澶т簬50鍏冭鍗�:" + record.getExtraInfo().getOrderCount50More() + "\n#");
+ desc.append("缁存潈璁㈠崟鏁�:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
+ desc.append("缁存潈璁㈠崟閫�鍥為噾棰�:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
+ desc.append("180澶╁畨鍏ㄨ鍗曟暟:" + record.getExtraInfo().getSafeOrderCount());
+ }
+ 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(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey())));
+ // long sameShopOrderCount =
+ // commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList,
+ // record.getExtract().getUserInfo().getId(),
+ // Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey())));
+ // 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);
@@ -566,6 +478,8 @@
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.serializeNulls();
+ gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
+
Gson gson = gsonBuilder.create();
JSONObject data = new JSONObject();
@@ -578,6 +492,27 @@
e.printStackTrace();
out.print(JsonUtil.loadFalseResult(e.getMessage()));
}
+ }
+
+ @RequestMapping(value = "getMyAuditedDanger")
+ public void getMyAuditedDanger(String callback, Long uid, PrintWriter out) {
+ if (uid == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇风櫥褰�"));
+ return;
+ }
+ // 鏌ヨ鍚屽簵閾哄晢鍝侊紝鍚屽晢鍝佽鍗曡秴杩囦竴瀹氭暟閲忕殑
+ List<Integer> typeList = new ArrayList<>();
+ typeList.add(HongBaoV2.TYPE_ZIGOU);
+ long sameGoodsOrderCount = commonOrderCountService.countSameGoodsOrderByUidAndHongBaoType(typeList, uid,
+ Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameGoodsOrderCount.getKey())));
+ long sameShopOrderCount = commonOrderCountService.countSameShopOrderByUidAndHongBaoType(typeList, uid,
+ Integer.parseInt(configService.get(ConfigKeyEnum.adminMinSameShopOrderCount.getKey())));
+ if (sameGoodsOrderCount > 0 || sameShopOrderCount > 0) {
+ String text = (String.format("鍚屽簵閾�:%s 鍚屽晢鍝�:%s", sameShopOrderCount, sameGoodsOrderCount));
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(text));
+ return;
+ }
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("搴楅摵/鍟嗗搧鏃犲紓甯�"));
}
/**
@@ -680,6 +615,13 @@
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("extract", extract);
data.put("beforeMoney", beforeMoney);
data.put("surplusTime", surplusTime);
@@ -743,6 +685,13 @@
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("extract", extract);
data.put("beforeMoney", beforeMoney);
data.put("surplusTime", surplusTime);
@@ -790,6 +739,18 @@
return;
}
+ for (ExtractAuditRecord record : list) {
+
+ if (record.getExtraInfo() != null) {
+ StringBuffer desc = new StringBuffer();
+ desc.append("澶т簬50鍏冭鍗�:" + record.getExtraInfo().getOrderCount50More() + "\n#");
+ desc.append("缁存潈璁㈠崟鏁�:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
+ desc.append("缁存潈璁㈠崟閫�鍥為噾棰�:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
+ desc.append("180澶╁畨鍏ㄨ鍗曟暟:" + record.getExtraInfo().getSafeOrderCount());
+ record.setExtraInfoStr(desc.toString());
+ }
+ }
+
int count = extractAuditRecordService.getByUidCount(uid);
int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -830,7 +791,7 @@
if (receiveMoneys == null) {
receiveMoneys = new BigDecimal(0);
}
-
+
// 鍘嗗彶鎻愮幇鎴愬姛閲戦
double successMoneys = extractCountService.countSuccessMoneysByUid(uid);
@@ -855,580 +816,6 @@
}
/**
- * 鏍规嵁鐢ㄦ埛id鏌ヨ鐩稿簲璁㈠崟鍒楄〃
- *
- * @param callback
- * @param pageIndex
- * @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) {
-
- 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);
- Calendar c = Calendar.getInstance();
- c.setTime(enddate);
- c.add(Calendar.DAY_OF_MONTH, 1);// 浠婂ぉ+1澶�
- endTime = sdf.format(c.getTime());
- }
-
- if (pageIndex == null)
- pageIndex = 1;
-
- 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) {
- 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>>();
-
- for (HongBao hongBao : list) {
- 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);
-
- // 瀛愯鍗曞彿
- String orderItemId = "";
- map.put("orderItemId", orderItemId);
-
- /* 璁㈠崟鐘舵�佸垽鏂細1 璁㈠崟宸蹭粯娆� 2銆佽鍗曞凡缁撶畻 4銆佽鍗曞け鏁� */
- if (state == HongBao.STATE_SHIXIAO) {
- 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;
- } else if ("璁㈠崟澶辨晥".equals(pidstate)) {
- orderState = 4;
- }
- } else {
- if (preGettime != null && preGettime > 0) {
- orderState = 2; // 璁㈠崟缁撶畻
- } else {
- orderState = 1; // 璁㈠崟宸蹭粯娆�
- }
- }
- map.put("orderState", orderState);
-
- } else if (state == HongBao.STATE_KELINGQU || state == HongBao.STATE_YILINGQU) {
- map.put("orderState", 2); // 璁㈠崟缁撶畻
- }
-
- /* 璁㈠崟杩斿埄鐘舵�侊細 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); // 鏈埌璐�
- } else {
- map.put("moneyState", 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) {
- // 鑷喘璁㈠崟
- 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) {
- // 閭�璇蜂汉鑷喘璁㈠崟+閭�璇蜂汉鍒嗕韩璁㈠崟
- rebateSource = 3;
- } else if (type == HongBao.TYPE_SHARE_GOODS) {
- // 鍒嗕韩璁㈠崟
- rebateSource = 4;
- }
- map.put("rebateSource", rebateSource);
-
- // 鑾峰彇璁㈠崟淇℃伅
- Map<String, Object> inMap = getOrderItem(hongBao);
-
- OrderItem orderItem = (OrderItem) inMap.get("orderItem");
- 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);
-
- // 褰撳墠瀹為檯杩斿埄閲戦
- orderItem.setFanMoney(money);
-
- String itemOrderId = orderItem.getOrderId();
- // 绾㈠寘瀵瑰簲璁㈠崟鍙�
- if (StringUtil.isNullOrEmpty(itemOrderId))
- orderItem.setOrderId(orderId);
-
- Long auctionId = orderItem.getAuctionId();
- if (auctionId != null) {
- auctionIdBuf.append(auctionId + ",");
- } else {
- if (!StringUtil.isNullOrEmpty(orderId)) {
- List<TaoBaoOrder> taoBaoOrders = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
- if (taoBaoOrders != null && taoBaoOrders.size() > 0) {
- TaoBaoOrder taoBaoOrder = taoBaoOrders.get(0);
- 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)) {
- Date settleDate = sdf.parse(settlementTime);
- endtime = settleDate.getTime();
- }
-
- String createTime = taoBaoOrder.getCreateTime();
- if (!StringUtil.isNullOrEmpty(createTime)) {
- Date createDate = sdf.parse(createTime);
- thirdCreateTime = createDate.getTime();
- }
-
- }
-
- }
- }
-
- map.put("orderItem", orderItem);
-
- // 鏀惰揣鏃堕棿
- map.put("endtime", endtime);
- // 涓嬪崟鏃堕棿
- 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);
- try {
- goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- 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();
-
- int goodsStae = 1;
- String auctionUrl = ""; // 鍟嗗搧閾炬帴
-
- OrderItem orderItem = (OrderItem) map.get("orderItem");
- Long auctionId = orderItem.getAuctionId();
- if (auctionId != null) {
- if (goodsBriefList != null && goodsBriefList.size() > 0) {
- for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsBriefList) {
- Long auctionIdTB = taoBaoGoodsBrief.getAuctionId();
- if (auctionId.equals(auctionIdTB)) {
- goodsStae = 0;// 鍦ㄥ敭
- auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
- String pictUrl = taoBaoGoodsBrief.getPictUrl();
- orderItem.setPicture(pictUrl);
- }
- }
- }
- }
-
- 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)));
-
- } catch (Exception e) {
- e.printStackTrace();
- out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
- }
- }
-
- /**
- * 鏍规嵁鐢ㄦ埛id鏌ヨ鐩稿簲璁㈠崟鍒楄〃
- *
- * @param callback
- * @param pageIndex
- * @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) {
-
- 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);
- Calendar c = Calendar.getInstance();
- c.setTime(enddate);
- c.add(Calendar.DAY_OF_MONTH, 1);// 浠婂ぉ+1澶�
- endTime = sdf.format(c.getTime());
- }
-
- if (pageIndex == null)
- pageIndex = 1;
-
- 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>>();
-
- for (HongBao hongBao : list) {
- 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);
-
- if (state == HongBao.STATE_SHIXIAO) {
- if (balanceTime != null) {
- map.put("orderState", 1); // 缁存潈鎴愬姛
- } else {
- map.put("orderState", 2); // 璁㈠崟澶辨晥
- }
- } else if (state == HongBao.STATE_BUKELINGQU || state == HongBao.STATE_KELINGQU) {
- if (preGettime != null && preGettime > 0) {
- map.put("orderState", 0); // 璁㈠崟缁撶畻
- } else {
- map.put("orderState", 3); // 璁㈠崟浠樻涓� 鏈粨绠�
- }
- } else {
- map.put("orderState", 0); // 璁㈠崟宸蹭粯娆�-宸茬粨绠�
- }
-
- if (HongBao.STATE_YILINGQU == state) {
- map.put("moneyState", 3); // 宸插埌璐�
- } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) {
- map.put("moneyState", 2); // 鏈埌璐�
- } else {
- map.put("moneyState", 4); // 宸插け鏁�
- }
-
- /*
- * 1-娣樺疂璁㈠崟 2-浜笢璁㈠崟 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 5.閭�璇峰ソ鍙嬬孩鍖�(甯冨績琛楃殑) 6.涓�绾у垎閿�绾㈠寘 7.浜岀骇鍒嗛攢绾㈠寘
- * 20-鍒嗕韩鍟嗗搧璁㈠崟
- */
- 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) {
-
- /* 鑷喘璁㈠崟 */
- 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<String, Object> inMap = getOrderItem(hongBao);
-
- OrderItem orderItem = (OrderItem) inMap.get("orderItem");
- 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);
-
- // 褰撳墠瀹為檯杩斿埄閲戦
- 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)) {
- List<TaoBaoOrder> taoBaoOrders = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
- if (taoBaoOrders != null && taoBaoOrders.size() > 0) {
- TaoBaoOrder taoBaoOrder = taoBaoOrders.get(0);
- 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)) {
- Date settleDate = sdf.parse(settlementTime);
- endtime = settleDate.getTime();
- }
-
- String createTime = taoBaoOrder.getCreateTime();
- if (!StringUtil.isNullOrEmpty(createTime)) {
- Date createDate = sdf.parse(createTime);
- thirdCreateTime = createDate.getTime();
- }
-
- }
-
- }
- }
-
- map.put("orderItem", orderItem);
-
- // 鏀惰揣鏃堕棿
- map.put("endtime", endtime);
- // 涓嬪崟鏃堕棿
- 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)));
-
- } catch (Exception e) {
- e.printStackTrace();
- out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
- }
- }
-
- 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>();
-
- Integer type = hongBao.getType();
- if (type == null) {
- return map;
- }
-
- if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) {
- /* 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 */
-
- } 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) {
- thirdCreateTime = thirdCreateTime2.getTime();
- }
- }
-
- 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) {
- thirdCreateTime = createTime.getTime();
- }
-
- // 缁撶畻鏃堕棿
- Date balanceTime = pidOrder.getBalanceTime();
- if (balanceTime != null) {
- endtime = balanceTime.getTime();
- }
-
- String param = hongBao.getParam();
- if (!StringUtil.isNullOrEmpty(param)) {
- String picture = param.substring(11, param.length());
- if (!StringUtil.isNullOrEmpty(picture)) {
- orderItem.setPicture(picture.substring(0, picture.length() - 1));
- }
- }
- }
- }
-
- map.put("orderItem", orderItem);
- map.put("endtime", endtime);
- map.put("thirdCreateTime", thirdCreateTime);
-
- return map;
-
- }
-
- /**
* 鏍¢獙鐢ㄦ埛璧勯噾鏄惁寮傚父
*
* @param uid
@@ -1443,281 +830,504 @@
}
try {
- extractService.checkExtract(uid);
+ extractService.checkExtract(Long.parseLong(uid));
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("璧勯噾姝e父"));
} catch (ExtractException e) {
JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
}
}
-
/**
- * 缁熻瀹℃牳娆℃暟
+ * 缁熻瀹℃牳娆℃暟
+ *
* @param callback
- * @param state 瀹℃牳鐘舵�侊細鎵�鏈�-3 閫氳繃-1 鎷掔粷- 2
- * @param type 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�3
- * @param dateType 绫诲瀷 1鏃� 2鏈� 3骞�
- * @param year 2018
- * @param startTime 2018-12-01
- * @param endTime 2018-12-01
+ * @param state
+ * 瀹℃牳鐘舵�侊細鎵�鏈�-3 閫氳繃-1 鎷掔粷- 2
+ * @param type
+ * 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�3
+ * @param dateType
+ * 绫诲瀷 1鏃� 2鏈� 3骞�
+ * @param year
+ * 2018
+ * @param startTime
+ * 2018-12-01
+ * @param endTime
+ * 2018-12-01
* @param out
*/
@RequestMapping(value = "getAuditTotal")
- public void getAuditTotal(String callback, String stateArray, Integer dateType, String year,
- String startTime, String endTime, PrintWriter out) {
-
- String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
- if (validateMsg != null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
- return;
- }
-
- if (dateType == 1 && year != null) {
- year = null; // 璁剧疆涓虹┖
- } else if (dateType == 2) {
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
-
- } else if (dateType == 3) {
- if (year != null)
- year = null;
-
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
- }
-
+ public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime,
+ String endTime, PrintWriter out) {
try {
- Object objectDate = null;
+ String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
+ if (validateMsg != null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
+ return;
+ }
+
+ if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
+ startTime = null;
+ endTime = null;
+ }
+
+ Date beginDate = null;
+ Date endDate = null;
+
+ if (dateType == 1) {
+ beginDate = TimeUtil.parse(startTime);
+ endDate = TimeUtil.parse(endTime);
+ } else if (dateType == 2) {
+ Calendar calendar=Calendar.getInstance();
+ int currentYear = calendar.get(Calendar.YEAR);
+ if (!StringUtil.isNullOrEmpty(year)) {
+ currentYear = Integer.parseInt(year);
+ }
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ beginDate =calendar.getTime();
+
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ calendar.roll(Calendar.DAY_OF_YEAR, -1);
+ endDate=calendar.getTime();
+ } else if (dateType == 3) {
+ beginDate = TimeUtil.parse("2018-01-01");
+ endDate = new Date();
+ }
+ Gson gson = new Gson();
List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
- Gson gson = new Gson();
- List<Integer> stateList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType());
-
+ String substring = stateArray.substring(1, stateArray.length()-1);
+ List<Integer> channelList = null;
+ if (stateArray != null && stateArray.trim().length() > 4) {
+ channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType());
+ }
+
JSONArray line_list = new JSONArray();
- for (Integer state: stateList) {
- JSONObject innerList = new JSONObject();
- if (state == null || state == 3) {
- innerList.put("name", "鎬昏");
- } else if (state == 1) {
- innerList.put("name", "閫氳繃鏁�");
- } else if (state == 2) {
- innerList.put("name", "椹冲洖鏁�");
- }
-
-
- List<Map<String, Object>> list = extractAuditRecordService.countAuditTotal(state, dateType,
- year, startTime, endTime);
-
- if (dateType != 3) {
- innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType,dateList, list)));
- } else {
- // 骞磋鍥�
- Map<String, Object> map = AdminUtils.yearsDataFactory(list);
-
- if (objectDate == null) {
- objectDate = map.get("date");
+
+ if (channelList != null && channelList.size() > 0) {
+ for (Integer state : channelList) {
+ List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, state);
+ String name = "";
+ if (state == 1) {
+ name = "閫氳繃";
+ } else if (state == 2) {
+ name = "椹冲洖";
}
- innerList.put("data", gson.toJson(map.get("value")));
+ JSONObject innerList = new JSONObject();
+ innerList.put("name", name);
+ innerList.put("data", gson.toJson(list));
+ line_list.add(innerList);
}
-
+ } else {
+ List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, null);
+ JSONObject innerList = new JSONObject();
+ innerList.put("name", "鍏ㄩ儴");
+ innerList.put("data", gson.toJson(list));
line_list.add(innerList);
}
-
+
JSONObject data = new JSONObject();
- if (objectDate != null) {
- data.put("xAxis_list", gson.toJson(objectDate));
- } else {
- data.put("xAxis_list", gson.toJson(dateList));
- }
-
data.put("line_list", line_list);
-
+ data.put("xAxis_list", gson.toJson(dateList));
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
} catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("绯荤粺寮傚父"));
e.printStackTrace();
}
}
-
+ private List<Object> getAuditData(List<String> dateList, Integer dateType, Date beginDate, Date endDate,
+ Integer state) throws Exception{
+ List<Object> list = new ArrayList<>();
+ List<CountUserInfo> listHistory = extractAuditRecordService.getAuditCount(beginDate, endDate, state);
+ for (String date: dateList) {
+ int value = 0;
+ if (listHistory != null) {
+ for (CountUserInfo history: listHistory) {
+ if (dateType == 1) {
+ String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ } else if (dateType == 2){
+ String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay());
+ if(gernalTime.startsWith("0")) {
+ gernalTime = gernalTime.substring(1, 2);
+ }
+
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ } else if (dateType == 3) {
+ String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ }
+ }
+ }
+ list.add(value + "");
+ }
+
+ return list;
+ }
+
/**
* 缁熻鎻愮幇鐢宠鎬婚
+ *
* @param callback
- * @param type 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�
- * @param dateType 绫诲瀷 1鏃� 2鏈� 3
- * @param year 2018
- * @param startTime 2018-12-01
- * @param endTime 2018-12-01
+ * @param type
+ * 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�
+ * @param dateType
+ * 绫诲瀷 1鏃� 2鏈� 3
+ * @param year
+ * 2018
+ * @param startTime
+ * 2018-12-01
+ * @param endTime
+ * 2018-12-01
* @param out
*/
@RequestMapping(value = "getExtractApplyMoney")
- public void getExtractApplyMoney(String callback, Integer dateType, String year,
- String startTime, String endTime, PrintWriter out) {
-
- String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
- if (validateMsg != null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
- return;
- }
-
- if (dateType == 1 && year != null) {
- year = null; // 璁剧疆涓虹┖
- } else if (dateType == 2) {
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
-
- } else if (dateType == 3) {
- if (year != null)
- year = null;
-
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
- }
-
+ public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime,
+ PrintWriter out) {
try {
+ String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
+ if (validateMsg != null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
+ return;
+ }
- Object objectDate = null;
+ if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
+ startTime = null;
+ endTime = null;
+ }
+
+ Date beginDate = null;
+ Date endDate = null;
+ if (dateType == 1) {
+ beginDate = TimeUtil.parse(startTime);
+ endDate = TimeUtil.parse(endTime);
+ } else if (dateType == 2) {
+ Calendar calendar=Calendar.getInstance();
+ int currentYear = calendar.get(Calendar.YEAR);
+ if (!StringUtil.isNullOrEmpty(year)) {
+ currentYear = Integer.parseInt(year);
+ }
+
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ beginDate =calendar.getTime();
+
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ calendar.roll(Calendar.DAY_OF_YEAR, -1);
+ endDate=calendar.getTime();
+ } else if (dateType == 3) {
+ beginDate = TimeUtil.parse("2018-01-01");
+ endDate = new Date();
+ }
+ Gson gson = new Gson();
List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
- Gson gson = new Gson();
- JSONArray line_list = new JSONArray();
+ List<String> list = new ArrayList<>();
+ List<CountUserInfo> listHistory = extractAuditRecordService.getApplyMoney(beginDate, endDate);
+ for (String date: dateList) {
+ BigDecimal money = new BigDecimal("0");
+ if (listHistory == null) {
+ list.add(money.toString());
+ continue;
+ }
+
+ for (CountUserInfo history: listHistory) {
+ if (dateType == 1) {
+ String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ money = MoneyBigDecimalUtil.add(money, history.getMoney());
+ continue;
+ }
+ } else if (dateType == 2){
+ String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay());
+ if(gernalTime.startsWith("0")) {
+ gernalTime = gernalTime.substring(1, 2);
+ }
+ if (gernalTime.equalsIgnoreCase(date)) {
+ money = MoneyBigDecimalUtil.add(money, history.getMoney());
+ continue;
+ }
+ } else if (dateType == 3) {
+ String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ money = MoneyBigDecimalUtil.add(money, history.getMoney());
+ continue;
+ }
+ }
+ }
+ list.add(money.toString());
+ }
JSONObject innerList = new JSONObject();
- innerList.put("name", "鎬昏");
-
- List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyMoney(null, dateType,
- year, startTime, endTime);
-
- if (dateType != 3) {
- innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
- } else {
- // 骞磋鍥�
- Map<String, Object> map = AdminUtils.yearsDataFactory(list);
-
- if (objectDate == null) {
- objectDate = map.get("date");
- }
- innerList.put("data", gson.toJson(map.get("value")));
- }
-
+ innerList.put("name", "閲戦");
+ innerList.put("data", gson.toJson(list));
+
+ JSONArray line_list = new JSONArray();
line_list.add(innerList);
-
-
+
JSONObject data = new JSONObject();
- if (objectDate != null) {
- data.put("xAxis_list", gson.toJson(objectDate));
- } else {
- data.put("xAxis_list", gson.toJson(dateList));
- }
-
+ data.put("xAxis_list", gson.toJson(dateList));
data.put("line_list", line_list);
-
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
} catch (Exception e) {
JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
e.printStackTrace();
}
}
-
+
/**
* 缁熻鎻愮幇鐢宠鎬绘鏁�
+ *
* @param callback
- * @param state 鎵�鏈�-绌哄�兼垨鑰呬笉浼� 寰呭鏍�-0 閫氳繃-1 鎷掔粷- 2
- * @param type 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�
- * @param dateType 绫诲瀷 1鏃� 2鏈� 3骞�
- * @param year 2018
- * @param startTime 2018-12-01
- * @param endTime 2018-12-01
+ * @param state
+ * 鎵�鏈�-绌哄�兼垨鑰呬笉浼� 寰呭鏍�-0 閫氳繃-1 鎷掔粷- 2
+ * @param type
+ * 缁熻绫诲瀷 1-24灏忔椂 2-鎵�鏈�
+ * @param dateType
+ * 绫诲瀷 1鏃� 2鏈� 3骞�
+ * @param year
+ * 2018
+ * @param startTime
+ * 2018-12-01
+ * @param endTime
+ * 2018-12-01
* @param out
*/
@RequestMapping(value = "getExtractApplyNumber")
- public void getExtractApplyNumber(String callback,Integer state, Integer dateType, String year,
- String startTime, String endTime, PrintWriter out) {
-
- String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
- if (validateMsg != null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
- return;
- }
-
- if (dateType == 1 && year != null) {
- year = null; // 璁剧疆涓虹┖
- } else if (dateType == 2) {
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
-
- } else if (dateType == 3) {
- if (year != null)
- year = null;
-
- if (startTime != null)
- startTime = null;
-
- if (endTime != null)
- endTime = null;
- }
-
+ public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime,
+ String endTime, PrintWriter out) {
try {
+ String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
+ if (validateMsg != null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
+ return;
+ }
+
+ if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
+ startTime = null;
+ endTime = null;
+ }
- Object objectDate = null;
+
+ Date beginDate = null;
+ Date endDate = null;
+
+ if (dateType == 1) {
+ beginDate = TimeUtil.parse(startTime);
+ endDate = TimeUtil.parse(endTime);
+ } else if (dateType == 2) {
+ Calendar calendar=Calendar.getInstance();
+ int currentYear = calendar.get(Calendar.YEAR);
+ if (!StringUtil.isNullOrEmpty(year)) {
+ currentYear = Integer.parseInt(year);
+ }
+
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ beginDate =calendar.getTime();
+
+ calendar.clear();
+ calendar.set(Calendar.YEAR, currentYear);
+ calendar.roll(Calendar.DAY_OF_YEAR, -1);
+ endDate=calendar.getTime();
+ } else if (dateType == 3) {
+ beginDate = TimeUtil.parse("2018-01-01");
+ endDate = new Date();
+ }
+ Gson gson = new Gson();
List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
- Gson gson = new Gson();
- JSONArray line_list = new JSONArray();
+ List<Object> list = new ArrayList<>();
+ List<CountUserInfo> listHistory = extractAuditRecordService.geApplyNumber(beginDate, endDate);
+ for (String date: dateList) {
+ int value = 0;
+ if (listHistory == null) {
+ list.add(value + "");
+ continue;
+ }
+
+ for (CountUserInfo history: listHistory) {
+ if (dateType == 1) {
+ String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ } else if (dateType == 2){
+ String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay());
+ if(gernalTime.startsWith("0")) {
+ gernalTime = gernalTime.substring(1, 2);
+ }
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ } else if (dateType == 3) {
+ String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay());
+ if (gernalTime.equalsIgnoreCase(date)) {
+ value += history.getNum();
+ continue;
+ }
+ }
+ }
+ list.add(value + "");
+ }
JSONObject innerList = new JSONObject();
- innerList.put("name", "鎬昏");
-
- List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyNumber(null, dateType,
- year, startTime, endTime);
-
- if (dateType != 3) {
- innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
- } else {
- // 骞磋鍥�
- Map<String, Object> map = AdminUtils.yearsDataFactory(list);
-
- if (objectDate == null) {
- objectDate = map.get("date");
- }
- innerList.put("data", gson.toJson(map.get("value")));
- }
-
+ innerList.put("name", "鏁伴噺");
+ innerList.put("data", gson.toJson(list));
+
+ JSONArray line_list = new JSONArray();
line_list.add(innerList);
-
-
+
JSONObject data = new JSONObject();
- if (objectDate != null) {
- data.put("xAxis_list", gson.toJson(objectDate));
- } else {
- data.put("xAxis_list", gson.toJson(dateList));
- }
-
+ data.put("xAxis_list", gson.toJson(dateList));
data.put("line_list", line_list);
-
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("绯荤粺寮傚父"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 涓嬭浇鎻愮幇绾㈠寘Openid
+ *
+ * @param callback
+ * @param response
+ * @param out
+ */
+ @RequestMapping(value = "downAutoExtractTxt")
+ public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
+ try {
+ List<String> list = extractService.getAutoExtractOpenIds();
+ if (list == null || list.size() <= 1) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐢ㄦ埛婊¤冻鑷姩鎻愮幇鏉′欢"));
+ return;
+ }
+
+ 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") + "\"");
+
+ StringBuilder sb = new StringBuilder();
+ 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();
} catch (Exception e) {
JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
e.printStackTrace();
}
}
+
+ /**
+ * 涓婁紶鎻愮幇绾㈠寘Excel
+ *
+ * @param file
+ * @param out
+ */
+ @RequestMapping(value = "uploadExcel", method = RequestMethod.POST)
+ public void uploadExcel(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
+ if (file == null) {
+ out.print(JsonUtil.loadFalseResult("涓婁紶鏂囦欢涓嶈兘涓虹┖锛�"));
+ return;
+ }
+
+ try {
+ List<RedPackRecord> list = WXRedPackUtil.readCsv(file.getInputStream());
+ extractService.updateManualExtractRecord(list);
+ out.print(JsonUtil.loadTrueResult("涓婁紶鎴愬姛"));
+ } catch (ExtractException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ out.print(JsonUtil.loadFalseResult("涓婁紶澶辫触"));
+ }
+ }
+
+ public static String getValue(String[] item,int index){
+ if(item.length > index){
+ String value = item[index];
+ return value;
+ }
+ return "";
+ }
+
+ /**
+ * 棰勮绾㈠寘鍙戠敓浜�
+ *
+ * @param callback
+ * @param pageIndex
+ * @param out
+ */
+ @RequestMapping(value = "preAutoUser")
+ public void preAutoUser(String callback, Integer pageIndex, PrintWriter out) {
+ try {
+ List<UserInfo> list = extractService.preAutoUser();
+ if (list == null || list.isEmpty()) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鐢ㄦ埛婊¤冻鑷姩鎻愮幇鏉′欢"));
+ return;
+ }
+
+ if (pageIndex == null || pageIndex < 1) {
+ pageIndex = 1;
+ }
+
+ Integer pageSize = 100;
+ 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());
+ } else {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("娌℃湁鏇村浜�"));
+ return;
+ }
+
+ JSONObject data = new JSONObject();
+ data.put("pe", pe);
+ data.put("result_list", listResult);
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
+ e.printStackTrace();
+ }
+ }
}
+
--
Gitblit v1.8.0