From 1e1ae4f19489644c9ff35125d075a30f89536d16 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 21 五月 2020 17:35:36 +0800 Subject: [PATCH] 后台编辑 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java | 87 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 87 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java index ab6f235..2a75869 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java @@ -41,6 +41,7 @@ import com.yeshi.fanli.service.inter.money.extract.ExtractService; import com.yeshi.fanli.service.inter.order.HongBaoV2Service; import com.yeshi.fanli.service.inter.order.OrderMoneyDailyCountService; +import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderUserMapService; import com.yeshi.fanli.service.inter.user.PreviewInfoService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; @@ -54,6 +55,7 @@ import com.yeshi.fanli.vo.money.MoneyStatisticVO; import com.yeshi.fanli.vo.money.TeamPredictVO; import com.yeshi.fanli.vo.order.OrderRankingVO; +import com.yeshi.fanli.vo.order.TeamDividentsVO; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -97,6 +99,9 @@ @Resource private PreviewInfoService previewInfoService; + + @Resource + private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService; private Gson getGson() { @@ -736,6 +741,88 @@ } + + /** + * 鍒嗙孩璇︽儏 + * + * @param acceptData + * @param uid + * @param datetype 1-澶� - 2鏈� + * @param out + */ + @RequestMapping(value = "getTeamDividendDetail") + public void getTeamDividendDetail(String callback, AcceptData acceptData, Integer page, Long uid, + String date, Integer datetype, String key, PrintWriter out) { + if (uid == null || uid == 0) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); + return; + } + + if (StringUtil.isNullOrEmpty(date) || datetype == null) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍙傛暟涓嶅畬鏁�")); + return; + } + + if (page == null) + page = 1; + int pageSize = Constant.PAGE_SIZE; + + + try { + Date minDay = new Date(); + Date maxDay = new Date(); + if (datetype == 1) { + minDay = TimeUtil.parseYYYYMMDD(date); + maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(date + " 23:59:59"); + } else if (datetype == 2) { + minDay = TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(date)); + maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(DateUtil.getLastDayOfMonth(date) + " 23:59:59"); + } + List<TeamDividentsVO> list = teamDividentsSourceOrderUserMapService.listByDateAndTargetUid((page-1) * pageSize, pageSize, uid, minDay, maxDay); + if (list == null) { + list = new ArrayList<>(); + } + long count = teamDividentsSourceOrderUserMapService.countByDateAndTargetUid(uid, minDay, maxDay); + + GsonBuilder builder = new GsonBuilder(); + builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() { + @Override + public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) { + if (value == null) { + return new JsonPrimitive("0.000"); + } else { + // 淇濈暀2浣嶅皬鏁� + value = value.setScale(3); + return new JsonPrimitive(value.toString()); + } + } + }); + + Gson gson = builder.create(); + JSONObject object = new JSONObject(); + + if (page == 1) { + TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid, minDay, maxDay); + if (teamDividentsVO == null) { + teamDividentsVO = new TeamDividentsVO(); + teamDividentsVO.setSubsidy(BigDecimal.ZERO); + teamDividentsVO.setDividents(BigDecimal.ZERO); + } + object.put("subsidy", teamDividentsVO.getSubsidy().setScale(3).toString()); + object.put("dividents", teamDividentsVO.getDividents().setScale(3).toString()); + } + + + object.put("count", count); + object.put("list", gson.toJson(list)); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object)); + } catch (Exception e) { + e.printStackTrace(); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触")); + } + } + + /** * 璁㈠崟缁熻-h5 * -- Gitblit v1.8.0