Helius
2021-06-16 5728be2af515b2200e782aa201ca5d4d67d9ea47
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package com.ibeetl.admin.console.api;
 
import com.ibeetl.admin.console.model.XzxUserRedpaperInfoModel;
import com.ibeetl.admin.console.service.XzxCityPartnerService;
import com.ibeetl.admin.console.service.XzxUserRedpaperInfoService;
import com.ibeetl.admin.console.web.query.XzxUserRedpaperInfoQuery;
import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.entity.XzxCityPartner;
import com.ibeetl.admin.core.entity.XzxUserRedpaperInfo;
import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.service.CorePlatformService;
import com.ibeetl.admin.core.util.ConvertUtil;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.ibeetl.admin.core.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * XzxUserRedpaperInfo 接口
 */
@RestController
@Api(value = "红包记录")
public class XzxUserRedpaperInfoApi {
 
    private final Log log = LogFactory.getLog(this.getClass());
    private static final String MODEL = "/admin/front/xzxUserRedpaperInfo";
    @Autowired
    CorePlatformService platformService;
    @Autowired
    XzxCityPartnerService cityPartnerService;
 
 
    @Autowired private XzxUserRedpaperInfoService xzxUserRedpaperInfoService;
    
    @Autowired
    FileService fileService;
 
    @PostMapping(MODEL + "/redPaperList.do")
    @ResponseBody
    @ApiOperation(value="红包记录-红包列表", notes="test: 仅0有正确返回")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType="query", name = "page", value = "页码", required = true, dataType = "int"),
            @ApiImplicitParam(paramType="query", name = "limit", value = "每页条数", required = true, dataType = "int"),
            @ApiImplicitParam(paramType="query", name = "startTime", value = "开始时间", required = true, dataType = "String"),
            @ApiImplicitParam(paramType="query", name = "endTime", value = "结束时间", required = true, dataType = "String"),
            @ApiImplicitParam(paramType="query", name = "receiveFlag", value = "红包领取状态0:已领取 1未领取", required = true, dataType = "Integer")
    })
    public JsonResult<Map<String,Object>> redPaperList(@RequestBody XzxUserRedpaperInfoModel model)
    {
        Map<String,Object> map =xzxUserRedpaperInfoService.redPaperList(model);
        return JsonResult.success(map);
    }
    @PostMapping(MODEL + "/cancelRedPaper.do")
    @ResponseBody
    @ApiOperation(value="红包记录-红包列表", notes="test: 仅0有正确返回")
    public JsonResult<Map<String,Object>> cancelRedPaper(){
        CoreUser user = platformService.getCurrentUser();
        XzxCityPartner partner = cityPartnerService.queryById(user.getId());
        String msg = xzxUserRedpaperInfoService.cancelRedPaper(partner);
        if(null!=msg&&!"".equals(msg)){
            return JsonResult.failMessage(msg);
        }else{
            Map<String,Object> map=new HashMap<>();
            map.put("code",0);
            map.put("msg","退还成功");
            return JsonResult.success(map);
        }
    }
 
}