package com.ks.daylucky.controller.api.client;
|
|
import com.ks.daylucky.pojo.VO.AcceptData;
|
import com.ks.daylucky.pojo.VO.ActivityLuckyCouponVO;
|
import com.ks.daylucky.util.Constant;
|
import com.ks.lucky.pojo.DO.LuckyActivityUserWeightRecord;
|
import com.ks.lucky.remote.service.LuckyActivityUserWeightRecordService;
|
import net.sf.json.JSONObject;
|
import org.apache.dubbo.config.annotation.Reference;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.yeshi.utils.JsonUtil;
|
import org.yeshi.utils.TimeUtil;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* 幸运券
|
*/
|
@Controller
|
@RequestMapping("api/client/activity/coupon")
|
public class ActivityLuckyCouponController {
|
|
@Reference
|
private LuckyActivityUserWeightRecordService luckyActivityUserWeightRecordService;
|
|
|
@ResponseBody
|
@RequestMapping("getCouponList")
|
public String getCouponList(AcceptData acceptData, Long activityId, int page) {
|
long count = luckyActivityUserWeightRecordService.countWeightRecord(activityId, acceptData.getApp().getId(), acceptData.getUid() + "");
|
List<LuckyActivityUserWeightRecord> list = luckyActivityUserWeightRecordService.getWeightRecordList(activityId, acceptData.getApp().getId(), acceptData.getUid() + "", page, Constant.PAGE_SIZE);
|
|
List<ActivityLuckyCouponVO> voList = new ArrayList<>();
|
if (list != null) {
|
for (LuckyActivityUserWeightRecord record : list) {
|
voList.add(new ActivityLuckyCouponVO(record.getTitle(), record.getWeight(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")));
|
}
|
}
|
JSONObject data = new JSONObject();
|
data.put("data", voList);
|
data.put("count", count);
|
return JsonUtil.loadTrueResult(data);
|
}
|
|
|
}
|