Commit 4b9ca5d2 authored by licc's avatar licc

新增设置培育奖接口

parent 96831c36
......@@ -7,20 +7,31 @@ import java.util.List;
/**
* 培育奖金额对应表
*
* @author zw
*/
public interface CultivatingPrizeMapper extends BaseMapper<CultivatingPrize> {
/**
* 根据用户等级获取培育奖对应金额
*
* @return
*/
CultivatingPrize getcultivatingPrizeByUserLevel(int userLevel);
/**
* 查询所有信息
*
* @return
*/
List<CultivatingPrize> getCultivatingPrizeList();
/**
* 编辑培育奖信息
*
* @param cultivatingPrize 信息
* @return 1
*/
int edit(CultivatingPrize cultivatingPrize);
}
......@@ -40,6 +40,17 @@
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<update id="edit" parameterType="cn.wisenergy.model.app.CultivatingPrize">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<select id="getcultivatingPrizeByUserLevel" resultType="cn.wisenergy.model.app.CultivatingPrize">
select
<include refid="cols_all"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.ShopZxMapper">
<mapper namespace="cn.wisenergy.mapper.ShopZxMapper">
<resultMap id="zxMap" type="cn.wisenergy.model.app.shopZx">
<id column="zx_id" property="zxid"/>
<result column="zx_url" property="zxUrl"/>
......@@ -57,43 +57,35 @@
<!--资讯内容倒叙查询-->
<!--资讯内容倒叙查询-->
<select id="selectPage" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.dto.ZxUserDto">
select
b.zx_id as zxid,
b.zx_url as zxUrl,
b.zx_likes as zxLikes,
b.zx_field as zxField,
b.zx_date as zxDate,
b.invite_code as inviteCode,
a.user_id as userId,
a.head_image as headImage
from shop_zx b left join user_info a ON a.invite_code=b.invite_code
WHERE zx_to_examine != 0
AND a.user_id !=0
order by zxid desc limit #{pageNum},#{pageSize}
</select>
<!--资讯总记录数查询-->
<select id="selectAllNum" parameterType="cn.wisenergy.model.app.shopZx" >
select count (*) from shop_zx
</select>
<!--查询点赞记录-->
<select id="selectlikes" parameterType="cn.wisenergy.model.app.userLikes" >
select * from user_likes
select
b.zx_id as zxid,
b.zx_url as zxUrl,
b.zx_likes as zxLikes,
b.zx_field as zxField,
b.zx_date as zxDate,
b.invite_code as inviteCode,
a.user_id as userId,
a.head_image as headImage
from shop_zx b left join user_info a ON a.invite_code=b.invite_code
WHERE zx_to_examine != 0
AND a.user_id !=0
order by zxid desc limit #{pageNum},#{pageSize}
</select>
<!--资讯点赞专用sql-->
<select id="selectByzxid" parameterType="java.lang.Integer" resultType="cn.wisenergy.model.app.shopZx">
select * from shop_zx where zx_id=#{zxid}
select * from shop_zx where zx_id=#{zxid}
</select>
<update id="updateByzxid">
UPDATE
<include refid="table"/>
<set>
zx_likes = #{zxLikes}
</set>
<where>
zx_id = #{zxid}
</where>
</update>
UPDATE
<include refid="table"/>
<set>
zx_likes = #{zxLikes}
</set>
<where>
zx_id = #{zxid}
</where>
</update>
<!--资讯审核-->
<update id="updateZxToExaminezxid">
......@@ -108,23 +100,24 @@
</update>
<!--资讯内容与用户内容倒叙查询-->
<select id="getShopZxList" resultType="cn.wisenergy.model.vo.ShopZxUserVo">
select
b.zx_id as zxid,
b.zx_url as zxUrl,
b.zx_likes as zxLikes,
b.zx_field as zxField,
b.zx_date as zxDate,
b.invite_code as inviteCode,
a.user_id as userId,
b.zx_to_examine as ZxToExamine
from shop_zx b left join user_info a ON a.invite_code=b.invite_code
select
b.zx_id as zxid,
b.zx_url as zxUrl,
b.zx_likes as zxLikes,
b.zx_to_examine as auditStatus,
b.zx_field as zxField,
b.zx_date as zxDate,
b.invite_code as inviteCode,
a.user_id as userId,
b.zx_to_examine as ZxToExamine
from shop_zx b left join user_info a ON a.invite_code=b.invite_code
<where>
1=1
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
</where>
order by zx_id desc
order by zx_id desc
limit #{startNum},#{endNum}
</select>
......
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 设置培育奖入参Vo
*
* @author 86187
*/
@Data
@ApiModel("SetCultivatingVo")
public class SetCultivatingVo {
/**
* 等级
*/
@ApiModelProperty(value = "等级", name = "userLevel")
private Integer userLevel;
/**
* 培育奖金额
*/
@ApiModelProperty(name = "prizeAward", value = "培育奖金额")
private BigDecimal prizeAward;
}
......@@ -47,6 +47,9 @@ public class ShopZxUserVo {
@ApiModelProperty(name = "liked_status", value = "点赞状态")
private Integer likedStatus;
@ApiModelProperty(name = "auditStatus", value = "审核状态")
private Integer auditStatus;
/**
* 资讯文字输入字段
*/
......
......@@ -3,6 +3,7 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.CultivatingPrize;
import cn.wisenergy.model.dto.CultivatingPrizeDto;
import cn.wisenergy.model.vo.SetCultivatingVo;
import com.github.pagehelper.PageInfo;
import java.util.List;
......@@ -17,4 +18,12 @@ public interface CultivatingPrizeService {
* @return 列表
*/
R<List<CultivatingPrize>> getCultivatingPrizeList();
/**
* 设置培育奖等级金额
*
* @param setVo 入参
* @return true or false
*/
R<Boolean> setAward(SetCultivatingVo setVo);
}
......@@ -4,6 +4,7 @@ import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.CultivatingPrizeMapper;
import cn.wisenergy.model.app.CultivatingPrize;
import cn.wisenergy.model.vo.CultivatingPrizeVo;
import cn.wisenergy.model.vo.SetCultivatingVo;
import cn.wisenergy.service.app.CultivatingPrizeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,10 +24,32 @@ public class CultivatingPrizeServiceImpl implements CultivatingPrizeService {
@Override
public R<List<CultivatingPrize>> getCultivatingPrizeList() {
log.info("shop-mall[]CultivatingPrizeServiceImpl[]getCultivatingPrizeList[]input.param.query:" );
log.info("shop-mall[]CultivatingPrizeServiceImpl[]getCultivatingPrizeList[]input.param.query:");
List<CultivatingPrize> cultivatingPrizeList = cultivatingPrizeMapper.getCultivatingPrizeList();
return R.ok(cultivatingPrizeList);
}
@Override
public R<Boolean> setAward(SetCultivatingVo setVo) {
log.info("shop-mall[]CultivatingPrizeServiceImpl[]setAward[]input.param.setVo:" + setVo);
if (null == setVo || null == setVo.getUserLevel() || null == setVo.getPrizeAward()) {
return R.error("入参不能为空!");
}
//获取等级培育奖信息
CultivatingPrize cultivatingPrize = cultivatingPrizeMapper.getcultivatingPrizeByUserLevel(setVo.getUserLevel());
if (null == cultivatingPrize) {
return R.error("该等级无培育奖金额,请联系管理员确认!");
}
cultivatingPrize.setCultivatingPrize(setVo.getPrizeAward());
int count = cultivatingPrizeMapper.edit(cultivatingPrize);
if (count == 0) {
return R.error("设置培育奖金额失败!");
}
return R.ok(0, true);
}
}
......@@ -211,27 +211,38 @@ public class UserController extends BaseController {
return cultivatingPrizeService.getCultivatingPrizeList();
}
@ApiOperation(value = "后台-培育奖设置", notes = "后台-培育奖设置", httpMethod = "POST")
@ApiImplicitParam(name = "setVo", value = "参数信息", dataType = "SetCultivatingVo")
@PostMapping("/admin/setAward")
public R<Boolean> setAward(@RequestBody SetCultivatingVo setVo) {
log.info("shop-mall[]UserController[]setAward[]input.param.setVo:" + setVo);
if (null == setVo || null == setVo.getUserLevel() || null == setVo.getPrizeAward()) {
return R.error("入参不能为空!");
}
return cultivatingPrizeService.setAward(setVo);
}
@ApiOperation(value = "后台-设置用户等级为幼苗", notes = "后台-设置用户等级为幼苗", httpMethod = "GET")
@GetMapping("admin/user/setUserLevelToSeedling")
public R<String> setUserLevelToSeedling(String userId,Integer userLevel){
if (null == userId || null == userLevel){
public R<String> setUserLevelToSeedling(String userId, Integer userLevel) {
if (null == userId || null == userLevel) {
return R.error("入参为空");
}
User userByUserId = userService.getByUserId(userId);
if (null == userByUserId){
return R.error(1,"当前用户不存在");
if (null == userByUserId) {
return R.error(1, "当前用户不存在");
}
if (userLevel != 0){
if (userLevel != 0) {
return R.error("用户等级不是普通用户,请查看自己等级");
}
//进行用户等级设置
int flag = userService.setUserLevelToSeedling(userId , userLevel);
if (flag == 0){
return R.ok(0,"设置成功");
}else {
return R.error(1,"设置失败,请重试");
int flag = userService.setUserLevelToSeedling(userId, userLevel);
if (flag == 0) {
return R.ok(0, "设置成功");
} else {
return R.error(1, "设置失败,请重试");
}
}
......
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