main
masong 2 years ago
parent 392f0b46a4
commit 05921e6e13
  1. 18
      cjy-module-system/cjy-module-system-biz/src/main/java/com/cjy/traceability/module/system/controller/admin/auth/AuthController.java
  2. 3
      cjy-module-system/cjy-module-system-biz/src/main/java/com/cjy/traceability/module/system/service/auth/AdminAuthService.java
  3. 11
      cjy-module-system/cjy-module-system-biz/src/main/java/com/cjy/traceability/module/system/service/auth/AdminAuthServiceImpl.java
  4. 1
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/dal/mysql/product/ProductMapper.java
  5. 6
      cjy-module-traceability/cjy-module-traceability-biz/src/main/java/com/cjy/traceability/module/traceability/service/product/ProductServiceImpl.java
  6. 1
      cjy-server/src/main/resources/application.yaml

@ -183,9 +183,13 @@ public class AuthController {
@Idempotent(timeout = 60, timeUnit = TimeUnit.SECONDS, message = "已发送请求,60s内请勿重复提交")
@Operation(summary = "忘记密码-发送验证码", description = "适合未登录的用户,已忘记密码账户")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<String> sendRandomCode(@RequestBody @Valid SendRandomCodeReqVO reqVO) {
String msg = authService.sendRandomCode(reqVO);
return success(msg);
public CommonResult<String> sendRandomCode(@RequestBody SendRandomCodeReqVO reqVO) {
if(StrUtil.isBlank(reqVO.getUsername())){
return error(505,"请输入用户名");
}else if(reqVO.getUsername().length() <4 || reqVO.getUsername().length()>=20){
return error(505,"用户名长度为4-20位");
}
return authService.sendRandomCode(reqVO);
}
@GetMapping("/checkRandomCode")
@PermitAll
@ -193,10 +197,10 @@ public class AuthController {
public CommonResult<Boolean> checkRandomCode(@RequestParam("username") String userName,@RequestParam("captchaVerification") String captchaVerification){
String verification = stringRedisTemplate.opsForValue().get(captchaVerification);
if(StrUtil.isBlank(verification)){
return error(500,"请获取邮箱验证码!");
return error(505,"请获取邮箱验证码!");
}
if(!verification.equals(userName)){
return error(500,"请输入正确的用户名");
return error(505,"验证码错误,请检查!");
}else{
return success(true);
}
@ -216,13 +220,13 @@ public class AuthController {
public CommonResult<String> resetPassword(@RequestBody @Valid ResetPwdReqVO reqVO) throws Exception {
String verification = stringRedisTemplate.opsForValue().get(reqVO.getCaptchaVerification());
if(StrUtil.isBlank(verification)){
ErrorCode errorCode = new ErrorCode(500,"验证码过期");
ErrorCode errorCode = new ErrorCode(505,"验证码过期");
return error(errorCode);
}
//修改密码
AdminUserDO user = userService.getUserByUsername(verification);
if (user.getStatus().equals(CommonStatusEnum.DISABLE)) {
ErrorCode errorCode = new ErrorCode(500,"该账号已停用");
ErrorCode errorCode = new ErrorCode(505,"该账号已停用");
return error(errorCode);
}
String plainText = CryptoUtils.decryptByRSA(CryptoUtils.PRIVATE_KEY, reqVO.getPassword());

@ -1,5 +1,6 @@
package com.cjy.traceability.module.system.service.auth;
import com.cjy.traceability.framework.common.pojo.CommonResult;
import com.cjy.traceability.module.system.controller.admin.auth.vo.*;
import com.cjy.traceability.module.system.dal.dataobject.user.AdminUserDO;
@ -73,7 +74,7 @@ public interface AdminAuthService {
* 重置密码 -发送验证码
* @return
*/
String sendRandomCode(SendRandomCodeReqVO reqVO);
CommonResult<String> sendRandomCode(SendRandomCodeReqVO reqVO);

@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.cjy.traceability.framework.common.enums.CommonStatusEnum;
import com.cjy.traceability.framework.common.enums.UserTypeEnum;
import com.cjy.traceability.framework.common.pojo.CommonResult;
import com.cjy.traceability.framework.common.util.monitor.TracerUtils;
import com.cjy.traceability.framework.common.util.servlet.ServletUtils;
import com.cjy.traceability.framework.common.util.validation.ValidationUtils;
@ -223,7 +224,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
}
@Override
public String sendRandomCode(SendRandomCodeReqVO reqVO) {
public CommonResult<String> sendRandomCode(SendRandomCodeReqVO reqVO) {
// boolean isOk = validateCaptchaByRestPassword(reqVO);
// if (!isOk) {
// return "验证码出错";
@ -232,13 +233,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
// 查询账号不是删除 或停用状态
AdminUserDO user = userService.getUserByUsername(reqVO.getUsername());
if(user ==null){
return "无此账号";
return CommonResult.error(505,"无此账号,请重新输入") ;
}
if (user.getStatus().equals(CommonStatusEnum.DISABLE)) {
return "账号已被禁用,请与管理员联系";
return CommonResult.error(505, "账号已被禁用,请与管理员联系") ;
}
if (StrUtil.isBlank(user.getEmail())) {
return "该账号尚未设置邮箱,请于管理员联系";
CommonResult.error(505, "该账号尚未设置邮箱,请于管理员联系") ;
}
MailSendSingleToUserReqDTO userReqDTO = new MailSendSingleToUserReqDTO();
userReqDTO.setMail(user.getEmail());
@ -253,7 +254,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
mailSendApi.sendSingleMailToAdmin(userReqDTO);
stringRedisTemplate.opsForValue().set(randomCode,user.getUsername(),10,TimeUnit.MINUTES);
String email = StrUtil.hide(user.getEmail(),3,6);
return "验证码已发送到"+email+"邮箱,请注意查收!";
return CommonResult.success("验证码已发送到"+email+"邮箱,请注意查收!");
}
@Override

@ -124,6 +124,7 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
.select(ProductDO :: getBatch)
.select(ProductDO :: getId)
.selectAs(AgriculturalProductDO :: getProductBreed,"productBreed")
.selectAs(AgriculturalProductDO :: getProductPic,"productPic")
.selectAs(SpeciesDO :: getSpeciesName,"speciesName")
.selectAs(VarietyDO :: getVarietyName,"varietyName")
.leftJoin(AgriculturalProductDO.class,AgriculturalProductDO :: getId,ProductDO :: getCropperId )

@ -252,6 +252,12 @@ public class ProductServiceImpl implements ProductService {
}
}
map.put("baseBlock", materialList);
List<CompanyDO> companyList = companyMapper.selectList();
if(companyList !=null && companyList.size() >0){
map.put("company",companyList.get(0));
}else{
map.put("company",new CompanyDO());
}
ScanRecordDO scanRecordDO = new ScanRecordDO();
scanRecordDO.setProvince(province);
scanRecordDO.setCity(city);

@ -64,6 +64,7 @@ flowable:
# MyBatis Plus 的配置项
mybatis-plus:
configuration:
call-setters-on-nulls: true
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
global-config:
db-config:

Loading…
Cancel
Save