Jelajahi Sumber

修复创客余额日志删除同步

mac 2 tahun lalu
induk
melakukan
f484441b1b

+ 5 - 0
kxs-common/kxs-common-core/pom.xml

@@ -46,6 +46,11 @@
             <groupId>org.springframework.boot</groupId>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-json</artifactId>
             <artifactId>spring-boot-starter-json</artifactId>
         </dependency>
         </dependency>
+        <!--oauth server 依赖-->
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
+        </dependency>
 
 
         <!--spring-webmvc-->
         <!--spring-webmvc-->
         <dependency>
         <dependency>

+ 5 - 0
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/CacheConstants.java

@@ -49,4 +49,9 @@ public interface CacheConstants {
 	 */
 	 */
 	String PARAMS_DETAILS = "params_details";
 	String PARAMS_DETAILS = "params_details";
 
 
+
+	/**
+	 * 用户职级缓存前缀
+	 */
+	String USER_LEVEL = "user_level:";
 }
 }

+ 27 - 0
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/enums/StateTypeEnum.java

@@ -0,0 +1,27 @@
+package com.kxs.common.core.constant.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 统计存储类型
+ *
+ * @author Lxq
+ * @date 2023-10-25
+ */
+@Getter
+@AllArgsConstructor
+public enum StateTypeEnum {
+
+
+    /**
+     * 统计存储类型
+     */
+    day(0, "天"),
+    month(1, "月");
+
+
+    private final Integer type;
+
+    private final String description;
+}

+ 43 - 0
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/constant/enums/UserLevelPolicyEnum.java

@@ -0,0 +1,43 @@
+package com.kxs.common.core.constant.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * <p>
+ * 客小爽职级升级交易额
+ *
+ * @author 没秃顶的码农
+ * @date 2023/10/27
+ */
+@Getter
+@RequiredArgsConstructor
+public enum UserLevelPolicyEnum {
+
+	K0(0, 0L, 1000000L),
+	K1(1, 1000000L, 3000000L),
+	K2(2, 3000000L, 8000000L),
+	K3(3, 8000000L, 15000000L),
+	K4(4, 15000000L, 30000000L),
+	K5(5, 30000000L, 60000000L),
+	K6(6, 60000000L, 100000000L),
+	K7(7, 100000000L, 300000000L),
+	K8(8, 300000000L, 500000000L),
+	K9(9, 500000000L, 5000000000000L);
+
+	/**
+	 * 等级
+	 */
+	private final Integer level;
+
+	/**
+	 * 最小交易额
+	 */
+	private final Long minTrade;
+
+	/**
+	 * 最小交易额
+	 */
+	private final Long maxTrade;
+
+}

+ 0 - 21
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/exception/AccessDeniedBizException.java

@@ -1,21 +0,0 @@
-
-package com.kxs.common.core.exception;
-
-import java.io.Serial;
-
-/**
- * 权限异常
- *
- * @author 没秃顶的码农
- * @date 2023/10/27
- */
-public class AccessDeniedBizException extends RuntimeException {
-
-	@Serial
-	private static final long serialVersionUID = -7285211528095468156L;
-
-	public AccessDeniedBizException(String msg) {
-		super(msg);
-	}
-
-}

+ 6 - 3
kxs-common/kxs-common-core/src/main/java/com/kxs/common/core/exception/GlobalBizExceptionHandler.java

@@ -2,6 +2,7 @@ package com.kxs.common.core.exception;
 
 
 import com.kxs.common.core.util.R;
 import com.kxs.common.core.util.R;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
 import org.springframework.core.annotation.Order;
 import org.springframework.core.annotation.Order;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.util.Assert;
 import org.springframework.util.Assert;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.ResponseStatus;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.security.access.AccessDeniedException;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -70,15 +72,16 @@ public class GlobalBizExceptionHandler {
 		return R.failed(exception.getMessage());
 		return R.failed(exception.getMessage());
 	}
 	}
 
 
+
 	/**
 	/**
 	 * AccessDeniedException
 	 * AccessDeniedException
 	 * @param e the e
 	 * @param e the e
 	 * @return R
 	 * @return R
 	 */
 	 */
-	@ExceptionHandler(AccessDeniedBizException.class)
+	@ExceptionHandler(AccessDeniedException.class)
 	@ResponseStatus(HttpStatus.FORBIDDEN)
 	@ResponseStatus(HttpStatus.FORBIDDEN)
-	public R handleAccessDeniedException(AccessDeniedBizException e) {
-		log.warn("拒绝授权异常信息 ex={}", "Access is denied");
+	public R handleAccessDeniedException(AccessDeniedException e) {
+		log.warn("无权限异常信息 ex={}", "Access denied");
 		return R.failed(e.getLocalizedMessage());
 		return R.failed(e.getLocalizedMessage());
 	}
 	}
 
 

+ 1 - 3
kxs-common/kxs-common-security/src/main/java/com/kxs/common/security/component/SkySecurityInnerAspect.java

@@ -1,9 +1,7 @@
 package com.kxs.common.security.component;
 package com.kxs.common.security.component;
 
 
 import cn.hutool.core.text.CharSequenceUtil;
 import cn.hutool.core.text.CharSequenceUtil;
-import cn.hutool.core.util.StrUtil;
 import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.common.core.constant.SecurityConstants;
-import com.kxs.common.core.exception.AccessDeniedBizException;
 import com.kxs.common.security.annotation.Inner;
 import com.kxs.common.security.annotation.Inner;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletRequest;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
@@ -40,7 +38,7 @@ public class SkySecurityInnerAspect implements Ordered {
 		String header = request.getHeader(SecurityConstants.FROM);
 		String header = request.getHeader(SecurityConstants.FROM);
 		if (inner.value() && !CharSequenceUtil.equals(SecurityConstants.FROM_IN, header)) {
 		if (inner.value() && !CharSequenceUtil.equals(SecurityConstants.FROM_IN, header)) {
 			log.warn("访问接口 {} 没有权限", point.getSignature().getName());
 			log.warn("访问接口 {} 没有权限", point.getSignature().getName());
-			throw new AccessDeniedBizException("Access is denied");
+			throw new AccessDeniedException("Access is denied");
 		}
 		}
 	}
 	}
 
 

+ 1 - 1
kxs-store/kxs-store-api/src/main/java/com/kxs/store/api/model/KxsSendTotal.java

@@ -90,7 +90,7 @@ public class KxsSendTotal extends Model<KxsSendTotal> implements Serializable {
     /**
     /**
      * 统计类型 0月 1天
      * 统计类型 0月 1天
      */
      */
-    @Schema(description = "统计类型 0月 1天")
+    @Schema(description = "统计类型 0天 1月")
     private Integer totalType;
     private Integer totalType;
 
 
 
 

+ 5 - 5
kxs-store/kxs-store-biz/src/main/java/com/kxs/store/biz/service/impl/KxsSendTotalServiceImpl.java

@@ -2,7 +2,7 @@ package com.kxs.store.biz.service.impl;
 
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.kxs.common.core.constant.enums.TotalTypeEnum;
+import com.kxs.common.core.constant.enums.StateTypeEnum;
 import com.kxs.common.core.util.TotalDateUtil;
 import com.kxs.common.core.util.TotalDateUtil;
 import com.kxs.store.biz.mapper.KxsSendTotalMapper;
 import com.kxs.store.biz.mapper.KxsSendTotalMapper;
 import com.kxs.store.api.model.KxsSendTotal;
 import com.kxs.store.api.model.KxsSendTotal;
@@ -27,13 +27,13 @@ public class KxsSendTotalServiceImpl extends ServiceImpl<KxsSendTotalMapper, Kxs
         Integer dateNumber = TotalDateUtil.getDateNumber(LocalDate.now());
         Integer dateNumber = TotalDateUtil.getDateNumber(LocalDate.now());
         KxsSendTotal dateTotal = baseMapper.selectOne(Wrappers.lambdaQuery(KxsSendTotal.class)
         KxsSendTotal dateTotal = baseMapper.selectOne(Wrappers.lambdaQuery(KxsSendTotal.class)
                 .eq(KxsSendTotal::getTotalDate, dateNumber)
                 .eq(KxsSendTotal::getTotalDate, dateNumber)
-                .eq(KxsSendTotal::getTotalType, TotalTypeEnum.date.getType())
+                .eq(KxsSendTotal::getTotalType, StateTypeEnum.day.getType())
                 .eq(KxsSendTotal::getBrandId, brandId)
                 .eq(KxsSendTotal::getBrandId, brandId)
                 .eq(KxsSendTotal::getWarehouseId, warehouseId));
                 .eq(KxsSendTotal::getWarehouseId, warehouseId));
         if (dateTotal == null) {
         if (dateTotal == null) {
             dateTotal = new KxsSendTotal();
             dateTotal = new KxsSendTotal();
             dateTotal.setTotalDate(dateNumber);
             dateTotal.setTotalDate(dateNumber);
-            dateTotal.setTotalType(TotalTypeEnum.date.getType());
+            dateTotal.setTotalType(StateTypeEnum.day.getType());
             dateTotal.setBrandId(brandId);
             dateTotal.setBrandId(brandId);
             dateTotal.setWarehouseId(warehouseId);
             dateTotal.setWarehouseId(warehouseId);
             dateTotal.setTotalNum(count);
             dateTotal.setTotalNum(count);
@@ -47,13 +47,13 @@ public class KxsSendTotalServiceImpl extends ServiceImpl<KxsSendTotalMapper, Kxs
         Integer monthNumber = TotalDateUtil.getMonthNumber(LocalDate.now());
         Integer monthNumber = TotalDateUtil.getMonthNumber(LocalDate.now());
         KxsSendTotal monthTotal = baseMapper.selectOne(Wrappers.lambdaQuery(KxsSendTotal.class)
         KxsSendTotal monthTotal = baseMapper.selectOne(Wrappers.lambdaQuery(KxsSendTotal.class)
                 .eq(KxsSendTotal::getTotalDate, monthNumber)
                 .eq(KxsSendTotal::getTotalDate, monthNumber)
-                .eq(KxsSendTotal::getTotalType, TotalTypeEnum.month.getType())
+                .eq(KxsSendTotal::getTotalType, StateTypeEnum.month.getType())
                 .eq(KxsSendTotal::getBrandId, brandId)
                 .eq(KxsSendTotal::getBrandId, brandId)
                 .eq(KxsSendTotal::getWarehouseId, warehouseId));
                 .eq(KxsSendTotal::getWarehouseId, warehouseId));
         if (monthTotal == null){
         if (monthTotal == null){
             monthTotal = new KxsSendTotal();new KxsSendTotal();
             monthTotal = new KxsSendTotal();new KxsSendTotal();
             monthTotal.setTotalDate(monthNumber);
             monthTotal.setTotalDate(monthNumber);
-            monthTotal.setTotalType(TotalTypeEnum.month.getType());
+            monthTotal.setTotalType(StateTypeEnum.month.getType());
             monthTotal.setBrandId(brandId);
             monthTotal.setBrandId(brandId);
             monthTotal.setWarehouseId(warehouseId);
             monthTotal.setWarehouseId(warehouseId);
             monthTotal.setTotalNum(count);
             monthTotal.setTotalNum(count);

+ 5 - 0
kxs-transfer/src/main/java/com/kxs/transfer/api/service/user/impl/KxsUserAmountLogServiceImpl.java

@@ -47,6 +47,11 @@ public class KxsUserAmountLogServiceImpl extends ServiceImpl<KxsUserAmountLogMap
 
 
         //操作类型
         //操作类型
         OperationType operation = dmlData.getOperation();
         OperationType operation = dmlData.getOperation();
+        if (operation.equals(OperationType.DELETE)) {
+            // 删除数据
+            baseMapper.deleteById(id);
+            return;
+        }
         for (String field : changeFieldList) {
         for (String field : changeFieldList) {
 
 
             switch (field) {
             switch (field) {