BlockChainAspect.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //package edu.nju.util;
  2. //
  3. //import edu.nju.dao.BugDao;
  4. //import edu.nju.dao.ReportDao;
  5. //import edu.nju.entities.Bug;
  6. //import edu.nju.entities.Report;
  7. //import org.aspectj.lang.JoinPoint;
  8. //import org.aspectj.lang.ProceedingJoinPoint;
  9. //import org.aspectj.lang.annotation.*;
  10. //import org.springframework.beans.factory.annotation.Autowired;
  11. //import org.springframework.stereotype.Component;
  12. //import javax.servlet.http.HttpServletResponse;
  13. //
  14. //
  15. ///**
  16. // * @Author JiaWei Xu
  17. // * @Date 2020-01-03 16:43
  18. // * @Email xjwhhh233@outlook.com
  19. // */
  20. //
  21. //@Aspect
  22. //@Component
  23. //public class BlockChainAspect {
  24. //
  25. // @Autowired
  26. // BugDao bugDao;
  27. //
  28. // @Autowired
  29. // ReportDao reportDao;
  30. //
  31. //
  32. // /**
  33. // * 定义切入点,切入点为com.example.demo.aop.AopController中的所有函数
  34. // *通过@Pointcut注解声明频繁使用的切点表达式
  35. // */
  36. // @Pointcut("execution(public * edu.nju.controller.UploadController.submit(..))")
  37. // public void bugSubmit(){
  38. //
  39. // }
  40. //
  41. // @Pointcut("execution(public * edu.nju.controller.AnalyzeController.saveGrade(..))")
  42. // public void saveBugGrade(){
  43. //
  44. // }
  45. // /**
  46. // * @description 在连接点执行之前执行的通知
  47. // */
  48. // @Before("saveBugGrade()")
  49. // public void doBeforeGame(JoinPoint joinPoint){
  50. // Object[] obj = joinPoint.getArgs();
  51. // for (Object argItem : obj) {
  52. // System.out.println("---->now-->argItem:" + argItem);
  53. // }
  54. //
  55. // }
  56. //
  57. // /**
  58. // * @description 在连接点执行之后执行的通知(返回通知和异常通知的异常)
  59. // */
  60. // @After("saveBugGrade()")
  61. // public void doAfterGame(JoinPoint joinPoint){
  62. // Object[] obj = joinPoint.getArgs();
  63. // for (Object argItem : obj) {
  64. // System.out.println("---->now-->argItem:" + argItem);
  65. // }
  66. // }
  67. //
  68. // /**
  69. // * @description 保存bug分数后传递给区块链
  70. // */
  71. // @AfterReturning(value="saveBugGrade()",returning = "keys")
  72. // public void doAfterReturningSaveBugGrade(JoinPoint joinPoint,Object keys){
  73. // Object[] obj = joinPoint.getArgs();
  74. // for (Object argItem : obj) {
  75. // System.out.println("---->now-->argItem:" + argItem);
  76. // }
  77. // //todo 将该信息传递给区块链服务
  78. // //任务ID、缺陷报告ID、分数、报告评审人ID
  79. //
  80. // String bugId= (String) obj[0];
  81. // String grade=(String) obj[1];
  82. //
  83. // Bug bug=bugDao.findByid(bugId);
  84. // Report report=reportDao.findById(bug.getReport_id());
  85. // String crowdTestId=report.getCase_take_id();
  86. //
  87. // String bugReviewerId="default";
  88. // }
  89. //
  90. // /**
  91. // * @description 上传bug后传递给区块链
  92. // */
  93. // @AfterReturning(value="bugSubmit()",returning = "keys")
  94. // public void doAfterReturningBugSubmit(JoinPoint joinPoint,Object keys){
  95. // Object[] obj = joinPoint.getArgs();
  96. // for (Object argItem : obj) {
  97. // System.out.println("---->now-->argItem:" + argItem);
  98. // }
  99. // //todo 将该信息传递给区块链服务 如何获得该bugID????
  100. // //任务ID、缺陷报告hash、缺陷报告 ID、众测工人ID
  101. //
  102. //
  103. // String bugId= (String) obj[0];
  104. // String grade=(String) obj[1];
  105. //
  106. // Bug bug=bugDao.findByid(bugId);
  107. // Report report=reportDao.findById(bug.getReport_id());
  108. // String crowdTestId=report.getCase_take_id();
  109. //
  110. // String bugReviewerId="default";
  111. // }
  112. ////
  113. //// /**
  114. //// * @description 在连接点执行之后执行的通知(异常通知)
  115. //// */
  116. //// @AfterThrowing("BugSubmit()")
  117. //// public void doAfterThrowingGame(){
  118. //// System.out.println("异常通知:球迷要求退票!");
  119. //// }
  120. //
  121. //// /**
  122. //// * @description 使用环绕通知
  123. //// */
  124. //// @Around("saveBugGrade()")
  125. //// public void doAroundGameData(ProceedingJoinPoint pjp) throws Throwable {
  126. //// try{
  127. //// System.out.println("球星上场前热身!");
  128. //// pjp.proceed();
  129. ////
  130. //// System.out.println("球星本场得到" + point + "分" );
  131. //// }
  132. //// catch(Throwable e){
  133. //// System.out.println("异常通知:球迷要求退票!");
  134. //// }
  135. //// }
  136. //
  137. //
  138. //}