Commit 17419f89 authored by ysongq's avatar ysongq

commit

parent d8591742
......@@ -84,7 +84,7 @@ public class LoginController {
@PostMapping(value = "/getCode")
@ApiOperation("通过手机号码获取验证码")
public Result loginCheck(@RequestParam(value = "telephone") String telephone,
@RequestParam(value = "validateCode")String validateCode) {
@RequestParam(value = "validateCode")String validateCode) throws Exception{
// 获取手机号码
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 获取redis中key对应的值
......@@ -110,7 +110,7 @@ public class LoginController {
*/
@GetMapping(value = "/phoneCheck")
@ApiOperation(value = "手机号码校验接口", notes = "手机号码是否已注册")
public Result phoneCheck(@RequestParam("telephone") String telephone) {
public Result phoneCheck(@RequestParam("telephone") String telephone) throws Exception{
if (telephone == null) {
return new Result(false, "请重新输入手机号!",StatusCode.ERROR);
}
......@@ -133,7 +133,7 @@ public class LoginController {
@GetMapping(value = "/phoneUserCheck")
@ApiOperation(value = "手机号用户名重复校验接口", notes = "手机号用户名是否重复")
public Result phoneCheck(@RequestParam(value = "username") String username ,
@RequestParam(value = "password") String telephone, HttpServletRequest request) {
@RequestParam(value = "password") String telephone, HttpServletRequest request) throws Exception{
String ph = "^[1][34578]\\d{9}$";
if (telephone.matches(ph)) {
MallCustomer mallCustomer = mallCustomerService.selectByPhone(telephone);
......
......@@ -53,7 +53,7 @@ public class MallCustomerController extends BaseController {
*/
@PostMapping("/saveCustomer")
@ApiOperation(value = "注册用户", notes = "添加用户")
public Result saveCustomer(@RequestBody CustomerRequest customer, HttpServletRequest request) {
public Result saveCustomer(@RequestBody CustomerRequest customer, HttpServletRequest request) throws Exception{
if (!StringUtils.isEmpty(customer)) {
String ph = "^[1][34578]\\d{9}$";
String telephone= customer.getTelephone();
......@@ -85,7 +85,7 @@ public class MallCustomerController extends BaseController {
*/
@GetMapping("/getLoginUserName")
@ApiOperation(value = "获取当前登录用户信息")
public Result getLoginUserName (HttpServletRequest request) {
public Result getLoginUserName (HttpServletRequest request) throws Exception{
// 从session中获取id
try {
MallCustomerApiDto mallCustomer = (MallCustomerApiDto) SessionUtils.getUserCurrent(request,"mallCustomer");
......@@ -114,4 +114,11 @@ public class MallCustomerController extends BaseController {
}
return new Result(false, "密码修改失败", StatusCode.ERROR);
}
// @PostMapping(value = "/upPassword")
// @ApiModelProperty(value = "忘记密码")
// public Result upPassword(@RequestBody CustomerRequest customer) throws Exception {
// mallCustomerService.upPassword(customer);
// return new Result(true, "密码修改成功", StatusCode.OK);
// }
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.customer;
import com.jz.common.utils.Result;
import com.jz.common.utils.*;
import com.jz.dm.mall.moduls.controller.company.bean.CompanyAddReq;
import com.jz.dm.mall.moduls.service.PersonalUserControllerService;
import io.swagger.annotations.Api;
......
......@@ -12,10 +12,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.concurrent.TimeUnit;
......@@ -39,7 +36,7 @@ public class ValidateCodeController {
* @param telephone
* @return
*/
@PostMapping(value = "/sendForLogin")
@GetMapping(value = "/sendForLogin")
@ApiOperation(value = "注册时发送的验证码")
public Result sendForLogin(@RequestParam(value = "telephone") String telephone) {
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
......@@ -70,7 +67,7 @@ public class ValidateCodeController {
* @param telephone
* @return
*/
@PostMapping("/send4Code")
@GetMapping("/send4Code")
@ApiOperation(value = "修改密码发送验证码")
public Result send4Code(@RequestParam(value = "telephone") String telephone) {
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @ClassName:
......@@ -30,10 +31,10 @@ public class MallHotRecommendGoodsDto implements Serializable {
private String dataPicture;
@ApiModelProperty(value = "数据商品价格")
private String dataPrice;
private BigDecimal dataPrice;
@ApiModelProperty(value = "优惠价格")
private String discountPrice;
private BigDecimal discountPrice;
@ApiModelProperty(value = "用户使用人数")
private Long usePerson;
......@@ -78,19 +79,20 @@ public class MallHotRecommendGoodsDto implements Serializable {
this.dataPicture = dataPicture;
}
public String getDataPrice() {
public BigDecimal getDataPrice() {
return dataPrice;
}
public void setDataPrice(String dataPrice) {
public void setDataPrice(BigDecimal dataPrice) {
this.dataPrice = dataPrice;
}
public String getDiscountPrice() {
public BigDecimal getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(String discountPrice) {
public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice;
}
......
......@@ -55,4 +55,10 @@ public interface MallCustomerService {
* @return
*/
MallCustomer selectByUser(Long customerId);
// /**
// * 忘记密码
// * @param customer
// */
// void upPassword(CustomerRequest customer);
}
\ No newline at end of file
......@@ -160,5 +160,16 @@ public class MallCustomerServiceImpl implements MallCustomerService {
return mallCustomer;
}
// /**
// * 忘记密码
// *
// * @param customer
// */
// @Override
// public void upPassword(CustomerRequest customer) {
// // 通过手机号判断是否注册过
//
// }
}
\ No newline at end of file
......@@ -7,6 +7,9 @@ import com.jz.dm.mall.moduls.service.MallHotRecommendGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.MathContext;
import java.text.DecimalFormat;
import java.util.List;
/**
......@@ -28,7 +31,9 @@ public class MallHotRecommendGoodsServiceImpl implements MallHotRecommendGoodsSe
@Override
public List<MallHotRecommendGoodsDto> selectByPopularApi() {
List<MallHotRecommendGoodsDto> popularApiList = tMallHotRecommendGoodsDao.selectByPopularApi();
for (MallHotRecommendGoodsDto goodsDto : popularApiList) {
goodsDto.getDataPrice().setScale(3);
}
return popularApiList;
}
}
\ No newline at end of file
......@@ -94,7 +94,7 @@
SELECT
t1.data_goods_id as dataGoodsId ,
t1.data_name as dataName,
(CASE WHEN t1.data_type = '01' then 'api' WHEN t1.data_type = '01' then 'api' end) dataTYpe,
(CASE WHEN t1.data_type = '01' then 'api' WHEN t1.data_type = '02' then '数据包' end) dataTYpe,
t1.data_label as dataLabel,
t1.data_picture as dataPicture,
t1.data_price as dataPrice,
......
......@@ -65,7 +65,7 @@ public class DepartmentController extends BaseController {
*/
@GetMapping(value = "/getDepartment/{id}")
@ApiOperation(value = "主键查询用户企业详情信息")
public Result<CompanyDetailsDto> selectById(@PathVariable(value = "id") Long id, HttpServletRequest req) {
public Result<CompanyDetailsDto> selectById(@PathVariable(value = "id") Long id, HttpServletRequest req) throws Exception{
if (id != null) {
CompanyDetailsDto companyDetails = departmentService.selectById(id);
return new Result<CompanyDetailsDto>(true, "查询企业详情成功!", StatusCode.OK, companyDetails);
......@@ -80,7 +80,7 @@ public class DepartmentController extends BaseController {
*/
@PostMapping(value = "/audit/{id}")
@ApiModelProperty(value = "企业审核")
public Result audit(@PathVariable(value = "id") Long id, HttpServletRequest req) {
public Result audit(@PathVariable(value = "id") Long id, HttpServletRequest req) throws Exception{
if (id != null) {
departmentService.audit(id, req);
return new Result<CompanyDetailsDto>(true, "企业审核成功!", StatusCode.OK);
......@@ -106,4 +106,4 @@ public class DepartmentController extends BaseController {
}
return new Result<CompanyDetailsDto>(false, "添加用户失败!", StatusCode.ERROR);
}
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ public class DataGoodsApiController extends BaseController {
*/
@GetMapping("/getDataDetails/{id}")
@ApiOperation(value = "点击商品查看商品详情", notes = "api商品")
public Result<DataGoodsApiDto> findById(@PathVariable(value = "id") Long id) {
public Result<DataGoodsApiDto> findById(@PathVariable(value = "id") Long id) throws Exception{
if (id != null) {
Result<DataGoodsApiDto> result = new Result<>();
DataGoodsApiDto dataGoodsApi = tDataGoodsApiService.selectById(id);
......
......@@ -6,6 +6,7 @@ import com.jz.common.utils.Result;
import com.jz.common.utils.SessionUtils;
import com.jz.common.utils.StatusCode;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.sys.bean.req.LoginRequest;
import com.jz.manage.moduls.service.SysUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -31,20 +32,20 @@ public class LoginController extends BaseController {
private RedisTemplate redisTemplate;
/**
* 登录功能
* @param username 账号
* @param password 密码
* @return
*/
@PostMapping(value = "login")
public Result login(String username, String password, HttpServletRequest request) {
public Result login(@RequestBody LoginRequest user, HttpServletRequest request) {
if (!StringUtils.isEmpty(user)) {
String username = user.getUsername();
String password = user.getPassword();
// 手机
String ph = "^[1][34578]\\d{9}$";
// 如果是手机验证
if (username.matches(username)) {
SysUser sysUser = sysUserService.selectByPhone(username, request);
if (sysUser != null) {
if (sysUser.getTelephone().equals(username) && sysUser.getPassword().equals(password)){
if (sysUser.getTelephone().equals(username) && sysUser.getPassword().equals(password)) {
return new Result<>(true, "登录成功!", StatusCode.OK);
}
return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR);
......@@ -52,40 +53,41 @@ public class LoginController extends BaseController {
}
SysUser sysUser = sysUserService.selectByUsername(username, request);
if (sysUser != null) {
if (sysUser.getAccount().equals(username) && sysUser.getPassword().equals(password)){
if (sysUser.getAccount().equals(username) && sysUser.getPassword().equals(password)) {
return new Result<>(true, "登录成功!", StatusCode.OK);
}
}
return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR);
}
/**
* 手机号码校验
* @param paramMap
* @param res
* @return
*/
@PostMapping(value = "/check")
public Result loginCheck(@RequestBody Map<String, String> paramMap, HttpServletResponse res) {
// 获取手机号码
String telephone = paramMap.get("telephone");
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 获取redis中key对应的值
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "请重新获取验证码!", StatusCode.ERROR);
}
// 判断验证码是否一致
if (!codeInRedis.equals(paramMap.get("validateCode"))) {
return new Result(false, "验证码不正确!", StatusCode.ERROR);
return new Result(false, "用户名密码不能为空!", StatusCode.ERROR);
}
// 删除redis的验证码
redisTemplate.delete(key);
return new Result(true, "验证码正确!", StatusCode.OK);
}
// /**
// * 手机号码校验
// * @param paramMap
// * @param res
// * @return
// */
// @PostMapping(value = "/check")
// public Result loginCheck(@RequestBody Map<String, String> paramMap, HttpServletResponse res) {
// // 获取手机号码
// String telephone = paramMap.get("telephone");
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// // 获取redis中key对应的值
// String codeInRedis = (String) redisTemplate.opsForValue().get(key);
// if (StringUtils.isEmpty(codeInRedis)) {
// return new Result(false, "请重新获取验证码!", StatusCode.ERROR);
// }
// // 判断验证码是否一致
// if (!codeInRedis.equals(paramMap.get("validateCode"))) {
// return new Result(false, "验证码不正确!", StatusCode.ERROR);
// }
// // 删除redis的验证码
// redisTemplate.delete(key);
//
// return new Result(true, "验证码正确!", StatusCode.OK);
// }
......
package com.jz.manage.moduls.controller.sys.bean;
package com.jz.manage.moduls.controller.sys.bean.dto;
import com.jz.common.enums.UserTypeEnum;
import io.swagger.annotations.ApiModel;
......
package com.jz.manage.moduls.controller.sys.bean.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/17
* @Version:
*/
@ApiModel(value = "用户登录接受的参数")
public class LoginRequest {
@ApiModelProperty(value = "验证码")
private String vailCode;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "用户名")
private String username;
public String getVailCode() {
return vailCode;
}
public void setVailCode(String vailCode) {
this.vailCode = vailCode;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
......@@ -15,5 +15,5 @@ public interface DataGoodsApiService {
* @param id
* @return
*/
DataGoodsApiDto selectById(Long id);
DataGoodsApiDto selectById(Long id) throws Exception;
}
\ No newline at end of file
......@@ -24,24 +24,24 @@ public interface DepartmentService {
* @param req
* @return
*/
PageInfoResponse<EnterpriseAuditDto> findList(EnterpriseAuditRequest auditRequest, HttpServletRequest req);
PageInfoResponse<EnterpriseAuditDto> findList(EnterpriseAuditRequest auditRequest, HttpServletRequest req) throws Exception;
/**
* 主键获取用户企业详情信息
* @param id
* @return
*/
CompanyDetailsDto selectById(Long id);
CompanyDetailsDto selectById(Long id) throws Exception;
/**
* 企业审核信息
* @param id
*/
void audit(Long id, HttpServletRequest req);
void audit(Long id, HttpServletRequest req) throws Exception;
/**
* 添加用户
* @param saveCustomerRequest
*/
Result add(SaveCustomerRequest saveCustomerRequest, HttpServletRequest req);
Result add(SaveCustomerRequest saveCustomerRequest, HttpServletRequest req) throws Exception;
}
\ No newline at end of file
......@@ -3,7 +3,6 @@ package com.jz.manage.moduls.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.MallCustomerApiDto;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
......@@ -17,7 +16,7 @@ import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import com.jz.manage.moduls.controller.customer.bean.request.SaveCustomerRequest;
import com.jz.manage.moduls.controller.sys.bean.SysUserDto;
import com.jz.manage.moduls.controller.sys.bean.dto.SysUserDto;
import com.jz.manage.moduls.entity.Department;
import com.jz.manage.moduls.entity.FinanceCustomerAssets;
import com.jz.manage.moduls.entity.FinanceCustomerBalance;
......
......@@ -5,7 +5,7 @@ import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.entity.SysUser;
import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.SessionUtils;
import com.jz.manage.moduls.controller.sys.bean.SysUserDto;
import com.jz.manage.moduls.controller.sys.bean.dto.SysUserDto;
import com.jz.manage.moduls.mapper.SysUserDao;
import com.jz.manage.moduls.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
......
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