|
@@ -3,14 +3,13 @@ package cn.com.ty.lift.system.homepage.service;
|
|
|
import cn.com.ty.lift.common.constants.ApiConstants;
|
|
|
import cn.com.ty.lift.system.constants.CommonConstants;
|
|
|
import cn.com.ty.lift.system.homepage.dao.dto.request.TodoRequest;
|
|
|
-import cn.com.ty.lift.system.homepage.dao.dto.response.AnnualInspectionResponse;
|
|
|
-import cn.com.ty.lift.system.homepage.dao.dto.response.CapitalRepairResponse;
|
|
|
-import cn.com.ty.lift.system.homepage.dao.dto.response.EmergencyResponse;
|
|
|
-import cn.com.ty.lift.system.homepage.dao.dto.response.MaintenanceTodoResponse;
|
|
|
+import cn.com.ty.lift.system.homepage.dao.dto.response.*;
|
|
|
import cn.com.ty.lift.system.homepage.dao.mapper.TodoDataMapper;
|
|
|
import cn.com.ty.lift.system.settings.dao.entity.MtCompanyAttestation;
|
|
|
import cn.com.ty.lift.system.settings.service.IMtCompanyAttestationService;
|
|
|
+import cn.com.ty.lift.system.user.dao.entity.MtCompanyUser;
|
|
|
import cn.com.ty.lift.system.user.dao.entity.UserApplication;
|
|
|
+import cn.com.ty.lift.system.user.service.IMtCompanyUserService;
|
|
|
import cn.com.ty.lift.system.user.service.IUserApplicationService;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -19,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author huangyuan
|
|
@@ -37,6 +37,9 @@ public class TodoService {
|
|
|
@Resource
|
|
|
private IUserApplicationService userApplicationService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IMtCompanyUserService mtCompanyUserService;
|
|
|
+
|
|
|
/**
|
|
|
* @param todoRequest 公司id
|
|
|
* @return
|
|
@@ -51,7 +54,7 @@ public class TodoService {
|
|
|
.eq("status", ApiConstants.ApplicationConstants.APPLY_WAIT)
|
|
|
);
|
|
|
//公司申请待办,平台公司才能有公司申请待办
|
|
|
- if(todoRequest.getMtCompanyId() == ApiConstants.PLATFORM_COMPANY_ID){
|
|
|
+ if (todoRequest.getMtCompanyId() == ApiConstants.PLATFORM_COMPANY_ID) {
|
|
|
long platCompanyTodoCount = mtCompanyAttestationService.count(new QueryWrapper<MtCompanyAttestation>()
|
|
|
.eq("is_certificated", ApiConstants.CompanyConstants.MAINTENANCE_WAIT_CERTIFICATE)
|
|
|
);
|
|
@@ -117,4 +120,58 @@ public class TodoService {
|
|
|
.getAnnualInspectionTodoData(todoRequest);
|
|
|
return RestResponse.success(annualInspectionResponseList, ApiConstants.RESULT_SUCCESS, "获取待办数据成功");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ * @description 团队申请团队待办
|
|
|
+ * @date 2020/2/24 11:31 上午
|
|
|
+ */
|
|
|
+ public RestResponse companyApplyTodo(TodoRequest todoRequest) {
|
|
|
+ List<CompanyApplyResponse> companyApplyResponseList = todoDataMapper.getCompanyApplyTodo(todoRequest);
|
|
|
+ //设置团队人数
|
|
|
+ if (companyApplyResponseList != null && companyApplyResponseList.size() > 0) {
|
|
|
+ setCompanyUserNum(companyApplyResponseList);
|
|
|
+ }
|
|
|
+ return RestResponse.success(companyApplyResponseList, ApiConstants.RESULT_SUCCESS, "获取待办数据成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param companyApplyResponseList 团队申请信息
|
|
|
+ * @return
|
|
|
+ * @description 设置团队人数
|
|
|
+ * @date 2020/2/24 12:05 下午
|
|
|
+ */
|
|
|
+ private void setCompanyUserNum(List<CompanyApplyResponse> companyApplyResponseList) {
|
|
|
+ List<Long> companyIdList = companyApplyResponseList.stream()
|
|
|
+ .map(CompanyApplyResponse::getMtCompanyId).collect(Collectors.toList());
|
|
|
+ //获取团队用户
|
|
|
+ List<MtCompanyUser> mtCompanyUserList = mtCompanyUserService.list(new QueryWrapper<MtCompanyUser>()
|
|
|
+ .in(companyIdList != null && companyIdList.size() > 0,
|
|
|
+ "mt_company_id", companyIdList)
|
|
|
+ );
|
|
|
+ if (mtCompanyUserList != null && mtCompanyUserList.size() > 0) {
|
|
|
+ Map<Long, Long> companyIdToUserNum = mtCompanyUserList.stream()
|
|
|
+ .collect(Collectors.groupingBy(MtCompanyUser::getMtCompanyId, Collectors.counting()));
|
|
|
+ //设置团队人数
|
|
|
+ companyApplyResponseList.forEach(companyApplyResponse -> {
|
|
|
+ if (companyIdToUserNum.size() > 0) {
|
|
|
+ long userNum = companyIdToUserNum.get(companyApplyResponse.getMtCompanyId()) != null ?
|
|
|
+ companyIdToUserNum.get(companyApplyResponse.getMtCompanyId()) : 0L;
|
|
|
+ companyApplyResponse.setCompanyUserNum(userNum);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ * @description 用户申请加入团队待办
|
|
|
+ * @date 2020/2/24 11:31 上午
|
|
|
+ */
|
|
|
+ public RestResponse companyApplyUserTodo(TodoRequest todoRequest) {
|
|
|
+ List<CompanyUserApplyResponse> companyUserApplyResponseList = todoDataMapper.getCompanyUserApplyTodo(todoRequest);
|
|
|
+ return RestResponse.success(companyUserApplyResponseList, ApiConstants.RESULT_SUCCESS, "获取待办数据成功");
|
|
|
+ }
|
|
|
}
|