|
@@ -1,24 +1,31 @@
|
|
|
package cn.iocoder.yudao.module.work.service.score;
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
+import cn.iocoder.yudao.module.work.controller.admin.score.vo.ScorePageReqVO;
|
|
|
+import cn.iocoder.yudao.module.work.controller.admin.score.vo.ScoreSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.work.controller.admin.work.vo.workPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.work.dal.dataobject.score.ScoreDO;
|
|
|
+import cn.iocoder.yudao.module.work.dal.dataobject.score.ScoreStatusDO;
|
|
|
+import cn.iocoder.yudao.module.work.dal.dataobject.type.TypeDO;
|
|
|
+import cn.iocoder.yudao.module.work.dal.dataobject.work.workDO;
|
|
|
+import cn.iocoder.yudao.module.work.dal.mysql.score.ScoreMapper;
|
|
|
+import cn.iocoder.yudao.module.work.dal.mysql.type.TypeMapper;
|
|
|
+import cn.iocoder.yudao.module.work.dal.mysql.work.WorkMapper;
|
|
|
+import cn.iocoder.yudao.module.work.service.type.TypeService;
|
|
|
+import cn.iocoder.yudao.module.work.service.work.workService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
|
|
|
-import cn.iocoder.yudao.module.work.controller.admin.score.vo.*;
|
|
|
-import cn.iocoder.yudao.module.work.dal.dataobject.score.ScoreDO;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.module.work.dal.mysql.score.ScoreMapper;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
-import static cn.iocoder.yudao.module.work.enums.ErrorCodeConstants.*;
|
|
|
+import static cn.iocoder.yudao.module.work.enums.ErrorCodeConstants.SCORE_NOT_EXISTS;
|
|
|
|
|
|
/**
|
|
|
* 作品评分 Service 实现类
|
|
@@ -31,6 +38,10 @@ public class ScoreServiceImpl implements ScoreService {
|
|
|
|
|
|
@Resource
|
|
|
private ScoreMapper scoreMapper;
|
|
|
+ @Resource
|
|
|
+ private TypeService typeService;
|
|
|
+ @Resource
|
|
|
+ private workService workService;
|
|
|
|
|
|
@Override
|
|
|
public Integer createScore(ScoreSaveReqVO createReqVO) {
|
|
@@ -87,5 +98,32 @@ public class ScoreServiceImpl implements ScoreService {
|
|
|
public PageResult<ScoreDO> getScorePage(ScorePageReqVO pageReqVO) {
|
|
|
return scoreMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public ScoreStatusDO getScoreStatus() {
|
|
|
+ //所有
|
|
|
+ int all=0;
|
|
|
+ //完成
|
|
|
+ int finish=0;
|
|
|
+ //剩余
|
|
|
+ int remain=0;
|
|
|
+ List<TypeDO> scoreTreeList = typeService.getScoreTreeList();
|
|
|
+ for (TypeDO typeDO:scoreTreeList){
|
|
|
+ workPageReqVO pageReqVO = new workPageReqVO();
|
|
|
+ pageReqVO.setStatus("1");
|
|
|
+ pageReqVO.setCategoryId(String.valueOf(typeDO.getId()));
|
|
|
+ List<workDO> list = workService.getworkList(pageReqVO);
|
|
|
+ all+=list.size();
|
|
|
+ for (workDO workDO:list){
|
|
|
+ if (workDO.getScoreDO().getScore()==null){
|
|
|
+ remain++;
|
|
|
+ }else {
|
|
|
+ finish++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return new ScoreStatusDO(String.valueOf(all),String.valueOf(finish),String.valueOf(remain));
|
|
|
+ }
|
|
|
|
|
|
}
|