|
|
@@ -28,12 +28,14 @@ import io.renren.modules.qmgj.service.FavoriteInfoService;
|
|
|
import io.renren.modules.qmgj.service.WorkService;
|
|
|
import io.renren.modules.qmjz.entity.AppraiseManage;
|
|
|
import io.renren.modules.qmjz.entity.ScoreStu;
|
|
|
+import io.renren.modules.qmjz.entity.TaskManage;
|
|
|
import io.renren.modules.qmjz.entity.vo.AppraiseManageVo;
|
|
|
import io.renren.modules.qmjz.enums.ScoreType;
|
|
|
import io.renren.modules.qmjz.enums.TaskType;
|
|
|
import io.renren.modules.qmjz.mapper.AppraiseManageMapper;
|
|
|
import io.renren.modules.qmjz.mapper.ScoreStuMapper;
|
|
|
import io.renren.modules.qmjz.service.ScoreStuService;
|
|
|
+import io.renren.modules.qmjz.service.TaskManageService;
|
|
|
import io.renren.modules.qmjz.utils.BeanCopyUtils;
|
|
|
import io.renren.modules.qmjz.utils.DateForStr;
|
|
|
import io.renren.modules.qyh.entity.AuditEntity;
|
|
|
@@ -121,6 +123,9 @@ public class WorkServiceImpl extends ServiceImpl<WorkDao, WorkEntity> implements
|
|
|
private ScoreStuService scoreStuService;
|
|
|
@Autowired
|
|
|
private ScoreStuMapper scoreStuMapper;
|
|
|
+ @Autowired
|
|
|
+ private TaskManageService taskManageService;
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
Map params = new HashMap();
|
|
|
params.put("myDataPermissions", true);
|
|
|
@@ -822,14 +827,14 @@ public class WorkServiceImpl extends ServiceImpl<WorkDao, WorkEntity> implements
|
|
|
return R.error(510, "当前报名数据有更新,请重试!");
|
|
|
}
|
|
|
}
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("workStuId", workStu.getId());
|
|
|
- long time = DateUtil.parseDate(work.getRegistrationTime(), "yyyy-MM-dd HH:mm").getTime();
|
|
|
- String expirationTime = String.valueOf(time - System.currentTimeMillis());
|
|
|
- rabbitTemplate.convertAndSend(QueueConstant.WORK_MS_QUEUE, jsonObject.toString(), message -> {
|
|
|
- message.getMessageProperties().setExpiration(expirationTime);
|
|
|
- return message;
|
|
|
- });
|
|
|
+ // JSONObject jsonObject = new JSONObject();
|
|
|
+ // jsonObject.put("workStuId", workStu.getId());
|
|
|
+ // long time = DateUtil.parseDate(work.getRegistrationTime(), "yyyy-MM-dd HH:mm").getTime();
|
|
|
+ // String expirationTime = String.valueOf(time - System.currentTimeMillis());
|
|
|
+ // rabbitTemplate.convertAndSend(QueueConstant.WORK_SCORE_QUEUE, jsonObject.toString(), message -> {
|
|
|
+ // message.getMessageProperties().setExpiration(expirationTime);
|
|
|
+ // return message;
|
|
|
+ // });
|
|
|
//TODO 更新用户工作次数
|
|
|
memberInfoDao.updateWorkFrequency(workStu.getStuId(), 1, true);
|
|
|
|
|
|
@@ -1793,6 +1798,55 @@ public class WorkServiceImpl extends ServiceImpl<WorkDao, WorkEntity> implements
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void endPublishAndSendPoint() {
|
|
|
+ String nowDate = DateFormatUtils.format(new Date(),"yyyy-MM-dd");
|
|
|
+ String nowTime = DateFormatUtils.format(new Date(),"HH:mm");
|
|
|
+ List<WorkEntity> workEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<WorkEntity>()
|
|
|
+ .le(WorkEntity::getWorkdateEnd, nowDate)
|
|
|
+ .le(WorkEntity::getWorktimeEnd, nowTime)
|
|
|
+ .eq(WorkEntity::getIsPublish, "1")
|
|
|
+ );
|
|
|
+ if(CollectionUtil.isNotEmpty(workEntityList))
|
|
|
+ {
|
|
|
+ for (WorkEntity workEntity : workEntityList) {
|
|
|
+ if (ObjectUtil.isNotNull(workEntity)) {
|
|
|
+ //查询当前兼职的参与人员
|
|
|
+ List<WorkStuEntity> workStuList = workStuDao.selectList(new LambdaQueryWrapper<WorkStuEntity>()
|
|
|
+ .eq(WorkStuEntity::getWorkId, workEntity.getId()));
|
|
|
+ if (CollectionUtil.isNotEmpty(workStuList)){
|
|
|
+ for (WorkStuEntity workStuEntity : workStuList) {
|
|
|
+ //送积分
|
|
|
+ TaskManage taskManage = taskManageService.getById(TaskType.WORK_ACTIVITY.getCode(), false);
|
|
|
+ // 增加积分记录
|
|
|
+ ScoreStu scoreStu = new ScoreStu();
|
|
|
+ scoreStu.setStuId(workStuEntity.getStuId());
|
|
|
+ scoreStu.setScoreType(ScoreType.TASK_SCORE.getCode());
|
|
|
+ scoreStu.setDay(new SimpleDateFormat("yyyyMMdd").format(new Date()));
|
|
|
+ scoreStu.setBusinessId(workStuEntity.getWorkId());
|
|
|
+ scoreStu.setTaskId(taskManage.getId());
|
|
|
+ // 查询积分值
|
|
|
+ Integer taskScore = taskManage.getTaskScore();
|
|
|
+ Integer totalScore = scoreStuService.getTotalScore(workStuEntity.getStuId());
|
|
|
+ scoreStu.setSurplusScore(totalScore + taskScore);
|
|
|
+ scoreStu.setScoreValue(taskScore);
|
|
|
+ scoreStu.setScoreEvent(TaskType.WORK_ACTIVITY.getInfo());
|
|
|
+ scoreStu.setCreateTime(new Date());
|
|
|
+ ScoreStu scoreOne = scoreStuService.getOneByStuIdActId(workStuEntity.getStuId(), workStuEntity.getWorkId());
|
|
|
+ if (null == scoreOne){
|
|
|
+ scoreStuService.save(scoreStu);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<WorkEntity>().set(WorkEntity::getIsPublish, "0")
|
|
|
+ .eq(WorkEntity::getId, workEntity.getId()));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void sendMqUpdate(WorkEntity work) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("workId", work.getId());
|