!117 压测期间对代码进行性能优化,以及部分代码优化
Merge pull request !117 from chopper711/test
This commit is contained in:
commit
0c234e78af
@ -26,7 +26,6 @@ import javax.validation.constraints.Min;
|
||||
@RestController
|
||||
@Api(tags = "买家端,预存款充值记录接口")
|
||||
@RequestMapping("/buyer/trade/recharge")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RechargeTradeBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@Api(tags = "买家端,余额提现记录接口")
|
||||
@RequestMapping("/buyer/member/withdrawApply")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MemberWithdrawApplyBuyerController {
|
||||
@Autowired
|
||||
private MemberWithdrawApplyService memberWithdrawApplyService;
|
||||
|
@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@Api(tags = "买家端,预存款充值记录接口")
|
||||
@RequestMapping("/buyer/member/recharge")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RechargeBuyerController {
|
||||
|
||||
@Autowired
|
||||
|
@ -3,12 +3,19 @@ server:
|
||||
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
threads:
|
||||
min-spare: 50
|
||||
max: 1000
|
||||
#
|
||||
# tomcat:
|
||||
# #最大链接数,默认不设置,默认是10000
|
||||
# max-connections: 6500
|
||||
# #最大等待队列长度,允许HTTP请求缓存到请求队列的最大个数,默认不限制
|
||||
# accept-count: 1000
|
||||
# threads:
|
||||
# #最少闲置
|
||||
# min-spare: 50
|
||||
# #最大线程数 ,默认是200
|
||||
# max: 800
|
||||
netty:
|
||||
connection-timeout:
|
||||
|
||||
# 与Spring Boot 2一样,默认情况下,大多数端点都不通过http公开,我们公开了所有端点。对于生产,您应该仔细选择要公开的端点。
|
||||
management:
|
||||
@ -69,10 +76,10 @@ spring:
|
||||
url: jdbc:mysql://127.0.0.1:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: lilishop
|
||||
maxActive: 20
|
||||
initialSize: 5
|
||||
maxActive: 50
|
||||
initialSize: 10
|
||||
maxWait: 60000
|
||||
minIdle: 5
|
||||
minIdle: 10
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
@ -110,7 +117,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: true
|
||||
show: false
|
||||
|
||||
# 忽略TOKEN 鉴权 的url
|
||||
ignored:
|
||||
@ -176,8 +183,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: debug
|
||||
org.hibernate: debug
|
||||
root: error
|
||||
# org.springframework: debug
|
||||
file:
|
||||
# 指定路径
|
||||
|
@ -52,9 +52,6 @@ public class UploadController {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private SystemSettingProperties systemSettingProperties;
|
||||
|
||||
@ApiOperation(value = "文件上传")
|
||||
@PostMapping(value = "/file")
|
||||
public ResultMessage<Object> upload(MultipartFile file,
|
||||
|
@ -108,7 +108,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: true
|
||||
show: false
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
@ -176,7 +176,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
root: error
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
file:
|
||||
|
@ -72,8 +72,8 @@ spring:
|
||||
url: jdbc:mysql://192.168.0.116:3306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: lilishop
|
||||
maxActive: 20
|
||||
initialSize: 5
|
||||
maxActive: 50
|
||||
initialSize: 20
|
||||
maxWait: 60000
|
||||
minIdle: 5
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
@ -183,7 +183,7 @@ mybatis-plus:
|
||||
logging:
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
root: error
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
# org.springframework.data.mongodb.core: debug
|
||||
|
19
consumer/src/main/java/cn/lili/event/MemberLoginEvent.java
Normal file
19
consumer/src/main/java/cn/lili/event/MemberLoginEvent.java
Normal file
@ -0,0 +1,19 @@
|
||||
package cn.lili.event;
|
||||
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
|
||||
/**
|
||||
* 会员登录消息
|
||||
*
|
||||
* @author Chopper
|
||||
* @since 2020/11/17 7:13 下午
|
||||
*/
|
||||
public interface MemberLoginEvent {
|
||||
|
||||
/**
|
||||
* 会员登录
|
||||
*
|
||||
* @param member 会员
|
||||
*/
|
||||
void memberLogin(Member member);
|
||||
}
|
@ -11,7 +11,7 @@ import cn.lili.modules.member.entity.dos.Member;
|
||||
public interface MemberRegisterEvent {
|
||||
|
||||
/**
|
||||
* 会员登录
|
||||
* 会员注册
|
||||
*
|
||||
* @param member 会员
|
||||
*/
|
||||
|
25
consumer/src/main/java/cn/lili/event/impl/MemberExecute.java
Normal file
25
consumer/src/main/java/cn/lili/event/impl/MemberExecute.java
Normal file
@ -0,0 +1,25 @@
|
||||
package cn.lili.event.impl;
|
||||
|
||||
import cn.lili.event.MemberLoginEvent;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 会员自身业务
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2022-01-11 11:08
|
||||
*/
|
||||
@Service
|
||||
public class MemberExecute implements MemberLoginEvent {
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
|
||||
@Override
|
||||
public void memberLogin(Member member) {
|
||||
memberService.updateById(member);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.listener;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.event.MemberLoginEvent;
|
||||
import cn.lili.event.MemberPointChangeEvent;
|
||||
import cn.lili.event.MemberRegisterEvent;
|
||||
import cn.lili.event.MemberWithdrawalEvent;
|
||||
@ -51,6 +52,12 @@ public class MemberMessageListener implements RocketMQListener<MessageExt> {
|
||||
@Autowired
|
||||
private List<MemberRegisterEvent> memberSignEvents;
|
||||
|
||||
/**
|
||||
* 会员注册
|
||||
*/
|
||||
@Autowired
|
||||
private List<MemberLoginEvent> memberLoginEvents;
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageExt messageExt) {
|
||||
@ -69,6 +76,21 @@ public class MemberMessageListener implements RocketMQListener<MessageExt> {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MEMBER_LOGIN:
|
||||
|
||||
for (MemberLoginEvent memberLoginEvent : memberLoginEvents) {
|
||||
try {
|
||||
Member member = JSONUtil.toBean(new String(messageExt.getBody()), Member.class);
|
||||
memberLoginEvent.memberLogin(member);
|
||||
} catch (Exception e) {
|
||||
log.error("会员{},在{}业务中,状态修改事件执行异常",
|
||||
new String(messageExt.getBody()),
|
||||
memberLoginEvent.getClass().getName(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//会员签到
|
||||
case MEMBER_SING:
|
||||
MemberSign memberSign = JSONUtil.toBean(new String(messageExt.getBody()), MemberSign.class);
|
||||
|
@ -111,7 +111,7 @@ spring:
|
||||
props:
|
||||
#是否打印逻辑SQL语句和实际SQL语句,建议调试时打印,在生产环境关闭
|
||||
sql:
|
||||
show: true
|
||||
show: false
|
||||
|
||||
# 忽略鉴权url
|
||||
ignored:
|
||||
@ -179,7 +179,7 @@ logging:
|
||||
config: classpath:logback-spring.xml
|
||||
# 输出级别
|
||||
level:
|
||||
cn.lili: info
|
||||
root: error
|
||||
# org.hibernate: debug
|
||||
# org.springframework: debug
|
||||
file:
|
||||
|
@ -211,6 +211,14 @@ public interface Cache<T> {
|
||||
* @return 计数器结果
|
||||
*/
|
||||
Long incr(String key, long liveTime);
|
||||
/**
|
||||
* redis 计数器 累加
|
||||
* 注:到达liveTime之后,该次增加取消,即自动-1,而不是redis值为空
|
||||
*
|
||||
* @param key 为累计的key,同一key每次调用则值 +1
|
||||
* @return 计数器结果
|
||||
*/
|
||||
Long incr(String key);
|
||||
//-----------------------------------------------redis计数---------------------------------------------
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ public class RedisCache implements Cache {
|
||||
@Override
|
||||
public Boolean remove(Object key) {
|
||||
|
||||
return redisTemplate.delete(key);
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,13 +207,19 @@ public class RedisCache implements Cache {
|
||||
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
|
||||
Long increment = entityIdCounter.getAndIncrement();
|
||||
//初始设置过期时间
|
||||
if ((null == increment || increment == 0) && liveTime > 0) {
|
||||
if (increment == 0 && liveTime > 0) {
|
||||
entityIdCounter.expire(liveTime, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
return increment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long incr(String key) {
|
||||
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
|
||||
return entityIdCounter.getAndIncrement();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用Sorted Set记录keyword
|
||||
* zincrby命令,对于一个Sorted Set,存在的就把分数加x(x可自行设定),不存在就创建一个分数为1的成员
|
||||
|
@ -115,8 +115,7 @@ public enum ResultCode {
|
||||
USER_AUTH_EXPIRED(20004, "用户已退出,请重新登录"),
|
||||
USER_AUTHORITY_ERROR(20005, "权限不足"),
|
||||
USER_CONNECT_LOGIN_ERROR(20006, "未找到登录信息"),
|
||||
USER_NAME_EXIST(20007, "该用户名已被注册"),
|
||||
USER_PHONE_EXIST(20008, "该手机号已被注册"),
|
||||
USER_EXIST(20008, "该用户名或手机号已被注册"),
|
||||
USER_PHONE_NOT_EXIST(20009, "手机号不存在"),
|
||||
USER_PASSWORD_ERROR(20010, "密码不正确"),
|
||||
USER_NOT_PHONE(20011, "非当前用户的手机号"),
|
||||
|
@ -37,6 +37,20 @@ public class UserContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据request获取用户信息
|
||||
*
|
||||
* @return 授权用户
|
||||
*/
|
||||
public static String getUuid() {
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String uuid = request.getHeader(SecurityEnum.UUID.getValue());
|
||||
return uuid;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据jwt获取token重的用户信息
|
||||
|
@ -10,7 +10,7 @@ public enum SecurityEnum {
|
||||
/**
|
||||
* 存在与header中的token参数头 名
|
||||
*/
|
||||
HEADER_TOKEN("accessToken"), USER_CONTEXT("userContext"), JWT_SECRET("secret");
|
||||
HEADER_TOKEN("accessToken"), USER_CONTEXT("userContext"), JWT_SECRET("secret"), UUID("uuid");
|
||||
|
||||
String value;
|
||||
|
||||
|
@ -11,16 +11,16 @@ import cn.lili.common.security.token.Token;
|
||||
* @version v1.0
|
||||
* 2020-11-13 10:13
|
||||
*/
|
||||
public abstract class AbstractTokenGenerate {
|
||||
public abstract class AbstractTokenGenerate<T> {
|
||||
|
||||
/**
|
||||
* 生成token
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param user 用户名
|
||||
* @param longTerm 是否长时间有效
|
||||
* @return TOKEN对象
|
||||
*/
|
||||
public abstract Token createToken(String username, Boolean longTerm);
|
||||
public abstract Token createToken(T user, Boolean longTerm);
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.common.utils;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -10,18 +11,30 @@ import java.util.Date;
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@Slf4j
|
||||
public class SnowFlake {
|
||||
|
||||
/**
|
||||
* 机器id
|
||||
*/
|
||||
private static long workerId = 0L;
|
||||
/**
|
||||
* 机房id
|
||||
*/
|
||||
private static long datacenterId = 0L;
|
||||
// /**
|
||||
// * 机器id
|
||||
// */
|
||||
// private static long workerId = 0L;
|
||||
// /**
|
||||
// * 机房id
|
||||
// */
|
||||
// public static long datacenterId = 0L;
|
||||
|
||||
private static Snowflake snowflake = IdUtil.createSnowflake(workerId, datacenterId);
|
||||
private static Snowflake snowflake;
|
||||
|
||||
/**
|
||||
* 初始化配置
|
||||
*
|
||||
* @param workerId
|
||||
* @param datacenterId
|
||||
*/
|
||||
public static void initialize(long workerId, long datacenterId) {
|
||||
snowflake = IdUtil.getSnowflake(workerId, datacenterId);
|
||||
log.error(workerId+""+datacenterId);
|
||||
}
|
||||
|
||||
public static long getId() {
|
||||
return snowflake.nextId();
|
||||
@ -29,12 +42,14 @@ public class SnowFlake {
|
||||
|
||||
/**
|
||||
* 生成字符,带有前缀
|
||||
*
|
||||
* @param prefix
|
||||
* @return
|
||||
*/
|
||||
public static String createStr(String prefix) {
|
||||
return prefix + DateUtil.toString(new Date(), "yyyyMMdd") + SnowFlake.getId();
|
||||
}
|
||||
|
||||
public static String getIdStr() {
|
||||
return snowflake.nextId() + "";
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import cn.lili.cache.Cache;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* SnowflakeInitiator
|
||||
*
|
||||
* @author Chopper
|
||||
* @version v1.0
|
||||
* 2022-01-14 14:04
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SnowflakeInitiator {
|
||||
|
||||
/**
|
||||
* 缓存前缀
|
||||
*/
|
||||
private static String KEY = "{Snowflake}";
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
/**
|
||||
* 尝试初始化
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
Long num = cache.incr(KEY);
|
||||
long dataCenter = num / 32;
|
||||
long workedId = num % 32;
|
||||
//如果数据中心大于32,则抹除缓存,从头开始
|
||||
if (dataCenter >= 32) {
|
||||
cache.remove(KEY);
|
||||
num = cache.incr(KEY);
|
||||
dataCenter = num / 32;
|
||||
workedId = num % 32;
|
||||
}
|
||||
SnowFlake.initialize(workedId, dataCenter);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SnowFlake.initialize(0, 8);
|
||||
|
||||
System.out.println(SnowFlake.getId());
|
||||
}
|
||||
}
|
@ -87,7 +87,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
this.remove(queryWrapper);
|
||||
throw new NoPermissionException("未绑定用户");
|
||||
}
|
||||
return memberTokenGenerate.createToken(member.getUsername(), longTerm);
|
||||
return memberTokenGenerate.createToken(member, longTerm);
|
||||
} catch (NoPermissionException e) {
|
||||
throw e;
|
||||
}
|
||||
@ -222,7 +222,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
//如果不存在会员,则进行绑定微信openid 和 unionid,并且登录
|
||||
if (member != null) {
|
||||
bindMpMember(openId, unionId, member);
|
||||
return memberTokenGenerate.createToken(member.getUsername(), true);
|
||||
return memberTokenGenerate.createToken(member, true);
|
||||
}
|
||||
|
||||
//如果没有会员,则根据手机号注册会员
|
||||
@ -230,7 +230,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
memberService.save(newMember);
|
||||
newMember = memberService.findByUsername(newMember.getUsername());
|
||||
bindMpMember(openId, unionId, newMember);
|
||||
return memberTokenGenerate.createToken(newMember.getUsername(), true);
|
||||
return memberTokenGenerate.createToken(newMember, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,7 +40,6 @@ import java.util.Date;
|
||||
* @since 2020-03-126 18:04:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionCashServiceImpl extends ServiceImpl<DistributionCashMapper, DistributionCash> implements DistributionCashService {
|
||||
/**
|
||||
* 分销员
|
||||
|
@ -34,7 +34,6 @@ import java.util.Objects;
|
||||
* @since 2020-03-24 23:04:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionGoodsServiceImpl extends ServiceImpl<DistributionGoodsMapper, DistributionGoods> implements DistributionGoodsService {
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderMapper, DistributionOrder> implements DistributionOrderService {
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020-03-24 23:04:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionSelectedGoodsServiceImpl extends ServiceImpl<DistributionSelectedGoodsMapper, DistributionSelectedGoods> implements DistributionSelectedGoodsService {
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,6 @@ import java.util.concurrent.TimeUnit;
|
||||
* @since 2020-03-14 23:04:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionServiceImpl extends ServiceImpl<DistributionMapper, Distribution> implements DistributionService {
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,6 @@ import java.util.List;
|
||||
* @since 2020/11/26 17:50
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements FileService {
|
||||
|
||||
@Autowired
|
||||
|
@ -4,7 +4,11 @@ package cn.lili.modules.goods.service;
|
||||
import cn.lili.modules.goods.entity.dos.Category;
|
||||
import cn.lili.modules.goods.entity.vos.CategoryVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -13,6 +17,7 @@ import java.util.List;
|
||||
* @author pikachu
|
||||
* @since 2020-03-02 16:44:56
|
||||
*/
|
||||
@CacheConfig(cacheNames = "{category}")
|
||||
public interface CategoryService extends IService<Category> {
|
||||
|
||||
|
||||
@ -25,6 +30,15 @@ public interface CategoryService extends IService<Category> {
|
||||
*/
|
||||
List<Category> dbList(String parentId);
|
||||
|
||||
/**
|
||||
* 获取分类
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(key = "#id")
|
||||
Category getCategoryById(String id);
|
||||
|
||||
/**
|
||||
* 根据分类id集合获取所有分类根据层级排序
|
||||
*
|
||||
@ -86,6 +100,7 @@ public interface CategoryService extends IService<Category> {
|
||||
* @param category 商品分类信息
|
||||
* @return 修改结果
|
||||
*/
|
||||
@CacheEvict(key = "#category.id")
|
||||
void updateCategory(Category category);
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020-02-18 16:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService {
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||
* @since 2020-02-18 16:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CategoryBrandServiceImpl extends ServiceImpl<CategoryBrandMapper, CategoryBrand> implements CategoryBrandService {
|
||||
|
||||
@Override
|
||||
|
@ -37,7 +37,6 @@ import java.util.stream.Collectors;
|
||||
* 2020-03-02 16:45:03
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CategoryParameterGroupServiceImpl extends ServiceImpl<CategoryParameterGroupMapper, CategoryParameterGroup> implements CategoryParameterGroupService {
|
||||
/**
|
||||
* 商品参数
|
||||
|
@ -36,7 +36,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
|
||||
|
||||
private static final String DELETE_FLAG_COLUMN = "delete_flag";
|
||||
@ -60,6 +59,11 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||
return this.list(new LambdaQueryWrapper<Category>().eq(Category::getParentId, parentId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategoryById(String id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类id集合获取所有分类根据层级排序
|
||||
*
|
||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CategorySpecificationServiceImpl extends ServiceImpl<CategorySpecificationMapper, CategorySpecification> implements CategorySpecificationService {
|
||||
|
||||
@Override
|
||||
|
@ -33,7 +33,6 @@ import java.util.*;
|
||||
* @since 2020/12/19
|
||||
**/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DraftGoodsServiceImpl extends ServiceImpl<DraftGoodsMapper, DraftGoods> implements DraftGoodsService {
|
||||
/**
|
||||
* 分类
|
||||
|
@ -27,7 +27,6 @@ import java.util.List;
|
||||
* 2020-02-23 15:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, GoodsGallery> implements GoodsGalleryService {
|
||||
/**
|
||||
* 设置
|
||||
|
@ -63,7 +63,6 @@ import java.util.*;
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
|
||||
|
||||
|
||||
|
@ -63,7 +63,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020-02-23 15:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> implements GoodsSkuService {
|
||||
|
||||
/**
|
||||
|
@ -14,6 +14,5 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/10/15
|
||||
**/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GoodsWordsServiceImpl extends ServiceImpl<GoodsWordsMapper, GoodsWords> implements GoodsWordsService {
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import java.util.List;
|
||||
* @since 2020-03-07 16:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreGoodsLabelServiceImpl extends ServiceImpl<StoreGoodsLabelMapper, StoreGoodsLabel> implements StoreGoodsLabelService {
|
||||
|
||||
/**
|
||||
|
@ -34,8 +34,9 @@ public interface FootprintMapper extends BaseMapper<FootPrint> {
|
||||
*
|
||||
* @param memberId 会员ID
|
||||
*/
|
||||
@Delete("DELETE FROM li_foot_print WHERE (SELECT COUNT(b.id) FROM ( SELECT * FROM li_foot_print WHERE member_id = #{memberId} ) b) >100 " +
|
||||
" AND id =(SELECT a.id FROM ( SELECT * FROM li_foot_print WHERE member_id = #{memberId} ORDER BY create_time ASC LIMIT 1 ) AS a)")
|
||||
@Delete("DELETE FROM li_foot_print l1 WHERE l1.id IN (" +
|
||||
"SELECT l2.id FROM (" +
|
||||
"SELECT l3.id FROM li_foot_print l3 WHERE l3.member_id=${memberId} ORDER BY id DESC LIMIT 100,100) l2)")
|
||||
void deleteLastFootPrint(String memberId);
|
||||
|
||||
}
|
@ -27,7 +27,6 @@ import java.util.Objects;
|
||||
* @since 2020/11/18 10:46 上午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint> implements FootprintService {
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,6 @@ import java.util.Optional;
|
||||
* @since 2020/11/18 2:25 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class GoodsCollectionServiceImpl extends ServiceImpl<GoodsCollectionMapper, GoodsCollection> implements GoodsCollectionService {
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@ import java.util.Objects;
|
||||
* @since 2020/11/18 9:44 上午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MemberAddressServiceImpl extends ServiceImpl<MemberAddressMapper, MemberAddress> implements MemberAddressService {
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,6 @@ import java.util.Map;
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMapper, MemberEvaluation> implements MemberEvaluationService {
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,7 @@ import cn.lili.common.security.token.Token;
|
||||
import cn.lili.common.sensitive.SensitiveWordsFilter;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.CookieUtil;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.common.utils.UuidUtils;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.modules.connect.config.ConnectAuthEnum;
|
||||
@ -62,7 +63,6 @@ import java.util.Objects;
|
||||
* @since 2021-03-29 14:10:16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {
|
||||
|
||||
/**
|
||||
@ -143,7 +143,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
throw new ServiceException(ResultCode.USER_PASSWORD_ERROR);
|
||||
}
|
||||
loginBindUser(member);
|
||||
return memberTokenGenerate.createToken(member.getUsername(), false);
|
||||
return memberTokenGenerate.createToken(member, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -168,7 +168,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
|
||||
return storeTokenGenerate.createToken(member.getUsername(), false);
|
||||
return storeTokenGenerate.createToken(member, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,12 +196,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
String username = UuidUtils.getUUID();
|
||||
Member member = new Member(username, UuidUtils.getUUID(), authUser.getAvatar(), authUser.getNickname(),
|
||||
authUser.getGender() != null ? Convert.toInt(authUser.getGender().getCode()) : 0);
|
||||
//保存会员
|
||||
this.save(member);
|
||||
Member loadMember = this.findByUsername(username);
|
||||
registerHandler(member);
|
||||
//绑定登录方式
|
||||
loginBindUser(loadMember, authUser.getUuid(), authUser.getSource());
|
||||
return memberTokenGenerate.createToken(username, false);
|
||||
loginBindUser(member, authUser.getUuid(), authUser.getSource());
|
||||
return memberTokenGenerate.createToken(member, false);
|
||||
} catch (ServiceException e) {
|
||||
log.error("自动注册服务泡出异常:", e);
|
||||
throw e;
|
||||
@ -235,13 +233,23 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
//如果手机号不存在则自动注册用户
|
||||
if (member == null) {
|
||||
member = new Member(mobilePhone, UuidUtils.getUUID(), mobilePhone);
|
||||
//保存会员
|
||||
this.save(member);
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_REGISTER.name();
|
||||
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
|
||||
registerHandler(member);
|
||||
}
|
||||
loginBindUser(member);
|
||||
return memberTokenGenerate.createToken(member.getUsername(), false);
|
||||
return memberTokenGenerate.createToken(member, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册方法抽象
|
||||
*
|
||||
* @param member
|
||||
*/
|
||||
private void registerHandler(Member member) {
|
||||
member.setId(SnowFlake.getIdStr());
|
||||
//保存会员
|
||||
this.save(member);
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_REGISTER.name();
|
||||
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -281,13 +289,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
//设置会员信息
|
||||
Member member = new Member(userName, new BCryptPasswordEncoder().encode(password), mobilePhone);
|
||||
//注册成功后用户自动登录
|
||||
if (this.save(member)) {
|
||||
Token token = memberTokenGenerate.createToken(member.getUsername(), false);
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_REGISTER.name();
|
||||
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
|
||||
return token;
|
||||
}
|
||||
return null;
|
||||
registerHandler(member);
|
||||
Token token = memberTokenGenerate.createToken(member, false);
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -331,9 +335,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
|
||||
//添加会员
|
||||
Member member = new Member(memberAddDTO.getUsername(), new BCryptPasswordEncoder().encode(memberAddDTO.getPassword()), memberAddDTO.getMobile());
|
||||
this.save(member);
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_REGISTER.name();
|
||||
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
|
||||
registerHandler(member);
|
||||
return member;
|
||||
}
|
||||
|
||||
@ -430,10 +432,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
* @param mobilePhone 手机号
|
||||
* @return 会员
|
||||
*/
|
||||
private Member findByPhone(String mobilePhone) {
|
||||
private Long findMember(String mobilePhone, String userName) {
|
||||
QueryWrapper<Member> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("mobile", mobilePhone);
|
||||
return this.baseMapper.selectOne(queryWrapper);
|
||||
queryWrapper.eq("mobile", mobilePhone)
|
||||
.or().eq("username", userName);
|
||||
return this.baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -599,13 +602,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
* @param mobilePhone 手机号
|
||||
*/
|
||||
private void checkMember(String userName, String mobilePhone) {
|
||||
//判断用户名是否存在
|
||||
if (findByUsername(userName) != null) {
|
||||
throw new ServiceException(ResultCode.USER_NAME_EXIST);
|
||||
}
|
||||
//判断手机号是否存在
|
||||
if (findByPhone(mobilePhone) != null) {
|
||||
throw new ServiceException(ResultCode.USER_PHONE_EXIST);
|
||||
if (findMember(userName, mobilePhone) > 0) {
|
||||
throw new ServiceException(ResultCode.USER_EXIST);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.modules.member.token;
|
||||
|
||||
import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.security.token.Token;
|
||||
@ -9,6 +10,9 @@ import cn.lili.common.context.ThreadContextHolder;
|
||||
import cn.lili.common.enums.ClientTypeEnum;
|
||||
import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -22,17 +26,17 @@ import java.util.Date;
|
||||
* @since 2020/11/16 10:50
|
||||
*/
|
||||
@Component
|
||||
public class MemberTokenGenerate extends AbstractTokenGenerate {
|
||||
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
public class MemberTokenGenerate extends AbstractTokenGenerate<Member> {
|
||||
@Autowired
|
||||
private TokenUtil tokenUtil;
|
||||
@Autowired
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
|
||||
@Override
|
||||
public Token createToken(String username, Boolean longTerm) {
|
||||
|
||||
Member member = memberService.findByUsername(username);
|
||||
public Token createToken(Member member, Boolean longTerm) {
|
||||
|
||||
//获取客户端类型
|
||||
String clientType = ThreadContextHolder.getHttpRequest().getHeader("clientType");
|
||||
@ -50,11 +54,12 @@ public class MemberTokenGenerate extends AbstractTokenGenerate {
|
||||
//记录最后登录时间,客户端类型
|
||||
member.setLastLoginDate(new Date());
|
||||
member.setClientEnum(clientTypeEnum.name());
|
||||
memberService.updateById(member);
|
||||
String destination = rocketmqCustomProperties.getMemberTopic() + ":" + MemberTagsEnum.MEMBER_LOGIN.name();
|
||||
rocketMQTemplate.asyncSend(destination, member, RocketmqSendCallbackBuilder.commonCallback());
|
||||
|
||||
AuthUser authUser = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), member.getFace(), UserEnums.MEMBER);
|
||||
//登陆成功生成token
|
||||
return tokenUtil.createToken(username, authUser, longTerm, UserEnums.MEMBER);
|
||||
return tokenUtil.createToken(member.getUsername(), authUser, longTerm, UserEnums.MEMBER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,29 +23,25 @@ import org.springframework.stereotype.Component;
|
||||
* @since 2020/11/16 10:51
|
||||
*/
|
||||
@Component
|
||||
public class StoreTokenGenerate extends AbstractTokenGenerate {
|
||||
@Autowired
|
||||
private MemberService memberService;
|
||||
public class StoreTokenGenerate extends AbstractTokenGenerate<Member> {
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
@Autowired
|
||||
private TokenUtil tokenUtil;
|
||||
|
||||
@Override
|
||||
public Token createToken(String username, Boolean longTerm) {
|
||||
//生成token
|
||||
Member member = memberService.findByUsername(username);
|
||||
public Token createToken(Member member, Boolean longTerm) {
|
||||
if (!member.getHaveStore()) {
|
||||
throw new ServiceException(ResultCode.STORE_NOT_OPEN);
|
||||
}
|
||||
LambdaQueryWrapper<Store> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Store::getMemberId, member.getId());
|
||||
Store store = storeService.getOne(queryWrapper);
|
||||
AuthUser user = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), store.getStoreLogo(), UserEnums.STORE);
|
||||
AuthUser authUser = new AuthUser(member.getUsername(), member.getId(), member.getNickName(), store.getStoreLogo(), UserEnums.STORE);
|
||||
|
||||
user.setStoreId(store.getId());
|
||||
user.setStoreName(store.getStoreName());
|
||||
return tokenUtil.createToken(username, user, longTerm, UserEnums.STORE);
|
||||
authUser.setStoreId(store.getId());
|
||||
authUser.setStoreName(store.getStoreName());
|
||||
return tokenUtil.createToken(member.getUsername(), authUser, longTerm, UserEnums.STORE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/11/17 3:48 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements MessageService {
|
||||
|
||||
@Autowired
|
||||
|
@ -16,7 +16,6 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ShortLinkServiceImpl extends ServiceImpl<ShortLinkMapper, ShortLink> implements ShortLinkService {
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 7:37 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AfterSaleLogServiceImpl extends ServiceImpl<AfterSaleLogMapper, AfterSaleLog> implements AfterSaleLogService {
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 7:38 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AfterSaleReasonServiceImpl extends ServiceImpl<AfterSaleReasonMapper, AfterSaleReason> implements AfterSaleReasonService {
|
||||
|
||||
|
||||
|
@ -65,7 +65,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020/11/17 7:38 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AfterSaleServiceImpl extends ServiceImpl<AfterSaleMapper, AfterSale> implements AfterSaleService {
|
||||
|
||||
/**
|
||||
|
@ -106,6 +106,7 @@ public class TradeDTO implements Serializable {
|
||||
*/
|
||||
private MemberAddress memberAddress;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端类型
|
||||
*/
|
||||
|
@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -85,19 +86,17 @@ public class TradeBuilder {
|
||||
* 1.构造交易
|
||||
* 2.创建交易
|
||||
*
|
||||
* @param checkedWay 购物车类型
|
||||
* @param tradeDTO 交易模型
|
||||
* @return 交易信息
|
||||
*/
|
||||
public Trade createTrade(CartTypeEnum checkedWay) {
|
||||
//读取对应购物车的商品信息
|
||||
TradeDTO tradeDTO = cartService.readDTO(checkedWay);
|
||||
public Trade createTrade(TradeDTO tradeDTO) {
|
||||
|
||||
//需要对购物车渲染
|
||||
if (isSingle(checkedWay)) {
|
||||
if (isSingle(tradeDTO.getCartTypeEnum())) {
|
||||
renderCartBySteps(tradeDTO, RenderStepStatement.singleTradeRender);
|
||||
} else if (checkedWay.equals(CartTypeEnum.PINTUAN)) {
|
||||
} else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.PINTUAN)) {
|
||||
renderCartBySteps(tradeDTO, RenderStepStatement.pintuanTradeRender);
|
||||
} else {
|
||||
} else {
|
||||
renderCartBySteps(tradeDTO, RenderStepStatement.tradeRender);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class CommissionRender implements CartRenderStep {
|
||||
String categoryId = cartSkuVO.getGoodsSku().getCategoryPath()
|
||||
.substring(cartSkuVO.getGoodsSku().getCategoryPath().lastIndexOf(",") + 1);
|
||||
if (CharSequenceUtil.isNotEmpty(categoryId)) {
|
||||
Double commissionRate = categoryService.getById(categoryId).getCommissionRate();
|
||||
Double commissionRate = categoryService.getCategoryById(categoryId).getCommissionRate();
|
||||
priceDetailDTO.setPlatFormCommissionPoint(commissionRate);
|
||||
}
|
||||
|
||||
|
@ -537,10 +537,8 @@ public class CartServiceImpl implements CartService {
|
||||
if (tradeDTO.getMemberAddress() == null) {
|
||||
throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST);
|
||||
}
|
||||
//将购物车信息写入缓存,后续逻辑调用校验
|
||||
this.resetTradeDTO(tradeDTO);
|
||||
//构建交易
|
||||
Trade trade = tradeBuilder.createTrade(cartTypeEnum);
|
||||
Trade trade = tradeBuilder.createTrade(tradeDTO);
|
||||
this.cleanChecked(tradeDTO);
|
||||
return trade;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 7:38 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem> implements OrderItemService {
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 7:36 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OrderPriceServiceImpl implements OrderPriceService {
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020/11/17 7:38 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
|
||||
private static final String ORDER_SN_COLUMN = "order_sn";
|
||||
@ -145,6 +144,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
private TradeService tradeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void intoDB(TradeDTO tradeDTO) {
|
||||
//检查TradeDTO信息
|
||||
checkTradeDTO(tradeDTO);
|
||||
|
@ -44,7 +44,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow> implements StoreFlowService {
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,7 +29,6 @@ import java.util.List;
|
||||
* @since 2020-05-5 15:10:16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ArticleCategoryServiceImpl extends ServiceImpl<ArticleCategoryMapper, ArticleCategory> implements ArticleCategoryService {
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,6 @@ import java.util.List;
|
||||
* @since 2020/11/18 11:40 上午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
|
||||
|
||||
@Override
|
||||
|
@ -17,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/11/18 11:40 上午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements FeedbackService {
|
||||
|
||||
}
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PaymentServiceImpl implements PaymentService {
|
||||
|
||||
@Autowired
|
||||
|
@ -15,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020-12-19 09:25
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RefundLogServiceImpl extends ServiceImpl<RefundLogMapper, RefundLog> implements RefundLogService {
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService {
|
||||
@Autowired
|
||||
private UserRoleService userRoleService;
|
||||
@ -119,7 +118,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
throw new ServiceException(ResultCode.USER_PASSWORD_ERROR);
|
||||
}
|
||||
try {
|
||||
return managerTokenGenerate.createToken(username, false);
|
||||
return managerTokenGenerate.createToken(adminUser, false);
|
||||
} catch (Exception e) {
|
||||
log.error("管理员登录错误", e);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import java.util.List;
|
||||
* @since 2020/11/22 12:08
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DepartmentRoleServiceImpl extends ServiceImpl<DepartmentRoleMapper, DepartmentRole> implements DepartmentRoleService {
|
||||
|
||||
|
||||
|
@ -27,7 +27,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 3:50 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020/11/17 3:45 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SystemLogServiceImpl implements SystemLogService {
|
||||
|
||||
@Autowired
|
||||
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 3:52 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleService {
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +31,6 @@ import java.util.*;
|
||||
* @author paulG
|
||||
* @since 2021/11/30
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public abstract class AbstractPromotionsServiceImpl<M extends BaseMapper<T>, T extends BasePromotions> extends ServiceImpl<M, T> implements AbstractPromotionsService<T> {
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CouponServiceImpl extends AbstractPromotionsServiceImpl<CouponMapper, Coupon> implements CouponService {
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,6 @@ import java.util.List;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FullDiscountServiceImpl extends AbstractPromotionsServiceImpl<FullDiscountMapper, FullDiscount> implements FullDiscountService {
|
||||
|
||||
/**
|
||||
|
@ -43,7 +43,6 @@ import java.util.List;
|
||||
* @since 2021/7/1
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class KanjiaActivityGoodsServiceImpl extends AbstractPromotionsServiceImpl<KanJiaActivityGoodsMapper, KanjiaActivityGoods> implements KanjiaActivityGoodsService {
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @date 2021/7/1
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class KanjiaActivityLogServiceImpl extends ServiceImpl<KanJiaActivityLogMapper, KanjiaActivityLog> implements KanjiaActivityLogService {
|
||||
|
||||
@Autowired
|
||||
|
@ -48,7 +48,6 @@ import java.util.Objects;
|
||||
* @since 2021/7/1
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class KanjiaActivityServiceImpl extends ServiceImpl<KanJiaActivityMapper, KanjiaActivity> implements KanjiaActivityService {
|
||||
|
||||
@Autowired
|
||||
|
@ -40,7 +40,6 @@ import java.util.*;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheConfig(cacheNames = "{MemberCoupon}")
|
||||
public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, MemberCoupon> implements MemberCouponService {
|
||||
|
||||
|
@ -47,7 +47,6 @@ import java.util.List;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PintuanServiceImpl extends AbstractPromotionsServiceImpl<PintuanMapper, Pintuan> implements PintuanService {
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/8/21
|
||||
**/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PointsGoodsCategoryServiceImpl extends ServiceImpl<PointsGoodsCategoryMapper, PointsGoodsCategory> implements PointsGoodsCategoryService {
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,6 @@ import java.util.*;
|
||||
* @since 2020/8/21
|
||||
**/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class PointsGoodsServiceImpl extends AbstractPromotionsServiceImpl<PointsGoodsMapper, PointsGoods> implements PointsGoodsService {
|
||||
|
||||
|
@ -41,7 +41,6 @@ import java.util.List;
|
||||
* @since 2021/3/18 9:22 上午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PromotionGoodsServiceImpl extends ServiceImpl<PromotionGoodsMapper, PromotionGoods> implements PromotionGoodsService {
|
||||
|
||||
private static final String SKU_ID_COLUMN = "sku_id";
|
||||
|
@ -26,7 +26,6 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PromotionServiceImpl implements PromotionService {
|
||||
/**
|
||||
* 秒杀
|
||||
|
@ -48,7 +48,6 @@ import java.util.stream.Collectors;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, SeckillApply> implements SeckillApplyService {
|
||||
|
||||
|
@ -50,7 +50,6 @@ import java.util.Map;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Slf4j
|
||||
public class SeckillServiceImpl extends AbstractPromotionsServiceImpl<SeckillMapper, Seckill> implements SeckillService {
|
||||
|
||||
|
@ -37,8 +37,6 @@ public class PageViewInterceptor {
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
|
||||
@AfterReturning(returning = "rvt", pointcut = "@annotation(cn.lili.modules.statistics.aop.PageViewPoint)")
|
||||
|
@ -22,7 +22,6 @@ import java.util.Objects;
|
||||
* @since 2020/11/17 4:28 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BillStatisticsServiceImpl extends ServiceImpl<BillStatisticsMapper, Bill> implements BillStatisticsService {
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020-03-126 18:04:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DistributionCashStatisticsServiceImpl extends ServiceImpl<DistributionCashStatisticsMapper, DistributionCash>
|
||||
implements DistributionCashStatisticsService {
|
||||
|
||||
|
@ -24,7 +24,6 @@ import java.util.Objects;
|
||||
* @since 2020-02-25 14:10:16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MemberEvaluationStatisticsServiceImpl extends ServiceImpl<MemberEvaluationStatisticsMapper, MemberEvaluation> implements MemberEvaluationStatisticsService {
|
||||
|
||||
|
||||
|
@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/8/21
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SeckillStatisticsServiceImpl extends ServiceImpl<SeckillStatisticsMapper, Seckill> implements SeckillStatisticsService {
|
||||
|
||||
|
||||
|
@ -5,6 +5,9 @@ import cn.lili.modules.store.entity.dos.FreightTemplate;
|
||||
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -14,6 +17,7 @@ import java.util.List;
|
||||
* @author Bulbasaur
|
||||
* @since 2020-03-07 09:24:33
|
||||
*/
|
||||
@CacheConfig(cacheNames = "{freightTemplate}")
|
||||
public interface FreightTemplateService extends IService<FreightTemplate> {
|
||||
|
||||
/**
|
||||
@ -38,6 +42,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
|
||||
* @param id 运费模板ID
|
||||
* @return 运费模板
|
||||
*/
|
||||
@Cacheable(key = "#id")
|
||||
FreightTemplateVO getFreightTemplate(String id);
|
||||
|
||||
/**
|
||||
@ -55,6 +60,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
|
||||
* @param freightTemplateVO 运费模板
|
||||
* @return 运费模板
|
||||
*/
|
||||
@CacheEvict(key = "#freightTemplateVO.id")
|
||||
FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO);
|
||||
|
||||
/**
|
||||
@ -64,6 +70,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
|
||||
* @param id 运费模板ID
|
||||
* @return 操作状态
|
||||
*/
|
||||
@CacheEvict(key = "#freightTemplateVO.id")
|
||||
boolean removeFreightTemplate(String id);
|
||||
|
||||
}
|
@ -48,7 +48,6 @@ import java.util.List;
|
||||
* @since 2020/11/17 4:28 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements BillService {
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,6 @@ import java.util.List;
|
||||
* @since 2020-03-07 09:24:33
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FreightTemplateServiceChildImpl extends ServiceImpl<FreightTemplateChildMapper, FreightTemplateChild> implements FreightTemplateChildService {
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,6 @@ import java.util.List;
|
||||
* @since 2020/11/22 16:00
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMapper, FreightTemplate> implements FreightTemplateService {
|
||||
/**
|
||||
* 配送子模板
|
||||
|
@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/11/22 16:00
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreAddressServiceImpl extends ServiceImpl<StoreAddressMapper, StoreAddress> implements StoreAddressService {
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +43,6 @@ import java.util.*;
|
||||
* @since 2020-03-07 16:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreDetailServiceImpl extends ServiceImpl<StoreDetailMapper, StoreDetail> implements StoreDetailService {
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,6 @@ import java.util.Optional;
|
||||
* @since 2020-03-07 16:18:56
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements StoreService {
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @since 2020/11/17 8:02 下午
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
|
||||
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user