Commit a4dcc2e3 authored by licc's avatar licc

最大进步奖展示接口

parent a5dd4277
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.ProgressPrize;
import cn.wisenergy.model.vo.ProgressPrizeVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -25,4 +26,13 @@ public interface ProgressPrizeMapper extends BaseMapper<ProgressPrize> {
* @return 最大进步奖用户列表
*/
List<ProgressPrize> getByYearMonth(@Param("yearMonth") String yearMonth);
/**
* 获取本月月的最大进步奖用户列表 倒序 增长率相等的,按注册时间倒序
*
* @param yearMonth 年月
* @return 最大进步奖用户列表
*/
List<ProgressPrizeVo> getByTime(@Param("yearMonth") String yearMonth);
}
......@@ -86,4 +86,18 @@
</where>
</select>
<select id="getByTime" resultType="cn.wisenergy.model.vo.ProgressPrizeVo">
select p.user_id as userId,p.growth_rate as growthRate, p.award_money as awardMoney
from progress_prize p,user_info u
<where>
p.user_id=u.user_id
<if test="yearMonth != null">
AND(
YEAR(p.year_month) = YEAR(#{yearMonth})
AND MONTH(p.year_month) = MONTH(#{yearMonth}))
</if>
order by p.growth_rate desc,u.create_time desc
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 86187
* @ Description: 每月进步奖展示Vo
* @ Author : 86187
* @ Date : 2021/3/9 16:53
*/
@ApiModel("ProgressPrizeVo")
@Data
public class ProgressPrizeVo {
/**
* 用户id
*/
@ApiModelProperty(value = "用户id", name = "userId")
private String userId;
/**
* 增长率
*/
@ApiModelProperty(value = "增长率", name = "growthRate")
private Double growthRate;
/**
* 奖金
*/
@ApiModelProperty(value = "奖金", name = "awardMoney")
private Double awardMoney;
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.vo.ProgressPrizeVo;
import java.util.List;
/**
* @author 86187
* @ Description: 进步奖接口定义
* @ Author : 86187
* @ Date : 2021/3/9 16:47
*/
public interface ProgressPrizeService {
/**
* 获取本月进步奖列表
*
* @return 进步奖列表
*/
R<List<ProgressPrizeVo>> getProgressPrizes();
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.MonthAwardMapper;
import cn.wisenergy.mapper.TradeRecordMapper;
......
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.DateUtil;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.ProgressPrizeMapper;
import cn.wisenergy.model.app.ProgressPrize;
import cn.wisenergy.model.vo.ProgressPrizeVo;
import cn.wisenergy.service.app.ProgressPrizeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author 86187
*/
@Service
@Slf4j
public class ProgressPrizeServiceImpl extends ServiceImpl<ProgressPrizeMapper, ProgressPrize> implements ProgressPrizeService {
@Override
public R<List<ProgressPrizeVo>> getProgressPrizes() {
log.info("shop-mall[]ProgressPrizeServiceImpl[]getProgressPrizes[]input.method");
//获取本月进步奖 列表
Date date = new Date();
String yearMonth = DateUtil.convertDateToStr(date, "yyyy-MM");
List<ProgressPrizeVo> list = baseMapper.getByTime(yearMonth);
return R.ok(list);
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.vo.ProgressPrizeVo;
import cn.wisenergy.service.app.ProgressPrizeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 86187
*/
@Api(tags = "进步奖相关接口")
@RestController
@RequestMapping("/growth")
@Slf4j
public class ProgressPrizeController {
@Autowired
private ProgressPrizeService progressPrizeService;
@ApiOperation(value = "获取本月进步奖列表", notes = "获取本月进步奖列表", httpMethod = "GET")
@GetMapping("/getProgressPrizes")
public R<List<ProgressPrizeVo>> getProgressPrizes() {
log.info("shop-mall[]ProgressPrizeController[]getProgressPrizes[]input.method");
return progressPrizeService.getProgressPrizes();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment