|
@@ -0,0 +1,92 @@
|
|
|
+package com.zhongzheng.modules.exam.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
+import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.modules.exam.bo.*;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamActivity;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamActivityUser;
|
|
|
+import com.zhongzheng.modules.exam.mapper.ExamActivityMapper;
|
|
|
+import com.zhongzheng.modules.exam.service.IExamActivityService;
|
|
|
+import com.zhongzheng.modules.exam.service.IExamActivityUserService;
|
|
|
+import com.zhongzheng.modules.exam.vo.ExamActivityVo;
|
|
|
+import com.zhongzheng.modules.wx.service.IWxLoginService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 考试活动Service业务层处理
|
|
|
+ *
|
|
|
+ * @author yangdamao
|
|
|
+ * @date 2021-12-07
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ExamActivityServiceImpl extends ServiceImpl<ExamActivityMapper, ExamActivity> implements IExamActivityService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IExamActivityUserService iExamActivityUserService;
|
|
|
+ @Autowired
|
|
|
+ private IWxLoginService wxLoginService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean insertByAddBo(ExamActivityAddBo bo) {
|
|
|
+ ExamActivity examActivity = new ExamActivity();
|
|
|
+ BeanUtils.copyProperties(bo, examActivity);
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ examActivity.setCreatorId(loginUser.getUser().getUserId());
|
|
|
+ examActivity.setCreateTime(DateUtils.getNowTime());
|
|
|
+ examActivity.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ return this.save(examActivity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ExamActivityVo> getActivityList(ExamActivityQueryBo bo) {
|
|
|
+ return baseMapper.getActivityList(bo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean updateByAddBo(ExamActivityUpdateBo bo) {
|
|
|
+ ExamActivity examActivity = new ExamActivity();
|
|
|
+ BeanUtils.copyProperties(bo, examActivity);
|
|
|
+ examActivity.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ return this.updateById(examActivity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public ExamActivityApplyVo applyActivity(ExamActivityApplyBo bo) {
|
|
|
+ ExamActivityUser examActivityUser = new ExamActivityUser();
|
|
|
+ BeanUtils.copyProperties(bo, examActivityUser);
|
|
|
+ examActivityUser.setCreateTime(DateUtils.getNowTime());
|
|
|
+ examActivityUser.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iExamActivityUserService.save(examActivityUser);
|
|
|
+ ExamActivity activity = getById(bo.getActivityId());
|
|
|
+ ExamActivityApplyVo vo = new ExamActivityApplyVo();
|
|
|
+ BeanUtils.copyProperties(activity,vo);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExamActivityVo getDetail(Long activityId) {
|
|
|
+ ExamActivity activity = getById(activityId);
|
|
|
+ ExamActivityVo vo = new ExamActivityVo();
|
|
|
+ BeanUtils.copyProperties(activity,vo);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ExamActivityUserVo> getActivityUserList(Long activityId) {
|
|
|
+ return baseMapper.getActivityUserList(activityId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getActivityApplyCode(Long activityId) {
|
|
|
+ return wxLoginService.getActivityApplyCode(activityId);
|
|
|
+ }
|
|
|
+}
|