|
@@ -1,5 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.as.service.aidingstudentscollegemanage;
|
|
|
|
|
|
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -15,6 +17,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.module.as.dal.mysql.aidingstudentscollegemanage.AidingStudentsCollegeManageMapper;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
|
|
import static cn.iocoder.yudao.module.as.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
/**
|
|
@@ -28,9 +31,18 @@ public class AidingStudentsCollegeManageServiceImpl implements AidingStudentsCol
|
|
|
|
|
|
@Resource
|
|
|
private AidingStudentsCollegeManageMapper aidingStudentsCollegeManageMapper;
|
|
|
+ @Resource
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+ @Resource
|
|
|
+ private DeptApi deptApi;
|
|
|
|
|
|
@Override
|
|
|
public Long createAidingStudentsCollegeManage(AidingStudentsCollegeManageSaveReqVO createReqVO) {
|
|
|
+ // 获得学院id
|
|
|
+ Long deptId = adminUserApi.getUser(getLoginUserId()).getDeptId();
|
|
|
+ Long collegeId = deptApi.getCollegeId(deptId);
|
|
|
+ createReqVO.setCollegeId(collegeId);
|
|
|
+
|
|
|
// 插入
|
|
|
AidingStudentsCollegeManageDO aidingStudentsCollegeManage = BeanUtils.toBean(createReqVO, AidingStudentsCollegeManageDO.class);
|
|
|
aidingStudentsCollegeManageMapper.insert(aidingStudentsCollegeManage);
|
|
@@ -71,4 +83,24 @@ public class AidingStudentsCollegeManageServiceImpl implements AidingStudentsCol
|
|
|
return aidingStudentsCollegeManageMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+
|
|
|
+ public Map<String, Long> getAidingStudentsCollegeManageCount() {
|
|
|
+ Map<String, Long> map = new LinkedHashMap<>();
|
|
|
+ //总人数
|
|
|
+ map.put("sum", aidingStudentsCollegeManageMapper.selectCount());
|
|
|
+ //未发布
|
|
|
+ map.put("unpublished", aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 0));
|
|
|
+ //审核中
|
|
|
+ //map.put("review", aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 1));
|
|
|
+ //公示中
|
|
|
+ //map.put("publicity", aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 2));
|
|
|
+ //进行中
|
|
|
+ map.put("ongoing", aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 1)
|
|
|
+ +aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 2));
|
|
|
+ //已完成
|
|
|
+ map.put("completed", aidingStudentsCollegeManageMapper.selectCount(AidingStudentsCollegeManageDO::getComStatus, 3));
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
}
|