Compare commits
2 Commits
76c6e12c72
...
5595a8009b
| Author | SHA1 | Date | |
|---|---|---|---|
| 5595a8009b | |||
| 233c226dca |
@@ -1,5 +1,6 @@
|
||||
package com.czg.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.mybatisflex.core.audit.AuditManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -17,8 +18,24 @@ public class MybatisFlexConfig {
|
||||
//设置 SQL 审计收集器
|
||||
AuditManager.setMessageCollector(auditMessage ->
|
||||
log.info("[sql] time: {}, size: {}, sql:\n{}",
|
||||
auditMessage.getElapsedTime(), auditMessage.getQueryCount(), auditMessage.getFullSql())
|
||||
);
|
||||
auditMessage.getElapsedTime(), auditMessage.getQueryCount(), compressSql(auditMessage.getFullSql())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 精简SQL:去除多余换行、制表符、连续空格,保留语法必需空格
|
||||
*
|
||||
* @param originalSql 原始带换行/空格的SQL
|
||||
* @return 精简后的SQL
|
||||
*/
|
||||
public static String compressSql(String originalSql) {
|
||||
if (StrUtil.isBlank(originalSql)) {
|
||||
return "";
|
||||
}
|
||||
// 1. 替换所有换行、制表符为单个空格
|
||||
String tempSql = originalSql.replaceAll("\\r\\n|\\r|\\n|\\t", " ");
|
||||
// 2. 替换多个连续空格为单个空格
|
||||
tempSql = tempSql.replaceAll("\\s+", " ");
|
||||
// 3. 去除首尾空格
|
||||
return tempSql.trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.market.vo.MemberConfigVO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.service.account.util.FunUtil;
|
||||
import com.czg.utils.FunUtils;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -61,6 +63,7 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
private MemberLevelConfigService memberLevelConfigService;
|
||||
@DubboReference
|
||||
private TbMemberConfigService memberConfigService;
|
||||
|
||||
private ShopUser getUserInfo(Long shopUserId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getId, shopUserId).one();
|
||||
if (shopUser == null) {
|
||||
@@ -240,9 +243,13 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
||||
shopUser.setBirthDay(null);
|
||||
}
|
||||
shopUser.setNickName(userInfo.getNickName());
|
||||
if (shopUser.getJoinTime() == null) {
|
||||
shopUser.setJoinTime(LocalDateTime.now());
|
||||
// if (shopUser.getJoinTime() == null) {
|
||||
// shopUser.setJoinTime(LocalDateTime.now());
|
||||
// }
|
||||
boolean b = saveOrUpdate(shopUser);
|
||||
if (b) {
|
||||
FunUtils.transactionSafeRun(() -> memberConfigService.joinMemberByCondition(shopId, userId, shopUser));
|
||||
}
|
||||
return saveOrUpdate(shopUser);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.czg.market.entity.MkPointsUser;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.service.MkPointsUserService;
|
||||
import com.czg.market.service.MkShopCouponRecordService;
|
||||
import com.czg.market.service.TbMemberConfigService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopConfigMapper;
|
||||
|
||||
Reference in New Issue
Block a user