mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、分析页板材信息名称规范;2、新增登录短信验证码校验接口;
This commit is contained in:
+1
-1
@@ -27,7 +27,7 @@ public class OrderGoodsPlateRespVO implements Comparable<OrderGoodsPlateRespVO>
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹路")
|
||||
private Integer texture;
|
||||
private Boolean texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BigDecimal width;
|
||||
|
||||
+44
-20
@@ -33,6 +33,7 @@ import com.cf.imes.module.system.api.dict.DictDataApi;
|
||||
import com.cf.imes.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -290,12 +291,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
seriesItem.put("id", entry.getKey());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
// 获取纹路描述
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
|
||||
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
|
||||
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
String specification = formatGoodsName('x', stripTrailingZeros(orderGoodsPlateRespVO.getWidth()),
|
||||
stripTrailingZeros(orderGoodsPlateRespVO.getHeight()), stripTrailingZeros(orderGoodsPlateRespVO.getThickness()));
|
||||
String goodsName = formatGoodsName('-', orderGoodsPlateRespVO.getMaterial(), orderGoodsPlateRespVO.getGoodsName(), orderGoodsPlateRespVO.getColor(), getTextureFromDict(orderGoodsPlateRespVO.getTexture()), specification, orderGoodsPlateRespVO.getBrand());
|
||||
seriesItem.put("name", goodsName);
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
@@ -362,12 +361,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
seriesItem.put("id", entry.getKey());
|
||||
// 材质-商品名称-颜色-纹理-宽-高-厚-品牌
|
||||
OrderGoodsPlateRespVO orderGoodsPlateRespVO = entry.getValue();
|
||||
// 获取纹路描述
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(orderGoodsPlateRespVO.getTexture())).getData();
|
||||
String texture = ObjectUtil.isNotNull(grainDTO) ? grainDTO.getLabel() : "";
|
||||
seriesItem.put("name", orderGoodsPlateRespVO.getMaterial() + "-" + orderGoodsPlateRespVO.getGoodsName() +
|
||||
"-" + orderGoodsPlateRespVO.getColor() + "-" + texture + "-" + stripTrailingZeros(orderGoodsPlateRespVO.getWidth()) +
|
||||
"×" + stripTrailingZeros(orderGoodsPlateRespVO.getHeight()) + "×" + stripTrailingZeros(orderGoodsPlateRespVO.getThickness()) + "-" + orderGoodsPlateRespVO.getBrand());
|
||||
String specification = formatGoodsName('x', stripTrailingZeros(orderGoodsPlateRespVO.getWidth()),
|
||||
stripTrailingZeros(orderGoodsPlateRespVO.getHeight()), stripTrailingZeros(orderGoodsPlateRespVO.getThickness()));
|
||||
String goodsName = formatGoodsName('-', orderGoodsPlateRespVO.getMaterial(), orderGoodsPlateRespVO.getGoodsName(), orderGoodsPlateRespVO.getColor(), getTextureFromDict(orderGoodsPlateRespVO.getTexture()), specification, orderGoodsPlateRespVO.getBrand());
|
||||
seriesItem.put("name", goodsName);
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, reqVO.getUnit())).toList());
|
||||
@@ -485,9 +482,10 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
}
|
||||
// 任意取一个类型
|
||||
PlateGoodDO plateGoodDO = plateGoodDOList.get(0);
|
||||
seriesItem.put("name", plateGoodDO.getMaterial() + "-" + plateGoodDO.getGoodsName() +
|
||||
"-" + plateGoodDO.getColor() + "-" + getTextureFromDict(plateGoodDO) + "-" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getWidth())) +
|
||||
"×" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getHeight())) + "×" + stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getThickness())) + "-" + plateGoodDO.getBrand());
|
||||
String specification = formatGoodsName('x', stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getWidth())),
|
||||
stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getHeight())), stripTrailingZeros(BigDecimal.valueOf(plateGoodDO.getThickness())));
|
||||
String goodsName = formatGoodsName('-', plateGoodDO.getMaterial(), plateGoodDO.getGoodsName(), plateGoodDO.getColor(), getTextureFromDict(plateGoodDO.getTexture()), specification, plateGoodDO.getBrand());
|
||||
seriesItem.put("name", goodsName);
|
||||
series.add(seriesItem);
|
||||
}
|
||||
resultMap.put(DATELIST_FIELD_NAME, dateList.stream().map(date -> generateDateRangeAxis(date, unit)).toList());
|
||||
@@ -498,18 +496,44 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 板材信息用-连接
|
||||
*
|
||||
* @param connChar 连接符
|
||||
* @param texts 信息内容
|
||||
* @return 为空时不带connChar
|
||||
*/
|
||||
private String formatGoodsName(char connChar, String... texts) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String text : texts) {
|
||||
if (StringUtils.isNotEmpty(text)) {
|
||||
sb.append(text).append(connChar);
|
||||
}
|
||||
}
|
||||
// 移除最后一个 -
|
||||
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == connChar) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据纹路枚举获取字典中纹路描述
|
||||
* @param plateGoodDO
|
||||
*
|
||||
* @param texture
|
||||
* @return
|
||||
*/
|
||||
private String getTextureFromDict(PlateGoodDO plateGoodDO) {
|
||||
private String getTextureFromDict(Boolean texture) {
|
||||
if (ObjectUtil.isNull(texture)) {
|
||||
return "无";
|
||||
}
|
||||
// 获取纹路描述
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.GRAIN_TYPE, String.valueOf(plateGoodDO.getTexture())).getData();
|
||||
DictDataRespDTO grainDTO = dictDataApi.getDictData(DictTypeConstants.PLATE_TEXTURE_TYPE, String.valueOf(texture)).getData();
|
||||
if (ObjectUtil.isNotNull(grainDTO)) {
|
||||
return grainDTO.getLabel();
|
||||
return Objects.equals("是", grainDTO.getLabel()) ? "有" : "无";
|
||||
} else {
|
||||
return "";
|
||||
return "无";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
Binary file not shown.
+1
@@ -27,6 +27,7 @@ public interface DictTypeConstants {
|
||||
String SMS_RECEIVE_STATUS = "system_sms_receive_status"; // 短信接收状态
|
||||
|
||||
String TYPOGRAPHY_TYPE = "typographyType"; // 排版面
|
||||
String PLATE_TEXTURE_TYPE = "plate_texture_type";// 板材纹路:0有 1无
|
||||
String GRAIN_TYPE = "grainType";//纹路类型
|
||||
String DOOR_OPENING_DIRECTIONS = "doorOpeningDirections";//开门方向
|
||||
String PRODUCT_TYPE = "productType";//产品类型
|
||||
|
||||
+11
-2
@@ -10,6 +10,7 @@ import com.cf.imes.framework.security.config.SecurityProperties;
|
||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginSmsCheckReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
|
||||
import com.cf.imes.module.system.convert.auth.AuthConvert;
|
||||
@@ -85,16 +86,24 @@ public class AuthController {
|
||||
return success(authService.login(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/check")
|
||||
@GetMapping("/login/check")
|
||||
@PermitAll
|
||||
@Operation(summary = "校验账号")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
@OperateLog(enable = false)
|
||||
@Parameter(name = "mobile", description = "手机号", required = true)
|
||||
public CommonResult<Boolean> loginCheck(
|
||||
@Param("mobile") @NotEmpty(message = "手机号不能为空") @Mobile String mobile) {
|
||||
return success(authService.loginCheck(mobile));
|
||||
}
|
||||
|
||||
@PostMapping("/login/sms/check")
|
||||
@PermitAll
|
||||
@Operation(summary = "校验登录验证码")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<Boolean> loginSmsCheck(@Valid @RequestBody AuthLoginSmsCheckReqVO reqVO) {
|
||||
return success(authService.loginSmsCheck(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
@PermitAll
|
||||
@Operation(summary = "登出系统")
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.cf.imes.module.system.controller.admin.auth.vo;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Schema(description = "管理后台 - 短信验证码校验 ReqVo")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AuthLoginSmsCheckReqVO {
|
||||
|
||||
@Schema(description = "手机号码", example = "15601691300")
|
||||
@Length(min = 11, max = 11, message = "手机号长度必须 11 位")
|
||||
@Mobile
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "验证码", example = "123456")
|
||||
@Length(min = 6, max = 6, message = "验证码长度必须 6 位")
|
||||
@NotEmpty(message = "短信验证码不能为空")
|
||||
private String smsCaptchaVerification;
|
||||
}
|
||||
+8
@@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.auth;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginSmsCheckReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSmsLoginReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSmsSendReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
|
||||
@@ -41,6 +42,13 @@ public interface AdminAuthService {
|
||||
*/
|
||||
boolean loginCheck(String mobile);
|
||||
|
||||
/**
|
||||
* 登录短信验证码校验
|
||||
*
|
||||
* @return true正确,false错误
|
||||
*/
|
||||
boolean loginSmsCheck(AuthLoginSmsCheckReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 基于 token 退出登录
|
||||
*
|
||||
|
||||
+16
@@ -14,6 +14,7 @@ import com.cf.imes.module.system.api.social.dto.SocialUserBindReqDTO;
|
||||
import com.cf.imes.module.system.api.social.dto.SocialUserRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginSmsCheckReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSmsLoginReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSmsSendReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthSocialLoginReqVO;
|
||||
@@ -165,6 +166,21 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loginSmsCheck(AuthLoginSmsCheckReqVO reqVO) {
|
||||
String mobile = reqVO.getMobile();
|
||||
// 查询账号
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(mobile);
|
||||
// 校验用户是否存在
|
||||
if (user == null) {
|
||||
createLoginLog(null, mobile, LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.BAD_CREDENTIALS);
|
||||
return false;
|
||||
}
|
||||
// 校验验证码正确性
|
||||
smsCodeService.validateSmsCode(reqVO);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSmsCode(AuthSmsSendReqVO reqVO) {
|
||||
// 登录场景,验证是否存在
|
||||
|
||||
+7
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginSmsCheckReqVO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@@ -37,4 +38,10 @@ public interface SmsCodeService {
|
||||
*/
|
||||
void validateSmsCode(@Valid SmsCodeValidateReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 检查验证码是否有效
|
||||
*
|
||||
* @param reqVO
|
||||
*/
|
||||
void validateSmsCode(@Valid AuthLoginSmsCheckReqVO reqVO);
|
||||
}
|
||||
|
||||
+24
-1
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeSendReqDTO;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||
import com.cf.imes.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginSmsCheckReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsCodeDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.mysql.sms.SmsCodeMapper;
|
||||
@@ -138,7 +139,7 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
@Override
|
||||
public void useSmsCode(SmsCodeUseReqDTO reqDTO) {
|
||||
// 非修改手机号的场景时校验手机号是否存在
|
||||
AdminUserDO user = userService.getUserByUsernameAndOrganId(reqDTO.getMobile(), null);
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(reqDTO.getMobile());
|
||||
if (ObjectUtil.isNull(user) && ObjectUtil.notEqual(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
@@ -159,6 +160,28 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSmsCode(AuthLoginSmsCheckReqVO reqVO) {
|
||||
String mobile = reqVO.getMobile();
|
||||
// 非修改手机号的场景时校验手机号是否存在
|
||||
AdminUserDO user = userService.getUserUniqueByUserName(mobile);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS);
|
||||
}
|
||||
String smsCodeKey = String.format(RedisKeyConstants.SMS_CAPTCHA_VERIFICATION, mobile);
|
||||
Object keyObj = redisTemplate.opsForValue().get(smsCodeKey);
|
||||
if (ObjectUtil.isNotNull(keyObj)) {
|
||||
// 校验码存在
|
||||
if (ObjectUtil.notEqual(String.valueOf(keyObj), reqVO.getSmsCaptchaVerification())) {
|
||||
// 验证码不正确
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_CORRECT);
|
||||
}
|
||||
} else {
|
||||
// 提示验证码不存在
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSmsCode(SmsCodeValidateReqDTO reqDTO) {
|
||||
validateSmsCode0(reqDTO.getMobile(), reqDTO.getCode(), reqDTO.getScene());
|
||||
|
||||
@@ -161,7 +161,8 @@ chenfeng:
|
||||
- /admin-api/system/auth/logout
|
||||
- /admin-api/system/auth/sms-code
|
||||
- /admin-api/system/user/reset-password
|
||||
- /admin-api/system/auth/check
|
||||
- /admin-api/system/auth/login/check
|
||||
- /admin-api/system/auth/login/sms/check
|
||||
- /rpc-api/**
|
||||
#- /admin-api/system/**
|
||||
#- /rpc-api/system/organ/valid # 防止递归。避免调用 /rpc-api/system/organ/valid 接口时,又去触发 /rpc-api/system/organ/valid 去校验
|
||||
|
||||
Reference in New Issue
Block a user