|
@@ -76,6 +76,13 @@ public class MtCompanyAttestationServiceImpl extends ServiceImpl<MtCompanyAttest
|
|
|
PojoUtils.pojoCopy(mtCompanyAttestationInfo, mtCompanyAttestation);
|
|
|
mtCompanyAttestation = mtCompanyAttestationInfo;
|
|
|
} else {
|
|
|
+ //如果是申请,判断是否重复申请
|
|
|
+ int companyAttestationCount = this.count(new QueryWrapper<MtCompanyAttestation>()
|
|
|
+ .eq("mt_company_id", companyAttestationRequest.getMtCompanyId())
|
|
|
+ );
|
|
|
+ if (companyAttestationCount > 0) {
|
|
|
+ return RestResponse.fail(ApiConstants.RESULT_ERROR, "当前公司已经申请过了请勿重复申请");
|
|
|
+ }
|
|
|
if (userInfo != null) {
|
|
|
//如果是新建,设置创建者名称
|
|
|
mtCompanyAttestation.setCreateUser(userInfo.getName());
|
|
@@ -164,18 +171,29 @@ public class MtCompanyAttestationServiceImpl extends ServiceImpl<MtCompanyAttest
|
|
|
.eq(currentUserId != null, "customer_manager_id", currentUserId)
|
|
|
//通过审核状态筛选申请信息
|
|
|
.eq("is_certificated", companyAttestationRequest.getIsCertificated())
|
|
|
- .like(StringUtils.isNotBlank(companyAttestationRequest.getQueryCondition()), "contacts_name",
|
|
|
- companyAttestationRequest.getQueryCondition())
|
|
|
- .or()
|
|
|
- .like(StringUtils.isNotBlank(companyAttestationRequest.getQueryCondition()), "contacts_tel",
|
|
|
- companyAttestationRequest.getQueryCondition())
|
|
|
+ .and(i -> i
|
|
|
+ .like(StringUtils.isNotBlank(companyAttestationRequest.getQueryCondition()), "contacts_name",
|
|
|
+ companyAttestationRequest.getQueryCondition())
|
|
|
+ .or()
|
|
|
+ .like(StringUtils.isNotBlank(companyAttestationRequest.getQueryCondition()), "contacts_tel",
|
|
|
+ companyAttestationRequest.getQueryCondition())
|
|
|
+ )
|
|
|
);
|
|
|
List<CompanyAttestationResponse> companyAttestationResponseList = new ArrayList<>();
|
|
|
List<MtCompanyAttestation> mtCompanyAttestationList = mtCompanyAttestationPage.getRecords();
|
|
|
if (mtCompanyAttestationList != null && mtCompanyAttestationList.size() > 0) {
|
|
|
- List<Long> customerManagerIdList = ProjectUtils.getAttrList(mtCompanyAttestationList, "customerManagerId", null);
|
|
|
+ //获取客户经理信息
|
|
|
+ List<Long> customerManagerIdList = ProjectUtils.getAttrList(mtCompanyAttestationList,
|
|
|
+ "customerManagerId", null);
|
|
|
List<UserInfo> userInfoList = (List<UserInfo>) userInfoService.listByIds(customerManagerIdList);
|
|
|
- Map<Long, UserInfo> customerManagerIdToUserInfo = ProjectUtils.attrToObjMap(userInfoList, "userId", null);
|
|
|
+ Map<Long, UserInfo> customerManagerIdToUserInfo = ProjectUtils.attrToObjMap(userInfoList,
|
|
|
+ "userId", null);
|
|
|
+ //获取公司信息
|
|
|
+ List<Long> companyIdList = ProjectUtils.getAttrList(mtCompanyAttestationList,
|
|
|
+ "mtCompanyId", null);
|
|
|
+ List<MaintenanceCompany> maintenanceCompanyList = (List<MaintenanceCompany>)
|
|
|
+ maintenanceCompanyService.listByIds(companyIdList);
|
|
|
+ Map<Long, MaintenanceCompany> companyIdToMaintenanceCompany = ProjectUtils.attrToObjMap(maintenanceCompanyList, "id", null);
|
|
|
for (MtCompanyAttestation mtCompanyAttestation : mtCompanyAttestationList) {
|
|
|
CompanyAttestationResponse companyAttestationResponse = new CompanyAttestationResponse(mtCompanyAttestation);
|
|
|
//设置客户经理名称
|
|
@@ -183,12 +201,22 @@ public class MtCompanyAttestationServiceImpl extends ServiceImpl<MtCompanyAttest
|
|
|
if (userInfo != null) {
|
|
|
companyAttestationResponse.setCustomerManagerName(userInfo.getName());
|
|
|
}
|
|
|
+ //设置公司信息
|
|
|
+ MaintenanceCompany maintenanceCompany = companyIdToMaintenanceCompany.get(mtCompanyAttestation.getMtCompanyId());
|
|
|
+ if (maintenanceCompany != null) {
|
|
|
+ companyAttestationResponse.setMtCompanyId(maintenanceCompany.getId());
|
|
|
+ //是否vip
|
|
|
+ Integer vipFlag = maintenanceCompany.getVipFlag() != null ? maintenanceCompany.getVipFlag() : 0;
|
|
|
+ //电梯台量
|
|
|
+ Integer limitedNum = maintenanceCompany.getLimitedNum() != null ? maintenanceCompany.getLimitedNum() : 0;
|
|
|
+ companyAttestationResponse.setVipFlag(vipFlag);
|
|
|
+ companyAttestationResponse.setLimitedNum(limitedNum);
|
|
|
+ }
|
|
|
companyAttestationResponseList.add(companyAttestationResponse);
|
|
|
}
|
|
|
mtCompanyAttestationPage.setRecords(companyAttestationResponseList);
|
|
|
}
|
|
|
applyPageResponse.setPage(mtCompanyAttestationPage);
|
|
|
- applyPageResponse.setCount(mtCompanyAttestationPage.getTotal());
|
|
|
return RestResponse.success(applyPageResponse, ApiConstants.RESULT_SUCCESS, "获取公司申请信息成功");
|
|
|
}
|
|
|
|
|
@@ -209,7 +237,8 @@ public class MtCompanyAttestationServiceImpl extends ServiceImpl<MtCompanyAttest
|
|
|
//审核未通过
|
|
|
applyPageResponse.setApplyFailCount(statusToCount.get(ApiConstants.CompanyConstants.MAINTENANCE_FAIL));
|
|
|
//当前状态为筛选条数
|
|
|
- applyPageResponse.setCount(statusToCount.get(isCertificated));
|
|
|
+ Long count = statusToCount.get(isCertificated) == null ? 0L : statusToCount.get(isCertificated);
|
|
|
+ applyPageResponse.setCount(count);
|
|
|
}
|
|
|
|
|
|
/***
|