admin
2021-01-15 5405154d6979f1b50ce2d881bb164b1acca80b6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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(version = "1.0.0",check = false)
    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);
    }
 
 
}