Commit 4d575855 authored by licc's avatar licc

后台应用设置接口实现

parent fee10c2e
......@@ -463,11 +463,14 @@
from
<include refid="table"/>
<where>
1=1
<if test="userId != null and userId != ''">
user_id=#{userId}
and user_id=#{userId}
</if>
<if test="queryTime != null and queryTime != ''">
and `create_time` = #{queryTime}
and (YEAR(create_time) = YEAR(#{queryTime})
AND MONTH(create_time) =MONTH(#{queryTime})
AND DAY(create_time)=DAY(#{queryTime}))
</if>
</where>
</select>
......
......@@ -31,9 +31,9 @@ public class AccountInfo implements Serializable {
private String userId;
/**
* 用户等级
* 用户等级 0:普通用户 1:幼苗 2: 青铜树 3:白银树 4:黄金树 5:农场主 6:森林之星 7:西田森合伙人
*/
@ApiModelProperty(name = "userLevel", value = "用户等级")
@ApiModelProperty(name = "userLevel", value = "用户等级 0:普通用户 1:幼苗 2: 青铜树 3:白银树 4:黄金树 5:农场主 6:森林之星 7:西田森合伙人")
private Integer userLevel;
/**
......
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 86187
* @ Description:
* @ Author : 86187
* @ Date : 2021/3/26 10:30
*/
@Data
@ApiModel("SetMemberPercentVo")
public class SetMemberPercentVo {
/**
* 比列
*/
@ApiModelProperty(name = "percent", value = "比列")
private Double percent;
/**
* 用户等级 0:普通用户 1:幼苗 2: 青铜树 3:白银树 4:黄金树 5:农场主 6:森林之星 7:西田森合伙人
*/
@ApiModelProperty(name = "userLevel", value = "用户等级 0:普通用户 1:幼苗 2: 青铜树 3:白银树 4:黄金树 5:农场主 6:森林之星 7:西田森合伙人")
private Integer userLevel;
/**
* 会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴
*/
@ApiModelProperty(name = "type", value = "会员等级百分比类型:1:返佣 2:月度肥料 3:月度最大进步奖 4:运营中心补贴")
private Integer type;
}
......@@ -3,6 +3,7 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.MemberPercent;
import cn.wisenergy.model.dto.MemberPercentQuery;
import cn.wisenergy.model.vo.SetMemberPercentVo;
import com.github.pagehelper.PageInfo;
/**
......@@ -12,8 +13,17 @@ public interface MemberPercentService {
/**
* 获取会员等级优惠比列列表
*
* @param query 条件
* @return 优惠比列列表
*/
R<PageInfo<MemberPercent>> getList(MemberPercentQuery query);
/**
* 更据等级和类型,设置优惠比列
*
* @param percentVo 参数
* @return true or false
*/
R<Boolean> setMemberPercent(SetMemberPercentVo percentVo);
}
......@@ -7,12 +7,15 @@ import cn.wisenergy.model.app.MemberPercent;
import cn.wisenergy.model.app.TradeRecord;
import cn.wisenergy.model.dto.MemberPercentQuery;
import cn.wisenergy.model.dto.TradeRecordQuery;
import cn.wisenergy.model.vo.SetMemberPercentVo;
import cn.wisenergy.service.app.MemberPercentService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -28,10 +31,13 @@ public class MemberPercentServiceImpl implements MemberPercentService {
@Override
public R<PageInfo<MemberPercent>> getList(MemberPercentQuery query) {
log.info("sho[-mall[]MemberPercentServiceImpl[]getList[]input.method");
log.info("sho[-mall[]MemberPercentServiceImpl[]getList[]input.param.query:" + query);
if (null == query) {
return R.error("入参不能为空!");
}
pageHandle(query);
Map<String,Object> map=new HashMap<>();
Map<String, Object> map = new HashMap<>();
int total = memberPercentMapper.count();
map.put("startNum", query.getStartNum());
......@@ -45,6 +51,39 @@ public class MemberPercentServiceImpl implements MemberPercentService {
return R.ok(info);
}
@Override
public R<Boolean> setMemberPercent(SetMemberPercentVo percentVo) {
log.info("sho[-mall[]MemberPercentServiceImpl[]setMemberPercent[]input.param.percentVo:" + percentVo);
if (null == percentVo || null == percentVo.getPercent() ||
null == percentVo.getType() || null == percentVo.getUserLevel()) {
return R.error("入参不能为空!");
}
//1、更据等级和类型,获取会员等级优惠 存在更新,不存 在新增
MemberPercent memberPercent = memberPercentMapper.getByLevelAndType(percentVo.getUserLevel(), percentVo.getType());
MemberPercent member = new MemberPercent();
BigDecimal bigDecimal = BigDecimal.valueOf(percentVo.getPercent()).setScale(2, RoundingMode.HALF_UP);
if (null == memberPercent) {
member.setType(percentVo.getType());
member.setPercent(bigDecimal);
member.setUserLevel(percentVo.getUserLevel());
int count = memberPercentMapper.add(member);
if (count == 0) {
return R.ok(1, false);
}
return R.ok(0, true);
}
//存在则更新
memberPercent.setPercent(bigDecimal);
int count = memberPercentMapper.edit(memberPercent);
if (count == 0) {
return R.ok(1, false);
}
return R.ok(0, true);
}
/**
* 分页处理方法
*
......
......@@ -390,7 +390,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("userId", queryDto.getUserId());
}
if (!StringUtils.isBlank(queryDto.getQueryTime())) {
Date date = DateUtil.convertStrToDate(queryDto.getQueryTime(), "yyyy-MM-dd");
Date date = DateUtil.convertStrToDate(queryDto.getQueryTime(), "yyyy-MM-dd hh:mm:ss");
map.put("queryTime", date);
}
......@@ -398,7 +398,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
map.put("startNum", queryDto.getStartNum());
map.put("endNum", queryDto.getEndNum());
List<User> list = usersMapper.getList(map);
List<User> list = usersMapper.getUserList(map);
PageInfo<User> info = new PageInfo<>();
info.setPageSize(queryDto.getPageSize());
info.setPageNum(queryDto.getPageNo());
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.BankInfo;
import cn.wisenergy.model.vo.SetMemberPercentVo;
import cn.wisenergy.service.app.MemberPercentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -10,8 +19,22 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Api(tags = "后台管理 -- 应用设置")
@RestController
@RequestMapping("/account")
@RequestMapping("/set")
@Slf4j
public class SettingController {
@Autowired
private MemberPercentService memberPercentService;
@ApiOperation(value = "参数设置", notes = "参数设置", httpMethod = "POST")
@ApiImplicitParam(name = "percentVo", value = "参数信息", dataType = "SetMemberPercentVo")
@PostMapping("/param")
public R<Boolean> param(@RequestBody SetMemberPercentVo percentVo) {
log.info("shop-mall[]SettingController[]param[]input.param.percentVo:" + percentVo);
if (null == percentVo || null == percentVo.getPercent() ||
null == percentVo.getType() || null == percentVo.getUserLevel()) {
return R.error("入参为空!");
}
return memberPercentService.setMemberPercent(percentVo);
}
}
......@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
*/
@Api(tags = "后台管理--用户登录")
@RestController
@RequestMapping("/sysUser")
@RequestMapping("/sys")
@Slf4j
public class SysUserController {
......
......@@ -58,9 +58,7 @@ public class ShiroConfig {
// 设置拦截器集合
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
filterChainDefinitionMap.put("/authInformation/save", "anon");//存储设备IMEI号和手机SIM卡ID号
filterChainDefinitionMap.put("/sys/login", "anon"); // 登录页面-身份认证
filterChainDefinitionMap.put("/sys/registered", "anon"); // 注册页面
filterChainDefinitionMap.put("/swagger-ui.html", "anon"); // swagger接口-匿名访问
filterChainDefinitionMap.put("/swagger/**", "anon");
filterChainDefinitionMap.put("/swagger-resources/**", "anon");
......@@ -72,14 +70,14 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/api/sms/verifyCode", "anon");
filterChainDefinitionMap.put("/api/sms/**", "anon");
filterChainDefinitionMap.put("/upload_flowChart/**", "anon");//图片地址
filterChainDefinitionMap.put("/webSocket/**", "anon");//socket
filterChainDefinitionMap.put("/message/**", "anon");//消息推送接口
filterChainDefinitionMap.put("/userlevel/test","anon");
filterChainDefinitionMap.put("/customerService/uploadWeChatImg","anon");
filterChainDefinitionMap.put("/customerService/service","anon");
filterChainDefinitionMap.put("/userlevel/test", "anon");
//后台设置
filterChainDefinitionMap.put("/set/**", "anon");
filterChainDefinitionMap.put("/customerService/uploadWeChatImg", "anon");
filterChainDefinitionMap.put("/customerService/service", "anon");
filterChainDefinitionMap.put("/**", "oauth2"); // 其他路径均需要身份认证,一般位于最下面,优先级最低
// 其他路径均需要身份认证,一般位于最下面,优先级最低
filterChainDefinitionMap.put("/**", "oauth2");
// 设置拦截器
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
......
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