Commit 9f66456b authored by liaoanyuan's avatar liaoanyuan

增加私人订制方案查询功能1

parent 18d1302e
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.Local;
import java.util.List;
public interface LocalMapper {
/**
* 获取地区列表
* @return 地区列表
*/
List<Local> getList();
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.model.app.Banner;
import cn.wisenergy.model.app.Staff;
import cn.wisenergy.model.dto.StaffDto;
......@@ -45,4 +46,11 @@ public interface StaffMapper extends BaseMapper<Banner> {
* @return 数据条数
*/
int getUserNumbers(Map<String, Object> map);
/**
* 查询员工信息
* @param map 查询参数
* @return
*/
Staff getStaff(Map<String, Object> map);
}
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.StaffUserVip;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StaffUserVipMapper {
List<StaffUserVip> getList(@Param("staffId") Integer staffId);
int add(StaffUserVip staffUserVip);
}
package cn.wisenergy.mapper;
import cn.hutool.system.UserInfo;
import cn.wisenergy.model.app.StaffUserVip;
import cn.wisenergy.model.app.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -57,4 +58,6 @@ public interface UsersMapper extends BaseMapper<User> {
User getByPhone(@Param("phone") String phone);
List<User> test(@Param("list") List<String> list);
List<User> getUserByStaffId(Map<String, Object> map);
}
......@@ -112,4 +112,16 @@
</where>
</select>
<select id="getStaff" resultMap="staffMap" parameterType="map">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
login_name=#{loginName}
and
is_delete=0
</where>
</select>
</mapper>
\ No newline at end of file
<?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.StaffUserVipMapper">
<resultMap id="staffUserMap" type="cn.wisenergy.model.app.StaffUserVip">
<id column="id" property="id"/>
<result column="staff_id" property="staffId"/>
<result column="user_vip_id" property="userVipId"/>
<result column="is_delete" property="isDelete"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
staff_user_vip
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
staff_id,user_vip_id,is_delete,create_time,update_time
</sql>
<sql id="vals">
#{staffId},#{userVipId},
#{isDelete},now(),now()
</sql>
<sql id="updateCondition">
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="userVipId !=null">user_vip_id = #{userVipId},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="staffId != null">and staff_id = #{staffId}</if>
<if test="userVipId !=null">and user_vip_id = #{userVipId}</if>
<if test="isDelete != null">and is_delete = #{isDelete}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<select id="getList" parameterType="int" resultMap="staffUserMap">
select user_vip_id
from <include refid="table"/>
where
staff_id=#{staffId}
</select>
<insert id="add" parameterType="cn.wisenergy.model.app.StaffUserVip">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
</mapper>
\ No newline at end of file
......@@ -174,4 +174,29 @@
</if>
</where>
</select>
<select id="getUserByStaffId" resultMap="userMap" parameterType="map">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
is_delete=0
<if test="list != null">
and id in
<foreach collection="list" index="index" item="id" separator="," open="(" close=")">
#{id.userVipId}
</foreach>
</if>
<if test="userName != null">and user_name like ('%' #{userName} '%')</if>
<if test="phone != null">and phone like ('%' #{phone} '%')</if>
order by create_time desc
<if test="pageNo != null">
limit #{pageNo},#{pageSize}
</if>
</where>
</select>
</mapper>
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel("Local")
public class Local implements Serializable {
private static final long serialVersionUID = 7245967746798893377L;
/**
* 主键id
*/
@ApiModelProperty(name = "id", value = "地区主键id")
private Integer id;
/**
* 地区名称
*/
@ApiModelProperty(name = "localName",value = "地区名称")
private String localName;
/**
* 是否删除
*/
@ApiModelProperty(name = "isDelete", value = "是否删除 0:正常 1:删除")
private Integer isDelete;
/**
* 创建时间
*/
@ApiModelProperty(name = "createTime", value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(name = "updateTime", value = "修改时间")
private Date updateTime;
}
......@@ -108,4 +108,5 @@ public class ScoreInfo implements Serializable {
*/
@ApiModelProperty(value = "更改时间",name = "updateTime")
private Date updateTime;
}
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel("StaffUserVip")
public class StaffUserVip implements Serializable {
private static final long serialVersionUID = -3233546906942298301L;
/**
* 主键id
*/
@ApiModelProperty(name = "id",value = "主键id")
private Integer id;
/**
* 员工id
*/
@ApiModelProperty(name = "staffId",value = "员工id")
private Integer staffId;
/**
* vip客户id
*/
@ApiModelProperty(name = "userVipId",value = "vip客户id")
private Integer userVipId;
/**
* 是否删除
*/
@ApiModelProperty(name = "isDelete", value = "是否删除 0:正常 1:删除")
private Integer isDelete;
/**
* 创建时间
*/
@ApiModelProperty(name = "createTime", value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(name = "updateTime", value = "修改时间")
private Date updateTime;
}
package cn.wisenergy.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel("StaffDto")
public class StaffDto implements Serializable {
private static final long serialVersionUID = -7701107348928870362L;
......
......@@ -6,7 +6,7 @@ import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "AccountInfo")
@ApiModel(value = "AccountLoginVo")
public class AccountLoginVo implements Serializable {
private static final long serialVersionUID = -3802879442149734552L;
......
package cn.wisenergy.model.vo;
import cn.wisenergy.model.app.ScoreInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@Api("UserVipCommitVo")
public class UserVipCommitVo implements Serializable {
private static final long serialVersionUID = -8080395072348646562L;
/**
* 用户id
*/
@ApiModelProperty(value = "用户id", name = "userId")
private Integer userId;
/**
* 主键id
*/
@ApiModelProperty(name = "staffId", value = "员工id")
private Integer staffId;
/**
* 用户名称
*/
@ApiModelProperty(value = "用户名称", name = "userName")
private String userName;
/**
* 手机号码
*/
@ApiModelProperty(value = "手机号码", name = "phone")
private String phone;
/**
* 用户头像
*/
@ApiModelProperty(value = "用户头像", name = "headImage")
private String headImage;
/**
* 性别
*/
@ApiModelProperty(value = "性别", name = "sex")
private Integer sex;
/**
* 学校
*/
@ApiModelProperty(value = "学校", name = "school")
private String school;
/**
* 考生类型 1:文化课考生 2:美术生 3:体育生 4:文学编导考生
*/
@ApiModelProperty(value = "考生类型 1:文化课考生 2:美术生 3:体育生 4:文学编导考生", name = "studentType")
private Integer studentType;
/**
* 用户来源 1:PC 2:APP
*/
@ApiModelProperty(value = "用户来源 1:PC 2:APP", name = "source")
private Integer source;
/**
* 学生成绩信息
*/
@ApiModelProperty(value = "学生成绩信息", name = "scoreInfo")
private ScoreInfo scoreInfo;
@ApiModelProperty(value = "flag:1:添加 2:编辑", name = "scoreInfo")
private Integer flag;
}
package cn.wisenergy.model.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@Api("UserVipQueryVo")
public class UserVipQueryVo implements Serializable {
private static final long serialVersionUID = -6966220437115781045L;
/**
* 主键id
*/
@ApiModelProperty(name = "staffId", value = "员工主键id")
private Integer staffId;
/**
* 起始页
*/
@ApiModelProperty(value = "起始页", name = "pageNo")
private Integer pageNo;
/**
* 页大小
*/
@ApiModelProperty(value = "页大小", name = "pageSize")
private Integer pageSize;
/**
* 用户名称
*/
@ApiModelProperty(value= "用户名" ,name="userName")
private String userName;
/**
* 电话号码
*/
@ApiModelProperty(name = "phone",value = "手机号")
private String phone;
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.AccountLoginVo;
import cn.wisenergy.model.vo.UserVipCommitVo;
import cn.wisenergy.model.vo.UserVipQueryVo;
import com.github.pagehelper.PageInfo;
public interface StaffUserVipService {
/**
* 员工登录
*
* @return true:成功 false:失败
*/
R<Boolean> staffLogin(AccountLoginVo accountLoginVo);
/**
* 获取员工学生关系表
*
* @param userVipQueryVo 查询信息
* @return
*/
R<PageInfo<UserInfoDto>> getList(UserVipQueryVo userVipQueryVo);
/**
* 添加员工和vip客户关系
* @param userVipCommitVo 添加信息
* @return true:成功 false:失败
*/
R<Boolean> addUserVip(UserVipCommitVo userVipCommitVo);
/**
* 添加员工和vip客户关系
* @param staffId 员工id
* @param phone 手机号
* @return true:成功 false:失败
*/
R<Boolean> addUserByPhone(Integer staffId,String phone);
}
\ No newline at end of file
......@@ -77,4 +77,6 @@ public interface UserService {
R<List<User>> test();
R<UserInfoVo> commitUserVipInfo(UserCommitDto userInfo);
}
......@@ -132,6 +132,16 @@ public class StaffServiceImpl implements StaffService {
return R.error("传入参数为空");
}
//创建参数容器map
HashMap<String, Object> map = new HashMap<>(4);
map.put("loginName",staff.getLoginName());
//查询管理者信息
Staff staff3 = staffMapper.getStaff(map);
if (null!=staff) {
return R.error("用户已存在");
}
//将参数转移到staff对象中
Staff staff2 = new Staff();
staff2.setIsDelete(0);
......
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.Md5Util;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.*;
import cn.wisenergy.model.app.*;
import cn.wisenergy.model.dto.UserCommitDto;
import cn.wisenergy.model.dto.UserDto;
import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.AccountLoginVo;
import cn.wisenergy.model.vo.UserInfoVo;
import cn.wisenergy.model.vo.UserVipCommitVo;
import cn.wisenergy.model.vo.UserVipQueryVo;
import cn.wisenergy.service.app.StaffUserVipService;
import cn.wisenergy.service.common.UserVipManager;
import cn.wisenergy.service.common.VolunteerManager;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class StaffUserVipServiceImpl implements StaffUserVipService {
@Autowired
private StaffMapper staffMapper;
@Autowired
private StaffUserVipMapper staffUserVipMapper;
@Autowired
private UsersMapper usersMapper;
@Autowired
private ScoreInfoMapper scoreInfoMapper;
@Autowired
private LoginRecordMapper loginRecordMapper;
@Autowired
private UserLimitMapper userLimitMapper;
@Autowired
private PayRecordMapper payRecordMapper;
@Autowired
private VolunteerManager volunteerManager;
@Autowired
private UserVipManager userVipManager;
//初始密码
private static final String PASSWORD = "123456";
@Override
public R<Boolean> staffLogin(AccountLoginVo loginVo) {
log.info("StaffUserVipServiceImpl[].staffLogin[].input:param:" + loginVo);
//判断参数是否为空
if (null == loginVo || StringUtils.isBlank(loginVo.getUserName()) || StringUtils.isBlank(loginVo.getPassword())) {
return R.error("账号或密码为空");
}
//创建参数容器map
HashMap<String, Object> map = new HashMap<>(4);
map.put("loginName", loginVo.getUserName());
//查询管理者信息
Staff staff = staffMapper.getStaff(map);
if (null == staff) {
return R.error("用户不存在");
}
if (!staff.getPassword().equals(Md5Util.digestMD5(loginVo.getPassword()))) {
return R.error("账号或者密码错误");
}
return R.ok(0, true);
}
@Override
public R<PageInfo<UserInfoDto>> getList(UserVipQueryVo queryVo) {
log.info("StaffUserVipServiceImpl[].getList[].input.param:" + queryVo);
if (null==queryVo||null==queryVo.getStaffId()) {
return R.error("入参为空");
}
List<StaffUserVip> listStaff = staffUserVipMapper.getList(queryVo.getStaffId());
//创建参数容器
Map<String, Object> map = new HashMap<>(4);
//将参数放入容器中
if (null!=queryVo.getPageNo()||null!=queryVo.getPageSize()){
map.put("pageNo", (queryVo.getPageNo() - 1) * queryVo.getPageSize());
map.put("pageSize", queryVo.getPageSize());
}
map.put("userName", queryVo.getUserName());
map.put("phone", queryVo.getPhone());
map.put("list",listStaff);
//查询用户数据
List<User> list1 = usersMapper.getUserByStaffId(map);
List<UserInfoDto> list = new ArrayList<>();
//将集合遍历拿出用户id查询成绩信息
for (User user : list1) {
UserInfoDto userInfoDto = new UserInfoDto();
//查询相关信息
ScoreInfo scoreInfo = scoreInfoMapper.getByUserId(user.getId());
if (null != scoreInfo) {
userInfoDto.setCultureGrade(scoreInfo.getCultureGrade().toString());
userInfoDto.setMajorGrade(null==scoreInfo.getMajorGrade()?"":scoreInfo.getMajorGrade().toString());
}
LoginRecord loginRecord = loginRecordMapper.getById(user.getId());
if (null != loginRecord) {
userInfoDto.setLastLoginTime(loginRecord.getUpdateTime());
userInfoDto.setIp(loginRecord.getIp());
}
UserLimit userLimit = userLimitMapper.getByUserId(user.getId());
if (null != userLimit) {
userInfoDto.setQueryLimit(userLimit.getUsableLimit());
}
List<PayRecord> byId = payRecordMapper.getById(user.getId());
//计算充值卡充值次数
Integer rechargeTimes = 0;
//支付宝充值总金额
Integer alipayMoney = 0;
//微信充值总金额
Integer weChatMoney = 0;
if (!CollectionUtils.isEmpty(byId)) {
for (PayRecord payRecord : byId) {
if (payRecord.getType() == 1) {
alipayMoney += Integer.valueOf(null == payRecord.getMoney() ? 0 : payRecord.getMoney());
}
if (payRecord.getType() == 2) {
weChatMoney += Integer.valueOf(null == payRecord.getMoney() ? 0 : payRecord.getMoney());
}
if (payRecord.getType() == 3) {
rechargeTimes += 1;
}
}
}
userInfoDto.setWeChatMoney(String.valueOf(weChatMoney));
userInfoDto.setAlipayMoney(String.valueOf(alipayMoney));
userInfoDto.setRechargeTimes(rechargeTimes);
//将消息进行同步
BeanUtils.copyProperties(user, userInfoDto);
userInfoDto.setUserId(user.getId());
userInfoDto.setRegisterTime(user.getCreateTime());
list.add(userInfoDto);
}
PageInfo<UserInfoDto> info = new PageInfo<>();
info.setPageSize(null==queryVo.getPageSize()?0:queryVo.getPageSize());
info.setPageNum(null==queryVo.getPageNo()?0:queryVo.getPageNo());
info.setTotal(usersMapper.getUserNumbers(map));
info.setList(list);
return R.ok(info);
}
@Override
public R<Boolean> addUserVip(UserVipCommitVo userVipCommitVo) {
log.info("StaffUserVipServiceImpl[].addUserVip[].input.param:" + userVipCommitVo);
if (null == userVipCommitVo || StringUtils.isBlank(userVipCommitVo.getPhone())||null==userVipCommitVo.getStaffId()) {
return R.error("入参为空");
}
String phone = userVipCommitVo.getPhone();
User bool = userVipManager.checkPhone(phone);
if (null!=bool) {
return R.error("该电话号码" + phone + "已被使用!");
}
userVipCommitVo.setFlag(1);
R<Boolean> booleanR = userVipManager.CommitUserVip(userVipCommitVo);
User byPhone =userVipManager.checkPhone(phone);
//判断信息是否添加成功
if (booleanR.getCode()==1) {
usersMapper.delById(byPhone.getId());
return R.error("信息添加失败2");
}
//进行vip客户和员工绑定
if (null==byPhone) {
usersMapper.delById(byPhone.getId());
return R.error("信息添加失败3");
}
return userVipManager.addPhone1(userVipCommitVo.getStaffId(),byPhone.getId());
}
@Override
public R<Boolean> addUserByPhone(Integer staffId, String phone) {
log.info("StaffUserVipServiceImpl[].addUserByPhone[].input.param:" +staffId,phone);
return addPhone(staffId,phone);
}
private R<Boolean> addPhone(Integer staffId,String phone){
if (null==staffId|| StringUtils.isBlank(phone)) {
return R.error("入参为空");
}
//进行vip客户和员工绑定
User byPhone =userVipManager.checkPhone(phone);
if (null==byPhone) {
return R.error("信息添加失败3");
}
StaffUserVip staffUserVip = new StaffUserVip();
staffUserVip.setStaffId(staffId);
staffUserVip.setUserVipId(byPhone.getId());
int add = staffUserVipMapper.add(staffUserVip);
//判断数据是否添加成功
if (add==0) {
return R.error("信息添加失败");
}
return R.ok(0,true);
}
}
\ No newline at end of file
......@@ -370,4 +370,48 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
orderQueryVo.setPageNo(pageNum);
orderQueryVo.setPageSize(pageSize);
}
@Override
public R<UserInfoVo> commitUserVipInfo(UserCommitDto userInfo) {
log.info("volunteer-service[]UserServiceImpl[]commitUserInfo[]input.param.userInfo:" + userInfo);
if (null == userInfo) {
return R.error("入参为空!");
}
User user = new User();
//2、要提交的用户信息
user.setSchool(userInfo.getSchool());
user.setSex(userInfo.getSex());
user.setExamType(userInfo.getStudentType());
user.setUserName(userInfo.getUserName());
user.setIsDelete(0);
user.setId(userInfo.getUserId());
user.setSource(userInfo.getSource());
//3、要提交的用户的成绩信息
ScoreInfo scoreInfo = userInfo.getScoreInfo();
//检查副科
R<Boolean> checkScore = volunteerManager.checkScore(scoreInfo);
if (null != checkScore && checkScore.getCode() == ERROR_CODE) {
return R.error(checkScore.getMessage());
}
//4、更新用户信息和保存用户成绩
boolean bool = volunteerManager.updateAndSaveUserInfo(user, scoreInfo,userInfo.getFlag());
if (!bool) {
return R.error("添加用户信息失败!");
}
//返回信息
UserInfoVo userInfoVo = new UserInfoVo();
userInfoVo.setUserId(userInfo.getUserId());
userInfoVo.setUserName(userInfo.getUserName());
userInfoVo.setPhone(user.getPhone());
userInfoVo.setSex(userInfo.getSex());
userInfoVo.setStudentType(userInfo.getStudentType());
userInfoVo.setUserName(userInfo.getUserName());
return R.ok(userInfoVo);
}
}
package cn.wisenergy.service.common;
import cn.wisenergy.common.utils.Md5Util;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.StaffUserVipMapper;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.StaffUserVip;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.dto.UserCommitDto;
import cn.wisenergy.model.vo.UserInfoVo;
import cn.wisenergy.model.vo.UserVipCommitVo;
import cn.wisenergy.service.app.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Component
@Slf4j
public class UserVipManager {
@Autowired
private UserService userService;
@Autowired
private VolunteerManager volunteerManager;
@Autowired
private StaffUserVipMapper staffUserVipMapper;
@Autowired
private UsersMapper usersMapper;
//初始密码
private static final String PASSWORD = "123456";
@Transactional(propagation = Propagation.REQUIRES_NEW)
public R<Boolean> CommitUserVip(UserVipCommitVo userVipCommitVo){
//3、给密码加密 初始密码:123456
String secret = Md5Util.digestMD5(PASSWORD);
R<UserInfoVo> userInfoVoR = volunteerManager.saveUserAndLimit(userVipCommitVo.getPhone(), secret, userVipCommitVo.getSource());
if (null == userInfoVoR.getData()) {
return R.error("信息添加失败1");
}
User user = checkPhone(userVipCommitVo.getPhone());
//调用用户提交信息接口
UserCommitDto userCommitDto = new UserCommitDto();
BeanUtils.copyProperties(userVipCommitVo,userCommitDto);
userCommitDto.setUserId(user.getId());
R<UserInfoVo> userInfoVo = userService.commitUserVipInfo(userCommitDto);
if (null==userInfoVo.getData()) {
return R.ok(1,false);
}
return R.ok(0,true);
}
public R<Boolean> addPhone1(Integer staffId,Integer userId){
StaffUserVip staffUserVip = new StaffUserVip();
staffUserVip.setStaffId(staffId);
staffUserVip.setUserVipId(userId);
staffUserVip.setIsDelete(0);
int add = staffUserVipMapper.add(staffUserVip);
//判断数据是否添加成功
if (add==0) {
usersMapper.delById(userId);
return R.error("信息添加失败");
}
return R.ok(0,true);
}
public User checkPhone(String phone) {
//根据电话号码查询用户
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("phone", phone);
queryWrapper.eq("is_delete", 0);
User user = usersMapper.selectOne(queryWrapper);
if (null != user) {
return user;
}
return null;
}
}
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.AccountLoginVo;
import cn.wisenergy.model.vo.UserVipCommitVo;
import cn.wisenergy.model.vo.UserVipQueryVo;
import cn.wisenergy.service.app.StaffUserVipService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
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;
@RestController
@Api(tags = "员工端")
@RequestMapping("/staffUser")
@Slf4j
public class StaffUserVipController {
@Autowired
private StaffUserVipService staffUserVipService;
@ApiOperation(value = "员工登录",notes = "员工登录",httpMethod = "POST")
@ApiModelProperty(name = "loginVo",value = "登录信息",dataType = "AccountLoginVo")
@PostMapping("/login")
public R<Boolean> login(@RequestBody AccountLoginVo loginVo){
log.info("StaffUserVipController[].login[].input.param:"+loginVo);
return staffUserVipService.staffLogin(loginVo);
}
@ApiOperation(value = "添加Vip客户",notes = "添加Vip客户",httpMethod = "POST")
@ApiModelProperty(name = "userVipCommitVo",value = "vip客户信息",dataType = "UserVipCommitVo")
@PostMapping("/add")
public R<Boolean> addUserVip(@RequestBody UserVipCommitVo userVipCommitVo){
log.info("StaffUserVipController[].addUserVip[].input.param:"+userVipCommitVo);
return staffUserVipService.addUserVip(userVipCommitVo);
}
@ApiOperation(value = "添加Vip客户(当客户已存在时)",notes = "添加Vip客户(当客户已存在时)",httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "staffId", value = "员工id", dataType = "int"),
@ApiImplicitParam(name = "phone", value = "vip客户手机号", dataType = "string")
}
)
@PostMapping("/add2")
public R<Boolean> addUserVipByPhone(Integer staffId, String phone){
log.info("StaffUserVipController[].addUserVipByPhone[].input.param:"+staffId,phone);
return staffUserVipService.addUserByPhone(staffId,phone);
}
@ApiOperation(value = "查询Vip客户",notes = "查询Vip客户",httpMethod = "POST")
@ApiModelProperty(name = "queryVo",value = "vip客户信息",dataType = "UserVipQueryVo")
@PostMapping("/getList")
public R<PageInfo<UserInfoDto>> getUserVipList(@RequestBody UserVipQueryVo queryVo){
log.info("StaffUserVipController[].addUserVip[].input.param:"+queryVo);
return staffUserVipService.getList(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