From baacd1378b33c4a84ee7a4998fb08fd9979ee4e1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 09 一月 2019 11:02:52 +0800 Subject: [PATCH] Merge branch 'dev-hongbao' --- fanli/src/main/java/com/yeshi/fanli/controller/admin/ExtractAdminController.java | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 259 insertions(+), 5 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 5477b87..1e1dcd2 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 @@ -15,6 +15,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -40,7 +43,9 @@ 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.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; @@ -57,14 +62,18 @@ import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; -import net.sf.json.JSONObject; - @Controller @RequestMapping("admin/new/api/v1/extract") public class ExtractAdminController { @Resource private ExtractService extractService; + + @Resource + private ConfigService configService; + + @Resource + private UserInfoCountService userInfoCountService; @Resource private ExtractCountService extractCountService; @@ -508,6 +517,23 @@ if (adminUser == null) { record.setAdminUser(new AdminUser()); } + + int warnLevel = 0; + Extract extract = record.getExtract(); + if (extract != null) { + Integer extractState = extract.getState(); + if (extractState != null && extractState == 0) { + UserInfo userInfo = extract.getUserInfo(); + if (userInfo != null) { + double countTodayMoney = extractService.countTodayMoney(userInfo.getId()); + if (countTodayMoney >= 100) { + warnLevel = 1; + } + } + } + + } + record.setWarnLevel(warnLevel); } int count = extractAuditRecordService.getMyAuditedTimeSlotCount(key, state, null, days); @@ -1009,7 +1035,11 @@ String auctionIds = auctionIdBuf.toString(); String ids = auctionIds.substring(0, auctionIds.length() - 1); - goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids); + try { + goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids); + } catch (Exception e) { + e.printStackTrace(); + } } List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>(); @@ -1060,7 +1090,7 @@ } catch (Exception e) { e.printStackTrace(); - out.print(JsonUtil.loadFalseResult(e.getMessage())); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); } } @@ -1263,7 +1293,7 @@ } catch (Exception e) { e.printStackTrace(); - out.print(JsonUtil.loadFalseResult(e.getMessage())); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); } } @@ -1394,4 +1424,228 @@ } } + + /** + * 缁熻瀹℃牳娆℃暟 + * @param callback + * @param state 瀹℃牳鐘舵�侊細鎵�鏈�-绌哄�兼垨鑰呬笉浼� 閫氳繃-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 = "getAuditTotal") + public void getAuditTotal(String callback,Integer state, Integer dateType, String year, + String startTime, String endTime, PrintWriter out) { + + + String validateMsg = 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; + } + + try { + + List<Map<String, Object>> resultList = extractAuditRecordService.countAuditTotal(state, dateType, + year, startTime, endTime); + + JSONObject innerList = new JSONObject(); + if (state == null) { + innerList.put("name", "鎬昏"); + } else if (state == 1) { + innerList.put("name", "閫氳繃鏁�"); + } else if (state == 2) { + innerList.put("name", "椹冲洖鏁�"); + } + innerList.put("data_list", resultList); + + JSONArray outList = new JSONArray(); + outList.add(innerList); + + JSONObject data = new JSONObject(); + data.put("result_list", outList); + + 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 out + */ + @RequestMapping(value = "getExtractMoney") + public void getExtractMoney(String callback,Integer state, Integer dateType, String year, + String startTime, String endTime, PrintWriter out) { + + String validateMsg = 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; + } + + try { + + List<Map<String, Object>> resultList = extractAuditRecordService.countExtractMoney(state, dateType, + year, startTime, endTime); + + JSONObject innerList = new JSONObject(); + if (state == null) { + innerList.put("name", "鎬昏"); + } else if (state == 0) { + innerList.put("name", "寰呭鏍�"); + } else if (state == 1) { + innerList.put("name", "閫氳繃"); + } else if (state == 2) { + innerList.put("name", "椹冲洖"); + } + innerList.put("data_list", resultList); + + JSONArray outList = new JSONArray(); + outList.add(innerList); + + JSONObject data = new JSONObject(); + data.put("result_list", outList); + + 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 out + */ + @RequestMapping(value = "getExtractApplyNumber") + public void getExtractApplyNumber(String callback,Integer state, Integer dateType, String year, + String startTime, String endTime, PrintWriter out) { + + String validateMsg = 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; + } + + try { + + List<Map<String, Object>> resultList = extractAuditRecordService.countExtractApplyNumber(state, dateType, + year, startTime, endTime); + + JSONObject innerList = new JSONObject(); + if (state == null) { + innerList.put("name", "鎬昏"); + } else if (state == 0) { + innerList.put("name", "寰呭鏍�"); + } else if (state == 1) { + innerList.put("name", "閫氳繃"); + } else if (state == 2) { + innerList.put("name", "椹冲洖"); + } + innerList.put("data_list", resultList); + + JSONArray outList = new JSONArray(); + outList.add(innerList); + + JSONObject data = new JSONObject(); + data.put("result_list", outList); + + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); + + } catch (Exception e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); + e.printStackTrace(); + } + } + + + /** + * 缁熻璧勯噾淇℃伅 + * + * @param out + */ + @RequestMapping(value = "getMoneynfo") + public void getHistoryInfo(String callback, PrintWriter out) { + + // 绱宸叉彁鐜伴噾棰濇�昏锛氬凡鎻愮幇鎴愬姛鐨勬�婚 + Map<String, Object> resultData = extractCountService.countTotalSuccess(); + // 褰撳墠鐢ㄦ埛浣欓鎬昏锛氭墍鏈夌敤鎴锋�讳綑棰� + BigDecimal amountMoney = userInfoCountService.countAllMoney(null); + + // 鍙彁鐜伴噾棰濋檺鍒� + String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY); + if (minMoney == null){ + minMoney = "0"; + } + // 褰撳墠鍙彁鐜伴噾棰濇�昏锛� 瓒呰繃鏈�浣庢彁鐜伴噾棰�---璁″叆缁熻 + BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney)); + + JSONObject data = new JSONObject(); + data.put("amountMoney", amountMoney); + data.put("extractApply", extractApply); + data.put("extractMoney", resultData.get("totalmoney")); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + } + + + public String validateParams(Integer shwoType, String startTime, String endTime) { + + if (shwoType == null) { + return "璇烽�夋嫨瑙嗗浘绫诲瀷"; + } + + if (shwoType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) { + return "璇烽�夋嫨鏃堕棿鍖洪棿"; + } + + if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) { + return "璇烽�夌粨鏉熸棩鏈�"; + } + + if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) { + return "璇烽�夎捣濮嬫棩鏈�"; + } + + return null; + } } -- Gitblit v1.8.0