commit
d9eabb541b
@ -0,0 +1,68 @@
|
|||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import com.cyl.manager.ums.domain.Member;
|
||||||
|
import com.cyl.manager.ums.service.MemberService;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.constant.HttpStatus;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginMember;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.framework.config.LocalDataUtil;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class H5MemberInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private MemberService memberService;
|
||||||
|
|
||||||
|
private static String[] WHITE_PATHS = {
|
||||||
|
"/h5/sms/login",
|
||||||
|
"/h5/account/login",
|
||||||
|
"/h5/register",
|
||||||
|
"/h5/validate"
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
String requestUri = request.getRequestURI();
|
||||||
|
boolean flag = true;
|
||||||
|
if (!requestUri.startsWith("/h5/")) {
|
||||||
|
return super.preHandle(request, response, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String s : WHITE_PATHS) {
|
||||||
|
if (requestUri.startsWith(s)) {
|
||||||
|
flag = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!flag) {
|
||||||
|
return super.preHandle(request, response, handler);
|
||||||
|
}
|
||||||
|
LoginMember loginMember = tokenService.getLoginMember(request);
|
||||||
|
if (loginMember == null) {
|
||||||
|
throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
tokenService.verifyMemberToken(loginMember);
|
||||||
|
//获取会员信息
|
||||||
|
Member member = memberService.selectById(loginMember.getMemberId());
|
||||||
|
if (member == null || member.getStatus() == 0) {
|
||||||
|
throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED);
|
||||||
|
}
|
||||||
|
//将会员信息存放至全局
|
||||||
|
LocalDataUtil.setVar(Constants.MEMBER_INFO, member);
|
||||||
|
|
||||||
|
return super.preHandle(request, response, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
public class MvcConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public H5MemberInterceptor memberInterceptor() {
|
||||||
|
return new H5MemberInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
registry.addInterceptor(memberInterceptor());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.ruoyi.common.config;
|
||||||
|
|
||||||
|
import com.ruoyi.common.config.properties.SmsProperties;
|
||||||
|
import com.ruoyi.common.core.sms.AliyunSmsTemplate;
|
||||||
|
import com.ruoyi.common.core.sms.SmsTemplate;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信配置类
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @version 4.2.0
|
||||||
|
*/
|
||||||
|
@EnableConfigurationProperties(SmsProperties.class)
|
||||||
|
public class SmsConfig {
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnProperty(value = "sms.enabled", havingValue = "true")
|
||||||
|
@ConditionalOnClass(com.aliyun.dysmsapi20170525.Client.class)
|
||||||
|
static class AliyunSmsConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SmsTemplate aliyunSmsTemplate(SmsProperties smsProperties) {
|
||||||
|
return new AliyunSmsTemplate(smsProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.ruoyi.common.config.properties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS短信 配置属性
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @version 4.2.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "sms")
|
||||||
|
@Component
|
||||||
|
public class SmsProperties {
|
||||||
|
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置节点
|
||||||
|
* 阿里云 dysmsapi.aliyuncs.com
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key
|
||||||
|
*/
|
||||||
|
private String accessKeyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密匙
|
||||||
|
*/
|
||||||
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 短信签名
|
||||||
|
*/
|
||||||
|
private String signName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信应用ID (腾讯专属)
|
||||||
|
*/
|
||||||
|
private String sdkAppId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LoginMember {
|
||||||
|
|
||||||
|
private Long memberId;
|
||||||
|
private String token;
|
||||||
|
private Long loginTime;
|
||||||
|
private Long expireTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.ruoyi.common.core.domain.model;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传返回体
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class SmsResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否成功
|
||||||
|
*/
|
||||||
|
private boolean isSuccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应消息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际响应体
|
||||||
|
* <p>
|
||||||
|
* 可自行转换为 SDK 对应的 SendSmsResponse
|
||||||
|
*/
|
||||||
|
private String response;
|
||||||
|
/**
|
||||||
|
* uuid
|
||||||
|
*/
|
||||||
|
private String uuid;
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.common.core.sms;
|
||||||
|
|
||||||
|
import com.aliyun.dysmsapi20170525.Client;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
|
||||||
|
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.ruoyi.common.config.properties.SmsProperties;
|
||||||
|
import com.ruoyi.common.core.domain.model.SmsResult;
|
||||||
|
import com.ruoyi.common.exception.sms.SmsException;
|
||||||
|
import com.ruoyi.common.utils.JsonUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aliyun 短信模板
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @version 4.2.0
|
||||||
|
*/
|
||||||
|
public class AliyunSmsTemplate implements SmsTemplate {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SmsProperties properties;
|
||||||
|
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@SneakyThrows(Exception.class)
|
||||||
|
public AliyunSmsTemplate(SmsProperties smsProperties) {
|
||||||
|
this.properties = smsProperties;
|
||||||
|
Config config = new Config()
|
||||||
|
// 您的AccessKey ID
|
||||||
|
.setAccessKeyId(smsProperties.getAccessKeyId())
|
||||||
|
// 您的AccessKey Secret
|
||||||
|
.setAccessKeySecret(smsProperties.getAccessKeySecret())
|
||||||
|
// 访问的域名
|
||||||
|
.setEndpoint(smsProperties.getEndpoint());
|
||||||
|
this.client = new Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SmsResult send(String phones, String templateId, Map<String, String> param) {
|
||||||
|
if (StringUtils.isBlank(phones)) {
|
||||||
|
throw new SmsException("手机号不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(templateId)) {
|
||||||
|
throw new SmsException("模板ID不能为空");
|
||||||
|
}
|
||||||
|
SendSmsRequest req = new SendSmsRequest()
|
||||||
|
.setPhoneNumbers(phones)
|
||||||
|
.setSignName(properties.getSignName())
|
||||||
|
.setTemplateCode(templateId)
|
||||||
|
.setTemplateParam(JsonUtils.toJsonString(param));
|
||||||
|
try {
|
||||||
|
SendSmsResponse resp = client.sendSms(req);
|
||||||
|
return SmsResult.builder()
|
||||||
|
.isSuccess("OK".equals(resp.getBody().getCode()))
|
||||||
|
.message(resp.getBody().getMessage())
|
||||||
|
.response(JsonUtils.toJsonString(resp))
|
||||||
|
.build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new SmsException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.common.core.sms;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.model.SmsResult;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模板
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @version 4.2.0
|
||||||
|
*/
|
||||||
|
public interface SmsTemplate {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*
|
||||||
|
* @param phones 电话号(多个逗号分割)
|
||||||
|
* @param templateId 模板id
|
||||||
|
* @param param 模板对应参数
|
||||||
|
* 阿里 需使用 模板变量名称对应内容 例如: code=1234
|
||||||
|
* 腾讯 需使用 模板变量顺序对应内容 例如: 1=1234, 1为模板内第一个参数
|
||||||
|
*/
|
||||||
|
SmsResult send(String phones, String templateId, Map<String, String> param);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.ruoyi.common.exception.sms;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sms异常类
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public class SmsException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public SmsException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.crypto.symmetric.AES;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* aes加密工具
|
||||||
|
*/
|
||||||
|
public class AesCryptoUtils {
|
||||||
|
|
||||||
|
public static String encrypt(String key, String content){
|
||||||
|
if (StringUtils.isBlank(key) || StringUtils.isBlank(content)){
|
||||||
|
throw new RuntimeException("错误");
|
||||||
|
}
|
||||||
|
AES aes = SecureUtil.aes(key.getBytes());
|
||||||
|
byte[] encrypt = aes.encrypt(content);
|
||||||
|
return aes.encryptHex(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decrypt(String key, String content){
|
||||||
|
if (StringUtils.isBlank(key) || StringUtils.isBlank(content)){
|
||||||
|
throw new RuntimeException("错误");
|
||||||
|
}
|
||||||
|
AES aes = SecureUtil.aes(key.getBytes());
|
||||||
|
return aes.decryptStr(content, CharsetUtil.CHARSET_UTF_8);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Dict;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON 工具类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public class JsonUtils {
|
||||||
|
|
||||||
|
private static final ObjectMapper OBJECT_MAPPER = SpringUtils.getBean(ObjectMapper.class);
|
||||||
|
|
||||||
|
public static ObjectMapper getObjectMapper() {
|
||||||
|
return OBJECT_MAPPER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toJsonString(Object object) {
|
||||||
|
if (ObjectUtil.isNull(object)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.writeValueAsString(object);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(String text, Class<T> clazz) {
|
||||||
|
if (StringUtils.isEmpty(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(text, clazz);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
|
||||||
|
if (ArrayUtil.isEmpty(bytes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(bytes, clazz);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T parseObject(String text, TypeReference<T> typeReference) {
|
||||||
|
if (StringUtils.isBlank(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(text, typeReference);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dict parseMap(String text) {
|
||||||
|
if (StringUtils.isBlank(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(text, OBJECT_MAPPER.getTypeFactory().constructType(Dict.class));
|
||||||
|
} catch (MismatchedInputException e) {
|
||||||
|
// 类型不匹配说明不是json
|
||||||
|
return null;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Dict> parseArrayMap(String text) {
|
||||||
|
if (StringUtils.isBlank(text)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(text, OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, Dict.class));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> parseArray(String text, Class<T> clazz) {
|
||||||
|
if (StringUtils.isEmpty(text)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OBJECT_MAPPER.readValue(text, OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号工具类
|
||||||
|
*/
|
||||||
|
public class PhoneUtils {
|
||||||
|
|
||||||
|
public static String hidePhone(String phone){
|
||||||
|
if (StringUtils.isEmpty(phone) || phone.length() < 11){
|
||||||
|
throw new RuntimeException("手机号格式错误");
|
||||||
|
}
|
||||||
|
return phone.substring(0, 3) + "****" + phone.substring(7, 11);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ResponseUtils {
|
||||||
|
|
||||||
|
private static final String MESSAGE = "msg";
|
||||||
|
private static final String CODE = "code";
|
||||||
|
private static final String DATA = "data";
|
||||||
|
|
||||||
|
private ResponseUtils(){}
|
||||||
|
|
||||||
|
private static ResponseEntity<Object> getEntity(Object body, HttpStatus statusCode){
|
||||||
|
MultiValueMap<String, String> headers = new HttpHeaders();
|
||||||
|
List<String> contentType = new ArrayList<String>();
|
||||||
|
contentType.add("application/json;charset=utf-8");
|
||||||
|
headers.put("Content-Type", contentType);
|
||||||
|
return new ResponseEntity<Object>(body, headers, statusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: czc
|
||||||
|
* @Description: TODO
|
||||||
|
* @DateTime: 2023/6/16 17:50
|
||||||
|
**/
|
||||||
|
public class SmsUtils {
|
||||||
|
|
||||||
|
public static String createRandom(boolean numberFlag, int length) {
|
||||||
|
String retStr = "";
|
||||||
|
String strTable = numberFlag ? "1234567890" : "1234567890abcdefghijkmnpqrstuvwxyz";
|
||||||
|
int len = strTable.length();
|
||||||
|
boolean bDone = true;
|
||||||
|
do {
|
||||||
|
retStr = "";
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
double dblR = Math.random() * len;
|
||||||
|
int intR = (int) Math.floor(dblR);
|
||||||
|
char c = strTable.charAt(intR);
|
||||||
|
if (('0' <= c) && (c <= '9')) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
retStr += strTable.charAt(intR);
|
||||||
|
}
|
||||||
|
if (count >= 2) {
|
||||||
|
bDone = false;
|
||||||
|
}
|
||||||
|
} while (bDone);
|
||||||
|
return retStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.cyl.h5.config;
|
||||||
|
|
||||||
|
import com.cyl.manager.ums.domain.Member;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.framework.config.LocalDataUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SecurityUtil {
|
||||||
|
|
||||||
|
public static Member getLocalMember() {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.cyl.h5.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.cyl.manager.ums.domain.Address;
|
||||||
|
import com.cyl.manager.ums.mapper.AddressMapper;
|
||||||
|
import com.cyl.manager.ums.pojo.dto.AddressDTO;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.redis.RedisService;
|
||||||
|
import com.ruoyi.common.utils.OssUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/h5")
|
||||||
|
public class H5CommonController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OssUtils ossUtils;
|
||||||
|
@Autowired
|
||||||
|
private AddressMapper addressMapper;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/area")
|
||||||
|
public AjaxResult getAddressList() {
|
||||||
|
String addresses = redisService.getAddressList();
|
||||||
|
if (StringUtils.isNotEmpty(addresses)) {
|
||||||
|
return AjaxResult.success(JSON.parseArray(addresses, AddressDTO.class));
|
||||||
|
}
|
||||||
|
QueryWrapper<Address> addressQueryWrapper = new QueryWrapper<>();
|
||||||
|
addressQueryWrapper.in("level", Arrays.asList(0,1,2));
|
||||||
|
List<Address> addressList = addressMapper.selectList(addressQueryWrapper);
|
||||||
|
Map<Long, List<Address>> cityMap = addressList.stream().filter(it -> it.getLevel() == 1).collect(Collectors.groupingBy(it -> it.getParentCode()));
|
||||||
|
Map<Long, List<Address>> districtMap = addressList.stream().filter(it -> it.getLevel() == 2).collect(Collectors.groupingBy(it -> it.getParentCode()));
|
||||||
|
List<AddressDTO> result = new ArrayList<>();
|
||||||
|
addressList.stream().filter(it -> it.getLevel() == 0).forEach(it -> {
|
||||||
|
AddressDTO dto = new AddressDTO();
|
||||||
|
dto.setId(it.getCode());
|
||||||
|
dto.setLevel("province");
|
||||||
|
dto.setName(it.getName());
|
||||||
|
dto.setPid(0L);
|
||||||
|
//获取城市列表
|
||||||
|
List<AddressDTO> child = new ArrayList<>();
|
||||||
|
if (cityMap.containsKey(it.getCode())) {
|
||||||
|
cityMap.get(it.getCode()).forEach(city -> {
|
||||||
|
AddressDTO cityDto = new AddressDTO();
|
||||||
|
cityDto.setId(city.getCode());
|
||||||
|
cityDto.setLevel("city");
|
||||||
|
cityDto.setName(city.getName());
|
||||||
|
cityDto.setPid(city.getParentCode());
|
||||||
|
cityDto.setChildren(districtMap.containsKey(city.getCode()) ?
|
||||||
|
districtMap.get(city.getCode()).stream().map(district -> {
|
||||||
|
AddressDTO districtDto = new AddressDTO();
|
||||||
|
districtDto.setId(district.getCode());
|
||||||
|
districtDto.setLevel("district");
|
||||||
|
districtDto.setName(district.getName());
|
||||||
|
districtDto.setPid(district.getParentCode());
|
||||||
|
return districtDto;
|
||||||
|
}).collect(Collectors.toList()) : Collections.EMPTY_LIST);
|
||||||
|
child.add(cityDto);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
dto.setChildren(child);
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
redisService.setAddressList(JSON.toJSONString(result));
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.cyl.h5.controller;
|
||||||
|
|
||||||
|
import com.cyl.h5.service.H5MemberAddressService;
|
||||||
|
import com.cyl.manager.ums.pojo.dto.MemberAddressDTO;
|
||||||
|
import com.cyl.manager.ums.pojo.vo.MemberAddressVO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/h5/member/address")
|
||||||
|
public class H5MemberAddressController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private H5MemberAddressService h5MemberAddressService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public ResponseEntity<List<MemberAddressVO>> getList(){
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.selectList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/default")
|
||||||
|
public ResponseEntity<MemberAddressVO> getDefault(){
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.getDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
public ResponseEntity<Integer> create(@RequestBody MemberAddressDTO memberAddressDTO){
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.insert(memberAddressDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
public ResponseEntity<Integer> update(@RequestBody MemberAddressDTO memberAddressDTO){
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.update(memberAddressDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ResponseEntity<MemberAddressVO> getInfo(@PathVariable Long id){
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.ok(h5MemberAddressService.deleteById(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.cyl.h5.controller;
|
||||||
|
|
||||||
|
import com.cyl.h5.pojo.request.RegisterRequest;
|
||||||
|
import com.cyl.h5.pojo.response.RegisterResponse;
|
||||||
|
import com.cyl.h5.pojo.response.ValidatePhoneResponse;
|
||||||
|
import com.cyl.h5.pojo.response.H5LoginResponse;
|
||||||
|
import com.cyl.h5.service.H5MemberService;
|
||||||
|
import com.cyl.manager.ums.pojo.vo.MemberVO;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/h5")
|
||||||
|
public class H5MemberController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private H5MemberService service;
|
||||||
|
|
||||||
|
@ApiOperation("会员注册")
|
||||||
|
@PostMapping("/register")
|
||||||
|
public ResponseEntity<RegisterResponse> register(@RequestBody RegisterRequest request){
|
||||||
|
return ResponseEntity.ok(service.register(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("注册验证码校验手机号")
|
||||||
|
@GetMapping("/validate/{phone}")
|
||||||
|
public ResponseEntity<ValidatePhoneResponse> validate(@PathVariable String phone){
|
||||||
|
return ResponseEntity.ok(service.validate(phone));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("手机号密码登录")
|
||||||
|
@PostMapping("/account/login")
|
||||||
|
public ResponseEntity<H5LoginResponse> accountLogin(@RequestBody String data){
|
||||||
|
return ResponseEntity.ok(service.accountLogin(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("sms登录")
|
||||||
|
@PostMapping("/sms/login")
|
||||||
|
public ResponseEntity<H5LoginResponse> smsLogin(@RequestBody String data){
|
||||||
|
return ResponseEntity.ok(service.smsLogin(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取会员信息")
|
||||||
|
@GetMapping("/member/info")
|
||||||
|
public ResponseEntity<MemberVO> getMemberInfo(){
|
||||||
|
return ResponseEntity.ok(service.getMemberInfo());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
package com.cyl.h5.controller;
|
||||||
|
|
||||||
|
import com.cyl.h5.pojo.dto.OrderCreateDTO;
|
||||||
|
import com.cyl.h5.pojo.vo.OrderCalcVO;
|
||||||
|
import com.cyl.h5.pojo.vo.form.OrderSubmitForm;
|
||||||
|
import com.cyl.h5.pojo.vo.query.OrderH5Query;
|
||||||
|
import com.cyl.manager.oms.pojo.vo.OrderVO;
|
||||||
|
import com.cyl.manager.oms.service.OrderService;
|
||||||
|
import com.cyl.manager.ums.domain.Member;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.redis.RedisService;
|
||||||
|
import com.ruoyi.framework.config.LocalDataUtil;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
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
|
||||||
|
@RequestMapping("/h5/order")
|
||||||
|
@Slf4j
|
||||||
|
public class H5OrderController {
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public ResponseEntity<Long> submit(@RequestBody OrderSubmitForm form) {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
Long memberId = member.getId();
|
||||||
|
String redisKey = "h5_order_add" + memberId;
|
||||||
|
String redisValue = memberId + "_" + System.currentTimeMillis();
|
||||||
|
try{
|
||||||
|
redisService.lock(redisKey, redisValue, 60);
|
||||||
|
return ResponseEntity.ok(orderService.submit(form));
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("创建订单方法异常", e);
|
||||||
|
return null;
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
redisService.unLock(redisKey, redisValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@PostMapping("orders")
|
||||||
|
public ResponseEntity<Page<OrderVO>> queryOrderPage(@RequestBody OrderH5Query query, Pageable pageReq) {
|
||||||
|
return ResponseEntity.ok(orderService.queryOrderPage(query, pageReq));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("下单前校验")
|
||||||
|
@PostMapping("/addOrderCheck")
|
||||||
|
public ResponseEntity<OrderCalcVO> addOrderCheck(@RequestBody OrderCreateDTO orderCreateDTO){
|
||||||
|
return ResponseEntity.ok(orderService.addOrderCheck(orderCreateDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,31 +0,0 @@
|
|||||||
package com.cyl.h5.controller;
|
|
||||||
|
|
||||||
import com.cyl.h5.pojo.vo.form.OrderSubmitForm;
|
|
||||||
import com.cyl.h5.pojo.vo.query.OrderH5Query;
|
|
||||||
import com.cyl.oms.pojo.vo.OrderVO;
|
|
||||||
import com.cyl.oms.service.OrderService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
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;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/h5-order")
|
|
||||||
public class Order1Controller {
|
|
||||||
@Autowired
|
|
||||||
private OrderService orderService;
|
|
||||||
@PostMapping("submit")
|
|
||||||
public ResponseEntity<OrderVO> submit(@RequestBody OrderSubmitForm form) {
|
|
||||||
return ResponseEntity.ok(orderService.submit(form));
|
|
||||||
}
|
|
||||||
@PostMapping("orders")
|
|
||||||
public ResponseEntity<Page<OrderVO>> queryOrderPage(@RequestBody OrderH5Query query, Pageable pageReq) {
|
|
||||||
return ResponseEntity.ok(orderService.queryOrderPage(query, pageReq));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.cyl.h5.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: czc
|
||||||
|
* @Description: TODO
|
||||||
|
* @DateTime: 2023/6/16 14:58
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class LoginDTO {
|
||||||
|
private String account;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.cyl.h5.pojo.dto;
|
||||||
|
|
||||||
|
import com.cyl.manager.pms.domain.Product;
|
||||||
|
import com.cyl.manager.pms.domain.Sku;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单请求VO
|
||||||
|
* @author Jinxin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "创建订单请求VO")
|
||||||
|
public class OrderProductListDTO {
|
||||||
|
@ApiModelProperty(value = "商品skuId", required = true)
|
||||||
|
@NotNull(message = "商品skuId不能为空")
|
||||||
|
private Long skuId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数量", required = true)
|
||||||
|
@NotNull(message = "数量不能为空")
|
||||||
|
@Min(value = 1, message = "数量不能小于1")
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "消费金", hidden = true)
|
||||||
|
private BigDecimal consumption;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "运费", hidden = true)
|
||||||
|
private BigDecimal freightAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "隐藏 业务过程中的数据", hidden = true)
|
||||||
|
private Sku sku;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "隐藏 业务过程中的数据", hidden = true)
|
||||||
|
private Product product;
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.cyl.h5.pojo.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class H5AccountLoginRequest extends H5LoginRequest{
|
||||||
|
/** 密码 */
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.cyl.h5.pojo.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class H5LoginRequest {
|
||||||
|
/** 账号即手机号 */
|
||||||
|
private String mobile;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.cyl.h5.pojo.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class H5SmsLoginRequest extends H5LoginRequest {
|
||||||
|
/** 验证码 */
|
||||||
|
private String code;
|
||||||
|
/** uuid */
|
||||||
|
private String uuid;
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.cyl.h5.pojo.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RegisterRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号")
|
||||||
|
@NotBlank
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("密码")
|
||||||
|
@NotBlank
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty("uuid")
|
||||||
|
@NotBlank
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
@ApiModelProperty("验证码")
|
||||||
|
@NotBlank
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.cyl.h5.pojo.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: czc
|
||||||
|
* @Description: TODO
|
||||||
|
* @DateTime: 2023/6/16 14:54
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class H5LoginResponse {
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.cyl.h5.pojo.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RegisterResponse {
|
||||||
|
/** token */
|
||||||
|
private String token;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.cyl.h5.pojo.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ValidatePhoneResponse {
|
||||||
|
/** 是否成功 */
|
||||||
|
private boolean ifSuccess;
|
||||||
|
/** 消息 */
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.cyl.h5.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("下单前校验返回数据")
|
||||||
|
public class OrderCalcVO {
|
||||||
|
@ApiModelProperty("sku数据")
|
||||||
|
private List<SkuViewDTO> skuList;
|
||||||
|
@ApiModelProperty("商品总金额")
|
||||||
|
private BigDecimal productTotalAmount;
|
||||||
|
@ApiModelProperty("订单总金额")
|
||||||
|
private BigDecimal orderTotalAmount;
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.cyl.h5.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sku渲染详情
|
||||||
|
*
|
||||||
|
* @author Jinxin
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "sku渲染详情")
|
||||||
|
public class SkuViewDTO {
|
||||||
|
private Long productId;
|
||||||
|
private Long skuId;
|
||||||
|
@ApiModelProperty(value = "商品名称")
|
||||||
|
private String productName;
|
||||||
|
@ApiModelProperty(value = "销售属性")
|
||||||
|
private String spData;
|
||||||
|
@ApiModelProperty(value = "购买数量")
|
||||||
|
private Integer quantity;
|
||||||
|
@ApiModelProperty(value = "主图")
|
||||||
|
private String pic;
|
||||||
|
@ApiModelProperty(value = "售价")
|
||||||
|
private BigDecimal price;
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package com.cyl.h5.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.cyl.manager.ums.domain.Member;
|
||||||
|
import com.cyl.manager.ums.domain.MemberAddress;
|
||||||
|
import com.cyl.manager.ums.mapper.MemberAddressMapper;
|
||||||
|
import com.cyl.manager.ums.pojo.dto.MemberAddressDTO;
|
||||||
|
import com.cyl.manager.ums.pojo.vo.MemberAddressVO;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.utils.AesCryptoUtils;
|
||||||
|
import com.ruoyi.common.utils.PhoneUtils;
|
||||||
|
import com.ruoyi.framework.config.LocalDataUtil;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员收货地址Service业务层处理
|
||||||
|
*
|
||||||
|
* @author sjm
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class H5MemberAddressService {
|
||||||
|
@Autowired
|
||||||
|
private MemberAddressMapper memberAddressMapper;
|
||||||
|
|
||||||
|
@Value("${aes.key}")
|
||||||
|
private String aesKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询会员收货地址
|
||||||
|
*
|
||||||
|
* @param id 会员收货地址主键
|
||||||
|
* @return 会员收货地址
|
||||||
|
*/
|
||||||
|
|
||||||
|
public MemberAddressVO selectById(Long id) {
|
||||||
|
MemberAddress memberAddress = memberAddressMapper.selectById(id);
|
||||||
|
MemberAddressVO memberAddressVO = new MemberAddressVO();
|
||||||
|
BeanUtils.copyProperties(memberAddress, memberAddressVO);
|
||||||
|
memberAddressVO.setPhone(AesCryptoUtils.decrypt(aesKey, memberAddress.getPhoneEncrypted()));
|
||||||
|
return memberAddressVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MemberAddressVO> selectList() {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
MemberAddress memberAddress = new MemberAddress();
|
||||||
|
memberAddress.setMemberId(member.getId());
|
||||||
|
List<MemberAddress> memberAddressesList = memberAddressMapper.selectByEntity(memberAddress);
|
||||||
|
return memberAddressesList.stream().map(it -> {
|
||||||
|
MemberAddressVO vo = new MemberAddressVO();
|
||||||
|
BeanUtils.copyProperties(it, vo);
|
||||||
|
vo.setPhone(AesCryptoUtils.decrypt(aesKey, it.getPhoneEncrypted()));
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增会员收货地址
|
||||||
|
*
|
||||||
|
* @param memberAddressDTO 会员收货地址
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insert(MemberAddressDTO memberAddressDTO) {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
if (memberAddressDTO.getIsDefault() == 1) {
|
||||||
|
//将别的设置为0
|
||||||
|
memberAddressMapper.updateDefault(0,member.getId());
|
||||||
|
}
|
||||||
|
MemberAddress memberAddress = new MemberAddress();
|
||||||
|
BeanUtils.copyProperties(memberAddressDTO, memberAddress);
|
||||||
|
memberAddress.setPhoneHidden(PhoneUtils.hidePhone(memberAddressDTO.getPhone()));
|
||||||
|
memberAddress.setPhoneEncrypted(AesCryptoUtils.encrypt(aesKey, memberAddressDTO.getPhone()));
|
||||||
|
memberAddress.setMemberId(member.getId());
|
||||||
|
memberAddress.setCreateTime(LocalDateTime.now());
|
||||||
|
return memberAddressMapper.insert(memberAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改会员收货地址
|
||||||
|
*
|
||||||
|
* @param memberAddressDTO 会员收货地址
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int update(MemberAddressDTO memberAddressDTO) {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
if (memberAddressDTO.getIsDefault() == 1) {
|
||||||
|
//将别的设置为0
|
||||||
|
memberAddressMapper.updateDefault(0,member.getId());
|
||||||
|
}
|
||||||
|
MemberAddress memberAddress = new MemberAddress();
|
||||||
|
BeanUtils.copyProperties(memberAddressDTO, memberAddress);
|
||||||
|
memberAddress.setPhoneHidden(PhoneUtils.hidePhone(memberAddressDTO.getPhone()));
|
||||||
|
memberAddress.setPhoneEncrypted(AesCryptoUtils.encrypt(aesKey, memberAddressDTO.getPhone()));
|
||||||
|
memberAddress.setUpdateTime(LocalDateTime.now());
|
||||||
|
memberAddress.setUpdateBy(member.getId());
|
||||||
|
return memberAddressMapper.updateById(memberAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除会员收货地址
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的会员收货地址主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int deleteByIds(Long[] ids) {
|
||||||
|
return memberAddressMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除会员收货地址信息
|
||||||
|
*
|
||||||
|
* @param id 会员收货地址主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int deleteById(Long id) {
|
||||||
|
return memberAddressMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MemberAddressVO getDefault() {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
QueryWrapper<MemberAddress> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("member_id",member.getId());
|
||||||
|
queryWrapper.eq("is_default",1);
|
||||||
|
List<MemberAddress> list = memberAddressMapper.selectList(queryWrapper);
|
||||||
|
if (CollectionUtils.isEmpty(list)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MemberAddressVO memberAddressVO = new MemberAddressVO();
|
||||||
|
BeanUtils.copyProperties(list.get(0), memberAddressVO);
|
||||||
|
memberAddressVO.setPhone(AesCryptoUtils.decrypt(aesKey, list.get(0).getPhoneEncrypted()));
|
||||||
|
return memberAddressVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
package com.cyl.h5.service;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.cyl.h5.pojo.request.H5AccountLoginRequest;
|
||||||
|
import com.cyl.h5.pojo.request.H5SmsLoginRequest;
|
||||||
|
import com.cyl.h5.pojo.request.RegisterRequest;
|
||||||
|
import com.cyl.h5.pojo.response.RegisterResponse;
|
||||||
|
import com.cyl.h5.pojo.response.ValidatePhoneResponse;
|
||||||
|
import com.cyl.h5.pojo.response.H5LoginResponse;
|
||||||
|
import com.cyl.manager.ums.domain.Member;
|
||||||
|
import com.cyl.manager.ums.mapper.MemberMapper;
|
||||||
|
import com.cyl.manager.ums.pojo.vo.MemberVO;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.domain.model.LoginMember;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.AesCryptoUtils;
|
||||||
|
import com.ruoyi.common.utils.PhoneUtils;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.framework.config.LocalDataUtil;
|
||||||
|
import com.ruoyi.framework.web.service.TokenService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class H5MemberService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MemberMapper memberMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Value("${aes.key}")
|
||||||
|
private String aesKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
* @param request 注册请求体
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public RegisterResponse register(RegisterRequest request){
|
||||||
|
RegisterResponse response = new RegisterResponse();
|
||||||
|
//校验验证码
|
||||||
|
this.validateVerifyCode(request.getUuid(), request.getMobile(), request.getCode());
|
||||||
|
//创建会员
|
||||||
|
Member member = new Member();
|
||||||
|
member.setPhoneEncrypted(AesCryptoUtils.encrypt(aesKey, request.getMobile()));
|
||||||
|
member.setPhoneHidden(PhoneUtils.hidePhone(request.getMobile()));
|
||||||
|
member.setPassword(SecurityUtils.encryptPassword(request.getPassword()));
|
||||||
|
member.setNickname("用户" + request.getMobile().substring(7,11));
|
||||||
|
member.setStatus(Constants.MEMBER_ACCOUNT_STATUS.NORMAL);
|
||||||
|
member.setGender(0);
|
||||||
|
member.setCreateTime(LocalDateTime.now());
|
||||||
|
memberMapper.insert(member);
|
||||||
|
//注册成功直接返回token了
|
||||||
|
H5LoginResponse loginResponse = getLoginResponse(member.getId());
|
||||||
|
response.setToken(loginResponse.getToken());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValidatePhoneResponse validate(String phone) {
|
||||||
|
ValidatePhoneResponse response = new ValidatePhoneResponse();
|
||||||
|
byte[] decodedBytes = Base64.getDecoder().decode(phone);
|
||||||
|
phone = new String(decodedBytes);
|
||||||
|
QueryWrapper<Member> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("phone_encrypted", AesCryptoUtils.encrypt(aesKey, phone));
|
||||||
|
Member member = memberMapper.selectOne(qw);
|
||||||
|
if (member != null){
|
||||||
|
throw new RuntimeException("该手机号已被占用");
|
||||||
|
}
|
||||||
|
response.setIfSuccess(true);
|
||||||
|
response.setMessage("该手机号可用");
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号密码登录
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public H5LoginResponse accountLogin(String data) {
|
||||||
|
if (StringUtils.isEmpty(data)){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.WRONG);
|
||||||
|
}
|
||||||
|
// 解码 转 对象
|
||||||
|
H5AccountLoginRequest request = JSON.parseObject(new String(Base64Utils.decodeFromString(data)), H5AccountLoginRequest.class);
|
||||||
|
log.info("account login request:{}", JSONUtil.toJsonStr(request));
|
||||||
|
QueryWrapper<Member> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("phone_encrypted", AesCryptoUtils.encrypt(aesKey, request.getMobile()));
|
||||||
|
Member member = memberMapper.selectOne(qw);
|
||||||
|
if (member == null){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.WRONG);
|
||||||
|
}
|
||||||
|
validateMemberStatus(member);
|
||||||
|
//check 密码
|
||||||
|
if (!SecurityUtils.matchesPassword(request.getPassword(), member.getPassword())){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.WRONG);
|
||||||
|
}
|
||||||
|
return getLoginResponse(member.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public H5LoginResponse smsLogin(String data){
|
||||||
|
if (StringUtils.isEmpty(data)){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.WRONG);
|
||||||
|
}
|
||||||
|
H5SmsLoginRequest request = JSON.parseObject(new String(Base64Utils.decodeFromString(data)), H5SmsLoginRequest.class);
|
||||||
|
//校验验证码
|
||||||
|
this.validateVerifyCode(request.getUuid(), request.getMobile(), request.getCode());
|
||||||
|
//查会员
|
||||||
|
QueryWrapper<Member> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("phone_encrypted", AesCryptoUtils.encrypt(aesKey, request.getMobile()));
|
||||||
|
Member member = memberMapper.selectOne(qw);
|
||||||
|
if (member == null){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.TO_REGISTER);
|
||||||
|
}
|
||||||
|
//校验会员状态
|
||||||
|
validateMemberStatus(member);
|
||||||
|
return getLoginResponse(member.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验会员状态
|
||||||
|
* @param member 会员信息
|
||||||
|
*/
|
||||||
|
private void validateMemberStatus(Member member) {
|
||||||
|
if (Constants.MEMBER_ACCOUNT_STATUS.FORBIDDEN == member.getStatus()){
|
||||||
|
throw new RuntimeException(Constants.LOGIN_INFO.FORBIDDEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验验证码有效性
|
||||||
|
* @param uuid 唯一标识
|
||||||
|
* @param phone 手机号
|
||||||
|
* @param inputCode 输入的验证码
|
||||||
|
*/
|
||||||
|
private void validateVerifyCode(String uuid, String phone, String inputCode){
|
||||||
|
String key = uuid + "_" + phone;
|
||||||
|
String redisCode = redisCache.getCacheObject(key);
|
||||||
|
if (redisCode == null){
|
||||||
|
throw new RuntimeException(Constants.VERIFY_CODE_INFO.EXPIRED);
|
||||||
|
}else if (!redisCode.equals(inputCode)){
|
||||||
|
throw new RuntimeException(Constants.VERIFY_CODE_INFO.WRONG);
|
||||||
|
}
|
||||||
|
//删除缓存
|
||||||
|
redisCache.deleteObject(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封装登录响应
|
||||||
|
* @param memberId 登录会员id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
private H5LoginResponse getLoginResponse(Long memberId){
|
||||||
|
LoginMember loginMember = new LoginMember();
|
||||||
|
loginMember.setMemberId(memberId);
|
||||||
|
String token = tokenService.createMemberToken(loginMember);
|
||||||
|
H5LoginResponse response = new H5LoginResponse();
|
||||||
|
response.setToken(token);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MemberVO getMemberInfo() {
|
||||||
|
Member member = (Member) LocalDataUtil.getVar(Constants.MEMBER_INFO);
|
||||||
|
MemberVO memberVO = new MemberVO();
|
||||||
|
BeanUtils.copyProperties(member, memberVO);
|
||||||
|
memberVO.setPhone(AesCryptoUtils.decrypt(aesKey, member.getPhoneEncrypted()));
|
||||||
|
return memberVO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.Aftersale;
|
import com.cyl.manager.oms.domain.Aftersale;
|
||||||
import com.cyl.oms.pojo.vo.AftersaleVO;
|
import com.cyl.manager.oms.pojo.vo.AftersaleVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单售后 DO <=> DTO <=> VO / BO / Query
|
* 订单售后 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.AftersaleItem;
|
import com.cyl.manager.oms.domain.AftersaleItem;
|
||||||
import com.cyl.oms.pojo.vo.AftersaleItemVO;
|
import com.cyl.manager.oms.pojo.vo.AftersaleItemVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单售后 DO <=> DTO <=> VO / BO / Query
|
* 订单售后 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.Order;
|
import com.cyl.manager.oms.domain.Order;
|
||||||
import com.cyl.oms.pojo.vo.OrderVO;
|
import com.cyl.manager.oms.pojo.vo.OrderVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单表 DO <=> DTO <=> VO / BO / Query
|
* 订单表 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.OrderDeliveryHistory;
|
import com.cyl.manager.oms.domain.OrderDeliveryHistory;
|
||||||
import com.cyl.oms.pojo.vo.OrderDeliveryHistoryVO;
|
import com.cyl.manager.oms.pojo.vo.OrderDeliveryHistoryVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单发货记录 DO <=> DTO <=> VO / BO / Query
|
* 订单发货记录 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.OrderItem;
|
import com.cyl.manager.oms.domain.OrderItem;
|
||||||
import com.cyl.oms.pojo.vo.OrderItemVO;
|
import com.cyl.manager.oms.pojo.vo.OrderItemVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单中所包含的商品 DO <=> DTO <=> VO / BO / Query
|
* 订单中所包含的商品 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.cyl.oms.convert;
|
package com.cyl.manager.oms.convert;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.cyl.oms.domain.OrderOperateHistory;
|
import com.cyl.manager.oms.domain.OrderOperateHistory;
|
||||||
import com.cyl.oms.pojo.vo.OrderOperateHistoryVO;
|
import com.cyl.manager.oms.pojo.vo.OrderOperateHistoryVO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 订单操作历史记录 DO <=> DTO <=> VO / BO / Query
|
* 订单操作历史记录 DO <=> DTO <=> VO / BO / Query
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.domain;
|
package com.cyl.manager.oms.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.domain;
|
package com.cyl.manager.oms.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.domain;
|
package com.cyl.manager.oms.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.domain;
|
package com.cyl.manager.oms.domain;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.cyl.oms.mapper;
|
package com.cyl.manager.oms.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import com.cyl.manager.oms.domain.AftersaleItem;
|
||||||
import com.cyl.oms.domain.AftersaleItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单售后Mapper接口
|
* 订单售后Mapper接口
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.cyl.oms.mapper;
|
package com.cyl.manager.oms.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import com.cyl.manager.oms.domain.Aftersale;
|
||||||
import com.cyl.oms.domain.Aftersale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单售后Mapper接口
|
* 订单售后Mapper接口
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.cyl.oms.mapper;
|
package com.cyl.manager.oms.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import com.cyl.manager.oms.domain.OrderDeliveryHistory;
|
||||||
import com.cyl.oms.domain.OrderDeliveryHistory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单发货记录Mapper接口
|
* 订单发货记录Mapper接口
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.cyl.oms.mapper;
|
package com.cyl.manager.oms.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import com.cyl.manager.oms.domain.OrderItem;
|
||||||
import com.cyl.oms.domain.OrderItem;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单中所包含的商品Mapper接口
|
* 订单中所包含的商品Mapper接口
|
||||||
@ -1,9 +1,8 @@
|
|||||||
package com.cyl.oms.mapper;
|
package com.cyl.manager.oms.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import com.cyl.manager.oms.domain.OrderOperateHistory;
|
||||||
import com.cyl.oms.domain.OrderOperateHistory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单操作历史记录Mapper接口
|
* 订单操作历史记录Mapper接口
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
package com.cyl.manager.oms.pojo.dto;
|
||||||
|
|
||||||
|
public class SaveOrderItemDTO {
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.query;
|
package com.cyl.manager.oms.pojo.query;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.query;
|
package com.cyl.manager.oms.pojo.query;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.query;
|
package com.cyl.manager.oms.pojo.query;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.query;
|
package com.cyl.manager.oms.pojo.query;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.query;
|
package com.cyl.manager.oms.pojo.query;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@ -1,8 +1,7 @@
|
|||||||
package com.cyl.oms.pojo.vo;
|
package com.cyl.manager.oms.pojo.vo;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.ruoyi.common.core.domain.BaseAudit;
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
/**
|
/**
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.cyl.oms.pojo.vo;
|
package com.cyl.manager.oms.pojo.vo;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package com.cyl.oms.pojo.vo;
|
package com.cyl.manager.oms.pojo.vo;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.ruoyi.common.core.domain.BaseAudit;
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
/**
|
/**
|
||||||
@ -1,8 +1,7 @@
|
|||||||
package com.cyl.oms.pojo.vo;
|
package com.cyl.manager.oms.pojo.vo;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.ruoyi.common.core.domain.BaseAudit;
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
/**
|
/**
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package com.cyl.oms.pojo.vo;
|
package com.cyl.manager.oms.pojo.vo;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.ruoyi.common.core.domain.BaseAudit;
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
/**
|
/**
|
||||||
@ -1,18 +1,16 @@
|
|||||||
package com.cyl.oms.service;
|
package com.cyl.manager.oms.service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.cyl.oms.mapper.AftersaleItemMapper;
|
import com.cyl.manager.oms.mapper.AftersaleItemMapper;
|
||||||
import com.cyl.oms.domain.AftersaleItem;
|
import com.cyl.manager.oms.domain.AftersaleItem;
|
||||||
import com.cyl.oms.pojo.query.AftersaleItemQuery;
|
import com.cyl.manager.oms.pojo.query.AftersaleItemQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单售后Service业务层处理
|
* 订单售后Service业务层处理
|
||||||
@ -1,19 +1,18 @@
|
|||||||
package com.cyl.oms.service;
|
package com.cyl.manager.oms.service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.cyl.oms.mapper.AftersaleMapper;
|
import com.cyl.manager.oms.mapper.AftersaleMapper;
|
||||||
import com.cyl.oms.domain.Aftersale;
|
import com.cyl.manager.oms.domain.Aftersale;
|
||||||
import com.cyl.oms.pojo.query.AftersaleQuery;
|
import com.cyl.manager.oms.pojo.query.AftersaleQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单售后Service业务层处理
|
* 订单售后Service业务层处理
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue