| | |
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount.SourceTypeEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.money.TeamEincomeRecordService;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | @Resource
|
| | | private PreviewInfoService previewInfoService;
|
| | |
|
| | | @Resource
|
| | | private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService;
|
| | | |
| | |
|
| | | private Gson getGson() {
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | |
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | | value = value.setScale(2, BigDecimal.ROUND_DOWN);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | |
| | | object.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | | } catch (ParseException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "查询失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTeamDividendStatistic")
|
| | | public void getTeamDividendStatistic(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | public void getTeamDividendStatistic(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | object.put("subsidy", subsidy.setScale(2).toString());
|
| | | object.put("today", gson.toJson(todayVO));
|
| | | object.put("month", gson.toJson(monthVO));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | | }
|
| | |
|
| | | private TeamPredictVO crateTeamPredictVO(List<OrderMoneyDailyCount> list) {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTeamDividendHistory")
|
| | | public void getTeamDividendHistory(AcceptData acceptData, Long uid, String date, Integer datetype,
|
| | | public void getTeamDividendHistory(String callback, AcceptData acceptData, Long uid, String date, Integer datetype,
|
| | | PrintWriter out) {
|
| | | if (uid == null || uid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(date) || datetype == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "参数不完整"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不完整"));
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | JSONObject object = new JSONObject();
|
| | | object.put("count", list.size());
|
| | | object.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(object));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | | } catch (ParseException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 分红详情
|
| | | * |
| | | * @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, key);
|
| | | if (list == null) {
|
| | | list = new ArrayList<>();
|
| | | }
|
| | | long count = teamDividentsSourceOrderUserMapService.countByDateAndTargetUid(uid, minDay, maxDay, key);
|
| | | |
| | | 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.00");
|
| | | } else {
|
| | | // 保留3位小数
|
| | | value = value.setScale(3,RoundingMode.DOWN);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | | });
|
| | | |
| | | Gson gson = builder.create();
|
| | | JSONObject object = new JSONObject();
|
| | |
|
| | | if (page == 1) {
|
| | | TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid, minDay, maxDay, key);
|
| | | if (teamDividentsVO == null) {
|
| | | teamDividentsVO = new TeamDividentsVO();
|
| | | teamDividentsVO.setSubsidy(BigDecimal.ZERO);
|
| | | teamDividentsVO.setDividents(BigDecimal.ZERO);
|
| | | }
|
| | | object.put("subsidy", teamDividentsVO.getSubsidy().setScale(2,RoundingMode.DOWN).toString());
|
| | | object.put("dividents", teamDividentsVO.getDividents().setScale(2, RoundingMode.DOWN).toString());
|
| | | }
|
| | | |
| | | object.put("count", count);
|
| | | object.put("list", gson.toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | List<OrderRankingVO> list = orderMoneyDailyCountService.getRankingByOrderNum(uid, minDate, maxDate);
|
| | | if (list.size() > 0) {
|
| | | for (OrderRankingVO vo: list) {
|
| | | for (int i = 0; i < list.size(); i ++) {
|
| | | OrderRankingVO vo = list.get(i);
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
|
| | | if (user == null) {
|
| | | list.remove(i);
|
| | | i--;
|
| | | continue;
|
| | | }
|
| | | vo.setNickName(user.getNickName());
|
| | | vo.setPortrait(user.getPortrait());
|
| | | }
|
| | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|