Commit 928c545a authored by liaoanyuan's avatar liaoanyuan

用户管理功能

parent 6b6a2439
package cn.wisenergy.mapper;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.dto.BannerDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -14,7 +16,7 @@ public interface BannerMapper extends BaseMapper<Banner> {
* @param advertising 广告信息
* @return 广告信息
*/
Banner add(Banner advertising);
int add(Banner advertising);
/**
* 编辑广告
......@@ -37,11 +39,26 @@ public interface BannerMapper extends BaseMapper<Banner> {
* @param map 筛选参数
* @return 广告列表
*/
List<Banner> getList(@Param("map") Map<String,Object> map);
List<BannerDto> getList(Map<String,Object> map);
/**
* 统计广告条数
* @return 广告条数
*/
int count();
/**
* 通过广告id查询广告信息
* @param id
* @return
*/
Banner getById(@Param("id") Integer id);
/**
* 通过广告ID改变投放状态
* @param id
* @param status
* @return
*/
int putIn(@Param("id") Integer id, @Param("status") Integer status);
}
......@@ -2,9 +2,13 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.PayRecord;
import cn.wisenergy.model.app.RefillCard;
import cn.wisenergy.model.app.UserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface RefillCardMapper extends BaseMapper<RefillCardMapper> {
/**
......@@ -20,4 +24,17 @@ public interface RefillCardMapper extends BaseMapper<RefillCardMapper> {
* @return
*/
int update(@Param("batchNumber") String batchNumber);
/**
* 获取充值卡信息
* @param map
* @return
*/
List<RefillCard> getList(Map<String,Object> map);
/**
* 获取充值卡数量
* @return
*/
Integer getUserNumbers();
}
......@@ -15,7 +15,7 @@
</resultMap>
<sql id="table">
advertising
banner
</sql>
<sql id="cols_all">
......@@ -53,7 +53,7 @@
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.Banner" keyProperty="id" useGeneratedKeys="true">
<insert id="add" parameterType="cn.wisenergy.model.app.Banner" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
......@@ -79,25 +79,35 @@
where id = #{id}
</delete>
<select id="getList" resultType="cn.wisenergy.model.app.Banner">
<select id="getList" resultType="cn.wisenergy.model.dto.BannerDto" parameterType="map">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
is_delete=0
limit #{startNum},#{endNum}
order by create_time desc
</where>
order by create_time desc
limit #{pageNo},#{pageSize}
</select>
<select id="count" resultType="java.lang.Integer">
select count(1)
from
<include refid="table"/>
<where>
is_delete=0
</where>
</select>
<select id="getById" resultMap="advertisingMap">
select <include refid="cols_all"/>
from <include refid="table"/>
where id=#{id}
</select>
<update id="putIn">
UPDATE
<include refid="table"/>
<set>
status=#{status}
</set>
<where>
id = #{id}
</where>
</update>
</mapper>
......@@ -22,11 +22,11 @@
</sql>
<sql id="cols_exclude_id">
user_id,type, operationName,ip, create_time,update_time
user_id,type, operation_name,ip, create_time,update_time
</sql>
<sql id="vals">
#{userId},#{type},#{operation_name},#{ip},now(),now()
#{userId},#{type},#{operationName},#{ip},now(),now()
</sql>
<sql id="updateCondition">
......
......@@ -27,7 +27,7 @@
</sql>
<sql id="cols_exclude_id">
user_name,password, phone,head_image,sex,school, student_type,is_delete,create_time,update_time
user_name,password, phone,head_image,sex,school, exam_type,is_delete,create_time,update_time
</sql>
<sql id="vals">
......@@ -102,23 +102,25 @@
from
<include refid="table"/>
<where>
<if test="userQueryVo.keyword != null">
(user_name LIKE CONCAT('%', #{keyword}, '%')) and
</if>
is_delete=0
<if test="userQueryVo.startTime != null">
<if test="startTime != null">
and create_time
between #{userQueryVo.startTime} </if>
<if test="workDayList != null">and #{userQueryVo.endTime}</if>
between #{startTime} </if>
<if test="endTime != null">and #{endTime}</if>
order by create_time desc
</where>
<if test="userQueryVo.pageNo!= null">limit #{userQueryVo.pageNo} ,</if>
<if test="pageNo!= null">limit #{pageNo} ,</if>
<if test="userQueryVo.pageSize!=null">#{userQueryVo.pageSize}</if>
<if test="pageSize!=null">#{pageSize}</if>
</select>
<select id="getUserNumbers" resultType="java.lang.Integer">
SELECT COUNT(id)
FROM
<include refid="table"/>
where is_delete=0
</select>
</mapper>
......@@ -20,7 +20,7 @@ public class CardInfo implements Serializable {
* 批次号
*/
@ApiModelProperty(value = "批次号",name = "batchNumber")
private String batchNumber;
private String banthNumber;
/**
* 次数
......
......@@ -10,6 +10,13 @@ import java.io.Serializable;
@ApiModel(value = "AccountDto")
public class AccountDto implements Serializable {
private static final long serialVersionUID = -6722696621467423127L;
/**
* 管理员主键id
*/
@ApiModelProperty(name ="id",value = "管理员主键id")
private Integer id;
/**
* 管理员账号
*/
......
......@@ -2,6 +2,7 @@ package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.dto.BannerDto;
import cn.wisenergy.model.vo.AdvertisingQueryVo;
import com.github.pagehelper.PageInfo;
......@@ -17,7 +18,7 @@ public interface BannerService {
* @param advertising 广告信息
* @return 广告信息
*/
R<Banner> add(Banner advertising);
int add(Banner advertising);
/**
* 编辑广告
......@@ -25,7 +26,7 @@ public interface BannerService {
* @param advertising 广告信息
* @return true 成功 false 失败
*/
R<Boolean> edit(Banner advertising);
R edit(Banner advertising);
/**
* 获取详情
......@@ -33,7 +34,7 @@ public interface BannerService {
* @param id 广告id
* @return 详情
*/
R<Banner> getById(Integer id);
R getById(Integer id);
/**
* 获取广告分页列表
......@@ -41,7 +42,7 @@ public interface BannerService {
* @param advertisingQueryVo 分页参数
* @return 分页结果集
*/
R<PageInfo<Banner>> getList(AdvertisingQueryVo advertisingQueryVo);
R<PageInfo<BannerDto>> getList(AdvertisingQueryVo advertisingQueryVo);
/**
* 开始/暂停投放广告
......@@ -51,4 +52,5 @@ public interface BannerService {
* @return true 成功 false 失败
*/
R<Boolean> putIn(Integer id, Integer status);
}
......@@ -3,12 +3,19 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.BannerMapper;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.dto.BannerDto;
import cn.wisenergy.model.vo.AdvertisingQueryVo;
import cn.wisenergy.service.app.BannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
/**
*@ Description: 广告接口是实现
......@@ -18,28 +25,121 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {
@Autowired
private BannerMapper bannerMapper;
@Override
public R<Banner> add(Banner advertising) {
return null;
public int add(Banner advertising) {
log.info("BannerServiceImpl[].add[].input.param:advertising:{}"+advertising);
//判断是否存在广告图片,给定初始值
if (!StringUtils.isEmpty(advertising.getImage())) {
advertising.setIsHaveImage(1);
}else {
advertising.setIsHaveImage(0);
}
advertising.setStatus(0);
//数据添加
int add = bannerMapper.add(advertising);
return add;
}
@Override
public R<Boolean> edit(Banner advertising) {
return null;
public R edit(Banner advertising) {
log.info("BannerServiceImpl[].getById[].input.param:advertising"+advertising);
if (null==advertising){
return R.error("输入的参数有误");
}
if (advertising.getStatus()<0||advertising.getStatus()>1){
return R.error("缺少重要数据");
}
int edit = bannerMapper.edit(advertising);
//判断数据是否修改成功
if (edit==0) {
return R.error("数据修改失败");
}
return R.ok();
}
@Override
public R<Banner> getById(Integer id) {
return null;
log.info("BannerServiceImpl[].getById[].input.param:id"+id);
if (null==id||id.equals("")) {
return R.error("传入参数无效");
}
Banner banner = bannerMapper.getById(id);
if (null==banner){
return R.error("数据获取失败");
}
return R.ok(banner);
}
@Override
public R<PageInfo<Banner>> getList(AdvertisingQueryVo advertisingQueryVo) {
return null;
public R<PageInfo<BannerDto>> getList(AdvertisingQueryVo advertisingQueryVo) {
log.info("BannerServiceImpl[].getList[].input.param:advertisingQueryVo:{}"+advertisingQueryVo);
if (null==advertisingQueryVo) {
return R.error("输入参数无效");
}
//数据验证
Integer pageNo = advertisingQueryVo.getPageNo();
Integer pageSize = advertisingQueryVo.getPageSize();
if (null == pageSize || pageSize == 0) {
pageSize = 10;
}
if (null == pageNo || pageNo == 0) {
pageNo = 1;
}
//封装参数
HashMap<String, Object> map = new HashMap<>(4);
map.put("pageNo",pageNo-1);
map.put("pageSize",pageSize);
//查询数据;
List<BannerDto> list = bannerMapper.getList(map);
//判断数据是否获取成功
if (CollectionUtils.isEmpty(list)) {
return R.error("数据查询失败");
}
PageInfo<BannerDto> pageInfo = new PageInfo<>();
pageInfo.setTotal(bannerMapper.count());
pageInfo.setPageNum(pageNo);
pageInfo.setPageSize(pageSize);
pageInfo.setList(list);
return R.ok(pageInfo);
}
@Override
public R<Boolean> putIn(Integer id, Integer status) {
return null;
public R putIn(Integer id, Integer status) {
log.info("BannerServiceImpl[].putIn[].input.param,status,id"+status,id);
//判断数据是否正确
if (id==null||id.equals("")) {
return R.error("缺少重要数据");
}
if (status==null||status.equals("")) {
return R.error("缺少重要数据");
}
if (status<0||status>1){
return R.error("缺少重要数据");
}
//修改广告状态
int i = bannerMapper.putIn(id, status);
//判断数据是否修改成功
if (i==0) {
return R.error("数据修改失败");
}
return R.ok();
}
}
......@@ -66,7 +66,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
//3、保存方案查询记录
SchemeQueryRecord schemeQueryRecord = new SchemeQueryRecord();
schemeQueryRecord.setMajorName("");
schemeQueryRecord.setStudentType(userInfo.getExamType());
schemeQueryRecord.setStudentType(userInfo.getStudentType());
schemeQueryRecord.setUserId(userInfo.getId());
schemeQueryRecord.setIsDelete(0);
double score = Double.parseDouble(queryVo.getCultureGrade()) + Double.parseDouble(queryVo.getMajorGrade());
......
......@@ -3,10 +3,8 @@ package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.constant.CommonAttributes;
import cn.wisenergy.common.utils.Md5Util;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.ScoreInfoMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.ScoreInfo;
import cn.wisenergy.model.app.UserInfo;
import cn.wisenergy.mapper.*;
import cn.wisenergy.model.app.*;
import cn.wisenergy.model.dto.UserCommitDto;
import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.UserInfoVo;
......@@ -42,42 +40,57 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, UserInfo> implemen
@Autowired
private ScoreInfoMapper scoreInfoMapper;
@Autowired
private LoginRecordMapper loginRecordMapper;
@Autowired
private UserLimitMapper userLimitMapper;
@Autowired
private PayRecordMapper payRecordMapper;
@Override
public R<PageInfo<UserInfoDto>> getUserList(UserQueryVo queryVo) {
log.info("volunteer_service[]UserServiceImpl[]getUserList[]input.param.queryVo:" + queryVo);
if (null == queryVo) {
return R.error("入参不能为空!");
}
pageHandle(queryVo);
//创建参数容器
HashMap<String, Object> map = new HashMap<>(4);
//将参数放入容器中
map.put("userQueryVo",queryVo);
map.put("pageNo",queryVo.getPageNo());
map.put("pageSize",queryVo.getPageSize());
map.put("startTime",queryVo.getStartTime());
map.put("endTime",queryVo.getEndTime());
//查询用户数据
List<UserInfo> list1 = usersMapper.getList(map);
int total = 0;
List<UserInfoDto> list = new ArrayList<>();
//将集合遍历拿出用户id查询成绩信息
for (UserInfo userInfo : list1) {
//创建UserInfoDto返回对象
UserInfoDto userInfoDto = new UserInfoDto();
//查询成绩信息
//查询相关信息
ScoreInfo scoreInfo = scoreInfoMapper.getById(userInfo.getId());
LoginRecord loginRecord = loginRecordMapper.getById(userInfo.getId());
UserLimit userLimit = userLimitMapper.getById(userInfo.getId());
PayRecord byId = payRecordMapper.getById(userInfo.getId());
//将消息进行同步
BeanUtils.copyProperties(userInfo,userInfoDto);
userInfoDto.setCultureGrade(scoreInfo.getCultureGrade());
userInfoDto.setMajorGrade(scoreInfo.getMajorGrade());
userInfoDto.setRegisterTime(userInfo.getCreateTime());
//将userInfoDto装入集合中
userInfoDto.setLastLoginTime(loginRecord.getUpdateTime());
userInfoDto.setQueryLimit(userLimit.getUsableLimit());
userInfoDto.setMoneyAmount(byId.getMoney());
list.add(userInfoDto);
//统计数据总量
total+=1;
}
System.out.println(total+" "+list1);
PageInfo<UserInfoDto> info = new PageInfo<>();
info.setPageSize(queryVo.getPageSize());
info.setPageNum(queryVo.getPageNo());
info.setTotal(total);
info.setTotal(usersMapper.getUserNumbers());
info.setList(list);
return R.ok(info);
}
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.dto.BannerDto;
import cn.wisenergy.model.vo.AdvertisingQueryVo;
import cn.wisenergy.service.app.BannerService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
/**
* @ Description: 管理端-广告管理
......@@ -15,4 +25,73 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/banner")
@Slf4j
public class BannerController {
@Autowired
private BannerService bannerService;
@ApiOperation(value = "广告添加",notes = "广告添加",httpMethod = "POST")
@ApiImplicitParam(name = "advertising",value = "广告数据",dataType = "Banner")
@PostMapping("/add")
public R add(@RequestBody Banner advertising){
log.info("BannerController[].add[].input.param:advertising{}"+advertising);
if (StringUtils.isEmpty(advertising)) {
return R.error("输入参数无效");
}
int add = bannerService.add(advertising);
if (add==0) {
return R.error("数据添加失败");
}
return R.ok();
}
@ApiOperation(value = "广告查询",notes = "广告查询",httpMethod = "POST")
@ApiImplicitParam(name = "advertisingQueryVo",value = "分页数据",dataType = "AdvertisingQueryVo")
@PostMapping("/getList")
public R<PageInfo<BannerDto>> add(@RequestBody AdvertisingQueryVo advertisingQueryVo){
log.info("BannerController[].add[].input.param:advertisingQueryVo{}"+advertisingQueryVo);
R<PageInfo<BannerDto>> list = bannerService.getList(advertisingQueryVo);
return list;
}
@ApiOperation(value = "查看详情",notes = "查看详情",httpMethod = "GET")
@ApiImplicitParam(name = "id",value = "广告id",dataType = "int")
@GetMapping("/getById")
public R<Banner> getById(Integer id){
log.info("BannerController[].getById[].input.param:id"+id);
R<Banner> bannerR = bannerService.getById(id);
return bannerR;
}
@ApiOperation(value = "广告投放",notes = "广告投放",httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "id",value = "广告id",dataType = "int",required = true),
@ApiImplicitParam(name = "status",value = "广告状态:0:暂停中 1:投放中",dataType = "int",required = true)
})
@GetMapping("/putIn")
public R putIn(Integer id,Integer status){
log.info("BannerController[].putIn[].input.param:id,status"+id,status);
R booleanR = bannerService.putIn(id, status);
//判断数据是否修改成功
if (booleanR.getCode()==0) {
return booleanR;
}
return R.error("数据修改失败");
}
@ApiOperation(value = "广告编辑",notes = "广告编辑",httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "advertising",value = "广告修改数据",dataType = "Banner"),
})
@PostMapping("/edit")
public R edit(@RequestBody Banner advertising){
log.info("BannerController[].edit[].input.param:advertising:{}"+advertising);
R booleanR = bannerService.edit(advertising);
//判断数据是否修改成功
if (booleanR.getCode()==0) {
return booleanR;
}
return R.error("数据修改失败");
}
}
......@@ -11,6 +11,7 @@ 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;
......@@ -32,7 +33,7 @@ public class UserController {
@ApiOperation(value = "用户管理",notes = "用户管理",httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "用户信息", dataType = "UserQueryVo")
@PostMapping("/manage")
public R manageUser(UserQueryVo queryVo){
public R manageUser(@RequestBody UserQueryVo queryVo){
log.info("UserController[].manageUser[].input.param:queryV0:{}"+queryVo);
//查询用户信息
R<PageInfo<UserInfoDto>> userList = userService.getUserList(queryVo);
......
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