|
@@ -1,12 +1,20 @@
|
|
package org.springblade.business.entity;
|
|
package org.springblade.business.entity;
|
|
|
|
|
|
|
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
import org.aspectj.lang.annotation.Around;
|
|
import org.aspectj.lang.annotation.Around;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
|
|
+import org.springblade.core.tool.utils.BeanUtil;
|
|
|
|
+import org.springblade.core.tool.utils.Func;
|
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author yangyj
|
|
* @author yangyj
|
|
* @Date 2023/10/27 10:39
|
|
* @Date 2023/10/27 10:39
|
|
@@ -14,7 +22,10 @@ import org.springframework.stereotype.Component;
|
|
*/
|
|
*/
|
|
@Aspect
|
|
@Aspect
|
|
@Component
|
|
@Component
|
|
|
|
+@RequiredArgsConstructor
|
|
public class TreeCodeUpdateAspect {
|
|
public class TreeCodeUpdateAspect {
|
|
|
|
+ private final StringRedisTemplate redisTemplate;
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Pointcut("@annotation(org.springblade.business.entity.TreeCodeUpdate)")
|
|
@Pointcut("@annotation(org.springblade.business.entity.TreeCodeUpdate)")
|
|
public void p(){};
|
|
public void p(){};
|
|
@@ -24,6 +35,25 @@ public class TreeCodeUpdateAspect {
|
|
Object result = null;
|
|
Object result = null;
|
|
try {
|
|
try {
|
|
Object[] args = joinPoint.getArgs();
|
|
Object[] args = joinPoint.getArgs();
|
|
|
|
+ Map<String,Object> paramsMap= BeanUtil.toMap(args[0]);
|
|
|
|
+ String tcu= this.redisTemplate.opsForValue().get("tcu");
|
|
|
|
+ if(paramsMap.containsKey("contractId")){
|
|
|
|
+ if(Func.isNotBlank(tcu)){
|
|
|
|
+ tcu=tcu+","+paramsMap.get("contractId");
|
|
|
|
+ }
|
|
|
|
+ }else if(paramsMap.containsKey("needCopyPrimaryKeyId")){
|
|
|
|
+ List<Map<String,Object>> listMap= jdbcTemplate.queryForList("select contract_id contractId from m_wbs_tree_contract where p_key_id ="+paramsMap.get("needCopyPrimaryKeyId"));
|
|
|
|
+ if(listMap.size()>0){
|
|
|
|
+ if(Func.isNotBlank(tcu)){
|
|
|
|
+ tcu=tcu+","+listMap.get(0).get("contractId");
|
|
|
|
+ }else{
|
|
|
|
+ tcu=listMap.get(0).get("contractId").toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(tcu!=null) {
|
|
|
|
+ this.redisTemplate.opsForValue().set("tcu", tcu);
|
|
|
|
+ }
|
|
result= joinPoint.proceed();
|
|
result= joinPoint.proceed();
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -32,4 +62,6 @@ public class TreeCodeUpdateAspect {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|