乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Java的新項(xiàng)目學(xué)成在線筆記-day19(十三)

       印度阿三17 2019-08-08
      4 自動(dòng)添加選課開發(fā)?
      ??4.1 學(xué)習(xí)服務(wù)添加選課?
      4.1.1需求分析?
      學(xué)習(xí)服務(wù)接收MQ發(fā)送添加選課消息,執(zhí)行添加 選 課操作。 添加選課成功向?qū)W生選課表插入記錄、向歷史任務(wù)表插入記錄、并向MQ發(fā)送“完成選課”消息。
      ??4.1.2 RabbitMQ配置?
      學(xué)習(xí)服務(wù)監(jiān)聽MQ的添加選課隊(duì)列,并且聲明完成選課隊(duì)列,配置代碼同訂單服務(wù)中RabbitMQ配置? ?4.1.3 Dao?
      學(xué)生選課Dao:

      [AppleScript]?純文本查看?復(fù)制代碼

      ?

      1

      public interface XcLearningCourseRepository extends JpaRepository<XcLearningCourse, String> {???? //根據(jù)用戶和課程查詢選課記錄,用于判斷是否添加選課???? XcLearningCourse findXcLearningCourseByUserIdAndCourseId(String userId, String courseId); }


      歷史任務(wù)Dao:
      ?

      [AppleScript]?純文本查看?復(fù)制代碼

      ?

      1

      public interface XcTaskHisRepository extends JpaRepository<XcTaskHis,String> {?? }


      4.1.4 Service?
      1、添加選課方法 向xc_learning_course添加記錄,為保證不重復(fù)添加選課,先查詢歷史任務(wù)表,如果從歷史任務(wù)表查詢不到任務(wù)說 明此任務(wù)還沒有處理,此時(shí)則添加選課并添加歷史任務(wù)。
      在學(xué)習(xí)服務(wù)中編碼如下代碼:
      ?

      [AppleScript]?純文本查看?復(fù)制代碼

      ?

      01

      02

      03

      04

      05

      06

      07

      08

      09

      10

      11

      12

      13

      14

      15

      16

      17

      18

      19

      20

      21

      22

      23

      24

      25

      26

      27

      28

      29

      30

      31

      32

      33

      34

      35

      36

      37

      38

      39

      //完成選課??

      ??@Transactional??

      ??public ResponseResult addcourse(String userId, String courseId,String valid,Date? startTime,Date endTime,XcTask xcTask){???????? if (StringUtils.isEmpty(courseId)) {???

      ?????????ExceptionCast.cast(LearningCode.LEARNING_GETMEDIA_ERROR);???

      ?????}???????

      ?if (StringUtils.isEmpty(userId)) {??

      ??????????ExceptionCast.cast(LearningCode.CHOOSECOURSE_USERISNULL);??

      ??????}???

      ?????if(xcTask == null || StringUtils.isEmpty(xcTask.getId())){??

      ??????????ExceptionCast.cast(LearningCode.CHOOSECOURSE_TASKISNULL);???

      ?????}????????? //查詢歷史任務(wù)??????

      ??Optional<XcTaskHis> optional = xcTaskHisRepository.findById(xcTask.getId());??

      ??????if(optional.isPresent()){????????

      ????return new ResponseResult(CommonCode.SUCCESS);????

      ????}?????

      ???XcLearningCourse xcLearningCourse =? xcLearningCourseRepository.findXcLearningCourseByUserIdAndCourseId(userId, courseId);???????? if (xcLearningCourse == null) {//沒有選課記錄則添加?????

      ???????xcLearningCourse = new XcLearningCourse();??????

      ??????xcLearningCourse.setUserId(userId);?????

      ???????xcLearningCourse.setCourseId(courseId);??????

      ??????xcLearningCourse.setValid(valid);???????

      ?????xcLearningCourse.setStartTime(startTime);????

      ????????xcLearningCourse.setEndTime(endTime);???

      ?????????xcLearningCourse.setStatus("501001");???

      ?????????xcLearningCourseRepository.save(xcLearningCourse);??

      ??????} else {//有選課記錄則更新日期?????

      ???????xcLearningCourse.setValid(valid);????

      ????????xcLearningCourse.setStartTime(startTime);????

      ????????xcLearningCourse.setEndTime(endTime);?????

      ???????xcLearningCourse.setStatus("501001");?????

      ???????xcLearningCourseRepository.save(xcLearningCourse);?????

      ???}??

      ?????//向歷史任務(wù)表播入記錄

      ????????Optional<XcTaskHis> optional = xcTaskHisRepository.findById(xcTask.getId());???

      ?????if(!optional.isPresent()){??????

      ?????//添加歷史任務(wù)????

      ????????XcTaskHis xcTaskHis = new XcTaskHis();?????

      ???????BeanUtils.copyProperties(xcTask,xcTaskHis);????

      ????????xcTaskHisRepository.save(xcTaskHis);

      ????????}

      ?

      [AppleScript]?純文本查看?復(fù)制代碼

      ?

      1

      return new ResponseResult(CommonCode.SUCCESS);???? }

      來源:https://www./content-1-382151.html

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多