| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.integral.IntegralExchange;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.exception.integral.IntegralExchangeException;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralExchangeRecordService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralExchangeService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskClassService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
|
| | | 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.vo.integral.DailySignVO;
|
| | | import com.yeshi.fanli.vo.integral.ExchangeTipVO;
|
| | | import com.yeshi.fanli.vo.integral.IntegralTaskClassVO;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | |
| | | @Resource
|
| | | private IntegralTaskRecordService integralTaskRecordService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private IntegralExchangeService integralExchangeService;
|
| | | |
| | | @Resource
|
| | | private IntegralExchangeRecordService integralExchangeRecordService;
|
| | | |
| | | /**
|
| | | * 获取任务列表
|
| | | * @param acceptData
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 金币兑换列表
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param ids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getExchangeList", method = RequestMethod.POST)
|
| | | public void getExchangeList(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "页码不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户相关信息不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | List<IntegralExchange> list = integralExchangeRecordService.listExchange((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE, uid);
|
| | | if (list == null) |
| | | list = new ArrayList<IntegralExchange>();
|
| | | |
| | | Long count = integralExchangeService.countValid();
|
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("goldCoin", extraVO.getGoldCoin());
|
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | /**
|
| | | * 兑换金币检验
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "verifyExchange", method = RequestMethod.POST)
|
| | | public void verifyExchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | try {
|
| | | ExchangeTipVO exchange = integralExchangeService.verifyExchange(uid, id);
|
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralExchangeException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 兑换金币
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "exchange", method = RequestMethod.POST)
|
| | | public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | try {
|
| | | ExchangeTipVO exchange = integralExchangeService.verifyExchange(uid, id);
|
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralExchangeException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|