| | |
| | | import com.google.gson.stream.JsonReader;
|
| | | import com.google.gson.stream.JsonWriter;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackExchange;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackWinInvite.RedPackWinInviteTypeEnum;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackGiveRecordException;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackExchangeService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackDetailVO;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackWinInviteVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private RedPackExchangeService redPackExchangeService;
|
| | | |
| | | @Resource |
| | | private RedPackWinInviteService redPackWinInviteService;
|
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | |
|
| | | /**
|
| | | * 统计淘礼金
|
| | | * 统计
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 红包邀请进度
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRewardList", method = RequestMethod.POST)
|
| | | public void getRewardList(AcceptData acceptData, Integer page, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "页码不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<RedPackWinInviteVO> list = new ArrayList<RedPackWinInviteVO>();
|
| | | |
| | | List<RedPackWinInvite> listRecord = redPackWinInviteService.getRewardList((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid);
|
| | | if (listRecord != null && !listRecord.isEmpty()) {
|
| | | for (RedPackWinInvite record: listRecord) {
|
| | | UserInfo user = null;
|
| | | RedPackWinInviteVO winVO = new RedPackWinInviteVO();
|
| | | RedPackWinInviteTypeEnum type = record.getType();
|
| | | if (RedPackWinInviteTypeEnum.newUserReward == type) {
|
| | | user = userInfoService.selectByPKey(uid);
|
| | | } else {
|
| | | user = userInfoService.selectByPKey(record.getTeamUid());
|
| | | }
|
| | | winVO.setPortrait(user.getPortrait());
|
| | | winVO.setNickName(user.getNickName());
|
| | | winVO.setDesc(type.getDesc());
|
| | | winVO.setMoney(record.getMoney().toString());
|
| | | list.add(winVO);
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", redPackWinInviteService.countRewardRecord(uid));
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 用户基础信息
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBasicInfo", method = RequestMethod.POST)
|
| | | public void getBasicInfo(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("balance", redPackBalanceService.getBalance(uid));
|
| | | data.put("ruleLink", redPackConfigService.getValueByKey("invite_reward_rule_link"));
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | data.put("inviteCode", userInfoExtra.getInviteCode());
|
| | | } else {
|
| | | data.put("inviteCode", "");
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | }
|
| | | }
|